function scriptInit() {
if (!document.getElementById) {
	return;
	}
}

function addEvent(elm, evType, fn, useCapture) {
	if (elm.addEventListener) {
	elm.addEventListener(evType, fn, useCapture);
	return true;
	} else if (elm.attachEvent) {
	var r = elm.attachEvent('on' + evType, fn);
	return r;
	} else {
	elm['on' + evType] = fn;
	}
}


function checkActive() {
	var a = document.getElementsByTagName("a");
	//var b = document.getElementsByTagName("a").className;
	if (window.location.href.substr(location.href.length - 1, 1) == '/') {
		var loc = window.location.href; 
	
	}
	else {
		var loc = window.location.href;
		
	}
	


for(var i=0; i < a.length; i++) {
	
	
		
		if (loc.search(a[i].href) == 0 && a[i].id.indexOf("changeme") == 0 ) {
		//alert(a[i].id.indexOf("changeme"));
		//alert(a[i].id);
		//alert("a[i].href is:" +a[i].href);
		
		//alert("search result:" + loc.search(a[i].href));
		var remove = loc.split("http://");
		//var remove2 = remove.replace(/,/, "");
		//alert(remove);
		//alert (remove.indexOf("/"));
		//alert(remove);
		if(a[i].href == "http://buywithconfidence.omvic.on.ca/") {
			if(a[i].href == loc) {
				a[i].setAttribute("class", a[i].className +" active_red");
				a[i].setAttribute("className", a[i].className +" active_red");
			}
		} else {
			//alert(a[i].href);
			a[i].setAttribute("class", a[i].className +" active_red");
			a[i].setAttribute("className", a[i].className +" active_red");
		}
			
		}
	}
}



function checkActiveleft() {
	var x = document.getElementsByTagName("a");
	var jblist = document.getElementsByTagName("li");
	var jbul = document.getElementsByTagName("ul");
	//var b = document.getElementsByTagName("a").className;
	if (window.location.href.substr(location.href.length - 1, 1) == '/') {
		var locx = window.location.href; 
	
	}
	else {
		var locx = window.location.href;
		
	}
	
	
	
	
for(var z=0; z < jblist.length; z++) {


if(locx.search(jblist[z].firstChild.href)==0 && jblist[z].firstChild.id.indexOf("changeme") != 0 && jblist[z].className!="last"){
	
	


//alert(jblist[z].childNode.className);



/*
if(navigator.appName=='Microsoft Internet Explorer' && locx.search(jbdone)!=0){
		alert(jbul[r].firstChild.firstChild+' = MSIE');
		//alert(jbul[r].className + ' - is the class');
		//alert(jbul[r].tagName + ' - is the tag');
		jbul[r].setAttribute("style","display:block;margin-bottom:0px;");
		//alert(jblist[z].firstChild.href + 'href');
		
		
		}
		
		else if(navigator.appName!='Microsoft Internet Explorer' && locx.search(jbdone)==0){
	alert(jbul[r].className + ' - is the class');
	alert(jbul[r].tagName + ' - is the tag');
	jbul[r].setAttribute("style","display:block;margin-bottom:0px;");
	//alert(jblist[z].firstChild.href + 'href');
		}



*/

for(var u=0; u < jbul.length; u++) {
	
	
	
	if(navigator.appName=='Microsoft Internet Explorer' && jbul[u].className == 'resources' ){
	
	//alert(jbul[u].firstChild.firstChild.getAttribute('href'));
//	alert(jbul[u].previousSibling.tagName);
	//alert(jblist[z].firstChild.getAttribute("href"));
	
	
	
	//alert("previousSibling.firstChild.getAttribute(href) = "+jblist[z].previousSibling.firstChild.getAttribute("href")+" LOCX ="+locx +" firstChild.getAttribute(href) ="+jblist[z].firstChild.getAttribute("href"));
	//alert(jblist[z].firstChild.getAttribute("href")); 
	
	if(locx.search(jblist[z].previousSibling.firstChild.getAttribute("href"))==0  || locx.search(jblist[z].firstChild.getAttribute("href"))==0){
		
		//alert('previousSibling is in locx = '+jblist[z].previousSibling.firstChild.getAttribute("href")); 
		var cssStringx = 'display:block;';
	jbul[u].style.cssText = cssStringx;
	jbul[u].setAttribute('style',cssStringx);
	
	}
	else{
		
	//alert('no doing anything');	
	}
	
	
	
	
	
	
}
	
}




if(locx.search(jblist[z].firstChild==0)){
	
	//alert('youre here, now set the children to display blox '+z+'  '+jblist[z].firstChild);
	
	//alert('nextsibling is'+jblist[z].nextSibling.nodeName);
	
	//alert('nextsibling is'+jblist[z].nextSibling.nextSibling.nextSibling.nodeName);
	//alert('nextsibling is'+jblist[z].nextSibling.nextSibling.nextSibling.nextSibling.nodeName);
	

	
}



if((jblist[z].lastChild!=0) && (jblist[z].nextSibling.nextSibling!=null)){

	//alert('get this one too!');
jblist[z].nextSibling.nextSibling.setAttribute("style","display:block;");
jblist[z].setAttribute("class",jblist[z].className +"active_arrow");
jblist[z].setAttribute("className",jblist[z].className +"active_arrow");


//alert('parent node style attribute is - '+jblist[z].parentNode.getAttribute('style'));

var cssString;
cssString =jblist[z].parentNode.style.cssText;
if( typeof(cssString) != 'string' ) {
  cssString = jblist[z].parentNode.getAttribute('style');
}
//alert('CSS STRING is = '+cssString);

var cssStringx = 'display:block;';
//jblist[z].parentNode.style.cssText = cssStringx;
//jblist[z].parentNode.setAttribute('style',cssStringx);
//alert('CSS STRING should now be set to = '+cssStringx);
//jblist[z].parentNode.setAttribute("style","display:block;margin-bottom:0px;");
}

else{
//alert("yep");
//alert(jblist.getAttribute);
//alert('else: parents class is = '+jblist[z].parentNode.className);
	jblist[z].setAttribute("class",jblist[z].className +" active_arrow");
//jblist[z].parentNode.setAttribute("style","display:block;margin-bottom:0px;");
//jblist[z].setAttribute("class",jblist[z].className +"active_arrow");
}
//alert(jblist[z].nextSibling.nextSibling);

//alert(jblist[z].className);


}





else if(jblist[z].className=="last" && locx.search(jblist[z].firstChild.href)==0){
	//alert(jblist[z].className+ "in");
	jblist[z].setAttribute("class",jblist[z].className +" active_arrow");
	jblist[z].setAttribute("className",jblist[z].className +" active_arrow");
}











}























for(var y=0; y < x.length; y++) {
	
	
		//alert(y);
		
	
			//window.location.hash = '';
	//var jh = window.location.hash;

		//alert(jh);
 	
	
	
	
	
	
	
	
	
		if (locx.search(x[y].href.split("#")) == 0 && x[y].id.indexOf("jbleft") == 0 ) {
		//alert(jblist[y]);
		//alert(locx.match(x[y].href));
		//alert(a[y].id.indexOf("changeme"));
		//alert(a[y].id);
		//alert("a[y].href is:" +a[y].href);
		jbhref = x[y].href.split("#");
		
		//alert("search result:" + loc.search(a[y].href));
		//var remove = loc.split("http://");
		//var remove2 = remove.replace(/,/, "");
		//alert(remove);
		//alert (remove.indexOf("/"));
		//alert(remove);
		if(jbhref == "http://buywithconfidence.omvic.on.ca/") {
			if(jbhref == locx) {
				x[y].setAttribute("class",x[y].className +" active_left");
				//x[y].setAttribute("className", x[y].className +" active_left");
			}
		} else {
			//alert(jbhref);
			x[y].setAttribute("class", x[y].className +" active_left");
			//x[y].setAttribute("className",x[y].className +" active_left");
		}
			
		}
	}
}




addEvent(window, 'load', checkActiveleft, false);
addEvent(window, 'load', checkActive, false);

