OChaser= new ClassChaser("CC","OChaser",150,170);

function resz() {
	if (document.layers)
	history.go(0);
}

function menu() {
	document.write('<div name="CC" id="CC" width="129">');
	document.write('<table cellspacing=0 cellpadding=0 border=0>');
	document.write('<tbody>');
	for(i=0;i<menulist.length;i++) {
	menuitem(menulist[i][0],menulist[i][1],i);
	}
	document.write('</tbody></table></div>');
	var listSize=menulist.length;
var hash=(location.href.substring(0,location.href.length-1).lastIndexOf('#')>=1)?1:0;
var wanted=location.href.substring(location.href.substring(0,location.href.length-1).lastIndexOf('/')+1,(hash)?location.href.substring(0,location.href.length-1).lastIndexOf('#'):location.href.length);
	var index=0;
	while (menulist[index][1]!=wanted) 
	index++;
	chaserRollover(menulist[index][0],menulist[index][0]+'4.gif');
}

function chaserRollover(imgid,imgsrc) {
	nnstr=(document.layers)?"document.layers.CC.":"";
	eval(nnstr+"document.images['"+imgid+"'].src='images/"+imgsrc+"'");
}

function menuitem (name,ref,i) {
	t="'"+name+"','"+name+"2.gif'";
	u="'"+name+"','"+name+".gif'";
v=name+".src==location.href.substring(0,location.href.substring(0,location.href.length-1).lastIndexOf('/')+1)+'images/"+name+".gif'";
w=name+".src==location.href.substring(0,location.href.substring(0,location.href.length-1).lastIndexOf('/')+1)+'images/"+name+"2.gif'";
	x="'elMenu"+(i+1)+"'";
	y='<a onmouseover="if('+v+') chaserRollover('+t+'); dmenu_PopUp('+x+',event)" onmouseout="if('+w+') chaserRollover('+u+'); dmenu_PopDown('+x+')" href="'+ref+'">';
	document.write('<tr><td>');
	document.write(y);
	document.write('<img id='+name+' src="images/'+name+'.gif" border=0 height=25 name='+name+'>');
	document.write('</a></td></tr>');
}

function ClassChaser(divName, objName,takeOffTop, takeOffBottom) {
	//Properties
	this.objName=objName 
	this.name=divName
	this.takeOffTop=(takeOffTop!=null)?parseInt(takeOffTop):0;					//default value to 0 
	this.takeOffBottom=(takeOffBottom!=null)?parseInt(takeOffBottom):0;	
	//default value to 0 
	this.startPos											//position where the div start chasing from
	this.endPos
	//position where the div end chasing in	
	this.styleRef											//refers to div styles according to browsers
	this.divObj											//div object reference
	this.availableScrollingHeight									//available height for the div to scroll in
	this.divHeight											//chaserHeight
	this.callRate = 10
	this.slideTime = 1200
	this.A
	this.B
	this.C
	this.D
	this.interval
	this.initialised
	//methods
	this.init = m_sw_init;	
	this.findObj = m_sw_findObj;
	this.main =	m_sw_main;
	this.slide = m_sw_slide;
	this.slideInit = m_sw_slideInit;
	this.startChase = m_sw_startChase;
	}

function m_sw_init() {
	this.macstr='MacPPC';
	this.ismac = (navigator.platform == this.macstr);
	this.styleRef=(document.layers)?"":".style";
	this.divObj=this.findObj(this.name);
	//position layer
	eval("this.divObj"+this.styleRef+".top=this.takeOffTop");
	this.divHeight=(document.layers)?parseInt(this.divObj.document.height):((document.all)?parseInt(this.divObj.clientHeight):parseInt(this.divObj.offsetHeight));
	this.availableScrollingHeight=((document.all)?((this.ismac)?parseInt(document.body.offsetHeight):parseInt(document.body.scrollHeight)):parseInt(document.height))-this.takeOffTop-this.takeOffBottom-this.divHeight;
	this.startPos=this.takeOffTop;
	this.endPos=this.availableScrollingHeight+this.takeOffTop;
	this.initialised=true;
	if (!document.all) {
	eval("this.interval=setInterval(\'"+this.objName+".main()\',this.callRate)");
	//this.callRate
	}
}

function m_sw_findObj(n,d) { 
	var p,i,x;  
	if(!d) d=document; 
	if((p=n.indexOf("?"))>0&&parent.frames.length) {
    	d=parent.frames[n.substring(p+1)].document; 
	n=n.substring(0,p);
	}
	//Case IE
	if(!(x=d[n])&&d.all) 
	x=d.all[n]; 
	for (i=0;!x&&i<d.forms.length;i++) 
	x=d.forms[i][n];
	//Case NN
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) 
	x=this.findObj(n,d.layers[i].document);
	//Case NN6
	if(!x && d.getElementById) 
	x=d.getElementById(n); 
	return x;
}

function m_sw_main() {
	eval("this.currentY=parseInt(this.divObj"+this.styleRef+".top)");
	this.scrollTop= (document.all)?parseInt(document.body.scrollTop):parseInt(window.pageYOffset);
	var newTargetY= this.scrollTop +(this.startPos);
	if (this.currentY!=newTargetY) {
		if (newTargetY!= this.targetY) {
		this.targetY= newTargetY
		if (this.availableScrollingHeight>0)
		this.slideInit();
		}
	if (this.availableScrollingHeight>0)
		this.slide()
	}
}

function m_sw_slideInit() {
	var now	= new Date();
	this.A	= this.targetY - this.currentY;
	this.B	= Math.PI / ( 2 * this.slideTime);
	this.C	= now.getTime()
	if (Math.abs(this.A) > this.availableScrollingHeight) {
	this.D = this.A > 0 ? this.targetY - this.availableScrollingHeight : this.targetY + this.availableScrollingHeight
	this.A = this.A > 0 ? this.availableScrollingHeight : -this.availableScrollingHeight
	} 
	else {
	this.D = this.currentY
	}
}

function m_sw_slide() {
	var now	= new Date()
	var newY = this.A * Math.sin( this.B * ( now.getTime() - this.C ) ) + this.D
	newY = Math.round( newY )
	if (( (this.A > 0) && (newY > this.currentY) && (newY<=this.endPos)) ||
		( (this.A < 0) && (newY < this.currentY) && (newY<=this.endPos) )) {
		eval("this.divObj"+this.styleRef+".top=newY");
	}
	if ((newY==this.targetY)&& (this.interval)&&(document.all)) {
		clearInterval(this.interval)
	}
}

function m_sw_startChase() {
	if ((document.all)&&(this.initialised)) {
		if (this.interval) {	
		clearInterval(this.interval)
		}
	eval("this.interval=setInterval(\'"+this.objName+".main()\',this.callRate)");
	}
}


