function resizeLeft() {
	//alert($('content').offsetHeight + "<" + $('right').offsetHeight);
	if($('content').offsetHeight < $('right').offsetHeight) {
		$('content').style.height = $('right').offsetHeight + "px";
	}
}

function resizeSearch() {
	msg = "Content: " + $('content').offsetHeight + "\n";
	msg += "Left: " + $('left').offsetHeight + "\n";
	msg += "Right: " + $('right').offsetHeight + "\n";
	msg += "searchContainer: " + $('searchContainer').offsetHeight + "\n";


	
	alert(msg);
}

function validate_wp(frm) {
	var errors = 0;
	Element.hide("firstError");
	Element.hide("lastError");
	Element.hide("emailError");
	Element.hide("emailValError");
	
	$("first_name").style.backgroundColor = "#ffffff";
	$("last_name").style.backgroundColor = "#ffffff";
	$("email").style.backgroundColor = "#ffffff";

	var errorMsg = "";
	if($('first_name').value=='') {
		new Effect.Highlight('first_name',{startcolor: "#ffffff",endcolor: "#ffff99",restorecolor: "#ffff99"});
		errors = 1;
		Element.show("firstError");
	}
	if($('last_name').value=='') {
		new Effect.Highlight('last_name',{startcolor: "#ffffff",endcolor: "#ffff99",restorecolor: "#ffff99"});
		errors = 1;
		Element.show("lastError");
	}
	if($('email').value=='') {
		new Effect.Highlight('email',{startcolor: "#ffffff",endcolor: "#ffff99",restorecolor: "#ffff99"});
		errors = 1;
		Element.show("emailError");
	}
	else {
		if(!checkEmail($('email').value)) {
			errors = 1;
			new Effect.Highlight('email',{startcolor: "#ffffff",endcolor: "#ffff99",restorecolor: "#ffff99"});
			Element.show("emailValError");
		}
	}
	
	if(errors==0) {
		return true;
	}
	else {
		new Effect.Shake(frm);
		return false;
	}
}

function extranetSubmit(frm) {
	var errors = 0;
	
	$("extraName").style.backgroundColor = "#ffffff";
	$("extraPass").style.backgroundColor = "#ffffff";
	
	
	if($('extraName').value=="") {
		Element.show("userNameError");
		new Effect.Highlight('extraName',{startcolor: "#ffffff",endcolor: "#ffff99",restorecolor: "#ffff99"});
	}
	if($('extraPass').value=="") {
		Element.show("passError");
		new Effect.Highlight('extraPass',{startcolor: "#ffffff",endcolor: "#ffff99",restorecolor: "#ffff99"});
	}
	if($('extraPass').value!="" && $('extraName').value!="") {
		new Effect.Shake(frm);
		$('extraPass').value="";
		$('extraPass').focus();
		Element.show("badLoginError");
		
	}
	return false;
}

function validate_demo(frm) {
	var errors = 0;
	Element.hide("firstError");
	Element.hide("lastError");
	Element.hide("emailError");
	Element.hide("emailValError");
	
	$("first_name").style.backgroundColor = "#ffffff";
	$("last_name").style.backgroundColor = "#ffffff";
	$("email").style.backgroundColor = "#ffffff";

	var errorMsg = "";
	if($('first_name').value=='') {
		new Effect.Highlight('first_name',{startcolor: "#ffffff",endcolor: "#ffff99",restorecolor: "#ffff99"});
		errors = 1;
		Element.show("firstError");
	}
	if($('last_name').value=='') {
		new Effect.Highlight('last_name',{startcolor: "#ffffff",endcolor: "#ffff99",restorecolor: "#ffff99"});
		errors = 1;
		Element.show("lastError");
	}
	if($('email').value=='') {
		new Effect.Highlight('email',{startcolor: "#ffffff",endcolor: "#ffff99",restorecolor: "#ffff99"});
		errors = 1;
		Element.show("emailError");
	}
	else {
		if(!checkEmail($('email').value)) {
			errors = 1;
			new Effect.Highlight('email',{startcolor: "#ffffff",endcolor: "#ffff99",restorecolor: "#ffff99"});
			Element.show("emailValError");
		}
	}
	
	if(errors==0) {
		return true;
	}
	else {
		
		return false;
	}
}

function checkEmail(str) {
	    var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    return false
		 }

 		 return true
}