// Support Script (409)
function PopulateWith(TheList, Items)
{
  var iCount = TheList.getCount();
  for (var i=0; i<iCount; i++)
    if (TheList.elementID)
      TheList.elementID.options[0] = null;
    else
      alert("bad or wrong DE for state population");

  i = 0;
  iCount = Items.length;
 	for (i=0; i<iCount; i++)
    TheList.addOption(Items[i], i, "");

  TheList.setSelectedByPosition(0);
}
// Support Script (721)
function subAwithBinC(a,b,c)
{

	var i = c.indexOf(a);
	var l = b.length;

	while (i != -1)	{
		c = c.substring(0,i) + b + c.substring(i + a.length,c.length);
		i = c.indexOf(a,i);
	}
	return c;

}
// Support Script (662)
function Validate(stopOnFailure)
{
	var ErrorMsg = "";
	var i
	var msg
	var tofocus = true;
	var ErrorMsg = "";
	
	// Go through the Validate Array that may or may not exist
	// and call the Validate function for all elements that have one.
	if (document.ValidateArray)
	{
		for (i = 0; i < document.ValidateArray.length; i ++)
		{
			msg = eval( document.ValidateArray[i] + ".Validate()")
			if (msg != "")
			{
				ErrorMsg += "\n\n" + document.ValidateArray[i] + ":  " + msg;
				if (tofocus) 
				{
					eval(document.ValidateArray[i] + ".focus()")
					tofocus = false;
				}
				
				if (stopOnFailure == "1") return ErrorMsg;
			}
  	}
  }
	return ErrorMsg;
}

function document_onLoad() {
var i = 0;
s = new Array(52);
s[i++] = "--"
s[i++] = "AK"
s[i++] = "AL"
s[i++] = "AR"
s[i++] = "AZ"
s[i++] = "CA"
s[i++] = "CO"
s[i++] = "CT"
s[i++] = "DC"
s[i++] = "DE"
s[i++] = "FL"
s[i++] = "GA"
s[i++] = "HI"
s[i++] = "IA"
s[i++] = "ID"
s[i++] = "IL"
s[i++] = "IN"
s[i++] = "KS"
s[i++] = "KY"
s[i++] = "LA"
s[i++] = "MA"
s[i++] = "MD"
s[i++] = "ME"
s[i++] = "MI"
s[i++] = "MN"
s[i++] = "MO"
s[i++] = "MS"
s[i++] = "MT"
s[i++] = "NC"
s[i++] = "ND"
s[i++] = "NE"
s[i++] = "NH"
s[i++] = "NJ"
s[i++] = "NM"
s[i++] = "NV"
s[i++] = "NY"
s[i++] = "OH"
s[i++] = "OK"
s[i++] = "OR"
s[i++] = "PA"
s[i++] = "RI"
s[i++] = "SC"
s[i++] = "SD"
s[i++] = "TN"
s[i++] = "TX"
s[i++] = "UT"
s[i++] = "VA"
s[i++] = "VT"
s[i++] = "WA"
s[i++] = "WI"
s[i++] = "WV"
s[i++] = "WY"

PopulateWith(List1, s);
 }
function List1__onChange() {
State.setText(List1.getSelectedText());
 }
function _List1__onChange() { if (List1) return List1.onChange(); }
function FormButton1__onClick() {
var addChar = "?" 
var j
var okToSubmit = false;

if ("".length > 1)
{
    Form1.setAction(subAwithBinC(" ", "%20", ""));
}

// execute the onSubmit() event handler and try to 
// determine if it already validated the form
Result = Form1.onSubmit();

//   If there is no onSubmithander the return value is null
//   If there is a validation handler it returns true to submit
//   or false to not submit
if (Result==null)  // there is no validation already defined
{
    if ("1" == "1")
    {
        Result = Validate("0"); // don't stop on first error
        if (Result == "") okToSubmit = true;
        else alert("The form could not be submitted:" + Result);
    }
    else okToSubmit = true;
}
else // there is a validation already defined
{
    if (Result==true)
        okToSubmit = true;
}

if (okToSubmit) 
{
    // We have to
    // put the source in the query string so the generic database contracts
    // still work.

    // NOTE: this only works if the method of the form is POST


    act = Form1.getAction();
    if (act.indexOf("?") != -1)
    {    
        addChar = "&"
    }

    act += addChar + "FormButton1=1"
    Form1.setAction(act);


    Form1.submit();
}
if ("".length > 0)
    document.location.href="";
else
    document.location.href="ps_orderprintout.asp";
 }
function _FormButton1__onClick() { if (FormButton1) return FormButton1.onClick(); }
function Check2__onClick() {
Blue_Window.setText("I wish to purchase Blue Window");
 }
function _Check2__onClick() { if (Check2) return Check2.onClick(); }
function Check3__onClick() {
Buckskin.setText("I wish to purchase Buckskin");
 }
function _Check3__onClick() { if (Check3) return Check3.onClick(); }
function Check4__onClick() {
Huff_Church_Road.setText("I wish to purchase Huff Church Road");
 }
function _Check4__onClick() { if (Check4) return Check4.onClick(); }
function Check6__onClick() {
Moonrise_at_High_Field.setText("I wish to purchase Moonrise at High Field");
 }
function _Check6__onClick() { if (Check6) return Check6.onClick(); }
function Check8__onClick() {
Prince_Edward_Island.setText("I wish to purchase Prince Edward Island");
 }
function _Check8__onClick() { if (Check8) return Check8.onClick(); }

