// all the navs (top, right, bottom, about, signup) are written here


//var topArray = new Array("Home","Canada","World","Business","Science","Culture","Education");
//var topNameArray = new Array("homepage","Canada","World","Business","Science","Culture","Education");
//var topHrefArray = new Array("/index.jsp","/canada/index.jsp","/world/index.jsp","/business/index.jsp","/science/index.jsp","/culture/index.jsp","/education/index.jsp");
//var topWidthArray = new Array("","","","","","","","");

var topArray = new Array("Home","Canada","World","Business","Science","Culture","Education","Blogs","Multimedia","Maclean's 50","Columnists","Forums");
var topNameArray = new Array("homepage","Canada","World","Business","Science","Culture","Education","Blog","Gallery","Macleans50","Columnists","Forums");
//var topArray = new Array("Home","Canada","World","Business","Science","Culture","Education","Blog Central","Maclean's 50","Newsmakers");
//var topNameArray = new Array("homepage","Canada","World","Business","Science","Culture","Education","Blog","Macleans50","Newsmakers");
var topHrefArray = new Array("/index.jsp","/canada/index.jsp","/world/index.jsp","/business/index.jsp","/science/index.jsp","/culture/index.jsp","/education/index.jsp","http://blog.macleans.ca/category/blog-central/","/gallery/index.jsp","/macleans50/index.jsp","/columnists/index.jsp","/forums/index.jsp");
var topWidthArray = new Array("","","","","","","","","","");


var bottomArray = new Array("Advertise","In-Class Programs","About Us","Subscriptions","Privacy Policy","Contact Us");
var bottomNameArray = new Array("Advertise","In-Class Programs","About","Subscriptions","Privacy","Contactus");
var bottomHrefArray = new Array("/advertise/index.jsp","http://www.macleansinclass.com/","/about/index.jsp","https://w1.buysub.com/servlet/OrdersGateway?cds_mag_code=MME&cds_page_id=36313&cds_response_key=V75AARMWN","/privacy/index.jsp","/contactus/index.jsp");
var bottomWidthArray = new Array("","","","","","");

//var rightArray = new Array("Blog Central","Maclean's 50","Columnists","Forums","Photo Gallery","Macleans Radio","Newsmakers","Storyline Newsletter");
//var rightNameArray = new Array("Blog","Macleans50","Columnists","Forums","Gallery","Radio","Newsmakers","Newsletters");
//var rightHrefArray = new Array("/blogs/index.jsp","/macleans50/index.jsp","/columnists/index.jsp","/forums/index.jsp","/gallery/index.jsp","/radio/index.jsp","/newsmakers/index.jsp","/newsletter/index.jsp");
//var rightWidthArray = new Array("","","","","","","","");

// MW - may 31 2007
//var rightArray = new Array("Blog Central","Maclean's 50","Media Room","Forums","Columnists","Maclean's Radio","Newsmakers","Storyline Newsletter");
//var rightNameArray = new Array("Blog","Macleans50","Gallery","Forums","Columnists","Radio","Newsmakers","Newsletters");
//var rightHrefArray = new Array("http://blog.macleans.ca/category/blog-central/","/macleans50/index.jsp","/gallery/index.jsp","/forums/index.jsp","/columnists/index.jsp","/radio/index.jsp","/newsmakers/index.jsp","/newsletter/index.jsp");
//var rightWidthArray = new Array("","","","","","","","");

var rightArray = new Array("Media Room","Forums","Columnists","Maclean's Radio","Give a Gift","Maclean's Uni Guide","Customer Service","Storyline Newsletter");
var rightNameArray = new Array("Gallery","Forums","Columnists","Radio","Gift","BackIssues","contactus","Newsletters");
var rightHrefArray = new Array("/gallery/index.jsp","/forums/index.jsp","/columnists/index.jsp","/radio/index.jsp","https://w1.buysub.com/servlet/GiftsGateway?cds_mag_code=MME","https://m1.buysub.com/webapp/wcs/stores/servlet/ProductDisplay?catalogId=10851&storeId=10851&productId=194360&langId=-1&parent_category_rn=10077","https://w1.buysub.com/servlet/CSGateway?cds_mag_code=MME","/newsletter/index.jsp");
var rightWidthArray = new Array("","","","","","","","");

var aboutArray = new Array("About Macleans","About Macleans.ca","Faqs","");
var aboutNameArray = new Array("intro","website","faq","","");
var aboutHrefArray = new Array("/about/index.jsp","/about/website.jsp","/about/faq.jsp","#","");
var aboutWidthArray = new Array("125","140","50","328");

var signupArray = new Array("Sign Up to Macleans.ca");
var signupNameArray = new Array("Signup");
var signupHrefArray = new Array("/signup/index.jsp");
var signupWidthArray = new Array("");

function checkMatch(curItem,thisItem,showThis,showThat) { 
	if (curItem==thisItem) { 
		return showThis; 
	} else { 
		return showThat; 
	} 
} 


function addHost(u) {
	if (u.indexOf("http") >=0) {
		return u;
	} else {
		return theHost+u;
	}
}
function nav(area) { 
	if (area=="top") { 
	  theNameArray = topArray; 
	  theIDArray = topNameArray; 
	  theHrefArray = topHrefArray; 
	  theName = headerName; 
	  hasHome = 0; 
	} else if (area=="bottom") { 
	  theNameArray = bottomArray; 
	  theIDArray = bottomNameArray; 
	  theHrefArray = bottomHrefArray; 
	  theName = bottomName; 
	  hasHome = -1; 
	} else if (area=="right") { 
	  theNameArray = rightArray; 
	  theIDArray = rightNameArray; 
	  theHrefArray = rightHrefArray; 
	  theName = rightName; 
	  hasHome = -1; 
	} else if (area=="about") { 
	  theNameArray = aboutArray; 
	  theIDArray = aboutNameArray; 
	  theHrefArray = aboutHrefArray; 
	  theName = aboutName; 
	  theWidthArray = aboutWidthArray; 
	  hasHome = -1; 
	} else if (area=="signup") { 
	  theNameArray = signupArray; 
	  theIDArray = signupNameArray; 
	  theHrefArray = signupHrefArray; 
	  theName = headerName; 
	  theWidthArray = signupWidthArray; 
	  hasHome = -1; 
	} 
	var html = ""; 
	for (x = 0; x < theNameArray.length; x++) { 
		if (area=="right") { 
			if (x == 0) { 
				html += "<ul>"; 
			} 
			if (x == 4) { 
				html += "</ul><ul style=\"position:relative; left:2px;\">"; 
			} 
			html += "<li class=\""+checkMatch(theName,theIDArray[x],'on','')+"\" "+checkMatch(theName,theIDArray[x],'!','')+"onMouseOver=\"this.className='on'\" "+checkMatch(theName,theIDArray[x],'!','')+"onMouseOut=\"this.className=''\"><p><a href=\""+addHost(theHrefArray[x])+"\">"+theNameArray[x]+"</a></p></li>";
		} else if (area=="about") { 
				if (x == theNameArray.length-1) {
					html += "<div class=\"link\" style=\"margin-right:0px;\"><p style=\"cursor:default !important; width:"+theWidthArray[x]+"px;\"></p></div>";
				} else {
					html += "<div class=\"link\"><p class=\""+checkMatch(theName,theIDArray[x],'on','')+"\" "+checkMatch(theName,theIDArray[x],'!','')+"onMouseOver=\"this.className='on'\"  "+checkMatch(theName,theIDArray[x],'!','')+"onMouseOut=\"this.className=''\" style=\"width:"+theWidthArray[x]+";\"><a href=\""+theHost+theHrefArray[x]+"\">"+theNameArray[x]+"</a></p></div>";
				}
		} else if (area=="signup") {
				html += "<p onClick=\"top.location.href='"+theHost+theHrefArray[x]+"'\" class=\""+checkMatch(theName,theIDArray[x],'topOn','')+"\"";
				html += " "+checkMatch(theName,theIDArray[x],'!','')+"onMouseOver=\"this.className='topOn'\"";
				html += " "+checkMatch(theName,theIDArray[x],'!','')+"onMouseOut=\"this.className=''\">";
				html += "<a href=\""+theHost+theHrefArray[x]+"\">"+theNameArray[x]+"</a></p>";
		} else { // top and bottom
			if (x==hasHome) { // home page
				html += "<p onClick=\"top.location.href='"+theHost+theHrefArray[x]+"'\" class=\"home "+checkMatch(theName,theIDArray[x],'topOn','')+"\"";
				html += " "+checkMatch(theName,theIDArray[x],'!','')+"onMouseOver=\"this.className='home topOn'\"";
				html += " "+checkMatch(theName,theIDArray[x],'!','')+"onMouseOut=\"this.className='home'\">";
				html += "<a href=\""+theHrefArray[x]+"\"></a></p>";
			} else {
				html += "<p onClick=\"top.location.href='"+theHost+theHrefArray[x]+"'\" class=\""+checkMatch(theName,theIDArray[x],'topOn','')+"\"";
				html += " "+checkMatch(theName,theIDArray[x],'!','')+"onMouseOver=\"this.className='topOn'\"";
				html += " "+checkMatch(theName,theIDArray[x],'!','')+"onMouseOut=\"this.className=''\">";
				html += "<a href=\""+addHost(theHrefArray[x])+"\">"+theNameArray[x]+"</a></p>";
			}
		} 
	} 
	if (area=="right") { 
		html += "</ul>"; 
	} 
	document.write(html); 
} 



