<!--  	13/06/2007   animate.js   //-->
/* Requires macros.js */
//alert('Start animate.js');
 
v=new Array();

function loadImagePairsJpg(){
/*************************************************************************
	Pre-load jpg images by filename                                   		
*************************************************************************/
if (document.images){
   	for (var i=0;i<arguments.length;i++){
   		eval('v["'+arguments[i]+'1"]=new Image()');
   		eval('v["'+arguments[i]+'1"].src="images/'+arguments[i]+'1.jpg"');
   		eval('v["'+arguments[i]+'2"]=new Image()');
   		eval('v["'+arguments[i]+'2"].src="images/'+arguments[i]+'0.jpg"');
		//confirm('v['+i+']\n'+arguments[i]+'1.src='+eval('v["'+arguments[i]+'1"].src')+'\n'+arguments[i]+'2.src='+eval('v["'+arguments[i]+'2"].src'));
 		}
	}
}
function ro1(){
/*************************************************************************
	Mouse rollout image                                  		
*************************************************************************/
	if(document.layers){imgobj=(find_ns_object('images',arguments[0]));}
	else{imgobj='document.'+arguments[0];}
	eval(imgobj+'.src=v["'+arguments[0]+'1"].src');
	}

function ro0(){
/*************************************************************************
	Mouse rollout image                                  		
*************************************************************************/
	if(document.layers){imgobj=(find_ns_object('images',arguments[0]));}
	else{imgobj='document.'+arguments[0];}
	eval(imgobj+'.src=v["'+arguments[0]+'2"].src');
	}


function loadImagePairsGif(){
/*************************************************************************
	Pre-load gif images by filename                                   		
*************************************************************************/
if (document.images){
   	for (var i=0;i<arguments.length;i++){
   		eval('v["'+arguments[i]+'1"]=new Image()');
   		eval('v["'+arguments[i]+'1"].src="images/'+arguments[i]+'1.gif"');
   		eval('v["'+arguments[i]+'2"]=new Image()');
   		eval('v["'+arguments[i]+'2"].src="images/'+arguments[i]+'2.gif"');
		//confirm('v['+i+']\n'+arguments[i]+'1.src='+eval('v["'+arguments[i]+'1"].src')+'\n'+arguments[i]+'2.src='+eval('v["'+arguments[i]+'2"].src'));
 		}
	}
}

function changeImages(){if (document.images) {
/************************************************************************
changeImages                                        		
Syntax: changeImages(imgname,filename.ext)			 	
*************************************************************************/
for (var i=0;i<changeImages.arguments.length;i+=2) {
	//alert('document.'+changeImages.arguments[i]+'.src="images/'+arguments[1]+'"');
	eval('document.'+changeImages.arguments[i]+'.src="images/'+arguments[1]+'"');
	}}
}

function rollover(){
/*************************************************************************
	Mouse rollover image                                  		
*************************************************************************/
	anImage=arguments[0]
	if(document.layers){imgobj=(find_ns_object('images',anImage));}
	else{imgobj='document.'+anImage;}
	eval(imgobj+'.src=v["'+anImage+'1"].src');
	}

function rollout(){
/*************************************************************************
	Mouse rollout image                                  		
*************************************************************************/
	anImage=arguments[0]
	if(document.layers){imgobj=(find_ns_object('images',anImage));}
	else{imgobj='document.'+anImage;}
	eval(imgobj+'.src=v["'+anImage+'2"].src');
	}



var howQuick=1;
var iWhere=0;
function scrollBackGround(){
/******************************************************************
function to scroll background image
	place only in body 
******************************************************************/
if(!document.layers){
	iWhere=iWhere+1;
	if (iWhere>1000000) iWhere=1;
	// move down
	// document.body.style.backgroundPosition="0 "+iWhere;
	// move up
	document.body.style.backgroundPosition="0 "+(iWhere*(-1));
	// move right
	// document.body.style.backgroundPosition=iWhere+" 0" ;
	// move left
	//document.body.style.backgroundPosition=(iWhere*(-1))+" 0" ;
	window.setTimeout("scrollBackGround()",howQuick);
	}
}


function pulse() {
/******************************************************************
	function to play animation of image object			
	function pulse(image_name,start_width,start_height,final_width,final_height,delay,increment)	
******************************************************************/
  	if (typeof $r110 !='undefined') {clearTimeout($r110);}
	incr    	=arguments[6];
	delay   	=arguments[5];
	YY   		=arguments[4];
	XX   		=arguments[3];
	newY 		=arguments[2];
	newX 		=arguments[1];
	animage 	=arguments[0];
	if(document.layers){imgobj=(find_ns_object('images',animage));}
	else{imgobj='document.'+animage;}

	eval(imgobj+".width="+newX);

	eval(imgobj+".height="+newY);
	if(newY>=YY){
		xoffset=0;
		yoffset=(incr*(-1));
		if(newX>XX*19/20){
			if(newY!=YY){xoffset=Math.round(yoffset*(XX-newX)/(YY-newY));}
			else		{xoffset=Math.round(yoffset*XX/YY);}
			}
		}
	if(newY<YY*19/20){
		xoffset=0;
		yoffset=(incr);
		if(newX<XX){
			xoffset=Math.round(yoffset*(XX-newX)/(YY-newY));
			}
		}
	//Warning: an alert will be caught in an endless loop!
	self.status='pulse='+(newX+xoffset)+' '+(newY+yoffset)+'  x:'+xoffset+' y:'+yoffset;
	$r110=setTimeout('pulse(animage,newX+xoffset,newY+yoffset,XX,YY,delay,incr);',delay);
	}
/******* end Function ******************************************/


function fillImg() {
/******************************************************************
function to play animation of image object			
syntax: fitImg($imageName,$img,newX,newY,divwidth,divheight,increment)	
******************************************************************/
	YY   		=arguments[5];
	XX   		=arguments[4];
	newY 		=arguments[3];
	newX 		=arguments[2];
	//confirm(self_url()+'/animate.src/fillImg:\narguments[0]=\n'+arguments[0]+'\nnewX='+newX+', newY='+newY+'\nXX='+XX+', YY='+YY);
	if(newY!=YY||newX!=XX){imgLoad(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4]);}	
	}
/******* end Function ******************************************/


function fitImg() {
/******************************************************************
function to play animation of image object			
syntax: fitImg($imageName,$img,divwidth,divheight,increment)	
******************************************************************/
 	imgLoad(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4]);	
	}




function imgLoad(){
/******************************************************************************
Syntax: imgLoad($imageName,$img,divwidth,divheight,incr)
******************************************************************************/
   	if (typeof $r1 !='undefined') {clearTimeout($r1);}
	incr    	=arguments[4];
	YY 	  	=arguments[3];
	XX 		=arguments[2];
	$img	 	=arguments[1];
	$imageName 	=arguments[0];
// define front picdiv from arguments[0]
	if(document.layers){imgobj=(find_ns_object('images',$imageName));}
	else	{imgobj='document.'+$imageName;}
// load $img into back picdiv, 'pix2'
	if(document.layers){picobj=(find_ns_object('images','pix2'));}
	else 	{picobj='document.pix2';}
	eval(picobj+".src=\'"+$img+"\'");
	//confirm(self_url()+'/animate.src/imgLoad:\npicobj.src='+eval(picobj+'.src')+'\nimgobj.src='+eval(imgobj+'.src')+'\nincr='+incr+'\ndivwidth='+XX+'\ndivheight='+YY);
	vv 		=new Image(); 
	vv.src 		=$img; 
	if(vv.complete){
		//confirm(self_url()+'/animate.src/imgLoad:\nvv.src='+vv.src+'\nvv.width='+vv.width+'\nvv.height='+vv.height+'\ndivwidth='+XX+'\ndivheight='+YY);
		//resizeImg(imgobj,picobj,$img,XX,YY,incr);
		$r1=setTimeout('resizeImg(\''+imgobj+'\',\''+picobj+'\',\''+$img+'\',XX,YY,incr)',10);
		}	
	//else{
		//confirm(self_url()+'/animate.src/setTimeout/imgLoad:\n$imageName='+$imageName+'\nXX='+XX+'\nYY='+YY+'\nincr='+incr);
		//$r1=setTimeout('imgLoad(\''+$imageName+'\',\''+$img+'\',XX,YY,incr)',2);
		//}
	}



function resizeImg() {
/******************************************************************
Syntax: resizeImg(pix1name,pix2name,divwidth,divheight,incr)	
******************************************************************/
 	//confirm(self_url()+'/animate.src/resizeImg:\nvwidth='+vv.width+'\nvheight='+vv.height);
 	incr    	=arguments[5];
	YY 	  	=arguments[4];
	XX 		=arguments[3];
	$img	 	=arguments[2];
	picobj 		=arguments[1];
	imgobj 		=arguments[0];
	XXX=eval(picobj+".width");
	YYY=eval(picobj+".height");
	//XXX=arguments[1].width;
	//YYY=arguments[1].height;
	xx=eval(imgobj+".width");
	yy=eval(imgobj+".height");
	if((XXX/YYY)>(XX/YY))	{YY=Math.round(YYY*XX/XXX);}
	else			{XX=Math.round(XXX*YY/YYY);}
	//confirm(self_url()+'/animate.src/resizeImg:\npicobj.src='+eval(picobj+'.src')+'\nimgobj.src='+eval(imgobj+'.src')+'\npicobj.width='+XXX+'\npicobj.height='+YYY+'\nimgobj.width='+xx+'\nimgobj.height='+yy+'\ndivobj.width='+arguments[3]+'\ndivobj.height='+arguments[4]+'\nfinal_width='+XX+'\nfinal_height='+YY+'\nxx='+(xx)+', yy='+(yy)+'==>>XX='+XX+', YY='+YY);
	//eval(imgobj+".src=\'"+$img+"\'");
	if(yy!=YY||xx!=XX){resize$Img(imgobj,xx,yy,XX,YY,incr);}
	//else{confirm(self_url()+'/navbar/navBar/Line51:\nimgobj='+imgobj+'\nimgobj.width='+xx+'\nimgobj.height='+yy+'\npicobj='+picobj+'\npicobj.width='+XXX+'\npicobj.height='+YYY+'\ndivobj.width='+arguments[3]+'\ndivobj.height='+arguments[4]);}
	}
/******* end Function ******************************************/



function resize$Img() {
/******************************************************************
Syntax: resize$Img(imgobj,newX,newY,XX,YY,incr)	
Syntax: resize$Img(image_name,start_width,start_height,final_width,final_height,increment)	
******************************************************************/
   	if (typeof $r !='undefined') {clearTimeout($r2);}
	var incr  	=arguments[5];
	var YY   	=arguments[4];
	var XX   	=arguments[3];
	//var yy 	=arguments[2];
	//var xx 	=arguments[1];
	newY 		=arguments[2];
	newX 		=arguments[1];
	imgobj 		=arguments[0];
	//confirm('resize$Img:\narguments[0]='+imgobj+'\narguments[1]='+$img+'\nfinal_width='+XX+'\nfinal_height='+YY+'\nnewX='+(newX)+' newY='+(newY)+' XX='+XX+' YY='+YY);
	eval(imgobj+".width="+newX);
	eval(imgobj+".height="+newY);
	xoffset=0;
	yoffset=0;
	if(newY>YY){
		yoffset=(((newY-YY)<incr)?(YY-newY):(incr*(-1)));
		//yoffset=(((newY-YY)<Math.round(incr*XX/YY))?(YY-newY):(Math.round(incr*XX/YY)*(-1)));
		}
	else{if(newY<YY){
		yoffset=(((YY-newY)<incr)?(YY-newY):(incr));
		//yoffset=(((YY-newY)<Math.round(incr*YY/XX))?(YY-newY):(Math.round(incr*YY/XX)));
		}}
	if(newX>XX){
		xoffset=(((newX-XX)<incr)?(XX-newX):(incr*(-1)));
		//xoffset=(((newX-XX)<Math.round(incr*YY/XX))?(XX-newX):(Math.round(incr*YY/XX)*(-1)));
		}
	else{if(newX<XX){
		xoffset=(((XX-newX)<incr)?(XX-newX):(incr));
		//xoffset=(((XX-newX)<Math.round(incr*XX/YY))?(XX-newX):(Math.round(incr*XX/YY)));
		}}
	self.status='resize$Img('+(arguments[0])+','+(arguments[1])+','+(arguments[2])+','+(arguments[3])+','+(arguments[4])+')';
	if(newY!=YY||newX!=XX){
		$r2=setTimeout('resize$Img(imgobj,newX+xoffset,newY+yoffset,XX,YY,incr);',1);
		}
	}
/******* end Function ******************************************/



function resizeImage(evt,name){
/******************************************************************
	function to drag-resize image object					
******************************************************************/
	newX=evt.x;
	newY=evt.y;
	eval("document."+name+".width=newX");
	eval("document."+name+".height=newY");
	}
/******* end Function ******************************************/



function pause() {
/******************************************************************
Syntax: pause(msec)	
******************************************************************/
$start=new Date();
var $now=null;
do {	var $now=new Date(); } 
	while($now-$start<arguments[0]);
	} 
/******* end Function ******************************************/


function imgLoadCheckImg(){
/******************************************************************************
Syntax: imgLoadCheckImg($img)
******************************************************************************/
   	if (typeof $rz !='undefined') {clearTimeout($rz);}
	var $loaded=false; 
	if(arguments[0]){
		var v=new Image(); 
		v.src=arguments[0]; 
		if(v.complete){$loaded=true;}
		if(!$loaded){$rz=setTimeout('imgLoadCheckImg(\''+v.src+'\')',400);}
		}
	//confirm('imgLoadCheckImg'+arguments[0]+'='+$loaded+'\n$img='+arguments[0]+'\nv.src='+v.src);
	return($loaded);
	}





function vpix() {
/******************************************************************
	function to play animation of .src image objects			
	function vpix(animage,delay,maxno,imgno)				
******************************************************************/
	imgno=0; if(arguments[3]){imgno=arguments[3];}
	maxno=1; if(arguments[2]){maxno=arguments[2];}
	delay=arguments[1];
	animage=arguments[0];
	eval('document.'+arguments[0]+'.src='+arguments[0]+imgno+'.src');
 	//comfirm(request.self_url()+':\n'+animage+','+imgno+','+delay+','+maxno+','+imgno);
	imgno+=1;
 	if (imgno<maxno){var vs=setTimeout('vpix(animage,delay,maxno,imgno);',delay);}else{imgno=0;}
	}
/******* end Function ********************************************/


function gpix() {
/******************************************************************
	function to play animation of .gifs                  		
	function gpix(animage,delay,maxno,imgno)				
******************************************************************/
	imgArray=new Array();
	imgno=0; if(arguments[3]){imgno=arguments[3];}
	maxno=1; if(arguments[2]){maxno=arguments[2];}
	delay=arguments[1];
	animage=arguments[0];
	eval('imgArray["'+animage+imgno+'"]=new Image()');
   	eval('imgArray["'+animage+imgno+'"].src="images/'+animage+imgno+'.gif"');
     	eval('document.'+arguments[0]+".src=imgArray['"+animage+imgno+"'].src");
 	//alert(request.self_url()+':\n'+animage+imgno+','+delay+','+maxno+','+imgno);
	imgno+=1;
 	if (imgno<maxno){var vs=setTimeout('gpix(animage,delay,maxno,imgno);',delay);}else{imgno=0;}
	}
/******* end Function ********************************************/


function changeBg(){
/******************************************************************
	function changeBg(selection,acolor)                     	
	Syntax: changeBg(menu1,bgcolor)		             	
******************************************************************/
	if(document.layers){eval('document.layers.'+selection+'.bgColor="'+acolor+'"');}
	else{eval('document.all.'+selection+'.style.backgroundColor="'+acolor+'"');}
	}
/******* end Function ********************************************/



function JSClock() {
/******************************************************************
	Digital Clock Object
	amended for Netscape compatibility 
******************************************************************/
	$docpath=docTagnameById ('forms',arguments[0]);
	if($docpath!=''){$jsclock($docpath);}
	}
function $jsclock() {
	$docpath=arguments[0];
	var time=new Date();
	var hour=time.getHours();
	var minute=time.getMinutes();
	var second=time.getSeconds();
	var $time=((hour>12) ? hour - 12 : hour);
	$time+=((minute < 10) ? ":0" : ":")+minute;
	$time+=((second < 10) ? ":0" : ":")+second;
	$time+=(hour>=12) ? "pm" : "am";
	//Warning: the following alert will be caught in an endless loop!
	//confirm('JSClock\n'+$docpath+'.digits.value="'+$time+'";')?clearTimeout(id):continue;
	eval($docpath+'.digits.value="'+$time+'";');
	id=setTimeout('$jsclock("'+$docpath+'")',1000);
	}
//alert('End of animate.js');