<? 
require_once "include/application.php"; 
require_once "include/function.php";
require_once "include/parameter.php";
require_once "include/newvalue_lib.php";


if($btnAdd){

	$dob=$year."-".$month."-".$day;
	$spdob=$spyear."-".$spmonth."-".$spday;
	$pwd=generatePassword();

	if(count($complementary)>0)$comp=implode(",", $complementary);	
	
	$ret=get_data("ip_program,ip_night","ivc_products","where ip_id='$scheme'");
	list($d,$m,$y)=split("/",$joindate);
	$exp=date("Y-m-d",mktime(0,0,0,$m,$d-1,$y+$ret["ip_program"]));

	$sql="
		INSERT INTO  `ivc_members` 
		(`im_formno`, `im_scheme`, `im_category`, `im_name`, `im_title`, `im_cardno`, `im_cardname`, 
		`im_nominee`, `im_nomtitle`, `im_ic`, `im_dob`, `im_nationality`, `im_foreignspecify`, `im_marital`, `im_language`, 
		`im_langaugespecify`, `im_addr1`, `im_addr2`, `im_addr3`, `im_postcode`, `im_country`, `im_maddr1`, `im_maddr2`, 
		`im_maddr3`, `im_mpostcode`, `im_mcountry`, `im_phome`, `im_mobile`, `im_fax`, `im_email`, `im_occupation`, `im_income`,
		`im_joindate`, `im_business`, `im_nature`, `im_offaddr1`, `im_offaddr2`, `im_offaddr3`, `im_offpostcode`, `im_website`, 
		`im_officephone`, `im_officeext`, `im_officefax`, `im_nominee1`, `im_designation1`, `im_nomineehome1`, `im_nomineemobile1`,
		`im_nomineefax1`, `im_nomineeemail1`, `im_nominee2`, `im_designation2`, `im_nomineehome2`, `im_nomineemobile2`, 
		`im_nomineefax2`, `im_nomineeemail2`, `im_spouse`, `im_sptitle`, `im_spic`, `im_spdob`, `im_spnationality`, 
		`im_spforeignspecify`, `im_spoccupation`, `im_sphome`, `im_spmobile`, `im_spfax`, `im_spemail`, `im_user`,im_active,im_userid,
		 im_pwd,im_complementary,im_freemaint,im_expired,im_entnight,im_program) 
		VALUES 
		('$formno', '$scheme', '$category', \"$name\", '$title', '$cardno', \"$cardname\", 
		\"$nominee\", '$nomtitle', '$ic', '$dob', '$nationality', '$foreignspecify', '$marital', '$language', 
		'$langaugespecify', \"$addr1\", \"$addr2\", \"$addr3\", '$postcode', '$country',\"$maddr1\", \"$maddr2\", 
		\"$maddr3\", '$mpostcode', '$mcountry', '$phome', '$mobile', '$fax', '$email', '$occupation', '$income', 
		'".system_date($joindate)."', \"$business\", \"$nature\", \"$offaddr1\", \"$offaddr2\", \"$offaddr3\", '$offpostcode', '$website',
		'$officephone', '$officeext', '$officefax', \"$nominee1\", \"$designation1\", '$nomineehome1', '$nomineemobile1', 
		'$nomineefax1', '$nomineeemail1', \"$nominee2\", \"$designation2\", '$nomineehome2', '$nomineemobile2', 
		'$nomineefax2', '$nomineeemail2', \"$spouse\", '$sptitle', '$spic', '$spdob', '$spnationality', 
		'$spforeignspecify', '$spoccupation', '$sphome', '$spmobile', '$spfax', '$spemail', '".$_SESSION["egoUser"]."','Yes','$cardno',
		'".md5($pwd)."','$comp','$maint','$exp','".$ret["ip_night"]."','".$ret["ip_program"]."');		
	";

	@mysql_query($sql) or die(mysql_error());

	for($i=0;$i<$ret["ip_program"];$i++){
		$j=$i+1;

		$ystart=date("Y-m-d",mktime(0,0,0,$m,$d,$y+$i));			
		$yent=date("Y-m-d",mktime(0,0,0,$m,$d-1,$y+$j));			
	

		$sql="INSERT INTO `ivc_yearly_ent` (
		  `ye_memberno` ,
		  `ye_start` ,
		  `ye_expiry` ,
		  `ye_night` ,
		  `ye_year` 
		  )
		  VALUES (
		  '$formno', '$ystart','$yent', '".$ret["ip_night"]."','$j'
		  );
		";
		@mysql_query($sql) or die(mysql_error());		
	}


	if($email){
		$message="Dear $name, 

		Welcome to Iconic Vacation Club! 
		
		We are glad to have you with us, being part of IVC has never made more sense! 
		
		The orientation meeting which you have attended was designed to help you become acquainted with the club.  In order to provide a seamless experience and service to our members, we have created a booking engine where the members may use their membership ID & password to log-in to website – www.iconicvacationclub.com  for the followings:
		
		a)	Resort Information
		b)	Member's Profile 
		c)	Online Villa Booking 
		d)	Member login and retrieval of own reservations and possibility to amend or cancel reservation (following certain rules) 
		Example 
		Membership ID : $cardno
		Login Password : $pwd
		Remarks : Member may change the password after the initial log-in 
		
		Please feel free to browse your way through our website, should you have any query or require any clarification please feel free to contact us at the following:
		Email Address : member@iconicvacationclub.com
		Member Service Centre - Contact Number : ( 03 ) 3141 3288 
		
		We will be happy to hear from you.
		
		Thank you!
		";
	


	//	mail($email,"Welcome to Iconic Vacation Club! ",$message,'From: '.EMAIL);	
	}

	print("<script type='text/javascript'>alert('Record is added.')</script>");
	print("<script type='text/javascript'>location.href='newMembers.php'</script>");

}


if(!$country)$country="Malaysia";
if(!$joindate)$joindate=date("d/m/Y");
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="sddm.css" >
<link rel="stylesheet" type="text/css" href="include/tabcontent.css" />

<script type="text/javascript" src="include/tabcontent.js">

/***********************************************
* Tab Content script v2.2- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

</script>

<script src="include/validation.js" type="text/javascript"></script>
  <link rel="stylesheet" href="datepicker/themes/winter.css" />
<!-- Loading Calendar JavaScript files -->
    <script type="text/javascript" src="datepicker/zapatec.js"></script>
    <script type="text/javascript" src="datepicker/calendar.js"></script>
<!-- Loading language definition file -->
    <script type="text/javascript" src="datepicker/calendar-en.js"></script>
<script language="javascript">
function copyaddr(){
	document.form.maddr1.value=document.form.addr1.value;
	document.form.maddr2.value=document.form.addr2.value;
	document.form.maddr3.value=document.form.addr3.value;	
	document.form.mpostcode.value=document.form.postcode.value;
	document.form.mcountry.value=document.form.country.value;
}
</script>
<title><? echo TITLE?></title></head>
<body>

<table width="1024" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#f1efd8">
  <tr>
    <td  colspan="2" align="center"><? require_once "include/header.php"; ?></td>
  </tr>
  <tr>
    <td colspan="2" align="center">&nbsp;</td>
  </tr>
  <tr>
    <td width="185" valign="top" bgcolor="e6f3f9">
	
<? require_once "include/columnLeft.php";
if(array_search("Membership",$menulist)==false)
		print("<script type='text/javascript'>location.href='index.php'</script>");
 ?>	</td>
    <td width="834" valign="top">
	<form name="form" method="post" action="<?=$PHP_SELF ?>"  ONSUBMIT="return ValidateAddMember(this)">
	  <table width="820" height="250" border="0" align="center" cellpadding="0" cellspacing="0">
      
      <tr>
        
        <td valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="2">
          <tr>
            <td height="30" colspan="2" class="TitleH3">New Membership </td>
          </tr>
          <tr>
            <td height="1" colspan="2" bgcolor="#B8ED83"></td>
          </tr>
          <tr>
            <td colspan="2" ><? echo "<div class='Msg'>$action_msg</div>" ?>&nbsp;</td>
          </tr>
          <tr>
            <td width="47%" valign="top" ><table id="tbl-tabMainContact" class="editTbl" border="0" cellspacing="0" 
  cellpadding="0">
              <tr>
                <th height="23" class="TextH1"><div align="left">Form No : <span class="require">*</span></div></th>
                <td class="TextH1"><input 
      name="formno" id="formno" value="<? echo $formno ?>" maxlength="10" style="WIDTH: 180px"/>                </td>
              </tr>
              <tr>
                <th height="23" class="TextH1"><div align="left">Type of Product :  <span class="require">*</span></div></th>
                <td class="TextH1"><select name="scheme" id="scheme" style="WIDTH: 180px">
                  <option value=""></option>
                  <?
			 
			 	$sql="select * from ivc_products order by ip_name";
				$result=mysql_query($sql) or die(mysql_error());				
				while($myrow=MySQL_fetch_array($result,MYSQL_ASSOC)){
					echo "<option value='".$myrow["ip_id"]."' ";
					if($scheme==$myrow["ip_id"])echo "selected";
					echo ">".$myrow["ip_code"]." - ".$myrow["ip_name"]."</option>";
				}
			
?>
                </select></td>
              </tr>
              <tr>
                <th height="23" class="TextH1"><div align="left">Category of Membership :  <span class="require">*</span></div></th>
                <td class="TextH1"><select name="category" id="category" style="WIDTH: 180px">
                  <option value=""></option>
                  <option value="Individual">Individual</option>
                  <option value="Corporate">Corporate</option>
                </select>
                  <? stayfocus("form","category",$category) ?></td>
              </tr>
              <tbody>
                <tr>
                  <th width="181" height="23" class="TextH1"><div align="left">Name of Applicant :  <span class="require">*</span></div></th>
                  <td width="201" class="TextH1"><input 
      name="name" id="name" value="<? echo $name ?>" maxlength="50" style="WIDTH: 180px"/>                  </td>
                </tr>
                <tr>
                  <th height="23" class="TextH1"><div align="left">Title :</div></th>
                  <td class="TextH1"><span class="main">
                    <select name="title" id="title" style="WIDTH: 180px" onchange="javascript:if(this.options[selectedIndex].value=='add'){newvalue('Title',this.value);}">
                      <option value="1"></option>
					  					   <?
			 
			 	$sql="select * from newvalue where nv_type='Title' order by nv_id";
				$result=mysql_query($sql) or die(mysql_error());				
				while($myrow=MySQL_fetch_array($result,MYSQL_ASSOC)){
					echo "<option value='".$myrow["nv_id"]."' ";
					if($title==$myrow["nv_id"])echo "selected";
					echo ">".$myrow["nv_name"]." </option>";
				}
			
?>
                            </select>
                  </span></td>
                </tr>
                <tr>
                  <th height="23" class="TextH1"><div align="left">Card No. : <span class="require">*</span></div></th>
                  <td class="TextH1"><input 
      name="cardno" id="cardno" value="<? echo $cardno ?>" maxlength="16" style="WIDTH: 180px"/>                  </td>
                </tr>
                <tr>
                  <th height="23" class="TextH1"><div align="left">Name on the Card : <span class="require">*</span></div></th>
                  <td class="TextH1"><input 
      name="cardname" id="cardname" value="<? echo $cardname ?>" maxlength="50" style="WIDTH: 180px"/>                  </td>
                </tr>
                <tr>
                  <th height="23" class="TextH1"><div align="left">Name of Nominee :</div></th>
                  <td class="TextH1"><input 
      name="nominee" id="nominee" value="<? echo $nominee ?>" maxlength="50" style="WIDTH: 180px"/>                  </td>
                </tr>
                <tr>
                  <th height="23" class="TextH1"><div align="left">Title :</div></th>
                  <td class="TextH1"><span class="main">
                    <select name="nomtitle" id="nomtitle" style="WIDTH: 180px" onchange="javascript:if(this.options[selectedIndex].value=='add'){newvalue('Title',this.value);}">
                      <option value="1"></option>
                      <?
			 
			 	$sql="select * from newvalue where nv_type='Title' order by nv_id";
				$result=mysql_query($sql) or die(mysql_error());				
				while($myrow=MySQL_fetch_array($result,MYSQL_ASSOC)){
					echo "<option value='".$myrow["nv_id"]."' ";
					if($nomtitle==$myrow["nv_id"])echo "selected";
					echo ">".$myrow["nv_name"]." </option>";
				}
			
?>
                    </select>
                  </span></td>
                </tr>
                <tr>
                  <th height="23" class="TextH1"><div align="left">NRIC/Passport : <span class="require">*</span></div></th>
                  <td class="TextH1"><input 
      name="ic" id="ic" value="<? echo $ic ?>" maxlength="20" style="WIDTH: 180px"/>                  </td>
                </tr>
                <tr>
                  <th height="23" class="TextH1"><div align="left">Date of Birth : </div></th>
                  <td class="TextH1"><?
echo "<select name='day'>";
echo '<option value=""></option>\n';
foreach ($days as $value) {
	echo '<option value="'.$value.'"';
	if($day==$value)echo ' selected';
	echo '>'.$value.'</option>\n';
} echo '</select> ';

echo "<select name='month'>";
echo '<option value=""></option>\n';
foreach ($months  as $key => $value) {
	echo '<option value="'.$key.'"';
	if($month==$key)echo ' selected';
	echo '>'.$value.'</option>\n';
}
echo '</select> ';

echo "<select name='year'>";
echo '<option value=""></option>\n';
foreach ($years as $value) {
	echo '<option value="'.$value.'"';
	if($year==$value)echo ' selected';
	echo '>'.$value.'</option>\n';
} 
echo '</select> ';
?>
                      <span class="subItem"></span></td>
                </tr>
                <tr>
                  <th height="23" class="TextH1"><div align="left">Nationality : </div></th>
                  <td class="TextH1"><input name="nationality" type="radio" value="Malaysian" <?=($nationality=="Malaysian" ? "CHECKED" : " ")?>/>
                    Malaysian</td>
                </tr>
                <tr>
                  <th height="23" class="TextH1"><div align="left"></div></th>
                  <td class="TextH1"><input name="nationality" type="radio" value="China" <?=($nationality=="China" ? "CHECKED" : " ")?>/>
                    China</td>
                </tr>
                <tr>
                  <th height="23" class="TextH1"><div align="left"></div></th>
                  <td class="TextH1"><input name="nationality" type="radio" value="Foreign" <?=($nationality=="Foreign" ? "CHECKED" : " ")?>/>
                    Foreign<span class="subItem"> (Please Specify) </span></td>
                </tr>
                <tr>
                  <th height="23" class="TextH1"><div align="left"></div></th>
                  <td class="TextH1"><input 
      name="foreignspecify" id="foreignspecify" value="<? echo $foreignspecify ?>" maxlength="50" style="WIDTH: 180px"/></td>
                </tr>
                <tr>
                  <th height="23" class="TextH1"><div align="left">Marital Status : </div></th>
                  <td class="TextH1"><select style="WIDTH: 180px"
      name="marital" id="marital">
                      <option value="1"></option>
                      <?
			 
			 	$sql="select * from newvalue where nv_type='Status' order by nv_id";
				$result=mysql_query($sql) or die(mysql_error());				
				while($myrow=MySQL_fetch_array($result,MYSQL_ASSOC)){
					echo "<option value='".$myrow["nv_id"]."' ";
					if($marital==$myrow["nv_id"])echo "selected";
					echo ">".$myrow["nv_name"]." </option>";
				}
			
?>

                    </select>                  </td>
                </tr>
                <tr>
                  <th height="23" class="TextH1"><div align="left">Language : </div></th>
                  <td class="TextH1"><select style="WIDTH: 180px"
      name="language" id="language">
                      <option value="1"></option>
                      <?
			 
			 	$sql="select * from newvalue where nv_type='Language' order by nv_id";
				$result=mysql_query($sql) or die(mysql_error());				
				while($myrow=MySQL_fetch_array($result,MYSQL_ASSOC)){
					echo "<option value='".$myrow["nv_id"]."' ";
					if($langauge==$myrow["nv_id"])echo "selected";
					echo ">".$myrow["nv_name"]." </option>";
				}
			
?>

                    </select>                  </td>
                </tr>
                <tr>
                  <th height="23" class="TextH1"><div align="left"></div></th>
                  <td class="TextH1"><span class="subItem">(Please Specify) </span></td>
                </tr>
                <tr>
                  <th height="23" class="TextH1"><div align="left"></div></th>
                  <td class="TextH1"><input 
      name="langaugespecify" id="langaugespecify" value="<? echo $langaugespecify ?>" maxlength="50" style="WIDTH: 180px"/></td>
                </tr>

                      <tr>
                        <td  height="23" class="TextH1">Home Address /<br />
                          Registered Address</th>
                        : <td><input style="WIDTH: 180px" maxlength="50" name="addr1" />                        </td>
                      </tr>
                          <td height="23" class="TextH1">
                          <td><input style="WIDTH: 180px" maxlength="50" name="addr2" />                        </td>
                      </tr>
                      <tr>
                        <td height="23" class="TextH1">
                        <td><input style="WIDTH: 180px" maxlength="50" name="addr3" />                        </td>
                      </tr>
                      <tr>
                        <td height="23" class="TextH1">Postcode :</td>
                        <td><input 
      name="postcode" id="postcode" style="WIDTH: 180px" value="<? echo $postcode ?>" maxlength="15" />                        </td>
                      </tr>
                      <tr>
                        <td height="23" class="TextH1">Country</th>
                        : <td>                <select name="country" id="country">
						<option value=""></option>
						                <? require "country.php"; ?>
										</select>
										                <? stayfocus("form","country",$country) ?>	                        </td>
                      </tr>
                      <tr>
                        <td  height="23" class="TextH1">Mailing Address
                          </th>
                          : </td>
                        <td><span class="text12">
                          <input name="btnCopy" type="button" class="btn150" id="btnCopy" value="Copy as above" onclick="copyaddr()"/>
                        </span></td>
                      </tr>
                      <tr>
                        <td  height="23" class="TextH1">&nbsp;</td>
                        <td><input name="maddr1" id="maddr1" style="WIDTH: 180px" value="<? echo $maddr1 ?>" maxlength="50" />                        </td>
                      </tr>
                      <tr>
                        <td height="23" class="TextH1"></td>
                        <td><input name="maddr2" id="maddr2" style="WIDTH: 180px" maxlength="50" />                        </td>
                      </tr>
                      <tr>
                        <td height="23" class="TextH1"></td>
                        <td><input name="maddr3" id="maddr3" style="WIDTH: 180px" maxlength="50" />                        </td>
                      </tr>
                      <tr>
                        <td height="23" class="TextH1">Postcode
                            </th>
                          : </td>
                        <td><input 
      name="mpostcode" id="mpostcode" style="WIDTH: 180px" value="<? echo $mpostcode ?>" maxlength="15" />                        </td>
                      </tr>
                      <tr>
                        <td height="23" class="TextH1">Country
                            </th>
                          : </td>
                        <td><select name="mcountry" id="mcountry">
                            <option value=""></option>
                            <? require "country.php"; ?>
                          </select>
                            <? stayfocus("form","mcountry",$mcountry) ?>                        </td>
                      </tr>
                      <tr>
                        <th height="23" class="TextH1"><div align="left">Contact No. : </div></th>
                        <td class="TextH1">Home                          </td>
                      </tr>
                      <tr>
                        <th height="23" class="TextH1"><div align="left"></div></th>
                        <td class="TextH1"><input 
      name="phome" id="phome" style="WIDTH: 180px" value="<? echo $phome ?>" maxlength="20" />                        </td>
                      </tr>
                      <tr>
                        <th height="23" rowspan="2" class="TextH1"><div align="left"></div></th>
                        <td class="TextH1">Mobile                          </td>
                      </tr>
                      <tr>
                        <td class="TextH1"><input 
      name="mobile" id="mobile" style="WIDTH: 180px" value="<? echo $mobile ?>" maxlength="20" /></td>
                      </tr>
                      <tr>
                        <th height="23" rowspan="2" class="TextH1"><div align="left"></div></th>
                        <td class="TextH1">Fax                          </td>
                      </tr>
                      <tr>
                        <td class="TextH1"><input 
      name="fax" id="fax" style="WIDTH: 180px" value="<? echo $fax ?>" maxlength="20" /></td>
                      </tr>
                      <tr>
                        <th height="23" class="TextH1"><div align="left">Email : </div></th>
                        <td class="TextH1"><input 
      name="email" id="email" style="WIDTH: 180px" value="<? echo $email ?>" maxlength="50" />                        </td>
                      </tr>
				
                <tr>
                  <th height="23" class="TextH1"><div align="left">Occupation : </div></th>
                  <td class="TextH1"><input 
      name="occupation" id="occupation" style="WIDTH: 180px" value="<? echo $occupation ?>" maxlength="50" />                  </td>
                </tr>
                <tr>
                  <th height="23" class="TextH1"><div align="left">Annual Income : </div></th>
                  <td class="TextH1"><select style="WIDTH: 180px"
      name="income" id="income">
                      <option value="1"></option>
                      <?
			 
			 	$sql="select * from newvalue where nv_type='Income' order by nv_id";
				$result=mysql_query($sql) or die(mysql_error());				
				while($myrow=MySQL_fetch_array($result,MYSQL_ASSOC)){
					echo "<option value='".$myrow["nv_id"]."' ";
					if($income==$myrow["nv_id"])echo "selected";
					echo ">".$myrow["nv_name"]." </option>";
				}
			
?>
                    </select>                  </td>
                </tr>
                <tr class="small">
                  <td class="TextH1">Free Maintenance Fees :</td>
                  <td class="TextH1"><input name="maint" type="text" class="small" id="maint" value="<? echo $maint ?>" size="2" maxlength="2" /> 
                    Years </td>
                </tr>
                <tr class="small">
                  <td valign="top" class="TextH1">Complementary :</td>
                  <td class="TextH1"><select name="complementary[]" size="7" multiple="multiple" id="complementary">
                    <?
			 	$sql="select * from newvalue where nv_type='Complementary' order by nv_name";
				$result=mysql_query($sql) or die(mysql_error());				
				while($myrow=MySQL_fetch_array($result,MYSQL_ASSOC)){
					echo "<option value='".$myrow["nv_id"]."'>".$myrow["nv_name"]." </option>";
				}
			
?>
                                    </select>
                    <? staymultifocus("form","complementary",$complementary) ?></td>
                </tr>
                <tr class="small">
                  <td class="TextH1">Apply Date : <span class="require">*</span></td>
                  <td class="TextH1"><input name="joindate" type="text" class="small" id="joindate"   value="<? echo $joindate ?>" size="15" maxlength="10" />
                      <button id="trigger_joindate">...</button>
                    <script type="text/javascript">//<![CDATA[
      Zapatec.Calendar.setup({
        weekNumbers       : false,
        electric          : false,
        inputField        : "joindate",
        button            : "trigger_joindate",
        ifFormat          : "%d/%m/%Y",
        daFormat          : "%Y/%m/%d"
      });
    //]]></script>
                      <span class="subItem"> dd/mm/yyyy</span></td>
                </tr>
              </tbody>
            </table></td>
            <td width="53%" rowspan="2" valign="top" ><div id="pettabs" class="indentmenu">
<ul>
<li><a href="#" rel="dog1" class="selected">BUSINESS INFORMATION</a></li>
<li><a href="#" rel="dog2">FAMILY INFORMATION</a></li>

</ul>
<br style="clear: left" />
</div>

<div style="border:1px solid gray; width:400px; height: 630px; padding: 5px; margin-bottom:1em">

<div id="dog1" class="tabcontent">
<table id="tbl-tabAddresses" class="editTbl" border="0" cellspacing="0" cellpadding="0">
                    <tbody>
					               <tr>
                        <td height="23" class="TextH1">Name of Business/
Employer : 
                        </td>
                        <td><input name="business" id="business" style="WIDTH: 180px" value="<? echo $business ?>" maxlength="100" /></td>
                      </tr>
                      <tr>
                        <td height="23" class="TextH1">Nature of Business : </td>
                        <td><input name="nature" style="WIDTH: 180px" value="<? echo $nature ?>" maxlength="100"/></td>
                      </tr>
                      <tr>
                        <td height="23" class="TextH1">Office Address : </th>
                        <td><input name="offaddr1" style="WIDTH: 180px" value="<? echo $offaddr1 ?>" maxlength="50" /></td>
                      </tr>
                      <tr>
                        <td height="23" class="TextH1"></td>
                        <td><input name="offaddr2" style="WIDTH: 180px" value="<? echo $offaddr2 ?>" maxlength="50"/></td>
                      </tr>
                      <tr>
                        <td height="23" class="TextH1"></td>
                        <td><input name="offaddr3" style="WIDTH: 180px" value="<? echo $offaddr3 ?>" maxlength="50"/></td>
                      </tr>
                      <tr>                     
                        <td height="23" class="TextH1">Postcode : </td>
                         <td><input 
      name="offpostcode" style="WIDTH: 180px" value="<? echo $offpostcode ?>" maxlength="15" />                        </td>
	  

      </tr>                <tr>
                        <td height="23" class="TextH1">Company Website : </td>
                        <td><input name="website" style="WIDTH: 180px" value="<? echo $website ?>" maxlength="100" /></td>

                      </tr>
                      <tr>
                        <td height="23" class="TextH1">Office Tel. No. : </td>
                        <td><input style="WIDTH: 100px" maxlength="20" name="officephone" /> 
                  </td>
                      </tr>
                      <tr>
                        <td height="23" class="TextH1">Ext : </td>
                        <td><input style="WIDTH: 100px" maxlength="5" name="officeext" /> 
                  </td>
                      </tr>
                      <tr>
                        <td height="23" class="TextH1">Fax : </td>
                        <td><input style="WIDTH: 100px" maxlength="20" name="officefax" /> <span class="subItem"> eg.0379770976 </span>
                  </td>
                      </tr>
                      <tr>
                        <td height="23" class="TextH1">Name of Nominee (1) : </td>
                        <td><input style="WIDTH: 180px" maxlength="50" name="nominee1" /> 
                  </td>
                      </tr>
                      <tr>
                        <td height="23" class="TextH1">Designation : </td>
                        <td><input style="WIDTH: 180px" maxlength="50" name="designation1" /> 
                  </td>
                      </tr>
       <tr>
                        <td height="23" class="TextH1"><div align="left">Contact No. : </div></td>
                        <td class="TextH1">Home                          </td>
                      </tr>
                      <tr>
                        <td height="23" class="TextH1"></td>
                        <td class="TextH1"><input 
      name="nomineehome1" style="WIDTH: 180px" value="<? echo $nomineehome1 ?>" maxlength="20" />                        </td>
                      </tr>
                      <tr>
                        <td height="23" rowspan="2" class="TextH1"><div align="left"></div></td>
                        <td class="TextH1">Mobile                          </td>
                      </tr>
                      <tr>
                        <td class="TextH1"><input 
      name="nomineemobile1" style="WIDTH: 180px" value="<? echo $nomineemobile1 ?>" maxlength="20" /></td>
                      </tr>
                      <tr>
                        <th height="23" rowspan="2" class="TextH1"></th>
                        <td class="TextH1">Fax                          </td>
                      </tr>
                      <tr>
                        <td class="TextH1"><input 
      name="nomineefax1" style="WIDTH: 180px" value="<? echo $nomineefax1 ?>" maxlength="20" /></td>
                      </tr>
                      <tr>
                        <th height="23" class="TextH1"><div align="left">Email : </div></th>
                        <td class="TextH1"><input 
      name="nomineeemail1"  style="WIDTH: 180px" value="<? echo $nomineeemail1 ?>" maxlength="50" />                        </td>
                      </tr>
					  
			               <tr>
                        <td height="23" class="TextH1">Name of Nominee (2) : </td>
                        <td><input style="WIDTH: 180px" maxlength="50" name="nominee2" /> 
                  </td>
                      </tr>
                      <tr>
                        <td height="23" class="TextH1">Designation : </td>
                        <td><input style="WIDTH: 180px" maxlength="50" name="designation2" /> 
                  </td>
                      </tr>
       <tr>
                        <td height="23" class="TextH1"><div align="left">Contact No. : </div></td>
                        <td class="TextH1">Home                          </td>
                      </tr>
                      <tr>
                        <td height="23" class="TextH1"></td>
                        <td class="TextH1"><input 
      name="nomineehome2" id="home" style="WIDTH: 180px" value="<? echo $nomineehome2 ?>" maxlength="20" />                        </td>
                      </tr>
                      <tr>
                        <td height="23" rowspan="2" class="TextH1"><div align="left"></div></td>
                        <td class="TextH1">Mobile                          </td>
                      </tr>
                      <tr>
                        <td class="TextH1"><input 
      name="nomineemobile2" id="nomineemobile2" style="WIDTH: 180px" value="<? echo $nomineemobile2 ?>" maxlength="20" /></td>
                      </tr>
                      <tr>
                        <th height="23" rowspan="2" class="TextH1"></th>
                        <td class="TextH1">Fax                          </td>
                      </tr>
                      <tr>
                        <td class="TextH1"><input 
      name="nomineefax2" style="WIDTH: 180px" value="<? echo $nomineefax2 ?>" maxlength="20" /></td>
                      </tr>
                      <tr>
                        <th height="23" class="TextH1"><div align="left">Email : </div></th>
                        <td class="TextH1"><input 
      name="nomineeemail2" style="WIDTH: 180px" value="<? echo $nomineeemail2 ?>" maxlength="50" />                        </td>
                      </tr>	
					  
                    </tbody>
              </table>
</div>

<div id="dog2" class="tabcontent">
<table id="tbl-tabPostalAddresses" class="editTbl" border="0" cellspacing="0" 
cellpadding="0">
                    <tbody>
    <tr>
                  <td width="172" height="23" class="TextH1"><div align="left">Name of Spouse : </div></td>
                  <td width="210" class="TextH1"><input 
      name="spouse" id="spouse" value="<? echo $spouse ?>" maxlength="50" style="WIDTH: 180px"/>                  </td>
                </tr>
                <tr>
                  <th height="23" class="TextH1"><div align="left">Title : </div></th>
                  <td class="TextH1">
                    <select name="sptitle" id="sptitle" style="WIDTH: 180px" >
                      <option value="1"></option>
					  					   <?
			 
			 	$sql="select * from newvalue where nv_type='Title' order by nv_id";
				$result=mysql_query($sql) or die(mysql_error());				
				while($myrow=MySQL_fetch_array($result,MYSQL_ASSOC)){
					echo "<option value='".$myrow["nv_id"]."' ";
					if($sptitle==$myrow["nv_id"])echo "selected";
					echo ">".$myrow["nv_name"]." </option>";
				}
			
?>
                            </select>
                  </span></td>
		  
                </tr>					
    <tr>
                  <td height="23" class="TextH1"><div align="left">NRIC/Passport : </td>
                  <td class="TextH1"><input 
      name="spic" id="spic" value="<? echo $spic ?>" maxlength="20" style="WIDTH: 180px"/>                  </td>
                </tr>
                <tr>
                  <td height="23" class="TextH1"><div align="left">Date of Birth : </div></td>
                  <td class="TextH1"><?
echo "<select name='spday'>";
echo '<option value=""></option>\n';
foreach ($days as $value) {
	echo '<option value="'.$value.'"';
	if($spday==$value)echo ' selected';
	echo '>'.$value.'</option>\n';
} echo '</select> ';

echo "<select name='spmonth'>";
echo '<option value=""></option>\n';
foreach ($months  as $key => $value) {
	echo '<option value="'.$key.'"';
	if($spmonth==$key)echo ' selected';
	echo '>'.$value.'</option>\n';
}
echo '</select> ';

echo "<select name='spyear'>";
echo '<option value=""></option>\n';
foreach ($years as $value) {
	echo '<option value="'.$value.'"';
	if($spyear==$value)echo ' selected';
	echo '>'.$value.'</option>\n';
} 
echo '</select> ';
?>
</td>
                </tr>
     <tr>
                  <th height="23" class="TextH1"><div align="left">Nationality : </div></th>
                  <td class="TextH1"><input name="spnationality" type="radio" value="Malaysian" <?=($spnationality=="Malaysian" ? "CHECKED" : " ")?>/>
                    Malaysian</td>
                </tr>
                <tr>
                  <th height="23" class="TextH1"><div align="left"></div></th>
                  <td class="TextH1"><input name="spnationality" type="radio" value="Foreign" <?=($spnationality=="Foreign" ? "CHECKED" : " ")?>/>
                    Foreign<span class="subItem"> (Please Specify) </span></td>
                </tr>
                <tr>
                  <th height="23" class="TextH1"><div align="left"></div></th>
                  <td class="TextH1"><input 
      name="spforeignspecify" id="spforeignspecify" value="<? echo $spforeignspecify ?>" maxlength="50" style="WIDTH: 180px"/></td>
                </tr>				
         <tr>
                  <th height="23" class="TextH1"><div align="left">Occupation : </div></th>
                  <td class="TextH1"><input 
      name="spoccupation" id="spoccupation" style="WIDTH: 180px" value="<? echo $spoccupation ?>" maxlength="50" />                  </td>
                </tr>
 <tr>
                        <th height="23" class="TextH1"><div align="left">Contact No. : </div></th>
                        <td class="TextH1">Home                          </td>
                      </tr>
                      <tr>
                        <th height="23" class="TextH1"><div align="left"></div></th>
                        <td class="TextH1"><input 
      name="sphome" id="sphome" style="WIDTH: 180px" value="<? echo $sphome ?>" maxlength="20" />                        </td>
                      </tr>
                      <tr>
                        <th height="23" rowspan="2" class="TextH1"><div align="left"></div></th>
                        <td class="TextH1">Mobile                          </td>
                      </tr>
                      <tr>
                        <td class="TextH1"><input 
      name="spmobile" id="spmobile" style="WIDTH: 180px" value="<? echo $spmobile ?>" maxlength="20" /></td>
                      </tr>
                      <tr>
                        <th height="23" rowspan="2" class="TextH1"><div align="left"></div></th>
                        <td class="TextH1">Fax                          </td>
                      </tr>
                      <tr>
                        <td class="TextH1"><input 
      name="spfax" id="spfax" style="WIDTH: 180px" value="<? echo $spfax ?>" maxlength="20" /></td>
                      </tr>
                      <tr>
                        <th height="26" class="TextH1"><div align="left">Email : </div></th>
                        <td class="TextH1"><input 
      name="spemail" id="spemail" style="WIDTH: 180px" value="<? echo $spemail ?>" maxlength="50" />                        </td>
                      </tr>
				
       				
                    </tbody>
                  </table></div>
				  
		  
</div>

<script type="text/javascript">

var mypets=new ddtabcontent("pettabs")
mypets.setpersist(true)
mypets.setselectedClassTarget("link")
mypets.init(0)

</script></td>
          </tr>
          <tr>
            <td valign="top" >&nbsp;</td>
          </tr>
          
          <tr class="small">
            <td height="1" colspan="2" bgcolor="#999999"></td>
          </tr>
          <tr class="small">
            <td height="30" colspan="2" class="TextH1"><span class="require">* Denotes a require_onced field</span></td>
          </tr>
          <tr>
            <td colspan="2" valign="top" ><span class="text12">
              <input name="btnAdd" type="submit" class="btn" id="btnAdd" value="ADD" onclick="return confirm('Are you sure ?')"/>
&nbsp;</span></td>
            </tr>
          

        </table>
		
	</td>

      </tr>
 
    </table><br />
	</form>	</td>
  </tr>
  <tr>
    <td colspan="2" bgcolor="#333333" class="Footer" align="center"><br />
    <? require_once "footer.php"; ?></td>
  </tr>
</table>
</body>
</html>
