function checkuploadform()
{
	if ( ( upload_process_form.ad_position[0].checked == false ) && ( upload_process_form.ad_position[1].checked == false ) && ( upload_process_form.ad_position[2].checked == false )  && ( upload_process_form.ad_position[3].checked == false ) && ( upload_process_form.ad_position[4].checked == false ) ) { alert ( "Please select your Banner Location!" ); return false; }
	
	if (!document.upload_process_form.full_name.value)
	{	alert('Error! Please input your Full Name.');
		document.upload_process_form.full_name.focus();
		return false; }
	
	if (!document.upload_process_form.email.value)
	{	alert('Error! Please input your Email Address.');
		document.upload_process_form.email.focus();
		return false; }
	
	
	if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(upload_process_form.email.value))
	{
		alert("Invalid E-mail Address! Please re-enter.")
		document.upload_process_form.email.focus();
		return false;
	}
	
	if (!document.upload_process_form.banner_title.value)
	{	alert('Error! Please input Banner Title.');
		document.upload_process_form.banner_title.focus();
		return false; }
		
	if (!document.upload_process_form.banner_link.value)
	{	alert('Error! Please input Banner Link.');
		document.upload_process_form.banner_link.focus();
		return false; }
	
	

   if(document.upload_process_form.banner_link.value!="")
   {
   if (document.upload_process_form.banner_link.value.indexOf ('www', 0) == -1 || document.upload_process_form.banner_link.value.length < 10)
   {
   	if(document.upload_process_form.banner_link.value.indexOf ('.com', 0) == -1 || document.upload_process_form.banner_link.value.length < 10) 
   {
   alert ("Enter a valid Website URL")
   document.upload_process_form.banner_link.focus();
   return false;
   }
   }
   }



	if(!document.upload_process_form.upload_banner.value)
	{
		//Check Type of Image
		if(!/(\.jpg|\.gif|\.bmp|\.png|\.jpeg)$/i.test(document.upload_process_form.upload_banner.value))
		{
				alert("Error! Banner Image File must be .bmp, .jpg, .gif, .png, .jpeg File format.");
				document.upload_process_form.upload_banner.focus();
				return false;
		}
	}
	
	
	if (document.upload_process_form.scode.value!=document.upload_process_form.securityCode.value)
	{	alert('Error! Input Correct security code to prevent Automated submissions.');
		document.upload_process_form.securityCode.focus();
		return false; }
	
	
	if (!document.upload_process_form.terms.checked){ 
		alert('Error! Please Check if you are agree terms and conditions of Buzzspider.com?.');
		return false; }
		
}

function check_enquiry_form()
{
	
	
	
	if (document.enquiries_form.referred_by_id.selectedIndex == 0)
	{   alert('Error! Please select Referred by.');
		document.enquiries_form.referred_by_id.focus();
		return false; 
		}
		
	if (document.enquiries_form.enquiry_type1.selectedIndex == 0)
	{   alert('Error! Please select Enquiry type.');
		document.enquiries_form.enquiry_type1.focus();
		return false; 
		}
		
	if (document.enquiries_form.enquiry_type1.selectedIndex == 0)
	{   alert('Error! Please select Enquiry type.');
		document.enquiries_form.enquiry_type1.focus();
		return false; 
		}
		
	if (!document.enquiries_form.enquiry_date1.value)
	{	alert('Error! Enquiry date is missing.');
		document.enquiries_form.enquiry_date1.focus();
		return false; }
	
	if (!document.enquiries_form.enquiry_time1.value)
	{	alert('Error! Please input Enquiry time.');
		document.enquiries_form.enquiry_time1.focus();
		return false; }
	
	if (!document.enquiries_form.enquiry_detail.value)
	{	alert('Error! Please input Enquiry Detail.');
		document.enquiries_form.enquiry_detail.focus();
		return false; }
		
	if (!document.enquiries_form.enquiry_status1.value)
	{	alert('Error! Please input Enquiry Status.');
		document.enquiries_form.enquiry_status1.focus();
		return false; }

	return true;	
}

function checkAddEmail()
{		
	if (document.addNewEmail.group_name.selectedIndex == 0)
	{	alert('Error! Please select Email Group.');
		document.addNewEmail.group_name.focus();
		return false; 
		}
	
	if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(addNewEmail.emailAddress.value))
	{
		alert("Invalid E-mail Address! Please re-enter.")
		document.addNewEmail.emailAddress.focus();
		return false;
	}
}

function checkImage()
{	
		if (!document.uploadImage.image_title.value)
		{
			alert('Error! Image Title is missing.');
			document.uploadImage.image_title.focus();
			return false; }
		
	if(document.uploadImage.image_name.value)
	{
		//Check Type of Image
		if(!/(\.jpg|\.gif|\.bmp|\.png|\.jpeg)$/i.test(document.uploadImage.image_name.value))
		{
				alert("Error! Property Image File must be .jpg, .gif, .png, .jpeg File format.");
				document.uploadImage.image_name.focus();
				return false;
		}
	}
}

function checkNewsletterForm()
{
	var answer = confirm("Are you sure you want to complete this process?")
	if (answer)
	{
		return true;
	}//end of IF Answer	
	else return false
}

function checkconfirmdelete()
{
	var answer = confirm("Are you sure you want to delete this record?")
	if (answer)
	{
		return true;
	}//end of IF Answer	
	else return false
}

function emailListForm()
{
	if (!document.emaillistform.groupName.value)
	{	alert('Error! Group Name is missing.');
		document.emaillistform.groupName.focus();
		return false; }
}

function checkcomposemessage()
{
	if (!document.composeMessage.templateTitle.value)
	{	alert('Error! Message/Template Title is missing.');
		document.composeMessage.templateTitle.focus();
		return false; }
}

function checkEmailConfigurationForm()
{
	if (!document.updateConfiguration.FromName.value)
	{	alert('Error! From Name is missing.');
		document.updateConfiguration.FromName.focus();
		return false; }
	
	if (!document.updateConfiguration.FromEmail.value)
	{	alert('Error! From Email Address is missing.');
		document.updateConfiguration.FromEmail.focus();
		return false; }
	
	if (!document.updateConfiguration.FromSubject.value)
	{	alert('Error! From Subject is missing.');
		document.updateConfiguration.FromSubject.focus();
		return false; }
		
	return true;
}

function checkServerConfigurationForm()
{
	if (!document.updateConfiguration.BatchInterval.value)
	{	alert('Error! Batch Interval is missing.');
		document.updateConfiguration.BatchInterval.focus();
		return false; }
	
	if (!document.updateConfiguration.smtp_server.value)
	{	alert('Error! SMTP Server is missing.');
		document.updateConfiguration.smtp_server.focus();
		return false; }
	
	if (!document.updateConfiguration.smtp_user.value)
	{	alert('Error! SMTP User Name is missing.');
		document.updateConfiguration.smtp_user.focus();
		return false; }
	
	if (!document.updateConfiguration.smtp_password.value)
	{	alert('Error! SMTP Password is missing.');
		document.updateConfiguration.smtp_password.focus();
		return false; }
		
	return true;
}


// JavaScript Document
function vfEditUser()
{
	emailFields = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
	
	if (document.editUserFrm.domain_id.selectedIndex == 0)
	{	alert('Please Select Domain URL.');
		document.editUserFrm.domain_id.focus();
		return false; }
	
	if (!document.editUserFrm.FullName.value)
	{	alert('Please enter Your Full Name.');
		document.editUserFrm.FullName.focus();
		return false; }
		
	if (document.editUserFrm.chkRole.selectedIndex == 0)
	{	alert('Please Select User Role.');
		document.editUserFrm.chkRole.focus();
		return false; }
		
		if (document.editUserFrm.Email.value != '')
	{	
	
		if (document.editUserFrm.Email.value.search(emailFields) != 0)
	{
	alert("Invalid E-mail Address! Please re-enter.");
	document.editUserFrm.Email.focus();
	return false;
	}
	}
		
	return true;
}

function vfUser()
{
	
	if (!document.addUserFrm.userName.value)
	{	alert('Please enter User Name.');
		document.addUserFrm.userName.focus();
		return false; }
		
		if (!document.addUserFrm.firstname.value)
	{	alert('Please enter ur Full Name.');
		document.addUserFrm.firstname.focus();
		return false; }
	
		if (!document.addUserFrm.password.value)
	{	alert('Enter your Password.');
		document.addUserFrm.password.focus();
		return false; }
		if (!document.addUserFrm.confirmation.value)
	{	alert('Enter confirmation Password.');
		document.addUserFrm.confirmation.focus();
		return false; }
		
		if (document.addUserFrm.password.value != document.addUserFrm.confirmation.value)
	{	alert('Wrong Confirm Password.');
		document.addUserFrm.confirmation.focus();
		return false; }
		
		if (document.addUserFrm.chkRole.selectedIndex == 0)
	{	alert('Please Select User Role.');
		document.addUserFrm.chkRole.focus();
		return false; }
		
	return true;
}

//numeric validation format this function will check only without comman
/*function IsNumeric(strString)
{
	//var x=document.checknum.pnum.value
	var anum=/(^\d+$)|(^\d+\.\d+$)/
		if (anum.test(strString))
		testresult=true
		else{		
		testresult=false
		}
	return (testresult)
}*/

function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
}


 
 //Check Excel File is .csv type 
 function checkImportFile()
 {
	 
	if (document.importFile.group_name.selectedIndex == 0)
	{	alert('Please select Email List / Group Name.');
		document.importFile.group_name.focus();
		return false; }

	if(!document.importFile.importfile.value)
	{
		alert("Error! Please upload file [.csv] format");
		document.importFile.importfile.focus();
		return false;
	}

	 //For Main Image
	if(document.importFile.importfile.value)
	{
		if(!/(\.csv)$/i.test(document.importFile.importfile.value))
		{
			alert("Error! Invalid File. File type should be .csv");
			document.importFile.importfile.focus();
			return false;
		}
	}
}
 
function showNewClient()
{
	newclient.style.display="block";
	}
	
function hidemetadiv()
{
	metaDiv.style.display = "none";
}  

function showPlainTextDiv()
{
	showPlainText.style.display = "block";
}

function showuploadImageDiv()
{
	uploadImageDiv.style.display = "block";
	DefaultImageDiv.style.display = "none";
}  

function showDefaultImageDiv()
{
	uploadImageDiv.style.display = "none";
	DefaultImageDiv.style.display = "block";
}


function inputSecurityCode()
{
	var n = prompt("Input Security Code!", "Type your security code here");
	n = parseInt(n);
	
	if (n == 5698733)
	{
	   return true;	   
	   }
	else if (n==7335277)
	{
		return true;
	}
	else
	{
	   alert('Error! Security Information is wrong!');    
	   return false;
	}
}

function checkEmails()
{
	if (!CheckValidEmail(document.ForgetPasswordForm.EmailAddress.value))	{	
		document.ForgetPasswordForm.EmailAddress.focus();
		return false; }
		
		//CheckValidEmail();
}


function CheckValidEmail(str)
{
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Error! Please Input Valid Email Address.")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Error! Please Input Valid Email Address.")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Error! Please Input Valid Email Address.")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Error! Please Input Valid Email Address.")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Error! Please Input Valid Email Address.")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Error! Please Input Valid Email Address.")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Error! Please Input Valid Email Address.")
		    return false
		 }

 		 return true					
}

function emailListForm()
{
	if (!document.linksCategoryForm.catName.value)
	{	alert('Error! Links Category Name is missing.');
		 document.linksCategoryForm.catName.focus();
		 return false; }
}


function checkAddLink()
{
		
	if (document.addNewLink.linkscat_name.selectedIndex == 0)
	{	alert('Error! Please select Category.');
		document.addNewLink.linkscat_name.focus();
		return false; 
		}
	
	if (!document.addNewLink.linkTitle.value)
	{	alert('Error! Please Input Link Title.');
		 document.addNewLink.linkTitle.focus();
		 return false; }
	
	if (!document.addNewLink.linkURL.value)
	{	alert('Error! Please Input Link URL.');
		 document.addNewLink.linkURL.focus();
		 return false; }
	
	if(!isValidURL(document.addNewLink.linkURL.value))
	{
		alert('Error! Please Input Valid Link URL. e.g. http://www.domain.com/');
		 document.addNewLink.linkURL.focus();
		 return false;
		}
	
	if (!document.addNewLink.linkDetail.value)
	{	alert('Error! Please Input Link Detail.');
		 document.addNewLink.linkDetail.focus();
		 return false; }

}

function checkCommunityForm()
{
	
	if (document.communityForm.country.selectedIndex == 0)
	{	alert('Error! Please select Country.');
		document.communityForm.country.focus();
		return false; }
	
	if (document.communityForm.country_state.selectedIndex == 0)
	{	alert('Error! Please select State.');
		document.communityForm.country_state.focus();
		return false; }
	
	if (!document.communityForm.CommunityName.value)
	{	alert('Error! Please Input Community Name.');
		 document.communityForm.CommunityName.focus();
		 return false; }
	
}


function HideContent(d) {
document.getElementById(d).style.display = "none";
}
function ShowContent(d) {
document.getElementById(d).style.display = "block";
}
function ReverseDisplay(d) {
if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; }
else { document.getElementById(d).style.display = "none"; }
}

function checkclientPersonalForm()
{	
	if (!document.clientPersonalForm.c_name.value)
	{	alert('Error! Please Input Name.');
		document.clientPersonalForm.c_name.focus();
		return false; }
	
	if (!document.clientPersonalForm.c_phone.value)
	{	alert('Error! Please Input Phone #.');
		document.clientPersonalForm.c_phone.focus();
		return false; }
	
	if (!document.clientPersonalForm.c_mobile.value)
	{	alert('Error! Please Input Mobile #.');
		 document.clientPersonalForm.c_mobile.focus();
		 return false; }

	if (document.clientPersonalForm.c_email.value)
	{
		if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(clientPersonalForm.c_email.value))
		{
			alert("Invalid E-mail Address! Please re-enter.")
			document.clientPersonalForm.c_email.focus();
			return false; }
	}
		
	if (document.clientPersonalForm.c_nationality_id.selectedIndex == 0)
	{	alert('Error! Please select Nationality.');
		 document.clientPersonalForm.c_nationality_id.focus();
		 return false; }

	if (document.clientPersonalForm.referred_by_id.selectedIndex == 0)
	{	alert('Error! Please select Referred by.');
		 document.clientPersonalForm.referred_by_id.focus();
		 return false; }
		 
	//for confirmation
	var answer = confirm("Are you sure you want to complete this process?")
	if(answer==true)	
		return true;
	else
		return false;
}


function checklandlordForm()
{
	if (!document.landlordForm.l_name.value)
	{	alert('Error! Please Input Landlord Name.');
		document.landlordForm.l_name.focus();
		return false; }
	
	if (!document.landlordForm.telephone_no.value)
	{	alert('Error! Please Input Landlord Phone #.');
		document.landlordForm.telephone_no.focus();
		return false; }
	
	if (!document.landlordForm.mobile_no.value)
	{	alert('Error! Please Input Landlord Mobile #.');
		 document.landlordForm.mobile_no.focus();
		 return false; }
	
	if (document.landlordForm.referred_by_id.selectedIndex == 0)
	{	alert('Error! Please select Referred by.');
		 document.landlordForm.referred_by_id.focus();
		 return false; }

	if (document.landlordForm.email_address.value)
	{
		if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(landlordForm.email_address.value))
		{
			alert("Invalid E-mail Address! Please re-enter.")
			document.landlordForm.email_address.focus();
			return false; }
	}

	if (document.landlordForm.country_id.selectedIndex == 0)
	{	alert('Error! Please select Nationality.');
		 document.landlordForm.country_id.focus();
		 return false; }

return true;
}

function checkClientform()
{
	if (!document.addClientForm.c_name.value)
	{	alert('Error! Please Input Client Name.');
		document.addClientForm.c_name.focus();
		return false; }
	
	if (!document.addClientForm.c_phone.value)
	{	alert('Error! Please Input Client Phone #.');
		document.addClientForm.c_phone.focus();
		return false; }
	
	if (!document.addClientForm.mobile_no.value)
	{	alert('Error! Please Input Client Mobile #.');
		 document.addClientForm.mobile_no.focus();
		 return false; }
	
	if (document.addClientForm.referred_by_id.selectedIndex == 0)
	{	alert('Error! Please select Referred by.');
		 document.addClientForm.referred_by_id.focus();
		 return false; }

	if (document.addClientForm.country_id.selectedIndex == 0)
	{	alert('Error! Please select Nationality.');
		 document.addClientForm.country_id.focus();
		 return false; }

return true;
}

function checkclientRequirementForm()
{	

	if (document.requirementForm.country.selectedIndex == 0)
	{	alert('Error! Please select Country.');
		 document.requirementForm.country.focus();
		 return false; }

	if (document.requirementForm.country_state.selectedIndex == 0)
	{	alert('Error! Please select State.');
		 document.requirementForm.country_state.focus();
		 return false; }

	if (document.requirementForm.r_notification_expire_days.value)
	{	if(!IsNumeric(document.requirementForm.r_notification_expire_days.value))
		{
			alert('Error! Please input Notification Expire Days in Number format.');
			document.requirementForm.r_notification_expire_days.focus();
			return false; }
	}

return true;
}


function checkclientcomplaintForm()
{	
	if (!document.complaintForm.c_remarks.value)
	{	alert('Error! Please input complaint remarks.');
		document.complaintForm.c_remarks.focus();
		return false; }

return true;
}

function checkclientattachmentForm()
{	
	if (!document.attachmentForm.attachment_title.value)
	{	alert('Error! Please input attachment Title.');
		document.attachmentForm.attachment_title.focus();
		return false; }
	

		//if Save Mode is active and File is not browsed
		if(!document.attachmentForm.eid.value)
		{
		if(!document.attachmentForm.attachment_url.value)
		{
					alert("Error! Please click Browse to select File for attachment.");
					document.attachmentForm.attachment_url.focus();
					return false;	
		}
		
		if(document.attachmentForm.attachment_url.value)
		{
			//Check Type of Image
			if(!/(\.jpg|\.gif|\.bmp|\.png|\.jpeg|\.zip|\.pdf|\.rar|\.doc|\.ppt)$/i.test(document.attachmentForm.attachment_url.value))
			{
					alert("Error! Attachment File must be .jpg, .gif, .png, .jpeg, .zip, .doc, .pdf, .rar, .ppt File format.");
					document.attachmentForm.attachment_url.focus();
					return false;
			}
		}
		}

		//if Edit Mode is active and File is not browsed
		if(document.attachmentForm.eid.value)
		{
			if(document.attachmentForm.attachment_url.value)
			{
				//Check Type of Image
				if(!/(\.jpg|\.gif|\.bmp|\.png|\.jpeg|\.zip|\.pdf|\.rar|\.doc|\.ppt|\.docx|\.pptx)$/i.test(document.attachmentForm.attachment_url.value))
				{
						alert("Error! Attachment File must be .jpg, .gif, .png, .jpeg, .zip, .doc, .docx, .pdf, .rar, .ppt, .pptx File format.");
						document.attachmentForm.attachment_url.focus();
						return false;
				}
			}
		}

return true;
}

function popUp(URL, popupwidth, popupheight) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width='+ popupwidth +',height='+popupheight+'');");
} 

function checkpropertyDetailForm()
{
	if (!document.propertyDetailForm.property_name.value)
	{	alert('Error! Please Input Property Name.');
		document.propertyDetailForm.property_name.focus();
		return false; }

	if (document.propertyDetailForm.country.selectedIndex == 0)
	{   alert('Error! Please Select Country.');
		document.propertyDetailForm.country.focus();
		return false; 
		}
	
	if (document.propertyDetailForm.country_state.selectedIndex == 0)
	{   alert('Error! Please Select State.');
		document.propertyDetailForm.country_state.focus();
		return false; 
		}

	if (document.propertyDetailForm.propertyCommunity.selectedIndex == 0)
	{   alert('Error! Please Select Community.');
		document.propertyDetailForm.propertyCommunity.focus();
		return false; 
		}

	if(document.propertyDetailForm.property_image_file.value)
	{	
		//Check Type of Image
		if(!/(\.jpg|\.gif|\.bmp|\.png|\.jpeg)$/i.test(document.propertyDetailForm.property_image_file.value))
		{
			alert("Error! Property Image must be .jpg, .gif, .png, .jpeg File format.");
			document.propertyDetailForm.property_image_file.focus();
			return false;
		}
	}

	//Map File
	if(document.propertyDetailForm.property_map_file.value)
	{	//Check Type of Image
		if(!/(\.jpg|\.gif|\.jpeg)$/i.test(document.propertyDetailForm.property_map_file.value))
		{
			alert("Error! Property Map must be .jpg, .gif, .jpeg File format.");
			document.propertyDetailForm.property_map_file.focus();
			return false;
		}
	}
	
	//Property Attachment
	if(document.propertyDetailForm.property_attachment_file.value)
	{	//Check Type of Image
		if(!/(\.zip|\.rar|\.doc|\.jpg|\.jpeg|\.gif|\.ppt|\.pdf|\.txt)$/i.test(document.propertyDetailForm.property_attachment_file.value))
		{
			alert("Error! Property Map must be .jpg, .gif, .jpeg, .zip, .doc, .ppt, .pdf, .txt File format.");
			document.propertyDetailForm.property_attachment_file.focus();
			return false;
		}
	}
	
	//for confirmation
	var answer = confirm("Are you sure you want to complete this process?")
	if(answer==true)	
		return true;
	else
		return false;

}

//For Lease Units
function checkUnitDetailForm()
{
	if (document.propertyDetailForm.country.selectedIndex == 0)
	{   alert('Error! Please Select Country.');
		document.propertyDetailForm.country.focus();
		return false; 
		}

	if (document.propertyDetailForm.country_state.selectedIndex == 0)
	{   alert('Error! Please Select State.');
		document.propertyDetailForm.country_state.focus();
		return false; 
		}

	if (document.propertyDetailForm.propertyCommunity.selectedIndex == 0)
	{   alert('Error! Please Select Community.');
		document.propertyDetailForm.propertyCommunity.focus();
		return false; 
		}
	
	if (document.propertyDetailForm.property_id.selectedIndex == 0)
	{   alert('Error! Please Select Property.');
		document.propertyDetailForm.property_id.focus();
		return false; 
		}
		
	if (document.propertyDetailForm.landlord_id.selectedIndex == 0)
	{	alert('Error! Please select Landlord of Unit.');
		document.propertyDetailForm.landlord_id.focus();
		return false; 
		}
	
	if (document.propertyDetailForm.unit_type_id.selectedIndex == 0)
	{	alert('Error! Please select Unit Type.');
		document.propertyDetailForm.unit_type_id.focus();
		return false; 
		}
	
	if (document.propertyDetailForm.subunit_type_id.selectedIndex == 0)
	{	alert('Error! Please select Sub-Unit Type.');
		document.propertyDetailForm.subunit_type_id.focus();
		return false; 
		}

	if (!document.propertyDetailForm.property_unit_no.value)
	{	alert('Error! Please Input Unit #.');
		document.propertyDetailForm.property_unit_no.focus();
		return false; }
	
	if (!document.propertyDetailForm.property_builtup_area.value)
	{	alert('Error! Please Input Built-up area.');
		document.propertyDetailForm.property_builtup_area.focus();
		return false; }
	
	if (document.propertyDetailForm.bedroom_id.selectedIndex == 0)
	{	alert('Error! Please select Bedroom.');
		document.propertyDetailForm.bedroom_id.focus();
		return false; 
		}

	if (document.propertyDetailForm.unit_view_id.selectedIndex == 0)
	{	alert('Error! Please select Unit View.');
		document.propertyDetailForm.unit_view_id.focus();
		return false; 
		}

	if (document.propertyDetailForm.property_status.selectedIndex == 0)
	{	alert('Error! Please select Unit Status.');
		document.propertyDetailForm.property_status.focus();
		return false; 
		}

	if (document.propertyDetailForm.property_status.selectedIndex == 0)
	{	alert('Error! Please select Unit Status.');
		document.propertyDetailForm.property_status.focus();
		return false; 
		}

	if (document.propertyDetailForm.property_image_file.value)
	{
		//Check Type of Image
		if(!/(\.jpg|\.gif|\.jpeg)$/i.test(document.propertyDetailForm.property_image_file.value))
		{
			alert("Error! Property Image must be .jpg, .gif,.jpeg File format.");
			document.propertyDetailForm.property_image_file.focus();
			return false;
		}
	}

	//Attacjment
	if (document.propertyDetailForm.property_attachment_file.value)
	{	//Check Type of Image
		if(!/(\.zip|\.rar|\.doc|\.jpg|\.jpeg|\.gif|\.ppt|\.pdf|\.txt)$/i.test(document.propertyDetailForm.property_attachment_file.value))
		{
			alert("Error! Property Map must be .jpg, .gif, .jpeg, .zip, .doc, .ppt, .pdf, .txt File format.");
			document.propertyDetailForm.property_attachment_file.focus();
			return false;
		}
	}
		
	if (document.propertyDetailForm.referred_by_id.selectedIndex == 0)
	{	alert('Error! Please select Referred  by field.');
		document.propertyDetailForm.referred_by_id.focus();
		return false; }
		
	if (!document.propertyDetailForm.referred_date.value)
	{	alert('Error! Please Input Referred date.');
		document.propertyDetailForm.referred_date.focus();
		return false; }


	if (!IsNumeric(document.propertyDetailForm.rent_annual.value))
	{	alert('Error! Please Input Annual Rent in Payment Details section in Correct Numeric format without , separated');
		 document.propertyDetailForm.rent_annual.focus();
		 return false; }

	if (!IsNumeric(document.propertyDetailForm.security_deposit_amount.value))
	{	   alert('Error! Please Input Security Deposit in Payment Details section in Correct Numeric format without , separated.');
			document.propertyDetailForm.security_deposit_amount.focus();
			return false; }
	
	if (!IsNumeric(document.propertyDetailForm.security_deposit_percentage.value))
	{	   alert('Error! Please Input Security Deposit %age in Payment Details section in Correct Numeric format.');
			document.propertyDetailForm.security_deposit_percentage.focus();
			return false; }

	if (!IsNumeric(document.propertyDetailForm.comission_amount.value))
	{	   alert('Error! Please Input Comission in Payment Details section in Correct Numeric format without , separated.');
			document.propertyDetailForm.comission_amount.focus();
			return false; }
	
	if (!IsNumeric(document.propertyDetailForm.comission_percentage.value))
	{	   alert('Error! Please Input Comission %age in Payment Details section in Correct Numeric format.');
			document.propertyDetailForm.comission_percentage.focus();
			return false; }
	
	if (!document.propertyDetailForm.total_cheques.value)
	{	   alert('Error! Please Input # of Cheques in Payment Details section.');
			document.propertyDetailForm.total_cheques.focus();
			return false; }
			
	//for confirmation
	//var answer = confirm("Are you sure you want to complete this process?")
	//if(answer==true)	
		return true;
	//else
	//	return false;
}


//For Sale Units
function checkSaleUnitDetailForm()
{	
	if (document.propertyDetailForm.country.selectedIndex == 0)
	{   alert('Error! Please Select Country.');
		document.propertyDetailForm.country.focus();
		return false; 
		}

	if (document.propertyDetailForm.country_state.selectedIndex == 0)
	{   alert('Error! Please Select State.');
		document.propertyDetailForm.country_state.focus();
		return false; 
		}

	if (document.propertyDetailForm.propertyCommunity.selectedIndex == 0)
	{   alert('Error! Please Select Community.');
		document.propertyDetailForm.propertyCommunity.focus();
		return false; 
		}
	
	if (document.propertyDetailForm.property_id.selectedIndex == 0)
	{   alert('Error! Please Select Property.');
		document.propertyDetailForm.property_id.focus();
		return false; 
		}
		
	if (document.propertyDetailForm.seller_id.selectedIndex == 0)
	{	alert('Error! Please select Seller of this Unit.');
		document.propertyDetailForm.seller_id.focus();
		return false; 
		}
	
	if (document.propertyDetailForm.unit_type_id.selectedIndex == 0)
	{	alert('Error! Please select Unit Type.');
		document.propertyDetailForm.unit_type_id.focus();
		return false; 
		}
	
	if (document.propertyDetailForm.subunit_type_id.selectedIndex == 0)
	{	alert('Error! Please select Sub-Unit Type.');
		document.propertyDetailForm.subunit_type_id.focus();
		return false; 
		}
		
		
	if (!document.propertyDetailForm.property_unit_no.value)
	{	alert('Error! Please Input Unit #.');
		document.propertyDetailForm.property_unit_no.focus();
		return false; }


/*	if (!document.propertyDetailForm.handover_date.value)
	{	alert('Error! Please Input Hand over date.');
		document.propertyDetailForm.handover_date.focus();
		return false; }*/
	
	if (document.propertyDetailForm.unit_view_id.selectedIndex == 0)
	{	alert('Error! Please select Unit view.');
		document.propertyDetailForm.unit_view_id.focus();
		return false; 
		}
		
	if (document.propertyDetailForm.bedroom_id.selectedIndex == 0)
	{	alert('Error! Please select Bedroom.');
		document.propertyDetailForm.bedroom_id.focus();
		return false; 
		}
	
	if (!document.propertyDetailForm.property_builtup_area.value)
	{	alert('Error! Please Input Builtup area.');
		document.propertyDetailForm.property_builtup_area.focus();
		return false; }
	
	if (!document.propertyDetailForm.property_floor_no.value)
	{	alert('Error! Please Input floor #.');
		document.propertyDetailForm.property_floor_no.focus();
		return false; }
	
	if (document.propertyDetailForm.property_leased.selectedIndex == 0)
	{	alert('Error! Please select Leased Status.');
		document.propertyDetailForm.property_leased.focus();
		return false; 
		}
	
	if (document.propertyDetailForm.property_leased.selectedIndex == 0)
	{	alert('Error! Please select Leased Status.');
		document.propertyDetailForm.property_leased.focus();
		return false; 
		}
		
	if (document.propertyDetailForm.owner_occupied.selectedIndex == 0)
	{	alert('Error! Please select Owner Occupied status.');
		document.propertyDetailForm.owner_occupied.focus();
		return false; 
		}
	
	if (document.propertyDetailForm.property_mandate.selectedIndex == 0)
	{	alert('Error! Please select Mandate status.');
		document.propertyDetailForm.property_mandate.focus();
		return false; 
		}
	
	if (document.propertyDetailForm.property_financing.selectedIndex == 0)
	{	alert('Error! Please select Financing status.');
		document.propertyDetailForm.property_financing.focus();
		return false; 
		}

	/*if (document.propertyDetailForm.property_image_file.value)
	{
		//Check Type of Image
		if(!/(\.jpg|\.gif|\.jpeg)$/i.test(document.propertyDetailForm.property_image_file.value))
		{
			alert("Error! Property Image must be .jpg, .gif,.jpeg File format.");
			document.propertyDetailForm.property_image_file.focus();
			return false;
		}
	}*/

	//Attacjment
	if (document.propertyDetailForm.property_attachment_file.value)
	{	//Check Type of Image
		if(!/(\.zip|\.rar|\.doc|\.jpg|\.jpeg|\.gif|\.ppt|\.pdf|\.txt)$/i.test(document.propertyDetailForm.property_attachment_file.value))
		{
			alert("Error! Property Map must be .jpg, .gif, .jpeg, .zip, .doc, .ppt, .pdf, .txt File format.");
			document.propertyDetailForm.property_attachment_file.focus();
			return false;
		}
	}

	if (document.propertyDetailForm.referred_by_id.selectedIndex == 0)
	{	alert('Error! Please select Referred  by field.');
		document.propertyDetailForm.referred_by_id.focus();
		return false; }
		
	if (!document.propertyDetailForm.referred_date.value)
	{	alert('Error! Please Input Referred date.');
		document.propertyDetailForm.referred_date.focus();
		return false; }

	//sales detail section
	if (!IsNumeric(document.propertyDetailForm.orignal_price.value))
	{   alert('Error! Orignal Price must be input in Correct format without , separated.');
		document.propertyDetailForm.orignal_price.focus();
		return false; }
		
	if (!IsNumeric(document.propertyDetailForm.premium_to_seller.value))
	{   alert('Error! Premium (to seller) must be input in Correct format without , separated.');
		document.propertyDetailForm.premium_to_seller.focus();
		return false; }

	if (!IsNumeric(document.propertyDetailForm.premium_to_seller_percentage.value))
	{   alert('Error! Please Input Premium (to seller) percentage in Correct format without , separated.');
		document.propertyDetailForm.premium_to_seller_percentage.focus();
		return false; }
	
	if (!IsNumeric(document.propertyDetailForm.agency_fee_seller.value))
	{   alert('Error! Please Input Agency fee (seller) in Correct format without , separated.');
		document.propertyDetailForm.agency_fee_seller.focus();
		return false; }
	
	if (!IsNumeric(document.propertyDetailForm.agency_fee_seller_percentage.value))
	{   alert('Error! Please Input Agency fee (seller) percentage in Correct format without , separated.');
		document.propertyDetailForm.agency_fee_seller_percentage.focus();
		return false; }
	
	if (document.propertyDetailForm.add_agency_fee.selectedIndex == 0)
	{	alert('Error! Please select Add Agency Fee option.');
		document.propertyDetailForm.add_agency_fee.focus();
		return false; 
		}

	
	
	if (!IsNumeric(document.propertyDetailForm.selling_price.value))
	{   alert('Error! Please check Selling price must be in Correct format without , separated.');
		document.propertyDetailForm.selling_price.focus();
		return false; }
	
	
	
	if (!IsNumeric(document.propertyDetailForm.agency_fee_buyer.value))
	{	alert('Error! Please Input Agency Fee of buyer in Correct format without , separated.');
		document.propertyDetailForm.agency_fee_buyer.focus();
		return false; }
		
	
	if (!IsNumeric(document.propertyDetailForm.agency_fee_buyer_percentage.value))
	{	alert('Error! Please Input Agency Fee of buyer percentage in Correct format without , separated.');
		document.propertyDetailForm.agency_fee_buyer_percentage.focus();
		return false; }
	
	if (!IsNumeric(document.propertyDetailForm.transfer_fee_buyer.value))
	{	alert('Error! Please Input Transfer / Registration Fee of buyer in Correct format without , separated.');
		document.propertyDetailForm.transfer_fee_buyer.focus();
		return false; }
		
	if (!IsNumeric(document.propertyDetailForm.transfer_fee_buyer_percentage.value))
	{	alert('Error! Please Input Transfer / Registration Fee of buyer percentage in Correct format without , separated.');
		document.propertyDetailForm.transfer_fee_buyer_percentage.focus();
		return false; }
	
	if (!IsNumeric(document.propertyDetailForm.transfer_fee_seller.value))
	{	alert('Error! Please Input Transfer / Registration Fee of seller in Correct format without , separated.');
		document.propertyDetailForm.transfer_fee_seller.focus();
		return false; }

	if (!IsNumeric(document.propertyDetailForm.transfer_fee_seller_percentage.value))
	{	alert('Error! Please Input Transfer / Registration Fee of seller percentage in Correct format without , separated.');
		document.propertyDetailForm.transfer_fee_seller_percentage.focus();
		return false; }

	if (!IsNumeric(document.propertyDetailForm.transfer_fee_completed.value))
	{	alert('Error! Please Input Transfer Fee (Completed & paid prop) in Correct format without , separated.');
		document.propertyDetailForm.transfer_fee_completed.focus();
		return false; }

	if (!IsNumeric(document.propertyDetailForm.transfer_fee_completed_percentage.value))
	{	alert('Error! Please Input Transfer Fee (Completed & paid prop) percentage in Correct format without , separated.');
		document.propertyDetailForm.transfer_fee_completed_percentage.focus();
		return false; }

	if (!IsNumeric(document.propertyDetailForm.seller_paid.value))
	{	alert('Error! Please Input seller paid amount in Correct format without , separated.');
		document.propertyDetailForm.seller_paid.focus();
		return false; }

	if (!IsNumeric(document.propertyDetailForm.seller_paid_percentage.value))
	{	alert('Error! Please Input seller paid amount percentage in Correct format without , separated.');
		document.propertyDetailForm.seller_paid_percentage.focus();
		return false; }

	if (!IsNumeric(document.propertyDetailForm.due_amount_developer.value))
	{	alert('Error! Please Input Due amount to developer in Correct format without , separated.');
		document.propertyDetailForm.due_amount_developer.focus();
		return false; }
	
	if (!IsNumeric(document.propertyDetailForm.due_amount_developer_percentage.value))
	{	alert('Error! Please Input Due amount to developer percentage in Correct format without , separated.');
		document.propertyDetailForm.due_amount_developer_percentage.focus();
		return false; }
	
	
	//for confirmation
	//var answer = confirm("Are you sure you want to complete this process?")
	//if(answer==true)	
		return true;
	//else
	//	return false;
}

function checkleasingpropertyDetailForm()
{
	if (!document.propertyDetailForm.property_name.value)
	{	alert('Error! Please Input Property Name.');
		document.propertyDetailForm.property_name.focus();
		return false; }
	
	if (document.propertyDetailForm.country.selectedIndex == 0)
	{   alert('Error! Please Select Country.');
		document.propertyDetailForm.country.focus();
		return false; 
		}
	
	if (document.propertyDetailForm.country_state.selectedIndex == 0)
	{   alert('Error! Please Select State.');
		document.propertyDetailForm.country_state.focus();
		return false; 
		}

	if (document.propertyDetailForm.propertyCommunity.selectedIndex == 0)
	{   alert('Error! Please Select Community.');
		document.propertyDetailForm.propertyCommunity.focus();
		return false; 
		}

	if(document.propertyDetailForm.eid.value)
	{
		if (document.propertyDetailForm.property_image_file.value)
		{	
			//Check Type of Image
			if(!/(\.jpg|\.gif|\.bmp|\.png|\.jpeg)$/i.test(document.propertyDetailForm.property_image_file.value))
			{
				alert("Error! Property Image must be .jpg, .gif, .jpegs File format.");
				document.propertyDetailForm.property_image_file.focus();
				return false;
			}
		}
	}

	//map
	if (document.propertyDetailForm.property_map_file.value)
	{	//Check Type of Image
		if(!/(\.jpg|\.gif|\.jpeg)$/i.test(document.propertyDetailForm.property_map_file.value))
		{
			alert("Error! Property Map must be .jpg, .gif, .jpeg File format.");
			document.propertyDetailForm.property_map_file.focus();
			return false;
		}
	}

	//attachment
	if (document.propertyDetailForm.property_attachment_file.value)
	{	//Check Type of Image
		if(!/(\.zip|\.rar|\.doc|\.jpg|\.jpeg|\.gif|\.ppt|\.pdf|\.txt)$/i.test(document.propertyDetailForm.property_attachment_file.value))
		{
			alert("Error! Property Map must be .jpg, .gif, .jpeg, .zip, .doc, .ppt, .pdf, .txt File format.");
			document.propertyDetailForm.property_attachment_file.focus();
			return false;
		}
	}

	if (!document.propertyDetailForm.referred_by_id.value)
	{ alert('Error! Please Select Referred by this property.');
	  document.propertyDetailForm.referred_by_id.focus();
	  return false; }
	 
	 if (!document.propertyDetailForm.referred_date.value)
	{ alert('Error! Please input Referred Date in a valid date format (Year-Month-Day).');
	  document.propertyDetailForm.referred_date.focus();
	  return false; }
	
	/*if(document.propertyDetailForm.eid.value)
		//For 360 degree Virtual Tour Image-1
	if (document.propertyDetailForm.virtual_tour_image1.value)
	{
		//Check Type of Image
		if(!/(\.jpg|\.gif|\.jpeg)$/i.test(document.propertyDetailForm.virtual_tour_image1.value))
		{
			alert("Error! 360 degree Virtual Tour Image-1 must be .jpg, .gif, .jpeg File format.");
			document.propertyDetailForm.virtual_tour_image1.focus();
			return false;
		}
		
		// 360 degree  Virtual Tour Image Title 
		if (!document.propertyDetailForm.virtual_tour_image_title1.value)
		{	alert('Error! 360 degree Virtual Tour Image-1 Caption must be inputed.');
		document.propertyDetailForm.virtual_tour_image_title1.focus();
		return false; }
	}
	
	//For 360 degree Virtual Tour Image-2
	if (document.propertyDetailForm.virtual_tour_image2.value)
	{
		//Check Type of Image
		if(!/(\.jpg|\.gif|\.jpeg)$/i.test(document.propertyDetailForm.virtual_tour_image2.value))
		{
			alert("Error! 360 degree Virtual Tour Image-2 must be .jpg, .gif, .jpeg File format.");
			document.propertyDetailForm.virtual_tour_image2.focus();
			return false;
		}
		
		// 360 degree  Virtual Tour Image Title 
		if (!document.propertyDetailForm.virtual_tour_image_title2.value)
		{	alert('Error! 360 degree Virtual Tour Image-2 Caption must be inputed.');
		document.propertyDetailForm.virtual_tour_image_title2.focus();
		return false; }
	}
	
	//For 360 degree Virtual Tour Image-3
	if (document.propertyDetailForm.virtual_tour_image3.value)
	{
		//Check Type of Image
		if(!/(\.jpg|\.gif|\.jpeg)$/i.test(document.propertyDetailForm.virtual_tour_image3.value))
		{
			alert("Error! 360 degree Virtual Tour Image-3 must be .jpg, .gif, .jpeg File format.");
			document.propertyDetailForm.virtual_tour_image3.focus();
			return false;
		}
		
		// 360 degree  Virtual Tour Image Title 
		if (!document.propertyDetailForm.virtual_tour_image_title3.value)
		{	alert('Error! 360 degree Virtual Tour Image-3 Caption must be inputed.');
		document.propertyDetailForm.virtual_tour_image_title3.focus();
		return false; }
	}
	
	//For 360 degree Virtual Tour Image-4
	if (document.propertyDetailForm.virtual_tour_image4.value)
	{
		//Check Type of Image
		if(!/(\.jpg|\.gif|\.jpeg)$/i.test(document.propertyDetailForm.virtual_tour_image4.value))
		{
			alert("Error! 360 degree Virtual Tour Image-4 must be .jpg, .gif, .jpeg File format.");
			document.propertyDetailForm.virtual_tour_image4.focus();
			return false;
		}
		
		// 360 degree  Virtual Tour Image Title 
		if (!document.propertyDetailForm.virtual_tour_image_title4.value)
		{	alert('Error! 360 degree Virtual Tour Image-4 Caption must be inputed.');
		document.propertyDetailForm.virtual_tour_image_title4.focus();
		return false; }
	}
	
	//For 360 degree Virtual Tour Image-5
	if (document.propertyDetailForm.virtual_tour_image5.value)
	{
		//Check Type of Image
		if(!/(\.jpg|\.gif|\.jpeg)$/i.test(document.propertyDetailForm.virtual_tour_image5.value))
		{
			alert("Error! 360 degree Virtual Tour Image-5 must be .jpg, .gif, .jpeg File format.");
			document.propertyDetailForm.virtual_tour_image5.focus();
			return false;
		}
		
		// 360 degree  Virtual Tour Image Title 
		if (!document.propertyDetailForm.virtual_tour_image_title5.value)
		{	alert('Error! 360 degree Virtual Tour Image-5 Caption must be inputed.');
		document.propertyDetailForm.virtual_tour_image_title5.focus();
		return false; }
	}
	}*/
return true;
}

function checkUploadGalleryForm()
{	
	if (!document.propertygalleryform.gallery_title.value)
	{	alert('Error! Please Input Title.');
		document.propertygalleryform.gallery_title.focus();
		return false; }
	
	//validation only for new gallery 
	if(!document.propertygalleryform.eid.value)
	{
			if(!document.propertygalleryform.gallery_fullimage.value)
			{
				alert("Error! Please Browse to select Property Full Image.");
				document.propertygalleryform.gallery_fullimage.focus();
				return false;	
			}
		
			if(document.propertygalleryform.gallery_fullimage.value)
			{
				//Check Type of Image
				if(!/(\.jpg|\.gif|\.jpeg)$/i.test(document.propertygalleryform.gallery_fullimage.value))
				{
					alert("Error! Property Image must be .jpg, .gif, .jpeg File format.");
					document.propertygalleryform.gallery_fullimage.focus();
					return false;
				}
			}
	
		
		/*if(!document.propertygalleryform.gallery_thumbimage.value)
		{
			alert("Error! Please Browse to select Property Thumb Image.");
			document.propertygalleryform.gallery_thumbimage.focus();
			return false;	
		}
	
		if(document.propertygalleryform.gallery_thumbimage.value)
		{
			//Check Type of Image
			if(!/(\.jpg|\.gif|\.jpeg)$/i.test(document.propertygalleryform.gallery_thumbimage.value))
			{
				alert("Error! Property Thumb Image must be .jpg, .gif, .jpeg File format.");
				document.propertygalleryform.gallery_thumbimage.focus();
				return false;
			}
		}*/
	}

return true;
}


function checkPaymentPlanForm()
{
	if (document.paymentplanform.payment_plan_id.selectedIndex == 0)
	{   alert('Error! Please Select Payment Plan.');
		document.paymentplanform.payment_plan_id.focus();
		return false; 
		}

	 if (document.paymentplanform.payment_type_id.selectedIndex == 0)
	 {   alert('Error! Please Select Payment Type.');
		document.paymentplanform.payment_type_id.focus();
		return false; 
		}
		
	if (!document.paymentplanform.installment_amount.value)
	{   alert('Error! Please input Installment Amount.');
		document.paymentplanform.installment_amount.focus();
		return false; }
	
	if (document.paymentplanform.installment_period.selectedIndex == 0)
	 {   alert('Error! Please Select Installment Period.');
		document.paymentplanform.installment_period.focus();
		return false; 
		}

	if (document.paymentplanform.installment_no_id.selectedIndex == 0)
	 {   alert('Error! Please Select Installment #.');
		document.paymentplanform.installment_no_id.focus();
		return false; 
		}
	return true;
}

function checkfinanceform()
{	
	if (!document.financeform.company_name.value)
	{   alert('Error! Please input Company Name.');
		document.financeform.company_name.focus();
		return false; }

	if (!document.financeform.termof_loan.value)
	{   alert('Error! Please input Term of Loan.');
		document.financeform.termof_loan.focus();
		return false; }

	if (!document.financeform.down_payment.value)
	{   alert('Error! Please input Down Payment.');
		document.financeform.down_payment.focus();
		return false; }	

	if (!document.financeform.interest_rate.value)
	{   alert('Error! Please input Interest Rate.');
		document.financeform.interest_rate.focus();
		return false; }

	return true;
}



function checkrentalpropertyDetailForm()
{
		
	if (!document.rentalpropertyDetailForm.property_name.value)
	{	alert('Error! Please Input Property Name.');
		document.rentalpropertyDetailForm.property_name.focus();
		return false; }
	
	
	if (document.rentalpropertyDetailForm.property_type_id.selectedIndex == 0)
	{	alert('Error! Please select Property Type.');
		document.rentalpropertyDetailForm.property_type_id.focus();
		return false; 
		}
	
		
	//conditions for rental plan
	if(document.rentalpropertyDetailForm.daily_plan.value)
	{
		if (!IsNumeric(document.rentalpropertyDetailForm.daily_plan.value))
		{	alert('Error! Please Input Daily Plan in Numeric Format only.');
			document.rentalpropertyDetailForm.daily_plan.focus();
			return false; }
	}
	
	//conditions for rental plan
	if(document.rentalpropertyDetailForm.weekly_plan.value)
	{
		if (!IsNumeric(document.rentalpropertyDetailForm.weekly_plan.value))
		{	alert('Error! Please Input Weekly Plan in Numeric Format only.');
			document.rentalpropertyDetailForm.weekly_plan.focus();
			return false; }
	}
	
	//conditions for rental plan
	if(!document.rentalpropertyDetailForm.monthly_plan.value)
	{
		if (!IsNumeric(document.rentalpropertyDetailForm.monthly_plan.value))
		{	alert('Error! Please Input Monthly Plan in Numeric Format only.');
			document.rentalpropertyDetailForm.monthly_plan.focus();
			return false; }
	}
	
	//conditions for rental plan
	if(document.rentalpropertyDetailForm.yearly_plan.value)
	{
		//conditions for rental plan
		if (!IsNumeric(document.rentalpropertyDetailForm.yearly_plan.value))
		{	alert('Error! Please Input Yealry Plan in Numeric Format only.');
			document.rentalpropertyDetailForm.yearly_plan.focus();
			return false; }
	}
	
	if (document.rentalpropertyDetailForm.country.selectedIndex == 0)
	{   alert('Error! Please Select Country.');
		document.rentalpropertyDetailForm.country.focus();
		return false; 
		}

	if (document.rentalpropertyDetailForm.country_state.selectedIndex == 0)
	{   alert('Error! Please Select State.');
		document.rentalpropertyDetailForm.country_state.focus();
		return false; 
		}

	if (document.rentalpropertyDetailForm.propertyCommunity.selectedIndex == 0)
	{   alert('Error! Please Select Community.');
		document.rentalpropertyDetailForm.propertyCommunity.focus();
		return false; 
		}

	//For Main Image File
	if (document.rentalpropertyDetailForm.property_image_file.value)
	{
		//Check Type of Image
		if(!/(\.jpg|\.gif|\.jpeg)$/i.test(document.rentalpropertyDetailForm.property_image_file.value))
		{
			alert("Error! Property Image must be .jpg, .gif, .jpeg File format.");
			document.rentalpropertyDetailForm.property_image_file.focus();
			return false;
		}
	}

	/*//For 360 degree Virtual Tour Image-1
	if (document.rentalpropertyDetailForm.virtual_tour_image1.value)
	{
		//Check Type of Image
		if(!/(\.jpg|\.gif|\.jpeg)$/i.test(document.rentalpropertyDetailForm.virtual_tour_image1.value))
		{
			alert("Error! 360 degree Virtual Tour Image-1 must be .jpg, .gif, .jpeg File format.");
			document.rentalpropertyDetailForm.virtual_tour_image1.focus();
			return false;
		}
		
		// 360 degree  Virtual Tour Image Title 
		if (!document.rentalpropertyDetailForm.virtual_tour_image_title1.value)
		{	alert('Error! 360 degree Virtual Tour Image-1 Caption must be inputed.');
		document.rentalpropertyDetailForm.virtual_tour_image_title1.focus();
		return false; }
	}
	
	//For 360 degree Virtual Tour Image-2
	if (document.rentalpropertyDetailForm.virtual_tour_image2.value)
	{
		//Check Type of Image
		if(!/(\.jpg|\.gif|\.jpeg)$/i.test(document.rentalpropertyDetailForm.virtual_tour_image2.value))
		{
			alert("Error! 360 degree Virtual Tour Image-2 must be .jpg, .gif, .jpeg File format.");
			document.rentalpropertyDetailForm.virtual_tour_image2.focus();
			return false;
		}
		
		// 360 degree  Virtual Tour Image Title 
		if (!document.rentalpropertyDetailForm.virtual_tour_image_title2.value)
		{	alert('Error! 360 degree Virtual Tour Image-2 Caption must be inputed.');
		document.rentalpropertyDetailForm.virtual_tour_image_title2.focus();
		return false; }
	}
	
	//For 360 degree Virtual Tour Image-3
	if (document.rentalpropertyDetailForm.virtual_tour_image3.value)
	{
		//Check Type of Image
		if(!/(\.jpg|\.gif|\.jpeg)$/i.test(document.rentalpropertyDetailForm.virtual_tour_image3.value))
		{
			alert("Error! 360 degree Virtual Tour Image-3 must be .jpg, .gif, .jpeg File format.");
			document.rentalpropertyDetailForm.virtual_tour_image3.focus();
			return false;
		}
		
		// 360 degree  Virtual Tour Image Title 
		if (!document.rentalpropertyDetailForm.virtual_tour_image_title3.value)
		{	alert('Error! 360 degree Virtual Tour Image-3 Caption must be inputed.');
		document.rentalpropertyDetailForm.virtual_tour_image_title3.focus();
		return false; }
	}
	
	//For 360 degree Virtual Tour Image-4
	if (document.rentalpropertyDetailForm.virtual_tour_image4.value)
	{
		//Check Type of Image
		if(!/(\.jpg|\.gif|\.jpeg)$/i.test(document.rentalpropertyDetailForm.virtual_tour_image4.value))
		{
			alert("Error! 360 degree Virtual Tour Image-4 must be .jpg, .gif, .jpeg File format.");
			document.rentalpropertyDetailForm.virtual_tour_image4.focus();
			return false;
		}
		
		// 360 degree  Virtual Tour Image Title 
		if (!document.rentalpropertyDetailForm.virtual_tour_image_title4.value)
		{	alert('Error! 360 degree Virtual Tour Image-4 Caption must be inputed.');
		document.rentalpropertyDetailForm.virtual_tour_image_title4.focus();
		return false; }
	}
	
	//For 360 degree Virtual Tour Image-5
	if (document.rentalpropertyDetailForm.virtual_tour_image5.value)
	{
		//Check Type of Image
		if(!/(\.jpg|\.gif|\.jpeg)$/i.test(document.rentalpropertyDetailForm.virtual_tour_image5.value))
		{
			alert("Error! 360 degree Virtual Tour Image-5 must be .jpg, .gif, .jpeg File format.");
			document.rentalpropertyDetailForm.virtual_tour_image5.focus();
			return false;
		}
		
		// 360 degree  Virtual Tour Image Title 
		if (!document.rentalpropertyDetailForm.virtual_tour_image_title5.value)
		{	alert('Error! 360 degree Virtual Tour Image-5 Caption must be inputed.');
		document.rentalpropertyDetailForm.virtual_tour_image_title5.focus();
		return false; }
	}*/

	//For Gallery Image 1 File
	if (document.rentalpropertyDetailForm.gallery_image1.value)
	{
		//Check Type of Image
		if(!/(\.jpg|\.gif|\.jpeg)$/i.test(document.rentalpropertyDetailForm.gallery_image1.value))
		{
			alert("Error! Property Gallery Image-1  must be .jpg, .gif, .jpeg File format.");
			document.rentalpropertyDetailForm.gallery_image1.focus();
			return false;
		}
	}

	//For Gallery Image 2 File
	if (document.rentalpropertyDetailForm.gallery_image2.value)
	{
		//Check Type of Image
		if(!/(\.jpg|\.gif|\.jpeg)$/i.test(document.rentalpropertyDetailForm.gallery_image2.value))
		{
			alert("Error! Property Gallery Image-2  must be .jpg, .gif, .jpeg File format.");
			document.rentalpropertyDetailForm.gallery_image2.focus();
			return false;
		}
	}

	//For Gallery Image 3 File
	if (document.rentalpropertyDetailForm.gallery_image3.value)
	{
		//Check Type of Image
		if(!/(\.jpg|\.gif|\.jpeg)$/i.test(document.rentalpropertyDetailForm.gallery_image3.value))
		{
			alert("Error! Property Gallery Image-3  must be .jpg, .gif, .jpeg File format.");
			document.rentalpropertyDetailForm.gallery_image3.focus();
			return false;
		}
	}

	//For Gallery Image 4 File
	if (document.rentalpropertyDetailForm.gallery_image4.value)
	{
		//Check Type of Image
		if(!/(\.jpg|\.gif|\.jpeg)$/i.test(document.rentalpropertyDetailForm.gallery_image4.value))
		{
			alert("Error! Property Gallery Image-4  must be .jpg, .gif, .jpeg File format.");
			document.rentalpropertyDetailForm.gallery_image4.focus();
			return false;
		}
	}

	//For Gallery Image 5 File
	if (document.rentalpropertyDetailForm.gallery_image5.value)
	{
		//Check Type of Image
		if(!/(\.jpg|\.gif|\.jpeg)$/i.test(document.rentalpropertyDetailForm.gallery_image5.value))
		{
			alert("Error! Property Gallery Image-5  must be .jpg, .gif, .jpeg File format.");
			document.rentalpropertyDetailForm.gallery_image5.focus();
			return false;
		}
	}
	
	//For Gallery Image 6 File
	if (document.rentalpropertyDetailForm.gallery_image6.value)
	{
		//Check Type of Image
		if(!/(\.jpg|\.gif|\.jpeg)$/i.test(document.rentalpropertyDetailForm.gallery_image6.value))
		{
			alert("Error! Property Gallery Image-6  must be .jpg, .gif, .jpeg File format.");
			document.rentalpropertyDetailForm.gallery_image6.focus();
			return false;
		}
	}
	
	
return true;
}

function checkReservationDetailForm()
{
	if (!document.propertyDetailForm.eid.value)
	{
		alert("Error! Please select again to reserve this unit.");
		document.propertyDetailForm.eid.focus();
		return false;
	}
	
	if (!document.propertyDetailForm.esessionid.value)
	{
		alert("Error! Please select again to reserve this unit.");
		document.propertyDetailForm.esessionid.focus();
		return false;
	}
	
	if (document.propertyDetailForm.referred_by_id.selectedIndex == 0)
	{	alert('Error! Please select Referred by.');
		document.propertyDetailForm.referred_by_id.focus();
		return false; 
		}
	
	if (!document.propertyDetailForm.referred_date.value)
	{
		alert("Error! Please Input Referred date.");
		document.propertyDetailForm.referred_date.focus();
		return false;
	}

	if (document.propertyDetailForm.reservation_type_id.selectedIndex == 0)
	{	alert('Error! Please select Reservation Type in Leasing Section.');
		document.propertyDetailForm.reservation_type_id.focus();
		return false; 
		}
	return true;
}

function checkSTReservationDetailForm()
{
	if (!document.propertyDetailForm.eid.value)
	{
		alert("Error! Please select again to reserve this unit.");
		document.propertyDetailForm.eid.focus();
		return false;
	}
	
	if (!document.propertyDetailForm.esessionid.value)
	{
		alert("Error! Please select again to reserve this unit.");
		document.propertyDetailForm.esessionid.focus();
		return false;
	}
	
	if (document.propertyDetailForm.referred_by_id.selectedIndex == 0)
	{	alert('Error! Please select Referred by.');
		document.propertyDetailForm.referred_by_id.focus();
		return false; 
		}
	
	if (!document.propertyDetailForm.referred_date.value)
	{
		alert("Error! Please Input Referred date.");
		document.propertyDetailForm.referred_date.focus();
		return false;
	}
	

	if (document.propertyDetailForm.reservation_type_id.selectedIndex == 0)
	{	alert('Error! Please select Reservation Type in Leasing Section.');
		document.propertyDetailForm.reservation_type_id.focus();
		return false; 
		}
	
	if (!document.propertyDetailForm.no_of_days.value)
	{
		alert("Error! Please Input Number of days.");
		document.propertyDetailForm.no_of_days.focus();
		return false;
	}
	
	if (!IsNumeric(document.propertyDetailForm.no_of_days.value))
	{
		alert("Error! Please Input valid Number of days.");
		document.propertyDetailForm.no_of_days.focus();
		return false;
	}
	
	if (!IsNumeric(document.propertyDetailForm.rent_per_day.value))
	{
		alert("Error! Please Input valid Rent per day.");
		document.propertyDetailForm.rent_per_day.focus();
		return false;
	}
	
	if (!IsNumeric(document.propertyDetailForm.total_rent.value))
	{
		alert("Error! Please Input valid Total rent.");
		document.propertyDetailForm.total_rent.focus();
		return false;
	}	
	
	if (!IsNumeric(document.propertyDetailForm.agency_fee.value))
	{
		alert("Error! Please Input valid Agency fee.");
		document.propertyDetailForm.agency_fee.focus();
		return false;
	}	
	return true;
}

function checkBlockSaleUnitForm()
{
	if (!document.blockSaleUnit.propertyID.value)
	{
		alert("Error! Some fields are missing. Referesh your page again.");
		document.blockSaleUnit.propertyID.focus();
		return false;
	}
	
	if (!document.blockSaleUnit.blockReason.value)
	{
		alert("Error! Please Input the reason to block this unit.");
		document.blockSaleUnit.blockReason.focus();
		return false;
	}
	
	return true;	
}
	
function checkvacantSaleUnitForm()
{
	if (!document.vacantSaleUnit.propertyID.value)
	{
		alert("Error! Some fields are missing. Referesh your page again.");
		document.vacantSaleUnit.propertyID.focus();
		return false;
	}
	return true;	
}

function checkSTleasingpropertyDetailForm()
{ 
	if (document.propertyDetailForm.country.selectedIndex == 0)
	{   alert('Error! Please Select Country.');
		document.propertyDetailForm.country.focus();
		return false; 
		}
	
	if (document.propertyDetailForm.country_state.selectedIndex == 0)
	{   alert('Error! Please Select State.');
		document.propertyDetailForm.country_state.focus();
		return false; 
		}

	if (document.propertyDetailForm.propertyCommunity.selectedIndex == 0)
	{   alert('Error! Please Select Community.');
		document.propertyDetailForm.propertyCommunity.focus();
		return false; 
		}
		
	if (!document.propertyDetailForm.property_name.value)
	{	alert('Error! Please Input Property Name.');
		document.propertyDetailForm.property_name.focus();
		return false; }
	
	if (document.propertyDetailForm.property_type_id.selectedIndex == 0)
	{   alert('Error! Please Select Property Type.');
		document.propertyDetailForm.property_type_id.focus();
		return false; 
		}
		
	if (document.propertyDetailForm.property_image_file.value)
	{	
		//Check Type of Image
		if(!/(\.jpg|\.gif|\.bmp|\.png|\.jpeg)$/i.test(document.propertyDetailForm.property_image_file.value))
		{
			alert("Error! Property Image must be .jpg, .gif, .jpegs File format.");
			document.propertyDetailForm.property_image_file.focus();
			return false;
		}
	}
	
	//map
	if (document.propertyDetailForm.property_map_file.value)
	{	//Check Type of Image
		if(!/(\.jpg|\.gif|\.jpeg)$/i.test(document.propertyDetailForm.property_map_file.value))
		{
			alert("Error! Property Map must be .jpg, .gif, .jpeg File format.");
			document.propertyDetailForm.property_map_file.focus();
			return false;
		}
	}
	
	//attachment
	if (document.propertyDetailForm.property_attachment_file.value)
	{	//Check Type of Image
		if(!/(\.zip|\.rar|\.doc|\.jpg|\.jpeg|\.gif|\.ppt|\.pdf|\.txt)$/i.test(document.propertyDetailForm.property_attachment_file.value))
		{
			alert("Error! Property Map must be .jpg, .gif, .jpeg, .zip, .doc, .ppt, .pdf, .txt File format.");
			document.propertyDetailForm.property_attachment_file.focus();
			return false;
		}
	}
		
	if (!document.propertyDetailForm.referred_by_id.value)
	{ alert('Error! Please Select Referred by this property.');
	  document.propertyDetailForm.referred_by_id.focus();
	  return false; }
	 
	 if (!document.propertyDetailForm.referred_date.value)
	{ alert('Error! Please input Referred Date in a valid date format (Year-Month-Day).');
	  document.propertyDetailForm.referred_date.focus();
	  return false; }
		  
return true;
}


function checkParcelDetailForm()
{
	if (document.parcelDetailForm.country.selectedIndex == 0)
	{   alert('Error! Please Select Country.');
		document.parcelDetailForm.country.focus();
		return false; 
		}
	
	if (document.parcelDetailForm.country_state.selectedIndex == 0)
	{   alert('Error! Please Select State.');
		document.parcelDetailForm.country_state.focus();
		return false; 
		}

	if (document.parcelDetailForm.propertyCommunity.selectedIndex == 0)
	{   alert('Error! Please Select Community.');
		document.parcelDetailForm.propertyCommunity.focus();
		return false; 
		}
	
	/*if (!document.parcelDetailForm.parcel_code.value)
	{	alert('Error! Please Input Parcel Code.');
		document.parcelDetailForm.parcel_code.focus();
		return false; }*/
	
	if (!document.parcelDetailForm.parcel_name.value)
	{	alert('Error! Please Input Parcel Name.');
		document.parcelDetailForm.parcel_name.focus();
		return false; }
	
	/*if (document.parcelDetailForm.equal_to_property.selectedIndex == 0)
	{   alert('Error! Please Select Parcel equal to Property option.');
		document.parcelDetailForm.equal_to_property.focus();
		return false; 
		}*/
	
	
	
	/*if (document.parcelDetailForm.parcel_property_id.selectedIndex == 0)
	{ 
		alert('Error! Please Select Property.');
		document.parcelDetailForm.parcel_property_id.focus();
		return false; 
	}		
	*/
	
	if (document.parcelDetailForm.property_type_id.selectedIndex == 0)
	{   alert('Error! Please Select Property Type.');
		document.parcelDetailForm.property_type_id.focus();
		return false; 
		}
		
	
/*	if (!document.parcelDetailForm.property_email.value)
	{ alert('Error! Please Input email in valid format.');
	  document.parcelDetailForm.property_email.focus();
	  return false; }*/
	  
	if (document.parcelDetailForm.property_image_file.value)
	{	
		//Check Type of Image
		if(!/(\.jpg|\.gif|\.bmp|\.png|\.jpeg)$/i.test(document.parcelDetailForm.property_image_file.value))
		{
			alert("Error! Property Image must be .jpg, .gif, .jpegs File format.");
			document.parcelDetailForm.property_image_file.focus();
			return false;
		}
	}
	
	//map
	if (document.parcelDetailForm.property_map_file.value)
	{	//Check Type of Image
		if(!/(\.jpg|\.gif|\.jpeg)$/i.test(document.parcelDetailForm.property_map_file.value))
		{
			alert("Error! Property Map must be .jpg, .gif, .jpeg File format.");
			document.parcelDetailForm.property_map_file.focus();
			return false;
		}
	}
	
	//attachment
	if (document.parcelDetailForm.property_attachment_file.value)
	{	//Check Type of Image
		if(!/(\.zip|\.rar|\.doc|\.jpg|\.jpeg|\.gif|\.ppt|\.pdf|\.txt)$/i.test(document.parcelDetailForm.property_attachment_file.value))
		{
			alert("Error! Property Map must be .jpg, .gif, .jpeg, .zip, .doc, .ppt, .pdf, .txt File format.");
			document.parcelDetailForm.property_attachment_file.focus();
			return false;
		}
	}

	if (document.parcelDetailForm.referred_by_id.selectedIndex == 0)
	{    alert('Error! Please Select Referred by this property.');
		 document.parcelDetailForm.referred_by_id.focus();
		 return false; }

	if (!document.parcelDetailForm.referred_date.value)
	{ alert('Error! Please input Referred Date in a valid date format (Year-Month-Day).');
	  document.parcelDetailForm.referred_date.focus();
	  return false; }
	
return true;
}


//For Lease Units
function checkSTLeasingUnitDetailForm()
{
		
	if (document.STUnitDetailForm.country.selectedIndex == 0)
	{   alert('Error! Please Select Country.');
		document.STUnitDetailForm.country.focus();
		return false; 
		}

	if (document.STUnitDetailForm.country_state.selectedIndex == 0)
	{   alert('Error! Please Select State.');
		document.STUnitDetailForm.country_state.focus();
		return false; 
		}

	if (document.STUnitDetailForm.propertyCommunity.selectedIndex == 0)
	{   alert('Error! Please Select Community.');
		document.STUnitDetailForm.propertyCommunity.focus();
		return false; 
		}
	
	if (document.STUnitDetailForm.property_id.selectedIndex == 0)
	{   alert('Error! Please Select Property.');
		document.STUnitDetailForm.property_id.focus();
		return false; 
		}
	
	if (document.STUnitDetailForm.landlord_id.selectedIndex == 0)
	{   alert('Error! Please Select Landlord.');
		document.STUnitDetailForm.landlord_id.focus();
		return false; 
		}
		
	if (document.STUnitDetailForm.unit_type_id.selectedIndex == 0)
	{	alert('Error! Please select Unit Type.');
		document.STUnitDetailForm.unit_type_id.focus();
		return false; 
		}
	
	if (!document.STUnitDetailForm.property_unit_no.value)
	{	alert('Error! Please Input Unit #.');
		document.STUnitDetailForm.property_unit_no.focus();
		return false; }

	if (!document.STUnitDetailForm.property_builtup_area.value)
	{	alert('Error! Please Input Built-up area.');
		document.STUnitDetailForm.property_builtup_area.focus();
		return false; }
		
	if (document.STUnitDetailForm.unit_view_id.selectedIndex == 0)
	{	alert('Error! Please select Unit View.');
		document.STUnitDetailForm.unit_view_id.focus();
		return false; 
		}
		
	if (!document.STUnitDetailForm.property_consumer_no.value)
	{	alert('Error! Please Input Consumer No.');
		document.STUnitDetailForm.property_consumer_no.focus();
		return false; }
	
	if (document.STUnitDetailForm.bedroom_id.selectedIndex == 0)
	{	alert('Error! Please select Bedroom(s).');
		document.STUnitDetailForm.bedroom_id.focus();
		return false; 
	}

	if (document.STUnitDetailForm.property_image_file.value)
	{
		//Check Type of Image
		if(!/(\.jpg|\.gif|\.jpeg)$/i.test(document.STUnitDetailForm.property_image_file.value))
		{
			alert("Error! Property Image must be .jpg, .gif,.jpeg File format.");
			document.STUnitDetailForm.property_image_file.focus();
			return false;
		}
	}

	//Attacjment
	if (document.STUnitDetailForm.property_attachment_file.value)
	{	//Check Type of Image
		if(!/(\.zip|\.rar|\.doc|\.jpg|\.jpeg|\.gif|\.ppt|\.pdf|\.txt)$/i.test(document.STUnitDetailForm.property_attachment_file.value))
		{
			alert("Error! Property Map must be .jpg, .gif, .jpeg, .zip, .doc, .ppt, .pdf, .txt File format.");
			document.STUnitDetailForm.property_attachment_file.focus();
			return false;
		}
	}
	
	if (document.STUnitDetailForm.unit_view_id.referred_by_id == 0)
	{	alert('Error! Please select Referred by.');
		document.STUnitDetailForm.referred_by_id.focus();
		return false; 
		}
	
	if (!document.STUnitDetailForm.referred_date.value)
	{	alert('Error! Please Input Referred date.');
		document.STUnitDetailForm.referred_date.focus();
		return false; }
		
	if (!IsNumeric(document.STUnitDetailForm.daily_plan.value))
	{	alert('Error! Please Input Rent per Day in a correct Numeric Format without , separated.');
		document.STUnitDetailForm.daily_plan.focus();
		return false; }
	
	if (!IsNumeric(document.STUnitDetailForm.weekly_plan.value))
	{	alert('Error! Please Input Rent per Week in a correct Numeric Format without , separated.');
		document.STUnitDetailForm.weekly_plan.focus();
		return false; }

	if (!IsNumeric(document.STUnitDetailForm.monthly_plan.value))
	{	alert('Error! Please Input Rent per Month in a correct Numeric Format without , separated.');
		document.STUnitDetailForm.monthly_plan.focus();
		return false; }
	
	if (!IsNumeric(document.STUnitDetailForm.yearly_plan.value))
	{	alert('Error! Please Input Rent per Year in a correct Numeric Format without , separated.');
		document.STUnitDetailForm.yearly_plan.focus();
		return false; }
	
	if (!IsNumeric(document.STUnitDetailForm.security_deposit_amount.value))
	{	alert('Error! Please Input Security Deposit Amount in a correct Numeric Format without , separated.');
		document.STUnitDetailForm.security_deposit_amount.focus();
		return false; }
		
return true;
}


//for lease calculation for AED 
function LeaseCalculation()
{
	var rent_annual = document.propertyDetailForm.rent_annual.value;
	var security_deposit_amount = document.propertyDetailForm.security_deposit_amount.value;
	var comission_amount = document.propertyDetailForm.comission_amount.value;

	//if rent annual and deposit amount is exist	
	if(IsNumeric(document.propertyDetailForm.rent_annual.value) && IsNumeric(document.propertyDetailForm.security_deposit_amount.value))
	{
		document.propertyDetailForm.security_deposit_percentage.value = ((security_deposit_amount / rent_annual) * 100 ).toFixed(2);
	}
	//if rent annual and comission amount is exist
	if(IsNumeric(document.propertyDetailForm.rent_annual.value) && IsNumeric(document.propertyDetailForm.comission_amount.value))
	{
		document.propertyDetailForm.comission_percentage.value = ((comission_amount / rent_annual) * 100 ).toFixed(2);
	}
}

//for lease calculation for %age
function LeaseCalculation1()
{
	var rent_annual = document.propertyDetailForm.rent_annual.value;
	var security_deposit_percentage = document.propertyDetailForm.security_deposit_percentage.value;
	var comission_percentage = document.propertyDetailForm.comission_percentage.value;
	
	
	
	//if rent annual and deposit amount is exist	
	if(IsNumeric(document.propertyDetailForm.rent_annual.value))
	{
		document.propertyDetailForm.security_deposit_amount.value = ((security_deposit_percentage / 100) * rent_annual ).toFixed(2);
	}
	//if rent annual and comission amount is exist
	if(IsNumeric(document.propertyDetailForm.rent_annual.value))
	{
		document.propertyDetailForm.comission_amount.value = ((comission_percentage / 100) * rent_annual).toFixed(2);
	}
}

//for calcuation of ShortTerm Leasing reserve/booking Section
function stleaseReserveBookCalculaton(n)
{
	var no_of_days = Number(document.propertyDetailForm.no_of_days.value);
	var total_rent = Number(document.propertyDetailForm.total_rent.value);
	var rent_per_day = Number(document.propertyDetailForm.rent_per_day.value);
	var agency_fee_percentage = Number(document.propertyDetailForm.agency_fee_percentage.value);
	
	switch(n)
	{
		case 1: // calculate total_rent if rent_per_day and no_of_days are exist
			if(IsNumeric(document.propertyDetailForm.no_of_days.value))
			{
				var rent_per_day = Number(document.propertyDetailForm.rent_per_day.value);
				var total_rent = Number((rent_per_day * no_of_days).toFixed(2));
				document.propertyDetailForm.total_rent.value = total_rent;
				stleaseReserveBookCalculaton(3);
			}
			else
				document.propertyDetailForm.total_rent.value=0;
			break;
		case 2: // calculate if total_rent inputed then calculate Rent per day, rent per day calculated
			if(IsNumeric(document.propertyDetailForm.no_of_days.value))
			{
				var total_rent = Number(document.propertyDetailForm.total_rent.value);
				var rent_per_day = Number((total_rent / no_of_days).toFixed(2));
				document.propertyDetailForm.rent_per_day.value = rent_per_day;				
			}
			break;
		case 3: // calculate if agency fees percentage inputed
			if(IsNumeric(document.propertyDetailForm.total_rent.value))
			{
				var agency_fee_percentage = Number(document.propertyDetailForm.agency_fee_percentage.value);
				var agency_fee = Number(((agency_fee_percentage/100) * total_rent).toFixed(2));
				document.propertyDetailForm.agency_fee.value = agency_fee;
			}
			break;
		case 4: // if no of days changed
			if(IsNumeric(document.propertyDetailForm.rent_per_day.value))
			{
				stleaseReserveBookCalculaton(1);
				stleaseReserveBookCalculaton(3);
			}
			break;
		case 5: // if agency fees inputed then calculate agency_fees_percentage
			if(IsNumeric(document.propertyDetailForm.total_rent.value))
			{
				var agency_fee = Number(document.propertyDetailForm.agency_fee.value);
				var agency_fee_percentage = Number(((agency_fee/total_rent) * 100).toFixed(2));
				document.propertyDetailForm.agency_fee_percentage.value = agency_fee_percentage;
			}
			break;
		default:
	}
}

function stlease_manualcalculation()
{
	if(document.STUnitDetailForm.calculation.checked==true)
	{
		document.STUnitDetailForm.yearly_plan.value=0;
		document.STUnitDetailForm.daily_plan.value = 0;
		document.STUnitDetailForm.weekly_plan.value = 0;
		document.STUnitDetailForm.monthly_plan.value = 0;
		}
	}
//for calcuation of ShortTerm Leasing Section
function stleaseCalculaton(n)
{
	var daily_plan = Number(document.STUnitDetailForm.daily_plan.value);
	var weekly_plan = Number(document.STUnitDetailForm.weekly_plan.value);
	var monthly_plan = Number(document.STUnitDetailForm.monthly_plan.value);
	var yearly_plan = Number(document.STUnitDetailForm.yearly_plan.value);

	//alert(document.STUnitDetailForm.calculation.checked);
	
	switch(n)
	{
		case 6: // IF amount changed of deposit then percentage should be change automatically
			if(IsNumeric(document.STUnitDetailForm.monthly_plan.value) && document.STUnitDetailForm.monthly_plan.value!=0 && document.STUnitDetailForm.calculation.checked==false) //if monthly plan inputed then
			{
				var daily_rent = (monthly_plan + (0.30 * monthly_plan))/30;
				var weekly_rent = (monthly_plan + (0.15 * monthly_plan))/4.286;
				var yearly_rent = monthly_plan * 12;

				document.STUnitDetailForm.daily_plan.value = Math.round(daily_rent);
				document.STUnitDetailForm.weekly_plan.value = Math.round(weekly_rent);
				document.STUnitDetailForm.yearly_plan.value = Math.round(yearly_rent-(yearly_rent*0.05));
			}
			break;
		case 7: // IF amount changed of deposit then percentage should be change automatically
			if(IsNumeric(document.STUnitDetailForm.yearly_plan.value) && document.STUnitDetailForm.yearly_plan.value!=0 && document.STUnitDetailForm.calculation.checked==false) //if monthly plan inputed then
			{
				var daily_rent = 0;
				var weekly_rent = 0;
				var monthly_rent = 0;

					document.STUnitDetailForm.daily_plan.value = Math.round(daily_rent);
					document.STUnitDetailForm.weekly_plan.value = Math.round(weekly_rent);
					document.STUnitDetailForm.monthly_plan.value = Math.round(monthly_plan);
			}
			break;
		default:
	}
}

//for Sale calculation when input %age
function SaleCalculation(n)
{
	var orignal_price = Number(document.propertyDetailForm.orignal_price.value);

	var premium_to_seller = Number(document.propertyDetailForm.premium_to_seller.value);
	var premium_to_seller_percentage = document.propertyDetailForm.premium_to_seller_percentage.value;

	var agency_fee_seller = Number(document.propertyDetailForm.agency_fee_seller.value);
	var agency_fee_seller_percentage = document.propertyDetailForm.agency_fee_seller_percentage.value;

	var selling_price = Number(document.propertyDetailForm.selling_price.value);

	var agency_fee_buyer = Number(document.propertyDetailForm.agency_fee_buyer.value);
	var agency_fee_buyer_percentage = document.propertyDetailForm.agency_fee_buyer_percentage.value;

	var transfer_fee_buyer = Number(document.propertyDetailForm.transfer_fee_buyer.value);
	var transfer_fee_buyer_percentage = document.propertyDetailForm.transfer_fee_buyer_percentage.value;

	var transfer_fee_seller = Number(document.propertyDetailForm.transfer_fee_seller.value);
	var transfer_fee_seller_percentage = Number(document.propertyDetailForm.transfer_fee_seller_percentage.value);

	var transfer_fee_completed = Number(document.propertyDetailForm.transfer_fee_completed.value);
	var transfer_fee_completed_percentage = Number(document.propertyDetailForm.transfer_fee_completed_percentage.value);

	var seller_paid = Number(document.propertyDetailForm.seller_paid.value);
	var seller_paid_percentage = Number(document.propertyDetailForm.seller_paid_percentage.value);

	var due_amount_developer = Number(document.propertyDetailForm.due_amount_developer.value);
	var due_amount_developer_percentage = Number(document.propertyDetailForm.due_amount_developer_percentage.value);

	//Math.round(Number(n))
	switch(n)
	{
		case 1: // this case is being used to initialize 0 to all blank fields
				setdefaultvalue();
				SaleCalculation(2);

		case 2: // this case is being used to calculate premium_to_seller_percentage
				document.propertyDetailForm.premium_to_seller.value = Math.round(((premium_to_seller_percentage / 100) * orignal_price ).toFixed(0));
				SaleCalculation(3);

		case 3: // this case is being used to calculate agency_fee_seller_percentage		
				var agency_fee_seller = Number(((agency_fee_seller_percentage/100) * (orignal_price + premium_to_seller)).toFixed(0));
				document.propertyDetailForm.agency_fee_seller.value = Number(agency_fee_seller);
				//adding agency fee in selling price YES / NOT
				if(document.propertyDetailForm.add_agency_fee.selectedIndex == 1)
				document.propertyDetailForm.selling_price.value = Number(orignal_price + premium_to_seller + agency_fee_seller);
				else
				document.propertyDetailForm.selling_price.value = Number(orignal_price + premium_to_seller);

				SaleCalculation(4);
				
		case 4: // this case is being used to calculate agency_fee_buyer
				var agency_fee_buyer = Number(((agency_fee_buyer_percentage/100) * selling_price).toFixed(0));
				document.propertyDetailForm.agency_fee_buyer.value = agency_fee_buyer;
				SaleCalculation(5);
	
		case 5: // this case is being used to calculate transfer_fee_seller
				var transfer_fee_seller = Number(((transfer_fee_seller_percentage/100) * orignal_price).toFixed(0));
				document.propertyDetailForm.transfer_fee_seller.value = transfer_fee_seller;
				SaleCalculation(6);
				
		case 6: // this case is being used to calculate transfer_fee_buyer
				var transfer_fee_buyer = Number(((transfer_fee_buyer_percentage/100) * orignal_price).toFixed(0));
				document.propertyDetailForm.transfer_fee_buyer.value = transfer_fee_buyer;
				SaleCalculation(7);
							
		case 7: // this case is being used to calculate transfer_fee_completed
				var transfer_fee_completed = Number(((transfer_fee_completed_percentage/100) * selling_price).toFixed(0));
				document.propertyDetailForm.transfer_fee_completed.value = transfer_fee_completed;
				SaleCalculation(8);
				
		case 8: // this case is being used to calculate seller_paid_percentage
				var seller_paid = Number(((seller_paid_percentage/100) * orignal_price).toFixed(0));
				document.propertyDetailForm.seller_paid.value = seller_paid;
				
				//remaining amount will be in developer section
				document.propertyDetailForm.due_amount_developer_percentage.value = 100 - seller_paid_percentage;
				document.propertyDetailForm.due_amount_developer.value = orignal_price - seller_paid;				
		default:
		buyer_summary_calculation();
	}
	
/*	//if orignal price is inputed
	if(IsNumeric(orignal_price))
	document.propertyDetailForm.selling_price.value  = orignal_price;
	
	//if rent annual and deposit amount is exist	
	if(IsNumeric(orignal_price) && IsNumeric(premium_to_seller))
		document.propertyDetailForm.premium_to_seller_percentage.value = ((premium_to_seller / orignal_price) * 100 ).toFixed(2);

	//if rent annual and comission amount is exist	
	if(IsNumeric(orignal_price) && IsNumeric(agency_fee_seller))
		document.propertyDetailForm.agency_fee_seller_percentage.value = ((agency_fee_seller / (orignal_price+premium_to_seller)) * 100 ).toFixed(2);

	//sum all values selling_price	
	if((orignal_price) && (premium_to_seller) && (agency_fee_seller))
	document.propertyDetailForm.selling_price.value =  (orignal_price + premium_to_seller + agency_fee_seller);
	else if((orignal_price) && (premium_to_seller))
	document.propertyDetailForm.selling_price.value =  (orignal_price + premium_to_seller);
	else if((orignal_price) && (agency_fee_seller))
	document.propertyDetailForm.selling_price.value =  (orignal_price + agency_fee_seller);
	else
	{}

// if agency_fee_buyer and rental annual is exist	
	if(IsNumeric(selling_price) && IsNumeric(agency_fee_buyer))
		document.propertyDetailForm.agency_fee_buyer_percentage.value = ((agency_fee_buyer / selling_price) * 100 ).toFixed(2);		

	// if transfer_fee_buyer and rental annual is exist	
	if(IsNumeric(orignal_price) && IsNumeric(transfer_fee_buyer))
		document.propertyDetailForm.transfer_fee_buyer_percentage.value = ((transfer_fee_buyer / orignal_price) * 100 ).toFixed(2);		
	
	// if transfer_fee_completed and rental annual is exist	
	if(IsNumeric(orignal_price) && IsNumeric(transfer_fee_completed))
		document.propertyDetailForm.transfer_fee_buyer_percentage.value = ((transfer_fee_completed / orignal_price) * 100 ).toFixed(2);*/
}

function setdefaultvalue()
{
		if(!IsNumeric(document.propertyDetailForm.premium_to_seller.value))
		document.propertyDetailForm.premium_to_seller.value = 0;
		if(!IsNumeric(document.propertyDetailForm.premium_to_seller_percentage.value))
		document.propertyDetailForm.premium_to_seller_percentage.value = 0;

		if(!IsNumeric(document.propertyDetailForm.agency_fee_seller.value))
		document.propertyDetailForm.agency_fee_seller.value = 0;
		if(!IsNumeric(document.propertyDetailForm.agency_fee_seller_percentage.value))
		document.propertyDetailForm.agency_fee_seller_percentage.value = 0;
		
		if(!IsNumeric(!document.propertyDetailForm.selling_price.value))
		document.propertyDetailForm.selling_price.value = 0;
		
		if(!IsNumeric(document.propertyDetailForm.agency_fee_buyer.value))
		document.propertyDetailForm.agency_fee_buyer.value = 0;				
		if(!IsNumeric(document.propertyDetailForm.agency_fee_buyer_percentage.value))
		document.propertyDetailForm.agency_fee_buyer_percentage.value = 0;
		
		if(!IsNumeric(document.propertyDetailForm.transfer_fee_buyer.value))
		document.propertyDetailForm.transfer_fee_buyer.value = 0;				
		if(!IsNumeric(document.propertyDetailForm.transfer_fee_buyer_percentage.value))
		document.propertyDetailForm.transfer_fee_buyer_percentage.value = 0;
		
		if(!IsNumeric(document.propertyDetailForm.transfer_fee_seller.value))
		document.propertyDetailForm.transfer_fee_seller.value = 0;				
		if(!IsNumeric(document.propertyDetailForm.transfer_fee_seller_percentage.value))
		document.propertyDetailForm.transfer_fee_seller_percentage.value = 0;

		if(!IsNumeric(document.propertyDetailForm.transfer_fee_completed.value))
		document.propertyDetailForm.transfer_fee_completed.value = 0;				
		if(!IsNumeric(document.propertyDetailForm.transfer_fee_completed_percentage.value))
		document.propertyDetailForm.transfer_fee_completed_percentage.value = 0;

		if(!IsNumeric(document.propertyDetailForm.seller_paid.value))
		document.propertyDetailForm.seller_paid.value = 0;				
		if(!IsNumeric(document.propertyDetailForm.seller_paid_percentage.value))
		document.propertyDetailForm.seller_paid_percentage.value = 0;

		if(!IsNumeric(document.propertyDetailForm.due_amount_developer.value))
		document.propertyDetailForm.due_amount_developer.value = 0;
		if(!IsNumeric(document.propertyDetailForm.due_amount_developer_percentage.value))
		document.propertyDetailForm.due_amount_developer_percentage.value = 0;
}

//for Sale calculation when input dirham amount
function SaleCalculation1(n)
{
	var orignal_price = Number(document.propertyDetailForm.orignal_price.value);
	
	var premium_to_seller = Number(document.propertyDetailForm.premium_to_seller.value);
	var premium_to_seller_percentage = document.propertyDetailForm.premium_to_seller_percentage.value;
	
	var agency_fee_seller = Number(document.propertyDetailForm.agency_fee_seller.value);
	var agency_fee_seller_percentage = document.propertyDetailForm.agency_fee_seller_percentage.value;
	
	var selling_price = Number(document.propertyDetailForm.selling_price.value);
	
	var agency_fee_buyer = Number(document.propertyDetailForm.agency_fee_buyer.value);
	var agency_fee_buyer_percentage = document.propertyDetailForm.agency_fee_buyer_percentage.value;

	var transfer_fee_buyer = Number(document.propertyDetailForm.transfer_fee_buyer.value);
	var transfer_fee_buyer_percentage = document.propertyDetailForm.transfer_fee_buyer_percentage.value;

	var transfer_fee_seller = Number(document.propertyDetailForm.transfer_fee_seller.value);
	var transfer_fee_seller_percentage = Number(document.propertyDetailForm.transfer_fee_seller_percentage.value);

	var transfer_fee_completed = Number(document.propertyDetailForm.transfer_fee_completed.value);
	var transfer_fee_completed_percentage = Number(document.propertyDetailForm.transfer_fee_completed_percentage.value);
	
	var seller_paid = Number(document.propertyDetailForm.seller_paid.value);
	var seller_paid_percentage = Number(document.propertyDetailForm.seller_paid_percentage.value);

	var due_amount_developer = Number(document.propertyDetailForm.due_amount_developer.value);
	var due_amount_developer_percentage = Number(document.propertyDetailForm.due_amount_developer_percentage.value);

	switch(n)
	{
		case 1: // this case is being used to initialize 0 to all blank fields
				setdefaultvalue();
				SaleCalculation1(2);
		  		
		case 2: // this case is being used to calculate premium_to_seller_percentage
				document.propertyDetailForm.premium_to_seller_percentage.value = ((Number(document.propertyDetailForm.premium_to_seller.value) / Number(document.propertyDetailForm.orignal_price.value)) * 100 ).toFixed(2);
				SaleCalculation1(3);
				
		case 3: // this case is being used to calculate agency_fee_seller_percentage		
				var agency_fee_seller_percentage = (Number(document.propertyDetailForm.agency_fee_seller.value)/(Number(document.propertyDetailForm.orignal_price.value) + Number(document.propertyDetailForm.premium_to_seller.value)) * 100).toFixed(2);
				document.propertyDetailForm.agency_fee_seller_percentage.value = agency_fee_seller_percentage;
				
				//adding agency fee in selling price YES / NOT
				if(document.propertyDetailForm.add_agency_fee.selectedIndex == 1)
				document.propertyDetailForm.selling_price.value = Number(document.propertyDetailForm.orignal_price.value) + Number(document.propertyDetailForm.premium_to_seller.value) + Number(document.propertyDetailForm.agency_fee_seller.value);
				else
				document.propertyDetailForm.selling_price.value = Number(document.propertyDetailForm.orignal_price.value) + Number(document.propertyDetailForm.premium_to_seller.value);
				SaleCalculation1(4);
					
		case 4: // this case is being used to calculate agency_fee_buyer
				var agency_fee_buyer_percentage = Number(((agency_fee_buyer/selling_price) * 100).toFixed(2));
				document.propertyDetailForm.agency_fee_buyer_percentage.value = agency_fee_buyer_percentage;
				SaleCalculation1(5);
							
		case 5: // this case is being used to calculate transfer_fee_seller
		
				var transfer_fee_seller_percentage = Number(((transfer_fee_seller/orignal_price) * 100 ).toFixed(2));
				document.propertyDetailForm.transfer_fee_seller_percentage.value = transfer_fee_seller_percentage;
				
				//calculate transfer/Reg fee of buyer according to given percentage value
				var transfer_fee_buyer = ((transfer_fee_buyer_percentage/100) * Number(document.propertyDetailForm.orignal_price.value)).toFixed(2);
				document.propertyDetailForm.transfer_fee_buyer.value = transfer_fee_buyer;

				//calculate transfer/Reg fee of buyer according to given percentage value
				var transfer_fee_completed = ((transfer_fee_completed_percentage/100) * Number(document.propertyDetailForm.selling_price.value)).toFixed(2);
				document.propertyDetailForm.transfer_fee_completed.value = transfer_fee_completed;

				var seller_paid = ((Number(document.propertyDetailForm.seller_paid_percentage.value)/100) * Number(document.propertyDetailForm.orignal_price.value)).toFixed(2);
				document.propertyDetailForm.seller_paid.value = seller_paid;

				//remaining amount will be in developer section
				document.propertyDetailForm.due_amount_developer_percentage.value = 100 - seller_paid_percentage;
				document.propertyDetailForm.due_amount_developer.value = Number(document.propertyDetailForm.orignal_price.value) - seller_paid;				
				
				//alculate Buyer Summary Section		
				buyer_summary_calculation();
				return;
				
		case 6: // this case is being used to calculate transfer_fee_buyer
				var transfer_fee_buyer_percentage = Number(((transfer_fee_buyer/orignal_price) * 100).toFixed(2));
				document.propertyDetailForm.transfer_fee_buyer_percentage.value = transfer_fee_buyer_percentage;

				//calculate transfer/Reg fee of buyer according to given percentage value
				var transfer_fee_completed = ((transfer_fee_completed_percentage/100) * Number(document.propertyDetailForm.selling_price.value)).toFixed(2);
				document.propertyDetailForm.transfer_fee_completed.value = transfer_fee_completed;

				var seller_paid = ((Number(document.propertyDetailForm.seller_paid_percentage.value)/100) * Number(document.propertyDetailForm.orignal_price.value)).toFixed(2);
				document.propertyDetailForm.seller_paid.value = seller_paid;

				//remaining amount will be in developer section
				document.propertyDetailForm.due_amount_developer_percentage.value = 100 - seller_paid_percentage;
				document.propertyDetailForm.due_amount_developer.value = Number(document.propertyDetailForm.orignal_price.value) - seller_paid;				
				
				//alculate Buyer Summary Section		
				buyer_summary_calculation();
				return;
							
		case 7: // this case is being used to calculate transfer_fee_completed
				var transfer_fee_completed_percentage = Number(((transfer_fee_completed/selling_price) * 100).toFixed(2));
				document.propertyDetailForm.transfer_fee_completed_percentage.value = transfer_fee_completed_percentage;

				var seller_paid = ((Number(document.propertyDetailForm.seller_paid_percentage.value)/100) * Number(document.propertyDetailForm.orignal_price.value)).toFixed(2);
				document.propertyDetailForm.seller_paid.value = seller_paid;

				//remaining amount will be in developer section
				document.propertyDetailForm.due_amount_developer_percentage.value = 100 - seller_paid_percentage;
				document.propertyDetailForm.due_amount_developer.value = Number(document.propertyDetailForm.orignal_price.value) - seller_paid;				
				
				//alculate Buyer Summary Section		
				buyer_summary_calculation();
				return;
				
		case 8: // this case is being used to calculate seller_paid_percentage & seller_paid				
				var seller_paid_percentage = Number(((seller_paid/orignal_price) * 100).toFixed(2));
				document.propertyDetailForm.seller_paid_percentage.value = seller_paid_percentage;
				
				//remaining amount will be in developer section
				document.propertyDetailForm.due_amount_developer_percentage.value = 100 - seller_paid_percentage;
				document.propertyDetailForm.due_amount_developer.value = orignal_price - seller_paid;
				//alculate Buyer Summary Section		
				buyer_summary_calculation();
				return;
		case 9:
				//calculate premium_to_seller on the basis of premium_to_seller_percentage	
				document.propertyDetailForm.premium_to_seller.value = ((premium_to_seller_percentage / 100) * Number(document.propertyDetailForm.orignal_price.value)).toFixed(2);
				document.propertyDetailForm.agency_fee_seller.value = ((agency_fee_seller_percentage/100)*(Number(document.propertyDetailForm.orignal_price.value)  + Number(document.propertyDetailForm.premium_to_seller.value))).toFixed(2);
				
				//adding agency fee in selling price YES / NOT
				if(document.propertyDetailForm.add_agency_fee.selectedIndex == 1)
				document.propertyDetailForm.selling_price.value = Number(document.propertyDetailForm.orignal_price.value) + Number(document.propertyDetailForm.premium_to_seller.value) + Number(document.propertyDetailForm.agency_fee_seller.value);
				else
				document.propertyDetailForm.selling_price.value = Number(document.propertyDetailForm.orignal_price.value) + Number(document.propertyDetailForm.premium_to_seller.value);
				
				//calculate agency_fee_buyer but percentage remain same
				var agency_fee_buyer = ((Number(document.propertyDetailForm.agency_fee_buyer_percentage.value)/100) * Number(document.propertyDetailForm.selling_price.value)).toFixed(2);
				document.propertyDetailForm.agency_fee_buyer.value = agency_fee_buyer;
				
				//calculate transfer/Reg fee of seller according to given percentage value
				var transfer_fee_seller = ((transfer_fee_seller_percentage/100) * Number(document.propertyDetailForm.orignal_price.value)).toFixed(2);
				document.propertyDetailForm.transfer_fee_seller.value = transfer_fee_seller;

				//calculate transfer/Reg fee of buyer according to given percentage value
				var transfer_fee_buyer = ((transfer_fee_buyer_percentage/100) * Number(document.propertyDetailForm.orignal_price.value)).toFixed(2);
				document.propertyDetailForm.transfer_fee_buyer.value = transfer_fee_buyer;

				//calculate transfer/Reg fee of buyer according to given percentage value
				var transfer_fee_completed = ((transfer_fee_completed_percentage/100) * Number(document.propertyDetailForm.selling_price.value)).toFixed(2);
				document.propertyDetailForm.transfer_fee_completed.value = transfer_fee_completed;

				var seller_paid = ((Number(document.propertyDetailForm.seller_paid_percentage.value)/100) * Number(document.propertyDetailForm.orignal_price.value)).toFixed(2);
				document.propertyDetailForm.seller_paid.value = seller_paid;

				//remaining amount will be in developer section
				document.propertyDetailForm.due_amount_developer_percentage.value = 100 - seller_paid_percentage;
				document.propertyDetailForm.due_amount_developer.value = Number(document.propertyDetailForm.orignal_price.value) - seller_paid;
				
				//alculate Buyer Summary Section		
				buyer_summary_calculation();
				return;
		case 10: // this case is being used to calculate agency_fee_seller using %age value	
				//adding agency fee in selling price YES / NOT
				if(document.propertyDetailForm.add_agency_fee.selectedIndex == 1)
				document.propertyDetailForm.selling_price.value = Number(document.propertyDetailForm.orignal_price.value) + Number(document.propertyDetailForm.premium_to_seller.value) + Number(document.propertyDetailForm.agency_fee_seller.value);
				else
				document.propertyDetailForm.selling_price.value = Number(document.propertyDetailForm.orignal_price.value) + Number(document.propertyDetailForm.premium_to_seller.value);
				//calculate agency_fee_buyer but percentage remain same
				var agency_fee_buyer = ((Number(document.propertyDetailForm.agency_fee_buyer_percentage.value)/100) * Number(document.propertyDetailForm.selling_price.value)).toFixed(2);
				document.propertyDetailForm.agency_fee_buyer.value = agency_fee_buyer;
				
				//calculate transfer/Reg fee of seller according to given percentage value
				var transfer_fee_seller = ((transfer_fee_seller_percentage/100) * Number(document.propertyDetailForm.orignal_price.value)).toFixed(2);
				document.propertyDetailForm.transfer_fee_seller.value = transfer_fee_seller;

				//calculate transfer/Reg fee of buyer according to given percentage value
				var transfer_fee_buyer = ((transfer_fee_buyer_percentage/100) * Number(document.propertyDetailForm.orignal_price.value)).toFixed(2);
				document.propertyDetailForm.transfer_fee_buyer.value = transfer_fee_buyer;

				//calculate transfer/Reg fee of buyer according to given percentage value
				var transfer_fee_completed = ((transfer_fee_completed_percentage/100) * Number(document.propertyDetailForm.selling_price.value)).toFixed(2);
				document.propertyDetailForm.transfer_fee_completed.value = transfer_fee_completed;

				var seller_paid = ((Number(document.propertyDetailForm.seller_paid_percentage.value)/100) * Number(document.propertyDetailForm.orignal_price.value)).toFixed(2);
				document.propertyDetailForm.seller_paid.value = seller_paid;

				//remaining amount will be in developer section
				document.propertyDetailForm.due_amount_developer_percentage.value = 100 - seller_paid_percentage;
				document.propertyDetailForm.due_amount_developer.value = Number(document.propertyDetailForm.orignal_price.value) - seller_paid;				
				
				//alculate Buyer Summary Section		
				buyer_summary_calculation();
				return;
				
			case 11: // if premium to seller amount changed then calculate rest of amount accordingly

				//if amount inputed then calculate premium_to_seller_percentage
				document.propertyDetailForm.premium_to_seller_percentage.value = ((Number(document.propertyDetailForm.premium_to_seller.value)/Number(document.propertyDetailForm.orignal_price.value))*100).toFixed(2);

				document.propertyDetailForm.agency_fee_seller.value = ((agency_fee_seller_percentage/100)*(Number(document.propertyDetailForm.orignal_price.value)  + Number(document.propertyDetailForm.premium_to_seller.value))).toFixed(0);

				//adding agency fee in selling price YES / NOT
				if(document.propertyDetailForm.add_agency_fee.selectedIndex == 1)
				document.propertyDetailForm.selling_price.value = Number(document.propertyDetailForm.orignal_price.value) + Number(document.propertyDetailForm.premium_to_seller.value) + Number(document.propertyDetailForm.agency_fee_seller.value);
				else
				document.propertyDetailForm.selling_price.value = Number(document.propertyDetailForm.orignal_price.value) + Number(document.propertyDetailForm.premium_to_seller.value);

				//calculate agency_fee_buyer accordingly agency_fee_buyer_percentage
				var agency_fee_buyer = ((agency_fee_buyer_percentage/100) * Number(document.propertyDetailForm.selling_price.value).toFixed(2));
				document.propertyDetailForm.agency_fee_buyer.value = agency_fee_buyer;

				//calculate transfer/Reg fee of seller according to given percentage value
				var transfer_fee_seller = ((transfer_fee_seller_percentage/100) * Number(document.propertyDetailForm.orignal_price.value)).toFixed(2);
				document.propertyDetailForm.transfer_fee_seller.value = transfer_fee_seller;

				//calculate transfer/Reg fee of buyer according to given percentage value
				var transfer_fee_buyer = ((transfer_fee_buyer_percentage/100) * Number(document.propertyDetailForm.orignal_price.value)).toFixed(2);
				document.propertyDetailForm.transfer_fee_buyer.value = transfer_fee_buyer;

				//calculate transfer/Reg fee of buyer according to given percentage value
				var transfer_fee_completed = ((transfer_fee_completed_percentage/100) * Number(document.propertyDetailForm.selling_price.value)).toFixed(2);
				document.propertyDetailForm.transfer_fee_completed.value = transfer_fee_completed;
				

				var seller_paid = ((Number(document.propertyDetailForm.seller_paid_percentage.value)/100) * Number(document.propertyDetailForm.orignal_price.value)).toFixed(2);
				document.propertyDetailForm.seller_paid.value = seller_paid;

				//remaining amount will be in developer section
				document.propertyDetailForm.due_amount_developer_percentage.value = 100 - seller_paid_percentage;
				document.propertyDetailForm.due_amount_developer.value = Number(document.propertyDetailForm.orignal_price.value) - seller_paid;
				
				//alculate Buyer Summary Section		
				buyer_summary_calculation();
				return;
				
		case 12:
				var transfer_fee_completed = ((Number(document.propertyDetailForm.transfer_fee_completed_percentage.value)/100) * Number(document.propertyDetailForm.selling_price.value)).toFixed(0);
				document.propertyDetailForm.transfer_fee_completed.value = transfer_fee_completed;
				
				//alculate Buyer Summary Section		
				buyer_summary_calculation();
				return;
				/*var seller_paid_percentage = ((Number(document.propertyDetailForm.seller_paid.value)/Number(document.propertyDetailForm.orignal_price.value)) * 100).toFixed(2);
				document.propertyDetailForm.seller_paid_percentage.value = seller_paid_percentage;

				//remaining amount will be in developer section
				document.propertyDetailForm.due_amount_developer_percentage.value = 100 - seller_paid_percentage;
				document.propertyDetailForm.due_amount_developer.value = orignal_price - seller_paid;*/
		case 13:
				//calculate agency_fee_seller_percentage 
				document.propertyDetailForm.agency_fee_seller_percentage.value = (Number(document.propertyDetailForm.agency_fee_seller.value)/(Number(document.propertyDetailForm.orignal_price.value)  + Number(document.propertyDetailForm.premium_to_seller.value)) * 100).toFixed(2);

				//adding agency fee in selling price YES / NOT
				if(document.propertyDetailForm.add_agency_fee.selectedIndex == 1)
				document.propertyDetailForm.selling_price.value = Number(document.propertyDetailForm.orignal_price.value) + Number(document.propertyDetailForm.premium_to_seller.value) + Number(document.propertyDetailForm.agency_fee_seller.value);
				else
				document.propertyDetailForm.selling_price.value = Number(document.propertyDetailForm.orignal_price.value) + Number(document.propertyDetailForm.premium_to_seller.value);

				//calculate agency_fee_buyer accordingly agency_fee_buyer_percentage
				var agency_fee_buyer = ((agency_fee_buyer_percentage/100) * Number(document.propertyDetailForm.selling_price.value).toFixed(2));
				document.propertyDetailForm.agency_fee_buyer.value = agency_fee_buyer;

				//calculate transfer/Reg fee of seller according to given percentage value
				var transfer_fee_seller = ((transfer_fee_seller_percentage/100) * Number(document.propertyDetailForm.orignal_price.value)).toFixed(2);
				document.propertyDetailForm.transfer_fee_seller.value = transfer_fee_seller;

				//calculate transfer/Reg fee of buyer according to given percentage value
				var transfer_fee_buyer = ((transfer_fee_buyer_percentage/100) * Number(document.propertyDetailForm.orignal_price.value)).toFixed(2);
				document.propertyDetailForm.transfer_fee_buyer.value = transfer_fee_buyer;

				//calculate transfer/Reg fee of buyer according to given percentage value
				var transfer_fee_completed = ((transfer_fee_completed_percentage/100) * Number(document.propertyDetailForm.selling_price.value)).toFixed(2);
				document.propertyDetailForm.transfer_fee_completed.value = transfer_fee_completed;

				var seller_paid = ((Number(document.propertyDetailForm.seller_paid_percentage.value)/100) * Number(document.propertyDetailForm.orignal_price.value)).toFixed(2);
				document.propertyDetailForm.seller_paid.value = seller_paid;

				//remaining amount will be in developer section
				document.propertyDetailForm.due_amount_developer_percentage.value = 100 - seller_paid_percentage;
				document.propertyDetailForm.due_amount_developer.value = Number(document.propertyDetailForm.orignal_price.value) - seller_paid;
				
				//alculate Buyer Summary Section		
				buyer_summary_calculation();
				return;
				
		case 14:
				var agency_fee_buyer_percentage = Number(((agency_fee_buyer/selling_price) * 100).toFixed(2));
				document.propertyDetailForm.agency_fee_buyer_percentage.value = agency_fee_buyer_percentage;

				/*//calculate agency_fee_buyer accordingly agency_fee_buyer_percentage
				var agency_fee_buyer = ((agency_fee_buyer_percentage/100) * Number(document.propertyDetailForm.selling_price.value).toFixed(2));
				document.propertyDetailForm.agency_fee_buyer.value = agency_fee_buyer;*/

				//calculate transfer/Reg fee of seller according to given percentage value
				var transfer_fee_seller = ((transfer_fee_seller_percentage/100) * Number(document.propertyDetailForm.orignal_price.value)).toFixed(2);
				document.propertyDetailForm.transfer_fee_seller.value = transfer_fee_seller;

				//calculate transfer/Reg fee of buyer according to given percentage value
				var transfer_fee_buyer = ((transfer_fee_buyer_percentage/100) * Number(document.propertyDetailForm.orignal_price.value)).toFixed(2);
				document.propertyDetailForm.transfer_fee_buyer.value = transfer_fee_buyer;

				//calculate transfer/Reg fee of buyer according to given percentage value
				var transfer_fee_completed = ((transfer_fee_completed_percentage/100) * Number(document.propertyDetailForm.selling_price.value)).toFixed(2);
				document.propertyDetailForm.transfer_fee_completed.value = transfer_fee_completed;

				var seller_paid = ((Number(document.propertyDetailForm.seller_paid_percentage.value)/100) * Number(document.propertyDetailForm.orignal_price.value)).toFixed(2);
				document.propertyDetailForm.seller_paid.value = seller_paid;

				//remaining amount will be in developer section
				document.propertyDetailForm.due_amount_developer_percentage.value = 100 - seller_paid_percentage;
				document.propertyDetailForm.due_amount_developer.value = Number(document.propertyDetailForm.orignal_price.value) - seller_paid;
		
				//alculate Buyer Summary Section		
				buyer_summary_calculation();
				return;
		default:

	}
	
				
/*	//if orignal price is inputed
	if(IsNumeric(orignal_price))
	document.propertyDetailForm.selling_price.value  = orignal_price;
	
	//if rent annual and deposit amount is exist	
	if(IsNumeric(orignal_price) && IsNumeric(premium_to_seller))
		document.propertyDetailForm.premium_to_seller_percentage.value = ((premium_to_seller / orignal_price) * 100 ).toFixed(2);

	//if rent annual and comission amount is exist	
	if(IsNumeric(orignal_price) && IsNumeric(agency_fee_seller))
		document.propertyDetailForm.agency_fee_seller_percentage.value = ((agency_fee_seller / (orignal_price+premium_to_seller)) * 100 ).toFixed(2);

	//sum all values selling_price	
	if((orignal_price) && (premium_to_seller) && (agency_fee_seller))
	document.propertyDetailForm.selling_price.value =  (orignal_price + premium_to_seller + agency_fee_seller);
	else if((orignal_price) && (premium_to_seller))
	document.propertyDetailForm.selling_price.value =  (orignal_price + premium_to_seller);
	else if((orignal_price) && (agency_fee_seller))
	document.propertyDetailForm.selling_price.value =  (orignal_price + agency_fee_seller);
	else
	{}

// if agency_fee_buyer and rental annual is exist	
	if(IsNumeric(selling_price) && IsNumeric(agency_fee_buyer))
		document.propertyDetailForm.agency_fee_buyer_percentage.value = ((agency_fee_buyer / selling_price) * 100 ).toFixed(2);		

	// if transfer_fee_buyer and rental annual is exist	
	if(IsNumeric(orignal_price) && IsNumeric(transfer_fee_buyer))
		document.propertyDetailForm.transfer_fee_buyer_percentage.value = ((transfer_fee_buyer / orignal_price) * 100 ).toFixed(2);		
	
	// if transfer_fee_completed and rental annual is exist	
	if(IsNumeric(orignal_price) && IsNumeric(transfer_fee_completed))
		document.propertyDetailForm.transfer_fee_buyer_percentage.value = ((transfer_fee_completed / orignal_price) * 100 ).toFixed(2);*/
}

function buyer_summary_calculation()
{
	//buyer summary section detial
		//To seller (AED)
		if(document.propertyDetailForm.add_agency_fee.selectedIndex == 1)
		{
			if(IsNumeric(document.propertyDetailForm.premium_to_seller.value) || IsNumeric(document.propertyDetailForm.agency_fee_seller.value))
			{
				document.propertyDetailForm.buyer_to_seller.value = Math.round(Number(document.propertyDetailForm.premium_to_seller.value) + Number(document.propertyDetailForm.agency_fee_seller.value)+ Number(document.propertyDetailForm.seller_paid.value)); }
		}
		else
		{
			document.propertyDetailForm.buyer_to_seller.value = Math.round(Number(document.propertyDetailForm.premium_to_seller.value) + Number(document.propertyDetailForm.seller_paid.value));
			}

		//To developer upon transfer (AED)
		if(IsNumeric(document.propertyDetailForm.due_amount_developer.value))
		document.propertyDetailForm.buyer_developer_transfer.value = Math.round(Number(document.propertyDetailForm.transfer_fee_buyer.value));

		//To developer (AED)
		if(IsNumeric(document.propertyDetailForm.due_amount_developer.value))
		document.propertyDetailForm.buyer_to_developer.value = Math.round(Number(document.propertyDetailForm.due_amount_developer.value));

		//buyer_to_company
		if(IsNumeric(document.propertyDetailForm.agency_fee_buyer.value))
		document.propertyDetailForm.buyer_to_company.value = Math.round(Number(document.propertyDetailForm.agency_fee_buyer.value));

		//Transfer Fee (completed & paid prop)
		if(IsNumeric(document.propertyDetailForm.transfer_fee_completed.value))
		document.propertyDetailForm.buyer_transfer_fee_completed.value = Math.round(Number(document.propertyDetailForm.transfer_fee_completed.value));

		//Transfer Fee (completed & paid prop)
		if(IsNumeric(document.propertyDetailForm.transfer_fee_completed.value))
		document.propertyDetailForm.buyer_transfer_fee_completed.value = Math.round(Number(document.propertyDetailForm.transfer_fee_completed.value));

		//To developer upon transfer (transfer fee) (AED) percentage
		if(IsNumeric(document.propertyDetailForm.transfer_fee_buyer.value))
		document.propertyDetailForm.buyer_developer_transfer_percentage.value = Math.round(Number(document.propertyDetailForm.transfer_fee_buyer_percentage.value));

		//To Company (agency fee) percentage
		if(IsNumeric(document.propertyDetailForm.agency_fee_buyer_percentage.value))
		document.propertyDetailForm.buyer_to_company_percentage.value = Math.round(Number(document.propertyDetailForm.agency_fee_buyer_percentage.value));
		
		//Transfer Fee (completed & paid prop) percentage
		if(IsNumeric(document.propertyDetailForm.transfer_fee_completed_percentage.value))
		document.propertyDetailForm.buyer_transfer_fee_completed_percentage.value = Math.round(Number(document.propertyDetailForm.transfer_fee_completed_percentage.value));


		//total
		document.propertyDetailForm.buyer_total.value = Number(document.propertyDetailForm.buyer_to_seller.value) + Number(document.propertyDetailForm.buyer_developer_transfer.value) + Number(document.propertyDetailForm.buyer_to_developer.value) + Number(document.propertyDetailForm.buyer_to_company.value) + Number(document.propertyDetailForm.buyer_transfer_fee_completed.value);
		
		//total of selling_price (its not calculating in calulation1() and calculation() function)
		//adding agency fee in selling price YES / NOT
		if(document.propertyDetailForm.add_agency_fee.selectedIndex == 1)
		document.propertyDetailForm.selling_price.value = Number(document.propertyDetailForm.orignal_price.value)  + Number(document.propertyDetailForm.premium_to_seller.value) + Number(document.propertyDetailForm.agency_fee_seller.value);
		else
		document.propertyDetailForm.selling_price.value = Number(document.propertyDetailForm.orignal_price.value)  + Number(document.propertyDetailForm.premium_to_seller.value);
				
	}
//Calculate Date Difference in days
function CalculateDuration()
{
	var dtStDate = document.propertyDetailForm.contract_start_date.value;	
    var dtEndDate = document.propertyDetailForm.contract_end_date.value;	
 	var one_day=1000*60*60*24;  
	var today=new Date('Y:m:d');

	alert(today);
  //if(dtStDate !="NaN" &&  dtEndDate !="NaN")
  //document.propertyDetailForm.no_of_days.value=Math.ceil((dtEndDate.getTime()-dtStDate.getTime())/(one_day));
}

//onclick="if (confirm('Are you sure, you want to Vacant this Unit ?')) {return true;} else {return false;}"

//show only selected domains users
function showDomainUser()
{ 
 	window.location = 'index.php?pg=ManageUsers&domainid=' + document.userlistform.domain_id.value;
}

function checkemailToFriend()
{	
	
	if (!document.emailToFriend.senderName.value)
	{
			alert('Error! Please Input Sender Name.');
			document.emailToFriend.senderName.focus();
			return false; }

	
	if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(emailToFriend.senderEmail.value))
	{
			alert("Invalid sender E-mail Address! Please re-enter.")
			document.emailToFriend.senderEmail.focus();
			return false;		
	}
	
	if (!document.emailToFriend.subject.value)
	{
		alert('Error! Please Input Subject.');
		document.emailToFriend.subject.focus();
		return false; }


	if (!document.emailToFriend.receiverName.value)
	{
		alert('Error! Please Input Receiver Name.');
		document.emailToFriend.receiverName.focus();
		return false; }

	
	if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(emailToFriend.receiverEmail.value))
	{
			alert("Invalid receiver E-mail Address! Please re-enter.")
			document.emailToFriend.receiverEmail.focus();
			return false;		
	}

	if (document.emailToFriend.scode.value!=document.emailToFriend.securityCode.value)
	{	alert('Error! Input Correct security code.');
		document.emailToFriend.securityCode.focus();
		return false; }
	
	return true;
}

function checkSendRequest()
{	
	
	if (!document.sendRequest.senderName.value)
	{
			alert('Error! Please Input Sender Name.');
			document.sendRequest.senderName.focus();
			return false; }

	
	if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(sendRequest.senderEmail.value))
	{
			alert("Invalid sender E-mail Address! Please re-enter.")
			document.sendRequest.senderEmail.focus();
			return false;		
	}
	

	if (document.sendRequest.scode.value!=document.sendRequest.securityCode.value)
	{	alert('Error! Input Correct security code.');
		document.sendRequest.securityCode.focus();
		return false; }
	
	return true;
}

function showLeaseDiv()
{
	if (document.propertyDetailForm.property_leased.selectedIndex == 1)
	leasediv.style.display="block";	
	
	
	if (document.propertyDetailForm.property_leased.selectedIndex == 2)
	leasediv.style.display="none";
}

//div function for incEditUnit.php
function showPaymentPlanDiv()
{
	paymentplan.style.display="block";		
	}

function hidePaymentPlanDiv()
{
	paymentplan.style.display="none";		
	}

function showGalleryDiv()
{
	gallery.style.display="block";		
	}

function hideGalleryDiv()
{
	gallery.style.display="none";		
	}

function showVirtualGalleryDiv()
{
	vtgallery.style.display="block";		
	}

function hideVirtualGalleryDiv()
{
	vtgallery.style.display="none";		
	}

function showSpecificationDiv()
{
	specification.style.display="block";		
	}

function hideSpecificationDiv()
{
	specification.style.display="none";		
	}

function showFinanceDiv()
{
	finance.style.display="block";		
	}

function hideFinanceDiv()
{
	finance.style.display="none";		
	}

function showBuyerSummaryDiv()
{
	buyersummary.style.display="block";		
	}

function hideBuyerSummaryDiv()
{
	buyersummary.style.display="none";		
	}

function checkAddpropertyDetailForm()
{
	if (!document.addpropertyDetailForm.property_name.value)
	{	alert('Error! Please Input Property Name.');
		document.addpropertyDetailForm.property_name.focus();
		return false; }

	if (document.addpropertyDetailForm.country.selectedIndex == 0)
	{   alert('Error! Please Select Country.');
		document.addpropertyDetailForm.country.focus();
		return false; 
		}
	
	if (document.addpropertyDetailForm.country_state.selectedIndex == 0)
	{   alert('Error! Please Select State.');
		document.addpropertyDetailForm.country_state.focus();
		return false; 
		}

	if (document.addpropertyDetailForm.propertyCommunity.selectedIndex == 0)
	{   alert('Error! Please Select Community.');
		document.addpropertyDetailForm.propertyCommunity.focus();
		return false; 
		}

return true;
}

function checksellerform()
{
	if (!document.addSellerForm.c_name.value)
	{	alert('Error! Please Input Seller Name.');
		document.addSellerForm.c_name.focus();
		return false; }
	
	if (!document.addSellerForm.c_phone.value)
	{	alert('Error! Please Input Seller Phone #.');
		document.addSellerForm.c_phone.focus();
		return false; }
	
	if (!document.addSellerForm.c_mobile.value)
	{	alert('Error! Please Input Seller Mobile #.');
		 document.addSellerForm.c_mobile.focus();
		 return false; }

	if (document.addSellerForm.c_email.value)
	{
		if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(addSellerForm.c_email.value))
		{
			alert("Invalid E-mail Address! Please re-enter.")
			document.addSellerForm.c_email.focus();
			return false; }
	}
		
	if (document.addSellerForm.c_nationality_id.selectedIndex == 0)
	{	alert('Error! Please select Nationality.');
		 document.addSellerForm.c_nationality_id.focus();
		 return false; }

	if (document.addSellerForm.referred_by_id.selectedIndex == 0)
	{	alert('Error! Please select Referred by.');
		 document.addSellerForm.referred_by_id.focus();
		 return false; }
		 
return true;
}


function checklandlordform()
{
	if (!document.addLandlordForm.c_name.value)
	{	alert('Error! Please Input Landlord Name.');
		document.addLandlordForm.c_name.focus();
		return false; }

	if (!document.addLandlordForm.c_phone.value)
	{	alert('Error! Please Input Landlord Phone #.');
		document.addLandlordForm.c_phone.focus();
		return false; }

	if (!document.addLandlordForm.c_mobile.value)
	{	alert('Error! Please Input Landlord Mobile #.');
		 document.addLandlordForm.c_mobile.focus();
		 return false; }

	if (document.addLandlordForm.c_email.value)
	{
		if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(addLandlordForm.c_email.value))
		{
			alert("Invalid E-mail Address! Please re-enter.")
			document.addLandlordForm.c_email.focus();
			return false; }
	}

	if (document.addLandlordForm.c_nationality_id.selectedIndex == 0)
	{	alert('Error! Please select Nationality.');
		 document.addLandlordForm.c_nationality_id.focus();
		 return false; }

return true;
}

function isValidURL(url) {
	var urlRegxp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
	
	if (urlRegxp.test(url) != true) {
		return false;
	} else {
		return true;
	}
}
