<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: 			*/
// +----------------------------------------------------------------------+
// | PHP version 4/5                                                      |
// +----------------------------------------------------------------------+
// | Copyright (c) 2004-2010 ARMIA INC                                    |
// +----------------------------------------------------------------------+
// | This source file is a part of iScripts VistaCart                     |
// +----------------------------------------------------------------------+
// | Authors: Jipson<jipson.thomas@armiasystems.com>             		  |
// +----------------------------------------------------------------------+
?>
<?php	echo $javascript->link('jquery.js'); ?>
<script language="javascript" type="text/javascript">
function chk(thisform){

	    var errorstr = '';
		var msgstr = "Sorry, we cannot complete your request.\nKindly provide us the missing or incorrect information enclosed below.\n\n";
		var i=0;
		var flag=0;
		var fcs_fld=new Array();
		var illegalChars = /\W/; /* For User name validtion*/
		var illegalChars1 = /[\W_]/;  /* For Password validtion*/
		var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;   /* For Email Address*/

		
		if ($.trim($('#AdminAdminName').val())=='') { errorstr += "- Please Enter User Name.\n";  fcs_fld[i]='AdminAdminName'; i++;}
		if ($.trim($('#AdminAdminName').val())!='') 
		{
         if ($.trim($('#AdminAdminName').val()).length < 5) { errorstr += "- Username should contain atleast 5 characters.\n";   fcs_fld[i]='AdminAdminName'; i++;}
		}
		if (illegalChars.test($('#AdminAdminName').val())) { errorstr += "- The username contains illegal characters.\n";   fcs_fld[i]='AdminAdminName'; i++;}
		
		if ($.trim($('#AdminEmail').val())=='') { errorstr += "- Please enter Email Address.\n";   fcs_fld[i]='AdminEmail'; i++;}
		
		if ($.trim($('#AdminEmail').val())!='') 
		{
		 if(reg.test($.trim($('#AdminEmail').val())) == false) { errorstr += "- Invalid Email Address.\n";   fcs_fld[i]='AdminEmail'; i++;}
		}		
		if ($.trim($('#AdminAdminPword').val())=='')  { errorstr += "- Please enter Password.\n";  fcs_fld[i]='AdminAdminPword'; i++;}				
		if ($.trim($('#AdminAdminPword').val())!='') 
		{
         if ($.trim($('#AdminAdminPword').val()).length < 6) { errorstr += "- Password should contain atleast 6 characters.\n";   fcs_fld[i]='AdminAdminPword'; i++;}
		}
		
		if ($.trim($('#AdminAdminPword').val()).length >= 6 ) {
		  if (illegalChars1.test($('#AdminAdminPword').val())) { errorstr += "- The password should contain letters and numbers only.\n";   fcs_fld[i]='AdminAdminPword'; i++;}
	    }		
		
		if ($.trim($('#AdminAdminPword').val()).length >= 6 && $.trim($('#AdminAdminPword').val())!='') {
		if ($.trim($('#AdminConpassword').val())=='') { errorstr += "- Please Confirm Password.\n";   fcs_fld[i]='AdminConpassword'; i++;}
		}
		if ($.trim($('#AdminConpassword').val())!='' ) {
		if ($.trim($('#AdminAdminPword').val()) != $.trim($('#AdminConpassword').val())) { errorstr += "- Password Mismatch.\n";  fcs_fld[i]='AdminConpassword'; i++;}					
		}
	
	if (errorstr != '')
	{
		msgstr = msgstr + errorstr;
		alert(msgstr);
		$('#'+fcs_fld[0]+'').focus();$('#'+fcs_fld[0]+'').select();
		return false;
	}
	else
	{
		thisform.submit();
		return true;
	}
} 
</script>
<div align="left" class="main_body">
		<!--mainbody area start -->
		
		
		<div  class="loginbg_signup admin_edit_add_sec">
		
		
		
					<div class="login_userbox">
					<?php echo $form->create('Admin', array('action' => 'add','name' =>'Admin')); ?>
					<div>
							<div class="loginhead_admin">Add Admin Users</div>
							<div class="invalid_user">
				          <?php $session->flash(); ?></div>
							<div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
					  </div>
							
				            <!--items display area start -->
<div align="left" class="inner_content_area">
						   <div align="right" id="inner_rightcontent">
						    
						       <span class="toplinks">
							   <?php echo $form->input('admin_name', array('label' => '','class' => 'box2_admin','size' => 27 )); ?>
						      
						       </span>					        
					       </div>
		<!--form area start -->
		
				<div align="left" id="login_leftcontent">
				  <p class="maintext_admin">User Name <span class="required_field">*</span></p> 
				</div>
				<div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
				 <div align="right" id="inner_rightcontent">
						    
						       <span class="toplinks">
						       <?php echo $form->input('email', array('label' => '','class' => 'box2_admin','size' => 27 )); ?>
						       </span>					       
					       </div>
						  
			<div align="left" id="login_leftcontent">
				  <p class="maintext_admin">Email <span class="required_field">*</span></p> 
				</div>
				<div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
				 <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
				 <div align="right" id="inner_rightcontent">
						    
						       <span class="toplinks">
							   <?php echo $form->input('admin_pword', array('label' => '','type' => 'password','class' => 'box2_admin','size' => 27 ,'maxlength' => 25)); ?>
						       
						       </span>					       
					       </div>
				
			<div align="left" id="login_leftcontent">
				  <p class="maintext_admin">Password <span class="required_field">*</span></p> 
				</div>
				<div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
				
				<div align="right" id="inner_rightcontent">
						    
						       <span class="toplinks">
						     <?php echo $form->input('conpassword', array('label' => '','type' => 'password','class' => 'box2_admin','size' => 27 ,'maxlength' => 25)); ?>
						       </span>					       
					       </div>
						
			<div align="left" id="login_leftcontent">
				  <p class="maintext_admin">Confirm Password <span class="required_field">*</span></p> 
				</div>
				
						  
						   <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
						      <div align="left" id="login_leftcontent">
				  <p class="maintext_admin">Add Privilege</p> 
				</div>
				
				
				<div align="right" id="inner_rightcontent">
					<span class="maintext_admin">
						<span><?php echo $form->checkbox('settings'); ?>Settings</span>
						<span><?php echo $form->checkbox('custom'); ?>Custom fields</span>
						<span><?php echo $form->checkbox('category'); ?>Categories</span>
					</span>					       
				</div>
				
				<div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
				<div align="right" id="inner_rightcontent">
					<span class="maintext_admin">
						<span><?php echo $form->checkbox('products'); ?>Products</span>
						<span><?php echo $form->checkbox('adminusers'); ?>Admin Users</span>
						<span><?php echo $form->checkbox('homepage'); ?>Homepage Design</span>
					</span>					       
			 	</div>
				
				<div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
				<div align="right" id="inner_rightcontent">    
					<span class="maintext_admin">
						<span><?php echo $form->checkbox('orders'); ?>Orders</span>
						<span><?php echo $form->checkbox('refund'); ?>Refund</span>
						<span><?php echo $form->checkbox('promocodes'); ?>Promo codes</span>
					</span>					       
				</div>
						    <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
				<div align="right" id="inner_rightcontent">    
					<span class="maintext_admin">
						<span><?php echo $form->checkbox('websitecontent'); ?>Website contents & Emails</span>
						<span><?php echo $form->checkbox('reports'); ?>Reports</span>
					</span>					       
				</div>
				<div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
				<div align="right" id="inner_rightcontent">
					<span class="maintext_admin">
						<span><?php echo $form->checkbox('users'); ?>Users</span>
						<span><?php echo $form->checkbox('help'); ?>Help Management</span>
						<span><?php echo $form->checkbox('feedback'); ?>Feedback</span>							
					</span>					       
				</div>
			   <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
				<div align="right" id="inner_rightcontent">				
					<span class="maintext_admin">
						<span><?php echo $form->checkbox('newsletter'); ?>Newsletters<span>
						<span><?php echo $form->checkbox('giftcards'); ?>Gift cards</span>
					</span>					       
				 </div>
			  <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>   
						    <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>   
						   <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
						
				 <div align="right" id="inner_rightcontent">
						   
						       <span class="toplinks">
							   <input type="button" class="buttn_admin" value="Add" onClick="return chk(document.Admin);">
						      
						       </span><span class="maintext_admin"><input type="button" class="buttn_admin" value="Cancel" onClick="javascript:history.go(-1);">			         
			                   </span>
			              
					       </div>
				
				
		
			 
		
			    <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
		
			<!--form area end -->
                         </div>
						 
						 
						 
								<div align="left" class="float_clear1"></div>
					 <?php echo $form->end(); ?>
				  </div>
				  
						<div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
		</div>
		
		
		</div>