<script type="text/javascript" src="javascript/jquery.validate.min.js"></script>

<!-- Progress Bar -->
<?php echo $this->progressBar;?>

<!-- Cart Summary -->
<?php echo $this->cartSummary;?>

<!-- Main Page -->
<script type="text/javascript">
// Field Validation
$(document).ready(function(){
    $("#submitForm").validate({
       errorClass: "invalid",
       errorElement: "span"
    });

});
</script>

<style type="text/css">
span.invalid { color: red; padding-left: 10px;}
</style>

<div style="margin-right:220px; margin-bottom:20px;">
<form action="<?php echo $this->nextUrl;?>" method="POST" id="submitForm">
<input type="hidden" name="formId" value="configureProduct">
<input type="hidden" name="product" value="<?php echo $this->product['id'];?>">
    
<h3><?php echo $this->lang("Configure Product");?>: <?php echo $this->product['name'];?></h3>
<p class="pagedesc">
	<?php if ( count($this->packageAddons) > 0 ) { ?>
		<?php echo $this->lang("Please fill in the product fields below and check through our available add-ons. (* indicates a required field)");?>
	<?php } else { ?>
		<?php echo $this->lang("Please fill in the product fields below. (* indicates a required field)");?>
	<?php } ?>
</p>


<?php if ( count($this->customFields) > 0) { ?>
<table class="ts2" cellspacing="0">
	<?php foreach ( $this->customFields as $field ) { ?>
	<tr>
	
		<td class="label"><?php if($field['required']) { echo '*'; } ?> <?php echo $this->lang($field['name']);?>:</td>
		<td>
			<?php if ( $field['type'] == typeTEXTFIELD ) { ?>
				<input value="<?php echo $field['savedValue']; ?>" class="<?php if($field['required']) { echo 'required'; } ?>" name="PCT_<?php echo $field['id']; ?><?php if(isset($field['isDomain'])) { echo "_1"; } ?>" type="text" onkeypress="return noenter(event);"  />

                <?php if(isset($field['isDomain'])) { ?>
                    <?php if(isset($this->subDomains)) { ?>
                        . <select class="dropdown" name="subDomain">
                            <option value="0"><?php echo $this->lang('Choose a Subdomain');?></option>
                            <?php foreach($this->subDomains AS $key) { ?>
                                <?php if ( strlen($key) > 0 ) { ?>
                                <option value="<?php echo $key; ?>"><?php echo $key; ?></option>
                                <?php } ?>
                            <?php } ?>
                        </select>
                    <?php } ?>
                <?php } ?>

            <?php } else if ( $field['type'] == typeCOUNTRY ) { ?>
                    <select class="dropdown" name="PCT_<?php echo $field['id']; ?>">
                    <?php foreach ( $field['select_options'] as $option ) { ?>
                        <option value="<?php echo $option['value']; ?>" <?php echo ($option['value'] == $this->DefaultCountry)? 'selected="selected"' : ''; ?> ><?php echo $option['label']; ?></option>
                    <?php } ?>
                    </select>
			<?php } else if ( $field['type'] == typeYESNO ) { ?>
				<select class="dropdown" name="PCT_<?php echo $field['id']; ?>">
					<option value="1" <?php echo $field['selectedyes']; ?>><?php echo $this->lang('Yes'); ?></option>
					<option value="0" <?php echo $field['selectedno']; ?>><?php echo $this->lang('No'); ?></option>
				</select>
			<?php } else if ( $field['type'] == typeTEXTAREA ) { ?>
				<textarea name="PCT_<?php echo $field['id']; ?>" class="<?php echo $field['class']; ?>" style="display: inline-block; width: 300px; vertical-align: top;" cols="40" rows="6"><?php echo $field['savedValue']; ?></textarea>
			<?php } else if ( $field['type'] == TYPEDATE ) { ?>
				<span style="display: inline-block">
					<input class="<?php echo $field['class']; ?>" type="text" name="PCT_<?php echo $field['id']; ?>" id="PCT_<?php echo $field['id']; ?>" size="10" value="<?php echo $field['savedValue']; ?>" onkeypress="return noenter(event);" readonly=true>
					<script type="text/javascript">
						datefields.push("PCT_<?php echo $field['id']; ?>");
					</script>
				</span>
			<?php } else if ( $field['type'] == typeDROPDOWN ) { ?>
				<?php if ( isset($field['select_options']) ) { ?>
				<select name="PCT_<?php echo $field['id']; ?>" class="dropdown">
				<?php foreach ( $field['select_options'] as $option ) { ?>
					<option size="30" value="<?php echo $option['value']; ?>"<?php echo $option['selected']; ?>><?php echo $option['label']; ?></option>
				<?php } ?>
				</select>
				<?php } ?>
			<?php } ?>
			<?php if ( strlen(@$field['desc']) >0 ) { ?>
			<br />
			<span style="font-size:11px; color:#666;"><?php echo $this->lang($field['desc']);?></span>
			<?php } ?>
		</td>
	</tr>
	<?php } ?>
</table>
<?php } ?>

<?php if ( count($this->packageAddons) > 0 ) { ?>

<h3><?php echo $this->lang("Product Add-ons");?></h3>

<table class="ts2" cellspacing="0" style="margin-top:20px;">
	<?php foreach ( $this->packageAddons as $addon ) { ?>
	<tr>
    	<td class="label"><?php echo $this->lang($addon['name']);?>:</td>
        <td>
			<?php if ( @$addon['radio_buttons'] == '0' ) { ?>
			<select name="addonSelect_<?php echo $addon['id']; ?>" class="dropdown">
				<?php foreach ( $addon['prices'] as $price ) { ?>
				<option value="addon_<?php echo $addon['id']; ?>_<?php echo $price['price_id']; ?>_<?php echo $price['recurringprice_cyle']; ?>" <?php echo $price['price_selected']; ?>><?php echo $price['price']; ?></option>
				<?php } ?>
			</select>
			<?php } else { ?>
				<?php foreach ( $addon['prices'] as $price ) { ?>
			<span>
				<input type="radio" name="addonSelect_<?php echo $addon['id']; ?>" class="dropdown" id="addon_<?php echo $addon['id']; ?>_<?php echo $price['price_id']; ?>_<?php echo $price['recurringprice_cyle']; ?>" value="addon_<?php echo $addon['id']; ?>_<?php echo $price['price_id']; ?>_<?php echo $price['recurringprice_cyle']; ?>" style="background:none; border:0px;" <?php echo $price['price_selected']; ?>/>
				<?php echo $price['price']; ?>
			</span>
			<br/>
				<?php } ?>
			<?php } ?>
			<?php if ( strlen($addon['desc']) > 0 ) { ?>
			<br />
			<span style="font-size:11px; color:#666;"><?php echo $this->lang($addon['desc']);?></span>
			<?php } ?>
		</td>
    </tr>
	<?php } ?>
</table>
<?php } ?>

<input class="submit" type="submit" <?php if($this->hasBundledProducts == true) { ?> value="<?php echo $this->lang('Continue');?>" <?php } else { ?> value="<?php echo $this->lang('Add to Cart');?>" <?php } ?> />

</form>
    
</div>

<div class="clear"></div>