<?include("includes/connection.php")?>
<?include("includes/func.php")?>
<html>
<head>
<link href="images/class.css" rel="stylesheet" type="text/css">
<title>Design Your Ring </title>
</head>
<?
if ($_POST["startagain"]!='') {
	redirect("chooseoptions.php?product=".pdbfx("product"));
}
if ($_GET["submit2"]!='')
 {
	 $_SESSION["errmsg"]="";
	 if ($_GET["left_side_text"]=='')
		    $_SESSION["errmsg"].="@Left Side Writing Should not be blank";
	 if ($_GET["right_side_text"]=='')
		    $_SESSION["errmsg"].="@Right Side Writing Should not be blank";
	  if ($_GET["custom_left_side"]==1 && $_GET["left_side_image"]!='' && $_GET["image"]!='' )
		    $_SESSION["errmsg"].="@You can either choose custome image or Image number of Left side.";
	  if ($_GET["custom_left_side"]==2 && $_GET["right_side_image"]!='' && $_GET["image"]!='' )
		    $_SESSION["errmsg"].="@You can either choose custome image or Image number of Right side.";
	 //if ($_GET["inside_engraving"]=='')
		   // $_SESSION["errmsg"].="@Inside Engraving Should not be blank";
		
		if ($_SESSION["errmsg"]=='') {
			$sql="select * from emblem_master  where emblem_status=1";
			$cmd = mysql_query($sql);
			while ($rs = mysql_fetch_array($cmd)) {
				if (gdbfx("left_side_image")!=''){
					if (strtolower(gdbfx("left_side_image"))==strtolower($rs["emblem_number"]))
						$left_side_image=1;
					}
				if (gdbfx("right_side_image")!=''){
					if (strtolower(gdbfx("right_side_image"))==strtolower($rs["emblem_number"]))
						$right_side_image=1;
					}	

			}
			
			if (gdbfx("left_side_image")!='' && $left_side_image!=1)
					 $_SESSION["errmsg"].="@Invalid shank image number entered in Left Side image.";
			if (gdbfx("right_side_image")!='' && $right_side_image!=1)
					 $_SESSION["errmsg"].="@Invalid shank image number entered in Right Side image.";
		}
		

	 
 }
?>
<body>
<?$step=6;
include("stepstop.php")?>
 <form name=step3 action="place_order.php" method=GET>
				
				<input type=hidden name=image value="<?=gdbfx("image");?>">
				

				  <input type=hidden name=product value="<?=gdbfx("product");?>">
				  <input type=hidden name=ring_number value="<?=gdbfx("ring_number");?>">
				  <input type=hidden name=metal_name value="<?=gdbfx("metal_name");?>">
				  <input type=hidden name=metal_finish value="<?=gdbfx("metal_finish");?>">
				   <input type=hidden name=Palm_Side value="<?=gdbfx("Palm_Side");?>">
				    <input type=hidden name=Replace_Zicon value="<?=gdbfx("Replace_Zicon");?>">

				<input type=hidden name=stone_number value="<?=gdbfx("stone_number");?>">
				<input type=hidden name=stone_cut_number value="<?=gdbfx("stone_cut_number");?>">
				<input type=hidden name=letter1 value="<?=gdbfx("letter1");?>">
				<input type=hidden name=letter2 value="<?=gdbfx("letter2");?>">
				<input type=hidden name=letter3 value="<?=gdbfx("letter3");?>">
			    <input type=hidden name=schoolname value="<?=gdbfx("schoolname");?>">
				<input type=hidden name=finger_size value="<?=gdbfx("finger_size");?>">

				<input type=hidden name=left_side_text value="<?=gdbfx("left_side_text");?>">
				<input type=hidden name=right_side_text value="<?=gdbfx("right_side_text");?>">
				<input type=hidden name=left_side_image value="<?=gdbfx("left_side_image");?>">
				<input type=hidden name=right_side_image value="<?=gdbfx("right_side_image");?>">
				<input type=hidden name=custom_left_side value="<?=gdbfx("custom_left_side");?>">
				<input type=hidden name=inside_engraving value="<?=gdbfx("inside_engraving");?>">
				<input type=hidden name=outside_engraving value="<?=gdbfx("outside_engraving");?>">
				<input type=hidden name=stone_letter value="<?=gdbfx("stone_letter");?>">
				<input type=hidden name=choose_font value="<?=gdbfx("choose_font");?>">
<?if ($_SESSION["errmsg"]!=''){?>
<table width="100%" border="0" cellspacing="1" cellpadding="2">
				  <tr>
		<td class="text"><span class="heading">
		

	<br><font color=red>Wait!You are not done yet.Please correct these errors and submit again:</font><br><br>

	<?}?>
		<?if ($_SESSION["errmsg"]!='')
			{
				$temp=split("@",$_SESSION["errmsg"]);
					for($i = 1; $i < count($temp); $i++){ 
							echo "<img src='images/icons/help.gif'> &nbsp; ". $temp[$i] ."<br>";
						}
				echo "<center><br><br><font class=heading><font color=red size=4><b><br><a href='javascript:history.back();'>Click Here</a> to Correct these problems.</b></font></font></center>";
			?>
		</span><br>
		  <br>
		 </td>
	  </tr>
	 </table>
			<? die;}?>
<table width="100%" border="0" cellspacing="1" cellpadding="2">
<tr align="center" class="heading"> 
	<td class="toplinks" align=left colspan=2><font  size=2><strong>Step 5 : Preview Your Order & Price </font></strong></td>
  </tr>
</table>

<table width="100%" border="0" cellspacing="1" cellpadding="2" bgcolor="#EEB94A">
<tr align="center" class="heading"> 
	<td  align=left width="30%" bgcolor="#FFFFFF"><font  size=2><strong>Ring</strong></font></td>
	<td class="toplinks" align=left width="70%" bgcolor="#FFFFFF"><font  size=2><?=gdbfx("ring_number");?></font></td>
 </tr>
 <tr align="center" class="heading"> 
	<td align=left width="40%" bgcolor="#FFFFFF"><font  size=2><strong>Metal</strong></font></td>
	<td class="toplinks" align=left width="60%" bgcolor="#FFFFFF"><font  size=2><?=gdbfx("metal_name");?></font></td>
 </tr>
  <tr align="center" class="heading"> 
	<td  align=left width="40%" bgcolor="#FFFFFF"><font  size=2><strong>Metal Finish</strong></font></td>
	<td class="toplinks" align=left width="60%" bgcolor="#FFFFFF"><font  size=2><?=gdbfx("metal_finish");?></font></td>
 </tr>
   <tr align="center" class="heading"> 
	<td  align=left width="40%" bgcolor="#FFFFFF"><font  size=2><strong>Palm Side</strong></font></td>
	<td class="toplinks" align=left width="60%" bgcolor="#FFFFFF"><font  size=2><?=gdbfx("Palm_Side");?></font></td>
 </tr>
  <tr align="center" class="heading"> 
	<td  align=left width="40%" bgcolor="#FFFFFF"><font  size=2><strong>Replace Zicon(with Diamonds)</strong></font></td>
	<td class="toplinks" align=left width="60%" bgcolor="#FFFFFF"><font  size=2><?=gdbfx("Replace_Zicon");?></font></td>
 </tr>
  <tr align="center" class="heading"> 
	<td  align=left width="40%" bgcolor="#FFFFFF"><font  size=2><strong>School/university</strong></font></td>
	<td class="toplinks" align=left width="60%" bgcolor="#FFFFFF"><font  size=2><?if (gdbfx("schoolname")!='') echo gdbfx("schoolname"); else echo "NA";?></font></td>
 </tr>
  <tr align="center" class="heading"> 
	<td  align=left width="40%" bgcolor="#FFFFFF"><font  size=2><strong>Finger Size</strong></font></td>
	<td class="toplinks" align=left width="60%" bgcolor="#FFFFFF"><font  size=2><?echo gdbfx("finger_size");?></font></td>
 </tr>
   <tr align="center" class="heading"> 
	<td  align=left width="40%" bgcolor="#FFFFFF"><font  size=2><strong>Stone Choice</strong></font></td>
	<td class="toplinks" align=left width="60%" bgcolor="#FFFFFF"><font  size=2><?=gdbfx("stone_number");?></font></td>
 </tr>
    <tr align="center" class="heading"> 
	<td  align=left width="40%" bgcolor="#FFFFFF"><font  size=2><strong>Stone Cut</strong></font></td>
	<td class="toplinks" align=left width="60%" bgcolor="#FFFFFF"><font  size=2><? if (getstoneType(gdbfx("stone_number"))!=1) echo "<font color=red>NA</font>"; else echo gdbfx("stone_cut_number");?></font></td>
 </tr>
  <tr align="center" class="heading"> 
	<td  align=left width="40%" bgcolor="#FFFFFF"><font  size=2><strong>Emblem Under Stone Letter</strong></font></td>
	<td class="toplinks" align=left width="60%" bgcolor="#FFFFFF"><font  size=2><? if (gdbfx("stone_cut_number")!="Emblem Under Stone") echo "<font color=red>NA</font>"; else echo gdbfx("letter1");?></font></td>
 </tr>
   <tr align="center" class="heading"> 
	<td  align=left width="40%" bgcolor="#FFFFFF"><font  size=2><strong>Encrusting on the Stone Letter</strong></font></td>
	<td class="toplinks" align=left width="60%" bgcolor="#FFFFFF"><font  size=2><? if (gdbfx("stone_cut_number")!="Encrusting on the Stone") echo "<font color=red>NA</font>"; else echo gdbfx("letter3");?></font></td>
 </tr>

 <tr align="center" class="heading"> 
	<td  align=left width="40%" bgcolor="#FFFFFF"><font  size=2><strong>Letter Shape</strong></font></td>
	<td class="toplinks" align=left width="60%" bgcolor="#FFFFFF"><font  size=2><? if (getstoneType(gdbfx("stone_cut_number"))!=6 || getstoneType(gdbfx("stone_number"))!=1) echo "<font color=red>NA</font>"; else echo gdbfx("stone_letter");?></font></td>
 </tr>
   <tr align="center" class="heading"> 
	<td  align=left width="40%" bgcolor="#FFFFFF"><font  size=2><strong>Crested Cut Letter</strong></font></td>
	<td class="toplinks" align=left width="60%" bgcolor="#FFFFFF"><font  size=2><? if (getstoneType(gdbfx("stone_cut_number"))!=6 || getstoneType(gdbfx("stone_number"))!=1) echo "<font color=red>NA</font>"; else echo gdbfx("letter2");?></font></td>
 </tr>
  
 <? if (gdbfx("image")!='') {?>
    <tr align="center" class="heading"> 
	<td  align=left width="40%" bgcolor="#FFFFFF"><font  size=2><strong>Custom Image</strong></font></td>
	<td class="toplinks" align=left width="60%" bgcolor="#FFFFFF"><font  size=2><? if (str_contains(gdbfx("image"),"PHOTO") && gdbfx("custom_left_side")!='') { echo "<small>".gdbfx("image")."(Custom Image)</small>";?></font><br>
	Used On <?if (gdbfx("custom_left_side")==1) echo "Left Side"; if (gdbfx("custom_left_side")==2) echo "Right Side";?> <?}?></td>
 </tr>
 <?}?>
     <tr align="center" class="heading"> 
	<td  align=left width="40%" bgcolor="#FFFFFF"><font  size=2><strong>Left Side Writing</strong></font></td>
	<td class="toplinks" align=left width="60%" bgcolor="#FFFFFF"><font  size=2><?=gdbfx("left_side_text");?></font></td>
 </tr>
      <tr align="center" class="heading"> 
	<td  align=left width="40%" bgcolor="#FFFFFF"><font  size=2><strong>Right Side Writing</strong></font></td>
	<td class="toplinks" align=left width="60%" bgcolor="#FFFFFF"><font  size=2><?=gdbfx("right_side_text");?></font></td>
 </tr>
      <tr align="center" class="heading"> 
	<td  align=left width="40%" bgcolor="#FFFFFF"><font  size=2><strong>Left Side Image</strong></font></td>
	<td class="toplinks" align=left width="60%" bgcolor="#FFFFFF"><font  size=2><?=gdbfx("left_side_image");?></font></td>
 </tr>
      <tr align="center" class="heading"> 
	<td  align=left width="40%" bgcolor="#FFFFFF"><font  size=2><strong>Right Side Image</strong></font></td>
	<td class="toplinks" align=left width="60%" bgcolor="#FFFFFF"><font  size=2><?=gdbfx("right_side_image");?></font></td>
 </tr>
      <tr align="center" class="heading"> 
	<td  align=left width="40%" bgcolor="#FFFFFF"><font  size=2><strong>Inside Engraving</strong></font></td>
	<td class="toplinks" align=left width="60%" bgcolor="#FFFFFF"><font  size=2><?=gdbfx("inside_engraving");?></font></td>
 </tr>
      <tr align="center" class="heading"> 
	<td  align=left width="40%" bgcolor="#FFFFFF"><font  size=2><strong>Outside Engraving</strong></font></td>
	<td class="toplinks" align=left width="60%" bgcolor="#FFFFFF"><font  size=2><?=gdbfx("outside_engraving");?></font></td>
 </tr>
<tr align="center" class="heading"> 
	<td  align=left width="40%" bgcolor="#FFFFFF"><font  size=2><strong>Engraving Font</strong></font></td>
	<td class="toplinks" align=left width="60%" bgcolor="#FFFFFF"><font  size=2><?=gdbfx("choose_font");?></font></td>
 </tr>
 <tr align="center" class="heading"> 
	<td  align=left width="40%" bgcolor="#FFFFFF"><font  size=2><strong>Final Cost</strong></font></td>
	<td class="toplinks" align=left width="60%" bgcolor="#FFFFFF"><font  size=3 color=green face=arial><strong>
	
	<?//echo gdbfx("ring_number")."-".gdbfx("metal_name")."<br>";
	
	$getstonetype=getstonetype(gdbfx("stone_number"));
	$getcost=getcost(gdbfx("ring_number"),gdbfx("metal_name"));
	if (gdbfx("Replace_Zicon")=='yes')
		$getcostD=getcostDiamond(gdbfx("ring_number"));
	else
		$getcostD=0;
		if ($getcost >0) {
			if ($getstonetype==1)
				echo "$ ".($getcost+12+$getcostD)." (USD)";
			if ($getstonetype==2)
				echo "$ ".($getcost+35+12+$getcostD)." (USD)";
			if ($getstonetype==3)
				echo "$ ".($getcost+65+12+$getcostD)." (USD)";	
			if ($getstonetype=='')
				echo "$ ".($getcost+12+$getcostD)." (USD)";	
		}
		else
			echo $getcost;
		?>
	
	</strong></font></td>
 </tr>

 <tr align="center" class="heading"> 
	<td  align=left width="40%" bgcolor="#FFFFFF"><font  size=2><strong>Cost BreakUp</strong></font></td>
	<td class="toplinks" align=left width="60%" bgcolor="#FFFFFF"><font  size=2 color=green >
	
	
		Cost Of Ring: $<?=$getcost;?>
		<?if ($getstonetype==2)
				echo "<br>Stone: $ ".(35);
			if ($getstonetype==3)
				echo "<br>Stone: $ ".(65);
			if ($getcostD!=0)
				echo "<br>Diamond Cost: $ ".$getcostD;
			echo "<br>Shipping Charges: $ ".(12);
		?>
	</font></td>
 </tr>
</table>







<table width="100%" border="0" cellspacing="1" cellpadding="2">
<?echo "<tr>";
echo "<td align=center  class=toplinks><br><a href=\"javascript:history.go(-1);\"><input type=button name=startagain value=\"Back\" class=button onclick=\"javascript:history.go(-1);\"></a></td><td align=center class=toplinks><br><input type=submit name=submit2 value=\"Place The order\" class=button></form></td></form></tr></table>";?>

<form name=step3 action="" method=POST>  <input type=hidden name=product value="<?=gdbfx("product");?>"><br><br><input type=submit name=startagain value="Start again" class=button></form>
<script>
function openWin(argURL, argSize) {

	window.open(argURL, "x_win" + (new Date()).getTime(), "resizable=yes,scrollbars=yes," + argSize);

}
</script>
</body>
</html></td>