<!--
// If any subheading is showing, it is named here. Otherwise, it is 0.
visibleSubheading = 0;
// If any heading has been hidden, it is named here. Otherwise, it is 0.
hiddenHeading = 0;

// If any secondary nav subheading is showing, it is named here. Otherwise, it is 0.
visibleSubheadingTwo = 0;
// If any secondary nav heading has been hidden, it is named here. Otherwise, it is 0.
hiddenHeadingTwo = 0;

$VERSION$ = 1.0;

var colorCode;
var colorHex;
var tabBgHex;


function popAltView(url) {
  newwindow=window.open(url,'name','height=570,width=600,top=60,left=80');
	if (window.focus) {newwindow.focus()}
	return false;
}

function popOther(url) {
  newwindow=window.open(url,'name','height=500,width=600,top=60,left=80,scrollbars=1');
	if (window.focus) {newwindow.focus()}
	return false;
}

function popShopping(url) {
  newwindow=window.open(url,'name','height=544,width=704,top=60,left=80,scrollbars=1');
	if (window.focus) {newwindow.focus()}
	return false;
}

function popEmailFriend(url) {
  newwindow=window.open(url,'name','height=750,width=704,top=60,left=80,scrollbars=1');
	if (window.focus) {newwindow.focus()}
	return false;
}

function popPromoPods(url) {
  newwindow=window.open(url,'name','height=250,width=340,top=250,left=250,scrollbars=0');
	if (window.focus) {newwindow.focus()}
	return false;
}

function popShippingRates(url) {
  newwindow=window.open(url,'name','height=200,width=210,top=60,left=80');
	if (window.focus) {newwindow.focus()}
	return false;
}

function show(pageElement) {  
  document.getElementById(pageElement).style.visibility = "visible"; 
}

function hide(pageElement) {  
  document.getElementById(pageElement).style.visibility = "hidden"; 
}

function showSubmenu(pageElement) {  
  document.getElementById(pageElement).style.visibility = "visible"; 
  document.getElementById(pageElement).style.display = "inline";
}

function showError(pageElement) {  
  document.getElementById(pageElement).style.visibility = "visible"; 
  document.getElementById(pageElement).style.display = "inline";
}

function hideSubmenu(pageElement) {  
  document.getElementById(pageElement).style.visibility = "hidden"; 
  document.getElementById(pageElement).style.display = "none";
}

function showHeading(heading) {  
  document.getElementById(heading).style.visibility = "visible"; 
  document.getElementById(heading).style.display = "inline";
}

function hideHeading(heading) {
  document.getElementById(heading).style.visibility = "hidden"; 
  document.getElementById(heading).style.display = "none";
  hiddenHeading = heading;
}

function showSubheading(subheading) {
  document.getElementById(subheading).style.visibility = "visible"; 
  document.getElementById(subheading).style.display = "block";
  visibleSubheading = subheading;
}

function hideSubheading(subheading) {
  document.getElementById(subheading).style.visibility = "hidden"; 
  document.getElementById(subheading).style.display = "none";
  visibleSubheading = 0;
}

function changeHeading(subheading) {
	// If the heading's subheading is not visible, show it...
	if (document.getElementById(subheading).style.visibility != "visible") {
		// If any other subheading is showing, hide it (old version also showed the old subheading's heading)...
		if (visibleSubheading != 0) {
			hideSubheading(visibleSubheading);
			// showHeading(hiddenHeading);
		}
		// ...then show the new heading's subheading (and hide its heading).
		showSubheading(subheading);
		// hideHeading(heading);
	// ...or else hide the heading's subheading (and show the heading).
	} else {
		hideSubheading(subheading);
		// showHeading(heading);
	}
}

function showHeadingTwo(heading) {  
  document.getElementById(heading).style.visibility = "visible"; 
  document.getElementById(heading).style.display = "inline";
}

function hideHeadingTwo(heading) {
  document.getElementById(heading).style.visibility = "hidden"; 
  document.getElementById(heading).style.display = "none";
  hiddenHeadingTwo = heading;
}

function showSubheadingTwo(subheading) {
  document.getElementById(subheading).style.visibility = "visible"; 
  document.getElementById(subheading).style.display = "inline";
  visibleSubheadingTwo = subheading;
}

function hideSubheadingTwo(subheading) {
  document.getElementById(subheading).style.visibility = "hidden"; 
  document.getElementById(subheading).style.display = "none";
	visibleSubheadingTwo = 0;
}

function changeHeadingTwo(heading, subheading) {
	// If the heading's subheading is not visible, show it...
	if (document.getElementById(subheading).style.visibility != "visible") {
		// If any other subheading is showing, hide it (in the old site, we would also show the old subheading's heading)...
		if (visibleSubheadingTwo != 0) {
			hideSubheadingTwo(visibleSubheadingTwo);
			// showHeadingTwo(hiddenHeadingTwo);
		}
		// ...then show the new heading's subheading (in the old site, we would also hide the new heading).
		showSubheadingTwo(subheading);
		// hideHeadingTwo(heading);
	// ...or else hide the heading's subheading (in the old site, we would also show the heading).
	} else {
		hideSubheadingTwo(subheading);
		// showHeadingTwo(heading);
	}
}

function WM_preloadImages() {

/*
WM_preloadImages()
Loads images into the browser's cache for later use.

Source: Webmonkey Code Library
(http://www.hotwired.com/webmonkey/javascript/code_library/)

Author: Nadav Savio
Author Email: nadav@wired.com

Usage: WM_preloadImages('image 1 URL', 'image 2 URL', 'image 3 URL', ...);
*/

  // Don't bother if there's no document.images
  if (document.images) {
    if (typeof(document.WM) == 'undefined'){
      document.WM = new Object();
    }
    document.WM.loadedImages = new Array();
    // Loop through all the arguments.
    var argLength = WM_preloadImages.arguments.length;
    for(arg=0;arg<argLength;arg++) {
      // For each arg, create a new image.
      document.WM.loadedImages[arg] = new Image();
      // Then set the source of that image to the current argument.
      document.WM.loadedImages[arg].src = WM_preloadImages.arguments[arg];
    }
  }
}

function updateHotspot(num){
	arrOff = arrNum[currentNum].split("#");
	WM_imageSwap(document.getElementById(arrOff[0]), arrOff[1]);
	WM_imageSwap(document.getElementById(arrOff[3]), arrOff[4]);
	hideSubmenu(arrOff[6]);
	arrOn = arrNum[num].split("#");
	WM_imageSwap(document.getElementById(arrOn[0]), arrOn[2]);
	WM_imageSwap(document.getElementById(arrOn[3]), arrOn[5]);
	showSubmenu(arrOn[6]);
	currentNum = num;
}

function updateHotspotBrewer(num){
	arrOff = arrNum[currentNum].split("#");
	WM_imageSwap(document.getElementById(arrOff[0]), arrOff[1]);
	hideSubmenu(arrOff[3]);
	arrOn = arrNum[num].split("#");
	WM_imageSwap(document.getElementById(arrOn[0]), arrOn[2]);
	showSubmenu(arrOn[3]);
	currentNum = num;
}

function WM_imageSwap(daImage, daSrc){
  var objStr,obj;
  /*
    WM_imageSwap()
    Changes the source of an image.

    Source: Webmonkey Code Library
    (http://www.hotwired.com/webmonkey/javascript/code_library/)

    Author: Shvatz
    Author Email: shvatz@wired.com

    Usage: WM_imageSwap(originalImage, 'newSourceUrl');

    Requires: WM_preloadImages() (optional, but recommended)
    Thanks to Ken Sundermeyer (ksundermeyer@macromedia.com) for his help
    with variables in ie3 for the mac. 
    */

  // Check to make sure that images are supported in the DOM.
  if(document.images){

    // Check to see whether you are using a name, number, or object
    if (typeof(daImage) == 'string') {
      // This whole objStr nonesense is here solely to gain compatability
      // with ie3 for the mac.
        objStr = 'document.getElementById(' + daImage + ')';
      obj = eval(objStr);
      obj.src = daSrc;
    } else if ((typeof(daImage) == 'object') || daImage || daImage.src) {
      daImage.src = daSrc;
    }
  }
}

function init() {
	// If the current page is a subpage of a heading, show the heading's subheading.
  if ((document.URL.indexOf("http://www.simplehuman.com/products/") != -1) || (document.URL.indexOf("\\products\\") != -1)) {
    showSubheading('prod_subheading');
    hideHeading('products_heading');
    if ((document.URL.indexOf("http://www.simplehuman.com/IamSteel") != -1) || (document.URL.indexOf("\\IamSteel") != -1)) {
      showSubheadingTwo('IamSteel_subheading');
      hideHeadingTwo('IamSteel_heading');
    } else if ((document.URL.indexOf("http://www.simplehuman.com/CanWorks") != -1) || (document.URL.indexOf("\\CanWorks") != -1)) {
      showSubheadingTwo('CanWorks_subheading');
      hideHeadingTwo('CanWorks_heading');
    }      
  } else if ((document.URL.indexOf("http://www.simplehuman.com/about_simplehuman/") != -1) || (document.URL.indexOf("\\about_simplehuman\\") != -1) || (document.URL.indexOf("simplehuman.typepad.com") != -1)) {
    showSubheading('about_subheading');
    hideHeading('about_heading');
  } else if ((document.URL.indexOf("http://www.simplehuman.com/retailer_locator/") != -1) || (document.URL.indexOf("\\retailer_locator\\") != -1)) {
    showSubheading('wherebuy_subheading');
    hideHeading('wherebuy_heading');
  } else if ((document.URL.indexOf("http://www.simplehuman.com/efficient_living/") != -1) || (document.URL.indexOf("\\efficient_living\\") != -1)) {
    showSubheading('effic_subheading');
    hideHeading('effic_heading');
  } else if ((document.URL.indexOf("http://www.simplehuman.com/customer_service/") != -1) || (document.URL.indexOf("\\customer_service\\") != -1)) {
    showSubheading('support_subheading');
    hideHeading('support_heading');
  } else if ((document.URL.indexOf("http://www.simplehuman.com/register/") != -1) || (document.URL.indexOf("\\register\\") != -1)) {
    showSubheading('support_subheading');
    hideHeading('support_heading');
  } else {
  	return;
  }
}

function isCompleteIdeasForm() {
  if ( 
    (document.ideasForm.firstName.value != "") && 
    (document.ideasForm.lastName.value != "") && 
    (document.ideasForm.email.value != "") && 
    (document.ideasForm.phoneArea.value != "select") && 
    (document.ideasForm.phonePrefix.value != "") && 
    (document.ideasForm.phoneLast4.value != "") && 
    (document.ideasForm.ideaTitle.value != "") && 
    (document.ideasForm.ideaDescr.value != "select") && 
    (document.ideasForm.readGuidelines.checked) 
  )
  {
    return true;
  } 
  else
  {
    showError('incompleteFormError');
    return false;
  }
}

function isCompleteKioskOfferForm() {
  if ( 
    (document.kioskOfferForm.firstName.value != "") && 
    (document.kioskOfferForm.lastName.value != "") && 
    (document.kioskOfferForm.email.value != "")
  )
  {
    return true;
  } 
  else
  {
    showError('incompleteFormError');
    return false;
  }
}

function isCompleteEmailFriendForm() {
  if ( 
    (document.emailFriendForm.firstName.value != "") && 
    (document.emailFriendForm.lastName.value != "") && 
    (document.emailFriendForm.friendEmailAddress.value != "") &&
    (document.emailFriendForm.yourEmailAddress.value != "")
  )
  {
    return true;
  } 
  else
  {
    showError('incompleteFormError');
    return false;
  }
}

function isCompleteContactForm() {
  if ( 
    (document.contactForm.name.value != "") && 
    (document.contactForm.email.value != "") && 
    (document.contactForm.phone.value != "") && 
    (document.contactForm.subject.value != "") && 
    (document.contactForm.description.value != "") 
  )
  {
    return true;
  } 
  else
  {
    showError('incompleteFormError');
    if (document.contactForm.name.value == "")
    {
      showError('fullNameError');
    }
    if (document.contactForm.email.value == "")
    {
      showError('emailError');
    }
    if (document.contactForm.phone.value == "")
    {
      showError('phoneError');
    }
    if (document.contactForm.subject.value == "")
    {
      showError('subjectError');
    }
    if (document.contactForm.description.value == "")
    {
      showError('descriptionError');
    }
    return false;
  }
}

function isCompleteContactFormUk() {
  if ( 
    (document.contactFormUk.forename.value != "") && 
    (document.contactFormUk.surname.value != "") && 
    (document.contactFormUk.emailUk.value != "") && 
    (document.contactFormUk.phoneUk.value != "") && 
    (document.contactFormUk.note.value != "") 
  )
  {
    return true;
  } 
  else
  {
    showError('incompleteFormUkError');
    if (document.contactFormUk.forename.value == "")
    {
      showError('forenameError');
    }
    if (document.contactFormUk.surname.value == "")
    {
      showError('surnameError');
    }
    if (document.contactFormUk.emailUk.value == "")
    {
      showError('emailUkError');
    }
    if (document.contactFormUk.phoneUk.value == "")
    {
      showError('phoneUkError');
    }
    if (document.contactFormUk.note.value == "")
    {
      showError('noteError');
    }
    return false;
  }
}

function isCompleteRegForm() {
  if ( 
    (document.regForm.firstName.value != "") && 
    (document.regForm.lastName.value != "") && 
    (document.regForm.addr1.value != "") && 
    (document.regForm.city.value != "") && 
    (document.regForm.state.value != "select") && 
    (document.regForm.zip.value != "") && 
    (document.regForm.email.value != "") && 
    (document.regForm.product.value != "select") && 
    (document.regForm.retailer.value != "") && 
    (document.regForm.purchaseDateMM.value != "") && 
    (document.regForm.purchaseDateDD.value != "") && 
    (document.regForm.whereUse.value != "select") && 
    (document.regForm.householdCount.value != "") && 
    (document.regForm.styling.value != "select") && 
    (document.regForm.priceValue.value != "select") && 
    (document.regForm.functionality.value != "select") && 
    (document.regForm.brand.value != "select") && 
    (document.regForm.ownedOtherProducts.value != "") && 
    (document.regForm.prevTrashcan.value != "select") && 
    (document.regForm.triedSurefit.value != "") && 
    (document.regForm.useDeodorizer.value != "") && 
    (document.regForm.useDishrack.value != "") && 
    (document.regForm.internetPurchaseFreq != "select") && 
    (document.regForm.whereHeard.value != "") && 
    (document.regForm.likelyToRecommend.value != "select") 
  )
  {
    return true;
  } 
  else
  {
    showError('incompleteFormError');
    return false;
  }
}

function isCompleteLinerSpecialForm() {
  var optionWherePurchased = -1, optionHowResearchedPurchase = -1, optionStoreMostVisited = -1, optionStore2ndMostVisited = -1;
  var valueWherePurchased, valueStoreMostVisited, valueStore2ndMostVisited;

  for (i = 0; i < document.linerSpecialForm.wherePurchased.length; i++) {
    if (document.linerSpecialForm.wherePurchased[i].checked) {
      optionWherePurchased = i;
      valueWherePurchased = document.linerSpecialForm.wherePurchased[i].value;
    }
  }

  for (i = 0; i < document.linerSpecialForm.howResearchedPurchase.length; i++) {
    if (document.linerSpecialForm.howResearchedPurchase[i].checked) {
      optionHowResearchedPurchase = i;
    }
  }

  for (i = 0; i < document.linerSpecialForm.storeMostVisited.length; i++) {
    if (document.linerSpecialForm.storeMostVisited[i].checked) {
      optionStoreMostVisited = i;
      valueStoreMostVisited = document.linerSpecialForm.storeMostVisited[i].value;
    }
  }

  for (i = 0; i < document.linerSpecialForm.store2ndMostVisited.length; i++) {
    if (document.linerSpecialForm.store2ndMostVisited[i].checked) {
      optionStore2ndMostVisited = i;
      valueStore2ndMostVisited = document.linerSpecialForm.store2ndMostVisited[i].value;
    }
  }

  if ((optionWherePurchased == -1) || (optionHowResearchedPurchase == -1) || (optionStoreMostVisited == -1) || (optionStore2ndMostVisited == -1) ) {
    showError('incompleteFormError');
    return false;
  } else if (  ((valueStoreMostVisited == "other") && (document.linerSpecialForm.storeMostVisitedOther.value == "")) || 
              ((valueWherePurchased == "other") && (document.linerSpecialForm.wherePurchasedOther.value == "")) || 
              ((valueStore2ndMostVisited == "other") && (document.linerSpecialForm.store2ndMostVisitedOther.value == "")) ) {
    showError('incompleteFormError');
    return false;
  } else if (document.linerSpecialForm.email.value == "") {
    showError('incompleteFormError');
    return false;
  } else {
    return true;
  }
}
  
function isCompleteCouponForm() {
  var optionWhereHeard = -1;
  var valueWhereHeard = "unchecked";

  for (i = 0; i < document.emailCouponForm.whereHeard.length; i++) {
    if (document.emailCouponForm.whereHeard[i].checked) {
      optionWhereHeard = i;
      valueWhereHeard = document.emailCouponForm.whereHeard[i].value;
    }
  }

  if (optionWhereHeard == -1) {
    showError('incompleteFormError');
    return false;
  } else if ( (valueWhereHeard != "unchecked") && (valueWhereHeard != "word of mouth") && (document.emailCouponForm.whereHeardSpecify.value == "") ) {
    showError('incompleteFormError');
    return false;
  } else if (document.emailCouponForm.email.value == "") {
    showError('incompleteFormError');
    return false;
  } else {
    return true;
  }
}
  
function isCompleteUpgradeFormOld() {
  var optionEverPurchased = -1;
  var valueEverPurchased = "unchecked";

  for (i = 0; i < document.upgradeForm.everPurchased.length; i++) {
    if (document.upgradeForm.everPurchased[i].checked) {
      optionEverPurchased = i;
      valueEverPurchased = document.upgradeForm.everPurchased[i].value;
    }
  }
  if ( (valueEverPurchased == "yes") && (document.upgradeForm.nameOfStore.value == "") ) {
    showError('incompleteFormError');
    return false;
  }
  if ( (document.upgradeForm.bagOverhang.checked) || (document.upgradeForm.doesntFitSpace.checked) || (document.upgradeForm.doesntMatchKitchen.checked) || (document.upgradeForm.flimsyPedal.checked) || (document.upgradeForm.hardToRemoveBag.checked) || (document.upgradeForm.otherCurrentProblem.checked) || (document.upgradeForm.noCurrentProblem.checked) ) {
    ;
  } else {
    showError('incompleteFormError');
    return false;
  }
  if ( (document.upgradeForm.otherCurrentProblem.checked) && (document.upgradeForm.otherCurrentProblemSpecify.value == "") ) {
    showError('incompleteFormError');
    return false;
  }
  if ( (document.upgradeForm.quality.checked) || (document.upgradeForm.price.checked) || (document.upgradeForm.spaceEfficient.checked) || (document.upgradeForm.easyToUse.checked) || (document.upgradeForm.practicalFeatures.checked) || (document.upgradeForm.appearance.checked) || (document.upgradeForm.warranty.checked) || (document.upgradeForm.otherImportantFactor.checked) ) {
    ;
  } else {
    showError('incompleteFormError');
    return false;
  }
  if ( (document.upgradeForm.otherImportantFactor.checked) && (document.upgradeForm.otherImportantFactorSpecify.value == "") ) {
    showError('incompleteFormError');
    return false;
  }
  if (document.upgradeForm.email.value == "") {
    showError('incompleteFormError');
    return false;
  } else {
    return true;
  }
}
  
function isCompleteUpgradeForm() {
  var optionEverPurchased = -1;
  var valueEverPurchased = "unchecked";

  for (i = 0; i < document.upgradeForm["00N30000000tkNk"].length; i++) {
    if (document.upgradeForm["00N30000000tkNk"][i].checked) {
      optionEverPurchased = i;
      valueEverPurchased = document.upgradeForm["00N30000000tkNk"][i].value;
    }
  }
  if ( (valueEverPurchased == "yes") && (document.upgradeForm["00N30000000sAiC"].value == "") ) {
    showError('incompleteFormError');
    return false;
  }
  if ( (document.upgradeForm["00N30000000tkJe"].checked) || (document.upgradeForm["00N30000000tkQK"].checked) || (document.upgradeForm["00N30000000tkQP"].checked) || (document.upgradeForm["00N30000000tkQe"].checked) || (document.upgradeForm["00N30000000tkQj"].checked) || (document.upgradeForm["00N30000000tkdA"].checked) || (document.upgradeForm["00N30000000tkQt"].checked) ) {
    ;
  } else {
    showError('incompleteFormError');
    return false;
  }
  if ( (document.upgradeForm["00N30000000tkdA"].checked) && (document.upgradeForm["00N30000000tkPq"].value == "") ) {
    showError('incompleteFormError');
    return false;
  }

  if ( (document.upgradeForm["00N30000000tkR3"].checked) || (document.upgradeForm["00N30000000tkRD"].checked) || (document.upgradeForm["00N30000000tkRN"].checked) || (document.upgradeForm["00N30000000tkRc"].checked) || (document.upgradeForm["00N30000000tkRr"].checked) || (document.upgradeForm["00N30000000tkSa"].checked) || (document.upgradeForm["00N30000000tkSp"].checked) || (document.upgradeForm["00N30000000tkqw"].checked) ) {
    ;
  } else {
    showError('incompleteFormError');
    return false;
  }
  if ( (document.upgradeForm["00N30000000tkqw"].checked) && (document.upgradeForm["00N30000000tkQ0"].value == "") ) {
    showError('incompleteFormError');
    return false;
  }
  if (document.upgradeForm.email.value == "") {
    showError('incompleteFormError');
    return false;
  } else {
    return true;
  }
}
  


function writeAltViewLinkCode(itemName, linksAmount, columns)
{
	var result = "<div class=\"altviews\">\n";
	result = result + "<h3>alternate views:</h3>\n";
	for(var i = 1; i<=linksAmount; i++){
		result = result + "<a href=\"http://www.tecportoptics.com/2007/alternate-views.html?";
		result = result + itemName + "," + i + "," + linksAmount + "\" ";
		result = result + "onclick=\"return popAltView('http://www.tecportoptics.com/2007/alternate-views.html?";
		result = result + itemName + "," + i + "," + linksAmount + "');\">";
		result = result + "<img src=\"http://www.tecportoptics.com/2007/images/altthumbs/th-";
		result = result + itemName + "-" + i + ".jpg\" alt=\"\" ";
		if (i % columns == 0)
			result = result + "class=\"thumbAltviewEnd\" /></a><br /\n>";
		else
			result = result + "class=\"thumbAltview\" /></a\n>";
	}
	result = result + "</div>\n";
	document.write(result);
}
// -->
