
// preload navigation images:

        if (document.images) {

  
                
		telecom_on = new Image();
		telecom_on.src = "images/plc_telecom_on.gif";
		telecom_off = new Image();
		telecom_off.src = "images/plc_telecom_off.gif";
		telecom_bg = new Image();
		telecom_bg.src = "images/technology_mainimg1.jpg";

		mobile_on = new Image();
		mobile_on.src = "images/plc_mobile_on.gif";
		mobile_off = new Image();
		mobile_off.src = "images/plc_mobile_off.gif";
		mobile_bg = new Image();
		mobile_bg.src = "images/mobile_mainimg1.jpg";

		converged_on = new Image();
		converged_on.src = "images/plc_converged_on.gif";
		converged_off = new Image();
		converged_off.src = "images/plc_converged_off.gif";
		converged_bg = new Image();
		converged_bg.src = "images/converged_mainimg1.jpg";

		managed_on = new Image();
		managed_on.src = "images/plc_managed_on.gif";
		managed_off = new Image();
		managed_off.src = "images/plc_managed_off.gif";
		managed_bg = new Image();
		managed_bg.src = "images/managed_mainimg1.jpg";
		
		technology_on = new Image();
		technology_on.src = "images/plc_technology_on.gif";
		technology_off = new Image();
		technology_off.src = "images/plc_technology_off.gif";
		technology_bg = new Image();
		technology_bg.src = "images/technology_mainimg1.jpg";

              
                
}
                        
function hiLite(imgID,changeID) {
                        
        if (document.images) {
        showText(imgID,changeID);
		return true;
        }
		
}

//global variables for the timer
timerStop = 0;
timerCount = 0;
currentPanel = '';
loopArray = new Array('telecomText','mobileText','convergedText','managedText','technologyText');
//loopBGArray = new Array('telecom_mainimg1.jpg','mobile_mainimg1.jpg','converged_mainimg1.jpg','managed_mainimg1_.jpg','technology_mainimg1.jpg');
loopTabArray = new Array('telecom','mobile','converged','managed','technology');

function showText(srcElement,changeID){
	panel = document.getElementById(srcElement+'Text');
	panelBackground = document.getElementById('background');
	switch(srcElement){
		case 'technology': panelBackground.style.backgroundImage = "url(images/technology_mainimg1.jpg)"; break;
		case 'managed': panelBackground.style.backgroundImage = "url(images/managed_mainimg1.jpg)"; break;
		case 'converged': panelBackground.style.backgroundImage = "url(images/converged_mainimg1.jpg)"; break;
		case 'mobile': panelBackground.style.backgroundImage = "url(images/mobile_mainimg1.jpg)"; break;
		case 'telecom': panelBackground.style.backgroundImage = "url(images/technology_mainimg1.jpg)"; break;
		default: if(timerStop != 0) panelBackground.style.backgroundImage = "url(images/plc_mainimg1.jpg)"; break;
	}
	
	//console.debug(srcElement+'Text');
	if(panel!=null){
		
		if(panel.style.display=='block'){
			//IF THE TIMES RUNNING AND WE MOUSEOVER
			//THE PANEL THE TIMER SHOWED DON'T TURN IT OFF
			//JUST RESET THE TIMER
			if(timerStop == 0){
			timerStop = 1;
			}
			else{
			//turn the panel off and restart the timer
			panel.style.display = (panel.style.display=='block') ? 'none' : 'block';
			panelBackground.style.backgroundImage = (panel.style.display=='none') ? "url(images/plc_mainimg1.jpg)" : background.style.backgroundImage;
			document.images[srcElement].src = eval(changeID + ".src");
			timerStop = 0;
			timerCount = 0;			
			}
		}
		else{
		//turn the panel on and stop the timer
		hideAllPanels();
        document.images[srcElement].src = eval(changeID + ".src");
		panel.style.display = 'block';
		timerStop = 1;		
		}
	}
	else{
        document.images[srcElement].src = eval(changeID + ".src");
	}
}

function hideAllPanels(){
	for($i=0;$i<loopArray.length;$i++){
		nextPanel=document.getElementById(loopArray[$i]);
		nextPanel.style.display = 'none';
		document.images[loopTabArray[$i]].src = eval(loopTabArray[$i] + '_off' + ".src");
	}
}

function timeEvent(){
	//console.debug('timed event fired');
	//keep a track of the timer count - it gets reset by the the hiLite function
	realCount = timerCount;	
	
	if(timerStop==0){
		/* turn off*/;
		lastCount = (timerCount==0) ? 4 : timerCount-1;
		//console.debug('time finished - '+realCount+' working with  - '+timerCount);

		imgID = loopTabArray[lastCount];
		changeID = loopTabArray[lastCount]+'_off';
		document.images[imgID].src = eval(changeID + ".src");
		
		hiLite(imgID,changeID);
		
		/* turn on*/
		imgID = loopTabArray[realCount];
		changeID = loopTabArray[realCount]+'_on';
		hiLite(imgID,changeID);
		
		timerCount = (realCount==4) ? 0 : realCount+1;
		//console.debug('time finished - '+timerCount+' stop - '+timerStop);
		timerStop = 0;
		nextBlock(); // for case study scroller
	}
//	console.debug('time finished - '+timerCount+' stop - '+timerStop);
	window.setTimeout('timeEvent()',10000);
}

