var cSection = null;
var cSubsection = null;

var pn = document.location.pathname.substr(1);
var splittedPath = pn.split("/");

cSection = splittedPath[0];
if (splittedPath.length == 3) { cSubsection = splittedPath[1]; }
if (splittedPath.length == 1) { cSection = 'home'; }


function chBg(o, s) {
	if (o.id != cSection) {
		o.style.background = 'url(/images/menubutton_background_'+s+'.gif)';
	}
}

function chSub(o, s) {
	o.style.backgroundColor = s;
}

function toggleMenu(o) {
	alert(o);
}

function goToUrl(u) {
	document.location.href = u;
}

menuBgImg = new Image();
menuBgImg.src = "/images/menubutton_background_on.gif";

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//	THIS FUNCTION WILL RESTORE ROLLED IMAGE(s) TO ORIGINAL STATE
function ipop_swapImgRestore() { //v3.0
var i,x,a=document.ipop_sr;
for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) {
x.src=x.oSrc;
}
}

//	THIS FUNCTION PRE-LOADS ROLLOVER IMAGE FILES
function ipop_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.ipop_p) d.ipop_p=new Array();
var i,j=d.ipop_p.length,a=ipop_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.ipop_p[j]=new Image; d.ipop_p[j++].src=a[i];}}
}

function ipop_findObj(n, d) { //v4.0
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=ipop_findObj(n,d.layers[i].document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}

//	THIS FUNCTION CONTROLS THE ROLLOVER EVENT
function ipop_swapImage_NoResize() { //v3.0
var i,j=0,x,a=ipop_swapImage_NoResize.arguments;
document.ipop_sr=new Array;
for(i=0;i<(a.length-1);i+=2) {
if ((x=ipop_findObj(a[i]))!=null){
document.ipop_sr[j++]=x;
if(!x.oSrc) {
x.oSrc=x.src;
}
x.src=a[i+1];
}
}
}

