function doPageBGD(){
var img=new Array();
	img[img.length]="http://www.capstoneny.com/i/mainpic-bgd/1.jpg";
	img[img.length]="http://www.capstoneny.com/i/mainpic-bgd/2.jpg";
	img[img.length]="http://www.capstoneny.com/i/mainpic-bgd/3.jpg";
	img[img.length]="http://www.capstoneny.com/i/mainpic-bgd/4.jpg";
	img[img.length]="http://www.capstoneny.com/i/mainpic-bgd/5.jpg";
	img[img.length]="http://www.capstoneny.com/i/mainpic-bgd/6.jpg";
	var rand=Math.round(Math.random()*(img.length-1));
	document.write("<style>body{background:#000 url('" + img[rand] +"');}</style>");
}

function getUrlVars(){
	//Read a page's GET URL variables and return them as an associative array
	//usage
	//Calling the function while at example.html?foo=asdf&bar=jkls sets map['foo']='asdf' and map['bar']='jkls'
	var map = {};
	var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
		map[key] = value;
	});
	return map;
}

function setIDandClassOnBody(theID, theClass1, theClass2){
		
	//this function needs fct getUrlVars()
	var urlVar = getUrlVars(); 
	var theOspace = urlVar['ospace'];
	var ForentOrForSale = urlVar['fs'];
	
	var zone =  ""; 
	if (urlVar['zone']){zone = "\" > <a href='#' class='zone'>" + urlVar['zone'] + "<\/a>\"";}
	
	var forsale = '';
	
	if(theOspace=='true'){//office space
		document.write('<body id=\"' + theID + '\" class=\"' + theClass1 ); 
		if(ForentOrForSale=='true'){//for sale
			document.write(' forsale');	
			forsale = 'For Sale';
		}
		else{ 
			document.write(' forent'); 
			forsale = 'For Rent';
		}
		document.write('\" >');
		document.write('<script\>var ospace = \"Office Space\"; var forsale = \"' + forsale + '\"; var theZone = ');
		if (zone!=''){ document.write( zone + ';<\/script>'); }
		else { document.write('\"\";<\/script>'); }
	}
	else {//retail space
		document.write('<body id=\"' + theID + '\" class=\"' + theClass2 );
		if(ForentOrForSale=='true'){//for sale
			document.write(' forsale');
			forsale = 'For Sale';
		}
		else{ 
			document.write(' forent'); 
			forsale = 'For Rent';
		}
		document.write('\" >');
		document.write('<script\>var ospace = \"Retail Space\"; var forsale = \"' + forsale + '\";var theZone = ');
		if (zone!=''){ document.write( zone + ';<\/script>'); }
		else { document.write('\"\";<\/script>'); }
	}
}

function showErrMsg(){
	//this function needs fct getUrlVars()
	var urlVar = getUrlVars(); 
	var errMsg = urlVar['err'];
	if(errMsg=='true'){//office space
		document.write('<div class=\"errMsg\">Error:<br \/>Combination of user name and password is invalid.<\/div>' ); 
	}	
}


function addToFavorites() { 
	var urlAddress = getUrlVars(); 
	var pageName = "Capstone Realty Advisors : listing No.{$id}"; 

	if (window.external) { 
		window.external.AddFavorite(urlAddress,pageName) 
	} 
	else { 
		alert("Sorry! Your browser doesn't support this function.");
	} 
} 

function transferImg(img, alt, title, originalImg){
	document.getElementById('mainImg').innerHTML = "<img src='../../i/uploads/" + img + "' width='430' alt='"+alt+"' title='"+title+"' onclick=\"revertMainImg('" + originalImg + "')\" />";
	if (document.getElementById('mainImg').height > 350){
		document.getElementById('mainImg').style.height = "400px!important";
	}
}
function revertMainImg(originalImg){
	document.getElementById('mainImg').innerHTML = "<img src='../../i/uploads/" + originalImg + "' width='430'  />";
}
function getNext(lid, allLids){}//not used
function ismaxlength(obj){
	var mlength=obj.getAttribute ? parseInt(obj.getAttribute("maxlength")) : "";
	if (obj.getAttribute && obj.value.length>mlength)
		obj.value=obj.value.substring(0,mlength)
}