<?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>

<script>

function validate(frm) {
		
		if (document.getElementById('heartthing').style.visibility=='visible') {
			if (step2.letter2.value == "") {
				alert("Enter Heart Shape Or Plain Letter");
				step2.letter2.focus();
				return (false);
			}
		}

		if (document.getElementById('shankthing').style.visibility=='visible') {
			if (step2.letter1.value == "") {
				alert("Enter Emblem Code");
				step2.letter1.focus();
				return (false);
			}
		}
		if (document.getElementById('shankthing').style.visibility=='visible') {
			if (step2.letter1.value!= "") {
				if (step2.letter1.value != "1102" && step2.letter1.value != "1104" && step2.letter1.value != "1106" && step2.letter1.value != "1108" && step2.letter1.value != "1110" && step2.letter1.value != "1112" && step2.letter1.value != "1114" && step2.letter1.value != "1116" && step2.letter1.value != "1118" && step2.letter1.value != "1120" && step2.letter1.value != "1122" && step2.letter1.value != "1124" && step2.letter1.value != "1126" && step2.letter1.value != "1128" && step2.letter1.value != "1130" && step2.letter1.value != "1132" && step2.letter1.value != "1134" && step2.letter1.value != "1136" && step2.letter1.value != "1138" && step2.letter1.value != "1140" && step2.letter1.value != "1142" && step2.letter1.value != "1144" && step2.letter1.value != "1146" && step2.letter1.value != "1148" && step2.letter1.value != "1150" && step2.letter1.value != "1152"  && step2.letter1.value != "1154" && step2.letter1.value != "1156" && step2.letter1.value != "1158" && step2.letter1.value != "1160" && step2.letter1.value != "1162" && step2.letter1.value != "1168" && step2.letter1.value != "1170" && step2.letter1.value != "1172" && step2.letter1.value != "1174" && step2.letter1.value != "1176" && step2.letter1.value != "1178" && step2.letter1.value != "1180" && step2.letter1.value != "1182" && step2.letter1.value != "1152" && step2.letter1.value != "1184" && step2.letter1.value != "1186" && step2.letter1.value != "1188" && step2.letter1.value != "1190" && step2.letter1.value != "1192" && step2.letter1.value != "1194" && step2.letter1.value != "1196" && step2.letter1.value != "1198" && step2.letter1.value != "1200" && step2.letter1.value != "1202" && step2.letter1.value != "1204" && step2.letter1.value != "1208" && step2.letter1.value != "1210" && step2.letter1.value != "1212" && step2.letter1.value != "1214" && step2.letter1.value != "1216" && step2.letter1.value != "1218"  && step2.letter1.value != "1220" && step2.letter1.value != "1222" && step2.letter1.value != "1224" && step2.letter1.value != "1226" && step2.letter1.value != "1228" && step2.letter1.value != "1230" && step2.letter1.value != "1232" && step2.letter1.value != "1234" && step2.letter1.value != "1236" && step2.letter1.value != "1238" && step2.letter1.value != "1240" && step2.letter1.value != "1242" && step2.letter1.value != "1244" && step2.letter1.value != "1246" && step2.letter1.value != "1248" && step2.letter1.value != "1250" && step2.letter1.value != "1252" && step2.letter1.value != "1254" && step2.letter1.value != "1256" && step2.letter1.value != "1258" && step2.letter1.value != "1260" && step2.letter1.value != "1262" && step2.letter1.value != "1264" && step2.letter1.value != "1266" && step2.letter1.value != "1268"  && step2.letter1.value != "1269" && step2.letter1.value != "1270" && step2.letter1.value != "1346" && step2.letter1.value != "A" && step2.letter1.value != "B"  && step2.letter1.value != "C"  && step2.letter1.value != "D"  && step2.letter1.value != "E"  && step2.letter1.value != "F"  && step2.letter1.value != "G"  && step2.letter1.value != "H"  && step2.letter1.value != "I"  && step2.letter1.value != "J"  && step2.letter1.value != "K"  && step2.letter1.value != "L"  && step2.letter1.value != "M"  && step2.letter1.value != "N"  && step2.letter1.value != "O"  && step2.letter1.value != "P"  && step2.letter1.value != "Q"  && step2.letter1.value != "R"  && step2.letter1.value != "S"   && step2.letter1.value != "T"   && step2.letter1.value != "U"   && step2.letter1.value != "V"   && step2.letter1.value != "W"   && step2.letter1.value != "X"   && step2.letter1.value != "Y"   && step2.letter1.value != "Z"   ) {
					alert("Emblem Code entered is NOT valid.");
					step2.letter1.focus();
					return (false);
				}
			}
		}

		if (document.getElementById('encrustingthing').style.visibility=='visible') {
			if (step2.letter3.value == "") {
				alert("Enter Encrusting on the Stone Letter");
				step2.letter3.focus();
				return (false);
			}
		}
}
</script>
</head>
<body>
<?$step=3;

include("stepstop.php")?>
<?if (getcostsimple(gdbfx("ring_number"),gdbfx("metal_name"))==''){
	echo "<center><br><br><font class=heading><font color=red size=4><b>".gdbfx("ring_number") ." Ring is not available in ". gdbfx("metal_name")."<br><a href='javascript:history.back();'>Click Here</a> to Choose other Metal.</b></font></font></center>";
	die;
}
if ($_GET["category_id"]==15) {

		if (getcostsimple(gdbfx("ring_number"),"Diamond")=='')
			$Replace_Zicon="";
		else
			$Replace_Zicon="yes";	redirect("chooseoptions3.php?product=".str_replace(" ","%20",gdbfx("product"))."&ring_number=".gdbfx("ring_number")."&metal_name=".str_replace(" ","%20",gdbfx("metal_name"))."&metal_finish=".str_replace(" ","%20",gdbfx("metal_finish"))."&Palm_Side=".str_replace(" ","%20",gdbfx("Palm_Side"))."&Replace_Zicon=".$Replace_Zicon."&schoolname=".str_replace(" ","%20",gdbfx("schoolname"))."&finger_size=".str_replace(" ","%20",gdbfx("finger_size")));
	}

if (gdbfx("Replace_Zicon")=='yes'){
	
	if (getcostsimple(gdbfx("ring_number"),"Diamond")==''){
			echo "<center><br><font class=heading><font color=red size=2 face=arial>".gdbfx("ring_number") ." Ring is not available with <b>Replace Zicon with real Diamonds option.</b>This option will be Ignored Or <a href='javascript:history.back();'>Click Here</a> to Choose other Ring.</b></font></font></center>";
			$Replace_Zicon="";
	}
	else
		$Replace_Zicon="yes";
}

?>
<table width="100%" border="0" cellspacing="1" cellpadding="2">
				  <form name=step2 action="chooseoptions3.php" method=GET  onSubmit="return validate(this);">

				  <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="<?=$Replace_Zicon;?>">
					<input type=hidden name=schoolname value="<?=gdbfx("schoolname");?>">
					<input type=hidden name=finger_size value="<?=gdbfx("finger_size");?>">
<?
$sql="select * from stone_master where stone_status=1 and stone_type=3";
$cmd = mysql_query($sql);?>

 <tr align="center" class="heading"> 
	<td class="toplinks" align=left colspan=2><font  size=2><strong>Step 3 : Stone Choice </font></strong></td>
  </tr>
</table>

<?if ($_GET["category_id"]!=4 && !str_contains($_GET["ring_number"],"1022") && !str_contains($_GET["ring_number"],"1030") && !str_contains($_GET["ring_number"],"1501") && !str_contains($_GET["ring_number"],"1502") && !str_contains($_GET["ring_number"],"1503")&& !str_contains($_GET["ring_number"],"1504") && $_GET["category_id"]!=3 ){?>

<table width="100%" border="0" cellspacing="1" cellpadding="2">
<?echo "<tr>";
echo "<td align=left colspan=\"2\" class=toplinks>Smooth Specialty Stones</td></tr></table>";?>
<table width="100%" border="0" cellspacing="1" cellpadding="2" background="images/yellowbg4.gif"><tr>
<?while ($rs = mysql_fetch_array($cmd)) {
	if ($i==6) echo "</tr><tr>";
	echo "<td bgcolor=\"#FFFFFF\">";
	$i=$i+1;
	if ($rs["stone_image"]!='')
		echo "<img src=\"stone_images/".$rs["stone_image"]."\"  border=\"0\"><br>";
		echo "<font class='heading'><input type=radio name=stone_number value='".$rs["stone_name"]."'  onclick=\"handleClick('hide it'); return true\"><small>".$rs["stone_name"]."</small></font>";
		echo "</td>";

}	
echo "</tr></table>"; ?>
<?if (!str_contains($_GET["ring_number"],"1005") && !str_contains($_GET["ring_number"],"1006")){?>

<?
$sql="select * from stone_master where stone_status=1 and stone_type=2";
$cmd = mysql_query($sql);?>

<table width="100%" border="0" cellspacing="1" cellpadding="2">
<?echo "<tr>";
echo "<td align=left colspan=\"2\" class=toplinks><font color=red>OR</font> Facet Specialty Stones</td></tr></table>";?>
<table width="100%" border="0" cellspacing="1" cellpadding="2" background="images/yellowbg4.gif"><tr>
<?while ($rs = mysql_fetch_array($cmd)) {
	if ($i==6) echo "</tr><tr>";
	echo "<td bgcolor=\"#FFFFFF\">";
	$i=$i+1;
	if ($rs["stone_image"]!='')
		echo "<img src=\"stone_images/".$rs["stone_image"]."\"  border=\"0\"><br>";
		echo "<font class='heading'><input type=radio name=stone_number value='".$rs["stone_name"]."'  onclick=\"handleClick('hide it'); return true\"><small>".$rs["stone_name"]."</small></font>";
		echo "</td>";

}	
echo "</tr></table>"; ?>
<?}?>
<?}?>

<?$i=0;
$sql="select * from stone_master where stone_status=1 and stone_type=1";
$cmd = mysql_query($sql);?>
<table width="100%" border="0" cellspacing="1" cellpadding="2">
<?echo "<tr>";
echo "<td align=left colspan=\"2\" class=toplinks>";
if ($_GET["category_id"]!=4 && !str_contains($_GET["ring_number"],"1022") && !str_contains($_GET["ring_number"],"1030") && !str_contains($_GET["ring_number"],"1501") && !str_contains($_GET["ring_number"],"1502") && !str_contains($_GET["ring_number"],"1503")&& !str_contains($_GET["ring_number"],"1504") && $_GET["category_id"]!=3 ) echo "<font color=red>OR</font> ";
echo "Birth Stones(Must select a stone cut later on the page below)</td></tr></table>";?>
<table width="100%" border="0" cellspacing="1" cellpadding="2" background="images/yellowbg4.gif"><tr>
<?while ($rs = mysql_fetch_array($cmd)) {
	$ringnumber=$rs["ring_number"];
		if ($i==0)
			$checked="checked";	
		else
			$checked="";

	if ($i==6) echo "</tr><tr>";
	echo "<td bgcolor=\"#FFFFFF\">";
	$i=$i+1;
	if ($rs["stone_image"]!='')
		echo "<img src=\"stone_images/".$rs["stone_image"]."\"  border=\"0\"><br>";
		echo "<font class='heading'><input type=radio name=stone_number value='".$rs["stone_name"]."'  ".$checked." onclick=\"handleClick('show it'); return true\"><small>".$rs["stone_name"]."</small></font>";
		echo "</td>";

}	
echo "</tr></table>"; ?>

<div id="boxthing2">
<table width="100%" border="0" valign=top cellspacing="1" cellpadding="2">
<?echo "<tr>";
echo "<td align=center valign=top colspan=\"2\" class=toplinks><input type=submit name=submit1 value=\"Move to Next Step\" class=button></td></tr></table>";?>
<table width="100%" border="0" cellspacing="1" cellpadding="2" valign=top ><tr>
<tr>

<td bgcolor="#FFFFFF" class="toplinks" valign=top><a href="chooseoptions.php?product=<?=gdbfx("product");?>"><u>Start Again</u></a>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:history.back();"><u>Back</u></a>

		</td>	
</tr></table>
</div>

<div id="boxthing">
<?
$sql="select * from stone_master where stone_status=1 and stone_type=4";
if (str_contains($_GET["ring_number"],"1501") || str_contains($_GET["ring_number"],"1501") || str_contains($_GET["ring_number"],"1503") || str_contains($_GET["ring_number"],"1504"))
$sql.=" and  stone_name not like '%starburst%' and  stone_name not like '%quadren%'";
$cmd = mysql_query($sql);?>

<table width="100%" border="0" cellspacing="1" cellpadding="2">
<?echo "<tr>";
echo "<td align=left colspan=\"2\" class=toplinks>Stone Cut <font color=red>(only if a Birth Stone is chosen)</font></td></tr></table>";?>

<?if (!str_contains($_GET["ring_number"],"1005") && !str_contains($_GET["ring_number"],"1006")){?>

<table width="100%" border="0" cellspacing="1" cellpadding="2">
<?echo "<tr>";
echo "<td align=left colspan=\"2\" class=toplinks>Facet Cut</td></tr></table>";?>
<table width="100%" border="0" cellspacing="1" cellpadding="2" background="images/yellowbg4.gif"><tr>
<?$i=0;
	while ($rs = mysql_fetch_array($cmd)) {
	if ($i==6) echo "</tr><tr>";
	echo "<td bgcolor=\"#FFFFFF\">";
	
	if ($i==0)
			$checked="checked";	
		else
			$checked="";
	$i=$i+1;
	if ($rs["stone_image"]!='')
		echo "<img src=\"stone_images/".$rs["stone_image"]."\"  border=\"0\"><br>";
		echo "<font class='heading'><input type=radio name=stone_cut_number value='".$rs["stone_name"]."' ".$checked." onclick=\"handleshank('".$rs["stone_id"]."'); return true\"><small>".$rs["stone_name"]."</small></font>";
		echo "</td>";

}	
echo "</tr></table>"; ?>
<?}?>
<?
$sql="select * from stone_master where stone_status=1 and stone_type=5";
$cmd = mysql_query($sql);?>

<table width="100%" border="0" cellspacing="1" cellpadding="2">
<?echo "<tr>";
echo "<td align=left colspan=\"2\" class=toplinks>";
if (!str_contains($_GET["ring_number"],"1005") && !str_contains($_GET["ring_number"],"1006") ) echo "<font color=red>OR</font> ";
echo "Smooth Cut</td></tr></table>";?>
<table width="100%" border="0" cellspacing="1" cellpadding="2" background="images/yellowbg4.gif"><tr>
<?$i=0;
while ($rs = mysql_fetch_array($cmd)) {
	if ($i==6) echo "</tr><tr>";
	echo "<td bgcolor=\"#FFFFFF\">";
	$i=$i+1;
	if ($rs["stone_image"]!='')
		echo "<img src=\"stone_images/".$rs["stone_image"]."\"  border=\"0\"><br>";
		echo "<font class='heading'><input type=radio name=stone_cut_number value='".$rs["stone_name"]."'  onclick=\"handleshank('".$rs["stone_id"]."'); return true\"><small>".$rs["stone_name"]."</small></font>";
		echo "</td>";

}	
echo "</tr></table>"; ?>
<div id="shankthing">
<table width="100%" border="0" cellspacing="1" cellpadding="2">
<?echo "<tr>";
echo "<td align=left colspan=\"2\" class=text>If <b>Emblem Under Stone</b> is choosen above enter Emblem Code Here : <input type=text size=2 name=letter1 maxlength=4> </font>";?>
<br><a href="#" onClick="javascript:openWin('protectedpopup.php', 'width=780, height=810')" class=toplinks ><font class=textlinks><b><u>See Available Emblems</u></b></font></a>
<?echo "</td></tr></table>";?>
</div>
<div id="encrustingthing">
<table width="100%" border="0" cellspacing="1" cellpadding="2">
<?echo "<tr>";
echo "<td align=left colspan=\"2\" class=text>If <b>Encrusting on the Stone</b><small>(1 char. max)</small> is choosen above enter It here : <input type=text size=2 name=letter3 maxlength=1> </font>";?>
<?echo "</td></tr></table>";?>
</div>

<?
$sql="select * from stone_master where stone_status=1 and stone_type=6";
$cmd = mysql_query($sql);?>

<table width="100%" border="0" cellspacing="1" cellpadding="2">
<?echo "<tr>";
echo "<td align=left colspan=\"2\" class=toplinks><font color=red>OR</font> Crested Cut</td></tr></table>";?>
<table width="100%" border="0" cellspacing="1" cellpadding="2" background="images/yellowbg4.gif"><tr>
<?while ($rs = mysql_fetch_array($cmd)) {
	if ($i==6) echo "</tr><tr>";
	echo "<td bgcolor=\"#FFFFFF\">";
	$i=$i+1;
	if ($rs["stone_image"]!='')
		echo "<img src=\"stone_images/".$rs["stone_image"]."\"  border=\"0\"><br>";
		echo "<font class='heading'><input type=radio name=stone_cut_number value='".$rs["stone_name"]."'  onclick=\"handleshank('".$rs["stone_id"]."'); return true\"><small>".$rs["stone_name"]."</small></font>";
		echo "</td>";

}	
echo "</tr></table>"; ?>
<?
$sql="select * from stone_master where stone_status=1 and stone_type=7";
$cmd = mysql_query($sql);?>

<table width="100%" border="0" cellspacing="1" cellpadding="2">
<?echo "<tr>";
echo "<td align=left colspan=\"2\" class=toplinks><font color=red>AND</font> Letter</td></tr></table>";?>
<table width="100%" border="0" cellspacing="1" cellpadding="2" background="images/yellowbg4.gif"><tr>
<?$i=0;
while ($rs = mysql_fetch_array($cmd)) {
	if ($i==6) echo "</tr><tr>";
	echo "<td bgcolor=\"#FFFFFF\">";
	$i=$i+1;
	if ($rs["stone_image"]!='')
		echo "<img src=\"stone_images/".$rs["stone_image"]."\"  border=\"0\"><br>";
		echo "<font class='heading'><input type=radio name=stone_letter value='".$rs["stone_name"]."' ><small>".$rs["stone_name"]."</small></font>";
		echo "</td>";

}	
echo "</tr></table>"; ?>
<div id="heartthing">
<table width="100%" border="0" cellspacing="1" cellpadding="2">
<?echo "<tr>";
echo "<td align=left colspan=\"2\" class=toplinks>If <b>Heart Shape</b> Or <b>Plain Letter</b> is choosen above enter It here : <input type=text size=2 name=letter2 maxlength=1> </font></td></tr></table>";?>
</div>
<table width="100%" border="0" cellspacing="1" cellpadding="2">
<?echo "<tr>";
echo "<td align=center  class=toplinks><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><input type=submit name=submit1 value=\"Move to Next Step\" class=button></form></td></tr></table>";?>
<table width="100%" border="0" cellspacing="1" cellpadding="2" ><tr>
<tr>

<td bgcolor="#FFFFFF" class="toplinks"><a href="chooseoptions.php?product=<?=gdbfx("product");?>"><u>Start Again</u></a>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;

		</td>	
</tr></table>
</div>
</body>
<script>

function hideLayer(whichLayer) {

if (document.getElementById) {
// this is the way the standards work
document.getElementById(whichLayer).style.visibility = "hidden";
}
else if (document.all) {
// this is the way old msie versions work
document.all[whichlayer].style.visibility = "hidden";
}
else if (document.layers) {
// this is the way nn4 works
document.layers[whichLayer].visibility = "hidden";
}

}

function showLayer(whichLayer) {

if (document.getElementById) {
// this is the way the standards work
document.getElementById(whichLayer).style.visibility = "visible";
}
else if (document.all) {
// this is the way old msie versions work
document.all[whichlayer].style.visibility = "visible";
}
else if (document.layers) {
// this is the way nn4 works
document.layers[whichLayer].visibility = "visible";
}

}
function handleClick(whichClick) {

if (whichClick == "hide it") {
// then the user wants to hide the layer
hideLayer("boxthing");
showLayer("boxthing2");

}
else if (whichClick == "show it") {
// then the user wants to show the layer
showLayer("boxthing");
hideLayer("boxthing2");
}

}
hideLayer("boxthing2");
hideLayer("shankthing");
hideLayer("encrustingthing");
hideLayer("heartthing");

</script>
<script>
function handleshank(whichClick) {

if (whichClick==25){
	
	showLayer("shankthing");
}
if (whichClick!=25){
	hideLayer("shankthing");
	
}
if (whichClick==26){
	
	showLayer("encrustingthing");
}
if (whichClick!=26){
	hideLayer("encrustingthing");
	
}
if (whichClick==28 || whichClick==29){
	
	showLayer("heartthing");
}
if (whichClick!=28 && whichClick!=29){
	hideLayer("heartthing");
	
}



}
function openWin(argURL, argSize) {

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

}

</script>
</html>