function confirmSubmit(text)
{
var agree=confirm(text);
if (agree)
	return true ;
else
	return false ;
}

function reDo() { 
 window.location.reload(); 
 } 
window.onresize = reDo; 
//Define global variables 
var timerID = null; 
var timerOn = false; 
var timerIDBox = null; 
var timerOnBox = false; 
var advertOn = true; 
var boxOn = 1; 
var timecount = 750;
var timecountbox = 5000; 
// Change this to the time delay that you desire 
var what = null; 
var newbrowser = true; 
var check = false; 
var menuis = false; 

function init() { 
 if (document.layers) { 
 layerRef="document.layers"; 
 styleSwitch=""; 
 visibleVar="show"; 
 screenSize = window.innerWidth; 
 what ="ns4"; 
 } 
 else if(document.all) { 
 layerRef="document.all"; 
 styleSwitch=".style"; 
 visibleVar="visible"; 
 screenSize = document.body.clientWidth + 18; 
 what ="ie4"; 
 } 
 else if(document.getElementById) { 
 layerRef="document.getElementByID"; 
 styleSwitch=".style"; 
 visibleVar="visible"; 
 what="dom1"; 
 } 
 else { 
 what="none"; 
 newbrowser = false; 
 } 
check = true; 

hideAllBox();
hideAll();
showLayer(defaultMenu); 
swapBox(); 
startTimeBox();
} 

// Toggles the layer visibility on 
function showLayer(layerName) { 
menuis=layerName;
if(check) { 
if (what =="none") { 
return; 
} 
else if (what == "dom1") { 
document.getElementById(layerName).style.visibility="visible"; 
document.getElementById(layerName+'head').style.textDecoration="underline";
} 
else { 
eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"'); 
eval(layerRef+'["'+layerName+'head"]'+styleSwitch+'.textDecoration="underline"'); 
} 
} 
else { 
return; 
} 
} 

// Toggles the layer visibility off 
function hideLayer(layerName) {
if(check) { 
if (what =="none") { 
return; 
} 
else if (what == "dom1") { 
document.getElementById(layerName).style.visibility="hidden"; 
document.getElementById(layerName+'head').style.textDecoration="none";
} 
else { 
eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"'); 
eval(layerRef+'["'+layerName+'head"]'+styleSwitch+'.textDecoration="none"'); 
} 
}
else { 
return; 
} 
} 

 
function hideAllBox() { 
 hideLayer('box1'); 
 hideLayer('box2'); 
 hideLayer('box3'); 
 hideLayer('box4'); 
 hideLayer('boxadvert'); 
 //Put all layers used in the nav here. 
 //Copy the hideLayer() function above. 
 } 	 

function hideAll() {
 hideLayer('menu1'); 
 hideLayer('menu2'); 
 hideLayer('menu3'); 
 hideLayer('menu4'); 
 hideLayer('menu5'); 
 //Put all layers used in the nav here. 
 //Copy the hideLayer() function above. 
 } 	 
function startTime() { if (menuis!=defaultMenu ) { if (timerOn == false) {  timerID=setTimeout( "hideAll();showLayer(defaultMenu);" , timecount);  timerOn = true;  } } } 

function startTimeBox() { if (timerOnBox == false) {  timerIDBox=setTimeout( "swapBox();" , timecountbox);  timerOnBox = true;  }  } 
 
 
function stopTime() {  if (timerOn) {  clearTimeout(timerID);  timerID = null;  timerOn = false;  }  } 
 
function stopTimeBox() {  if (timerOnBox) {  clearTimeout(timerIDBox);  timerIDBox = null;  timerOnBox = false;  }  }

var timerMenu = null;
function showMenu(menu) { if (menuis!=menu ) {  timerMenu=setTimeout( "hideAll(); showLayer('"+menu+"'); stopTime()" , timecount/3) }}
function stopShowMenu() { clearTimeout(timerMenu); startTime(); }

function swapBox() { 
 hideAllBox();
 stopTimeBox();
 if (advertOn == false) { 
	 var random = Math.floor(Math.random()*2);
	 if (random == 1) advertOn = true;
 }
 if (advertOn == false) {  
  showLayer('boxadvert'); advertOn = true;
 }
 else
 { 
	 switch(boxOn)
	 {
		 case 1:
		   showLayer('box1');
		   boxOn = 2;
		   break;
		 case 2:
		   showLayer('box2');
		   boxOn = 3;
		   break;
		 case 3:
		   showLayer('box3');
	  	   boxOn = 4;
	  	   break;
	  	 case 4:
		   showLayer('box4');
		   boxOn = 5;
		   break;
		 default:
		   showLayer('boxadvert');
		   boxOn = 1;
	 }	 
	 advertOn = false;
 }
  startTimeBox();
 //Put all layers used in the nav here. 
 //Copy the hideLayer() function above. 
 } 

function NewWindow(page, name, w, h) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',toolbar=no,menubar=no,location=no'
win = window.open(page, name, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
