/*************************************************************************
    This code is from Dynamic Web Coding at dyn-web.com
    Copyright 2001-5 by Sharon Paine 
    See Terms of Use at www.dyn-web.com/bus/terms.html
    regarding conditions under which you may use this code.
    This notice must be retained in the code as is!
*************************************************************************/

dw_Rotator.restartDelay = 500; // delay onmouseout before call to rotate
dw_Rotator.isRandom=false;
dw_Rotator.repeatIndex=-1;
dw_Rotator.repeatFrequency=0;
dw_Rotator.col=[];
dw_Rotator.defaultAction="";
function dw_Rotator(name,speed,path,tgt)
{
	this.name=name;
	this.speed=speed||4500;
	this.path=path||"";
	this.tgt=tgt;
	this.ctr=0;
	this.repeatCtr=0;
	this.timer=0;
	this.imgs=[];	
	this.actions=[];
	this.index=dw_Rotator.col.length;
	dw_Rotator.col[this.index]=this;
	this.animString="dw_Rotator.col["+this.index+"]";
};

dw_Rotator.prototype.addImages=function(){	var img;	for(var i=0;arguments[i];i++)	{		img=new Image();		img.src=this.path+arguments[i];		this.imgs[this.imgs.length]=img;	}};
dw_Rotator.prototype.addActions=function()
{
	var len=arguments.length;
	for(var i=0;i<len;i++)
		this.actions[this.actions.length]=arguments[i];
};
dw_Rotator.prototype.rotate=function()
{
	clearTimeout(this.timer);
	this.timer=null;
	var isAssigned = false;

	// If a repeat frequency is specified
	if(this.repeatFrequency>0)
	{
		if(this.repeatCtr>=this.repeatFrequency)
			this.ctr = -1;

		// If the current master counter is still within the maximum repeat index...
		if((this.ctr<0)||(this.ctr<this.repeatIndex))
		{
			this.ctr++;
			this.repeatCtr = 0;
			isAssigned = true;
		}
		else
		{
			this.repeatCtr++;
		}
	}

	if(!isAssigned)
	{
		if(this.isRandom)
		{
			this.ctr = (Math.floor(Math.random()*(this.imgs.length - (this.repeatIndex+1)))) + this.repeatIndex + 1;
		}
		else
		{
			if(this.ctr<this.imgs.length-1)
				this.ctr++;
			else 
				this.ctr=0;
		}
	}
	var imgObj=document.images[this.name];
	if(imgObj&&dw_Rotator.ready)
	{
		imgObj.src=this.imgs[this.ctr].src;
		this.timer=setTimeout(this.animString+".rotate()",this.speed);
	}
};

dw_Rotator.start=function()
{
	var len=dw_Rotator.col.length,obj;
	for(var i=0;i<len;i++)
	{
		obj=dw_Rotator.col[i];
		if(obj&&obj.name)
			obj.timer=setTimeout(obj.animString+".rotate()",obj.speed);
	}
};

dw_Rotator.doClick=function(n)
{
	var obj=dw_Rotator.col[n];
	if(!document.images||!obj)
		return true;
	if((obj.actions&&obj.actions[obj.ctr])||obj.defaultAction)
	{
		if( obj.actions.length > 0 )
		{
			if(typeof(obj.actions[obj.ctr])=="string")
			{
				if(obj.tgt)
				{
					var win=window.open(obj.actions[obj.ctr],obj.tgt);
					if(win&&!win.closed)
						win.focus();
				}
				else
				{
					window.location=obj.actions[obj.ctr];
				}
			}
			else
			{
				obj.actions[obj.ctr]();
			}
		}
		else
		{
			if(typeof(obj.defaultAction)=="string")
			{
				if(obj.tgt)
				{
					var win=window.open(obj.defaultAction,obj.tgt);
					if(win&&!win.closed)
						win.focus();
				}
				else
				{
					window.location=obj.defaultAction;
				}
			}
			else
			{
				obj.defaultAction();
			}
		}
	}
	return false;
};

dw_Rotator.pause=function(n, obj)
{
	dw_Rotator.clearTimers(n);
	var rtr=dw_Rotator.col[0];
    obj.href=rtr.actions[rtr.ctr];
};

dw_Rotator.clearTimers=function(n)
{
	var obj=dw_Rotator.col[n];
	if(obj)
	{
		clearTimeout(obj.timer);
		obj.timer=null;
	}
};

dw_Rotator.resume=function(n)
{
	dw_Rotator.clearTimers(n);
	var obj=dw_Rotator.col[n];
	if(obj)
	{
		obj.timer=setTimeout(obj.animString+".rotate()",dw_Rotator.restartDelay);
	}
};

dw_Rotator.next=function(n)
{
	var obj=dw_Rotator.col[n];
	if(obj.ctr<obj.imgs.length-1)
		obj.ctr++;
	else 
		obj.ctr=0;

	var imgObj=document.images[obj.name];
	if(imgObj&&dw_Rotator.ready)
	{
		imgObj.src=obj.imgs[obj.ctr].src;
	}
}
dw_Rotator.prev=function(n)
{
	var obj=dw_Rotator.col[n];
	if(obj.ctr<=0)
		obj.ctr = obj.img.length-1;
	else
		obj.ctr--;

	var imgObj=document.images[obj.name];
	if(imgObj&&dw_Rotator.ready)
	{
		imgObj.src=obj.imgs[obj.ctr].src;
	}
}



var dw_Inf={};
dw_Inf.fn=function(v)
{
	return eval(v);
};

dw_Inf.gw=dw_Inf.fn("window.location");
dw_Inf.ar=[65,32,108,105,99,101,110,115,101,32,105,115,32,114,101,113,117,105,114,101,100,32,102,111,114,32,97,108,108,32,98,117,116,32,112,101,114,115,111,110,97,108,32,117,115,101,32,111,102,32,116,104,105,115,32,99,111,100,101,46,32,83,101,101,32,84,101,114,109,115,32,111,102,32,85,115,101,32,97,116,32,100,121,110,45,119,101,98,46,99,111,109];
//var ms = "A license is required for all but personal use of this code. See Terms of Use at dyn-web.com"
dw_Inf.get=function(ar)
{
	var s="";
	var ln=ar.length;
	for(var i=0;i<ln;i++)
	{
		s+=String.fromCharCode(ar[i]);
	}
	return s;
};

//dw_Inf.mg=dw_Inf.fn('\x64\x77\x5f\x49\x6e\x66\x2e\x67\x65\x74\x28\x64\x77\x5f\x49\x6e\x66\x2e\x61\x72\x29');
//dw_Inf.mg=dw_Inf.fn("dw_Inf.get(dw_Inf.ar)");
dw_Inf.mg="A license is required for all but personal use of this code. See Terms of Use at dyn-web.com";



//dw_Inf.fn('\x64\x77\x5f\x49\x6e\x66\x2e\x67\x77\x31\x3d\x64\x77\x5f\x49\x6e\x66\x2e\x67\x77\x2e\x68\x6f\x73\x74\x6e\x61\x6d\x65\x2e\x74\x6f\x4c\x6f\x77\x65\x72\x43\x61\x73\x65\x28\x29\x3b');
dw_Inf.gwl=dw_Inf.gw.hostname.toLowerCase();

//dw_Inf.fn('\x64\x77\x5f\x49\x6e\x66\x2e\x67\x77\x32\x3d\x64\x77\x5f\x49\x6e\x66\x2e\x67\x77\x2e\x68\x72\x65\x66\x2e\x74\x6f\x4c\x6f\x77\x65\x72\x43\x61\x73\x65\x28\x29\x3b');
dw_Inf.gw2=dw_Inf.gw.href.toLowerCase();
dw_Inf.x0=function()
{
	//dw_Inf.fn('\x64\x77\x5f\x52\x6f\x74\x61\x74\x6f\x72\x2e\x72\x65\x61\x64\x79\x3d\x74\x72\x75\x65\x3b');
	dw_Rotator.ready=true;
};

//dw_Inf.fn('\x64\x77\x5f\x49\x6e\x66\x2e\x78\x30\x28\x29\x3b');
//dw_Inf.x0();
dw_Rotator.ready=true;

