function setUpNav() {        
  if (defaultNavNum == 2 || defaultNavNum == 5) {                    
    document.getElementById("topNav" + defaultNavNum).className = "selected" + defaultNavNum;                    
  } else {            
    document.getElementById("topNav" + defaultNavNum).className = "selected";        
  }        
  if (document.getElementById("headerSearchInput").value != "Search AOL Shopping") {            
    document.getElementById("headerSearchInput").className = "aol_inputSearch";        
  }        
  if (document.getElementById("footerSearchInput").value != "Search AOL Shopping") {            
    document.getElementById("footerSearchInput").className = "aol_inputSearch";        
  }    
}    

function changeTopNav (optionId) {        
  for (var i = 1; i < 8; i++) {            
    document.getElementById("topNav" + i).className = "";        
  }              
              
  if (optionId != 0) {            
    if (optionId == 2 || optionId == 5) {                
      document.getElementById("topNav" + optionId).className = "selected" + optionId;                         
    } else {                
      document.getElementById("topNav" + optionId).className = "selected";                          
    }        
  } else {            
    setUpNav();        
  }    
}

function openIM() {
	if (navigator.userAgent.indexOf("AOL") != -1) {
		location.href = "aol://9293::<a href=\"" + location.href + "\">SHOP.AOL.CA</a>";
	} else {
		window.open('http://aimexpress.aol.com/','','directories=no,scrollbars=yes,height=500,location=no,menubar=no,status=no,toolbar=no,width=500');
	}
}

function submitProdSearch(formType) {
	formStr = "prodSearchFinalFrm";
	if (formType == "ebay") {
		formStr = "prodEBaySearchFinalFrm";
	}
	//alert(formType + " - " + formStr);
	
	//formElement = document.getElementById(formStr);
	//alert(formElement);
	
	spi = /^\s*$/;
	catSelect = document.getElementById(formStr).catSelect.value;
	kwStr = document.getElementById(formStr).kw.value;
	
	if (catSelect == "") {
		alert("Please select a Search Category");
	} else if (spi.test(document.getElementById(formStr).kw.value)) {
		alert("Please enter a Search Term");
	} else {
		if (catSelect != "sale" && catSelect != "all" && catSelect != "ebay") {
			document.getElementById(formStr).dId.value = catSelect;
		}
		document.getElementById(formStr).submit();
	}
	return false;
}

function openNewWindow (urlStr, width, height) {
	window.open(urlStr,null,"toolbar=no,scrollbars=yes,width=" + width + ",height=" + height);
}

function starsOff() {
	for (i = 0; i < 5; i++) {
		document.getElementById("star_" + i).className = "star starOff";
	}
}

function switchStar(starNo) {
	starsOff();

	for (i = 0; i <= starNo; i++) {
		document.getElementById("star_" + i).className = "star starOn";
	}
}

function submitTopSearch(f) {
	spi = /^\s*$/;
	if (spi.test(f.kw.value) || f.kw.value == "Search AOL Shopping") {
		alert("Please enter a Search Term.");
	} else {
		f.submit();
	}
	return false;
}
