// JavaScript Document
function check_email(form) {
	// check format of email address
	if (parseInt(form.email.value.length,10) > 0) {
		var emailpat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
		var testString = form.email.value;
		if (!emailpat.test(testString)) {
			return false;
		}
	} else {
		return false;
	}
	return true;
}

function popup(html_file,x,y,windowname) {
	option_params = 'width='+x+',height='+y+',menubar=no,toolbar=no,status=yes,resizable=yes,personalbar=no,location=no,directories=no,scrollbars=yes';
	pop=window.open(html_file,windowname,option_params);
}

// This will remove the helper input text
function handleInput(inputID,helpText) {
	
	if($(inputID).value == helpText) {
		$(inputID).value="";
		$(inputID).focus();
	} 
}
// This will restore the helper input text if the field is left blank
function restoreInput(inputID,helpText) {
	if($(inputID).value == '') {
		$(inputID).value=helpText;
	}
}

// Use this function to share the current page on facebook
function fbs_click() {
	u=location.href;t=document.title; 
	window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
	return false;
}
// Launch links in a new window and still be valid XHTML 1.0 Strict
function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if ((anchor.getAttribute("href")) && (anchor.getAttribute("rel") == "external")) {
			anchor.target = "_blank";
		}
	}
}

//onload events go in here
window.addEvent('domready', function() {
									 
	new SmoothScroll({ duration: 1000 });

	externalLinks()
	
	var other_links_panel = '';
	
	if($('other_links_panel')){
		other_links_panel = new Fx.SlidePlus($('other_links_holder'), $('other_links_panel_heading'));
		if (home && home == "yes") {
			other_links_panel.hide();
		}
	}
	
});

function realestate_installCascadingMenu(navId)
{
		if (document.getElementById(navId))
        mbSet(navId, 'mb');
}
