function disableLink(e) {     // cancels the event    
e.preventDefault();
} 
onload=function() {doButtons('image1');}
//Stores all of the Element IDs
	ie5 = (document.all && document.getElementById);
	ns6 = (!document.all && document.getElementById);
//Creates the new iamges on the fly when called
	var image1 = new Image();
	var image2 = new Image();
	var image3 = new Image();
	var image4 = new Image();
	var image5 = new Image();
//IMAGE 1 VALUES	
	image1.src = "/images/hp-banner-958x200-4G-boost.png";
	image1.alt = "Giving 4G a Boost";
	image1href = "http://support.sasktel.com/app/answers/detail/a_id/15319?Link=MainBanner-4GImprovements&amp;campaign=Home";
//IMAGE 2 VALUES
	image2.src = "/images/hp-banner-958x200-liveexpert-20111117.png";
	image2.alt = "SaskTel LiveExpert";
	image2href = "/search/controller/_/Ntt-promo-hs-liveexpert?Link=MainBanner-LiveExpert&amp;campaign=Home";
//IMAGE 3 VALUES
	image3.src = "/images/hp-banner-958x200-iphone4S-launch.png";
	image3.alt = "iPhone 4S";
	image3href = "/search/controller//Apple-iPhone-4S-16GB/_/R-Product_Services_Apple_iPhone_4S_16GB?Link=MainBanner-iphone4S&amp;campaign=Home";
//IMAGE 4 VALUES	
	image4.src = "/images/hp-banner-max-dtvr-spin-20110929.png";
	image4.alt = "Take Max with DTVR for a spin! Max including DTVR $29/mo. for three months";
	image4href = "/search/controller/_/Ntt-three-months-residential-Max/Ntx-mode+matchany%7C?Link=MainBanner-TakeDTVRforSpin&campaign=Home";
//IMAGE 5 VALUES	
	image5.src = "/images/hp-banner-958x200-hs-surf-save-smile-20110908.png";
	image5.alt = "Surf. Save. Smile. SaskTel High Speed Internet $9.95/mo. for three months.";
	image5href = "/search/controller/_/Tab-4294966321/Ntt-high-speed-internet-promotions?Link=MainBannerSurfSaveSmile&amp;campaign=Home";


//GLOBAL VARIABLES
	i=1;//variable used in the autoImage function to determin which image to start the rotation on.	
	t="";//variable used to initialize the timeout function,
function pause() {
	//This function stops the rotation and hides the pause button, which allows the play button underneath to show through.
	clearTimeout(t);
	document.getElementById('bannerImageOptionsPause').style.visibility = "hidden";
}
function play() {
	//This function start the rotation back up, on the next image, and displayse the pause button again.
	document.getElementById('bannerImageOptionsPause').style.visibility = "visible";
	clearTimeout(t);
	autoImage();
}
function autoImage() {
	//This function runs a loop 4 times automatically switching the images from 1-4.
	i=i+1;
	if (i==6){i=1;}
	imageChange = "image" + i;
	doButtons(imageChange);
}
function fadeIn() {
	//This function is used to fade in the image.  Because the loop runs so quickly it needs to delay the next step, so that the fade is visible, otherwise it would fade so quickly you wouldn't even notice it.
	opac=0;
	counter = 0;
	interval=setInterval('if(counter<100){delay();counter++;}else{clearInterval(interval);}', 25);
}
function delay(){ 
	//This is the function that delays the fadeIn loop to allow you to see the image slowly fade in.
		opac=opac+1;
        if(ie5){document.getElementById('bannerImages').filters.alpha.opacity = opac;}
        if(ns6){document.getElementById('bannerImages').style.MozOpacity = opac/100;}
}
function doButtons(picimage) {
		//This function sets the images to appear on demand.
		document.getElementById('bannerImageOptionsPause').style.visibility = "visible";
		$(".bannerimage1").css("background-color","#F9F9F9");
		$(".bannerimage2").css("background-color","#F9F9F9");
		$(".bannerimage3").css("background-color","#F9F9F9");
		$(".bannerimage4").css("background-color","#F9F9F9");
		$(".bannerimage5").css("background-color","#F9F9F9");
		clearTimeout(t);
		if(ie5){document.getElementById('bannerImages').filters.alpha.opacity = 0;}
        if(ns6){document.getElementById('bannerImages').style.MozOpacity = 0;}
		eval("document['picture'].src = " + picimage + ".src");
		eval("document['picture'].alt = " + picimage + ".alt");
		document.getElementById('pictureURL').href = window[picimage+'href'];
		$(".banner"+picimage).css("background-color","#CCC");
		//If all the images are using the standard background with a white page flip use this Line and comment out the If and Else statements $('#bannerContainer').css("background-image","url(/images/banner-bg-full-white.gif)");$('#bannerImages').css("background-image","url(/images/banner-bg-full-white.gif)");$('#pictureURL').unbind('click', disableLink);$('#pictureURL').css("cursor","pointer");
		if(picimage == "image3"){$('#bannerContainer').css("background-image","url(/images/banner-bg-start.gif)");$(".bannerimage2").css("display","none");$(".bannerimage1").css("display","none");$(".bannerimage3").css("display","none");$(".bannerimage4").css("display","none");$(".bannerimage5").css("display","none");$(".bannerimagePlay").css("display","none");document.getElementById('bannerImageOptionsPause').style.visibility = "hidden";}//This is changing the background of the first Image to be the plain white background without the page flip.  Change the picImage == to a different number if the image you want to have a different background is not in the first sequence.
		else {$('#bannerContainer').css("background-image","url(/images/banner-bg-full-white.gif)");$('#bannerImages').css("background-image","url(/images/banner-bg-full-white.gif)");$('#pictureURL').unbind('click', disableLink);$('#pictureURL').css("cursor","pointer");$(".bannerimage1").css("display","block");$(".bannerimage2").css("display","block");$(".bannerimage3").css("display","block");$(".bannerimage4").css("display","block");$(".bannerimage5").css("display","block");$(".bannerimagePlay").css("display","block");$(".bannerImageOptionsPause").css("display","block");}//This is setting all the other images should have the regular page flip background.
		t = setTimeout(autoImage,7000);
		fadeIn();
}
