
// preload navigation images:

        if (document.images) {

		home_on = new Image();
                home_on.src = "images/home_on.gif";
                home_off = new Image();
                home_off.src = "images/home_off.gif";
                
                about_on = new Image();
		about_on.src = "images/about_on.gif";
		about_off = new Image();
                about_off.src = "images/about_off.gif";
                
                members_on = new Image();
		members_on.src = "images/members_on.gif";
		members_off = new Image();
                members_off.src = "images/members_off.gif";
                
		events_on = new Image();
		events_on.src = "images/events_on.gif";
		events_off = new Image();
		events_off.src = "images/events_off.gif";

		proactive_on = new Image();
		proactive_on.src = "images/proactive_on.gif";
		proactive_off = new Image();
		proactive_off.src = "images/proactive_off.gif";

		news_on = new Image();
		news_on.src = "images/news_on.gif";
		news_off = new Image();
		news_off.src = "images/news_off.gif";

		join_on = new Image();
		join_on.src = "images/join_over.gif";
		join_off = new Image();
		join_off.src = "images/join_off.gif";
		
		mainimg_on = new Image();
		mainimg_on.src = "images/mainimg_on.gif";
		mainimg_off = new Image();
		mainimg_off.src = "images/mainimg_off.gif";
		
		feat1_on = new Image();
		feat1_on.src = "images/feat1_on.gif";
		feat1_off = new Image();
		feat1_off.src = "images/feat1_off.gif";
		
		feat2_on = new Image();
		feat2_on.src = "images/feat2_on.gif";
		feat2_off = new Image();
		feat2_off.src = "images/feat2_off.gif";
		
		feat3_on = new Image();
		feat3_on.src = "images/feat3_on.gif";
		feat3_off = new Image();
		feat3_off.src = "images/feat3_off.gif";
		
		login_on = new Image();
		login_on.src = "images/login_on.gif";
		login_off = new Image();
		login_off.src = "images/login_off.gif";
		
		vote_on = new Image();
		vote_on.src = "images/vote_on.gif";
		vote_off = new Image();
		vote_off.src = "images/vote_off.gif";
		
		gobut_on = new Image();
		gobut_on.src = "images/search1_on.gif";
		gobut_off = new Image();
		gobut_off.src = "images/search1_off.gif";
		
		access_on = new Image();
		access_on.src = "images/access_on.gif";
		access_off = new Image();
		access_off.src = "images/access_off.gif";
		
		search_on = new Image();
		search_on.src = "images/search_on.gif";
		search_off = new Image();
		search_off.src = "images/search_off.gif";
		
		
		
		memprofile_on = new Image();
		memprofile_on.src = "images/mem_profile_on.gif";
		memprofile_off = new Image();
		memprofile_off.src = "images/mem_profile_off.gif";

		memmembers_on = new Image();
		memmembers_on.src = "images/mem_members_on.gif";
		memmembers_off = new Image();
		memmembers_off.src = "images/mem_members_off.gif";

		memevents_on = new Image();
		memevents_on.src = "images/mem_events_on.gif";
		memevents_off = new Image();
		memevents_off.src = "images/mem_events_off.gif";

		memforum_on = new Image();
		memforum_on.src = "images/mem_forum_on.gif";
		memforum_off = new Image();
		memforum_off.src = "images/mem_forum_off.gif";


                
		tab1_on = new Image();
		tab1_on.src = "images/tab1_on.gif";
		tab1_off = new Image();
		tab1_off.src = "images/tab1_off.gif";
		tab1_bg = new Image();
		tab1_bg.src = "images/image1.gif";

		tab2_on = new Image();
		tab2_on.src = "images/tab2_on.gif";
		tab2_off = new Image();
		tab2_off.src = "images/tab2_off.gif";
		tab2_bg = new Image();
		tab2_bg.src = "images/image2.jpg";

		tab3_on = new Image();
		tab3_on.src = "images/tab3_on.gif";
		tab3_off = new Image();
		tab3_off.src = "images/tab3_off.gif";
		tab3_bg = new Image();
		tab3_bg.src = "images/image3.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('tab1','tab2','tab3');
//loopBGArray = new Array('image1.jpg','image2.jpg','image3.jpg');
loopTabArray = new Array('tab1','tab2','tab3');

function showText(srcElement,changeID){
	panel = document.getElementById(srcElement+'Text');
	panelBackground = document.getElementById('background');
	
	//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/image0.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) ? 2 : 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==2) ? 0 : realCount+1;
		//console.debug('time finished - '+timerCount+' stop - '+timerStop);
		timerStop = 0;
	}
//	console.debug('time finished - '+timerCount+' stop - '+timerStop);
	window.setTimeout('timeEvent()',5000);
}


