// Author Stephen Barraclough // November 10, 2005  // Trinex Internet Solutions

//vars and arrays
var hideSubnavTimeout;

//top level
var NavList = new Array("Home","Money Back Guarantee","Fishing","Lodging &amp; Dining","Couples Week","Fishing Clinics","Rates &amp; Information","Kasba Itinerary","Location &amp; Weather","Wilderness Canoe Trips","View our Videos","View our Photos","Kasba Resources","Contact Us","Information Request","Kasba Club Members","Sitemap");
var NavListLinks = new Array("/main.asp","/guarantee.asp","/fishing.asp","/lodging_dining.asp","/couples_week.asp","/fishing_clinics.asp","/ratesinfo.asp","/itinerary.asp","/location_weather.asp","/canoetrips.asp","/video.asp","/gallery/index_public.asp?gtID=185","/links.asp","/contact.asp","/info_request.asp","/members/members.asp","/sitemap.asp");
//section names used for top level nav
var SecNames = new Array("main","guarantee","fish","lodgedine","couplesweek","flyfishseminar","ratesinfo","itinerary","location","canoe","video","photos","links","contact","inforequest","member","sitemap");
	
//submenus
	var Subfish = new Array("Northern Pike","Lake Trout","Arctic Grayling","Fly Fishing","Guides and Equipment","Tackle and Information","When to Go","Kazan Outpost","Fly-out options");
	var SubfishLinks = new Array("/fishing_northern_pike.asp","/fishing_lake_trout.asp","/fishing_arctic_grayling.asp","/fishing_fly_fishing.asp","/fishing_guides_equipment.asp","/fishing_tackle_info.asp","/fishing_when.asp","/fishing_tabane_outpost.asp","/fishing_flyout.asp");
	
	var SubRates = new Array("2010 Brochure <font size=\"1\">[4.0MB PDF]</font>","Packages - Main Lodge","Packages - Kazan Outpost","Flyouts","Kasba Couples Week","Tackle Rental","Payment Policies","Departure Dates","FAQs");
	var SubRatesLinks = new Array("/2010_kasba_brochure.pdf","/ratesinfo_packages_main.asp","/ratesinfo_packages_tabane.asp","/ratesinfo_flyouts.asp","/couples_week.asp","/ratesinfo_tackle.asp","/ratesinfo_payment.asp","/ratesinfo_departure.asp","/ratesinfo_faqs.asp");

	//var SubMembers = new Array("Fishing Trophies","Photo Galleries","Contact a Member","Newsletter","Kasba Store","My Profile");
	//var SubMembersLinks = new Array("#","#","#","#","#","#");

function Nav(sec) {
		
		var navTopLevel = ""; var onitclass = ""; var ActiveSection = sec; var NavLength = NavList.length;
		document.write("<div id='navGlobal'>");
		
		for(var i=0; i < NavLength; i++) {
		
			navTopLevel = NavList[i];
			navSecNames = SecNames[i];
			//toplevel Nav
			if(ActiveSection == navSecNames) {
					onitclass = "class='onit'"
					} else {  
					 onitclass = "";
					}
			document.write("<div "+onitclass+"><a id='topnavitem"+i+"' class=\"mainnavitem\" href='"+NavListLinks[i]+"' onmouseover=showSubnav('"+i+"'); onmouseout='hideSubnav();'>"+navTopLevel+"</a></div>");
					//subnav holder div
					document.write("<div id='Nav"+i+"' onmouseover=showSubnav('"+i+"'); onmouseout='hideSubnav();'>");
					
					switch(navTopLevel) {	
						case "Fishing":
							for(var t=0; t < Subfish.length; t++)	{
								document.write("<div class='subnavitem'><a href='"+SubfishLinks[t]+"'>"+Subfish[t]+"</a></div>");
							}
						break;				
						case "Rates &amp; Information":
							for(var t=0; t < SubRates.length; t++)	{
							document.write("<div class='subnavitem'><a href='"+SubRatesLinks[t]+"'>"+SubRates[t]+"</a></div>");
						}
						break;
						default:
						break;
						}
				document.write("</div>"); //close each sub
			} //
		document.write("</div>"); //close navholder
	} //close nav

function initGlobalNav(){
	hideAll(); //hack for IE5/Mac
	//document.getElementById('navGlobal').style.visibility = 'visible';
}	

function ActiveNav(navitem) {
	var getObj = document.getElementById('topnavitem'+navitem);
		getObj.style.background = '#0E4886';
		getObj.style.color = '#FFEACA';
		getObj.style.borderBottom = '1px solid #FFEACA';
}


function showSubnav(navitem){
	hideAll();
	strActiveSubnav = navitem;
	document.getElementById('Nav'+navitem).style.visibility = 'visible';
	//Styles
	var getObj = document.getElementById('topnavitem'+navitem);
		getObj.style.background = '#0E4886';
		getObj.style.color = '#FFEACA';
		getObj.style.borderBottom = '1px solid #FFEACA';
}

function hideAll() {
	for(var h=0; h < NavList.length; h++) {
		document.getElementById('Nav'+h).style.visibility = 'hidden';
		//Styles
		var getObj = document.getElementById('topnavitem'+h);
			getObj.style.background = 'transparent';
			getObj.style.color = '#0E4886';
			getObj.style.borderBottom = '1px solid #FFEACA';
	}
}	

function hideSubnav(state){
	clearTimeout(hideSubnavTimeout);
	strActiveSubnav = '';
	if(state == 'force'){
		hideSubnav2();
	} else {
		hideSubnavTimeout = setTimeout('hideSubnav2()', 300);
	}
}

function hideSubnav2(){
	if (strActiveSubnav == ''){
		hideAll();
	}
}	

function Fo(w,h,ver,path) {
	document.write("<object type=\"application/x-shockwave-flash\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="+ver+",0,0,0\" width=\""+w+"\" height=\""+h+"\">");
	document.write("<param name=movie value=\"" + path + "\" />"); 
  	document.write("<param name=menu value=false />"); 
 	document.write("<param name=quality value=best />"); 
	document.write("<param name=wmode value=transparent />");
	document.write("<param name=scale value=exactfit />");
	document.write("<param name=salign value=LT />");
	document.write("<param name=devicefont value=true />");
	document.write("<param name=AllowScriptAccess VALUE=samedomain />");
 	document.write("<embed src=\"" + path + "\" menu=false quality=best bgcolor=#E9E1CC AllowScriptAccess=samedomain devicefont=true scale=exactfit salign=LT wmode=transparent pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\""+w+"\" height=\""+h+"\">"); 
  	document.write("</embed></object>"); 
}	

function FoSlideShow(w,h,ver,path,targetdiv) {
	var DisplayFlash = document.getElementById(targetdiv);
	var str = "<object type=\"application/x-shockwave-flash\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="+ver+",0,0,0\" width=\""+w+"\" height=\""+h+"\">";
	str += "<param name=movie value=\"" + path + "\" />"; 
  	str += "<param name=menu value=false />"; 
 	str += "<param name=quality value=best />"; 
	str += "<param name=wmode value=transparent />";
	str += "<param name=scale value=noscale />"; 
 	str += "<embed src=\"" + path + "\" menu=false scale=noscale quality=best wmode=transparent pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\""+w+"\" height=\""+h+"\">";
  	str += "</embed></object>"; 
	DisplayFlash.innerHTML = str;
}
	
	
function FoBanner(w,h,ver,path) {
	document.write("<object type=\"application/x-shockwave-flash\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="+ver+",0,0,0\" width=\""+w+"\" height=\""+h+"\">");
	document.write("<param name=movie value=\"" + path + "\" />"); 
  	document.write("<param name=menu value=false />"); 
 	document.write("<param name=quality value=best />"); 
	document.write("<param name=wmode value=transparent />");
	document.write("<param name=scale value=exactfit />");
	document.write("<param name=salign value=LT />");
	document.write("<param name=devicefont value=true />");
	document.write("<param name=FlashVars value=setJump=loaded />");
	document.write("<param name=AllowScriptAccess VALUE=samedomain />");
 	document.write("<embed src=\"" + path + "\" menu=false quality=best bgcolor=#E9E1CC AllowScriptAccess=samedomain devicefont=true scale=exactfit salign=LT wmode=transparent flashvars=setJump=loaded pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\""+w+"\" height=\""+h+"\">"); 
  	document.write("</embed></object>"); 
}

function popVideo(url, w, h) {
	SX = Math.round((screen.availWidth - w) / 2);
	SY = Math.round((screen.availHeight - h) / 2);
	var popSiteMap=window.open("/video/videoview.asp?flv="+url,"popSiteMap","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width="+w+",height="+h+",screenX="+SX+",left="+SX+",screenY="+SY+",top="+SY);
	if (popSiteMap.focus) {	
		popSiteMap.focus();
	}
	return false;
}

//onload
function pageInit(){
	initGlobalNav();	
}	

window.onload = pageInit;		