

var agt=navigator.userAgent.toLowerCase();
var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));

function lightTopLink(el){
	if (document.all){
		document.all[el].className='pageHeaderBar2H'
	} else {
		document.getElementById(el).className='pageHeaderBar2H'
	}
}

function lightTopSubLink(el){
	if (document.all){
		document.all[el].className='pageHeaderBar1H'
	} else {
		document.getElementById(el).className='pageHeaderBar1H'
	}
}

function lightSideLink(el){
	var s=''
	var o,p
	if (document.all){
		o = document.all[el]
		document.all[el.toString()+'A'].className='leftMenuAH'
	} else {
		o = document.getElementById(el)
		document.getElementById(el.toString()+'A').className='leftMenuAH'
	}
	if (o != p){
		s = o.src
		var t = s.toString().split('/')
		t[t.length-1] = 'menuarrowred.gif'
		s = t.join('/')
		o.src = s
	}
}

function lightBottomLink(el){
	if (document.all){
		document.all[el].className='pagefooter2H'
	} else {
		document.getElementById(el).className='pagefooter2H'
	}
}

function showSideMenu(el){
	if (document.all){
		if (is_ie){	document.all[el].style.display='block' } else {	document.all[el].style.display='table-row' }
	} else {
		document.getElementById(el).style.display='table-row'
	}
}

function zipFocus(){
	if (document.all){
		document.all.zipcode.focus()
	} else {
		document.getElementsByName('zipcode')[0].focus()
	}
}

function bdidFocus(){
	if (document.all){
		document.all.bdid.focus()
	} else {
		document.getElementsByName('bdid')[0].focus()
	}
}

function jumpSignin(){
	if (window.top.key != 'cadmium'){
		var s = window.document.location.toString().split('/')
		var j = 0
		for (var i=0; i<s.length; i++){if (s[i].toLowerCase()=='dealers'){j=i}}
		if (j>0){
			s[j+1] = 'body-sa.htm'
			while (s.length>j+2){s.length--}
			window.top.document.location = s.join('/')
		} else {window.top.document.location = 'http://www.bondhus.com/'}
	}
}

function openConsole(pth, lang){
//	var a
//	a = document.getElementById("pgMenuc")
//	window.open(a.href.toString() + pth, "BondhusConsole", 
//	var cwidth = 720; var cheight = 530
	var cwidth=790; var cheight=540;
	var cpath = '../console/'
	if (lang == 'gm'){cpath = '../console-gm/'}
	if (lang == 'it'){cpath = '../console-it/'}
	if (lang == 'jp'){cpath = '../console-jp/'}
	if (lang == 'ko'){cpath = '../console-ko/'}
	if (lang == 'po'){cpath = '../console-po/'}	
	if (lang == 'sp'){cpath = '../console-sp/'}
	if (lang == 'sw'){cpath = '../console-sw/'}

	window.open(cpath + "console.asp" + pth, "BondhusConsole", 
		"location=0, menubar=0, toolbar=0, directories=0, resizable=0, status=0, dependent=0, width=" + cwidth + ", height=" + cheight);
}

function switchConsole(lang){
	var cpath = '../console/'
	if (lang == 'gm'){cpath = '../console-gm/'}
	if (lang == 'it'){cpath = '../console-it/'}
	if (lang == 'jp'){cpath = '../console-jp/'}
	if (lang == 'ko'){cpath = '../console-ko/'}
	if (lang == 'po'){cpath = '../console-po/'}
	if (lang == 'sp'){cpath = '../console-sp/'}
	if (lang == 'sw'){cpath = '../console-sw/'}
	var fn
	if (document.all){
		fn = window.opener.document.all.displayiframe.src
	} else {
		fn = window.opener.document.getElementsByName('mainiframe')[0].src
	}
	var fne = fn.split('=')
	var fnd = ""
	if (fne.length > 1){fnd=fne[1]}
	window.opener.document.location = cpath + "console.asp?t=" + fnd
	window.close()
}

function centerWindow(){
	var frameWidth = 0
	var frameHeight = 0
	if (self.innerWidth){
		frameWidth = self.innerWidth;
		frameHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientWidth) {
		frameWidth = document.documentElement.clientWidth;
		frameHeight = document.documentElement.clientHeight;
	} else if (document.body) {
		frameWidth = document.body.clientWidth;
		frameHeight = document.body.clientHeight;
	}
	else return;
	
	var locX = Math.round((self.screen.width - frameWidth) / 2)
	var locY = Math.round((self.screen.height - frameHeight) / 2)

	parent.window.moveTo(locX, locY);
	window.focus()
}

function openCatSearch(){
	var cwidth = 1014
	var cheight = 700
	var s = window.document.location.toString().split('/')
	var j = 0
	for (var i=0; i<s.length; i++){if (s[i].toLowerCase().indexOf('bondhus')>-1){j=i}}
	if (j>0){
		s[j+1] = 'cat_search2/main.htm'
		while (s.length>j+2){s.length--}
		s = s.join('/')
	} else {s = 'http://www.bondhus.com/cat_search2/main.htm'}
	window.open(s, "BondhusConsole", 
		"location=0, menubar=0, toolbar=0, directories=0, resizable=1, status=0, dependent=0, width=" + cwidth + ", height=" + cheight);
}
