// JavaScript Document
/* Code to Disable right click on images */

/*
Disable right click script II (on images)- By Dynamicdrive.com
For full source, Terms of service, and 100s DTHML scripts
Visit http://www.dynamicdrive.com


var clickmessage="Right click disabled on images!"

function disableclick(e) {
if (document.all) {
if (event.button==2||event.button==3) {
if (event.srcElement.tagName=="IMG"){
alert(clickmessage);
return false;
}
}
}
else if (document.layers) {
if (e.which == 3) {
alert(clickmessage);
return false;
}
}
else if (document.getElementById){
if (e.which==3&&e.target.tagName=="IMG"){
alert(clickmessage)
return false
}
}
}

function associateimages(){
for(i=0;i<document.images.length;i++)
document.images[i].onmousedown=disableclick;
}

if (document.all)
document.onmousedown=disableclick
else if (document.getElementById)
document.onmouseup=disableclick
else if (document.layers)
associateimages()
 Disable right click code end*/
 
 /*------------------------------------*/
var isNS = (navigator.appName == "Netscape") ? 1 : 0;
if(navigator.appName == "Netscape") document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP);
  function mischandler(){
   return false;
 }
function mousehandler(e){
  var myevent = (isNS) ? e : event;
  var eventbutton = (isNS) ? myevent.which : myevent.button;
    if((eventbutton==2)||(eventbutton==3)) return false;
 }
 document.oncontextmenu = mischandler;
 document.onmousedown = mousehandler;
 document.onmouseup = mousehandler;
 
 /*-----------------------------------*/

function validateLogin()
{
	form = document.login;
	if(trim(form.admin_name.value)=="")
	{
		alert("Please Enter Login Name");
		form.admin_name.value='';
		form.admin_name.focus();
		return false;
		}
	if(trim(form.admin_password.value)=="")
	{
		alert("Please Enter Password");
		form.admin_password.value='';
		form.admin_password.focus();
		return false;
		}	
	form.action = "db_login.php";
	form.submit();
	return true;
	}
	
function validateHomeManager(val)
{
	form = document.frm_homeManager;
	/*if(trim(form.location.value)=="")
	{
		alert("Please Enter Location");
		form.location.focus();
		return false;
		}
	if(isFloat(form.price.value)=="")
	{
		alert("Please Enter Price");
		form.price.focus();
		return false;
		}*/
		if(val=='add'){
	if(trim(form.image.value)=="")
	{
		alert("Please Upload Image");
		form.image.focus();
		return false;
		}
		}
	form.action = "db_homeManager.php";
	form.submit();
	BarUpdate();
	return true;
	}
	
function validateFloorPlanManager(val)
{
	form = document.frm_floorPlanManager;
	if(trim(form.plan_name.value)=="")
	{
		alert("Please Enter Plan Name");
		form.plan_name.focus();
		return false;
		}
	
		if(val=='add'){
	if(trim(form.elevation_img.value)=="")
	{
		alert("Please Upload Main Floor Plan");
		form.elevation_img.focus();
		return false;
		}
		}
	form.action = "db_floorPlanManager.php";
	form.submit();
	BarUpdate();
	return true;
	}


function validateAccountInformation()
{
	form = document.frm_accountInformation;
	if(trim(form.admin_email.value)=="")
	{
		alert("Please Enter E-mail");
		form.admin_email.focus();
		return false;
		}
	else if(checkEmailAddress(form.admin_email.value)=="")
	{
		alert("Please Enter Valid E-mail");
		form.admin_email.focus();
		return false;
		}	
	
	form.action = "db_accountInformation.php";
	form.submit();
	return true;
	
	}

	
function validateChangePassword()
{
	form = document.changepassword;
	if(trim(form.oldPass.value)=='')
	{
		alert("Please Enter Old Password");
		form.oldPass.focus();
		return false;
		}
	if(trim(form.newPass.value)=='')
	{
		alert("Please Enter New Password");
		form.newPass.focus();
		return false;
		}	
	if(trim(form.cNewPass.value)=='')
	{
		alert("Please Enter Confirm Password");
		form.cNewPass.focus();
		return false;
		}	
	if(form.newPass.value!=form.cNewPass.value)
	{
		alert("New Password and Confirm Password are not matched ");
		form.cNewPass.focus()
		return false;
		}
	form.action = "db_changePassword.php";
	form.submit();
	return true;
	}

function validateFloorInner()
{
	form = document.frm_floor_inner; 
	if(trim(form.image1.value)=='')
	{
		alert("Please Upload Image");
		form.image1.focus();
		return false;
		}
	form.action = "db_floorPlanManager.php" ;
	form.submit()
	return true;
}

function validateAvailable(a_id1){
	form = document.frm_youth; 
	if(trim(form.title.value)=='') {
		alert("Please Enter Community Title");
		form.title.focus();
		return false;
	}
	form.action ="db_available.php?a_id="+a_id1;
	form.submit();
	BarUpdate();
	return true;
}

function validate_custom_homes_communities(a_id1){
	form = document.custom_communities; 
	if(trim(form.title.value)=='') {
		alert("Please Enter Community Title");
		form.title.focus();
		return false;
	}
	form.action ="db_custom_homes_communities.php?a_id="+a_id1;
	form.submit();
	BarUpdate();
	return true;
}
	