<?php 
if(isset($_REQUEST['Search']))
{
// echo "<pre/>";
// 	print_r($_REQUEST);
// 	die('suspend');
$_REQUEST['hr_applcnt_rgstn']['attach_file']=$_FILES['attach']['name'];
$_REQUEST['hr_applcnt_rgstn']['dob']=ConvertSQLDate($_REQUEST['hr_applcnt_rgstn']['dob']);
$_REQUEST['hr_applcnt_rgstn']['CompanyId']=$_SESSION['ACGCompanyId'];
$_REQUEST['hr_applcnt_rgstn']['created_by']=$_SESSION['UserID'];
$_REQUEST['hr_applcnt_rgstn']['created_date']=date('Y-m-d');        
move_uploaded_file($_FILES['attach']['tmp_name'], "uploaded_docs/".$_FILES["attach"]["name"]);
//$sql= $s->insertRecord('hr_applcnt_rgstn',$_REQUEST['hr_applcnt_rgstn'])  ; 

$s->RecordInsert('hr_applcnt_rgstn', $_REQUEST['hr_applcnt_rgstn']);
$last=DB_Last_Insert_ID($db,'hr_applcnt_rgstn',$ErrMsg);
for($t=0;$t<count($_REQUEST['ref_name']);$t++)
{
$data['hr_applcnt_rgstn_id']=$last;
$data['name']=$_REQUEST['ref_name'][$t];
$data['email']=$_REQUEST['ref_email1'][$t];
$data['off_email']=$_REQUEST['ref_email2'][$t];
$data['phone']=$_REQUEST['ref_phone'][$t];
$data['mobile']=$_REQUEST['ref_mobile'][$t];
$data['aknowledge_date']=date('Y-m-d');
$data['aknowledge_created']=$_SESSION['UserID'];
$s->RecordInsert('hr_applcnt_rgstn_ref',$data);
 }

 for($k=0;$k<count($_REQUEST['company']);$k++)
			{
				$dataEmpSal['hr_applcnt_rgstn_id']=$last;
				$dataEmpSal['company_name']=$_REQUEST['company'][$k];
				$dataEmpSal['from_date']=ConvertSQLDate($_REQUEST['frm_date'][$k]);
				$dataEmpSal['to_date']=ConvertSQLDate($_REQUEST['to_date'][$k]);
				$dataEmpSal['ctc']=$_REQUEST['ctc'][$k];
				$dataEmpSal['salary_dtls']=$_REQUEST['salary_dtls'][$k];
				$s->RecordInsert('hr_applcnt_rgstn_experience',$dataEmpSal);
			}

	$dataArr1['status']="pending";
    $dataArr1['awd_application_id']=$last;
    $dataArr1['created_by']=$_SESSION['UserID'];    
    $dataArr1['datetime']=date('Y-m-d H:i:s');
    $s->RecordInsert('hr_applcnt_rgstn_log_status',$dataArr1);



$s->pageLocation("index.php?route=HRModule/Master/application_registrartion_index".$rurl);
}

?>

<link rel="stylesheet" href="css/new_mxerp.css">
<form action="" enctype="multipart/form-data" method="post" name="myform" onsubmit="return validation();" >
<div class="body_contain">
<div class="tab_div"> 
<h1>Applicant Registration</h1>

<h3><strong>Application Details</strong></h3>

<table width="100%" border="0" cellpadding="3" cellspacing="0">
	<tr class="row1">
	<td width="13%"><strong>Designation</strong></td>
	<td width="20%"><input type="text" readonly value="<?php  echo $sitename=$s->GetFieldValue('desigmaster',"id='".$_REQUEST['design']."'",'designame'); 
	//echo $_REQUEST['design'];
	 ?>">
		<input type="hidden" name="hr_applcnt_rgstn[designation]"  value="<?php echo $_REQUEST['design']; ?>">
	</td>
	<td width="13%"><strong>Department</strong></td>
	<td width="20%"><input type="text" readonly value="<?php   echo $sitename1=$s->GetFieldValue('deptmaster',"id='".$_REQUEST['dept']."'",'deptname'); ?>" >
		<input type="hidden" name="hr_applcnt_rgstn[department]" value="<?php echo $_REQUEST['dept']; ?>" >
		<input type="hidden" name="hr_applcnt_rgstn[hr_job_created_id]" value="<?php echo $_REQUEST['jobpoid']; ?>" >		
	</td>
	<td colspan="2">&nbsp;</td>
	</tr>
</table>
<br>
<h3><strong>General Details</strong></h3>
 	
	<table width="100%" border="0" cellpadding="3" cellspacing="0">
	<tr class="row1">
	<td width="13%"><strong>First Name</strong></td>
	<td width="20%"><input type="text" id="fname" name="hr_applcnt_rgstn[first_name]" ></td>
	<td width="13%"><strong>Middle Name</strong></td>
	<td width="20%"><input type="text"  name="hr_applcnt_rgstn[middle_name]" ></td>
	<td width="13%"><strong>Last Name</strong></td>
	<td><input type="text" name="hr_applcnt_rgstn[last_name]" ></td>
</tr>
<tr class="row1">
	<td><strong>Date of Birth</strong></td>
	<td><input type="text"  id ="dob" name="hr_applcnt_rgstn[dob]" style="width:50%;" class="datepicker"> &nbsp;<strong>Age</strong> <input type="text"  name="age"  id ="age"  onclick='javascript:getAge();' style="width:20%;"></td>
	<td><strong>Birth Place</strong></td>
	<td><input type="text" name="hr_applcnt_rgstn[birth_place]" ></td>
	<td><strong>Sex</strong></td>
    <td>Male: <input type="radio" name="hr_applcnt_rgstn[gender]" value="m" > &nbsp;Female: <input type="radio" name="hr_applcnt_rgstn[gender]" value="f" ></td>
</tr>
<tr class="row1">
	<td><strong>Religion</strong></td>
	<td><input type="text" name="hr_applcnt_rgstn[religion]"  ></td>
	<td><strong>Marital Status</strong></td>
	<td><select name="hr_applcnt_rgstn[marital_status]" >
	<option>--Select--</option>
	<option value="m">Married</option>
        <option value="u">UnMarried</option>
	</select></td>
	<td><strong>Dependent</strong></td>
	<td><input type="text" name="hr_applcnt_rgstn[dependent]" ></td>
</tr>
<tr class="row1">
	<td><strong>Father's Name</strong></td>
	<td><input type="text"  name="hr_applcnt_rgstn[father_name]"></td>
	<td><strong>Occupation</strong></td>
	<td><select name="hr_applcnt_rgstn[occupation]" >
	<option>--Select--</option>
	<option value="service">Service</option>
        <option value="business">Business</option>
	</select></td>
	<td><strong>Location</strong></td>
	<td><input type="text" name="hr_applcnt_rgstn[location]" ></td>
</tr>
<tr class="row1">
	<td><strong>Mother's Name</strong></td>
	<td><input type="text"  name="hr_applcnt_rgstn[mother_name]"></td>
	<td><strong>Occupation</strong></td>
	<td><select name="hr_applcnt_rgstn[mother_occupation]" >
	<option>--Select--</option>
	<option value="housewife">House wife</option>
	<option value="service">Service</option>
        <option value="business">Business</option>
	</select></td>
	<td><strong>Location</strong></td>
	<td><input type="text" name="hr_applcnt_rgstn[mother_location]" ></td>
</tr>
</table>
<br>
<h3><strong>Contact Details</strong></h3>
<table width="100%" border="0" cellpadding="3" cellspacing="0">
	<tr class="row1">
	<td width="13%"><strong>Mobile No.1</strong></td>
	<td width="20%"><input type="text"  id="mobile1" name="hr_applcnt_rgstn[mobile1]"  onkeypress="return isNumberKey(event)" ></td>
	<td width="13%"><strong>Email ID 1</strong></td>
	<td width="20%"><input type="text" id="email1" name="hr_applcnt_rgstn[email1]" ></td>
	<td width="13%"><strong>Phone No.1</strong></td>
	<td><input type="text" name="hr_applcnt_rgstn[phone1]"  onkeypress="return isNumberKey(event)" ></td>
</tr>
<tr class="row1">
    <td><strong>Mobile No.2</strong></td>
	<td><input type="text" name="hr_applcnt_rgstn[mobile2]" onkeypress="return isNumberKey(event)" ></td>
	<td><strong>Email ID 2</strong></td>
	<td><input type="text" name="hr_applcnt_rgstn[email2]" ></td>
	<td><strong>Phone No.2</strong></td>
	<td><input type="text" name="hr_applcnt_rgstn[phone2]" onkeypress="return isNumberKey(event)" ></td>
</tr>
</table>
<br>
<h3><strong>Reference Details</strong></h3>
<table width="100%" border="1" cellpadding="3" cellspacing="0" style="border:#808080 1px solid;">
	<tr>
      <th><strong>Name</strong></th>
      <th width="12%"><strong>Mobile No.</strong></th>
      <th width="24%"><strong>Personal Email ID</strong></th>
      <th width="24%"><strong>Office Email ID</strong></th>
      <th width="12%"><strong>Phone No.</strong></th>
	</tr>
<tr>
	<td><input type="text" id="ref_name" name="ref_name[]" ></td>
	<td><input type="text"  id="ref_mobile" name="ref_mobile[]" onkeypress="return isNumberKey(event)" ></td>
	<td><input type="text" id="ref_email1" name="ref_email1[]" ></td>
	<td><input type="text"  id="ref_email2" name="ref_email2[]" ></td>
	<td><input type="text" id="ref_phone" name="ref_phone[]" onkeypress="return isNumberKey(event)" ></td>
</tr
<tr class="row1">
	<td><input type="text" name="ref_name[]" ></td>
	<td><input type="text" name="ref_mobile[]" onkeypress="return isNumberKey(event)"  ></td>
	<td><input type="text" name="ref_email1[]" ></td>
	<td><input type="text" name="ref_email2[]" ></td>	
	<td><input type="text" name="ref_phone[]" onkeypress="return isNumberKey(event)" ></td>
</tr>

<tr class="row1">
	<td><input type="text" name="ref_name[]" ></td>
	<td><input type="text" name="ref_mobile[]"  onkeypress="return isNumberKey(event)" ></td>
	<td><input type="text" name="ref_email1[]" ></td>
	<td><input type="text" name="ref_email2[]" ></td>	
	<td><input type="text" onkeypress="return isNumberKey(event)" name="ref_phone[]" ></td>
</tr>

</table>

<br>
<h3><strong>Address Details&nbsp;&nbsp;(if both are same then check)</strong>&nbsp;&nbsp;<input type="checkbox" id='add_check' onclick='javascript:copy_address(this);'></h3>
<table width="100%" border="0" cellpadding="3" cellspacing="0">
	<tr class="row1">
	<td><strong>Present Address</strong></td>
	<td colspan="3"><textarea name="hr_applcnt_rgstn[present_address]"  id='present_address' rows="3"></textarea></td>
	<td><strong>City</strong></td>
	<td>
	<select name='hr_applcnt_rgstn[city]' onchange="get_state_country(this.value)" id='city' >
	<option value="">--Select--</option>

 <?php $city="select * from city_master";
                  $cityRes=DB_query($city,$db); 
                  while($cityRow=DB_fetch_array($cityRes)){?>?>
                  <option value="<?php echo $cityRow['id'];?>"><?php echo $cityRow['city']; ?></option>
                <?php } ?>
	</select></td>
</tr>
<tr class="row1">
	<td width="13%"><strong>State</strong></td>
	<td width="20%"><input type="text" name='hr_applcnt_rgstn[state]' id='state' ></td>
	<td width="13%"><strong>Country	</strong></td>
	<td width="20%"><input type="text" name='hr_applcnt_rgstn[country]' id='country' ></td>
	<td width="13%"><strong>Pin code</strong></td>
	<td><input type="text" name='hr_applcnt_rgstn[pincode]' id='pincode' ></td>
</tr>
<tr class="row1">
	<td><strong>Permanent Address</strong></td>
	<td colspan="3"><textarea rows="3" id='prmnt_address' name='hr_applcnt_rgstn[prmnt_address]'></textarea></td>
	<td><strong>City</strong></td>
	<td>
	<select name='hr_applcnt_rgstn[city2]' id='city2' onchange="get_state_country1(this.value)" >
	<option value="">--Select--</option>
	<?php $city="select * from city_master";
                  $cityRes=DB_query($city,$db); 
                  while($cityRow=DB_fetch_array($cityRes)){?>
                  <option value="<?php echo $cityRow['id'];?>"><?php echo $cityRow['city']; ?></option>
                <?php } ?>
	</select></td>
</tr>
<tr class="row1">
	<td><strong>State</strong></td>
	<td><input type="text" name='hr_applcnt_rgstn[state2]' id='state2' ></td>
	<td><strong>Country	</strong></td>
	<td><input type="text" name='hr_applcnt_rgstn[country2]'  id='country2'></td>
	<td><strong>Pin code</strong></td>
	<td><input type="text" name='hr_applcnt_rgstn[pincode2]' id='pincode2' >	</td>
</tr>
</table>
<br>
<h3><strong>Experience Details</strong></h3>
<table width="100%" border="0" cellpadding="3" cellspacing="0" >
	<tr class="row1">
	<td width="13%"><strong>Total Experience</strong></td>
	<td width="20%"><input type="text"  onkeypress="return isNumberKey(event)" name='hr_applcnt_rgstn[total_experience]' id='total_experience' ></td>
	<td width="13%"><strong>Total Company</strong></td>
	<td width="20%"><input type="text"  id="totalcompany" onkeypress="return isNumberKey(event)"  onkeyup="show_company(this.value)" ></td>
	<td colspan="2"></td>
	<!--<td><strong>Pin code</strong></td>
	<td><input type="text" ></td>-->
</tr>
</table>
<br>
<div id="c_show">
<table width="100%" border="1" cellpadding="3" cellspacing="0" style="border:#808080 1px solid;">
<tr>
	<th><strong>Company Name</strong></th>	
	<th width="8%"><strong>From Date</strong></th>
	<th width="8%"><strong>To Date</strong></th>
	<th width="12%"><strong>CTC</strong></th>
	<th width="12%"><strong>Salary Detail</strong></th>
</tr>
<tr>
	<td><input type="text" name="company[]" ></td>	
	<td><input type="text" name="frm_date[]"  class="datepicker"></td>	
	<td><input type="text" name="to_date[]"  class="datepicker"></td>	
	<td><input type="text" name="ctc[]"  ></td>	
	<td><input type="text"  name="salary_dtls[]" ></td>
</tr>
</table>
</div>
<br>
<h3><strong>Education Details</strong></h3>
<table width="100%" border="0" cellpadding="3" cellspacing="0">
	<tr class="row1">
	<td width="13%"><strong>Doctorate/Phd.</strong></td>
	<td width="20%"><select  name="hr_applcnt_rgstn[other_master]" id="Doctorate">
			<option value="">Select</option>
			<option value="Ph.D/Doctorate">Ph.D/Doctorate</option>
			<option value="MPHIL">MPHIL</option>
			<option value="Other">Other</option>
	</select>
    </td>
	<td width="13%"><strong>College/University</strong></td>
	<td width="20%"><input type="text" name="hr_applcnt_rgstn[other_collage]"  placeholder="College/University"></td>
	<td width="7%"><strong>%</strong></td>
	<td width="10%"><input type="text"  placeholder="mark" onkeypress="return isNumber(event);" id="other_collage" name="hr_applcnt_rgstn[other_master_number]" ></td>
	<td width="7%"><strong>Year </strong></td>
	<td><input type="text"  onkeypress="return isNumberKey(event)"  id="other_pass_year" name="hr_applcnt_rgstn[other_master_pass_year]" placeholder="Year"></td>
</tr>
<tr class="row1">
	<td><strong>Post Graduate</strong></td>
	<td><select   name="hr_applcnt_rgstn[master]" id="master">
	<option value="">Select</option>
	<option value="CA">CA</option>
	<option value="CS">CS</option>
	<option value="ICWA">ICWA</option>
	<option value="Integrated PG">Integrated PG</option>
	<option value="LLM">LLM</option>
	<option value="M.A">M.A</option>
	<option value="M.Arch">M.Arch</option>
	<option value="M.Com">M.Com</option>
	<option value="M.Ed">M.Ed</option>
	<option value="M.Pharma">M.Pharma</option>
	<option value="M.Sc">M.Sc</option>
	<option value="M.Tech">M.Tech</option>
	<option value="MBA/PGDM">MBA/PGDM</option>
	<option value="MCA">MCA</option>
	<option value="MS">MS</option>
	<option value="PG Diploma">PG Diploma</option>
	<option value="MVSC">MVSC</option>
	<option value="MCM">MCM</option>
	<option value="Other">Other</option>
	</select></td>
	<td><strong>College/University</strong></td>
	<td><input type="text"  name="hr_applcnt_rgstn[master_collage]" id="master_collage"  placeholder="College/University"></td>
	<td><strong>%</strong></td>
	<td><input type="text"  onkeypress="return isNumber(event);" name="hr_applcnt_rgstn[master_number]" id="master_number"  placeholder="mark"></td>
	<td><strong>Year </strong></td>
	<td><input type="text" onkeypress="return isNumberKey(event)"   name="hr_applcnt_rgstn[master_pass_year]" id="master_pass_year"  placeholder="Year"></td>
</tr>
<tr class="row1">
	<td><strong>Graduate</strong></td>
	<td><select  name="hr_applcnt_rgstn[bachelor]" id="bachelor" >
	<option value="Not Pursuing Graduation"<?php if($bachelor=="Not Pursuing Graduation"){ ?> selected="selected"; <?php }?>>Not Pursuing Graduation</option>
		  <option value="B.A"<?php if($bachelor=="B.A"){ ?> selected="selected"; <?php }?>>B.A</option>
		  <option value="B.Arch"<?php if($bachelor=="B.Arch"){ ?> selected="selected"; <?php }?>>B.Arch</option>
		  <option value="BCA"<?php if($bachelor=="BCA"){ ?> selected="selected"; <?php }?>>BCA</option>
		  <option value="B.B.A"<?php if($bachelor=="B.B.A"){ ?> selected="selected"; <?php }?>>B.B.A</option>
		  <option value="B.Com"<?php if($bachelor=="B.Com"){ ?> selected="selected"; <?php }?>>B.Com</option>
		  <option value="B.Ed"<?php if($bachelor=="B.Ed"){ ?> selected="selected"; <?php }?>>B.Ed</option>
		  <option value="BDS"<?php if($bachelor=="BDS"){ ?> selected="selected"; <?php }?>>BDS</option>
		  <option value="BHM"<?php if($bachelor=="BHM"){ ?> selected="selected"; <?php }?>>BHM</option>
		  <option value="B.Pharma"<?php if($bachelorr=="B.Pharma"){ ?> selected="selected"; <?php }?>>B.Pharma</option>
		  <option value="B.Sc"<?php if($bachelor=="B.Sc"){ ?> selected="selected"; <?php }?>>B.Sc</option>
		  <option value="B.Tech/B.E"<?php if($bachelor=="B.Tech/B.E"){ ?> selected="selected"; <?php }?>>B.Tech/B.E.</option>
		  <option value="LLB"<?php if($bachelor=="LLB"){ ?> selected="selected"; <?php }?>>LLB</option>
		  <option value="MBBS"<?php if($bachelor=="MBBS"){ ?> selected="selected"; <?php }?>>MBBS</option>
		  <option value="Diploma"<?php if($bachelor=="Diploma"){ ?> selected="selected"; <?php }?>>Diploma</option>
		  <option value="BVSC"<?php if($bachelor=="BVSC"){ ?> selected="selected"; <?php }?>>BVSC</option>
		<option value="Other" <?php if($bachelor=="Other"){ ?> selected="selected"; <?php }?>>Other</option>
	</select></td>    
    <td><strong>College/University</strong></td>
	<td><input type="text"   name="hr_applcnt_rgstn[bachelor_collage]" id="bachelor_collage" placeholder="College/University"></td>
	<td><strong>%</strong></td>
	<td><input type="text"  onkeypress="return isNumber(event);" name="hr_applcnt_rgstn[bachelor_number]" id="bachelor_number" placeholder="mark"></td>
	<td><strong>Year </strong></td>
	<td><input type="text"  onkeypress="return isNumberKey(event)" name="hr_applcnt_rgstn[bachelor_pass_year]" id="bachelor_pass_year"  placeholder="Year"></td>
</tr>
<tr class="row1">
	<td><strong>Intermediate</strong></td>
	<td><input type="checkbox" name="hr_applcnt_rgstn[intermediate]" id="intermediate"  value="true" /></td>
	<td><strong>College/University</strong></td>
	<td><input type="text"  name="hr_applcnt_rgstn[intermediate_collage]" id="intermediate_collage" placeholder="College/University"></td>
	<td><strong>%</strong></td>
	<td><input type="text"   onkeypress="return isNumber(event);" name="hr_applcnt_rgstn[intermediate_number]" id="intermediate_number" placeholder="mark"></td>
	<td><strong>Year </strong></td>
	<td><input type="text"  onkeypress="return isNumberKey(event)" name="hr_applcnt_rgstn[intermediate_year]" id="intermediate_year" placeholder="Year"></td>
</tr>
<tr class="row1">
	<td><strong>High School</strong></td>
	<td><input type="checkbox"  name="hr_applcnt_rgstn[tenth]" id="tenth" value="true"  /></td>
	<td><strong>College/University</strong></td>
	<td><input type="text"   name="hr_applcnt_rgstn[tenth_collage]" id="tenth_collage" placeholder="College/University"></td>
	<td><strong>%</strong></td>
	<td><input type="text"  onkeypress="return isNumber(event);" name="hr_applcnt_rgstn[tenth_number]" id="tenth_number"   placeholder="mark"></td>
	<td><strong>Year </strong></td>
	<td><input type="text" onkeypress="return isNumberKey(event)" name="hr_applcnt_rgstn[tenth_year]" id="tenth_year"  placeholder="Year"></td>
</tr>
</table>
<br>
<h3><strong>Other Education Details</strong></h3>
<table width="100%" border="0" cellpadding="3" cellspacing="0">
	<tr class="row1">
	<td width="13%"><strong>Certificate 1</strong></td>
	<td width="20%"><input type="text"  name="hr_applcnt_rgstn[course1]" id="course1"></td>
	<td width="13%"><strong>College/University</strong></td>
	<td width="20%"><input type="text"  name="hr_applcnt_rgstn[course1_collage]" id="course1_collage"></td>
	<td width="7%"><strong>%/Grade</strong></td>
	<td width="10%"><input type="text"  onkeypress="return isNumber(event);" name="hr_applcnt_rgstn[course1_number]" id="course1_number"></td>
	<td width="7%"><strong>Duration</strong></td>
	<td><input type="text"  name="hr_applcnt_rgstn[course1_duration]" id="course1_duration"></td>
</tr>
<tr class="row1">
	<td><strong>Certificate 2</strong></td>
	<td><input type="text"  name="hr_applcnt_rgstn[course2]" id="course2"></td>
	<td><strong>College/University</strong></td>
	<td><input type="text"  name="hr_applcnt_rgstn[course2_collage]" id="course2_collage"></td>
	<td><strong>%/Grade</strong></td>
	<td><input type="text"  name="hr_applcnt_rgstn[course2_number]" id="course2_number"></td>
	<td><strong>Duration</strong></td>
	<td><input type="text"  name="hr_applcnt_rgstn[course2_duration]" id="course2_duration"></td>
</tr>
<tr class="row1">
	<td><strong>Certificate 3</strong></td>
	<td><input type="text"  name="hr_applcnt_rgstn[course3]" id="course3" ></td>
	<td><strong>College/University</strong></td>
	<td><input type="text"  name="hr_applcnt_rgstn[course3_collage]" id="course3_collage"></td>
	<td><strong>%/Grade</strong></td>
	<td><input type="text"  name="hr_applcnt_rgstn[course3_number]" id="course3_number"></td>
	<td><strong>Duration</strong></td>
	<td><input type="text"  name="hr_applcnt_rgstn[course3_duration]" id="course3_duration"></td>
</tr>
<tr class="row1">
	<td><strong>Key Skill</strong></td>
	<td colspan="7"><textarea rows="3" name="hr_applcnt_rgstn[key_skill]" ></textarea></td>
</tr>
</table>
<br>
<h3><strong>Attachment Details</strong></h3>
<table width="100%" border="0" cellpadding="3" cellspacing="0">
<tr class="row1">
	<td width="13%"><strong>Document</strong></td>
	<td width="20%"><input type="file" name='attach' id="attach"></td>
	<td><textarea rows="3" name="hr_applcnt_rgstn[document]" ></textarea></td>
</tr>
<tr class="row1">
	<td style="text-align:center;" colspan="3">
	<input name="Search" type="submit" class="search"  value="Save"/></td>
</tr>
</table>


	
</div></div>
</form>

<script>
function copy_address(str)
{
   if($('#'+str.id).is(':checked')==true)
       {
            $("#present_address").attr('readonly','true')  ;
            $("#state").attr('readonly','true')  ;
            $("#country").attr('readonly','true')  ;
            $("#pincode").attr('readonly','true')  ;
            $("#city").attr('readonly','true')  ;
            $("#prmnt_address").val($("#present_address").val());
            $("#state2").val($("#state").val());
            $("#country2").val($("#country").val());
            $("#pincode2").val($("#pincode").val());
            $("#city2").val($("#city").val());   
       }
    else
        {
            
            $("#present_address").removeAttr('readonly')  ;
            $("#state").removeAttr('readonly')  ;
            $("#country").removeAttr('readonly')  ;
            $("#pincode").removeAttr('readonly')  ;
            $("#city").removeAttr('readonly')  ;
            $("#prmnt_address").val(null);
            $("#state2").val(null);
            $("#country2").val(null);
            $("#pincode2").val(null);
            $("#city2").val(null);  

        }
}



function getAge() {

	var birth1= $("#dob").val();
	//alert(birth);
	if(birth1!=''){
	var birth=new Date(birth1);
    var today = new Date();
    var nowyear = today.getFullYear();
    var nowmonth = today.getMonth();
    var nowday = today.getDate();
    //alert(nowyear);

    var birthyear = birth.getFullYear();
    var birthmonth = birth.getMonth();
    var birthday = birth.getDate();
    // alert(birthyear);
    var age = nowyear - birthyear;
    var age_month = nowmonth - birthmonth;
    var age_day = nowday - birthday;   
    // alert(age);
     $("#age").val(age);
 }

}

function show_company(str)
{

	var ajax;
    if(window.XMLHttpRequest)
    {
        ajax=new XMLHttpRequest();
    }
   else
    {
        ajax=new ActiveXObject("Microsoft.XMLHTTP");
    }
    ajax.onreadystatechange=function(){
        if(ajax.readyState==4 && ajax.status==200)
            {
                //alert(ajax.responseText);
               document.getElementById("c_show").innerHTML=ajax.responseText;
               $('.datepicker').removeClass('hasDatepicker').datepicker({ dateFormat: 'dd/mm/yy',changeMonth: true, changeYear: true,yearRange: '-80:+20'});
            }
    }
  
    ajax.open("POST","ajax_randon_company.php?str="+str,true);
    ajax.send();
}

function get_state_country(str){
		//alert(str);
		if(str!=''){
	$.post('ajax_get_state_country1.php',{"id":str},function(data){
      if(data!='')
      {
        //alert(data);
        var arr = data.split('__');
         // var asd=$("#"+id).val('');
         $("#state").val(arr[0].replace(/\s/g, ""));
         $("#country").val(arr[1].replace(/\s/g, ""));
       //  alert(asd);
          //$(this).val(""); 
         return true;
      }
      
  });

}
}
function get_state_country1(str){
		//alert(str);
		if(str!=''){
	$.post('ajax_get_state_country1.php',{"id":str},function(data){
      if(data!='')
      {
        //alert(data);
        var arr = data.split('__');
         // var asd=$("#"+id).val('');
         $("#state2").val(arr[0]);
         $("#country2").val(arr[1]);
       //  alert(asd);
          //$(this).val(""); 
         return true;
      }
      
  });

}
}

function isNumberKey(evt)
      {
         var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode > 31 && (charCode < 48 || charCode > 57) )
            return false;
         else   
          return true;
      
      }
function isNumber(evt) {
    evt = (evt) ? evt : window.event;
    var charCode = (evt.which) ? evt.which : evt.keyCode;
    if (charCode > 31 && (charCode < 46 || charCode > 57)) {
        return false;
    }
    return true;
}

function validation(){	
   if(document.getElementById("fname").value==''){
   	alert("Please Fill First Name");
   	document.getElementById("fname").focus();
   	return false;  
   }
   if(document.getElementById("attach").value==''){
   	alert("Please Attach a document");
   	document.getElementById("attach").focus();
   	return false;  
   }
 /*
   if(document.getElementById("dob").value==''){
   	alert("Please Fill Date Of Birth");
   		document.getElementById("dob").focus();
   	return false;
   }
    if(document.getElementById("email1").value==''){
   	alert("Please Fill Email Id");
   	document.getElementById("email1").focus();
   	return false;
   }
    if(document.getElementById("mobile1").value==''){
   	alert("Please Fill mobile1");
   		document.getElementById("mobile1").focus();
   	return false;
   }
   if(document.getElementById("ref_name").value==''){
   	alert("Please Fill Reference Name");
   		document.getElementById("ref_name").focus();
   	return false;
   }
   if(document.getElementById("ref_mobile").value==''){
   	alert("Please Fill Mobile");
   		document.getElementById("ref_mobile").focus();
   	return false;
   }
   if(document.getElementById("ref_email1").value==''){
   	alert("Please Fill Personal Email");
   		document.getElementById("ref_email1").focus();
   	return false;
   }
    if(document.getElementById("ref_email2").value==''){
   	alert("Please Fill Office Email ID ");
   		document.getElementById("ref_email2").focus();
   	return false;
   }
   if(document.getElementById("ref_phone").value==''){
   	alert("Please Fill Office Phone");
   		document.getElementById("ref_phone").focus();
   	return false;
   }

*/
}
   
</script>
 