﻿<!--
//linked from meta include file for convenience

{
	//------sponsors------
	//remember...curpic represents the 2nd pic, not the first
	var imgid="rimg";	//the image 1 and image 2's ids on the page
	var curpic=1;
	var maximg=6;	
	var r_pause=6000;	//pause between images
	
	
	var picCollection= new Array(maximg);
	picCollection[0]="sponsors1.gif";
	picCollection[1]="sponsors2.gif";
	picCollection[2]="sponsors3.gif";
	picCollection[3]="sponsors4.gif";
	picCollection[4]="sponsors5.gif";
	picCollection[5]="sponsors6.gif";
	
	var destination= new Array(maximg);
	destination[0]="http://www.screechrum.com/";
	destination[1]="http://www.newfoundlandpower.com/";
	destination[2]="http://www.molsoncoors.com/";
	destination[3]="http://www.pch.gc.ca/eng/1266037002102/1265993639778";
	destination[4]="http://www.gov.nl.ca/";
	destination[5]="http://www.acoa-apeca.gc.ca/English/Pages/Home.aspx";
	
	function gotosponsor()
	{
		var temp="";
		
		if((curpic-1)<0)
		{
			temp=destination[maximg-1];
		}else{
			temp=destination[curpic-1];
		}
		
		if(temp!="")
		{
			window.open(temp,"sponsors");
		}
		
		//document.location.href=temp;
		
	}
	
	function initrotate()
	{	
		/*randomize*/
		var laststart;
		var randnum;
		var i=0;	//breakpoint
				
		laststart=getCookie('laststart');
		//laststart=1;
		
		do{
			i=i+1;
			//just in case, so it won't try too many times
			if(i>(maximg+3))
			{
				break;
			}
			randnum = Math.random();
			randnum=randnum*(maximg);
			randnum = Math.floor(randnum);			
		}while(randnum==laststart);
		
		//expire in 1 day
		setCookie('laststart',randnum,1);		
	
		/*end randomize*/
		
		curpic=randnum;
		newpic=document.getElementById(imgid+1);
		newpic.src=thepath+picCollection[curpic];
				//document.getElementById('test').innerHTML=curpic;
		if((curpic>=0) && (curpic<(maximg-1))){
			curpic=curpic+1;		
		}else{
			curpic=0;
		}
		newpic=document.getElementById(imgid+2);
		newpic.src=thepath+picCollection[curpic];			
			
		rotate(2);
	}
	
	function rotate(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("'+imgid+r_hide+'",100,'+((-1)*r_speed)+');',r_pause);
		setTimeout('rfade("'+imgid+r_show+'",0,'+r_speed+');',r_pause);		
			
		//start cycle again
		setTimeout('rotate("'+r_hide+'");',r_pause);
	
	}
	
	function changepic(p_id)
	{		
		var newpic;	
		newpic=document.getElementById(p_id);

		// rotate pics
		if((curpic>=0) && (curpic<(maximg-1))){
			curpic=curpic+1;		
		}else{
			curpic=0;
		}
				
		//alert(curpic);
		newpic.style.zIndex=1;
		//safari / mozilla
		newpic.style.opacity=(0);
		//IE
		newpic.style.filter = 'alpha(opacity=0)';
			
		newpic.src=thepath+picCollection[curpic];
	}
}
	
// -->