// JavaScript Document

function showDropDown(objChkBx,divid) {
	if(objChkBx.checked == true) {
		animatedcollapse.hide(divid);
	}
	else
	{
		animatedcollapse.show(divid);
	}
}

function HideDIV(d) { document.getElementById(d).style.display = "none"; }
function DisplayDIV(d)
 { 
 
if (d=="fourth")
 {

var browser =navigator.appName; 
if (browser =="Microsoft Internet Explorer")
 
									   {
									 
									     document.getElementById("StreetVeiwIe").style.display='Block';
									     document.getElementById("Six").style.display='none';
									      timeout_id=setTimeout("closedive()",100); 
									   								     
									   }
									   else
									   {
									   document.getElementById("Six").style.display='Block';
									  document.getElementById("StreetVeiwIe").style.display='none';
									  
									   
								   
}

 }
  document.getElementById(d).style.display = "block"; 
 }
function showmap() {
	DisplayDIV("pop_up");
	document.getElementById("chkAreas").disabled = true;
	var hiddenareas = document.getElementById("txtAreas");
	var chkbxs = document.getElementById("area").getElementsByTagName("input");
	hiddenareas.value = "";
	for(var i=0;i<chkbxs.length;i++)
	{
		chkbxs[i].checked=false;
	}
	if(hiddenareas.value == "") { hiddenareas.value = "Select" }
	document.getElementById("hdnAreas").value = hiddenareas.value;
	document.getElementById("linkAreas").style.textDecoration = "none";
	document.getElementById("linkAreas").style.color = "#333333";
	document.getElementById("linkAreas").style.cursor = "default";
}

function setCats() {
	var hiddencats = document.getElementById("txtCats");
	var chkbxs = document.getElementById("cat").getElementsByTagName("input");
	hiddencats.value = "";
	for(var i=0;i<chkbxs.length;i++)
	{
		if(chkbxs[i].checked==true) { hiddencats.value += chkbxs[i].title + ";"; }
	}
	if(hiddencats.value == "") { hiddencats.value = "Select" }
	document.getElementById("hdnCats").value = hiddencats.value;
}

function setAreas(areaname) {
	var hiddenareas = document.getElementById("txtAreas");
	var chkbxs = document.getElementById("area").getElementsByTagName("input");
	hiddenareas.value = "";
	for(var i=0;i<chkbxs.length;i++)
	{
		if(chkbxs[i].checked==true) { hiddenareas.value += chkbxs[i].title + ";"; }
	}
	if(hiddenareas.value == "") { hiddenareas.value = "Select" }
	document.getElementById("hdnAreas").value = hiddenareas.value;
}

function setTenure() {
	var hiddentenure = document.getElementById("txtTenure");
	var chkbxs = document.getElementById("tenure").getElementsByTagName("input");
	hiddentenure.value = "";
	for(var i=0;i<chkbxs.length;i++)
	{
		if(chkbxs[i].checked==true) { hiddentenure.value += chkbxs[i].title + ";"; }
	}
	if(hiddentenure.value == "") { hiddentenure.value = "Select" }
	document.getElementById("hdnTenure").value = hiddentenure.value;
}

function setValues() {
	try {
	var chkbxs = document.getElementById("cat").getElementsByTagName("input");
	var cats = document.getElementById("hdnCats").value;
	//if(cats && cats != "All") {
		for(var i=0;i<chkbxs.length;i++) {
			if(chkbxs[i].type == "checkbox" && cats.match(chkbxs[i].title)) { chkbxs[i].checked = true; }
		}
	//}
	
	chkbxs = document.getElementById("area").getElementsByTagName("input");
	var areas = document.getElementById("hdnAreas").value;
	//if(areas && areas != "All") {
		for(var i=0;i<chkbxs.length;i++) {
			if(chkbxs[i].type == "checkbox" && areas.match(chkbxs[i].title)) { chkbxs[i].checked = true; }
		}
	//}
	
	chkbxs = document.getElementById("tenure").getElementsByTagName("input");
	var tenure = document.getElementById("hdnTenure").value;
	//if(tenure && tenure != "All") {
		for(var i=0;i<chkbxs.length;i++) {
			if(chkbxs[i].type == "checkbox" && tenure.match(chkbxs[i].title)) { chkbxs[i].checked = true; }
		}
	//}
	setCatsSelection();
	setAreasSelection();
	setTenureSelection();
	}
	catch(e) { }
}

function setCatsSelection() {
	var alink = document.getElementById("linkCats");
	if(document.getElementById("chkCategories").checked==true) {
		alink.style.textDecoration='none';
		alink.style.cursor="default";
		alink.style.color="#333333";
	}
	else {
		alink.style.textDecoration='underline';
		alink.style.cursor="pointer";
		alink.style.color="#333333";
	}
}

function setAreasSelection() {
	var alink = document.getElementById("linkAreas");
	if(document.getElementById("chkAreas").checked==true) {
		alink.style.textDecoration='none';
		alink.style.cursor="default";
		alink.style.color="#ffffff";
	}
	else {
		alink.style.textDecoration='underline';
		alink.style.cursor="pointer";
		alink.style.color="#ffffff";
	}
}

function setTenureSelection() {
	var alink = document.getElementById("linkTenure");
	if(document.getElementById("chkTenure").checked==true) {
		alink.style.textDecoration='none';
		alink.style.cursor="default";
		alink.style.color="#ffffff";
	}
	else {
		alink.style.textDecoration='underline';
		alink.style.cursor="pointer";
		alink.style.color="#FFFF00";
	}
}

function validateSearch() {
	var cats = document.getElementById("txtCats").value;
	if(cats == "" || cats == "Select" && (document.getElementById("chkCategories").checked == false)) {
		alert("Please select a category first.");
		return;
	}
	
	var areas = document.getElementById("txtAreas").value;
	if(areas == "" || areas == "Select" && (document.getElementById("chkAreas").checked == false)) {
		alert("Please select an area first.");
		return;
	}
	
	var tenure = document.getElementById("txtCats").value;
	if(tenure == "" || tenure == "Select" && (document.getElementById("chkTenuers").checked == false)) {
		alert("Please select a tenure first.");
		return;
	}
	
	document.getElementById("lnkSearch").click();
}

function setReqCats() {
	var hiddenareas = document.getElementById("txtReqCategories");
	var chkbxs = document.getElementById("reqcats").getElementsByTagName("input");
	hiddenareas.value = "";
	for(var i=0;i<chkbxs.length;i++)
	{
		if(chkbxs[i].checked==true) { hiddenareas.value += chkbxs[i].title + ";"; }
	}
	if(hiddenareas.value == "") { hiddenareas.value = "Select" }
	document.getElementById("hdnReqCategories").value = hiddenareas.value;
}

function setReqAreas() {
	var hiddenareas = document.getElementById("txtReqAreas");
	var chkbxs = document.getElementById("reqarea").getElementsByTagName("input");
	hiddenareas.value = "";
	for(var i=0;i<chkbxs.length;i++)
	{
		if(chkbxs[i].checked==true) { hiddenareas.value += chkbxs[i].title + ";"; }
	}
	if(hiddenareas.value == "") { hiddenareas.value = "Select" }
	document.getElementById("hdnReqAreas").value = hiddenareas.value;
}

function setReqCategoriesSelection() {
	var alink = document.getElementById("linkReqCategories");
	if(document.getElementById("chkReqCategories").checked==true) {
	alink.style.textDecoration='none';
		alink.style.cursor="default";
		alink.style.color="#333333";
	}
	else {
		alink.style.textDecoration='underline';
		alink.style.cursor="pointer";
		alink.style.color="#333333";
	}
}

function setReqAreasSelection() {
	var alink = document.getElementById("linkReqAreas");
	if(document.getElementById("chkReqAreas").checked==true) {
	alink.style.textDecoration='none';
		alink.style.cursor="default";
		alink.style.color="#333333";
	}
	else {
		alink.style.textDecoration='underline';
		alink.style.cursor="pointer";
		alink.style.color="#333333";
	}
}

function setReqValues() {
	try{
	var chkbxs1 = document.getElementById("reqcats").getElementsByTagName("input");
	var cats = document.getElementById("hdnReqCategories").value;
	//if(areas && areas != "All") {
		for(var i=0;i<chkbxs1.length;i++) {
			if(chkbxs1[i].type == "checkbox" && cats.match(chkbxs1[i].title)) { chkbxs1[i].checked = true; }
		}
	//}
	
	var chkbxs = document.getElementById("reqarea").getElementsByTagName("input");
	var areas = document.getElementById("hdnReqAreas").value;
	//if(areas && areas != "All") {
		for(var i=0;i<chkbxs.length;i++) {
			if(chkbxs[i].type == "checkbox" && areas.match(chkbxs[i].title)) { chkbxs[i].checked = true; }
		}
	//}
	setReqCategoriesSelection();
	setReqAreasSelection();
	}
	catch(e) {}
}

function selectArea(areaname) {
	var hiddenareas = document.getElementById("txtAreas");
	var chkbxs = document.getElementById("area").getElementsByTagName("input");
	hiddenareas.value = "";
	for(var i=0;i<chkbxs.length;i++)
	{
		if(chkbxs[i].title==areaname) { chkbxs[i].checked = true; }
		if(chkbxs[i].checked==true) { hiddenareas.value += chkbxs[i].title + ";"; }
	}
	document.getElementById("hdnAreas").value = hiddenareas.value;
	if(hiddenareas.value == "") { hiddenareas.value = "Select" }
}

function unSelectArea(areaname) {
	var hiddenareas = document.getElementById("txtAreas");
	var chkbxs = document.getElementById("area").getElementsByTagName("input");
	hiddenareas.value = "";
	for(var i=0;i<chkbxs.length;i++)
	{
		if(chkbxs[i].title==areaname) { chkbxs[i].checked = false; }
		if(chkbxs[i].checked==true) { hiddenareas.value += chkbxs[i].title + ";"; }
	}
	document.getElementById("hdnAreas").value = hiddenareas.value;
	if(hiddenareas.value == "") { hiddenareas.value = "Select" }
}

function hideMapDiv() {
	document.getElementById('pop_up').style.display='none';
	document.getElementById("chkAreas").disabled = false;
	setAreasSelection();
}

function setImage(obj) {
	try{
		var img = new Image();
		img.src = obj.src;
		if(img.height > img.width) {
			obj.height = img.height > 160? 160:img.height;
			var width = obj.height * (img.width/img.height);
			obj.width = width > 222 ? 222:width;
		}
		else {
			obj.width = img.width > 222? 222:img.width;
			var height = obj.width * (img.height/img.width);
			obj.height = height > 160 ? 160:height;
		}
	}
	catch(e) { obj.src = "images/image.jpg"; }
}

function setListingsImage(obj) {
	var img = new Image();
	img.src = obj.src;
	if(img.height > img.width) {
		obj.height = img.height > 141? 141:img.height;
		var width = obj.height * (img.width/img.height);
		obj.width = width > 188 ? 188:width;
	}
	else {
		obj.width = img.width > 188? 188:img.width;
		var height = obj.width * (img.height/img.width);
		obj.height = height > 141 ? 141:height;
	}
}

function setListingsImage2(obj) {
	var img = new Image();
	img.src = obj.src;
	if(img.height > img.width) {
		obj.height = 188;
		var width = (188 * img.width)/img.height;
		width = width > 188 ? 188:width;			
		obj.width= (width > 0 ? width : 188) ;	
	}
	else {
		obj.width = 188;
		var height = obj.width * (img.height/img.width);
		obj.height = height > 188 ? 188:height;
		
		
		obj.width = 188;
		var height =(188 * img.height)/img.width;				
		height = height > 188 ? 188:height;		
		
		obj.height = (height > 0 ? height : 188);
	}
}



function setDetMainImage(obj) 
{
	try
	{	    
        var img = new Image();
		img.src = obj.src;
		
		if(img.height > img.width) 
		{		
			obj.height = 400;
			var width = (400 * img.width)/img.height;
			width = width > 400 ? 400:width;
			obj.width=	(width > 0 ? width : 400);	
		}
		else 
		{		
			obj.width = 400;
			var height = (400 * img.height)/img.width;			
			height = height > 400 ? 400 : height;
			obj.height=(height > 0 ? height : 400);
		}		
	}
	catch(e) { obj.width = 400; obj.height = 400;}
}

function setDetMainImage2(obj) 
{
	try
	{	    
        var img = new Image();
		img.src = obj.src;
		
		if(img.height > img.width) 
		{		
			obj.height = 277;
			var width = (277 * img.width)/img.height;
			width = width > 277 ? 277:width;
			obj.width=	(width > 0 ? width : 277);	
		}
		else 
		{		
			obj.width = 277;
			var height = (277 * img.height)/img.width;			
			height = height > 277 ? 277 : height;
			obj.height=(height > 0 ? height : 277);
		}		
	}
	catch(e) { obj.width = 277; obj.height = 277;}
}

function setDetThumbImage(obj) {
	try{
		var img = new Image();
		img.src = obj.src;
		if(img.height > img.width) {
			 obj.height = 96;
			 var width = (96 * img.width)/img.height;
			 width = width > 96 ? 96:width;			    
			 obj.width=	(width > 0 ? width : 96);		
		}
		else {
			obj.width = 96;
			var height = (96 * img.height)/img.width;
			height = height > 96 ? 96:height;	  
			obj.height= (height > 0 ? height :96);
		}
	}
	catch(e) {}
}


function setDetThumbImage2(obj) {
	var img = new Image();
	img.src = obj.src;
	if(img.height > img.width) {
		obj.height = img.height > 90? 90:img.height;
		var width = obj.height * (img.width/img.height);
		obj.width = width > 90 ? 90:width;
	}
	else {
		obj.width = img.width > 90? 90:img.width;
		var height = obj.width * (img.height/img.width);
		obj.height = height > 90 ? 90:height;
	}
}



document.write('');
document.write('');
document.write('');
document.write('');
document.write('');
document.write('');
document.write('');
document.write('');

document.write('');
document.write('');
