/*
 *Disclaimer Popup Function - used for opening the template /global/disclaimers_popup.jsp
 */
function discPop() {
	var popupUrl = "/global/disclaimers_popup.jsp?contentName=/media/popups/shared/Disclaimers";
	var popupName = "disclaimerPopup";
	var popupOptions = "width=500,height=600,scrollbars=yes,menubar=no,resizable=yes,location=no,toolbar=no"; 
	
	var popupWin = window.open(popupUrl, popupName, popupOptions);
	if (window.focus) {
		popupWin.focus();
	}
	
	return;
}// discPop


/*
 *Image Switching Function
 *used for changing the main image on the product page to a Scene7 alternate view.
 */
function updateScene7Image(theImage) {
	document.images.featuredImage.src = theImage;
}// updateScene7Image


/* Pull a query string variable and return the value */
function getValue(varname) {
  //the querystring, everything after the ?
  var query = location.search.substring(1);
  var vars = query.split("&");// Split the query string into variables (separates by &s)
  var value = "";// Initialize the value with "" as default

  // Iterate through vars, checking each one for varname
  for (i=0;i<vars.length;i++){   
    var parts = vars[i].split("=");// Split the variable by =, which splits name and value
    
    // Check if the correct variable
    if (parts[0] == varname){
      // Load value into variable
      value = parts[1];
      break;
    }
  }
  
  // Convert escape code
  value = unescape(value);

  // Return the value
  return value;
}// getValue

/* used on the carousel pages as a secondary navigation appearing in the mainContentUpperLTA DIV.
1. Setup a ul with an id of mainContentUpperLTANav
2. On the onlick add the following: onclick="setActiveNow(this);"
*/
function setActiveNow(obj) {
   var linkList = document.getElementById("mainContentUpperLTANav").getElementsByTagName("a");
   for (i = 0; i < linkList.length; i++) {
	  linkList[i].className = "";
   }
   obj.className = "active";
}

//if initial panel is being set this function updates the navigation.
function setActiveByPanel(panel) {
	panel--;   
	var linkList = document.getElementById("mainContentUpperLTANav").getElementsByTagName("a");
	for (i = 0; i < linkList.length; i++) {
		linkList[i].className = "";
	}
	linkList[panel].className = "active";
}

