﻿<!--
//linked from meta include file for convenience

{
	
	//------feature------
	//remember...curpic represents the 2nd pic, not the first
	var t_imgid="rbox";	//the image 1 and image 2's ids on the page
	var t_curpic=1;
	var t_maximg=3;	
	var t_r_pause=8000;	//pause between images
	
	var t_picCollection= new Array(t_maximg);
	t_picCollection[0]="rbox1.jpg";
	//t_picCollection[1]="rbox2.jpg";
	//t_picCollection[2]="rbox4.jpg";
	//t_picCollection[2]="rbox5.jpg";
	//t_picCollection[2]="rbox6.jpg";
	//t_picCollection[3]="rbox7.jpg";
	//t_picCollection[4]="rbox8.jpg";
	t_picCollection[1]="rbox9.jpg";
	t_picCollection[2]="rbox3.jpg";
	
	var t_destination= new Array(t_maximg);
	//t_destination[0]="http://www.cupids400.com/english/legacy/index.php";
	t_destination[0]="http://www.cupids400.com/english/legacy/index.php";
	//t_destination[1]="http://www.cupids400.com/english/events/jun10.php#marquee";
	//t_destination[2]="";
	//t_destination[2]="http://www.cupids400.com/english/events/jul10.php#marquee";
	//t_destination[2]="http://www.cupids400.com/english/attractions/index.php#vacation";
	//t_destination[2]="http://www.cupids400.com/english/events/aug10.php#soiree";
	//t_destination[3]="http://www.cupids400.com/english/children.pdf";
	//t_destination[4]="http://www.cupids400.com/english/traffic.pdf";
	t_destination[1]="http://www.cupids400.com/english/events/sep10.php#a18";
	t_destination[2]="http://www.cupids400.com/english/education/iphone.php";
	
	function gotopage()
	{
		var temp="";
		
		if((t_curpic-1)<0)
		{
			temp=t_destination[t_maximg-1];
		}else{
			temp=t_destination[t_curpic-1];
		}
		if(temp!="")
		{
			document.location.href=temp;
		}
		
	}
	
	function initrotate_t()
	{	
		/*randomize*/
		var laststart;
		var randnum;
		var i=0;	//breakpoint
		
		laststart=getCookie('laststart_t');
		//laststart=1;
		
		do{
			i=i+1;
			//just in case, so it won't try too many times
			if(i>(t_maximg+3))
			{
				break;
			}
			randnum = Math.random();
			randnum=randnum*(t_maximg);
			randnum = Math.floor(randnum);			
		}while(randnum==laststart);
		
		//expire in 1 day
		setCookie('laststart_t',randnum,1);		
	
		/*end randomize*/
		
		t_curpic=randnum;
		newpic=document.getElementById(t_imgid+1);
		newpic.src=thepath+t_picCollection[t_curpic];
				//document.getElementById('test').innerHTML=t_curpic;
		if((t_curpic>=0) && (t_curpic<(t_maximg-1))){
			t_curpic=t_curpic+1;		
		}else{
			t_curpic=0;
		}
		newpic=document.getElementById(t_imgid+2);
		newpic.src=thepath+t_picCollection[t_curpic];			
			
		rotate_t(2);
	}
	
	function rotate_t(p_show)
	{
		var r_show;
		var r_hide;
		var r_obj;
		var newpic;		
		
		//show / hide pics
		if(p_show==1)
		{
			r_hide="2";
			r_show="1";
		}else{
			r_hide="1";
			r_show="2";
		}
		
		setTimeout('rfade("'+t_imgid+r_hide+'",100,'+((-1)*r_speed)+');',t_r_pause);
		setTimeout('rfade("'+t_imgid+r_show+'",0,'+r_speed+');',t_r_pause);		
			
		//start cycle again
		setTimeout('rotate_t("'+r_hide+'");',t_r_pause);
	
	}
	
	function changepic_t(p_id)
	{		
		var newpic;	
		newpic=document.getElementById(p_id);

		// rotate pics
		if((t_curpic>=0) && (t_curpic<(t_maximg-1))){
			t_curpic=t_curpic+1;		
		}else{
			t_curpic=0;
		}

		newpic.style.zIndex=1;
		//safari / mozilla
		newpic.style.opacity=(0);
		//IE
		newpic.style.filter = 'alpha(opacity=0)';
			
		newpic.src=thepath+t_picCollection[t_curpic];
	}
	
}
	
// -->
