
/***********************************************************************
Client-side content, data and utilities for Literature search functions
***********************************************************************/  

searchStyleBlock  = '<style type="text/css">';
searchStyleBlock += '	#hiderDiv { visibility:hidden; background:url("/images/common/hider_bg.gif"); width:100%; height:100%; position:absolute; top:0; left:0; z-index:100; }';
searchStyleBlock += '	.helpTipDiv { visibility: hidden; position: absolute; top:0; left:0; width: 330px; z-index:200; border:1px solid #D77503; background-color:#FBE6CC; padding:0px 10px 10px 10px; text-align:left; }';
searchStyleBlock += '	.helptipTop { margin-top:2px; padding-bottom:3px; text-align:right; border-bottom: 1px solid #d77503; }';
searchStyleBlock += '	.helptipHeadline { margin-top:6px; margin-bottom:12px; font-size:16px; font-weight:bold; }';
searchStyleBlock += '</style>';

document.write(searchStyleBlock);


document.writeln('<div id="helpContainerDiv">');

// generic help //
document.writeln('<div id="genericHelpDiv" class="helpTipDiv">');
	document.writeln('<div class="helptipTop"><a href="javascript:closeHelpTip();"><img src="http://www.geappliances.com/images/close_orange_orange.gif" width="27" height="14" alt="close" border="0" style="vertical-align:bottom;" />close window</a></div>');
	document.writeln('<div class="helptipHeadline">We\'re sorry, but the search term you entered is not a model number.</div>');
	document.writeln('<div>To find your exact model number, look for the number printed on tags located inside or on the back of your appliance. <a href="http://www.geappliances.com/finder/daughter.htm" target="_blank" onclick="window.open(\'http://www.geappliances.com/finder/daughter.htm\',\'\',\'width=566,height=490,scrollbars,resizable,toolbar\');return false;">Need help finding your model number?</a><br><br>');
	document.writeln('<b>NOTE:</b> In some cases, there may be a series of letters and numbers on the front of your appliance, such as XL44, XL1800, Arctica or Harmony. This is not the model number of your appliance.<br><br>');
	document.writeln('<div class="button"><a href="javascript:closeHelpTip();">Try Again</a></div></div>');
document.writeln('</div>');
// end generic help //

// XL44 help //
document.writeln('<div id="XL44HelpDiv" class="helpTipDiv">');
	document.writeln('<div class="helptipTop"><a href="javascript:closeHelpTip();"><img src="http://www.geappliances.com/images/close_orange_orange.gif" width="27" height="14" alt="close" border="0" style="vertical-align:bottom;" />close window</a></div>');
	document.writeln('<div class="helptipHeadline">&quot;XL44&quot; is a line of GE ranges.</div>');
	document.writeln('<div>Some common XL44 models are:</div>');
	document.writeln('<div style="margin:14px 0px 16px 38px;">');
	document.writeln('<table width="270" cellpadding="0" cellspacing="0" border="0"><tr valign="top">');
	document.writeln('<td width="34%"><a href="javascript:submitFromLink(\'JGBC17\');">JGBC17</a><br><a href="javascript:submitFromLink(\'JGBC20\');">JGBC20</a><br><a href="javascript:submitFromLink(\'JGBP24\');">JGBP24</a><br><a href="javascript:submitFromLink(\'JGBP26\');">JGBP26</a><br><a href="javascript:submitFromLink(\'JGBP27\');">JGBP27</a></td>');
	document.writeln('<td width="33%"><a href="javascript:submitFromLink(\'JGBP28\');">JGBP28</a><br><a href="javascript:submitFromLink(\'JGBP30\');">JGBP30</a><br><a href="javascript:submitFromLink(\'JGBP35\');">JGBP35</a><br><a href="javascript:submitFromLink(\'JGBS04\');">JGBS04</a><br><a href="javascript:submitFromLink(\'JGBS15\');">JGBS15</a></td>');
	document.writeln('<td width="33%"><a href="javascript:submitFromLink(\'JGBS17\');">JGBS17</a><br><a href="javascript:submitFromLink(\'JGBS20\');">JGBS20</a><br><a href="javascript:submitFromLink(\'JGBS21\');">JGBS21</a><br><a href="javascript:submitFromLink(\'JGBS22\');">JGBS22</a><br><a href="javascript:submitFromLink(\'JGBS23\');">JGBS23</a></td>');
	document.writeln('</tr></table>');
	document.writeln('</div>');
	document.writeln('<div>To find your exact model number, look for the number printed on tags located inside or on the back of your appliance. <a href="http://www.geappliances.com/finder/ranges.htm" target="_blank" onclick="window.open(\'http://www.geappliances.com/finder/ranges.htm\',\'\',\'width=566,height=490,scrollbars,resizable,toolbar\');return false;">Need help finding your model number?</a></div>');
document.writeln('</div>');
// end XL44 help //

// XL1800 help //
document.writeln('<div id="XL1800HelpDiv" class="helpTipDiv">');
	document.writeln('<div class="helptipTop"><a href="javascript:closeHelpTip();"><img src="http://www.geappliances.com/images/close_orange_orange.gif" width="27" height="14" alt="close" border="0" style="vertical-align:bottom;" />close window</a></div>');
	document.writeln('<div class="helptipHeadline">&quot;XL1800&quot; is a line of GE microwave ovens.</div>');
	document.writeln('<div>Some common XL1800 models are:</div>');
	document.writeln('<div style="margin:14px 0px 16px 38px;">');
	document.writeln('<table width="270" cellpadding="0" cellspacing="0" border="0"><tr valign="top">');
	document.writeln('<td width="34%"><a href="javascript:submitFromLink(\'JVM1840\');">JVM1840</a><br><a href="javascript:submitFromLink(\'JVM1841\');">JVM1841</a><br><a href="javascript:submitFromLink(\'JVM1842\');">JVM1842</a></td>');
	document.writeln('<td width="33%"><a href="javascript:submitFromLink(\'JVM1850\');">JVM1850</a><br><a href="javascript:submitFromLink(\'JVM1851\');">JVM1851</a><br><a href="javascript:submitFromLink(\'JVM1860\');">JVM1860</a></td>');
	document.writeln('<td width="33%"><a href="javascript:submitFromLink(\'JVM1861\');">JVM1861</a><br><a href="javascript:submitFromLink(\'JVM1870\');">JVM1870</a><br><a href="javascript:submitFromLink(\'JVM1871\');">JVM1871</a></td>');
	document.writeln('</tr></table>');
	document.writeln('</div>');
	document.writeln('<div>To find your exact model number, look for the number printed on tags located inside or on the back of your appliance. <a href="http://www.geappliances.com/finder/microwaves.htm" target="_blank" onclick="window.open(\'http://www.geappliances.com/finder/microwaves.htm\',\'\',\'width=566,height=490,scrollbars,resizable,toolbar\');return false;">Need help finding your model number?</a></div>');
document.writeln('</div>');
// end XL1800 help //

// XL1400 help //
document.writeln('<div id="XL1400HelpDiv" class="helpTipDiv">');
	document.writeln('<div class="helptipTop"><a href="javascript:closeHelpTip();"><img src="http://www.geappliances.com/images/close_orange_orange.gif" width="27" height="14" alt="close" border="0" style="vertical-align:bottom;" />close window</a></div>');
	document.writeln('<div class="helptipHeadline">&quot;XL1400&quot; is a line of GE microwave ovens.</div>');
	document.writeln('<div>Some common XL1400 models are:</div>');
	document.writeln('<div style="margin:14px 0px 16px 38px;">');
	document.writeln('<table width="270" cellpadding="0" cellspacing="0" border="0"><tr valign="top">');
	document.writeln('<td width="34%"><a href="javascript:submitFromLink(\'JVM1410\');">JVM1410</a><br><a href="javascript:submitFromLink(\'JVM1421\');">JVM1421</a><br><a href="javascript:submitFromLink(\'JVM1430\');">JVM1430</a></td>');
	document.writeln('<td width="33%"><a href="javascript:submitFromLink(\'JVM1440\');">JVM1440</a><br><a href="javascript:submitFromLink(\'JVM1441\');">JVM1441</a><br><a href="javascript:submitFromLink(\'JVM1443\');">JVM1443</a></td>');
	document.writeln('<td width="33%"><a href="javascript:submitFromLink(\'JVM1450\');">JVM1450</a><br><a href="javascript:submitFromLink(\'JVM1460\');">JVM1460</a><br><a href="javascript:submitFromLink(\'JVM1490\');">JVM1490</a></td>');
	document.writeln('</tr></table>');
	document.writeln('</div>');
	document.writeln('<div>To find your exact model number, look for the number printed on tags located inside or on the back of your appliance. <a href="http://www.geappliances.com/finder/microwaves.htm" target="_blank" onclick="window.open(\'http://www.geappliances.com/finder/microwaves.htm\',\'\',\'width=566,height=490,scrollbars,resizable,toolbar\');return false;">Need help finding your model number?</a></div>');
document.writeln('</div>');
// end XL1400 help //

document.writeln('</div>'); // end of helpContainerDiv

document.writeln('<div id="hiderDiv">&nbsp;</div>');

//strings to look for BESIDES XL44, XL1800 and XL1400.
//upper/lower case doesn't matter.
var genericArray = new Array(
"Profile",
"Spacemaker",
"Spacesaver",
"Potscrubber",
"Hotpoint",
"Spectra",
"Washer",
"Oven",
"Water",
"Triton",
"Advantium",
"Aquarius",
"Range",
"Dryer",
"Monogram",
"Nautilus",
"Artica",
"Arctica",
"Air",
"Refrig",
"Medallion",
"Eterna",
"Adora",
"Harmony",
"Prodigy",
"Freezer",
"Americana",
"Select"
);


function openHelpTip(divID) {
	// grab all the div that contains all helpTips //
	var helpContainer = document.getElementById("helpContainerDiv");
	
	// determine which divs are helpTips and hide any open helpTips //
	var helpTipDivArray = helpContainer.getElementsByTagName('div');
	for (var j = 0; j < helpTipDivArray.length; ++j) {
		var helpTipDiv = helpTipDivArray[j];
		if (!helpTipDiv.className || !/\bhelpTipDiv\b/.test(helpTipDiv.className)) {
			continue;
		}
		helpTipDiv.style.visibility = "hidden";
	}
	
	// get helpTip[x] //
	obj = document.getElementById(divID);
	
		var ww = document.documentElement.clientWidth;
		var wh = document.documentElement.clientHeight;
		var st = document.documentElement.scrollTop;
		var sh = document.documentElement.scrollHeight;
	
	//set helpTip[x] position //
	xpt = (ww - 330) / 2 ;
	ypt = (wh - 300) / 2 ;
	ypt += st;
	//alert("left "+xpt+" - top "+ypt);
	if (xpt < 5) {
		var xpt = 5;
	}
	obj.style.left = xpt+"px"; 
	if (ypt < 5) {
		var ypt = 5;
	}
	obj.style.top = ypt+"px";
	
	// show helpTip[x] //
	
	if( wh < sh ) { hiderHeight = sh; } else { hiderHeight = wh; }
	
	var hiderDiv = document.getElementById("hiderDiv");
	hiderDiv.style.visibility = "visible";
	hiderDiv.style.height = hiderHeight+"px";
	obj.style.visibility = "visible";
}

function closeHelpTip()	{
	// hide helpTip[x] //
	obj.style.visibility = "hidden";
	var hiderDiv = document.getElementById("hiderDiv");
	hiderDiv.style.visibility = "hidden";
	document.docSearchForm.SKU.select();
}

function submitFromLink(skunumber) {
	document.docSearchForm.SKU.value = skunumber;
	closeHelpTip()
	document.docSearchForm.submit();
}

function fnPrepareSKU(strString){
	var strReturn = "";
	var found = "false";
	var badChars = "`-=\\][';/ .,\"~!@#$%^&*()_+|}{:?><";
	for(i=0; i<strString.length; i++){
		for (j=0; j<badChars.length; j++){
			currChar = badChars.charAt(j) ;
			if (strString.charAt(i) == currChar) { 
				found = "true";
				break;
			}
		}
		if( found == "false" ){
			strReturn = strReturn + strString.charAt(i); 
		}
		else{
			found = "false";
		}
	}
	return strReturn;
}


function validateDocSearch(fm){
	strSKU = fnPrepareSKU(fm.SKU.value);
	fm.SKU.value = strSKU;
	SKU = strSKU;
	if(SKU == ""){ alert("Please enter model number."); fm.SKU.focus(); return false; }
	if(SKU.length < 3){ alert("Please enter at least three characters."); fm.SKU.focus(); return false; }
	if(SKU.toUpperCase().indexOf("XL44") != -1)   { openHelpTip('XL44HelpDiv'); return false; }
	if(SKU.toUpperCase().indexOf("XL1800") != -1) { openHelpTip('XL1800HelpDiv'); return false; }
	if(SKU.toUpperCase().indexOf("XL1400") != -1) { openHelpTip('XL1400HelpDiv'); return false; }
	for(i=0;i<genericArray.length;i++) {
		testString = genericArray[i].toUpperCase();
		if(SKU.toUpperCase().indexOf(testString) != -1) { openHelpTip('genericHelpDiv'); return false; }
	}
	return true;
}
