/*********************************************************
Global JS file for GEAppliances.com (as of 08/09 redesign)
*********************************************************/


// fixes IE6 background image flicker bug
try {
	document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}

// global vars
var popupWin;
var scrnwidth=screen.width;
var scrnheight=screen.height;


// define Base_Href variable for testing purposes
var exceptions = new Array();
	var i = 0;
	exceptions[i++] = "postsaleservice";
	exceptions[i++] = "consumerspot";
	exceptions[i++] = "aftermind";
	exceptions[i++] = "geapplianceparts";
	exceptions[i++] = "genet2";
	exceptions[i++] = "genet";
	exceptions[i++] = "millstone";
	exceptions[i++] = "products";
	exceptions[i++] = "monogram";
	exceptions[i++] = "ap1lnx";
	exceptions[i++] = "answers";
	exceptions[i++] = "prodcontent";

var Base_Href = window.location.protocol +"//www.geappliances.com";
var UnSecure_Base_Href = "http://www.geappliances.com";
if (window.location.host.indexOf('team') != -1)
{
	var Base_Href = window.location.protocol +"//"+ window.location.host;
	var UnSecure_Base_Href = "http://"+ window.location.host;
	for (count = 0; count < exceptions.length; count++)
	{
		if (window.location.host.indexOf(exceptions[count]) != -1)
		{
			var Base_Href = window.location.protocol +"//www.geappliances.com";
			var UnSecure_Base_Href = "http://www.geappliances.com";
		}//Close if
	}//Close for
}//Close if




// "only 1 open at a time" popup function.
//-----------------------------------------------------------------------------
// The fifth argument, windowname, is optional.  If specified, it is passed as
// the second argument to window.open().  This is required in order to leave
// the popup opener page (without closing the popup), come back to it, and NOT
// have a duplicate popup window.
//-----------------------------------------------------------------------------
function openPop (url, width, height, addloptions, windowname) {
	if (windowname == null) {
		windowname = "";
	}
	var xspot = Math.round((scrnwidth/2)-(width/2));
	var yspot = Math.round((scrnheight/2)-(height/2)-30);
	features = "height="+height+",width="+width+",top="+yspot+",screenY="+yspot+",left="+xspot+",screenX="+xspot;
	if (addloptions && addloptions!="") { features += ","+addloptions; }
	if (!popupWin || popupWin.closed) {
		popupWin = window.open(url, windowname, features);
	}
	else {
		window.popupWin.close();
		popupWin = window.open(url, windowname, features);
	}
}


/*
Function to encode special characters, as well as anything that's not
printable ASCII, as HTML entities for safe inclusion in generated HTML.
	
Usage example:

	document.write('<a href="' + encodeEntities(url) + '">moo</a>\n');
*/
function encodeEntities (s) {
	s = s.replace(/&/g, "&amp;");
	s = s.replace(/</g, "&lt;");
	s = s.replace(/>/g, "&gt;");
	s = s.replace(/\x22/g, "&quot;"); /* double quotation mark */
	s = s.replace(/\x27/g, "&#39;"); /* ASCII apostrophe -
		&apos; is not universal yet */
	s = s.replace(/[^\x20-\x7e]/g,
		function (ch) {
			return "&#" + ch.charCodeAt(0) + ";";
		}
	); /* escape anything other than ASCII printable */
	return s;
}

/*
based on openLarger() from http://www.gelighting.com/na/scripts/global.js

Usage example --- onclick event (also applies for href="javascript:..."):

	<a target="_blank" href="images/foo.jpg"
		onclick="openNakedImagePopup('images/foo.jpg', 640, 480, 'GE Profile(TM) Washers and Dryers'); return false;">
			view larger photo
	</a>

	Got &, <, >, ', ", or other special characters?

	<a target="_blank" href="images/foo.jpg?foo=1&amp;bar=2"
		onclick="openNakedImagePopup('images/foo.jpg?foo=1&amp;bar=2', 640, 480, 'GE Profile&trade; Washers &amp; Dryers'); return false;">
			view larger photo
	</a>

	REMEMBER:
	While this function runs encodeEntities on the imageURL and altText,
	you still need to escape <, >, &, ', and " characters in onclick events
	or any other HTML attribute value (the browser unescapes them, then
	openNakedImagePopup re-escapes them).
	While most browsers are lenient, XHTML validation tools will issue
	warnings or error messages if you do not do this.

Usage example --- <script> element (also applies for .js files):

	<script type="text/javascript">
		function openPopup () {
			openNakedImagePopup('images/foo.jpg', 640, 480, 'GE Profile(TM) Washers and Dryers');
			// Got special characters?
			openNakedImagePopup('images/foo.jpg?foo=1&bar=2', 640, 480, 'GE Profile\u2122 Washers & Dryers'); // [1] one way
			openNakedImagePopup('images/foo.jpg?foo=1&bar=2', 640, 480, 'GE Profile&trade; Washers &amp; Dryers', true); // [2] another way
			// notice lack of entity escaping here --^ in the URLs.
			// you don't need to entity-escape the URLs in <script>
			// elements or .js files.
		}
	</script>
	<a target="_blank" href="images/foo.jpg" onclick="openPopup(); return false;">
		view larger photo
	</a>

	Got &, <, >, ', ", or other special characters?

	REMEMBER:
	Since browsers do NOT unescape entities in <script> elements like they
	do in HTML attribute values, you do NOT need to do HTML entity escaping
	here.  \ escaping still applies.  See [1] above.

	If you don't like looking up Unicode hex values, you can use HTML
	entity escaping instead.  However, within <script> elements and .js
	files, you MUST pass an optional fifth argument of true.  In other
	contexts, such as onclick attributes and javascript: hrefs, you
	MUST NOT pass the optional fifth argument.  (The browser unescapes
	entities in onclick/href attributes, but not in script elements or
	.js files; the optional fifth argument tells openNakedImagePopup
	to *not* perform entity-escaping on the alt text.)
	
*/

var nakedImagePopupWindow;
function openNakedImagePopup(imageURL, width, height, altText, isEscaped) {
	var screenX = Math.round((screen.width - width) / 2);
	var screenY = Math.round((screen.height - height - 60) / 2); /* assume 60px for titlebar, toolbars, other vertical real-estate */
	var features = ( /* parenthesis for multiline expression */
		"width=" + width
		+ ",height=" + height
		+ ",screenX=" + screenX + ",screenY=" + screenY /* Netscape */
		+ ",left=" + screenX + ",top=" + screenY /* IE */
	);
	if (nakedImagePopupWindow && !(nakedImagePopupWindow.closed)) {
		nakedImagePopupWindow.close();
	}
	nakedImagePopupWindow = window.open(null, null, features);
	if (altText != null && !isEscaped) {
		altText = encodeEntities(altText);
	}
	var html = ( /* parenthesis for multiline expression */
		'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n'
		+ '<html>\n'
		+ '<head>\n'
		+ '<title>'
		+ ((altText != null) ? altText : 'Photo')
		+ '</title>\n'
		+ '<style type="text/css">\n'
		+ 'html, body { margin: 0; padding: 0; background-color: white; color: black; }\n'
		+ '</style>\n'
		+ '</head>\n'
		+ '<body>\n'
		+ '<img src="' + encodeEntities(imageURL) + '"\n'
		+ ' width="' + width + '"'
		+ ' height="' + height + '"'
		+ ((altText != null) ? (' alt="' + altText + '"') : "")
		+ ' border="0"'
		+ ' />\n'
		+ '</body>\n'
		+ '</html>\n'
	);
	nakedImagePopupWindow.document.open();
	nakedImagePopupWindow.document.write(html);
	nakedImagePopupWindow.document.close();
}


function closepopups(){
	if (popupWin && popupWin.open){
		window.popupWin.close();
	}
}

// Function to open FAQ popups
// Uses the 'openPop' function
function callOpenPop(faqFileName){
	urlFaq="/search/fast/infobase/"+faqFileName;
	openPop(urlFaq,'575','480','scrollbars,resizable,toolbar');
}

// Function to open video gallery
// Uses the 'openPop' function
function openVideoGalleryPopup(url) {
	openPop(url, 780, 730, 'scrollbars,resizable');
}

// Function to open Email-A-Friend -- ClickQuared version 
// Uses the 'openPop' function
function openEmailafriendPopup(url) {
	encurl= encodeURIComponent(url);
	openPop("http://forms.geconsumerandindustrial.com/asbs/servlet/SS?F=3123803&C=21036959&product="+encurl, 600, 630, 'scrollbars,resizable');
}


/* clears default value of text input on focus */
function textInputFocusClear(obj) {
	if(obj.value == obj.defaultValue) {
		obj.value = "";
	}
}
/* resets default value on blur if no text is entered */
function textInputBlurReset(obj) {
	if(obj.value == "") {
		obj.value = obj.defaultValue;
	}
}



//get url parameter value by name
function getParamFromURL(paramName)
{
  var regexS = "[\\?&'&amp;']"+ paramName +"=([^&#]*)";
  var regex = new RegExp( regexS );
  var tmpURL = window.location.href;
  var results = regex.exec( tmpURL );
  if( results == null )
    return "";
  else
    return results[1];
}
// Function to get a value from URL
function getValueFromURL(paramName)
{
  var regexS = "[\\?&'&amp;']"+ paramName +"=([^&#]*)";
  var regex = new RegExp( regexS );
  var tmpURL = window.location.href;
  var results = regex.exec( tmpURL );
  if( results == null )
    return "";
  else
    return results[1];
}




/***********************************************************
The "topNavSelector" function sets a selected item in the
top nav for the current page (based on the page URL and the
left nav link's HREF).

For pages that exist outside the major categories defined in
the top nav, the default behavior will be to set the home
button as selected. To force an item in the top nav to be 
set as selected, the corresponding A tag must be assigned a unique
ID in the top nav include file. Then you must pass that ID 
into the "topNavSelector" function.

This function should be run in the page immediately 
following the top nav include call.
***********************************************************/
function topNavSelector(optionalID) {
try {
	pageURL = document.location.href;
	// test for Teamsite URL
	workareaCheck = pageURL.indexOf("WORKAREA/");

	// determine URL path (testing for Teamsite, as well)
	if(workareaCheck != -1) {
		pagePath = pageURL.split("WORKAREA/")[1];
		pagePath = pagePath.substr(pagePath.indexOf("/"));
	} else {
		pagePath = location.pathname;
	}
	
	if(!optionalID || !document.getElementById(optionalID)) {
	
		var navArray = document.getElementById("topNav").getElementsByTagName("a");
		// cycle through nav items looking for one with HREF that matches the beginnging of the page URL
		for(i=0;i<navArray.length;i++) {
			
			var testHref = navArray[i].pathname;
			if(testHref.indexOf("/") != 0) { testHref = "/" + testHref; } // IE doesn't include beginning slash
			
			
			if(pagePath.indexOf(testHref) == 0 && navArray[i].parentNode.tagName != "LI") {
				navArray[i].className += " selected";
				break;
			}// if
		} // for
		
	} else {
		
		document.getElementById(optionalID).className += " selected";
		
	} // else
	
} catch(err) {} // try-catch
} // function





/* This function alternates the background color of table rows between 
	white and gray by placing a class of "odd" on every other row. 
	This function applies to tables that contain a class of 'graybarTable'.*/
function alternateOddRowsInGraybarTables () {
	/* sanity check */
	if (!document.getElementsByTagName) {
		return;
	}

	var tables = document.getElementsByTagName("table");
	for (var i = 0; i < tables.length; ++i) {
		var table = tables[i];
		if (!table.className || !/\bgraybarTable\b/.test(table.className)) {
			continue;
		}

		var els = table.getElementsByTagName("tbody");
		if (!els || !els.length) continue;
		var tbody = els[0];

		var rows = tbody.getElementsByTagName("tr");
		if (!rows || !rows.length) continue;
		for (var j = 0; j < rows.length; j += 2) {
		rows[j].className = rows[j].className + " odd";
		}
	}
}





// Function for search.
function fnMastheadSearch (form) {
	var searchField = form.SEARCHTEXT;
	searchField.value = searchField.value.replace(/\%/g, ""); // workaround bug on corporate server
	var searchValue = searchField.value;

	var categoryField = form.selSearchCategory;
	var category;
	if (categoryField.type === "select") { // legacy form
		category = categoryField.options[categoryField.selectedIndex].value;
	}
	else {			// Google-powered search form
		category = categoryField.value;
	}

	// begin validation
	switch (category) {
	case "3":
		// extra validation if wanting use & care manuals
		if (searchValue === "") {
			alert("Please enter model number.");
			searchField.focus();
			searchField.select();
			return false;
		}
		if (searchValue.length < 3) {
			alert("Please enter at least 3 characters.");
			searchField.focus();
			searchField.select();
			return false;
		}
		break;
	default:
		if (searchValue === "") {
			alert("Please enter search term(s)");
			searchField.focus();
			searchField.select();
			return false;
		}
	}
	// end validation

	switch (category) {
	case "":
	case "0":		// nothing selected yet
		if (categoryField.type === "select") {
			categoryField.selectedIndex = 1;
		}
		else {
			categoryField.value = "1";
		}
		category = "1";
		// FALL THROUGH to case for "1".
	case "1":		// Products
		form.action       = "http://genet.geappliances.com/geasearch/Dispatcher?REQUEST=GETSEARCHRESULT";
		form.SITEID.value = "GEAPPLIANCES";
		form.SKU.value    = "";
		break;
	case "2":		// Service & Support
		form.action       = "http://genet.geappliances.com/geasearch/Dispatcher?REQUEST=GETSEARCHRESULT";
		form.SITEID.value = "GEACAPPL";
		form.SKU.value    = "";
		break;
	case "3":		// Use & Care Manuals
		form.action       = "http://genet.geappliances.com/DocSearch/Dispatcher?REQUEST=SEARCHWITHURLCONNECTION";
		form.SITEID.value = "GEA";
		form.SKU.value    = searchValue;
		break;
	}

	return true;
}


// Functions for language link.
 var MP = {
<!-- mp_trans_disable_start --> 
  Version: '1.0.22',
  Domains: {'es':'espanol.geappliances.com'},	
  SrcLang: 'en',
<!-- mp_trans_disable_end -->
  UrlLang: 'mp_js_current_lang',
  SrcUrl: unescape('mp_js_orgin_url'),
<!-- mp_trans_disable_start --> 	
  init: function(){
    if (MP.UrlLang.indexOf('p_js_')==1) {
      MP.SrcUrl=window.top.document.location.href;
      MP.UrlLang=MP.SrcLang;
  }
},
getCookie: function(name){
  var start=document.cookie.indexOf(name+'=');
  if(start < 0) return null;
  start=start+name.length+1;
  var end=document.cookie.indexOf(';', start);
  if(end < 0) end=document.cookie.length;
  while (document.cookie.charAt(start)==' '){ start++; }
  return unescape(document.cookie.substring(start,end));
},
setCookie: function(name,value,path,domain){
  var cookie=name+'='+escape(value);
  if(path)cookie+='; path='+path;
  if(domain)cookie+='; domain='+domain;
  var now=new Date();
  now.setTime(now.getTime()+1000*60*60*24*365);
  cookie+='; expires='+now.toUTCString();
  document.cookie=cookie;
},
switchLanguage: function(lang){
  if(lang!=MP.SrcLang){
    var script=document.createElement('SCRIPT');
    script.src=location.protocol+'//'+MP.Domains[lang]+'/'+MP.SrcLang+lang+'/?1023749632;'+encodeURIComponent(MP.SrcUrl);
	document.body.appendChild(script);
  } else if(lang==MP.SrcLang && MP.UrlLang!=MP.SrcLang){
    var script=document.createElement('SCRIPT');
    script.src=location.protocol+'//'+MP.Domains[MP.UrlLang]+'/'+MP.SrcLang+MP.UrlLang+'/?1023749634;'+encodeURIComponent(location.href);
	document.body.appendChild(script);
  }
  return false;
},
switchToLang: function(url) {
  window.top.location.href=url; 
}
<!-- mp_trans_disable_end -->   
};



// Knowledge Base search 
function validGEACSearch (form) {
	if ("SEARCHTEXT" in form) { // legacy form
		form.SEARCHTEXT.value = form.SEARCHTEXT.value.replace(/\%/g, ""); // workaround bug on corporate server
		if (!/\S/.test(form.SEARCHTEXT.value)) {
			alert("Please enter a search term or model number.");
			form.SEARCHTEXT.focus();
			form.SEARCHTEXT.select();
			return false;
		}
	}
	else if ("q" in form) {	// Google-powered search form
		if (!/\S/.test(form.q.value)) {
			alert("Please enter a search term or model number.");
			form.q.focus();
			form.q.select();
			return false;
		}
	}
	return true;
}




/*************************** COMPARE PAGE FUNCTIONS ***************************/
// init var that means that the "only show differences" option is currently off
var differencesToggled = false;

/* This function expands and contracts the "product details" sections on COMPARE pages */
function compareProductDetailsToggle(obj) {
	
	var thisRow = obj;
	while(thisRow.tagName != "TR")	{
		thisRow = thisRow.parentNode;
	}// while
	
	var rowGroupArray = new Array();
	for(i=thisRow.rowIndex+1; i<document.getElementById("compareTable").rows.length; i++ ) {
		if( document.getElementById("compareTable").rows[i].className != "subHeadingRow" && document.getElementById("compareTable").rows[i].className != "productInfoRow" ) {
			if(document.getElementById("compareTable").rows[i].className == "differenceRow" || differencesToggled != true) {
				rowGroupArray.push(document.getElementById("compareTable").rows[i]);
			}
		} else {
			break;
		}
	}
	
	var linkSpansArray = thisRow.getElementsByTagName("span");
		
	if(rowGroupArray[0].style.display != "none") {
		
		for(i=0; i<rowGroupArray.length; i++) {
			rowGroupArray[i].style.display = "none";
		}
		for( i=0; i< linkSpansArray.length; i++ ) {
			if( linkSpansArray[i].className == "showHide" ) { linkSpansArray[i].innerHTML = "show"; }
			if( linkSpansArray[i].className == "plusMinus" ) { linkSpansArray[i].innerHTML = "+"; }
		}
		thisRow.cells[0].style.borderBottomWidth = "0";
		
	} else {
		
		for(i=0; i<rowGroupArray.length; i++) {
			rowGroupArray[i].style.display = "";
		}
		
		for( i=0; i< linkSpansArray.length; i++ ) {
			if( linkSpansArray[i].className == "showHide" ) { linkSpansArray[i].innerHTML = "hide"; }
			if( linkSpansArray[i].className == "plusMinus" ) { linkSpansArray[i].innerHTML = "-"; }
		}
		thisRow.cells[0].style.borderBottomWidth = "1px";
		
	}
}


/* This function toggles between showing all points of comparison or just the ones with differences on COMPARE pages */
function compareDifferencesToggle(obj) {
	var rowsArray = document.getElementById("compareTable").getElementsByTagName("tbody")[0].rows;
	var showHeading = false; /* init value */
	var differencesBox = document.getElementById("differencesBox");
	
	if(differencesToggled != true) {
	
		for(i=rowsArray.length-1; i>=0; i--) {
			rowsArray[i].style.display = "none";
			if( rowsArray[i].className == "differenceRow" ) {
				rowsArray[i].style.display = "";
				showHeading = true;
			}
			if( rowsArray[i].className == "subHeadingRow" && showHeading == true ) {
				var linkSpansArray = rowsArray[i].getElementsByTagName("span");
				for( j=0; j< linkSpansArray.length; j++ ) {
					if( linkSpansArray[j].className == "showHide" ) { linkSpansArray[j].innerHTML = "hide"; }
					if( linkSpansArray[j].className == "plusMinus" ) { linkSpansArray[j].innerHTML = "-"; }
				}
				
				rowsArray[i].style.display = "";
				showHeading = false;
			}
		}
		
		differencesBox.getElementsByTagName("span")[0].innerHTML = "Show All Features";
		differencesBox.getElementsByTagName("a")[0].innerHTML = "Show all features for these products.";
		
		differencesToggled = true;
	
	} else {
		
		for(i=0; i<rowsArray.length; i++) {
			rowsArray[i].style.display = "";
		
			var linkSpansArray = rowsArray[i].getElementsByTagName("span");
			for( j=0; j< linkSpansArray.length; j++ ) {
				if( linkSpansArray[j].className == "showHide" ) { linkSpansArray[j].innerHTML = "hide"; }
				if( linkSpansArray[j].className == "plusMinus" ) { linkSpansArray[j].innerHTML = "-"; }
			}
		}
		
		differencesBox.getElementsByTagName("span")[0].innerHTML = "Show Me the Differences";
		differencesBox.getElementsByTagName("a")[0].innerHTML = "Only show features that are different between models.";
		
		differencesToggled = false;
	}
}

/*************************** END COMPARE PAGE FUNCTIONS ***************************/




/*************************** SPEC PAGE FUNCTIONS ***************************/

/* This function expands and contracts the "product details" sections on SPEC pages */
function specProductDetailsToggle(obj) {
	var productDetailsTableWrapper = obj.parentNode.parentNode.getElementsByTagName("table")[0].parentNode;
	
	var linkSpansArray = obj.parentNode.getElementsByTagName("span");
		
	if(productDetailsTableWrapper.style.display != "none") {
		
		productDetailsTableWrapper.style.display = "none";
		
		for( i=0; i< linkSpansArray.length; i++ ) {
			if( linkSpansArray[i].className == "showHide" ) { linkSpansArray[i].innerHTML = "show"; }
			if( linkSpansArray[i].className == "plusMinus" ) { linkSpansArray[i].innerHTML = "+"; }
		}
		
	} else {
		
		productDetailsTableWrapper.style.display = "block";
		
		for( i=0; i< linkSpansArray.length; i++ ) {
			if( linkSpansArray[i].className == "showHide" ) { linkSpansArray[i].innerHTML = "hide"; }
			if( linkSpansArray[i].className == "plusMinus" ) { linkSpansArray[i].innerHTML = "-"; }
		}
		
	}
}




// number of current product image on spec pages (defaulted to first image)
var currentSpecImage = 0;

/* this functions sets the selected thumbnail and populates the larger image  */
function setMainImage(num) {
	
	// check the limits
	if( num < 0 ) { num = productImagesArray.length -1 }
	if( num >= productImagesArray.length ) { num = 0; }
	
	// set selected thumbnail
	document.getElementById("productThumbnail"+currentSpecImage ).childNodes[0].className = "";
	document.getElementById("productThumbnail"+num ).childNodes[0].className = "doubleBorder";
	
	// write main image
	mainImageSrc = productImagesArray[num][1];
	if(!productImagesArray[num][2] || GetSwfVer() == -1) {
		anchorContents = "";
		document.getElementById("magnifyInstructions").style.visibility = "hidden";
	}else {
		anchorContents = " class=\"MagicMagnify\" rel=\"zoom-color: #cccccc; size: 180px; type: square\" href=\"" + productImagesArray[num][2] + "\"";
		document.getElementById("magnifyInstructions").style.visibility = "visible";
	}
	document.getElementById("imageCell").innerHTML = "<a" + anchorContents + "><img id=\"mainImage\" src=\"" + mainImageSrc + "\" width=\"480\" height=\"500\" alt=\"\" title=\"\" /></a>";
	
	currentSpecImage = num;
}


/* this function populates the thumbnails and larger image on spec pages */
function populateProductImages() {
	// hide arrows and thumbs if only one image is available
	if(productImagesArray.length == 1) {
		document.getElementById("thumbnailsViewer").style.display = "none";
		leftRightButtonLinks = document.getElementById("mainImageViewer").getElementsByTagName("a");
		leftRightButtonLinks[0].style.visibility = "hidden";
		leftRightButtonLinks[1].style.visibility = "hidden";
	}
	
	// populate the thumbnails
	for(i=0; i<productImagesArray.length; i++) {
		document.getElementById("thumbnailsViewer").innerHTML += "<a id=\"productThumbnail" + i + "\" href=\"javascript:setMainImage(" + i + "); MagicMagnify_findMagnifiers();\"><img src=\"" + productImagesArray[i][0] + "\" width=\"60\" height=\"63\" alt=\"View larger\" title=\"View larger\" /></a> ";
	}
	
	// set the first thumbnail as selected and populate the larger images
	setMainImage(currentSpecImage);
}
/*************************** END SPEC PAGE FUNCTIONS ***************************/

/*************************** START SPEC PAGE 2012 FUNCTIONS ***************************/
		
var imgwidthvary = 81;
var lastNum;
var movedOver = false;
var wasBackwards = false;
var startOver = false;

/* this function sets the selected thumbnail and populates the larger image  */
function newsetMainImage(num) {
			
	var allimgs = productImagesArray.length;
	var trueimglength = allimgs*81;
			
			
	/* Scroll the overflow DIV */
			
	//alert('num: ' + num + ' lastNum: ' + lastNum + ' imgwidthvary: ' + imgwidthvary + ' trueimglength: ' + trueimglength);
		
	// Did the user click the right arrow, and there's more than 4 images?
			
	if (num == lastNum + 1 && allimgs > 4) {
			
		// Is the current number equal to or greater than 3?
		if (num >= 3 && num < allimgs) {
				
			/* Is imgwidthvary less than 1? If so, set it back to 81 (the width of an image container) */
			if (imgwidthvary < 1) {
				imgwidthvary = 81;
			}
				
			// Were we going backwards before this?
					
			if (wasBackwards == true) {
				if (typeof moveOver === "undefined")  {
					moveOver = 0;
				}
						
				imgwidthvary = 0;
				imgwidthvary = moveOver + 81;
						
				moveOver = moveOver + 81;
				$('#thumbnailsViewer').stop().animate({ right: moveOver + 'px' }, 600);
			} else {
				$('#thumbnailsViewer').stop().animate({ right: imgwidthvary + 'px' }, 600);
				imgwidthvary = imgwidthvary + 81;
			}
		
			movedOver = true;
					
		} 
		else if (num == allimgs) {
			$('#thumbnailsViewer').stop().animate({ right: '0' }, 400);
			movedOver = false;
			moveOver = 0;
			wasBackwards = false;
			imgwidthvary = 81;
			startOver = true;
		}
	}
			
	// Did the user click the left arrow, and there's more than 4 images?

	else if (num == lastNum - 1 && allimgs > 4) {
	
		// Did the user click the left arrow right away?
		if (num < 0) {
			moveOver = trueimglength - 243;
			$('#thumbnailsViewer').stop().animate({ right: moveOver + 'px' }, 600);
			movedOver = false;
			wasBackwards = false;
			imgwidthvary = 81;
			startOver = false;
		}
		else if (num >= 3 && num < allimgs) {
			if (imgwidthvary >= 81) {
				if (typeof moveOver === "undefined" || startOver == true)  {
					moveOver = 0;
					moveOver = trueimglength - 81;
					imgwidthvary = imgwidthvary - 81;
					startOver = false;
				}
			}
					
			wasBackwards = true;
					
			if (movedOver == true) {
				moveOver = imgwidthvary;
				moveOver = moveOver - 81;
				$('#thumbnailsViewer').stop().animate({ right: imgwidthvary + 'px' }, 600);
				imgwidthvary = imgwidthvary - 81;
				//alert('movedOver true');
			} else {
				$('#thumbnailsViewer').stop().animate({ right: moveOver + 'px' }, 600);
				//alert('moving by: ' + moveOver + 'px');
				moveOver = moveOver - 81;
			}
		} 
		else if (num == 2) {
			$('#thumbnailsViewer').stop().animate({ right: '0' }, 600);
			movedOver = false;
			moveOver = 0;
			wasBackwards = false;
			imgwidthvary = 81;
			startOver = true;
		}
		else if (movedOver == true) {
			$('#thumbnailsViewer').stop().animate({ right: '0' }, 600);
			movedOver = false;
			moveOver = 0;
			wasBackwards = false;
			imgwidthvary = 81;
			startOver = true;
		}
	}

	// check the limits

	if( num < 0 ) { 
		num = productImagesArray.length -1 
	}
			
	if( num >= productImagesArray.length ) { 
		num = 0; 
	}
			
	lastNum = num;

	// set selected thumbnail

	document.getElementById("productThumbnail"+currentSpecImage ).childNodes[0].className = "";
	document.getElementById("productThumbnail"+num ).childNodes[0].className = "selected";

	// write main image

	mainImageSrc = productImagesArray[num][1];

	if(!productImagesArray[num][2]) {
		anchorContents = "";
		document.getElementById("magnifyInstructions").style.visibility = "hidden";
	}else {
		anchorContents = " class=\"MagicZoomPlus\" rel=\"zoom-position:inner;zoom-fade: true; buttons:hide;\" href=\"" + productImagesArray[num][2] + "\"";
		document.getElementById("magnifyInstructions").style.visibility = "visible";
	}
	document.getElementById("imageCell").innerHTML = "<a" + anchorContents + "><img id=\"mainImage\" src=\"" + mainImageSrc + "\" width=\"480\" height=\"500\" alt=\"\" title=\"\" /></a>";
			
			
	// write the main image for the printer CSS. The DIV is hidden unless the printer CSS is loaded
	
	document.getElementById("productImgforPrint").innerHTML = "<img src=\"" + mainImageSrc + "\" width=\"288\" height=\"300\" alt=\"Product image for print\" title=\"Product image for print\" />";
			
	currentSpecImage = num;
			
}

/* this function populates the thumbnails and larger image on spec pages */

function newpopulateProductImages() {
	// hide arrows and thumbs if only one image is available
	if(productImagesArray.length == 1) {
		document.getElementById("thumbnailViewerMain").style.display = "none";
	}

	// populate the thumbnails

	for(i=0; i<productImagesArray.length; i++) {
		document.getElementById("thumbnailsViewer").innerHTML += "<li><a id=\"productThumbnail" + i + "\" href=\"javascript:newsetMainImage(" + i + "); activateMagicZoom();\"><img src=\"" + productImagesArray[i][0] + "\" width=\"60\" height=\"63\" alt=\"View larger\" title=\"View larger\" /></a></li> ";
	}

	// set the first thumbnail as selected and populate the larger images
	newsetMainImage(currentSpecImage);
}
		

/*************************** END SPEC PAGE 2012 FUNCTIONS ***************************/




/******************* FOOTER FUNCTIONS *******************/

function validateNewsletterSubscriptionForm (form) {
	if (!form.i_emailgeneric) {
		return true;
	}
	if(!(/^\w+((-\w+)|(\.\w+)|(\+\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9][A-Za-z0-9]+$/.test(form.i_emailgeneric.value))) {
		alert("This does not appear to be a valid e-mail address.  Please try again.");
		form.i_emailgeneric.select();
		return false;
	}
	return true;
}

function openPrivacyPolicyPopup (url) {
	return openPop(url, 640, 500, "scrollbars,resizable",
		       "GEAPrivacyPolicy");
}

function openTermsPopup (url) {
	return openPop(url, 640, 500, "scrollbars,resizable",
		       "GEATerms");
}

/***************** END FOOTER FUNCTIONS *****************/








// Flash Player Version Detection - Rev 1.6
// Detect Client Browser type
// Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved.
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function ControlVersion()
{
	var version;
	var axo;
	var e;

	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}

	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";

			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";

			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");			
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			var versionRevision = descArray[3];
			if (versionRevision == "") {
				versionRevision = descArray[4];
			}
			if (versionRevision[0] == "d") {
				versionRevision = versionRevision.substring(1);
			} else if (versionRevision[0] == "r") {
				versionRevision = versionRevision.substring(1);
				if (versionRevision.indexOf("d") > 0) {
					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
				}
			}
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
			//alert("flashVer="+flashVer);
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
    var str = '';
    if (isIE && isWin && !isOpera)
    {
  		str += '<object ';
  		for (var i in objAttrs)
  			str += i + '="' + objAttrs[i] + '" ';
  		for (var i in params)
  			str += '><param name="' + i + '" value="' + params[i] + '" /> ';
  		str += '></object>';
    } else {
  		str += '<embed ';
  		for (var i in embedAttrs)
  			str += i + '="' + embedAttrs[i] + '" ';
  		str += '> </embed>';
    }

    document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "id":
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}


//-----------------------------------------------------------------------------
// BEGIN MOBILE REDIRECT CODE
//-----------------------------------------------------------------------------
var mobileKeywords = [
	"mobi", "phone", "blackberry", "android", "iphone", "BenQ-Siemens",
	"SIE-S68", "SIE-EF81", "Windows CE", "LG/U880", "MIDP", "CLDC",
	"LG-G5200", "LG-G7000", "UP.Browser", "LG/U8120", "LG/U8130",
	"LG/U8138", "LG/U8180", "SymbianOS", "webOS", "PalmSource",
	"NetFront", "SGH-i900", "SonyEricsson", "skyfire"
];

// Is the user surfing from an iPad, specifically?  (At this writing it
// is used to determine which banner on the home page is shown.  Logic
// for that is in a script block in /index.htm.)
var isIpad = /ipad/i.test(navigator.userAgent);

// Generic flag: Is the user surfing from a tablet?  This flag is used
// to determine whether mobileRedirect() redirects.  This check will
// probably be modified in the future to include other types of tablet
// devices on which we also do not want mobile redirects to take place.
var isTablet = /ipad/i.test(navigator.userAgent); // genericism

var hasFlash = GetSwfVer() !== -1;

// Is the user surfing from a mobile device?  THIS INCLUDES TABLETS
// running a mobile platform.  The isTablet flag will be used to exclude
// tablets.
var isMobileDevice;

// tl;dr: this code block sets the isMobileDevice flag to true or false.
(function () {
	var i, ua, kw;
	ua = navigator.userAgent.toLowerCase();
	for (i = 0; i < mobileKeywords.length; i += 1) {
		mobileKeywords[i] = mobileKeywords[i].toLowerCase();
	}
	isMobileDevice = false;
	for (i = 0; i < mobileKeywords.length; i += 1) {
		kw = mobileKeywords[i];
		if (ua.indexOf(kw) !== -1) {
			isMobileDevice = true;
			break;
		}
	}
})();

// tl;dr: this function redirects the user to the URL specified in its
// argument.
function mobileRedirect (url) {
	var $ = (typeof(jQuery) !== "undefined") ? jQuery : null;
	if ($ && !$.cookie("preventMobileRedirect") && 
	    isMobileDevice && !isTablet) {
		location.replace(url);
	}
}
//-----------------------------------------------------------------------------
// END MOBILE REDIRECT CODE
//-----------------------------------------------------------------------------


//-----------------------------------------------------------------------------
// BEGIN GOOGLE ANALYTICS CODE
//-----------------------------------------------------------------------------
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-23305009-1']);
_gaq.push(['_trackPageview']);
(function() {
	var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
	ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
	var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
//-----------------------------------------------------------------------------
// END GOOGLE ANALYTICS CODE
//-----------------------------------------------------------------------------



//-----------------------------------------------------------------------------
// BEGIN OPINIONLAB JAVASCRIPT ENGINE CODE
//-----------------------------------------------------------------------------

/* OnlineOpinion v5.2.2 Released: 5/6/2011 Branch: master fbc30f6ca6527b2824b2ca1c6f274e452522cf2b Components: Full The following code is Copyright 1998-2011 Opinionlab, Inc. All rights reserved. Unauthorized use is prohibited. This product and other products of OpinionLab, Inc. are protected by U.S. Patent No. 6606581, 6421724, 6785717 B1 and other patents pending. http://www.opinionlab.com */
var OOo={Browser:(function(){var a=navigator.userAgent,b=Object.prototype.toString.call(window.opera)=='[object Opera]',c={IE:!!window.attachEvent&&!b,Opera:b,WebKit:a.indexOf('AppleWebKit/')>-1,Chrome:a.indexOf('Chrome')>-1,Gecko:a.indexOf('Gecko')>-1&&a.indexOf('KHTML')===-1,MobileSafari:/Apple.*Mobile.*Safari/.test(a),PalmPre:a.indexOf('Pre/')>-1,BlackBerry:a.indexOf('BlackBerry')>-1,Fennec:a.indexOf('Fennec')>-1,IEMobile:a.indexOf('IEMobile')>-1,OperaMobile:a.search(/Opera (?:Mobi|Mini)/)>-1},d=0,f,h=false;if(c.IE){f=/msie.(\d\.\d+)/i;d=a.match(f)[1]}else if(c.Gecko){f=/gecko.(\d+)/i;d=a.match(f)[1]}else if(c.WebKit){f=/applewebkit\/(\d+)/i;d=a.match(f)[1]}else if(c.Opera){f=/opera.(\d\.\d+)/i;d=a.match(f)[1]}else{h=true}c.isMobile=(c.MobileSafari||c.PalmPre||c.BlackBerry||c.Fennec||c.IEMobile||c.OperaMobile);c.Version=parseFloat(d);c.isModern=(!(h||(c.IE&&c.Version<6)||(c.Opera&&c.Version<8)||(c.Gecko=='gecko'&&c.Version<20041107)));return c})()};OOo.Cache={};OOo.instanceCount=0;if(!OnlineOpinion)var OnlineOpinion=OOo;(function(){function h(a){return document.getElementById(a)}function g(a,b){for(var c in b)a[c]=b[c];return a}function i(a,b,c,d){if(a.addEventListener)a.addEventListener(b,c,d);else if(a.attachEvent)a.attachEvent('on'+b,c)}function j(a,b,c,d){if(a.removeEventListener)a.removeEventListener(b,c,d);else if(a.detachEvent)a.detachEvent('on'+b,c)};function k(a){var b=[];for(var c in a)b.push(c+'='+(encodeURIComponent(a[c])||''));return b.join('&')}function l(a){var b=k(a.metrics);b+='&custom_var='+a.tealeafId+'|'+a.clickTalePID+'/'+a.clickTaleUID+'/'+a.clickTaleSID;if(a.legacyVariables)b+="|"+encodeURIComponent(a.legacyVariables);if(a.metrics.type=='OnPage')b+='|iframe';if(a.asm)b+='&asm=1';b+='&_'+"rev=2";if(a.customVariables)b+='&customVars='+encodeURIComponent(OOo.serialize(a.customVariables));return b}function o(a,b){var c=document,d=c.createElement('form'),f=c.createElement('input');d.style.display='none';d.method='post';d.target=b||'OnlineOpinion';d.action=a.onPageCard?'https://secure.opinionlab.com/ccc01/comment_card_json_4_0_b.asp?r='+location.href:'https://secure.opinionlab.com/ccc01/comment_card_d.asp';f.name='params';f.value=l(a);d.appendChild(f);c.body.appendChild(d);return d}function p(){return{width:screen.width,height:screen.height,referer:location.href,prev:document.referrer,time1:(new Date()).getTime(),time2:null,currentURL:location.href,ocodeVersion:'5.2.2'}}g(OOo,{extend:g,toQueryString:k,addEventListener:i,$:h,appendOOForm:o,removeEventListener:j,createMetrics:p})})();(function(){function h(a){if(!a)return null;switch(typeof a){case'number':case'boolean':case'function':return a;break;case'string':return'\''+a+'\'';break;case'object':var b;if(a.constructor===Array||typeof a.callee!=='undefined'){b='[';var c,d=a.length;for(c=0;c<d-1;c++){b+=h(a[c])+','}b+=h(a[c])+']'}else{b='{';var f;for(f in a){b+=f+':'+h(a[f])+','}b=b.replace(/\,$/,'')+'}'}return b;break;default:return null}}OOo.extend(OOo,{serialize:h})})();(function(){function f(a,b){var c=location.pathname,d;if(c.search(a[0])!=-1){OOo.createCookie(b,0);return false}else if(OOo.readCookie(b)){d=parseInt(OOo.readCookie(b));if((c.search(a[d+1])!=-1)&&(d+1!=a.length-1)){OOo.createCookie(b,d+1);return false}else if(c.search(a[d])!=-1)return false;else if(d+1==a.length-1&&c.search(a.pop())!=-1){OOo.eraseCookie(b);return true}else{OOo.eraseCookie(b);return false}}else return false}OOo.extend(OOo,{checkTunnel:f})})();(function(){function s(a){var b="";for(var c=7;c>=0;c--)b+='0123456789abcdef'.charAt((a>>(c*4))&0x0F);return b}function v(a){var b=((a.length+8)>>6)+1,c=new Array(b*16);for(var d=0;d<b*16;d++)c[d]=0;for(var d=0;d<a.length;d++)c[d>>2]|=a.charCodeAt(d)<<(24-(d%4)*8);c[d>>2]|=0x80<<(24-(d%4)*8);c[b*16-1]=a.length*8;return c}function n(a,b){var c=(a&0xFFFF)+(b&0xFFFF),d=(a>>16)+(b>>16)+(c>>16);return(d<<16)|(c&0xFFFF)}function q(a,b){return(a<<b)|(a>>>(32-b))}function w(a,b,c,d){if(a<20)return(b&c)|((~b)&d);if(a<40)return b^c^d;if(a<60)return(b&c)|(b&d)|(c&d);return b^c^d}function r(a){return(a<20)?1518500249:(a<40)?1859775393:(a<60)?-1894007588:-899497514}function y(a){var b=v(a),c=new Array(80),d=1732584193,f=-271733879,h=-1732584194,g=271733878,i=-1009589776,j,k,l,o,p,t;for(var u=0;u<b.length;u+=16){j=d,k=f,l=h,o=g,p=i;for(var m=0;m<80;m++){if(m<16)c[m]=b[u+m];else c[m]=q(c[m-3]^c[m-8]^c[m-14]^c[m-16],1);t=n(n(q(d,5),w(m,f,h,g)),n(n(i,c[m]),r(m)));i=g;g=h;h=q(f,30);f=d;d=t}d=n(d,j);f=n(f,k);h=n(h,l);g=n(g,o);i=n(i,p)}return s(d)+s(f)+s(h)+s(g)+s(i)}OOo.extend(OOo,{sha1:y})})();(function(){function g(a){var b=a.cookieName||'oo_abandon',c=OOo.readCookie(b),d=a.startPage,f=a.endPage,h=a.middle;if(!c){if(location.pathname.indexOf(d)!=-1)OOo.createCookie(b);return false}else if(location.pathname.indexOf(f)!=-1){OOo.eraseCookie(b);return false}else if(location.pathname.search(h)!=-1)return false;else{OOo.eraseCookie(b);return true}}OOo.extend(OOo,{checkAbandonment:g})})();(function(){function c(a){for(var b=a.length-1;b>=0;b--){if(a[b].read){if(!!(cookieValue=OOo.readCookie(a[b].name))&&cookieValue==a[b].value)return true;else if(typeof a[b].value=='undefined'&&!!OOo.readCookie(a[b].name))return true}}return false}function d(a){for(var b=a.length-1;b>=0;b--){if(a[b].set)OOo.createCookie(a[b].name,a[b].value,a[b].expiration)}}OOo.extend(OOo,{checkThirdPartyCookies:c,setThirdPartyCookies:d})})();OOo.extend(Function.prototype,(function(){if(typeof(Prototype)!="undefined")return;var f=Array.prototype.slice;function h(a,b){var c=a.length,d=b.length;while(d--)a[c+d]=b[d];return a}function g(a,b){a=f.call(a,0);return h(a,b)}function i(b){if(arguments.length<2&&typeof arguments[0]==="undefined")return this;var c=this,d=f.call(arguments,1);return function(){var a=g(d,arguments);return c.apply(b,a)}}return{bind:i}})());(function(){var h;if(location.host.search(/\d+\.\d+\.\d+\.\d+/)===0)h=location.host;else{h=location.host.split('.').reverse();h='.'+h[1]+'.'+h[0]}function g(a,b,c){var d='',f='';if(c){d=new Date();d.setTime(d.getTime()+(c*1000));f="; expires="+d.toGMTString()}document.cookie=a+"="+b+f+"; path=/; domain="+h+";"}function i(a){var b=a+"=",c=document.cookie.split(';'),d;for(var f=0;f<c.length;f++){d=c[f];while(d.charAt(0)==' ')d=d.substring(1,d.length);if(d.indexOf(b)===0)return d.substring(b.length,d.length)}return null}function j(a){g(a,"",-1)}OOo.extend(OOo,{createCookie:g,readCookie:i,eraseCookie:j})})();OOo.Ocode=function(a){var b=OOo.Browser;if(!b.isModern||(a.disableMobile&&b.isMobile))return;if(a.disableNoniOS&&(navigator.userAgent.search('Android')!=-1||b.PalmPre||b.IEMobile||b.OperaMobile||b.Fennec))return;OOo.instanceCount++;this.options={tealeafCookieName:'TLTSID'};OOo.extend(this.options,a);var c=this.options,d=c.referrerRewrite;c.metrics=OOo.createMetrics();this.frameName=c.onPageCard?'OnlineOpinion'+OOo.instanceCount:'OnlineOpinion';if(c.cookie&&this.matchUrl())return;if(c.thirdPartyCookies&&OOo.checkThirdPartyCookies(c.thirdPartyCookies))return;if(c.abandonment&&!OOo.checkAbandonment(c.abandonment))return;
if(c.tunnel&&!OOo.checkTunnel(c.tunnel.path,c.tunnel.cookieName))return;if(c.events&&c.events.onSingleClick)this.singProbability=Math.random()<1-c.events.onSingleClick/100;c.tealeafId=OOo.readCookie(c.tealeafCookieName)||OOo.readCookie(c.sessionCookieName);if(d)c.metrics.referer=d.searchPattern?window.location.href.replace(d.searchPattern,d.replacePattern):d.replacePattern;if(c.events){this.setupEvents();if(c.events.disableLinks||c.events.disableFormElements)this.setupDisableElements()}if(c.floating)this.floating();else if(c.bar)this.bar();else if(c.tab)this.tab()};OOo.Ocode.prototype={show:function(){var a=this.options;if(this.interruptShow)return;if(!this.floatingLogo&&a.cookie&&this.matchUrl())return;if(!a.floating&&a.events&&this.singProbability)return;if(a.events&&a.events.onSingleClick)this.singProbability=true;if(a.cookie)this.tagUrl();if(a.thirdPartyCookies){if(OOo.checkThirdPartyCookies(a.thirdPartyCookies))return;OOo.setThirdPartyCookies(a.thirdPartyCookies)}if(this.floatingLogo&&a.disappearOnClick)this.floatingLogo.style.display='none';if(typeof arguments[0]=='string')a.metrics.trigger=arguments[0];if(a.clickTalePID&&typeof ClickTale=='function'){a.clickTaleUID=ClickTaleGetUID();a.clickTaleSID=ClickTaleGetSID()}if(a.onPageCard)this.setupOnPageCC();else this.launchOOPopup()},tagUrl:function(){if(this.matchUrl())return;var a=this.options.cookie,b=a.type=='page'?location.href:location.hostname,c=OOo.readCookie(a.name||'oo_r')||'';OOo.createCookie(a.name||'oo_r',c+OOo.sha1(b),a.expiration)},matchUrl:function(){var a=this.options.cookie.type=='page'?location.href:location.hostname,b=OOo.readCookie(this.options.cookie.name||'oo_r');if(!b)return false;return b.search(OOo.sha1(a))!=-1}};(function(){function h(){var a=this.options,b=a.newWindowSize||[545,325],c=[parseInt((a.metrics.height-b[1])/2),parseInt((a.metrics.width-b[0])/2)],a=this.options,d,f;a.metrics.time2=(new Date()).getTime();a.metrics.type='Popup';d=OOo.appendOOForm(a);f=window.open('','OnlineOpinion','location=no,status=no,width='+b[0]+',height='+b[1]+',top='+c[0]+',left='+c[1]);if(f)d.submit()}OOo.extend(OOo.Ocode.prototype,{launchOOPopup:h})})();(function(){function k(){var a=this.options.events,b=[false,false],c=['onExit','onEntry'],d=OOo.Browser.Opera?'unload':'beforeunload',f,h;for(var g=c.length-1;g>=0;g--){f=c[g];if(a[f]instanceof Array){var i=a[f],j=i.length;while(j--&&!b[g]){if(window.location.href.search(i[j].url)!=-1&&Math.random()>=1-i[j].p/100)b[g]=true}}else if(a[f]&&Math.random()>=1-a[f]/100)b[g]=true}if(b[0])OOo.addEventListener(window,d,this.show.bind(this,'onExit'),false);if(b[1]){if(a.delayEntry){window.setTimeout(function(){this.show()}.bind(this,'onEntry'),a.delayEntry*1000)}else{this.show('onEntry')}}}function l(){OOo.addEventListener(document.body,'mousedown',o.bind(this));if(!this.options.events.disableFormElements)return;var a=document.getElementsByTagName('form');for(var b=a.length-1;b>=0;b--)OOo.addEventListener(a[b],'submit',p.bind(this))}function o(a){var b=a||window.event,c=a.target||a.srcElement,d=this.options.events,f=c.parentNode,h=5,g=0;while(f&&(c.nodeName!='A'||c.nodeName!='INPUT')&&g!=h){if(f.nodeName=='A')c=f;f=f.parentNode;g++}if(d.disableFormElements&&c.tagName=="INPUT"&&(c.type=='submit'||c.type=='image'))this.interruptShow=true;if(c.nodeName=='A'&&c.href.substr(0,4)=='http'&&c.href.search(d.disableLinks)!=-1)this.interruptShow=true}function p(a){this.interruptShow=true}OOo.extend(OOo.Ocode.prototype,{setupEvents:k,setupDisableElements:l})})();OOo.extend(OOo.Ocode.prototype,{floating:function(){var d=document,f=this.floatingLogo=document.createElement('div'),h=d.createElement('div'),g=d.createElement('div'),i=d.createElement('div'),j=d.createElement('span'),k=this.options.floating,l=OOo.$(k.contentId),o='10px',p=false,t=k.id;if(t)f.id=t;f.className='oo_feedback_float';g.className='oo_transparent';h.className='olUp';i.className='olOver';h.tabIndex=0;h.onkeyup=function(a){var b=a||window.event;if(b.keyCode!=13)return;this.show()}.bind(this);h.innerHTML=k.caption||'Feedback';f.appendChild(h);j.innerHTML=k.hoverCaption||'Click here to<br>rate this page';i.appendChild(j);f.appendChild(i);f.appendChild(g);if(OOo.Browser.IE&&OOo.Browser.Version<7){f.style.position='absolute';f.style.bottom='';OOo.addEventListener(window,'scroll',u,false);OOo.addEventListener(window,'resize',u,false);function u(a){f.style.top=(d.documentElement.scrollTop+document.documentElement.clientHeight-f.clientHeight)+'px'};p=true}else if(OOo.Browser.MobileSafari){var m=window.innerHeight,s;f.style.bottom=null;f.style.top=(pageYOffset+window.innerHeight-60)+'px';OOo.addEventListener(window,'scroll',function(a){s=pageYOffset-(m-window.innerHeight);f.style.webkitTransform='translateY('+s+'px)'},false)}if(k.position&&k.position.search(/Content/)&&l){var v=this.spacer=d.createElement('div'),n=OOo.Browser.WebKit?d.body:d.documentElement,q;v.id='oo_feedback_fl_spacer';v.style.left=r(l)+'px';d.body.appendChild(v);switch(k.position){case'rightOfContent':q=function(a){f.style.left=(r(l)-n.scrollLeft)+'px';if(p)q=null};break;case'fixedPreserveContent':q=function(a){var b=OOo.Browser.IE?d.body.clientWidth:window.innerWidth,c=!p?n.scrollLeft:0;if(b<=r(l)+f.offsetWidth+parseInt(o))f.style.left=(r(l)-c)+'px';else{f.style.left='';f.style.right=o}};break;case'fixedContentMax':q=function(a){var b=OOo.Browser.IE?d.body.clientWidth:window.innerWidth;if(b<=r(l)+f.offsetWidth+parseInt(o)){f.style.left='';f.style.right=o;if(a&&a.type=='scroll'&&p)f.style.left=(d.documentElement.clientWidth+n.scrollLeft-105)+'px'}else{f.style.left=(r(l)-n.scrollLeft)+'px';f.style.right=''}};break}q();OOo.addEventListener(window,'scroll',q,false);OOo.addEventListener(window,'resize',q,false);function w(a){v.style.left=r(l)+'px'};OOo.addEventListener(window,'resize',w,false)}else{f.style.right=o}OOo.addEventListener(f,'click',this.show.bind(this,'Floating'),false);OOo.addEventListener(f,'touchstart',this.show.bind(this,'Floating'),false);d.body.appendChild(f);if(OOo.Browser.IE&&OOo.Browser.Version<7){f.style.top=(d.documentElement.clientHeight-f.clientHeight)+'px';g.style.height=f.clientHeight+'px'}function r(a){return a.offsetLeft+a.offsetWidth}},removeFloatingLogo:function(){document.body.removeChild(this.floatingLogo);if(this.spacer)document.body.removeChild(this.spacer)}});OOo.extend(OOo.Ocode.prototype,{bar:function(){var c=document,d=this.floatingLogo=c.createElement('div'),f=c.createElement('span');d.id='oo_bar';f.innerHTML=this.options.bar.caption||'Feedback';d.appendChild(f);d.tabIndex=0;d.onkeyup=function(a){var b=a||window.event;if(b.keyCode!=13)return;this.show()}.bind(this);OOo.addEventListener(d,'click',this.show.bind(this,'Bar'));document.body.className+=document.body.className<1?'oo_bar':' oo_bar';document.body.appendChild(d);if(OOo.Browser.IE){var h;if(c.compatMode=='CSS1Compat'){h=function(a){if(a&&a.type=='resize')setTimeout(h,50);d.style.top=(c.documentElement.scrollTop+document.documentElement.clientHeight-d.clientHeight-1)+'px';d.style.width=(Math.max(c.documentElement.clientWidth,c.body.offsetWidth))+'px'}}else{h=function(a){d.style.top=(c.body.scrollTop+document.body.clientHeight-d.clientHeight-1)+'px';d.style.width=(Math.max(c.documentElement.clientWidth,c.body.offsetWidth)-22)+'px'}}d.style.position='absolute';OOo.addEventListener(window,'scroll',h,false);OOo.addEventListener(window,'resize',h,false);h()}else if(OOo.Browser.MobileSafari){var g=window.innerHeight,i;d.style.bottom=null;d.style.top=(pageYOffset+window.innerHeight-22)+'px';OOo.addEventListener(window,'scroll',function(a){i=pageYOffset-(g-window.innerHeight);d.style.webkitTransform='translateY('+i+'px)'},false)}}});OOo.extend(OOo.Ocode.prototype,{tab:function(){var c=document,d=this.floatingLogo=c.createElement('div'),f=c.createElement('a'),h=c.createElement('span'),g=this.options.tab;d.id='oo_tab';d.className='oo_tab_'+(g.position||'right');if(OOo.Browser.IE&&OOo.Browser.Version<7){d.style.position='absolute';if(g.position=='right')d.className+=' oo_tab_ie_right'}else if(OOo.Browser.MobileSafari){d.style.top=(pageYOffset+window.innerHeight/2)+'px';OOo.addEventListener(window,'scroll',function(a){d.style.top=(pageYOffset+window.innerHeight/2)+'px'},false)}f.href="javascript:void(0)";f.title=g.title||'Feedback';d.tabIndex=0;d.onkeyup=function(a){var b=a||window.event;if(b.keyCode!=13)return;this.show()}.bind(this);f.appendChild(h);d.appendChild(f);OOo.addEventListener(d,'click',this.show.bind(this,'Tab'),false);c.body.appendChild(d)}});OOo.extend(OOo.Ocode.prototype,{setupOnPageCC:function(){var g=document,i=OOo.Cache.overlay||g.createElement('div'),j=this.wrapper=g.createElement('div'),k=g.createElement('a'),l=g.createElement('div'),o=g.createElement('span'),p=this.frameName,t=g.createElement(OOo.Browser.IE&&OOo.Browser.Version<9?'<iframe name="'+p+'">':'iframe'),u=g.createDocumentFragment(),m=this.options,s=m.onPageCard,v='https://secure.opinionlab.com/ccc01/comment_card_json_4_0_b.asp',n,q,w,r=false;m.metrics.type='OnPage';OOo.Cache.overlay=i;i.id='oo_overlay';i.style.display='block';i.className='';l.className='iwrapper';j.className='oo_cc_wrapper';k.className='oo_cc_close';k.href="javascript:void(0)";k.title=s.closeTitle||"Close Feedback Card";j.style.visibility='hidden';if(OOo.Browser.IE){if(!window.XMLHttpRequest){i.style.position='absolute';i.style.width=Math.max(g.documentElement.clientWidth,g.body.offsetWidth)+'px';i.style.height=Math.max(g.documentElement.clientHeight,g.body.offsetHeight)+'px';j.style.position='absolute'}else{var y=g.createElement("div"),A=g.createElement("div"),B=g.createElement("div"),x=g.createElement("div");x.className="oo_shadows";y.className='oo_body';A.className='oo_top';B.className='oo_bottom';x.appendChild(y);x.appendChild(A);x.appendChild(B);l.appendChild(x)}}OOo.addEventListener(k,'click',z);if(s.closeWithOverlay&&!OOo.Browser.isMobile){j.appendChild(o);o.onclick=z;i.onclick=z}t.src=v;t.name=p;l.appendChild(k);l.appendChild(t);j.appendChild(l);u.appendChild(j);u.appendChild(i);g.body.appendChild(u);w=C.bind(this);window.postMessage?OOo.addEventListener(window,"message",w):q=setInterval(C.bind(this),500);n=OOo.appendOOForm(m,p);m.metrics.time2=(new Date()).getTime();n.submit();function C(a){if((a&&a.origin!='https://secure.opinionlab.com')||(!a&&location.hash.substr(1,3)!='OL='))return;var b=a?a.data:location.hash.slice(4),c=parseInt(b),d=document;if(!a)location.hash='';if(c>0){if(r)return;r=true;var f=window.innerHeight||d.documentElement.clientHeight,h=c;if(h>f){h=f-40;t.style.width='555px'}t.style.height=h+'px';if(OOo.Browser.IE&&OOo.Browser.Version<7)o.style.height=j.offsetHeight+'px';j.style.visibility='visible';i.className="no_loading"}else if(b=='submitted')z()}function z(){i.style.display='none';i.className='';g.body.removeChild(j);window.postMessage?OOo.removeEventListener(window,'message',w):window.clearInterval(q);r=false}}});OOo.Invitation=function(a){this.options={tunnelCookie:'oo_inv_tunnel',repromptTime:604800,responseRate:50,repromptCookie:'oo_inv_reprompt',promptMarkup:'oo_inv_prompt.html',promptStyles:'oo_inverstitial_style.css',percentageCookie:'oo_inv_percent',pagesHitCookie:'oo_inv_hit',popupType:'popunder',promptDelay:0,neverShowAgainButton:false,loadPopupInBackground:false,tealeafCookieName:'TLTSID',monitorWindow:'oo_inv_monitor.html'};this.popupShown=false;OOo.extend(this.options,a);var b=this.options,c=parseInt(OOo.readCookie(b.pagesHitCookie))||0;OOo.Invitation.friendlyDomains=b.friendlyDomains||null;if(location.search.search('evs')!=-1){b.loadPopupInBackground=true;this.launchPopup();OOo.createCookie(b.repromptCookie,1,b.repromptTime==-1?0:b.repromptTime)}setTimeout(function(){if(!window.oo_inv_monitor)return;if(b.area&&location.href.search(b.area)==-1){this.options.popupType='popup';this.launchPopup()}else if(b.goal&&location.href.search(b.goal)!=-1){oo_inv_monitor.close()}}.bind(this),1000);if(OOo.readCookie(b.repromptCookie))return;if(b.thirdPartyCookies&&OOo.checkThirdPartyCookies(b.thirdPartyCookies))return;if(!OOo.readCookie(b.percentageCookie)){OOo.createCookie(b.percentageCookie,(Math.random()>1-(b.responseRate/100))?"1":"0")}if(typeof(b.promptTrigger)!='undefined'){if(b.promptTrigger instanceof RegExp){if(!window.location.href.match(b.promptTrigger))return}else if(b.promptTrigger instanceof Array){if(!OOo.checkTunnel(b.promptTrigger,b.tunnelCookie))return}}c++;OOo.createCookie(b.pagesHitCookie,c);if(b.pagesHit&&c<b.pagesHit)return;OOo.eraseCookie(b.tunnelCookie);if(OOo.readCookie(b.percentageCookie)=='1'){window.setTimeout(function(){OOo.createCookie(b.repromptCookie,1,b.repromptTime);this.getPrompt()}.bind(this),b.promptDelay*1000)}};OOo.Invitation.prototype={getPrompt:function(){var a=window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP"),b=this,c=document.createElement('link'),d;a.onreadystatechange=function(){if(a.readyState!=4)return;b.showPrompt(a.responseText)};a.open("GET",this.options.pathToAssets+this.options.promptMarkup,true);a.send(null)},showPrompt:function(a){var b=document,c=b.createElement('div'),d=OOo.Cache.overlay||b.createElement('div'),f,h,g=this.options;d.id='oo_overlay';c.id='oo_container';c.style.visibility='hidden';c.innerHTML=a;c.appendChild(d);b.body.appendChild(c);if(g.companyLogo){f=new Image();f.src=g.companyLogo;OOo.$('oo_company_logo').appendChild(f)}OOo.addEventListener(OOo.$('oo_launch_prompt'),'click',this.launchPopup.bind(this),false);if(g.neverShowAgainButton){h=OOo.$('oo_never_show');h.style.visibility='visible';OOo.addEventListener(h,'click',this.killPrompt.bind(this),false)}if(OOo.Browser.IE&&!window.XMLHttpRequest){d.style.position='absolute';d.style.width=Math.max(document.documentElement.clientWidth,document.body.offsetWidth)+'px';d.style.height=Math.max(document.documentElement.clientHeight,document.body.offsetHeight)+'px';c.style.position='absolute'}c.style.visibility='visible';d.className='no_loading'},launchPopup:function(){if(this.popupShown)return;this.popupShown=true;var a=this.options,b=window.location.href,c=a.popupType=='popup'?'https://secure.opinionlab.com/ccc01/comment_card.asp?':a.pathToAssets+a.monitorWindow+'?'+(new Date()).getTime()+'&',d,f=[],h=a.asm?[555,500]:[545,200],g,i=OOo.readCookie(a.teleafId),j=OOo.createMetrics();h=a.newWindowSize||h;if(a.referrerRewrite){j.referer=a.referrerRewrite.searchPattern?window.location.href.replace(a.referrerRewrite.searchPattern,a.referrerRewrite.replacePattern):a.referrerRewrite.replacePattern}if(a.thirdPartyCookies)OOo.setThirdPartyCookies(a.thirdPartyCookies);d=OOo.toQueryString(j)+'&type=Invitation';if(a.customVariables)d+='&customVars='+encodeURIComponent(OOo.serialize(a.customVariables));d+='&custom_var='+i;if(a.clickTalePID&&ClickTaleGetUID&&ClickTaleGetSID)d+='|'+[a.clickTalePID,ClickTaleGetUID(),ClickTaleGetSID()].join('/');g=window.open(c+d,'OnlineOpinionInvitation','location=no,status=no,width='+h[0]+',height='+h[1]);if(!a.loadPopupInBackground&&OOo.$('oo_container'))OOo.Invitation.hidePrompt();if(a.popupType=='popunder'){if(!OOo.Browser.Chrome){g.blur();window.focus()}else{if(!a.loadPopupInBackground)alert(a.chromeMainWinPrompt||'Please fill out the form behind this window when you are finished.');if(a.chromeSurveyPrompt)setTimeout(function(e){g.postMessage(a.chromeSurveyPrompt,"*")},500)}}else if(window.oo_inv_monitor){window.blur();g.focus()}},killPrompt:function(){OOo.createCookie(this.options.repromptCookie,1,1825);OOo.Invitation.hidePrompt()}};OOo.extend(OOo.Invitation,{hidePrompt:function(){OOo.$('oo_container').style.display='none'},navigateToFriendlyDomain:function(a){location=a}});

//-----------------------------------------------------------------------------
// END OPINIONLAB JAVASCRIPT ENGINE CODE
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------
// START OPINIONLAB CONFIGURATION CODE
//-----------------------------------------------------------------------
var oo_feedback;

if (window.top === window.self) {
	OOo.addEventListener(window, 'load', function () {
		var customVariables;
		if (typeof(s) !== "undefined") {
			// we've called omniture.
			customVariables = {
				PageName:     s.pageName,
				Channel:      s.channel,
				SiteSection2: s.prop3,
				SiteSection3: s.prop4,
				SiteSection4: s.prop5,
				PageType:     s.prop16
			};
		}
		else {
			// we haven't called omniture.
			customVariables = {
				PageName:     document.title,
				Channel:      "",
				SiteSection2: "",
				SiteSection3: "",
				SiteSection4: "",
				PageType:     ""
			};
		}
		oo_feedback = new OOo.Ocode({
		 	onPageCard:      { closeWithOverlay: {} },
			customVariables: customVariables
		});
		var oo_floating = new OOo.Ocode({
			floating:        {},
			onPageCard:      { closeWithOverlay: {} },
			customVariables: customVariables
		});
	}, false);
}

//-----------------------------------------------------------------------
// END OPINIONLAB CONFIGURATION CODE
//-----------------------------------------------------------------------

// for site search form in header
function validateSiteSearchForm (form) {
	if ("q" in form) {
		if (!/\S/.test(form.q.value)) {
			return false;
		}
	}
	return true;
}

// for advanced search forms
function validateAdvancedSearchForm (form) {
	if (/\S/.test(form.as_q.value) ||
	    /\S/.test(form.as_epq.value) ||
	    /\S/.test(form.as_oq.value)) {
		return true;
	}
	alert("Please enter a search term in at least one of the first three fields.");
	form.as_q.focus();
	form.as_q.select();
	return false;
}



