// JavaScript Document


function returntooriginal(){
document.getElementById("changeable").innerHTML="<h4>To check if your refrigerator is applied to this recall please enter your model and serial numbers below.</h4><br><br><table cellpadding='5' cellspacing='5'><tr><td>Model</td><td><input name='model' type='text' id='model'></td></tr><tr><td>Serial</td><td><input name='serial' type='text' id='serial'></td></tr><tr><td></td><td><input type='button' name='submit' value='Check for Recall' onClick='checkmodelserial()'></td></tr></table>";	
}
function checkmodelserial(){
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
			{
			alert ("Your browser does not support AJAX!");
			return;
			}
		var url="check.asp";
		url=url+"?";
		url=url+"model="+document.getElementById("model").value;
		url=url+"&serial="+document.getElementById("serial").value;
//		url=url+"&m="+method;
		url=url+"&sid="+Math.random();
		xmlHttp.onreadystatechange=StateChangedcheckmodelserial;
		//alert(stateChanged);
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
}

function StateChangedcheckmodelserial(){
if (xmlHttp.readyState==4)
{
var xmlDoc=xmlHttp.responseXML.documentElement;
if (xmlDoc.getElementsByTagName("truefalse")[0].childNodes[0].nodeValue=="True")
{
document.getElementById("changeable").innerHTML = "<h3 style='color:red; font-weight:bold;'>This unit has been recalled</h3><p style='font-weight:bold; font-size:14px;'>The model and serial numbers you've entered are included in the recall. Check the refrigerator's model/serial number label for a identifing sticker (blue dot) which indicates that the unit has been repaired. If there is no BLUE dot sticker on the model/serial number label, please call us toll free at (800)828-0778 or <a href='/appointment/'>click here to schedule your appointment.</a></p><a style='color:#0000FF; cursor:pointer;' onClick='returntooriginal()'>Search Again</a>"
}
if(xmlDoc.getElementsByTagName("truefalse")[0].childNodes[0].nodeValue!="True")
{
document.getElementById("changeable").innerHTML = "<h3 style='color:red; font-weight:bold;'>This unit has not been recalled</h3><p style='font-weight:bold; font-size:14px;'>The model and serial numbers you've entered are not included in the recall.</p><a style='color:#0000FF; cursor:pointer;' onClick='returntooriginal()'>Search Again</a>"
}
}
}


function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

