// JavaScript Document
<!--
function goProcesstest(a){alert("test");if(a=="add"){if(document.getElementById("ajaxcheck").value==1){self.document.wishbuy.action="";document.getElementById("a2cb").className="hidden";document.getElementById("a2cw").className="greenbutton";q=document.getElementById("quantity").value;n=document.getElementById("newitem").value;c=document.getElementById("unclashcategory").value;p=document.getElementById("price").value;if(document.getElementById("optionid").options){o=document.getElementById("optionid").options[document.getElementById("optionid").selectedIndex].value}else{o=document.getElementById("optionid").value}iedcache=Math.random();url="/cartcontrol/cartmonitor.cfc?method=additem&newitem="+n+"&quantity="+q+"&category="+c+"&price="+p+"&optionid="+o+"&iedcache="+iedcache+"&endof";self.document.wishbuy.action="";loadXMLDoc(url);return false}else{if(document.getElementById("quantity").value!=""){if(vCurrentInventory>=document.getElementById("quantity").value){vOptions=document.getElementById("optionidpulldown");if(vOptions!=null){if(vOptions.options[vOptions.selectedIndex].text=="Must Select Option"){alert("An option from the pull down menu must be selected.")}else{self.document.wishbuy.action="/carttest2.cfm";self.document.wishbuy.submit()}}else{self.document.wishbuy.action="/carttest2.cfm";self.document.wishbuy.submit()}}else{alert("The quantity entered exceeds the amount we currently have available.")}}else{alert("No quantity was entered.")}}return false}if(a=="Add to Wish List"){self.document.wishbuy.action="/wish.cfm";self.document.wishbuy.submit();return}if(a=="Show Next"){self.document.wishbuy.action="/jewelry_item.cfm/"+self.document.wishbuy.nextitem.value+".htm";self.document.wishbuy.submit();return}}function goProcess(a){if(a=="add"){if(document.getElementById("ajaxcheck").value==1){self.document.wishbuy.action="";document.getElementById("a2cb").className="hidden";document.getElementById("a2cw").className="greenbutton";q=document.getElementById("quantity").value;n=document.getElementById("newitem").value;c=document.getElementById("unclashcategory").value;p=document.getElementById("price").value;if(document.getElementById("optionid").options){o=document.getElementById("optionid").options[document.getElementById("optionid").selectedIndex].value}else{o=document.getElementById("optionid").value}iedcache=Math.random();url="/cartcontrol/cartmonitor.cfc?method=additem&newitem="+n+"&quantity="+q+"&category="+c+"&price="+p+"&optionid="+o+"&iedcache="+iedcache+"&endof";self.document.wishbuy.action="";loadXMLDoc(url);return false}else{if(document.getElementById("quantity").selectedIndex!=0){if(vCurrentInventory>=document.getElementById("quantity").selectedIndex-1){vOptions=document.getElementById("optionidpulldown");if(vOptions!=null){if(vOptions.options[vOptions.selectedIndex].text=="Must Select Option"){alert("An option from the pull down menu must be selected.")}else{self.document.wishbuy.action="http://wholesale.semiprecious.com/cart.cfm";self.document.wishbuy.submit()}}else{self.document.wishbuy.action="http://wholesale.semiprecious.com/cart.cfm";self.document.wishbuy.submit()}}else{var b="Please select quantity 0 to "+vCurrentInventory+". Selecting 0 will remove the item from your cart.";alert(b)}}else{alert("No quantity was entered.")}}return false}if(a=="Add to Wish List"){self.document.wishbuy.action="/wish.cfm";self.document.wishbuy.submit();return}if(a=="Show Next"){self.document.wishbuy.action="/jewelry_item.cfm/"+self.document.wishbuy.nextitem.value+".htm";self.document.wishbuy.submit();return}}function ajaxcheck(){if(document.getElementById("ajaxcheck").value==-1){ajaxCheckClient();return false}}function ajaxCheckClient(){var a=Math.random();a=a*1e3;a=Math.round(a*1e3)+1;document.getElementById("ajaxcheck").value=a;var b="/ajaxCheckServer.cfm?var="+a;loadXMLDoc(b);return}function processReqChange(){if(req.readyState==4){if(req.status==200){good=0;if(req.responseXML){if(req.responseXML.documentElement){good=1}}if(good==0){document.getElementById("ajaxcheck").value=0;goProcess("add")}if(good==1){response=req.responseXML.documentElement;method0=response.getElementsByTagName("localmethod")[0].firstChild.data;if(method0=="ajaxcheck"){var a=response.getElementsByTagName("returnvalue")[0].firstChild.data;var b=document.getElementById("ajaxcheck").value;if(b==a){document.getElementById("ajaxcheck").value=1;url="/ajaxcheckserver.cfm?ajaxset=1"}else{document.getElementById("ajaxcheck").value=0}return}if(method0=="ajaxset"){return}method=response.getElementsByTagName("qtyadded")[0].firstChild.data;if(method){method1=response.getElementsByTagName("optionid")[0].firstChild.data;method2=response.getElementsByTagName("qtyinstock")[0].firstChild.data;method3=response.getElementsByTagName("grandtotal")[0].firstChild.data;method4=response.getElementsByTagName("totalqty")[0].firstChild.data;method2=method2*1+0;method=method*1+0;method3=method3*1;if(method>method2){alert("In stock :"+method2+" . Your Order:"+method+". Please allow 2-4 weeks for not in stock qty")}else{alert("Qty of this item in cart:"+method+".")}document.getElementById("totalqty").innerHTML='<u><a href="http://<cfoutput>#cgi.server_name#</cfoutput>/cart.cfm" title="check jewelry in cart">Qty  in Cart</a></u><br /><strong><span style="background-color:white;">This Item: '+method+'</span></strong><br /><a href="/cart.cfm" title="click to go to cart">Total: '+method4+"</a>";document.getElementById("totalqty").className="rowb";if(method1>0){document.getElementById("qtyincart").innerHTML='<a href="http://<cfoutput>#cgi.server_name#</cfoutput>/cart.cfm" title="click to go to cart">Qty In Cart: '+method+' </a> <span class="optionsinline">(Option '+method1+")</span>"}else{document.getElementById("qtyincart").innerHTML=' <a href="http://<cfoutput>#cgi.server_name#</cfoutput>/cart.cfm" title="click to go to cart">Qty In Cart: '+method+" </a> "}document.getElementById("totalqty").className="itemdetailsboxgreen";document.getElementById("qtyincart").className="itemdetailsboxred";document.getElementById("erroraddingitem").className="hidden";document.getElementById("grandtotal").innerHTML="[ $"+method3+" , "+method4+" Items]";document.getElementById("grandtotal").className="error";document.getElementById("a2wl").className="hidden"}else{alert("There was an error. Make sure you have entered a numeric value in the qty")}}else{document.getElementById("a2cw").className="hidden";document.getElementById("a2cb").className="greenbutton";document.getElementById("erroraddingitem").className="error";document.getElementById("ajaxoutput").className="itemdetailsboxred";return false}}else{alert("There was an error adding the Item.")}document.getElementById("a2cw").className="hidden";document.getElementById("a2cb").className="greenbutton"}return false}function updateOptionid(){document.getElementById("optionid").value=document.getElementById("optionidlist").options[document.getElementById("optionidlist").selectedIndex].value}
//-->

