// Céline Nguyen celine.nguyen@nurun.com celine.nguyen@sympatico.ca
// (c) Nurun 2004 

var webSiteUrl = "/"

function main() {/*
	initlayers();
	SwapImage(sectionname,1);
	if (sectionname == "the-parts" && pagename != "automotive-parts"){sp(pagename,1)}
	
	
	if(isgecko && (sectionname == "the-pro" || sectionname == "contact")) {BposX = eval (getanx("xyBanner") + 8)} 
	else {BposX = getanx("xyBanner");}
	BposY = 113;
	
	bannerImg.setx(BposX);
	bannerImg.sety(BposY);
	bannerImg.show();*/
}


function sw(id,state) {
	if (id != sectionname){SwapImage(id,state)}
	else return;
}
function sp(id,state) {
	state = (state) ? "_on" : "_off";
	document.images[id].src = webSiteUrl + "_img/partnav/" + id + state + ".gif";
}
function spp(id,state) {
	state = (state) ? "-on" : "-off";
	document.images[id].src = webSiteUrl + "_img/parts-" + id + state + ".gif";
}
function SwapImage(id,state) {
	state = (state) ? "-on" : "-off";
	document.images[id].src = webSiteUrl + "_img/nav/" + id + state + ".gif";
}

var interRe = 16;
var intermen = 0;
var posyRe = 500;
var lin ='<tr><td bgcolor="#F8F1E7" height="4"><spacer type="block" height="4"></td></tr>'
var shadow ='<tr><td bgcolor="#F8F1E7" height="4"><img src="/_img/partnav/shadow.gif" width="159" height="4" alt="" border="0"></td></tr>'
var posX;
var posY;

parts = new Array();
parts[0] = new Array("under-car/car-changing-brake-pads","under-car/steering-suspension-systems","under-car/driveline-superstore","under-car/automotive-exhaust-heat-shield")
parts[1] = new Array("under-hood/check-ignition-module","under-hood/engine-emissions-fuel-sensors","under-hood/auto-air-conditioning-heating-cooling","under-hood/engine-parts-gaskets","under-hood/automotive-air-fuel-filters")
parts[2] = new Array("oils-chemicals/antifreeze-engine-coolant","oils-chemicals/motor-oils","oils-chemicals/power-steering-transmission-fluid","oils-chemicals/washer-fluid","oils-chemicals/engine-oil-additives")
parts[3] = new Array("tools-accessories/automotive-shop-lift-equipment","tools-accessories/automotive-hand-tools","tools-accessories/hitch-cargo-carriers","tools-accessories/power-packs-battery-chargers","tools-accessories/windshield-wiper-motors-blades","tools-accessories/automotive-lighting")
parts[4] = new Array("paint-bodycare/car-polish-wax-wash","paint-bodycare/auto-paint-car-finish","paint-bodycare/auto-body-tools-repair")
parts[5] = new Array("")
parts[6] = new Array()
parts[7] = new Array()

function loadNav(rec,recsub){
		posX = getanx("xyNavTop");
		posY = getany("xyNavTop") + 10;
		posyRe = posY;
		var str=''
		str+='<table width="159" border="0" cellspacing="0" cellpadding="0">'
		for(i=0;i<parts[rec].length; i++) {
			ns='<tr><td width="159" colspan="2"><a href="/parts/'+parts[rec][i]+'.asp" onMouseOver="sp(\'m'+rec+'_'+i+'\',1)" onMouseOut="sp(\'m'+rec+'_'+i+'\')"><img name="m'+rec+'_'+i+'" src="/_img/partnav/m'+rec+'_'+i+'_off.gif" width="159" height="14" border="0"></a></td></tr>'
			sted='<tr><td width="159"><img name="m'+rec+'_'+i+'" src="/_img/partnav/m'+rec+'_'+i+'_on.gif" width="159" height="14" border="0"></td></tr>'
			
			/* gere l'espace entre sec et sub */
			if (rec != 0) {espdeb = lin} else {espdeb = shadow}
			if (i!=recsub && i==0) {str+=espdeb+ns}
			else if (i!=recsub && i!=0) {str+=ns}
			else if (i==recsub && i!=0) {str+=sted}
			else if (i==recsub && i==0) {str+=espdeb+sted}
		}
		if (parts[rec].length !=0) {
		str+='<tr><td height="5" bgcolor="#F8F1E7"><spacer type="block" height="5"></td></tr>'
		} else str+='';
		str+='</table>'

		var elemSubMenu = document.createElement("div");
		elemSubMenu.innerHTML = str;
		document.getElementById("rt" + (rec)).appendChild(elemSubMenu)

		rt0.sety(posyRe);
		rt0.setx(posX);
		mh = posyRe;

		for (j=0; j<parts.length; j++){
			eval('rt'+j+'.show()');
		}
}

function popWin(url,w,h,scroll,tools,name,center,baseUrl) {
	var str = "height=" + h + ",innerHeight=" + h;
	str += ",width=" + w + ",innerWidth=" + w;
	if(!center) var center = false;
	if(!scroll) scroll = 0;
	if(!tools) tools = 0;
	if(!name) name = "pop";
	if(baseUrl) url = webSiteCMSUrl + url;
	if((window.screen) && (center)) {
		var ah = screen.availHeight - 30;
		var aw = screen.availWidth - 10;

		var xc = (aw - w) / 2;
		var yc = (ah - h) / 2;

		str += ",left=" + xc + ",screenX=" + xc;
		str += ",top=" + yc + ",screenY=" + yc;
		}
		
	pop = window.open(url,name,'toolbar=' + tools + ',location=0,directories=0,status=0,menubar=0,scrollbars=' + scroll + ',resizable=1,' + str).focus();
}

function newwin(loc) {
popWin(loc,230,230,0,0,"nav_window",1,'')
}

function newwin200(loc) {
popWin(loc,220,300,0,0,"nav_window",1,'')
}

function newwin977(loc) {
  popWin(loc,977,630,0,0,"nav_window",1,'')
}

function newwin977long(loc) {
  popWin(loc,977,700,1,0,"nav_window",1,'')
}

function formHandler(list){
var choice = list.options[list.selectedIndex].value;
window.location.href = choice;
}

function open_rules(url,w,h)
{
window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width=' + w + ',height=' + h + ',top=20,left=20')
}
