<script type="text/javascript">
function CheckForm(){
	var subject=document.getElementById("subject");
	if(subject.value=="")    {
      alert("Subject is not empty");
      return false;
    }else{
		document.getElementById('formDetail').submit();
	}
}
</script>
<div class="my-account">
	<div class="heading" style="margin-bottom:0;">
        <dl class="acctip">
            <dt>My Ticket</dt>
        </dl>
    </div>
    <div class="ticketBox">
        <fieldset>
            <legend>Create a New Ticket</legend>
            <form method="post" id="setup_account" action="index.php?controller=my_tickets&action=create_ticket" onsubmit="return CheckForm();">
                    <table cellspacing="0" cellpadding="0" id="invstats">
                        <tbody><tr>
                            <td class="labeltxtbg" colspan="2">
                                <p>While we try very hard to meet your expectations, it is helpful for our customers to only create one ticket per issue. Multiple tickets about the same problem hurt our ability to help you quickly.</p>
                            </td>
                        </tr>
                        <tr class="labeltxtbg">
                            <th class="textRight vertTop">From Address</th>
                            <td class="secrowover">
                                <select name="email_address" id="email_address">
                                  <option value="<?php echo $customer_info['email']?>"><?php echo $customer_info['email']?></option>
                                   <?php if(is_array($ticket_email_list)){?>
                                   <?php foreach ($ticket_email_list as $v){?>
                                    <?php if($v['email_address']!=$customer_info['email']){?>
                                      <option value="<?php echo $v['email_address']?>"><?php echo $v['email_address']?></option>
                                     <?php }?>
                                   <?php }?>
                                   <?php }?>
                                </select>
                            </td>
                        </tr>
                        <tr class="labeltxtbg">
                            <th class="textRight vertTop">Subject</th>
                            <td class="secrowover">
                                <input type="text" name="subject" id="subject" class="input-text">
                            </td>
                        </tr>
                        <tr class="labeltxtbg">
                            <th class="textRight vertTop">Order Number</th>
                            <td class="secrowover">
                                <select name="reference">
                                 <option value="">Please select the order number associated with your ticket.</option>
                                 <?php if(is_array($waiting_payment_order_data)){?>
                                 <?php foreach($waiting_payment_order_data as $od){?>
                                   <option value="<?php echo $od['reference']?>">PO# <?php echo $od['reference'].' - '.$od['total'].' - '.$od['order_status_name']?></option>
                                 <?php }?>
                                 <?php }?>

                                 <?php if(is_array($order_data)){?>
                                 <?php foreach($order_data as $od){?>
                                   <option value="<?php echo $od['reference']?>">PO# <?php echo $od['reference'].' - '.$od['total'].' - '.$od['order_status_name']?></option>
                                 <?php }?>
                                 <?php }?>
                                </select>
                            </td>
                        </tr>
                        <tr class="labeltxtbg">
                            <th class="textRight vertBottom last">Your Message</th>
                            <td class="secrowover last">
                                <textarea name="message" id="message" class="input-text"></textarea>
                            </td>
                        </tr>
                    </tbody></table>
                    <div class="addTicket">
                    <a style="vertical-align:inherit;" onclick="window.history.back(-1)" class="btn_button btn_gray"><i class="icon-back"></i>Back</a>
                    <input type="submit" class="createnewticketbtn" value="Create New Ticket">
                    </div>
                </form>
            </fieldset>
    </div>
</div>
