function t1(inputBox,defaultText) {if(inputBox.value==defaultText) inputBox.value="";}
function t0(inputBox,defaultText) {if(inputBox.value=="") inputBox.value=defaultText;}	
function toggleObj(obj) { if(obj==null) return true; if (obj.style.display == "none" | obj.style.display == "") {obj.style.display="block";} else {obj.style.display="none";} return false; }
function advSearch() { var obj=getElem('advsearchparams'); obj.style.display="block"; return true;}
function listingType() { var forSale=getElem('ForSale');if(!forSale) return;var forRent=getElem('ForRent');var buy=getElem('SearchControl_Buy');var rent=getElem('SearchControl_Rent');if(buy.checked){hideObj(forRent);showObj(forSale);}else{hideObj(forSale);showObj(forRent);}}
function getElem(objId) { if (document.getElementById(objId)) { return document.getElementById(objId);} return null; }
function hideObj(obj)  { if(obj==null) return; obj.style.display="none"; }
function showObj(obj)  { if(obj==null) return; obj.style.display="block"; }
function displayForm(obj) {var ws = new WindowSize(); var backdrop = getElem('backdrop'); var foreground = getElem(obj); showObj(backdrop); showObj(foreground); backdrop.style.left = "0px"; backdrop.style.height = ws.PageHeight+"px"; backdrop.style.width = ws.PageWidth+"px"; backdrop.style.top = "0px"; foreground.style.top = (ws.VisibleTop + 10) + "px"; return false; }
function hideForm(elem) {hideObj(getElem('backdrop'));hideObj(getElem(elem)); return false;}
function showPhoto(photo) {hidePhotos();showObj(getElem(photo));displayForm('photos'); return false;}
function showActivePhoto() {var curImg=getElem('CurrentPhoto');var i;if(curImg==null){i=0;}else{i=parseInt(curImg.innerHTML)-1;}showPhoto("photo"+i.toString()); return false;}
function checkEmail(inputvalue){var pattern=/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;if(pattern.test(inputvalue)){return true;}else{return false;}}
function Trim(str){newstr=str.replace(/^\s+/, '');return newstr.replace(/\s+$/, '');};
function WindowSize()
{
	this.PageWidth=0; this.PageHeight=0; this.VisibleWidth = 0; this.VisibleHeight = 0; this.VisibleTop = 0; this.VisibleLeft = 0;

	if( window.innerHeight && window.scrollMaxY ) // Firefox
	{
		this.PageWidth = window.innerWidth + window.scrollMaxX;
		this.PageHeight = window.innerHeight + window.scrollMaxY;
	}
	else if( document.body.scrollHeight > document.body.offsetHeight ) // all but Explorer Mac
	{
		this.PageWidth = document.body.scrollWidth;
		this.PageHeight = document.body.scrollHeight;
	}
	else // works in Explorer 6 Strict, Mozilla (not FF) and Safari
	{
		this.PageWidth = document.body.offsetWidth + document.body.offsetLeft;
		this.PageHeight = document.body.offsetHeight + document.body.offsetTop;
	}

	// VisibleWidth & VisibleHeight
	if( typeof( window.innerWidth ) == 'number' )
	{
		this.VisibleWidth = window.innerWidth;
		this.VisibleHeight = window.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientWidth)
	{
		this.VisibleWidth    = document.documentElement.clientWidth;
		this.VisibleHeight   = document.documentElement.clientHeight;
	}
	else if (document.body && document.body.clientWidth)
	{
		this.VisibleWidth    = document.body.clientWidth;
		this.VisibleHeight   = document.body.clientHeight;
	}

	// VisibleTop & VisibleLeft
	if (!isNaN(window.pageYOffset))
	{
		this.VisibleTop      = window.pageYOffset;
		this.VisibleLeft     = window.pageXOffset;
	}
	else if (document.body && ( document.body.scrollTop || document.body.scrollLeft))
	{
		this.VisibleTop      = document.body.scrollTop;
		this.VisibleLeft     = document.body.scrollLeft;
	}
	else if (document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop) )
	{
		this.VisibleTop      = document.documentElement.scrollTop;
		this.VisibleLeft     = document.documentElement.scrollLeft;
	}
	else
	{
		//alert("Unknown Scrolling");
	}

	if (navigator.userAgent.indexOf('Safari') > -1)
	{
		this.VisibleHeight = window.innerHeight;
	}
}
window.onload = listingType;

function Listing(address, beds, baths, price, link, photo, listingdate, listingid) {
    this._address = address;
    this._beds = beds;
    this._baths = baths;
    this._price = price;
    this._link = link;
    this._photo = new Image(200,150);
    this._photo.src = photo;
    this._listingdate = listingdate;
    this._listingid = listingid;
}
Listing.prototype._address;Listing.prototype._beds;Listing.prototype._baths;Listing.prototype._price;Listing.prototype._link;Listing.prototype._photo;Listing.prototype._listingdate;Listing.prototype._listingid;

