	// JavaScript Document
	
	/**
	 * Function to check is field empty
	 *
	 * @Param txtfield errmsg
	 * $Return true or false 
	 */
	function isFieldEmpty (txtfield,errmsg)	{
		if(trim($(txtfield).value) == ""){
			$("divRegisterError").style.display="block";
			$("divRegisterError").className="Errormsg";
			$("divRegisterError").innerHTML=errmsg;
			$(txtfield).focus();
			return false;
		}
	}
	//Phone Number validation
	function isPhoneNumber(qty){
			if (qty.match(/^[0-9\-\/]+$/)){
			if(qty.match(/^[/]/)){
				return false;
			}else{
				return true;
			}
		}else{
			return false;
		}
	}
	/**
	 * Function for hide message Div
	 *
	 * @Param Null
	 * $Return true or false 
	 */
	function hideRegerror_msg ()
	{
		$('divRegisterError').style.display='none';
	}
	/**
	 * Function to check  Valid Email
	 *
	 * @Param email
	 * $Return true or false 
	 */
	function isValidEmail (email){
		var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
		if (filter.test(email)){
			return true;
		}else{
			return false;
		}
		
	}
	/**
	 * Function to Save and validate tour operators details 
	 *
	 * @Param Null
	 * $Return true or false 
	 */
	function Accept_tour_operator () { 
	
		if(isFieldEmpty("Ufname","Please enter your full name")==false){
			$('Ufname').style.backgroundColor= "#FEEA83"; 
			return false;
		}
		if(isNaN($('Ufname').value)	==	'')	{
			$('divRegisterError').style.display	=	"block";
			$('divRegisterError').innerHTML	=	"You are entered disallowed characters";
			$('Ufname').style.backgroundColor= "#FEEA83";
			$('Ufname').select();
			return;
		}
		if(isFieldEmpty("Uemail","Please enter your email address")==false){
			$('Uemail').style.backgroundColor= "#FEEA83";
			return false;
		}
		if(!isValidEmail($('Uemail').value)) {
			$('divRegisterError').style.display ='block';
			$('divRegisterError').innerHTML="Please Enter A Valid Email Address";
			$('Uemail').style.backgroundColor= "#FEEA83";
			$('Uemail').select();
			return false;
		}
		if(isFieldEmpty("Uname","Please enter your user name")==false){
			$('Uname').style.backgroundColor= "#FEEA83";
			return false;
		}
		if(isFieldEmpty("Password","Please enter your password")==false){
			$('Uname').style.backgroundColor= "#FEEA83";
			return false;
		}
		if($('Password').value.length < 8 ) {
			$('divRegisterError').style.display ='block';
			$('divRegisterError').innerHTML="Please enter your password with minimum 8 character "; 
			$('Password').style.backgroundColor= "#FEEA83";
			$('Password').select();
			return false;
		}
		
		if(isFieldEmpty("ConfPassword","Please confirm your password")==false){return false;}
		if($('Password').value != $('ConfPassword').value) {
			$('divRegisterError').style.display	=	"block";
			$('divRegisterError').innerHTML	=	"your password mismatch";
			$('ConfPassword').style.backgroundColor= "#FEEA83";
			$('ConfPassword').select();	
			return;
		}
		thisForm.txtWhat2Do.value	=	"SAVE_USER_DETAILS"; 
		thisForm.action	=	"operatorRegister.php?SAVE_USER_DETAILS";
		thisForm.submit();
	}
	/**
	 * Function to check user login details
	 *
	 * @Param Null
	 * $Return true or false 
	 */
	function check_user_login_details () { 
		if(isFieldEmpty("Uname","Please enter your user name")==false){ 
			$('Uname').style.backgroundColor= "#FEEA83";
			return false;
		}
		if(isFieldEmpty("password","Please enter your password")==false){ 
			$('password').style.backgroundColor= "#FEEA83";
			return false;
		}
		thisForm.txtWhat2Do.value = "USERLOGIN";
		thisForm.action  = "index.php";
	}
	/**
	 * Function For show and hide forgot passowrd  text field  
	 *
	 * @Param Null
	 * @Return Unknown
	 *
	 */
	 function show_hide_accept_forgot_password () { 
		if($('divForgotPassword').style.display == 'none') {
			$('divForgotPassword').style.display = 'block';
		}
		else {
			$('divAdminLoginError').style.display = 'none';
			$('divForgotPassword').style.display = 'none';
		}
	}
	/**
	 * Function for sent new password to tour operators
	 *
	 * @Paran Null
	 * @Return Unknown
	 */
	function send_new_passowrd (){ 
		if(isFieldEmpty("Useremail","Please enter your  Email-id")==false){ 
			$('Useremail').style.backgroundColor= "#FEEA83";
			return false;
		}
		if(!isValidEmail($('Useremail').value)){
			$('divRegisterError').innerHTML = 'Please enter a valid Email-id';
			$('divRegisterError').style.display = 'block';
			$('Useremail').style.backgroundColor= "#FEEA83";
			$('Useremail').focus();
			return;
		}
		thisForm.txtWhat2Do.value='FORGOTPASSWORD';	
		thisForm.submit();
	}
	/**
	 * An Ajax function for Check user name Availability
	 *
	 * @Param Username
	 * @Return Response
	 * @Type Ajax
	 */
	 function check_username_availability (username) { 
		var params  	=	"username="+escape(username)+ "&action=CHECK_USERNAME";    
		var url = 'ajaxpost.php';
		$('useravailable').innerHTML = 'Please wait..<img src=././Images/loader_user.gif>';
		new Ajax.Request (url, {
									method      :   "post",
									parameters  :   params,
									onSuccess	:	username_check_msg
								}
							);
	 }
	 /**
	  * Function to display user name available or not
	  * 
	  * @Param reqObj
	  * @Return ------- 
	  */
	function username_check_msg (reqObj) {
		$('useravailable').innerHTML = reqObj.responseText;
		if(trim(reqObj.responseText) == "user name not available") { 
			$('Uname').select();
			return;
		}
	}
	/**
	 * Function for touroperator password is valid or not 
	 *
	 * @Param 
	 * @Return 
	 * NOTE  : Function Not in use--------------------------------------------
	 */
	 function check_is_valid_password (password)
	 { 
		var params	=	"password="+escape(password)+"&action=CHECKPASSWORD";
		var url		=	"ajaxpost.php";	
	 }
	 /**
	  * Function for update tour operator password
	  * 
	  * @Param Null
	  * @Return Null
	  */
	  function update_password()
	  {
		if(trim($('password').value) == '')
			{
				$('message').style.display ='block';
				$('message').innerHTML="Please Enter Your Current Password"; 
				$('password').style.backgroundColor= "#FEEA83";
				$('password').focus();return false;
			}
			if(trim($('newpswd').value) == '')
			{
				$('message').style.display ='block';
				$('message').innerHTML="Please Enter Your New Password"
				$('newpswd').style.backgroundColor= "#FEEA83";
				$('newpswd').focus();return false;
			}
	 		if($("newpswd").value.length <=7) 
			{
				$('message').style.display ='block';
				$('message').innerHTML="Enter Password atleast Eight character"; 
				$('newpswd').style.backgroundColor= "#FEEA83";
				$('newpswd').focus(); return;
			}
			if(trim($('confirmpswd').value) == '')
			{
				$('message').style.display ='block';
				$('message').innerHTML="Please Confirm Your Password"; 
				$('confirmpswd').style.backgroundColor= "#FEEA83";
				$('confirmpswd').focus();return false;
			}
			if($("newpswd").value!=$("confirmpswd").value) 
			{
				$('message').style.display ='block';
				$('message').innerHTML="Password's doesn't match"; 
				$('newpswd').style.backgroundColor= "#FEEA83";
				$('newpswd').focus(); return;
			}
		thisForm.txtWhat2Do.value='CHANGEPASSWORD';
		thisForm.action='changepassword.php';
		thisForm.submit();
	  }
	  /**
	   * Function for show password strength
	   * 
	   * @Param Null
	   * @Return Null
	   */
	  function passwordStrength(password)
	  { 
		var desc = new Array();
		desc[0] = "Very Weak";
		desc[1] = "Weak";
		desc[2] = "Better";
		desc[3] = "Medium";
		desc[4] = "Strong";
		desc[5] = "Strongest";
		var score   = 0;
		//if password bigger than 6 give 1 point
		if (password.length > 6) score++;
		//if password has both lower and uppercase characters give 1 point      
		if ( ( password.match(/[a-z]/) ) && ( password.match(/[A-Z]/) ) ) score++;
		//if password has at least one number give 1 point
		
		if (password.match(/\d+/)) score++;
		//if password has at least one special caracther give 1 point
		if ( password.match(/.[!,@,#,$,%,^,&,*,?,_,~,-,(,)]/) ) score++;
		//if password bigger than 12 give another 1 point
		if (password.length > 12) score++;
		document.getElementById("passwordDescription").innerHTML = desc[score];
		document.getElementById("passwordStrength").className = "strength" + score;
	  }
	  /**
	   * Function for go back to home in user interface 
	   *
	   * @Param Null
	   * @Return Null
	   */
		function go_back_home () { 
			thisForm.action='index.php';
			thisForm.submit();
		}
		/**
		 * Function for check and uncheck checkbox
		 *
		 * @Param checkbox[input type]
		 * @Return true or false
		 * NOTE Function not in use-----------------------------------------------------
		 */
		function change_checkbox (checkbox)
		{
			if($(checkbox).checked == true)
			{
				$(checkbox).checked = false;
			}		
		}
		/**
		 * Function for save tour operator's basic information 
		 *
		 * @Param Null
		 * @Return Null
		 */
		 function save_basic_info () { 
		 	
			if(isFieldEmpty("txtHomestay","Please enter name of the Home stay unit")==false) {
				$('txtHomestay').style.backgroundColor= "#FEEA83";
				$('txtHomestay').focus();
				return false;
			}
			if(isNaN($('txtHomestay').value)	==	'')	{
				$('divRegisterError').style.display	=	"block";
				$('divRegisterError').innerHTML	=	"You are entered disallowed characters";
				$('txtHomestay').style.backgroundColor= "#FEEA83";
				$('txtHomestay').focus();
				return;
			}
			if(isFieldEmpty("txtOwner","Please enter name of the owner/promoter with full postal address")==false) {
				$('txtOwner').style.backgroundColor= "#FEEA83";
				return false;
			}
			if(isFieldEmpty("txtAddress","Please enter Location of house along with full address ")==false) {
				$('txtAddress').style.backgroundColor= "#FEEA83";
				return false;
			}
			
			if(isFieldEmpty("txtOptDate","Please enter Date on which the Homestay became operational")==false) {
				$('txtOptDate').style.backgroundColor= "#FEEA83";
				$('txtOptDate').focus();
				return false;
			}
			var startdate = ($('txtOptDate').value);
			var enddate = ($('HidDate').value);
			var startarray =startdate.split("-");
			var endarray =enddate.split("-");
			var objStartDate = new Date(startarray[2],startarray[1],startarray[0]);  
			var objStopDate = new Date(endarray[2],endarray[1],endarray[0]);  
			if (objStartDate > objStopDate) {     
			  
				$('divRegisterError').style.display	=	"block";
				$('divRegisterError').innerHTML	=	"Please select a valid date";
				$('txtOptDate').style.backgroundColor= "#FEEA83";
				$('txtOptDate').focus();
				return;
			  	
			}
			if(isFieldEmpty("txtBuildNo","Please enter Building No./Ward No: local body")==false) {
				$('txtBuildNo').style.backgroundColor= "#FEEA83";
				$('txtBuildNo').focus();
				return false;
			}
			/*if(isNaN($('txtBuildNo').value))	{
				$('divRegisterError').style.display	=	"block";
				$('divRegisterError').innerHTML	=	"Please enter a number";
				$('txtBuildNo').style.backgroundColor= "#FEEA83";
				$('txtBuildNo').focus();
				return;
			}*/
			if(isFieldEmpty("txtLocalbody","Please enter Name of local body")==false) {
				$('txtLocalbody').style.backgroundColor= "#FEEA83";
				$('txtLocalbody').focus();
				return false;
			}
			if(!isNaN($('txtLocalbody').value))	{
				$('divRegisterError').style.display	=	"block";
				$('divRegisterError').innerHTML	=	"Please enter a character";
				$('txtLocalbody').style.backgroundColor= "#FEEA83";
				$('txtLocalbody').focus();
				return;
			}
			if(isFieldEmpty("txtPlint","Please enter Plint area (floor wise)")==false) {
				$('txtPlint').style.backgroundColor= "#FEEA83";
				$('txtPlint').focus();
				return false;
			}
			
			if(isFieldEmpty("txtBuildlicense","Please enter Details of the building license from the local body plan")==false) {
				$('txtBuildlicense').style.backgroundColor= "#FEEA83";
				$('txtBuildlicense').focus();
				return false;
			}
			if(isFieldEmpty("txtPlot","Please enter area of the plot")==false) {
				$('txtPlot').style.backgroundColor= "#FEEA83";
				$('txtPlot').focus();
				return false;
			}
			if(isNaN($('txtPlot').value))	{
				$('divRegisterError').style.display	=	"block";
				$('divRegisterError').innerHTML	=	"Please enter a number";
				$('txtPlot').style.backgroundColor= "#FEEA83";
				$('txtPlot').focus();
				return;
			}
			if(isFieldEmpty("txtServeyno","Please enter Servey Number")==false) {
				$('txtServeyno').style.backgroundColor= "#FEEA83";
				$('txtServeyno').focus();
				return false;
			}
			if(isNaN($('txtServeyno').value))	{
				$('divRegisterError').style.display	=	"block";
				$('divRegisterError').innerHTML	=	"Please enter a number";
				$('txtServeyno').style.backgroundColor= "#FEEA83";
				$('txtServeyno').focus();
				return;
			}
			if(isFieldEmpty("txtWardno","Please enter your Ward Number and Name of the local body")==false) {
				$('txtWardno').style.backgroundColor= "#FEEA83";
				$('txtWardno').focus();
				return false;
			}
			if(isNaN($('txtWardno').value))	{
				$('divRegisterError').style.display	=	"block";
				$('divRegisterError').innerHTML	=	"Please enter a number";
				$('txtWardno').style.backgroundColor= "#FEEA83";
				$('txtWardno').focus();
				return;
			}
			if(isFieldEmpty("txtVillage","Please enter your Village")==false) {
				$('txtVillage').style.backgroundColor= "#FEEA83";
				$('txtVillage').focus();
				return false;
			}
			if(!isNaN($('txtVillage').value))	{
				$('divRegisterError').style.display	=	"block";
				$('divRegisterError').innerHTML	=	"Please enter a character";
				$('txtVillage').style.backgroundColor= "#FEEA83";
				$('txtVillage').focus();
				return;
			}
			if(isFieldEmpty("txtTaluk","Please enter your Taluk")==false) {
				$('txtTaluk').style.backgroundColor= "#FEEA83";
				$('txtTaluk').focus();
				return false;
			}
			if(!isNaN($('txtTaluk').value))	{
				$('divRegisterError').style.display	=	"block";
				$('divRegisterError').innerHTML	=	"Please enter a character";
				$('txtTaluk').style.backgroundColor= "#FEEA83";
				$('txtTaluk').focus();
				return;
			}
		/*	if(isFieldEmpty("txtDistrict","Please enter your District")==false) {
				$('txtDistrict').style.backgroundColor= "#FEEA83";
				$('txtDistrict').focus();
				return false;
			}
			if(!isNaN($('txtDistrict').value))	{
				$('divRegisterError').style.display	=	"block";
				$('divRegisterError').innerHTML	=	"Please enter a character";
				$('txtDistrict').style.backgroundColor= "#FEEA83";
				$('txtDistrict').focus();
				return;
			}*/
			if(isFieldEmpty("txtDisTown","Please enter distance from nearest town")==false) {
				$('txtDisTown').style.backgroundColor= "#FEEA83";
				$('txtDisTown').focus();
				return false;
			}
			if(isNaN($('txtDisTown').value))	{
				$('divRegisterError').style.display	=	"block";
				$('divRegisterError').innerHTML	=	"Please enter a number";
				$('txtDisTown').style.backgroundColor= "#FEEA83";
				$('txtDisTown').focus();
				return;
			}
			if(isFieldEmpty("txtDisRail","Please enter distance from nearest railway station")==false) {
				$('txtDisRail').style.backgroundColor= "#FEEA83";
				$('txtDisRail').focus();
				return false;
			}
			if(isNaN($('txtDisRail').value))	{
				$('divRegisterError').style.display	=	"block";
				$('divRegisterError').innerHTML	=	"Please enter a number";
				$('txtDisRail').style.backgroundColor= "#FEEA83";
				$('txtDisRail').focus();
				return;
			}
			if(isFieldEmpty("txtDisAir","Please enter distance from nearest airport ")==false) {
				$('txtDisAir').style.backgroundColor= "#FEEA83";
				$('txtDisAir').focus();
				return false;
			}
			if(isNaN($('txtDisAir').value))	{
				$('divRegisterError').style.display	=	"block";
				$('divRegisterError').innerHTML	=	"Please enter a number";
				$('txtDisAir').style.backgroundColor= "#FEEA83";
				$('txtDisAir').focus();
				return;
			}
			if(isFieldEmpty("txtAccessBuild","Please enter Access to the building")==false) {
				$('txtAccessBuild').style.backgroundColor= "#FEEA83";
				$('txtAccessBuild').focus();
				return false;
			}
			
			if(isFieldEmpty("txtBedroom","Please enter Nearest tourist spot ")==false) {
				$('txtBedroom').style.backgroundColor= "#FEEA83";
				$('txtBedroom').focus();
				return false;
			}
			
			if(isFieldEmpty("txtAccessBuild","Please enter number of bed rooms offered to tourist")==false) {
				$('txtNearestSpot').style.backgroundColor= "#FEEA83";
				$('txtNearestSpot').focus();
				return false;
			}	
			if(($('txtKitchenY').checked == false) && ($('txtKitchenN').checked ==false))
			{
				alert("Please select Yes or No for Kitchen facilities");
				return;
			}
			if(($('txtDiningY').checked == false) && ($('txtDiningN').checked ==false))
			{
				alert("Please select Yes or No for dining table facility");
				return;
			}
			thisForm.txtWhat2Do.value = "SAVE_BASIC_INFO";
			thisForm.action = "informations.php";
			thisForm.submit();
		 }
		 /**
		  * Function to create dynamic input fields
		  *
		  * @Param Null
		  * @Return 
		  */
		function  __fncAddRowToTableAcc()
		{ 
			$('hiddenAcc').value = parseInt($('hiddenAcc').value) + 1 ;
			$('hiddenAccForDelete').value = parseInt($('hiddenAccForDelete').value) + 1 ;
			var addval = $('hiddenAcc').value;
			var olddiv = $('divAccompany');
			var firstdiv = document.createElement('div');
			var outdiv = document.createElement('div');
				outdiv.id = 'DivAcc' + addval;
				outdiv.className = 'OuterDivJs';
			var inndiv1 = document.createElement('div');
			var inndiv2 = document.createElement('div');
			var inndiv3 = document.createElement('div');
			var inndiv4 = document.createElement('div');
		
				
			var size = document.createElement('input');
				size.type = 'text';
				size.name = 'txtEducation' + addval;
				size.id = 'txtEducation' + addval;
				size.className = 'textfield';
				inndiv2.appendChild(size);
				
			var freq = document.createElement('input');
				freq.type = 'text';
				freq.name = 'txtOccupation' + addval;
				freq.id = 'txtOccupation' + addval;
				freq.className = 'textfield';
				inndiv3.appendChild(freq);
				
			var title3 = document.createElement('input');
				title3.id = 'txtName' + addval;
				title3.name = 'txtName' + addval;
				title3.className = 'textfield';
				inndiv1.appendChild(title3);
				
			var but = document.createElement('input');
				but.type = 'button';
				but.name = 'remove' + addval;
				but.id = 'remove' + addval;
				but.value = 'Remove';
				but.className = 'rightbutton';
				but.onclick = function() {
				removeRowFromTableAcc(addval);
			};
				inndiv4.appendChild(but); 
			var Gname = document.createElement('input');
				Gname.type = 'text';
				Gname.name = 'txtRelation' + addval;
				Gname.id = 'txtRelation' + addval;
				Gname.className = 'textfield';
				inndiv1.appendChild(Gname);
				
				outdiv.appendChild(inndiv1);
				
				outdiv.appendChild(inndiv2);
				
				outdiv.appendChild(inndiv3);
				outdiv.appendChild(inndiv4);
				olddiv.appendChild(outdiv);
			$('hiddenCount').value =  parseInt($('hiddenCount').value ,10)+1;
		}
		/**
	  * Function to add row to phone number field
	  * 
	  * @Param none
	  * @Return ------- 
	  */
		function  __fncAddRowToPhone(cnt)
		{ 
			  var ni =$('divAccompany');
			  var numi = $('hiddenPhone');
			  var num = parseInt($('hiddenPhone').value) + parseInt(1);
			  numi.value = num;
			  var newdiv = document.createElement('input');
			  newdiv.type	=	"text";
			  var divIdName1 = 'phone'+num;
			  newdiv.setAttribute('id',divIdName1);
			  newdiv.setAttribute('name',divIdName1);
			  ni.appendChild(newdiv);
			  newdiv.className	=	'phone1';
			  var addval = $('hiddenPhone').value;
			  
			  var but = document.createElement('input');
				but.type = 'button';
				but.name = 'remove' + addval;
				but.id = 'remove' + addval;
				but.value = 'Remove';
				but.className = 'rightbuttonPhone';
				but.onclick = function() {
					$('hiddenPhone').value	=	parseInt($('hiddenPhone').value)-parseInt(1);
					removeElement('phone'+num);
					removeElement('remove'+ addval);
				}
				 ni.appendChild(but);
				 but.className	=	'removebtn';
		}
		/**
		  * Function toremove phone number rows
		  * 
		  * @Param none
		  * @Return ------- 
		  */
		function removeElement(divNum) 
		{
			  var d = $('divAccompany');
			  var olddiv = $(divNum);
			  d.removeChild(olddiv);
		}
		/**
		  * Function to remove fax
		  * 
		  * @Param none
		  * @Return ------- 
		  */
		function removeFax(divNum) 
		{
			  var d = $('divfax'); 
			  var olddiv = $(divNum);
			  d.removeChild(olddiv);
		}
		/**
		  * Function toremove phone number rows
		  * 
		  * @Param none
		  * @Return ------- 
		  */
		function removeInput(divNum,but) 
		{
		  var d = $('divinput');
		  var olddiv = $(divNum);
		  var button = $(but);
		  d.removeChild(olddiv);
		  d.removeChild(button);
		  $('hiddenPhone').value	=	parseInt($('hiddenPhone').value)-parseInt(1);
		}
		/**
		  * Function toremove phone number rows
		  * 
		  * @Param none
		  * @Return ------- 
		  */
		function removeFaxNo(divNum,but) 
		{
		  var d = $('removefaxno');
		  var olddiv = $(divNum);
		  var button = $(but);
		  d.removeChild(olddiv);
		  d.removeChild(button);
		  $('hiddenPhone').value	=	parseInt($('hiddenPhone').value)-parseInt(1);
		}
		/**
		  * Function toremove phone number rows
		  * 
		  * @Param none
		  * @Return ------- 
		  */
		function __fncAddRowToFax()
		{
			  var ni = $('divfax');
			  var numi =$('hiddenFax');
			  var num = ($('hiddenFax').value -1)+ 2;
			  numi.value = num;
			  var newdiv = document.createElement('input');
			  newdiv.type	=	"text";
			  var divIdName = 'fax'+num;
			  newdiv.setAttribute('id',divIdName);
			  newdiv.setAttribute('name',divIdName);
			  ni.appendChild(newdiv);
			  newdiv.className	=	"phone2";
			  var addval = $('hiddenFax').value;
			  var but = document.createElement('input');
				but.type = 'button';
				but.name = 'removeFax' + addval;
				but.id = 'removeFax' + addval;
				but.value = 'Remove';
				but.className = 'rightbuttonPhone phone2';
				but.onclick = function() {
					$('hiddenFax').value	=	$('hiddenFax').value -1;
					removeFax('fax'+num);
					removeFax('removeFax'+ addval);
				}
				 ni.appendChild(but);
				
		}
		 /**
		 * Function to remove dynamic input fields
		 *
		 * @Param Null
		 * @Return 
		 */
		function removeRowFromTableAcc(adds)
		{ 
			var divs = $('divAccompany');
			var olddiv = $('DivAcc' + adds);
	
				divs.removeChild(olddiv);
				$('hiddenAccForDelete').value = $('hiddenAccForDelete').value - 1;
				$('hiddenAcc').value = $('hiddenAcc').value - 1;
		}
	    /**
		 * Function for save tour operator's other details 
		 *
		 * @Param Null
		 * @Return Null
		 */
		 function save_other_details () {
			 if(isFieldEmpty("activity","Please enter details ")==false) {
				  $('activity').style.backgroundColor= "#FEEA83";
				  return false;
			 }
			 if(isFieldEmpty("Member","Please enter details ")==false) {
				  $('Member').style.backgroundColor= "#FEEA83";
				  return false;
		     }
			  if(isNaN($('activity').value)	==	'')	{
				$('divRegisterError').style.display	=	"block";
				$('divRegisterError').innerHTML	=	"You are entered disallowed characters";
				$('activity').style.backgroundColor= "#FEEA83";
				$('activity').focus();
				return;
			 }
			  if(isNaN($('Member').value)	==	'')	{
				$('divRegisterError').style.display	=	"block";
				$('divRegisterError').innerHTML	=	"You are entered disallowed characters";
				$('Member').style.backgroundColor= "#FEEA83";
				$('Member').focus();
				return;
			 }
			 if(isFieldEmpty("Domestic","Please enter details ")==false) {
				  $('Domestic').style.backgroundColor= "#FEEA83";
				  return false;
		     }
			 if(!isNaN($('Domestic').value)	==	'')	{
				$('divRegisterError').style.display	=	"block";
				$('divRegisterError').innerHTML	=	"You are entered disallowed characters";
				$('Domestic').style.backgroundColor= "#FEEA83";
				$('Domestic').focus();
				return;
			 }
			 if(isFieldEmpty("Foreign","Please enter details ")==false) {
				  $('Foreign').style.backgroundColor= "#FEEA83";
				  return false;
		     }
			 if(!isNaN($('Foreign').value)	==	'')	{
				$('divRegisterError').style.display	=	"block";
				$('divRegisterError').innerHTML	=	"You are entered disallowed characters";
				$('Foreign').style.backgroundColor= "#FEEA83";
				$('Foreign').focus();
				return;
			 }
			  if(isFieldEmpty("Gname0","Please enter group name")==false) {
				  $('Gname0').style.backgroundColor= "#FEEA83";
				  return false;
		     }
			 if(isFieldEmpty("Size0","Please enter group size")==false) {
				  $('Size0').style.backgroundColor= "#FEEA83";
				  return false;
		     }
			 if(!isNaN($('Size0').value)	==	'')	{
				$('divRegisterError').style.display	=	"block";
				$('divRegisterError').innerHTML	=	"You are entered disallowed characters";
				$('Size0').style.backgroundColor= "#FEEA83";
				$('Size0').focus();
				return;
			 }
			  if(isFieldEmpty("Freq0","Please enter group Frequency")==false) {
				  $('Freq0').style.backgroundColor= "#FEEA83";
				  return false;
		     }
			 if(!isNaN($('Freq0').value)	==	'')	{
				$('divRegisterError').style.display	=	"block";
				$('divRegisterError').innerHTML	=	"You are entered disallowed characters";
				$('Freq0').style.backgroundColor= "#FEEA83";
				$('Freq0').focus();
				return;
			 }
			 if(isFieldEmpty("Promote","Please enter details ")==false) {
				  $('Promote').style.backgroundColor= "#FEEA83";
				  return false;
			 }
			 if(isFieldEmpty("Speprogr","Please enter details ")==false) {
				  $('Speprogr').style.backgroundColor= "#FEEA83";
				  return false;
			 }
			 if(isFieldEmpty("ManPwr","Please enter details ")==false) {
				  $('ManPwr').style.backgroundColor= "#FEEA83";
				  return false;
			 }
			 thisForm.txtWhat2Do.value = "SAVE_OTHER_DETAILS";
			 thisForm.action = "otherDetails.php";
			 thisForm.submit();
		 }
		 /**
		 * Function for get total of Paid up capital, Loans, Secured, Unsecured, Reserves and Reserves
		 *
		 * @Param Null
		 * @Return Integer
		 */
		 function save_finance_details()
		 {
			
			 if(isFieldEmpty("Pcapital","Please enter your paid up capital")==false) {
				 $('Pcapital').style.backgroundColor= "#FEEA83";
				 return false;
			 }
			 if(!isNaN($('Pcapital').value)	==	'')	{
				$('divRegisterError').style.display	=	"block";
				$('divRegisterError').innerHTML	=	"You are entered disallowed characters";
				$('Pcapital').style.backgroundColor= "#FEEA83";
				$('Pcapital').focus();
				return;
			}
			if(isFieldEmpty("secure","Please enter secured  loan")==false) {
				 $('secure').style.backgroundColor= "#FEEA83";
				 return false;
			}
			
			if(!isNaN($('secure').value)	==	'')	{
				$('divRegisterError').style.display	=	"block";
				$('divRegisterError').innerHTML	=	"You are entered disallowed characters";
				$('secure').style.backgroundColor= "#FEEA83";
				$('secure').focus();
				return;
			}
			if(isFieldEmpty("unsecure","Please enter unsecured  loan")==false) {
				  $('unsecure').style.backgroundColor= "#FEEA83";
				  return false;
			}
			if(!isNaN($('unsecure').value)	==	'')	{
				$('divRegisterError').style.display	=	"block";
				$('divRegisterError').innerHTML	=	"You are entered disallowed characters";
				$('unsecure').style.backgroundColor= "#FEEA83";
				$('unsecure').focus();
				return;
			}
			if(isFieldEmpty("Reserves","Please details of loan")==false) {
				$('Reserves').style.backgroundColor= "#FEEA83";
				return false;
			}
			if(!isNaN($('Reserves').value)	==	'')	{
				$('divRegisterError').style.display	=	"block";
				$('divRegisterError').innerHTML	=	"You are entered disallowed characters";
				$('Reserves').style.backgroundColor= "#FEEA83";
				$('Reserves').focus();
				return;
			}
			if(isFieldEmpty("liabty","Please enter details ")==false) {
				$('liabty').style.backgroundColor= "#FEEA83";
				return false;
			}
			if(!isNaN($('liabty').value)	==	'')	{
				$('divRegisterError').style.display	=	"block";
				$('divRegisterError').innerHTML	=	"You are entered disallowed characters";
				$('liabty').style.backgroundColor= "#FEEA83";
				$('liabty').focus();
				return;
			}
			if(isFieldEmpty("Fasset","Please enter details ")==false) {
				$('Fasset').style.backgroundColor= "#FEEA83";
				return false;
			}
			if(!isNaN($('Fasset').value)	==	'')	{
				$('divRegisterError').style.display	=	"block";
				$('divRegisterError').innerHTML	=	"You are entered disallowed characters";
				$('Fasset').style.backgroundColor= "#FEEA83";
				$('Fasset').focus();
				return;
			}
			if(isFieldEmpty("Invest","Please enter details ")==false) {
				$('Invest').style.backgroundColor= "#FEEA83";
				return false;
			}
			if(!isNaN($('Invest').value)	==	'')	{
				$('divRegisterError').style.display	=	"block";
				$('divRegisterError').innerHTML	=	"You are entered disallowed characters";
				$('Invest').style.backgroundColor= "#FEEA83";
				$('Invest').focus();
				return;
			}
			if(isFieldEmpty("Casset","Please enter details ")==false) {
				$('Casset').style.backgroundColor= "#FEEA83";
				return false;
			}
			if(!isNaN($('Casset').value)	==	'')	{
				$('divRegisterError').style.display	=	"block";
				$('divRegisterError').innerHTML	=	"You are entered disallowed characters";
				$('Casset').style.backgroundColor= "#FEEA83";
				$('Casset').focus();
				return;
			}
			if(isFieldEmpty("Iasset","Please enter details ")==false) {
				$('Iasset').style.backgroundColor= "#FEEA83";
				return false;
			}
			if(!isNaN($('Iasset').value)	==	'')	{
				$('divRegisterError').style.display	=	"block";
				$('divRegisterError').innerHTML	=	"You are entered disallowed characters";
				$('Iasset').style.backgroundColor= "#FEEA83";
				$('Iasset').focus();
				return;
			}
			
			 thisForm.txtWhat2Do.value = "SAVE_FINANCE_DETAILS"; 
			 thisForm.action = "financialPerfomance.php";
			 thisForm.submit();
		 }
	    /**
		 * Function for get total of Paid up capital, Loans, Secured, Unsecured, Reserves and Reserves
		 *
		 * @Param Null
		 * @Return Integer
		 */
		function get_asset_tot ()
		{	 
			var fixed_asset 	=	Number($('Fasset').value);
			var invest 			=	Number($('Invest').value);
			var curr_asset 		= 	Number($('Casset').value);
			var intang_asset 	= 	Number($('Iasset').value);
			var second_total	=	fixed_asset	+ 
									invest	 	+
									curr_asset	+
									intang_asset;
			$('Stotal').value = second_total;
		}
		/**
		 * Function for get total of Fixed assets, Investment, Current assets and Intangible Assets
		 *
		 * @Param Null
		 * @Return Integer
		 */
		function get_loan_tot ()
		{	 
			var paid_cap 	=	Number($('Pcapital').value);
			var loan_secur 	= 	Number($('secure').value);
			var loan_unsec 	= 	Number($('unsecure').value);
			var reserves 	= 	Number($('Reserves').value);
			var liablity 	= 	Number($('liabty').value);
			var first_total	=	paid_cap 	+ 
								loan_secur	+
								loan_unsec	+
								reserves	+
								liablity;
			$('Ftotal').value = first_total;
		}
	    /**
		 * Function hide branch office input area
		 *
		 * @Param Null
		 * @Return Null
		 */
		function load_org_type () {
			
			if($('Orgtype').value 	== "Branch") {
				$('branch').style.display	= "none";
			}
			else if($('Orgtype').value 	== "Head") {
				$('branch').style.display	= "block";
			}
		}
		/*function compare_birth_dates(start_date, end_date)
		{ 
			start_date=start_date;
			var point1=0;
			var point2=0;
			var arrDate1 = start_date.split(");
			var useDate1 = new Date(arrDate1[2], arrDate1[1]-1, arrDate1[0]);
			var arrDate2 = end_date.split(");
			var useDate2 = new Date(arrDate2[2], arrDate2[1], arrDate2[0]-1);
			
			var year1=arrDate1[2];
			var month1=arrDate1[1];
			var day1=arrDate1[0];
			var year2=arrDate2[2];
			var month2=arrDate2[1];
			var day2=arrDate2[0];
			var year1 = parseInt(year1);
			var year2 = parseInt(year2);
			if(year1>year2)
			{
				point1++; 
			}
			else if(year1<year2)
			{
				point2++;
			}
			else
			{
				point1++;point2++;			
			}
			if(month1>month2 && point1>0) 
			{
				point1++; 
			}
			else if(month1<month2 && point2>0)
			{
				point2++; 
			}
			else 
			{
				point1++;point2++;
			}
			if(day1>day2 && point1>1)
			{ 
				point1++; 
			}
			else if(day1<day2 && point2>1)
			{
				point2++;
			}
			else 
			{
				point1++;point2++;
			}	
			
			if(point1>point2 )
			{
				return false;
			}
			else
			{
				return true;
			}
		}*/

		/**
		 * Function for save payment details
		 *
		 * @Param Null
		 * @Return Null
		 */
		function save_payement_data () {
			
			   if(isFieldEmpty("Bname","Please enter your bank name")==false)	{
				   $('Bname').style.backgroundColor= "#FEEA83"; 
				   return false;
				}
			   if(isNaN($('Bname').value)	==	'')	{
					$('divRegisterError').style.display	=	"block";
					$('divRegisterError').innerHTML	=	"You are entered disallowed characters";
					$('Bname').style.backgroundColor= "#FEEA83";
					$('Bname').select();
					return;
				}
				/*if(isFieldEmpty("Naudit","Please enter name of auditors ")==false) {
					$('Naudit').style.backgroundColor= "#FEEA83"; 
					return false;
				}
				if(isNaN($('Naudit').value)	==	'')	{
					$('divRegisterError').style.display	=	"block";
					$('divRegisterError').innerHTML	=	"You are entered disallowed characters";
					$('Naudit').style.backgroundColor= "#FEEA83";
					$('Naudit').select();
					return;
				}*/
				if(isFieldEmpty("DDnum","Please enter name of auditors ")==false) {
					$('DDnum').style.backgroundColor= "#FEEA83"; 
					return false;
				}
				/*if($('DDnum').value.length	> 15 )	{
					$('divRegisterError').style.display	=	"block";
					$('divRegisterError').innerHTML	=	"You are crossed the number limit";
					$('DDnum').style.backgroundColor= "#FEEA83";
					$('DDnum').select();
					return;      
				}*/
				if(!isNaN($('DDnum').value)	==	'')	{
					$('divRegisterError').style.display	=	"block";
					$('divRegisterError').innerHTML	=	"You are entered disallowed characters";
					$('DDnum').style.backgroundColor= "#FEEA83";
					$('DDnum').select();
					return;
				}
				if(isFieldEmpty("DDdate","Please select DD date")==false){ 
					$('DDdate').style.backgroundColor= "#FEEA83"; 
					return false;
				}
				if(isFieldEmpty("DDamount","Please your DD amount")==false){ 
					$('DDamount').style.backgroundColor= "#FEEA83"; 
					return false;
				}
				if(!isNaN($('DDamount').value)	==	'')	{
					$('divRegisterError').style.display	=	"block";
					$('divRegisterError').innerHTML	=	"You are entered disallowed characters";
					$('DDamount').style.backgroundColor= "#FEEA83";
					$('DDamount').select();
					return;
				}
				thisForm.txtWhat2Do.value	=	"PAYMENT_DETAILS";
				thisForm.actiom	=	"paymentDetails.php";
				thisForm.submit();
		}
		/**
		 * Function to chnage text field background color
		 *
		 * @Param Null
		 * @ Return Null
		 *
		 */
		function change_bg_color (element) { 
			 element.style.backgroundColor = "#FFFFFF";
			 $('divRegisterError').style.display = "none";
		}
		/**
		 * Function to chnage text field background color
		 *
		 * @Param Null
		 * @ Return Null
		 * NOTE : note in use----------------------------------------------
		 */
		function setbg(color)
		{
			$("Areainterest").style.color=color;
		}
		function text_color (id) {
			$(id).style.color = '#000000';	  
		}
		function invisible_mgs (elId,msg) { 
			if(elId.value == msg)
			{ 
				elId.value='';	
				elId.value.classname='comnt_color';
			}
			else if(elId.value == '') {
				elId.value=msg;	
			}
		}
		/**
		 * Function to save profile image of tour operator
		 *
		 * @Param Null
		 * @Return Null
		 * @Type ajax
		 */
		function save_profile_image (Uploadimg) {
			   	
				var params  	=	"Uploadimg="+escape(Uploadimg)+ "&action=SAVE_PROFILE_IMAGE";    
				var url = 'ajaxpost.php';
				$('text').style.display="block";
				$('text').innerHTML = '<img src=././Images/uploading.gif><b style="color:#3B5998;">uploading files<blink>....</blink></b>';
				new Ajax.Request (url, {
											method      :   "post",
											parameters  :   params,
											onSuccess	:	username_check_msg
										}
									);
				thisForm.txtWhat2Do.value	=	"SAVE_PROFILE_IMAGE";
				thisForm.action	=	"documents.php";
				thisForm.submit();
		}
		function refresh()
		{
		    window.location.reload( false );
		}
		/**
		 * Function to save profile image of tour operator
		 *
		 * @Param Null
		 * @Return Null
		 * @Type ajax
		 */
		function save_profile_photo (Uploadimg) {
			
			if( $('files').value=='' && $('filesBuilding1').value == '' && $('filesBuilding2').value =='' && $('filesBuilding3').value == '' && $('filesBuilding4').value == '')
			{
				alert('Please select your image');
				return false;
			}
			var params  	=	"Uploadimg="+escape(Uploadimg)+ "&action=SAVE_PROFILE_IMAGE";   
			var url = 'ajaxpost.php';
			$('text').style.display="block";
			$('text').innerHTML = '<img src=././Images/uploading.gif><b style="color:#3B5998;">uploading files<blink>....</blink></b>';
			new Ajax.Request (url, {
										method      :   "post",
										parameters  :   params,
										onSuccess	:	username_check_msg
									}
								);
			thisForm.txtWhat2Do.value	=	"SAVE_PROFILE_IMAGE";
			$('text').innerHTML = '<img src=./Images/img-loader.gif>uploading<blink>....</blink>'
			thisForm.actiom	=	"uploadImage.php";
			thisForm.submit();
		}
		/*
		 * Function to submit all forms confirmation 
		 *
		 * @Paran Null
		 * @Return Null
		 */
		function submit_all_forms_confirm () { 
			$('confirmation').className="data_entry_confirm_block";
		}
	   /**
		* Function to submit all forms 
		*
		* @Paran Null
		* @Return Null
		*/
		 function submit_all_forms () {
			thisForm.txtWhat2Do.value = "SUBMIT_FROM";
			thisForm.action = "informations.php";
			thisForm.submit();	 
		 }
	   /**
		* Function to close confirmation box
		*
		* @Paran Null
		* @Return Null
		*/
		function finish_confirmation_non() {	
				$('confirmation').style.display="none";
				$('confirmation').focus();
		}
	   /**
		* Function to view usert guide
		*
		* @Paran Null
		* @Return Null
		*/
		function view_user_manual () { 
			window.open("usermanual.php","_blank","height=5000, width=1000,scrollbars=yes,resizeable=0,left=200");
			thisForm.submit();	
		}
	   /**
		* Function to Recommand fpr accreditation
		*
		* @Paran Null
		* @Return Null
		*/
		function  recommand_accreditation () { 
			thisForm.txtWhat2Do.value = "RECOMMAND_FOR_ACCREDITATION";
			thisForm.action = "viewalldetails.php";
			thisForm.submit();	 	
		}
		function download_certificate (username)
		{ 
			window.open(base_url+"uploads/"+username+"/certificate.pdf","_blank","height=3000, width=1300,scrollbars=yes,left=55");
		}
		function download_ddreciept (username)
		{ 
			window.open(base_url+"uploads/"+username+"/demand_draft_reciept.pdf","_blank","height=3000, width=1000,scrollbars=yes,left=200");
		}
		function download_tourism_logo ()
		{
			window.open(base_url+"/Images/Kerala Tourism logo.jpg","_blank","height=5000, width=1000,scrollbars=yes,left=200");
		}
		function download_accreditation_logo ()
		{
			window.open(base_url+"/Images/ato logo.jpg","_blank","height=5000, width=1000,scrollbars=yes,left=200");
		}
		function show_underline () {
			$('addphoto').style.textDecoration="underline";	
		}
		function hide_underline () {
			$('addphoto').style.textDecoration="none";	
		}
		function add_photo ()
		{
			thisForm.action = "uploadImage.php";
			thisForm.submit();	
		}
		function open_guidelines () {
			window.open(base_url+"/guidelines.pdf","_blank","height=5000, width=1000,scrollbars=yes,left=220");
		}
		/**
		  * Function to create dynamic input fields
		  *
		  * @Param Null
		  * @Return 
		  */
		function  __fncAddFacilities()
		{ 
			$('facility').value = parseInt($('facility').value) + 1 ;
			$('facilityDelete').value = parseInt($('facilityDelete').value) + 1 ;
			var addval = $('facility').value;
			var olddiv = $('DivFacility');
			var firstdiv = document.createElement('div');
			var outdiv = document.createElement('div');
				outdiv.id = 'DivFaci' + addval;
				outdiv.className = 'OuterDivJs';
			var inndiv1 = document.createElement('div');
			var inndiv2 = document.createElement('div');
			var inndiv3 = document.createElement('div');
			var inndiv4 = document.createElement('div');
		
				
			var size = document.createElement('input');
				size.type = 'text';
				size.name = 'Size_toilet' + addval;
				size.id = 'Size_toilet' + addval;
				size.className = 'textfield_room';
				inndiv2.appendChild(size);
				
			var freq = document.createElement('input');
				freq.type = 'text';
				freq.name = 'RoonSize' + addval;
				freq.id = 'RoonSize' + addval;
				freq.className = 'textfield_room';
				inndiv3.appendChild(freq);
				
			var title3 = document.createElement('input');
				title3.type = 'text';
				title3.name = 'A/C' + addval;
				title3.id = 'A/C' + addval;
				title3.maxLength = 3;
				title3.className = 'textfield_room';
				inndiv2.appendChild(title3);
				
				
				title3.className = 'textfield_room';
				inndiv1.appendChild(title3);
				
			var but = document.createElement('input');
				but.type = 'button';
				but.name = 'remove' + addval;
				but.id = 'remove' + addval;
				but.value = 'Remove';
				but.className = 'rightbutton';
				but.onclick = function() {
				removeFacility(addval);
			};
				inndiv4.appendChild(but); 
			var Gname = document.createElement('input');
				Gname.type = 'text';
				Gname.name = 'Facility' + addval;
				Gname.id = 'Facility' + addval;
				Gname.className = 'textfield_room';
				inndiv1.appendChild(Gname);
				
				outdiv.appendChild(inndiv1);
				
				outdiv.appendChild(inndiv2);
				
				outdiv.appendChild(inndiv3);
				outdiv.appendChild(inndiv4);
				olddiv.appendChild(outdiv);
			$('facilityCount').value =  parseInt($('facilityCount').value ,10)+1;
		}
		 /**
		 * Function to remove dynamic input fields
		 *
		 * @Param Null
		 * @Return 
		 */
		function removeFacility(adds)
		{ 
			var divs = $('DivFacility');
			var olddiv = $('DivFaci' + adds);
				divs.removeChild(olddiv);
				$('facilityDelete').value = $('facilityDelete').value - 1;
				$('facility').value = $('facility').value - 1;
		}
		
		function PrintContent()
		{  
			thisForm.action = "pdf_forward_app.php";
			thisForm.submit();	
		}

