<!-- hide
function openWin1() {
  myWin= open("goldengatesite.html", "displayWindow",
    "width=640,height=480,status=no,toolbar=no,menubar=no, scrollbars=no");
}

function openWin2() {
  myWin= open("avalspace.html#a2", "displayWindow",
    "width=450,height=200,status=no,toolbar=no,menubar=no, scrollbars=no");
}
function openWin3() {
  myWin= open("directionsgold.html", "displayWindow",
    "width=400,height=500,status=no,toolbar=no,menubar=no, scrollbars=no");
}
function openWin4() {
  myWin= open("Qlinks.html", "displayWindow",
    "width=350,height=650,status=no,toolbar=no,menubar=no, scrollbars=no");
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function open_cms( url )
{
	cmswin = window.open( url, 'cmswin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=1,copyhistory=no,width=750,height=700' );
	cmswin.focus();
}

function open_map( url )
{
	mapwin = window.open( url, 'mapwin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=1,copyhistory=no,width=640,height=720' );
	mapwin.focus();
}

//===================================================================
//Functions for generating date
//===================================================================
function measure(n) {
	this.length=n;
	for (var i=1;i<=n;i++) {
		this[i]=0 }
	return this
}
month=new measure(12);
month[1]="January"
month[2]="February"
month[3]="March"
month[4]="April"
month[5]="May"
month[6]="June"
month[7]="July"
month[8]="August"
month[9]="September"
month[10]="October"
month[11]="November"
month[12]="December"

day=new measure(7);
day[1]="Sunday"
day[2]="Monday"
day[3]="Tuesday"
day[4]="Wednesday"
day[5]="Thursday"
day[6]="Friday"
day[7]="Saturday"

function writedate() {
		 display=new Date();
		 document.write(day[display.getDay()+1]+", "+month[display.getMonth()+1]+" "+display.getDate()+", "+display.getFullYear());
}


//Fuctions to mimmick LTrim,  RTrim, and Trim...
//==================================================================
//LTrim(string) : Returns a copy of a string without leading spaces.
//==================================================================
function LTrim(str)
/*
        PURPOSE: Remove leading blanks from our string.
        IN: str - the string we want to LTrim
*/
{
        var whitespace = new String(" \t\n\r");

        var s = new String(str);

        if (whitespace.indexOf(s.charAt(0)) != -1) {
            // We have a string with leading blank(s)...

            var j=0, i = s.length;

            // Iterate from the far left of string until we
            // don't have any more whitespace...
            while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
                j++;


            // Get the substring from the first non-whitespace
            // character to the end of the string...
            s = s.substring(j, i);
        }

        return s;
}

//==================================================================
//RTrim(string) : Returns a copy of a string without trailing spaces.
//=================================================================//=
function RTrim(str)
/*
        PURPOSE: Remove trailing blanks from our string.
        IN: str - the string we want to RTrim

*/
{
        // We don't want to trip JUST spaces, but also tabs,
        // line feeds, etc.  Add anything else you want to
        // "trim" here in Whitespace
        var whitespace = new String(" \t\n\r");

        var s = new String(str);

        if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
            // We have a string with trailing blank(s)...

            var i = s.length - 1;       // Get length of string

            // Iterate from the far right of string until we
            // don't have any more whitespace...
            while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
                i--;


            // Get the substring from the front of the string to
            // where the last non-whitespace character is...
            s = s.substring(0, i+1);
        }

        return s;
}


//=============================================================
//Trim(string) : Returns a copy of a string without leading or trailing spaces
//=============================================================
        function Trim(str)
        /*
                PURPOSE: Remove trailing and leading blanks from our string.
                IN: str - the string we want to Trim

                RETVAL: A Trimmed string!
        */
        {
                return RTrim(LTrim(str));
        }



function validEmail(email) {
	 invalidChars = " /:,;"
	
	if (email == "") {	// cannot be empty
	    //alert("Please enter your email address.");
	    return false
         }
	for (i=0; i<invalidChars.length; i++) {	// does it contain any invalid characters?
	badChar = invalidChars.charAt(i)
	if (email.indexOf(badChar,0) > -1) {
	   return false
	}
      }
      atPos = email.indexOf("@",1)	// there must be one "@" symbol
      if (atPos == -1) {
	 return false
      }
      if (email.indexOf("@",atPos+1) != -1) {	// and only one "@" symbol
	  return false
      }
      periodPos = email.indexOf(".",atPos)
      if (periodPos == -1) {			// and at least one "." after the "@"
	 return false
      }
      if (periodPos+3 > email.length)	{ // must be at least 2 characters after the "."
	 return false
      }
      return true
}

//######### ValidateForm #########/////////////////////
//This function performs form validation for required fields. 
//The required fields are indicated by the hidden field "_required". 
//The value is a list of the field ids plus the question number, 
//separated by comma. Note that here we use field ids so that we can 
//group fields have the different names but the same ids, for example, 
//a group of checkboxes. 
function ValidateForm(thisform) {
var errormsg = "Please complete question ";
if (thisform._required != null) {
	if (Trim(thisform._required.value).length != "") {
	var fieldnames = thisform._required.value.split(",");
		for (m=0; m<fieldnames.length; m++) {
			fieldnamearr = fieldnames[m].split("|");
			fieldname = Trim(fieldnamearr[0]);
			validationcode = "";
			errormsg = "Please complete all required fields. ";
			if (fieldnamearr.length > 1) {
				fieldlabel = Trim(fieldnamearr[1]);
				errormsg = errormsg + fieldlabel + ".";
			}
			//if (thisform.elements[fieldname].disabled == false || thisform.elements[fieldname].disabled===undefined) {
			//status = thisform.elements[fieldname].disabled;
			//errormsg = status;
				if (thisform.elements[fieldname].length===undefined) {
					if (thisform.elements[fieldname].disabled == false || thisform.elements[fieldname].disabled===undefined) {
						if (Trim(thisform.elements[fieldname].value).length=="") {
						alert(errormsg);
						thisform.elements[fieldname].focus();
						return false;
							}
						emailfield = fieldname.toLowerCase();
						if (emailfield.indexOf("email")>0) {
							if (validEmail(Trim(thisform.elements[fieldname].value))==false) {
							thisform.elements[fieldname].focus();
							alert("Please enter a valid email address.");
							return false;
								}
							}
						}
					if (fieldnamearr.length > 2) {
					  	validationcode = Trim(fieldnamearr[2]);
						validationcode = validationcode.toLowerCase();
						if (validationcode == "zip") {
							if (!(IsZip(thisform.elements[fieldname].value))) {
								thisform.elements[fieldname].focus();
								alert("Please enter a valid zip code, for example, 10200 or 10200-1234.");
								return false; 
								}
							}
						if (validationcode == "year") {
							if (!(IsYear(thisform.elements[fieldname].value))) {
								thisform.elements[fieldname].focus();
								alert(validationcode + IsYear(thisform.elements[fieldname].value) + "Please enter a valid year, for example, 1984.");
								return false; 
								}
							}
					  	}
					}
				else {
					if (thisform.elements[fieldname][0].disabled == false || thisform.elements[fieldname][0].disabled===undefined) {
						thischecked = -1
						for (i=0; i<thisform.elements[fieldname].length; i++) {
							if (thisform.elements[fieldname][i].checked || (thisform.elements[fieldname][i].selected && thisform.elements[fieldname][i].value.length!="")) {
							thischecked = i;
								}
							}
						if (thischecked == -1) {
							thisform.elements[fieldname][0].focus();
							alert(errormsg);
							return false;
							
							}
						}
					}
				//}
			}
		}
	}
	
SubmitForm = true;
}
//######### ValidateForm #########/////////////////////


function confirmExit() {
	if (SubmitForm == true) {
		return;
	}
	return confirmExitText;
}

function InitBody() {
	DoLock(document.forms[0]);
}

function DoLock(thisform) {
	var fieldname;
	for (n=0; n<thisform.elements.length; n++) {
		fieldname = thisform.elements[n].name;
		if (fieldname.indexOf("othertext") > 0) {
			thisform.elements[n].disabled = true;
			}
		}
}

function LockTextBox(name, status) {
	var x;
	x = document.getElementById(name);
	if (x != null) {
		if (status) x.value = "";
		x.disabled = status;
		}
}

function JumpForm(elementID) {
	if (elementID.length > 0)
		document.getElementById(elementID).focus();
	else
		document.getElementById("Button1").click();
	return;
}


//######### LockAll #########/////////////////////
//This function will disable all the fields except 
//the unlockfield and the fields for the submit button and ASP.NET field. 
//All disabled field will be cleared of any data.
//unlockfield: the field that will remain unlocked.
function LockAll(thisform, unlockfield) {
	var fieldname;
	for (n=0; n<thisform.elements.length; n++) {
		fieldname = thisform.elements[n].name;
		if (fieldname != unlockfield && fieldname != "Button1" && fieldname != "__VIEWSTATE") {
			ClearField(thisform.elements[n]);
			thisform.elements[n].disabled = true;
			}
		}
	//SubmitForm = true;
	//thisform.submit();
}
//######### LockAll #########/////////////////////

//######### unLockAll #########/////////////////////
//This function will unlock (enable) all the fields except 
//the lockfield and the fields for text next to a check box. 
//lockfield: the field that will remain locked.
function unLockAll(thisform, lockfield) {
	var fieldname;
	for (n=0; n<thisform.elements.length; n++) {
		fieldname = thisform.elements[n].name;
		if (fieldname != lockfield && fieldname.indexOf("othertext") == -1 ) {
			thisform.elements[n].disabled = false;
			}
		};
}
//######### unLockAll #########/////////////////////

//######### LockSelected #########/////////////////////
//This function will change the "disabled" status of the field. 
//theform: form object
//fieldprefixstr: a list of field name prefixes separated by comma. 
//Note that "field_1" will match "field1_1", "field_11", "field_123", etc.
//lockstatus: "lock" - disable the fields; "unlock" - enable the fields.
function LockSelected(thisform, fieldprefixstr, lockstatus) {
	var fieldprefixarr = fieldprefixstr.split(",");
	for (m=0; m<fieldprefixarr.length; m++) {
		fieldprefix = Trim(fieldprefixarr[m]);
		for (n=0; n<thisform.elements.length; n++) {
		fieldname = thisform.elements[n].name;
		if (fieldname.indexOf(fieldprefix) == 0) {
			if (lockstatus == "lock") {
				ClearField(thisform.elements[n]);
				thisform.elements[n].disabled = true;
				}
			if (lockstatus == "unlock") {
				if (fieldname.indexOf("othertext") == -1 ) {
					thisform.elements[n].disabled = false;
					}
				}
			}
		}
	}
}
//######### LockSelected #########/////////////////////

//######### ClearSelected #########/////////////////////
//Will clear the value of multiple fields. 
//fieldprefixstr: a list of field prefixes that will be cleared
//excludefield: field to be excluded from clearing.
function ClearSelected(thisform, fieldprefixstr, excludefield) {
	var fieldprefixarr = fieldprefixstr.split(",");
	for (m=0; m<fieldprefixarr.length; m++) {
		fieldprefix = Trim(fieldprefixarr[m]);
		for (n=0; n<thisform.elements.length; n++) {
			fieldname = thisform.elements[n].name;
			if (fieldname.indexOf(fieldprefix) == 0 && fieldname != excludefield) {
				ClearField(thisform.elements[n]);
				if (fieldname.indexOf("othertext") != -1 ) {
					thisform.elements[n].disabled = true;
					}
			}
		}
	}
}

//######### ClearField #########/////////////////////
function ClearField(thisfield) {
	if (thisfield.type == "text") {
		thisfield.value = "";
	}
	if (thisfield.type == "textarea") {
		thisfield.value = "";
	}
	if (thisfield.type == "checkbox") {
		thisfield.checked = false;
	}
	if (thisfield.type == "radio") {
		thisfield.checked = false;
	}
}

//####### validate year #######//////////////////////
function IsZip(zipstr) {
	var pattern = /(^\d{5}$)|(^\d{5}-\d{4}$)/;
	if (pattern.test(zipstr)) {
		return true;
	}  else {return false;}
}

//####### validate zip code #######//////////////////
function IsYear(yearstr) {
	var pattern = /^\d{4}$/;
	if (pattern.test(yearstr)) {
		return true;
	}  else {return false;}
}

// -->