function setCompare(){
	compVar = 1;
	compButton = document.getElementById('compareBtn');
	compLink = compButton.getElementsByTagName("a");
	alert(compLink.innerHTML);
	tmp = compLink[0].getElementsByTagName("span");
	compButtonText = tmp[0].innerHTML;
	
	//t = document.getElementById('listTable');
	//alert(t.td.length)
}
function sendCompare(){
	retStr = false;
	for(i=0;i<document.forms['compareForm'].ids.length;i++){
			if(document.forms['compareForm'].ids[i].checked){
				retStr = true;
				retStr = document.forms['compareForm'].ids[i].checked;
				document.forms['compareForm'].submit();
			}
	}
 if(!retStr){
		alert("Please choose two or more products to compare");
 }
 return retStr;
}
function compare(t){
	compVar ++;
	highlight(t,'#9D9EC4');
	showHideComp();
	showHide('note1');
	
	x = t.getElementsByTagName("div")
	text = x[0].innerHTML;
	if(text==compButtonText || text=="<a>"+compButtonText+"</a>"){
		x[0].innerHTML = "Compare Now";
	}else{
		document.forms['compareForm'].submit();
		x[0].innerHTML = compButtonText;
	}
}

function setTextareas(){
	y = document.getElementById("edu").scrollHeight;
	y2 = document.getElementById("sum").scrollHeight;

	document.getElementById('edu').style.height = String(y)+"px";
	document.getElementById('sum').style.height = String(y2)+"px";

	/*
	y = document.getElementById('measurement');
	y2 = document.getElementById('measurement2');
	y.style.display = "none";
	y2.style.display = "none";
	*/
}

function setPage(title){
	str = window.location.search;//picks up the ?id=[]&page=[] values
	str = str.substr(1);//takes off the ?
	x = str.split("page=");//splits at the "page" variable
	y = x.pop()//takes off the last entry in the array (ie the "id" var)
	z = y.split("%20");//splits at any spaces (%20)...
	str = z.join(" ")//... then re-joins using the space (" ")
	if(str==""){
		str = "Home";
	}
	if(document.getElementById(str)){
		document.getElementById(str).style.display = 'block';
	}
	if(document.getElementById(str+"Nav")){
		document.getElementById(str+"Nav").className = 'clicked';
	}
	if(String(title)!="undefined"){
		t = document.getElementById("pageTitle");
		document.title = String(title) + " - " + document.title;
		t.innerHTML = title;
	}
}
function takeLinkNav(x){
	linkText = x.innerHTML;
	linkText = linkText.replace(/\&amp\;/,"&");
	//alert(linkText);
	if(x.href.match(/\?/)=="?"){
		x.href += "&page=" + linkText;
	}else{
		x.href += "?page=" + linkText;
	}
}
function takeLink(x){ 
  x.href += "&page=" + x.id;
}
function spawn(first,second,third){
	var x = new Array(first);
	for(i = 1; i < second; i++){
		x.push(first);
	}
	if(third){
		x = x.reverse();
	}
	return x;
}
function showHideComp(){
	x = document.getElementsByName('compare');
	//x = document.getElementsById('compare');
	//alert(x.length);
	for (y = 0; y < x.length; y++){
		tmpName = x[y];
		//alert(tmpName);
		if(tmpName.style.display == 'block'){
			tmpName.style.display = 'none';
		}else{
			tmpName.style.display = 'block';
		}
	}

}
function highlight(ting,col){
	if(ting.style.backgroundColor == ''){
		ting.style.backgroundColor = col;
	}else{
		ting.style.backgroundColor = '';
	}
}
function swapPic(x){
	option1 = "drawing";
	option2 = "image";
	if(x==option1){
		clicked = document.getElementById(option1);
		notClicked = document.getElementById(option2);
	}else{
		notClicked = document.getElementById(option1);
		clicked = document.getElementById(option2);
	}
	if(clicked.style.textDecoration == 'underline'){
		document.getElementById('placeHolder').src = pictureSwap1.src;
		clicked.style.textDecoration = 'none';
		notClicked.style.textDecoration = 'underline';
	}else{
		document.getElementById('placeHolder').src = pictureSwap2.src;
		clicked.style.textDecoration = 'underline';
		notClicked.style.textDecoration = 'none';
	}
		clicked.blur();
}
function showHide2(x){
	if(document.getElementById(x).style.display == 'block'){
		document.getElementById(x).style.display = 'none';
	}else{
		document.getElementById(x).style.display = 'block';
	}
}
function showHide(x){
	if(document.getElementById(x).style.display == 'block'){
		document.getElementById(x).parentNode.style.backgroundImage = 'url(images/folder.gif)';
		document.getElementById(x).style.display = 'none';
	}else{
		document.getElementById(x).style.display = 'block';
		document.getElementById(x).parentNode.style.backgroundImage = 'url(images/folder2.gif)';
	}
}

function mw_crumbs(divider,default_page,root){
	if(!divider) { divider = " > " }
	if(!default_page){ default_page = "index.asp" }
	var m = location.toString(),h = "";
	m = m.substring(m.indexOf("/") + 1);
	m = m.split("/");
	var howmany = spawn("../",m.length,true);
	howmany[m.length] = default_page;
	for(i = 1;i<m.length-1;i++){
		h += ("<a href = "+howmany[i+2]+">"+unescape( m[i]+"</a>"+divider))
	}
	h = h.substr(0,h.length-2);
	//h += "<b>"+document.title+"</b>";
	if(root) {
		h = h.replace(eval("/"+location.host+"/"),root);
	}
	h += "";
	return h
}