//VERIFY REALTOR AGENCY and Email
//
function toggleDisplay(elementid) {
  var node = document.getElementById(elementid);
  if(node.style.display === '') {
    node.style.display = 'none';
  }
  else {
    node.style.display = '';
  }
}

//larongegold form verification
//
function chkform(myform)
 {
 valid=true;
 c_last_name = myform.Contact_Last_Name.value;
 if (c_last_name.length < 1)
 	{
 	alert('Please provide us with your name');
 	valid=false;
 	}
 c_comments = myform.Comments.value;
 if (c_comments.length < 1)
 	{
 	alert('Please enter a comment');
 	valid=false;
	 }
 c_phone = myform.Contact_Phone.value;
 c_eml = myform.Contact_Email.value;
 if(c_eml.length > 0)
 	{
 	atpos=c_eml.indexOf("@");
 	dotpos=c_eml.indexOf(".");
 	if (atpos<1 || dotpos<atpos+2 || dotpos+2>=c_eml.length)
  	 {
  	 alert("Please provide a valid e-mail address");
  	 valid = false;
  	 }
 }
 else 
 {
  	if(c_phone.length < 1)
	{
	 alert('Please provide us with at least one method of contacting you');
	 valid = false;
	}
 } 
  if(valid){document.form.submit();}
 return valid;
}
function chkformlite(myform)
 {
 valid=true;
 
 c_eml = myform.Contact_Email.value;
 if(c_eml.length > 0)
 	{
 	atpos=c_eml.indexOf("@");
 	dotpos=c_eml.indexOf(".");
 	if (atpos<1 || dotpos<atpos+2 || dotpos+2>=c_eml.length)
  	 {
  	 alert("Please provide a valid e-mail address");
  	 valid = false;
  	 }
 	}
 else 
 {
  	 alert("Please provide a valid e-mail address");
  	 valid = false;
 } 
  if(valid)
  {
  document.rqstform.submit();
  document.rqstform.reset();
  }
 return valid;
}
//
//
function verify(){
alert("got here");
var msg = "";
var Item = document.form.eagency.selectedIndex;
var Result = document.form.eagency.options[Item].text;
alert("got here");
if (Result === "Yes") {
   msg=msg+"You have indicated that you are currently working with another Realtor.  As it is not ";
   msg=msg+"our intention to interfere with any working relationship you may currently have, ";
   msg=msg+"we suggest you request this service from your Realtor.  We know he or she will be more ";
   msg=msg+"than happy to provide you with this information.";

   alert(msg);

}
if (document.form.Contact_Email.value === "") {
msg = "Please Enter Your E-mail Address";
alert(msg);
}
if (msg === ""){
document.form.submit();
}
else {
return false;
  }
}

//
function popitup(url) {
var	newwindow=window.open(url,'contact-form.html','height=500,width=500');
	if (window.focus) {newwindow.focus();}
	return false;
}
// Copyright 2001 Idocs.com      
// Distribute this script freely, but keep this notice in place

// backlink object initializer
function backlink() {
	this.text = 'Go Back';
	this.type = 'link';
	this.write = backlink_write;
	this.form = true;
}
// write method
function backlink_write() {
	if (! window.history) {return;}
	if (window.history.length === 0){return;}

	this.type = this.type.toLowerCase();
	if (this.type === 'button') {
		if (this.form){
			document.write('<FORM>');}
		document.write('<INPUT TYPE=BUTTON onClick="history.back(-1)" VALUE="', this.text, '"');
		if (this.otheratts){document.write(' ', this.otheratts);}
		document.write('>');
		if (this.form){document.write('<\/FORM>');}
	} else {
		document.write('<A HREF="javascript:history.back(-1)"');
		if (this.otheratts){
			document.write(' ', this.otheratts);}
		document.write('>');
		if (this.type === 'image' || this.type === 'img') {
			document.write('<img SRC="', this.src, '" ALT="', this.text, '"');
			if (this.width){document.write(' WIDTH=', this.width);}
			if (this.height){ document.write(' HEIGHT=', this.height);}
			if (this.otherimgatts){document.write(' ', this.otherimgatts);}
			document.write(' BORDER=0 />');
		}
		else {
		document.write(this.text);}
		document.write('<\/A>');
	}
}
