 <?php 
   require_once("head2Alt.php");
   if(isset($_POST['post']))

  {

     if( isset($_POST['hiD']) && isset($_POST['owniD']))
     {

        $hnm=$_POST['hiD'];
        $ownID=$_POST['owniD']; 
        //HOTEL NAVIGATION LINKS-->
        require_once("my_hotel_main_nav_link.php");
  //-MAIN NAVIGATION LINK END-->
      
    }
  }
?> 
  <center>
  <div>
  <sup>
    <?php 
       
   echo $con->eSname($sname)."<p/>";
   echo $con->eScost($scost)."<p/>";
    echo $con->eSservice($serviceId)."<p/>";
    
     ?>
  </sup>
</div>
</center> 

  
 
   <!--NEW USER REGISTRATION FORM, DISPLAYED BY DEFAULTS IN PAGE LOAD-->


<center><fieldset id="new_sevice_reg_form">
<label id="reg_form_tile_label">Add new  associated here </label></p/>
<i>Please fill the form below to add associated -</i>
<form name="new_user_registration" id="new_user_registration" action="addAssServicePro.php" method="POST">

<table border="0" id="reg_form_table">

   <input class="hi" type="text" name="owniD"  value="<?php echo $ownID;?>">


   <input class="hi" type="text" name="hiD"  value="<?php echo $hnm;?>">

 <tr>
  
  <td height="40px" width="35%" valign="top">

        <label id="mini_label">Service Id number:<sup>*</sup></label><br>

  </td> 


  <td id="reg_form_table_cell">
     
         <input type="text" name="serviceId" id="serviceId" class="prof_info" value="<?php echo $serviceId;?>"    /><br/>
         <sup id="si"></sup>
         
  </td>

</tr>
      
    
  
<tr>
  
  <td height="40px" width="35%" valign="top">

        <label id="mini_label">Service name/Description:<sup>*</sup></label><br>

  </td> 


  <td id="reg_form_table_cell">
     
         <input type="text" name="sname" id="sname" class="prof_info"  value="<?php echo $sname;?>" /><br/>
         <sup id="ln"></sup>
         
  </td>

</tr>

<tr>
 
  <td height="40px"   valign="top">

        <label id="mini_label">Service charge/Cost if any:<sup>*</sup></label><br>

  </td> 

  <td id="reg_form_table_cell">

    
         <input type="text" name="scost" id="scost" class="prof_info" value="<?php echo $scost;?>"  /><br/>
         <sup id="rt"></sup>
  </td>

  </tr>

   
<tr>

  <td colspan="2" align="center">
        <input type="submit"  name="submit" value="Submit" id="submit"/>
  </td>

</tr>

</table>
 
</form>
</fieldset> </center>
 
<script>
 
$(document).ready(function(){
  
$("#new_user_registration").on('submit',function(e){

var sname =document.getElementById('sname').value;
$.trim(sname);  
var scost =document.getElementById('scost').value;
$.trim(scost);  
var serviceId =document.getElementById('serviceId').value;
$.trim(serviceId);


var vN =/[\(A-Za-z)]/g;
var nV =/[a-z\s]/i;
var nR =/[A-Za-z0-9]/i;
var nC =/[0-9]/i;
var j=0,k=0, g=0,i=0;


                             //SERVICE ID VALIDATION
if(serviceId=="")
{
 e.preventDefault();

document.getElementById('si').innerHTML="Service Id  required!..";
 } 
 else
 {

      for(i=0;i<serviceId.length;i++)
       {
         if(!serviceId[i].match(nR))
          {
             j++;

           }
        }
      
       if(j>0){
        e.preventDefault();

       
        document.getElementById('si').innerHTML="You typed Service id with error!.."; 


              }
         else{

        document.getElementById('si').innerHTML="";

              }
   }
 
    j=0, i=0;


                                                         //ROOM NAME VALIDATION

                                                         //ROOM NAME VALIDATION
if(sname=="")
{
 e.preventDefault();

document.getElementById('ln').innerHTML="Service description  required!..";
 } 
 else
 {

      for(i=0;i<sname.length;i++)
       {
         if(!sname[i].match(nV))
          {
             j++;

           }
        }
      
       if(j>0){
        e.preventDefault();

       
        document.getElementById('ln').innerHTML="You typed Service description with error!.."; 


              }
         else{

        document.getElementById('ln').innerHTML="";

              }
   }
 
    j=0, i=0;
                                                                               ///ROOM TYPE VALIDATION
 

if(scost==""){
 e.preventDefault();

document.getElementById('rt').innerHTML="Charge/cost required!..";
 }
 else{

     for(i=0;i<scost.length;i++)
       {
         if(!scost[i].match(nR))
          {
             j++;

           }
        }
      
       if(j>0){
       e.preventDefault();
 
        document.getElementById('rt').innerHTML="Service cost typed with error!.."; 
              }
         else{
       

        document.getElementById('rt').innerHTML="";

              }
   }
 
    j=0, i=0;
               
 
 
 
                                                                            ///ROOM ID VALIDATION
 
 

               
  
}
);
}
);  
    
 
</script>
<?php
require_once('footerIn.php');
?>





