
//
//		Image Rotator Setup	
//		

		<!-- Rotating Clickable Promotion Image -->

		//Booking Block Rotator
		var timeDelay = 10;  // change delay time in seconds
		var Pix = new Array("images/ra_base2.jpg");
		var Dest1 = new Array("","","","","","");
		var Dest2 = new Array("","","","","","");
		var iMap1 = new Array("","","","","","");
		var iMap2 = new Array("","","","","","");
		var Delay = new Array(6,6,6,6,6,6);
		var timerID = setInterval("slideshow()", 3000);
		clearInterval(timerID);

		//Mission Block Rotator
		var timeDelay2 = 10;  // change delay time in seconds
		var Pix2 = new Array("images/services_AirlineServices.jpg","images/services_Engineering.jpg","images/services_Freight.jpg","images/services_MiningOilGas.jpg","images/services_SpecialMission.jpg");
		var Dest1a = new Array("airline_services.htm","engineering.htm","freight.htm","omg.htm","mission.htm","");
		var Dest2a = new Array("","","","","","");
		var iMap1a = new Array("0,0,273,123","0,0,273,123","0,0,273,123","0,0,273,123","0,0,273,123","");
		var iMap2a = new Array("","","","","","");
		var Delay2 = new Array(6,6,6,6,6,6);
		var timerID2 = setInterval("slideshow2()", 3000);
		clearInterval(timerID2);

		// 3rd Image Panel
		var timeDelay3 = 10; // change delay time in seconds
		var Pix3 = new Array("images/community_canteen.jpg","images/community_legacy.jpg");
		var Dest1b = new Array("","","");
		var Dest2b = new Array("","","");
		var iMap1b = new Array("","","");
		var iMap2b = new Array("","","");
		var Delay3 = new Array(10,10,6);
		var timerID3 = setInterval("slideshow3()", 3000);
		clearInterval(timerID3);	

		
//	---------------------------------------------------------------------------------------------------------------------------------------		
//
//		News Ticker	Setup	
//		
			news_item = new Array();
			news_id = new Array();
			var current_news;

				news_item[0]= '10 December 2009: Cobham wins A$170m Chevron Deal ';
				news_item[1]= '29 October 2009: Cobham turns 75';
				news_item[2]= '19 November 2009: Cobham launches Kambalda RPT Service';
				news_item[3]= '4 December 2009: Cobham Named One of Britain’s 10 “Most Admired Companies”';
				news_item[4]= '18 December 2009: Cobham launches new website & online booking engine'

				
				news_id[0] = "news/ChevronFixedWingContractFactSheet_8-12-09.pdf";
				news_id[1] = "http://www.cobham75.com";
				news_id[2] = "news/Kambala_RPT_Service_19-11-09.pdf";
				news_id[3] = "http://www.cobham.com/media/96668/314%20-%20cobham%20named%20one%20of%20britain's%2010%20most%20admired%20companies.pdf";
				news_id[4] = "";
			
//	---------------------------------------------------------------------------------------------------------------------------------------		

//
//		Image Rotator Functions
//		

		// Booking Block Rotator
		var howMany = Pix.length;
		var PicCurrentNum = 0;
		timeDelay=Delay[PicCurrentNum]*1000;	
		var PicCurrent = new Image();
		PicCurrent.src = Pix[PicCurrentNum];

		// Bottom Promo Panel
		var howMany2 = Pix2.length;
		var PicCurrentNum2 = 0;
		timeDelay2=Delay2[PicCurrentNum2]*1000;	
		var PicCurrent2 = new Image();
		PicCurrent2.src = Pix2[PicCurrentNum2];
		
		// Banner Promo Panel
		var howMany3 = Pix3.length;
		var PicCurrentNum3 = 0;
		timeDelay3=Delay3[PicCurrentNum3]*1000;	
		var PicCurrent3 = new Image();
		PicCurrent3.src = Pix3[PicCurrentNum3];

		function startPix() {
		timerID = setInterval("slideshow()", timeDelay);
		createImageMap();
		document["ChangingPix"].src  = Pix[0];

		timerID2 = setInterval("slideshow2()", timeDelay2);
		createImageMap2();
		document["ChangingPix2"].src  = Pix2[0];

		timerID3 = setInterval("slideshow3()", timeDelay3);
		createImageMap3();
		document["ChangingPix3"].src  = Pix3[0];
		}
		
		function actionLink(linkDest)	{
		alert("Link To " + linkDest);
		
		if(linkDest != "")
			window.location=linkDest;
		}
		
		function slideshow() {
		clearInterval(timerID);	
		PicCurrentNum++;
		if (PicCurrentNum == howMany) {
		PicCurrentNum = 0;
		}
		timeDelay=Delay[PicCurrentNum]*1000;
		PicCurrent.src = Pix[PicCurrentNum];
		createImageMap();
		blendimage("bb_ad","ChangingPix",Pix[PicCurrentNum],1000);		//Fade in pic
		timerID = setInterval("slideshow()", timeDelay);
		}

		function slideshow2() {
		clearInterval(timerID2);	
		PicCurrentNum2++;
		if (PicCurrentNum2 == howMany2) {
		PicCurrentNum2 = 0;
		}
		timeDelay2=Delay2[PicCurrentNum2]*1000;
		PicCurrent2.src = Pix2[PicCurrentNum2];
		createImageMap2();
		blendimage("pic2","ChangingPix2",Pix2[PicCurrentNum2],1000);		//Fade in pic
		timerID2 = setInterval("slideshow2()", timeDelay2);
		}

		function slideshow3() {
		clearInterval(timerID3);	
		PicCurrentNum3++;
		if (PicCurrentNum3 == howMany3) {
		PicCurrentNum3 = 0;
		}
		timeDelay3=Delay3[PicCurrentNum3]*1000;
		PicCurrent3.src = Pix3[PicCurrentNum3];
		createImageMap3();
		blendimage("pic3","ChangingPix3",Pix3[PicCurrentNum3],1000);		//Fade in pic
		timerID3 = setInterval("slideshow3()", timeDelay3);
		}

   		function createImageMap () {
	   
   		// clear out existing image map
   		clearImageMap();
	   
   		dst1 = document.createElement("AREA");
   		dst1.shape = "rect";
   		dst1.coords = iMap1[PicCurrentNum];
	   
   		if (Dest1[PicCurrentNum] != "")
   		{
   		dst1.href = Dest1[PicCurrentNum];
   		}
   		else
   		{
   		dst1.href = "";
   		}
	   
   		dst2 = document.createElement("AREA");
   		dst2.shape = "rect";
   		dst2.coords = iMap2[PicCurrentNum];
	   
   		if (Dest2[PicCurrentNum] != "")
   		{
   		dst2.href = Dest2[PicCurrentNum];
   		}
   		else
   		{
   		dst2.href = "";
   		}
	   
  		mapObj = document.getElementById("PromoMap");
   		if(dst1.coords != "")
			mapObj.appendChild(dst1);
   		if(dst2.coords != "")
			mapObj.appendChild(dst2);
   		}
   		
   		function createImageMap2 () {
	   
   		// clear out existing image map
   		clearImageMap2();
	   
   		dst1a = document.createElement("AREA");
   		dst1a.shape = "rect";
   		dst1a.coords = iMap1a[PicCurrentNum2];
	   
   		if (Dest1a[PicCurrentNum2] != "")
   		{
   		dst1a.href = Dest1a[PicCurrentNum2];
   		}
   		else
   		{
   		dst1a.href = "";
   		}
	   
   		dst2a = document.createElement("AREA");
   		dst2a.shape = "rect";
   		dst2a.coords = iMap2a[PicCurrentNum2];
	   
   		if (Dest2a[PicCurrentNum2] != "")
   		{
   		dst2a.href = Dest2a[PicCurrentNum2];
   		}
   		else
   		{
   		dst2a.href = "";
   		}
	   
  		mapObj2 = document.getElementById("PromoMap2");
   		if(dst1a.coords != "")
			mapObj2.appendChild(dst1a);
   		if(dst2a.coords != "")
			mapObj2.appendChild(dst2a);
   		}

   		function createImageMap3 () {
	   
   		// clear out existing image map
   		clearImageMap3();
	   
   		dst1b = document.createElement("AREA");
   		dst1b.shape = "rect";
   		dst1b.coords = iMap1b[PicCurrentNum3];
	   
   		if (Dest1b[PicCurrentNum3] != "")
   		{
   		dst1b.href = Dest1b[PicCurrentNum3];
   		}
   		else
   		{
   		dst1b.href = "";
   		}
	   
   		dst2b = document.createElement("AREA");
   		dst2b.shape = "rect";
   		dst2b.coords = iMap2b[PicCurrentNum3];
	   
   		if (Dest2b[PicCurrentNum3] != "")
   		{
   		dst2b.href = Dest2b[PicCurrentNum3];
   		}
   		else
   		{
   		dst2b.href = "";
   		}
	   
  		mapObj3 = document.getElementById("PromoMap3");
   		if(dst1b.coords != "")
			mapObj3.appendChild(dst1b);
   		if(dst2b.coords != "")
			mapObj3.appendChild(dst2b);
   		}


   		function clearImageMap () {
   		mapObj3 = document.getElementById("PromoMap");
   		while (mapObj3.childNodes.length)
	   		{
	   		mapObj3.removeChild(mapObj3.firstChild);
	   		}
   		}

   		function clearImageMap2 () {
   		mapObj4 = document.getElementById("PromoMap2");
   		while (mapObj4.childNodes.length)
	   		{
	   		mapObj4.removeChild(mapObj4.firstChild);
	   		}
   		}

   		function clearImageMap3 () {
   		mapObj5 = document.getElementById("PromoMap3");
   		while (mapObj5.childNodes.length)
	   		{
	   		mapObj5.removeChild(mapObj5.firstChild);
	   		}
   		}

		
		function adPopup(nSelect) 
		{
			var w = 0, h = 0;
			var popW = 0, popH = 0;
			var leftPos = 0, topPos = 0;
			var PopupFile = "";
							
			if (document.all) {
			   /* the following is only available after onLoad */
			   w = document.body.clientWidth;
			   h = document.body.clientHeight;
			}
			else if (document.layers) {
			   w = window.innerWidth;
			   h = window.innerHeight;
			}
			
			if(nSelect == 0){
				popW = 395, popH = 550;
				PopupFile = "popup0.htm";
				}
			if(nSelect == 1){
				popW = 400, popH = 640;
				PopupFile = "popup1.htm";
				}
			if(nSelect == 2){
				popW = 460, popH = 520;
				PopupFile = "bagabargain.htm";
				}
			if(nSelect == 3){
				popW = 395, popH = 580;
				PopupFile = "moreinfo.aspx";
				}
			leftPos = (w-popW)/2;
			topPos = (h-popH)/2;
			window.open(PopupFile,'popup','width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos);
		}

//	---------------------------------------------------------------------------------------------------------------------------------------

//
//		News Ticker	Functions
//		

			function addLetter(news_num, letter_num){
				current_news = news_id[news_num];
				var news = document.getElementById("NewsTicker");
				if(letter_num<105){
					if(letter_num < news_item[news_num].length){
						news.innerHTML += news_item[news_num].substring([letter_num],[letter_num+1]);
						setTimeout("addLetter("+news_num+","+(letter_num+1)+")",20);
					}else{
						news.innerHTML += " ...";
						if(news_item[news_num+1]){
							var new_news_num = news_num+1;
						}
						else{
							var new_news_num = 0;
						}
						setTimeout("document.getElementById('NewsTicker').innerHTML='';addLetter("+new_news_num+",0)",4000);
					}
				}else{
					news.innerHTML += " ...";
					if(news_item[news_num+1]){
						var new_news_num = news_num+1;
					}
					else{
						var new_news_num = 0;
					}
					setTimeout("document.getElementById('NewsTicker').innerHTML='';addLetter("+new_news_num+",0)",4000);
				}
			}

			function showNewsStory(){
			    if (current_news != "")
				    {
				    top.location.href = current_news;
				    }
			}

//	---------------------------------------------------------------------------------------------------------------------------------------

