<?php
$product = $tpl['product'];
$opt = 1;
$action = '';
$message = '';
$price = $_POST['price'];
$percentage = $price * 100 / $product['price'];
switch ($product['suggest_type']) {
	case 'suggest':
		if($percentage >= 0 && $percentage < 35)
		{
			$opt = 1;
		}else if($percentage >= 35 && $percentage < 70){
			$opt = 2;
		}else if($percentage >= 70 && $percentage < 100){
			$opt = 3;
		}
		$action = $product['price_range_'.$opt.'_action'];
		$action = $action == 'thank' ? 'message' : $action;
		$message =  $product['price_range_'.$opt.'_' . $action];
		break;
	case 'offer':
		if($price == $product['price_suggest_1'])
		{
			$opt = 1;
		}
		if($price == $product['price_suggest_2'])
		{
			$opt = 2;
		}
		if($price == $product['price_suggest_3'])
		{
			$opt = 3;
		}
		$action = $product['price_suggest_'.$opt.'_action'];
		$action = $action == 'thank' ? 'message' : $action;
		$message =  $product['price_suggest_'.$opt.'_' . $action];
		break;
}
?><input type="hidden" name="price_option" value="<?php echo $opt;?>" /><?php
if($action == 'email')
{
	?>
	<p>
		<label class="title"><?php __('email'); ?></label>
		<span class="pj-form-field-custom pj-form-field-custom-before">
			<span class="pj-form-field-before"><abbr class="pj-form-field-icon-email"></abbr></span>
			<input type="text" name="email" id="email" value="" class="pj-form-field required email w200"/>
		</span>
	</p>
	<?php
}else if($message != ''){
	?>
	<p>
		<label class="title">&nbsp;</label>
		<span class="inline_block">
			<label class="content"><?php echo $message;?></label>
		</span>
	</p>
	<?php
}
?>