function openmap() {
	newWindow = window.open('showmap.php','mapwin','toolbar=no,scrollbars=no,height=365,width=540,top=5,left=25');
	newWindow.focus();
}

function showdisclaimer() {
	newWindow = window.open('disclaimer.php','disclaimerwin','toolbar=no,scrollbars=yes,height=600,width=650,top=5,left=25');
	newWindow.focus();
}

function showinterestedinbuilding(id) {
	newWindow = window.open('interested_in_building.php?id='+id,'interestedwin','toolbar=yes,scrollbars=yes,height=500,width=750,top=5,left=25');
	newWindow.focus();
}

function showcontactform() {
	newWindow = window.open('contact_form.php?submit=','contactformwin','toolbar=no,scrollbars=no,height=350,width=400,top=5,left=25');
	newWindow.focus();
}

function showconsultform(req_type, req_id, bldg_id) {
	newWindow = window.open('consult_form.php?req_type=' + req_type + '&req_id=' + escape(req_id) + '&building_id=' + escape(bldg_id),'consultformwin','toolbar=no,scrollbars=yes,height=475,width=650,top=5,left=25');
	newWindow.focus();
}

function showconsultform2(req_type, req_id, bldg_id) {
	newWindow = window.open('consult_form.php?req_type=' + req_type + '&req_id=' + escape(req_id) + '&building_id=' + escape(bldg_id) + '&user=2','consultformwin','toolbar=no,scrollbars=yes,height=475,width=650,top=5,left=25');
	newWindow.focus();
}

function showfriendform(req_type, req_id) {
	newWindow = window.open('friend_form.php?req_type=' + req_type + '&req_id=' + escape(req_id),'friendformwin','toolbar=no,scrollbars=yes,height=475,width=650,top=5,left=25');
	newWindow.focus();
}

function showmortgagecalc(imagefile) {
	newWindow = window.open('mortgage_calc.php','mortgagewin','toolbar=no,scrollbars=no,height=200,width=300,top=5,left=25');
	newWindow.focus();
}

function gobuilding(dropdown) {
	var myindex  = dropdown.selectedIndex;
	var SelValue = dropdown.options[myindex].value;
	var baseURL  = "display_condo.php?id=" + SelValue;
	if (SelValue > 0) {
		top.location.href = baseURL;
	}
	return true;
}

function goarea(dropdown) {
	var myindex  = dropdown.selectedIndex;
	var SelValue = dropdown.options[myindex].value;
	var baseURL  = "find_subarea.php?area=" + SelValue;
	top.location.href = baseURL;
	return true;
}

function gosubarea(dropdown) {
	var myindex  = dropdown.selectedIndex;
	var SelValue = dropdown.options[myindex].value;
    var baseURL  = "find_building.php?sub_area=" + SelValue;
	top.location.href = baseURL;
	return true;
}

function toggle(obj) {
	var el = document.getElementById(obj);
	el.style.display = (el.style.display != 'none' ? 'none' : 'block' );
}

function toggleRow(obj) {
	var el = document.getElementById(obj);
	// Note: do not use 'block' here as it causes table layout issues in FF when colspan attribute is set on the td elements
	el.style.display = (el.style.display != 'none' ? 'none' : '' );
}

function NewWindow(mypage,myname,w,h,scroll){
	var winl = (screen.width-w)/2;
	var wint = (screen.height-h)/2;
	var settings ='height='+h+',';
	settings +='width='+w+',';
	settings +='top='+wint+',';
	settings +='left='+winl+',';
	settings +='scrollbars='+scroll+',';
	settings +='resizable=no';
	win=window.open(mypage,myname,settings);
	if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}

function MM_openBrWindow(theURL,winName,features) {
	window.open(theURL,winName,features);
}

function updateimage(image_id, imagefile) {
	document.images[image_id].src = imagefile;
}

function mpitems( intWhich ) {
	for(i=1;i<3;i++) {
		if(i==intWhich) {
			document.getElementById('mpitems' + i).style.display = 'block';
			document.getElementById('mpitems' + i + '_link').className = ('mpitems' + i + '_current');
		}
		else {
			document.getElementById('mpitems' + i).style.display = 'none';
			document.getElementById('mpitems' + i + '_link').className = ('mpitems' + i);
		}
	}
	//$('cnnMpStoriesTab'+ intWhich).blur();
}

function checkAll(checkname, exby) {
  for (i = 0; i < checkname.length; i++)
  checkname[i].checked = exby.checked? true:false
}

function display_gallery(id, gallery_type) {
//	var url = '/display_gallery.php?item_type='+gallery_type+'&id='+id;
//	var objLink = document.createElement('a');
//	objLink.setAttribute('href',url);
//	objLink.setAttribute('rel','floatbox');
//	objLink.setAttribute('rev','width:720 height:540 scrolling:no');
//	fb.start(objLink);
	fb.start(document.getElementById('start_gallery'));
}

function checkEmail(myForm) {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myForm.emailAddr.value)){
return (true)
}
alert("Invalid E-mail Address. Please re-enter.")
return (false)
}