<!--
// Variable setup
var menuActive =0;
var theTimer = 0;
var showHideTimer = 0;
var menuSvcWdth=160;
var menuAbtWdth=120;


// Determine browser capability and set display control accordingly //
var isDOM = (document.getElementById) ? true : false; 
var isIE4 = (document.all && !isDOM) ? true : false;
var isNS4 = (document.layers) ? true : false;

function getRef(id) {
if (isDOM) return document.getElementById(id);
if (isIE4) return document.all[id];
if (isNS4) return document.layers[id];
}
function getSty(id) {    // find element based on browser capability //
return (isNS4 ? getRef(id) : getRef(id).style);
} 

if (isNS4){
 visible= 'show'; //Netscape values for display control//
 hidden='hide';
 }
else if (isIE4 || isDOM){
 visible='visible';
 hidden='hidden';
 }


function swapvisible(img){     //Turn element display on and off - expects id of element
 var ddMenu=getSty(img);
 if(ddMenu.visibility==visible){  // if ON then turn OFF , if OFF turn ON //
   ddMenu.visibility=hidden;
  }
 else{
  ddMenu.visibility=visible;
  }
lastmenu = ddMenu;      // record fo last item changed //
}

if (isNS4) {
   window.onResize = reloadIt;
}

function reloadIt() {
  document.location = document.location;
}

function menuOn(img,hasMenu,lyr) {
	clearTimeout(theTimer)

	document.images[img].src = eval(img + "_on").src;

	for (var i=0;i<menuArray.length;i++) {
		if ((img + "_lyr" != menuArray[i]) && !lyr) {
			menuActive = 0;
			hideMenu(menuArray[i]);
		}
	}
	
	if (hasMenu) {
		menuActive = 1;
		document.images[img].src = eval(img + "_on").src;
		
		getSty(img + "_lyr").pixelLeft = getPos('x',document.images[img]);
		getSty(img + "_lyr").Left = getPos('x',document.images[img]);
		getSty(img + "_lyr").pixelTop = getPos('y',document.images[img])+27;
		getSty(img + "_lyr").Top = getPos('y',document.images[img])+27;
		getSty(img + "_lyr").visibility = visible;		
	
	}
}

function menuOff(img,hasMenu,lyr) {

	document.images[img].src = eval(img + "_off").src;

	if (hasMenu) {
		menuActive = 0;
		theTimer = setTimeout("hideMenu('" + img + "_lyr')",50);
	}
}

function resetMenu(img) {
	menuActive = 1;
	document.images[img].src = eval(img + "_on").src;
	}

function hideTimer(menu) {
	menuActive = 0;
	theTimer = setTimeout("hideMenu('" + menu + "')",400);
	}

function hideMenu(menu) {
	if (!menuActive) {
	
		 ddMenu=getSty(menu);
		 ddMenu.visibility=hidden;
//		document.all[menu].style.visibility = hidden;
	
		menuActive = 0;
		var img = menu.split("_")[0];
		document.images[img].src = eval(img + "_off").src;
	}
}
// All main nav
var home_off = new Image(); home_off.src = "images/menu_home.gif";
var home_on = new Image(); home_on.src = "images/menu_home-over.gif"; 
var about_off = new Image(); about_off.src = "images/menu_about.gif";
var about_on = new Image(); about_on.src = "images/menu_about-over.gif";
var services_off = new Image(); services_off.src = "images/menu_services.gif";
var services_on = new Image(); services_on.src = "images/menu_services-over.gif";
var music_off = new Image(); music_off.src = "images/menu_music.gif";
var music_on = new Image(); music_on.src = "images/menu_music-over.gif";
var equipment_off = new Image(); equipment_off.src = "images/menu_equipment.gif";
var equipment_on = new Image(); equipment_on.src = "images/menu_equipment-over.gif";

// Set up menu bar as string variable

var menuArray = new Array();  

var div = '<div id="home_lyr" style="position:absolute;left:0px;top:0px;visibility:hidden;" onmouseover="resetMenu(\'home\')" onmouseout="hideTimer(\'home_lyr\')">';
document.writeln(div  + '</div>');

var div = '<div id="about_lyr" class="menuddAbout" onMouseOver="resetMenu(\'about\')" onMouseOut="hideTimer(\'about_lyr\')">';
var tblHdr1 = '<table width=menuAbtWdth cellpadding=0 cellspacing=0 border=0>';
var row1 = '<tr bgcolor=#AEC4D8 id="mabt1" onClick="document.location=\'http://campbells-ent.co.nz/about.php\';" ><td width=menuAbtWdth height =16><a href="about.php"><span id="mabt1txt" class="menuddServicestxt">About Us</span></a></td></tr>';
var row2 = '<tr bgcolor=#AEC4D8 id="mabt2" onClick="document.location=\'http://campbells-ent.co.nz/policy.php\';" ><td width=menuAbtWdth height =16><a href="policy.php"><span id="mabt2txt" class="menuddServicestxt">Policy</span></a></td></tr>';
var row3 = '<tr bgcolor=#AEC4D8 id="mabt3" onClick="document.location=\'http://campbells-ent.co.nz/questions.php;\'" ><td width=menuAbtWdth height =16><a href="questions.php"><span id="mabt3txt" class="menuddServicestxt"><nobr>Questions</nobr></span></a></td></tr>';
var tblFtr = '<tr bgcolor=#AEC4D8><td class="menuddServicestxt" height=7px><img height=7 src="images/spacer.gif" ></td></tr></table>';

document.writeln(div + tblHdr1 + row1 + row2 + row3 + tblFtr + '</div>');


var div = '<div id="services_lyr" style="position:absolute;left:0px;top:0px;visibility:hidden;" onmouseover="resetMenu(\'services\')" onmouseout="hideTimer(\'services_lyr\')">';
document.writeln(div  + '</div>');

var div = '<div id="music_lyr" style="position:absolute;left:0px;top:0px;visibility:hidden;" onmouseover="resetMenu(\'music\')" onmouseout="hideTimer(\'music_lyr\')">';
document.writeln(div  + '</div>');


var div = '<div id="equipment_lyr" class="menuddServices" onMouseOver="resetMenu(\'equipment\')" onMouseOut="hideTimer(\'equipment_lyr\')">';
var tblHdr1 = '<table width=menuSvcWdth cellpadding=0 cellspacing=0 border=0>';
var row1 = '<tr bgcolor=#AEC4D8 id="msvc1" onClick="document.location=\'http://campbells-ent.co.nz/equipment.php\';" ><td width=menuSvcWdth height =16><a href="equipment.php"><span id="msvc1txt" class="menuddServicestxt">Jukeboxes & Karaoke</span></a></td></tr>';
var row2 = '<tr bgcolor=#AEC4D8 id="msvc2" onClick="document.location=\'http://campbells-ent.co.nz/djequipment.php\';" ><td width=menuSvcWdth height =16><a href="djequipment.php"><span id="msvc2txt" class="menuddServicestxt">DJ Equipment</span></a></td></tr>';
var row3 = '<tr bgcolor=#AEC4D8 id="msvc3" onClick="document.location=\'http://campbells-ent.co.nz/lighting.php;\'" ><td width=menuSvcWdth height =16><a href="lighting.php"><span id="msvc3txt" class="menuddServicestxt"><nobr>Lighting</nobr></span></a></td></tr>';
var row4 = '<tr bgcolor=#AEC4D8 id="msvc4" onClick="document.location=\'http://campbells-ent.co.nz/bands.php;\'" ><td width=menuSvcWdth height =16><a href="bands.php"><span id="msvc4txt" class="menuddServicestxt"><nobr>Band PAs</nobr></span></a></td></tr>';
var row5 = '<tr bgcolor=#AEC4D8 id="msvc5" onClick="document.location=\'http://campbells-ent.co.nz/video.php;\'" ><td width=menuSvcWdth height =16><a href="video.php"><span id="msvc5txt" class="menuddServicestxt"><nobr>Big Screen</nobr></span></a></td></tr>';
var tblFtr = '<tr bgcolor=#AEC4D8><td class="menuddServicestxt" height=7px><img height=7 src="images/spacer.gif" ></td></tr></table>';

document.writeln(div + tblHdr1 + row1 + row2 + row3 + row4 + row5 + tblFtr + '</div>');

var menuArray = new Array();
// add to this array for each new submenu 
menuArray[0] = "home_lyr";
menuArray[1] = "about_lyr";
menuArray[2] = "services_lyr";
menuArray[3] = "music_lyr";
menuArray[4] = "equipment_lyr";

function getPos(whichPos,theObj) {
	var posX = 0;
	var posY = 0;

	var parent = theObj;
	while (parent && parent.tagName != "BODY" && parent.tagName != "HTML") {
		posX += parent.offsetLeft;
		posY += parent.offsetTop;
		parent = parent.offsetParent;
	} 

	if (whichPos == "x") return posX;
	else if (whichPos == "y") return posY;
	else if (whichPos == "xy") return posX + "," + posY;
} 

pageLoaded = 1;
//-->
