// JavaScript Document
var xmlHttp;
function showpty() {
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null) { alert ("Please enable javascript or upgrade your browser"); return; }
	ptytype=document.getElementById? document.getElementById("propertytype") : propertytype;
	ptytype = ptytype.value;
	var url="in_bedcheck.php";
	url=url+"?ptype="+ptytype;
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged() { 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
	if(xmlHttp.responseText == 'true') {
		hideobj=document.getElementById? document.getElementById("bedlabel") : bedlabel;
		hideobj.style.visibility='visible';
		hideobj=document.getElementById? document.getElementById("bedselect") : bedselect;
		hideobj.style.visibility='visible';
		hideobj=document.getElementById? document.getElementById("bedsep") : bedsep;
		hideobj.style.visibility='visible';
	}
	else {
		hideobj=document.getElementById? document.getElementById("bedlabel") : bedlabel;
		hideobj.style.visibility='hidden';
		hideobj=document.getElementById? document.getElementById("bedselect") : bedselect;
		hideobj.style.visibility='hidden';
		hideobj=document.getElementById? document.getElementById("bedsep") : bedsep;
		hideobj.style.visibility='hidden';		
	}
}}

function GetXmlHttpObject() {
	var xmlHttp=null;
	try {
		xmlHttp=new XMLHttpRequest();
	}
	catch (e) {
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e) {
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}

messageObj = new DHTML_modalMessage();
messageObj.setShadowOffset(5);

function displayMessage(url) {
	messageObj.setSource(url);
	messageObj.setCssClassMessageBox(false);
	messageObj.setSize(400,200);
	messageObj.setShadowDivVisible(true);
	messageObj.display();
}

function displayStaticMessage(messageContent,cssClass) {
	messageObj.setHtmlContent(messageContent);
	messageObj.setSize(300,150);
	messageObj.setCssClassMessageBox(cssClass);
	messageObj.setSource(false);
	messageObj.setShadowDivVisible(false);
	messageObj.display();	
}

function closeMessage() {
	messageObj.close();	
}

function MM_validateForm() {
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
  if (p<1 || p==(val.length-1)) errors+='• '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
  if (isNaN(val)) errors+='• '+nm+' must contain a number.\n';
  if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
    min=test.substring(8,p); max=test.substring(p+1);
    if (num<min || max<num) errors+='• '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '• '+nm+' is required.\n'; }
    } if (errors) alert('No feilds must not be left blank:\n'+errors);
    document.MM_returnValue = (errors == '');
} }
