function goURL(s) {       
	var d = s.options[s.selectedIndex].value
    window.top.location.href = d
    s.selectedIndex=0
}

//-----------------------------
 //dropout tree menu script //
//---------------------------- 
/*
if (document.getElementById){  //sets initial state of the menu to hidden - block this code to initially show
	document.write('<style type="text/css">\n')
	document.write('.submenu{display: none;margin-bottom: 15px;}\n')
	document.write('</style>\n')
}
*/
function getElementsByStyleClass (className) {
  var all = document.all ? document.all :
    document.getElementsByTagName('*');
  var elements = new Array();
  for (var e = 0; e < all.length; e++)
    if (all[e].className == className)
      elements[elements.length] = all[e];
  return elements;
}
function hideAll() {
		var subs = getElementsByStyleClass('subcat');
		for(i = 0; i < subs.length; i++) {
			subs[i].style.display = "none";
		}
	
}
function showHide(obj) { //onclick either shows or hides the current dropout
	
	//hideAll();
	var showEl = document.getElementById(obj);
	//var showAr = document.getElementById("navMenu").getElementsByTagName("span");
	if(showEl.style.display != "block"){ 
		showEl.style.display = "block";
	} else {
		showEl.style.display = "none";
	}
}

function openWin(theURL,winName,w,h,scroll) { 

	if ((screen.width<=1024) && (screen.height<=768)) {
		settings = 'height='+screen.height*.89+',width='+screen.width*.89+',scrollbars='+scroll+',resizable=no';
	} else {
		LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	    TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	    settings ='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable=no';
	}
	window.open(theURL,winName,settings);
}

function swapImageViewed(image){
	//var newImage = selectedView + currentImage;
	window.document.imageViewed.src = 'images/catalog/'+image;
}

function userFormCheck(formobj){
	// name of mandatory fields
	var fieldRequired = Array("name", "username", "password", "password2", "permission", "email");
	// field description to appear in the dialog box
	var fieldDescription = Array("Name", "Username", "Password", "Verify Password", "permission", "Email");
	// dialog message
	var alertMsg = "Please complete the following fields:\n";
	
	var l_Msg = alertMsg.length;
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
			}
			if (obj.type == undefined){
				var blnchecked = false;
				for (var j = 0; j < obj.length; j++){
					if (obj[j].checked){
						blnchecked = true;
					}
				}
				if (!blnchecked){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
			}
		}
	}

	if (alertMsg.length == l_Msg){
		return true;
	}else{
		alert(alertMsg);
		return false;
	}
}

/*
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

*/