/*
Fading Scroller- By DynamicDrive.com
For full source code, 100's more DHTML scripts, and TOS,
visit http://www.dynamicdrive.com
*/

var delay=3000 //set delay between message change (in miliseconds)
var frame=0;
var idTo;
var idTo2;
begintag='<font face="verdana" size=2>' //set opening tag, such as font declarations
closetag='</font>';
/*begintag='' //set opening tag, such as font declarations
closetag='';*/

/*var fcontent=new Array()
fcontent[0]="We program in all forms of HTML, PHP, ASP, Javascript, CSS, and CGI. Paired with our graphic design and multimedia capabilities, we can work with you to build and market the best possible website for your company."
fcontent[1]="<strong>Hosting</strong><br>Discounts are offered on our six month and one year hosting plans. Get your new full featured hosting plan started today by using your Visa or Mastercard!"
fcontent[2]="For more templates check out our Flash, Swish and HTML website templates at <a href=http://www.e-xerit.org/>FinerDesign.com</a>"
closetag='</font>'*/

var fwidth="100%"//set scroller width
var fheight="25" //set scroller height

///No need to edit below this line/////////////////

var ie4=document.all&&!document.getElementById
var ns4=document.layers
var DOM2=document.getElementById
var faderdelay=3000;
var index=-1;

if (DOM2)
faderdelay=3000
function pause(millisecondi)
{
	var now = new Date();
	var exitTime = now.getTime() + millisecondi;

	while(true)
	{
		now = new Date();
		if(now.getTime() > exitTime) return;
	}
}
//function to change content
function changecontent()
{
	if (index==(fcontent.length-1))
		index=-1
	index++
	if (DOM2)
	{
		document.getElementById("fscroller").style.color="rgb(255,255,255)"
		document.getElementById("fscroller").innerHTML=begintag+fcontent[index]+closetag
	}
	else if (ie4)
		document.all.fscroller.innerHTML=begintag+fcontent[index]+closetag
	else if (ns4)
	{
		document.fscrollerns.document.fscrollerns_sub.document.write(begintag+fcontent[index]+closetag)
		document.fscrollerns.document.fscrollerns_sub.document.close()
	}	
	
}

// colorfade() partially by Marcio Galli for Netscape Communications.  ////////////
// Modified by Dynamicdrive.com

//frame=parseInt(document.getElementById("fscroller").style.offsetWidth)/10;

hex=255;  // Initial color value.

function colorfade() 
{	         	
	// 20 frames fading process
	if(frame>0) 
	{	
		hex-=12; // increase color value
		document.getElementById("fscroller").style.color="rgb("+hex+","+hex+","+hex+")"; // Set color value.
		frame--;
		setTimeout("colorfade()",20);	
	}
	else
	{
		document.getElementById("fscroller").style.color="rgb(0,0,0)";
		frame=20;
		hex=255
	}   
}
function move() 
{	         	
	// 20 frames fading process
	clearTimeout(idTo2);
	if(frame>0) 
	{	
		// identifica la posizione dell'elemento
		obj=document.getElementById("fscroller");
		x=obj.style.left;
		
		// setta la nuova posizione
		newpos=parseInt(x)-10;
		obj.style.left=newpos+"px";
		//window.status="Frame=> "+frame+"Valore => "+newpos+"px";
		frame--;
		idTo=setTimeout("move()",50);	
	}
	else
	{
		obj.style.left=origx;
		//frame=stripHTML(fcontent[index]).length;
		hex=255
		clearTimeout(idTo);
		begscroll();
	}   
}
function include(script_filename) {
    document.write('<' + 'script');
    document.write(' language="javascript"');
    document.write(' type="text/javascript"');
    document.write(' src="' + script_filename + '">');
    document.write('</' + 'script' + '>');
}
function begscroll()
{
	changecontent();
	frame=stripHTML(fcontent[index]).length;
	idTo2=setTimeout("move()",3000);
}
function stripHTML(obj)
{
	var re = /(<([^>]+)>)/gi;
	//alert("prodotto: "+obj);
	for (i=0; i<obj.length; i++)
	return obj.replace(re, "")
}
if (ie4||DOM2)
document.write('<div id="pippo" style="position:relative;overflow:hidden; width:100%; height:25px; clip:rect(100 100 200 100);"><div id="fscroller" style="position:relative;left:0px;border:0px solid black;width:'+fwidth+'px;height:'+fheight+'px;padding:2px"></div></div>');
var origx=document.getElementById("fscroller").style.left;
//alert(document.getElementById("fscroller").style.width);
window.onload=function ()
{
	if(typeof(nifty)=="boolean" && nifty==true)
	{
		Nifty("div#box,div#box2,div#box3,div#box4","medium");
		nifty=false;
	}
	if (!window.$) {
		window.$ = function(id) { return document.getElementById(id); }
	}
	var t = new Date().getTime();
	/*for(idx in arrBordi)
	{
		//alert(arrBordi[idx]);
		eval("shadowedBorder.render('"+arrBordi[idx]+"');");
	}*/
	begscroll();
}
