

//called by the onKeyUp javascript event on the input
function FindSelections()
{
	var objZip = document.getElementById("txtZip");
  if (objZip.value)
  {
    //SearchComplection is defined by Ajax.Net because that's the name of the type we registered
    Schedule.LoadZipInfo(objZip.value, FindSelections_CallBack);
  }
}	

function printWin()
{
	
    var output;
    
    /*
    output = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
    output += "<html>";
    output += "<head>";
    output += "<link href=\"css/reset.css\" rel=\"stylesheet\" type=\"text/css\" />";
    output += "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/header.css\" />";
    output += "<link href=\"css/screen.css\" rel=\"stylesheet\" type=\"text/css\" />";
    output += "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/branding.css\" />";
    output += "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/navigation.css\" />";
    output += "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/classes.css\" />";
    output += "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/footer.css\" />";
    output += "<!--[if IE]>\n";
    output += "    <link rel=\"stylesheet\" href=\"css/ie.css\" />\n";
    output += "<![endif]-->\n";
    output += "<link href=\"styles/widget.css\" rel=\"stylesheet\" type=\"text/css\" />";
    output += "</head>";
    output += "<body>\n";
    output += "<img src=\"http://www.jcehrlich.com/en/i/ehrlich-logo.jpg\" />";
    output += "<br />";
    output += " <div style=\"margin-left: 15px;\">  Free inspection Confirmation  </div>";
    output += "<div class=\"inspect-ctr1\" style=\"margin-left: 15px;\">";
    output += document.getElementById('Schedule1_pnPrint').innerHTML;
    output += "</div>";
    output += "</div>"
    //output += "<div class=\"inspect-btm\" style=\"margin-left: 15px;\"></div>"
    output += "</body>";
    output += "</html>";
    */
    
    
    output = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
    
    output += "<html>";
    output += "<head>";
    output += "<link href=\"css/reset.css\" rel=\"stylesheet\" type=\"text/css\" />";

    output += "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/header.css\" />";
    output += "<link href=\"css/screen.css\" rel=\"stylesheet\" type=\"text/css\" />";
    
    output += "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/branding.css\" />";
    output += "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/navigation.css\" />";
    output += "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/classes.css\" />";
    output += "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/footer.css\" />";
    output += "<!--[if IE]>\n";
    output += "    <link rel=\"stylesheet\" href=\"css/ie.css\" />\n";
    output += "<![endif]-->\n";
    
    output += "<link href=\"styles/widget.css\" rel=\"stylesheet\" type=\"text/css\" />";
    
    output += "</head>";
    output += "<body>\n";
    output += "<img src=\"http://www.jcehrlich.com/en/i/ehrlich-logo.jpg\" />";
    output += "<form name=\"contactform\" method=\"post\" action=\"TestInclude.aspx\" id=\"contactform\"    class=\"inspection\">";
    output += "<div id=\"sitecontainer\">";
    output += "    <div class=\"clearfix\" id=\"content-container\">";
    output += "        <div id=\"pri-cont-local\">";
    output += "            <div id=\"inspect_trad\">";

    output += document.getElementById('Schedule1_pnPrint').innerHTML;
    output += document.getElementById('Schedule1_pnPrint2').innerHTML;
    output += document.getElementById('Schedule1_pnPrint3').innerHTML;
    output += document.getElementById('Schedule1_pnPrint4').innerHTML;
    output += document.getElementById('Schedule1_pnPrint5').innerHTML;

    //output += "<br />For questions, or to reschedule your appointment, <br /> please call 1-800-837-5520.";

    //output += document.getElementById('pnPrint').innerHTML;
    //output += document.getElementById('pnPrintBookingNumber').innerHTML;
    output += "             </div>";
    output += "          </div>";
    output += "       </div>";
    output += "    </div>";
    output += " </form>";

    output += "</body>";
    output += "</html>";

    var a = window.open('','','width=450,height=600,scrollbars=yes');
	a.document.open("text/html");

	a.document.write(output);

	a.document.close();
	a.print();
	//a.close();
	return;
	
}

function HighlightDay(obj) {
	document.getElementById(obj).style.backgroundColor = "yellow";
	return;
	}
function GetDayOptions(obj) {
    document.getElementById("BoxSelection").innerHTML = document.getElementById(obj + "Info").innerHTML;
    document.getElementById("BoxPrev").innerHTML = document.getElementById(obj + "Prev").innerHTML;
    document.getElementById("BoxNext").innerHTML = document.getElementById(obj + "Next").innerHTML;
    document.getElementById("BoxDayTitle").innerHTML = document.getElementById(obj + "Title").innerHTML;
    
    document.getElementById("PreviousArrow").innerHTML = document.getElementById(obj + "PreviousArrow").innerHTML;
    document.getElementById("PreviousText").innerHTML = document.getElementById(obj + "PreviousText").innerHTML;
    //PreviousArrow
    //PreviousText
    
    document.getElementById("NextArrow").innerHTML = document.getElementById(obj + "NextArrow").innerHTML;
    document.getElementById("NextText").innerHTML = document.getElementById(obj + "NextText").innerHTML;
    //NextArrow
    //NextText
    
    return;
    }
function ReturnDay(obj,color) {
	document.getElementById(obj).style.backgroundColor = color;
	return;
	}
function SaveSelection(dtSelectedDate,sTimeSlot,sStartDateTime,sEndDateTime) {
    Schedule1.SaveDateTimeSelection(dtSelectedDate, sTimeSlot, sStartDateTime, sEndDateTime);
	var obj = document.getElementById("Schedule1:hidSelectedDateTime");
	if(obj == null){
	       obj = document.getElementById("Schedule1_hidSelectedDateTime");
	}
	//alert(dtSelectedDate);
	obj.value = dtSelectedDate + " at " + sTimeSlot;

	var hidStart = document.getElementById("Schedule1:hidStartDateTime");
	if (hidStart == null) {
	    hidStart = document.getElementById("Schedule1_hidStartDateTime");
	}
	hidStart.value = sStartDateTime;

	var hidEnd = document.getElementById("Schedule1:hidEndDateTime");
	if (hidEnd == null) {
	    hidEnd = document.getElementById("Schedule1_hidEndDateTime");
	}
	hidEnd.value = sEndDateTime;
	
	//alert(obj.value);
	__doPostBack('Schedule1:btnGoStepEnterNameInfo','');
	}
	//callback we told Ajax.Net to pass the response tos
	
function FindSelections_CallBack(response)
{
  //if the server side code threw an exception
  if (response.error != null)
  {    
    alert(response.error); //we should probably do better than this
    return;
  }  
  
  //if we didn't get what we expect, or didn't get any matches  
  if (!response.value  || response.value.length == 0)
  {
    //matcheList.style.visibility = "hidden";
    return;
  }
  

  //matcheList.style.visibility = "visible";
  //matcheList.options.length = 0; //reset the states dropdown    
  //matcheList.size = response.value.length; //dynamically set the size of the select box   
  var obj0 = document.getElementById("lblCity");
  var obj1 = document.getElementById("lblState");

  var obj = response.value;
  if (typeof(obj.Rows) == "object")  {
	
  for (var i = 0; i < obj.Rows.length; ++i)
  {
	obj0.innerHTML = obj.Rows[i].City
	obj1.innerHTML = obj.Rows[i].State
	//matcheList.options[matcheList.options.length] = new Option(response.value[i]);       
  }    
	}
else {
	//alert("obj value:" + obj.value.length);
  for (var i = 0; i < obj.length; ++i)
  {
    obj0.innerHTML = obj[i].City
	obj1.innerHTML = obj[i].State

	//matcheList.options[matcheList.options.length] = new Option(response.value[i]);       
  }  
	}

}