/*
document.getElementsByClassName = function(clsName,parent,tag) 
{
var ch = (parent || document.body).getElementsByTagName(tag?tag:'*');
var a = new Array(); 
for( var i=0; i<ch.length; i++ ) if( ch[i].className==clsName ) a.push(ch[i]);
return a;
};
*/


/*
function switchform(cls,show)
{
		var left = document.getElementById('content');
		var f = document.getElementsByClassName(cls,left,'div');

		for( var i=0; i<f.length; i++ ) {
			if( f[i].getAttribute('name')==show ) {
				f[i].style.display='block';
			}
			else {
				f[i].style.display='none';
			}
		}
}
*/




function expandit(strDiv1)
{

  if (strDiv1 == "buy")
    strDiv2 = "rent";
  else
    strDiv2 = "buy";

  var objDiv1 = document.getElementById(strDiv1);
  var objDiv2 = document.getElementById(strDiv2);
  
  if (objDiv1.style.display=='block')
    return;

  objDiv1.style.display=='block'?objDiv1.style.display='none':objDiv1.style.display='block';
  objDiv2.style.display=='none'?objDiv2.style.display='block':objDiv2.style.display='none';

//#left ul li ul.under
//  document.body.style.backgroundPositionY="bottom";
/*
var left = document.getElementsById('left');
var under = document.getElementsByClassName('under',left,'ul')[0];

alert (under);

under.style.backgroundPosition = "0px -320px";
*/

  return;
}




function validate_form()
{
  var missing = "";
  valid = true;

  if (document.info_request.firstname.value == "") {
    missing = "First Name";
    document.info_request.firstname.focus();
    valid = false;
  }
  if (document.info_request.lastname.value == "") {
    if (valid == false) missing += ", "
    missing += "Last Name";
    document.info_request.lastname.focus();
    valid = false;
  }
  if (document.info_request.email.value == "") {
    if (valid == false) missing += ", "
    missing += "Email";
    if (valid != false) document.info_request.email.focus();
    valid = false;
  }

  if (valid == false) {
    alert ("Please fill in the following field(s): "+missing+".");
  }
  else {
    var email = document.info_request.email.value;
    if (email != "")
    {
      if (email.indexOf(' ') == -1 
          && 0 < email.indexOf('@')
          && email.indexOf('@') + 1 < email.length) {
        return valid;
      }
      else {
        alert ('Invalid email address.')
        document.info_request.email.focus();
        valid = false;
      }
    }
  }
  return valid;
}



function confirmation(str)
{
  var answer = confirm(str)
  if (answer)
    return true;
  else
    return false;
}


