<?php

/**
* @version 2.8.13
* @package Joomla 2.5
* @subpackage DT Register
* @copyright Copyright (C) 2006 DTH Development
* @copyright contact dthdev@dthdevelopment.com
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/

global $Itemid;

include(DTreg::get_template_path('user'.DS.'tmpl'.DS.'event_header.php'));
$tEvent = $this->tEvent;
?>
<div id="price_header">
<?php
 
?>
</div>
<form name="frmcart" id="frmcart" method="post" action="index.php" enctype="multipart/form-data">

   <div style="clear:both">

    <?php
       if($tEvent->use_discountcode && in_array($tEvent->discount_code_usagetype,array(1,3)) ) { ?>
	   		   
        <dl>
         <dt class="dtlabel">
           <?php echo JText::_( 'DT_DISCOUNT_CODE'); ?>:
         </dt>
         <dd class="dtfield">
           <input type="text" name="discount_code" id="discount_code" value="" class="inputbox" /><label for="discount_code" style="display:none" generated="true" class="error"></label>
         </dd>
         <dd class="dttip"> </dd>
      </dl>
            
	   <?php }
	   echo $this->form;

	 ?>
	
	</div>
	
	<div style="clear:both; padding: 10px 0px 0px 0px">

    <input onclick='window.location="<?php echo JRoute::_("index.php?option=com_dtregister&controller=member&task=index&userId=".$this->userId); ?>"' name="" type="button" class="button" value="<?php echo JText::_( 'DT_BACK' ); ?>" />&nbsp;&nbsp;<input type="submit" class="button" name="savemember" value="<?php echo JText::_( 'DT_SAVE' );?>" />

   </div>

   <input type="hidden" name="Member[groupUserId]" value="<?php echo $this->userId; ?>" />

   <input type="hidden" name="userId" value="<?php echo $this->userId; ?>" />

   <input type="hidden" name="formsubmit" value="add" />
   <input type="hidden" name="key" value="" />
   <input type="hidden" name="option" value="com_dtregister" />

   <input type="hidden" name="controller" value="member" />

   <input type="hidden" name="Itemid" value="<?php echo $Itemid; ?>" />

   <input type="hidden" name="task" value="add" />

</form>

<div id="debug">

</div>

<script type="text/javascript">

 DTjQuery(function(){

   //DTjQuery.validator.messages.required = " ";

    DTjQuery(document.frmcart).validate({

	        success: function(label) {

				label.addClass("success");

			}

	});

 })

</script>
<script type="text/javascript">
  var DT_disabled = [] ;
  DT_disabled = DTjQuery(':disabled');
  var updateFee = function(){
	    
	  // var prevtask = DTjQuery(document.frmcart.task).val();
	  var prevcontroller = DTjQuery(document.frmcart.controller).val();
	  var options = {
		               beforeSubmit : function () {
						              	 DTjQuery.each(DT_disabled, function(){
		     									 DTjQuery(this).removeAttr('disabled','disabled');  
	   								         })
									  },
		               url : "<?php echo JRoute::_("index.php?no_html=1");?>",
					   data : {task:'price_header',controller:'user'},
					   success : function(responseText){
						             DTjQuery("#price_header").html(responseText);
									  DTjQuery.each(DT_disabled, function(){
		     									DTjQuery(this).attr('disabled','disabled');  
	   								         })
					              }
		   }
	  // DTjQuery(document.frmcart.task).val('price_header');
	  // DTjQuery(document.frmcart.controller).val('user');
	   DTjQuery(document.frmcart).ajaxSubmit(options);
	  // DTjQuery(document.frmcart.task).val(prevtask);
	  // DTjQuery(document.frmcart.controller).val(prevcontroller);
	     
  }
  
  updateFee();
</script>