var FramedWindow; var ReffererItemID; var ReffererCategoryID; var ShowCloseWindowTitle; nav = navigator.userAgent; var compareView; var StoneID,ItemPriceForPreset,ItemPriceForPreset; compareView = 1; moz = false; var msie = (navigator.userAgent.toLowerCase().indexOf('msie')!=-1); var IE7andMOZ = window.XMLHttpRequest; if ((nav.indexOf("Firefox") != -1)||(nav.indexOf("Netscape") != -1))
moz = true; if(!msie)
var xmlDoc = document.implementation.createDocument("", "", null); else
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); function DoSelect() { if(CheckSize()==false) return false;alert(document.forms[5].name);document.frmItem.submit();}
function $(objID){return document.getElementById(objID);}
function TrackModule(m,l)
{ pic1= new Image(1,1); pic1.src="TrackModule.asp?m="+m+'&l='+l;}
var rsize;function CheckSize(){rsize = document.getElementsByName('ringsize')[0].value;if(rsize==''){alert("Please select ring size");document.getElementsByName('ringsize')[0].focus();return false}}
function LoadImage(obj)
{ var so = new SWFObject("Loupe/image_viewer_advanced.swf", "my-flash", "583", "359", "7", "#FFFFFF"); so.addParam("wmode", "transparent"); so.addVariable("xmlPath", "loupe/LoupeData.asp?id="+StoneID); if(!msie) hs.minWidth=583; return hs.htmlExpand(obj, { swfObject: so } )
}
function formatCurrency(num) { num = num.toString().replace(/\$|\,/g,''); if(isNaN(num))
num = "0"; sign = (num == (num = Math.abs(num))); num = Math.floor(num*100+0.50000000001); cents = num%100; num = Math.floor(num/100).toString(); if(cents<10)
cents = "0" + cents; for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
num = num.substring(0,num.length-(4*i+3))+','+ num.substring(num.length-(4*i+3)); return (((sign)?'':'-') + '$' + num );}
function show(actio) { var xpos = getX(document.getElementById('MainImage')); var ypos = getY(document.getElementById('MainImage')); ypos +=240; xpos -=22; if(actio==0)
{ document.getElementById('yourlayer').style.top = ypos; document.getElementById('yourlayer').style.left = xpos; document.getElementById('yourlayer').style.visibility='visible';}
else
{ document.getElementById('myRing').style.top = ypos; document.getElementById('myRing').style.left = xpos; document.getElementById('myRing').style.visibility='visible';}
}
function hide() { document.getElementById('yourlayer').style.visibility='hidden'; document.getElementById('myRing').style.visibility='hidden';}
function verify()
{ if (xmlDoc.readyState != 4)
{ return false;}
}
function ShowLayer(vobj,layer_id)
{ $(layer_id).style.top = getY(vobj); $(layer_id).style.left = getX(vobj); $(layer_id).style.visibility = "visible";}
function PostData(frm,tpage,msgElmName,popupIDtoClose,popDivClose,clear_form){ var str= ""; if(msgElmName != '')
var msg = eval("document.getElementById('"+msgElmName + "')"); else
var msg = document.getElementById("msg"); for(i=0;i<frm.length;i++){ switch (frm[i].type) { case "text" : {str += frm[i].name + "=" + escape(frm[i].value) + "&" } break; case "Text" : {str += frm[i].name + "=" + escape(frm[i].value) + "&" } break; case "textarea" : {str += frm[i].name + "=" + escape(frm[i].value) + "&"}break; case "hidden" :{str += frm[i].name + "=" + escape(frm[i].value) + "&"}break; case "radio" : {if(frm[i].checked==true) str += frm[i].name + "=" + escape(frm[i].value) + "&"} break; case "checkbox" :{str += frm[i].name + "=" + escape(frm[i].checked) + "&"}break; case "select-one" :{ str += frm[i].name + "=" + escape(frm[i].options[frm[i].selectedIndex].text) + "&"
str += frm[i].name + "_value=" + escape(frm[i].options[frm[i].selectedIndex].value) + "&"
}
break;}
}
var sendInfo = GetSourceHtml(tpage,str); if(document.getElementById("frmWrap")) document.getElementById("frmWrap").innerHTML = "<iframe scrolling='no' frameborder='0'  id='main_ifrm' src='https://design.jared-diamonds.com/blank.htm'></iframe>"
if(sendInfo.indexOf("Please")>=0)
{ alert(sendInfo); return false;}
if(popupIDtoClose==3)
{ if(clear_form) clearform(frm); alert(sendInfo); if($('capt'))
{ $('capt').src = '_Captcha/aspcaptcha.asp?' + Math.random();}
close_win1(); return false;}
if(popDivClose==4)
{ if(clear_form) clearform(frm); alert(sendInfo); if($('msgReq1'))
{ $('capt5').src = '_Captcha/aspcaptcha.asp?' + Math.random(); return false;}return false;
}
if(popupIDtoClose!=undefined){ var element = eval("document.getElementById('" + popupIDtoClose + "')"); element.style.display = element.style.display == 'block' ? 'none':'block';}
else
msg.innerHTML = sendInfo; if(clear_form) clearform(frm); return false;}
function clearform(frm){ for(i=0;i<frm.length;i++){ switch (frm[i].type) { case "text" : {frm[i].value = ""} break; case "textarea" : {frm[i].value = ""}break;}
}
}
function close_win1(){ parent.document.getElementById('main_div').style.display='none'; var image1 = new Image();}
function PrintIFRM(obj){ window.print(obj);}
function ZoomIn(obj){ var zomVal = parseInt(obj.style.zoom) + 10; if(zomVal <= 100)
obj.style.zoom = zomVal + "%";}
function ZoomOut(obj){ var zomVal = parseInt(obj.style.zoom) - 10; if(zomVal >= 50)
obj.style.zoom = zomVal + "%";}
function displayElement(elmName,obj,eImage1,eImage2)
{ if(document.getElementById("commentsfinish"))
{ document.getElementById("commentsfinish").style.display = document.getElementById("commentsfinish").style.display == 'inline' ? 'none':'inline'; document.getElementById("3commentPoints").style.display = "none";}
var element = eval("document.getElementById('" + elmName + "')"); if(element)
{ element.style.display = element.style.display == 'block' ? 'none':'block'; if(eImage1!=undefined) document.getElementById("plus").src = element.style.display == 'block' ? eImage2:eImage1; if(document.getElementById("read_review")) document.getElementById("read_review").style.display = element.style.display == 'block' ? 'none':'block';}
}
function displayElementBG(elmName,obj,bgOn,bgOff)
{ var element = eval("top.document.getElementById('" + elmName + "')"); element.style.display = element.style.display == 'block' ? 'none':'block';}
function more_search_options(obj)
{ document.getElementById('tblCC').style.display = document.getElementById('tblCC').style.display == 'block' ? 'none':'block'; document.getElementById('tblcut').style.display = document.getElementById('tblcut').style.display == 'block' ? 'none':'block'; obj.src = document.getElementById('tblcut').style.display == 'block' ? '_images/but_search_more_close.jpg':'_images/but-search-more.jpg';}
function replace_pic_src(obj,srcURL,itemid){ eval("document.getElementById('pic_"+ itemid +"').src='_images/jewelry/" + srcURL + "'");}
function replace_pic_src1(item_id,pid){ last_div_id = 0; if(objDoc.getElementById('div'+last_div_id))
{ var oldy = objDoc.getElementById("div"+last_div_id); objDoc.body.removeChild(oldy);}
objDoc.frm1.pic.src = "_images/jewelry/" + srcURL;}
function hide_shapes(act){ if (document.getElementById('shapes')){ if(act == 0){document.getElementById('shapes').style.visibility ="hidden";}else document.getElementById('shapes').style.visibility ="visible";}
}
function AddItems(itemid) { var slots = itemid + ","; xmlDoc.async="false"; xmlDoc.onreadystatechange=verify; xmlFile = site+ "/AddToCart.asp?cart=" + slots ; xmlDoc.load(xmlFile); document.getElementById("frmWrap").innerHTML = "<iframe scrolling='no' frameborder='0'  id='main_ifrm' src='" + site + "blank.htm'></iframe>"; open_div(site + "/Messages.asp?MsgType=1&ToShop=1&Info=" + xmlDoc.text,300,200);}
var StartTop = 0 ; var StartLeft = screen.width ; var ElementTop ; var ElementLeft ; var idII; function getX(obj)
{ return( obj.offsetParent==null ? obj.offsetLeft : obj.offsetLeft+getX(obj.offsetParent) );}
function getY(obj)
{ return( obj.offsetParent==null ? obj.offsetTop : obj.offsetTop+getY(obj.offsetParent) );}
function remove(){ dv.style.visibility = 'hidden'; window.clearInterval(idIII)
}
function runElement(direction){ var nval = -30; if (direction == 1) nval = 30; StartLeft = StartLeft + nval; if(direction == 0)
{ if(ElementLeft > StartLeft )
{ window.clearInterval(idII); idIII = window.setInterval("remove()", 10000);}
}
else
{ if(ElementLeft < StartLeft )
{ window.clearInterval(idII); idIII = window.setInterval("remove()", 10000);}
}
dv.style.left = StartLeft;}
function AddItem(act) { if(act == 0){ var numofitems = ""
xmlDoc.async="false"; xmlDoc.onreadystatechange=verify; xmlFile = site + "/CheckItemsInShoppingBag.asp"; xmlDoc.load(xmlFile); if(xmlDoc.text=="0"){ StartTop = 0 ; StartLeft = screen.width ; Ypos = getY(document.getElementById("but_shop"))- 130; Xpos = getX(document.getElementById("but_shop"))+ 150; ElementTop = Ypos; ElementLeft = Xpos; StartTop = ElementTop; dv = document.getElementById("lyr4"); dv.style.top = ElementTop; dv.style.visibility = 'visible'; idII = window.setInterval("runElement(0)", 1); return false;}
else{ document.location=site + "/Shop_Bag.asp";return false;}
}
var slots = ""; if (document.frm_search.cart[1])
for(i=0;i<document.frm_search.cart.length;i++)
{ if(document.frm_search.cart[i].checked==true)
slots = slots + document.frm_search.cart[i].value + ",";}
else
{ if(document.frm_search.cart.checked==true)
slots = slots + document.frm_search.cart.value + ",";}
if(slots == "")
{ var msg="<b>Please add a stone <br>first <input type='checkbox' checked='checked'/>and then press</b><br>"; msg+="<img src='_images/butsmall_add.gif'/>"; DrMsg.Show(msg,"add",250,96); return false;}
else{ xmlDoc.async="false"; xmlDoc.onreadystatechange=verify; xmlFile = site + "/AddToCart.asp?cart=" + slots ; xmlDoc.load(xmlFile); document.getElementById("frmWrap").innerHTML = "<iframe scrolling='no' frameborder='0'  id='main_ifrm' src='" + site + "blank.htm'></iframe>"
open_div(site + "/Messages.asp?MsgType=1&ToShop=1&Info=" + xmlDoc.text,300,200)
}
}
function add_to_wish(slot,nItemID) { nItemID = (nItemID==undefined)?'':nItemID; if(nItemID !='')
{ if(CheckSize()!=false)
document.location = site+"/AddToWishList.asp?ItemID="+nItemID+'&ringsize='+rsize;}
else
document.location = site+"/AddToWishList.asp?DiamondID="+slot;}
function add_to_wish_jewelry(sitem) { xmlDoc.async="false"; xmlDoc.onreadystatechange=verify; xmlFile = site + "/AddToWishList.asp?ItemID="+sitem; xmlDoc.load(xmlFile); document.getElementById("frmWrap").innerHTML = "<iframe scrolling='no' frameborder='0'  id='main_ifrm' src='" + site + "blank.htm'></iframe>"; open_div(site + "/Messages.asp?MsgType=2&Info=" + xmlDoc.text,300,200);}
function ClickBox(obj,ItemID,Shape,from){ if( ((from==0)||(moz)) || (from == undefined) )
if(!((moz) && from==1)) obj.checked = (obj.checked == true) ? false:true;}
var shape_br = 0; function CheckShape(obj){ document.getElementById("HaTD").style.display = ((obj.value!='BR')) ? 'none':'block'; if ((obj.value!='BR')&&(shape_br==0))
document.getElementById('shape_Round').checked=false; shape_br++;}
var num_clicks_color = 0; var num_clicks_clarity = 0; function CheckRange(obj,sname){ var sflag = false; var sstart = -1; var send = -1; if(sname=='clarity')
{ var objlist = document.all["clarity"]; num_clicks_clarity = num_clicks_clarity + 1;}
else
{ var objlist = document.all["color"]; num_clicks_color = num_clicks_color + 1;}
if(obj.checked == false) return; for(i=0;i<objlist.length;i++){ if (sflag == true)
objlist[i].checked=false; if(objlist[i].id == obj.id) sflag = true;}
for(i=0;i<objlist.length;i++){ if (objlist[i].checked == true && sstart == -1 ) sstart = i; if (objlist[i].checked == true && sstart != -1) send = i;}
if(sstart!=-1 && send != -1)
for(i=0;i<objlist.length;i++){ if (i>=sstart && i<= send)
objlist[i].checked=true; else
objlist.checked=false;}
}
var dv; function openNewWin(num){ document.all("frmWrap").innerHTML = "<iframe scrolling='Auto' frameborder='0'  id='main_ifrm' src='" + site + "blank.htm'></iframe>"; open_div(site + "/diamond_info.asp?id="+num,580,450);}
function openNewWindow(num,tp,crt,supp){ var oDetails = new Object(); oDetails.SessionEnd = ""; if(crt<=0.69){ var swidth = 700; var sheight = 500;}
else
{ var swidth = 700; var sheight = 600;}
if(crt>=0.7){ if(tp == 'GIA'){ swidth = 614
sheight = 550;}
else{ swidth = 973
sheight = 600;}
}
document.all("frmWrap").innerHTML = "<iframe scrolling='Auto' frameborder='0'  id='main_ifrm' src='" + site + "blank.htm'></iframe>"; open_div(site + "/show_pics.asp?supp="+ supp +"&crt="+ crt +"&type="+tp+"&pic=" + num,swidth,sheight);}
function search_finder(ind){ if(ind==0)
{ document.quick.price.value = ""; document.quick.submit();}
else
{ document.quick.carat_from.value = ""; document.quick.carat_to.value = ""; document.quick.color_from.selectedIndex = 0; document.quick.color_to.selectedIndex = 0; document.quick.clarity_from.selectedIndex = 0; document.quick.clarity_to.selectedIndex = 0; document.quick.submit();}
}
function replace_shape(item_id,obj,sFile){ obj.src = "_images/"+item_id+"/"+sFile;}
function open_float(str,n_width,n_height,ypos,xpos){ top.document.all("frmWrap").innerHTML = "<iframe scrolling='Auto' frameborder='0'  id='main_ifrm' src='" + site + "blank.htm'></iframe>"; open_div(str,n_width,n_height,ypos,xpos); return;}
function check_search(){ document.form1.submit();}
var xmlhttp; var bflag = 0; var end_page; var curr_page; var nVal = 0; function PinPage(current_page)
{ var i = 0; var j = 0; if(isNaN(current_page)) current_page = 1; curr_page = current_page; bflag = 2; nVal = 1; if(current_page<15){ p_start = 1;nVal = 0;}
else
p_start = parseInt((current_page)/15) * 15; end_page=15; if(p_start==1) end_page = 14; for(i=p_start ; i <= record_count && j<=(end_page) ; i++,j++)
{ if(eval("document.all['td" + j + "']"))
if(current_page == i) { eval("document.all['td" + j + "'].innerHTML = '<a class = avi href=javascript:Browsing("+i+",0)>"+i+"</a>'"); eval("document.all['td" + j + "'].className = 'PageNumberOn'");}
else{ eval("document.all['td" + j + "'].innerHTML = '<a href=javascript:Browsing("+i+",0)>"+i+"</a>'"); eval("document.all['td" + j + "'].className = 'PageNumberOff'");}
}
}
function changePageSize(page_size)
{ document.paging.pageSize.value=page_size; document.paging.submit();}
function jewel_sort(obj){ if((obj.name=='sortway')&&(obj.value!=''))
{ document.paging.sortway.value=obj.value; document.paging.submit(); return;}
else
{ document.paging.catfilter.value=obj.value; document.paging.submit(); return;}
}
function Browsing(currect_page,page,aPage){ document.paging.page_num.value=page; document.paging.currect_page.value=currect_page; document.paging.submit(); return;}
function xmlhttpChange()
{ if (xmlhttp.readyState==4)
{ document.getElementById('search_table').innerHTML = ""; document.getElementById('search_table').innerHTML = xmlhttp.responseText; if (xmlhttp.status==200)
{ }
else
{ alert("Problem retrieving XML data");}
}
}
function goToPrevPage(page,pageLength)
{ document.paging.currect_page.value=(1+page)*pageLength; document.paging.page_num.value=page; document.paging.submit();}
function goToNextPage(page,pageLength)
{ document.paging.currect_page.value=page*pageLength+1; document.paging.page_num.value=page; document.paging.submit();}
function goToPage(page,pageLength)
{ document.paging.currect_page.value=page*pageLength+1; document.paging.page_num.value=page; document.paging.submit();}
function go_search(q_id){ document.form1.query.value=q_id; document.form1.submit();}
function rem_compare(cid,rem_id){ ChangeDiamondTabData("dc",cid,'','rem='+rem_id);}
function compare_diamond(){ document.frm_search.submit();}
function rem_compare_diamond(slink,rem_id){ document.general_frm.action = "DiamondFrame.asp?action=dc&compare=1&rem="+ rem_id; document.general_frm.target = "frmData"; document.general_frm.rem.value = rem_id; document.general_frm.submit();}
function SetTab(sTab){ parent.document.getElementById("liPD").className = "off"; parent.document.getElementById("liSD").className = "off"; parent.document.getElementById("liDC").className = "off"; eval("parent.document.getElementById('"+ sTab +"').className = ''");}
var z_index = 100; var items_count = 0; function run1(shp,cat){ for (i=0;i<=items.length-1;i++){ if(items[i]){ str = items[i].src; str = str.replace(/small0/, ""); str = str.replace(/.gif/, "_s"+ shp +".jpg"); str = str.split('_s')[0] +"_s"+ shp +".jpg"; items[i].src = str;}
}
return;}
function show_div(cat_id,nIndex,ind,obj,set_shape,img_id,ImageURL)
{ if (ImageURL!=undefined){ obj.src = site + "/" + ImageURL; return;}
if ((cat_id == 295) || (cat_id == 294) || (cat_id == 301)|| (cat_id == 159)) return; document.general_frm.shape_selected.value = set_shape; if ((cat_id == 180)||(cat_id == 164))
{ obj.src = site+"/_images/"+img_id+"_"+set_shape+".gif"; return;}
if ((cat_id == 260)||(cat_id == 164)||(cat_id == 159)||(cat_id == 181)||(cat_id == 165))
{ obj.src = site + "/" + ImageURL; return;}
var img = new Image(); img.src='set_image.asp?shape='+ set_shape; if(obj.src != site+"/image.asp?col=3&ItemId="+obj.name)
obj.src = site+"/image.asp?col=3&ItemId="+obj.name; items_count = ind; if(document.getElementById("div_-1_"+nIndex)){ var oldy = document.getElementById("div_-1_"+nIndex); document.body.removeChild(oldy);}
if(document.getElementById("div_" + nIndex + "_" + ind)){ var oldy = document.getElementById("div_" + nIndex + "_" + ind); document.body.removeChild(oldy);}
var top = 0 ; var left = 0 ; rootElement = obj; if (!rootElement) return; while(rootElement.tagName.toLowerCase() != 'body') { top += rootElement.offsetTop; left += rootElement.offsetLeft; rootElement = rootElement.offsetParent;}
var slink = (moz==true)?obj.parentNode.href:obj.parentElement.href; if(slink.indexOf("java") == -1) slink = slink + '&shape='+document.general_frm.shape_selected.value; newNote = document.createElement("div"); newNote.id = "div_" + nIndex + "_" + ind; newNote.style.cursor='hand'; if(slink.indexOf("java") == -1)
newNote.onclick=function goto_location(){document.location=slink;}; else
newNote.onclick=function goto_location(){eval(slink);}; newNote.innerHTML = "<img border=0 src='_images/"+set_shape+"_D.gif'>"; newNote.style.position = 'absolute'; newNote.style.zindex = z_index; if(cat_id==164)
{ newNote.style.top = top+76; newNote.style.left = left+52;}
else
{ newNote.style.top = top-2; newNote.style.left = left+28;}
newNote.style.visibility = 'visible'; document.body.appendChild(newNote);}
function show_div_shop_bag(cat_id,nIndex,ind,obj,set_shape,img_id)
{ if ((cat_id == 295) || (cat_id == 294) || (cat_id == 301)|| (cat_id == 159)) return; document.general_frm.shape_selected.value = set_shape; if ((cat_id == 180))
{ obj.src = "_images/"+img_id+"_"+set_shape+".gif"; return;}
if ((cat_id == 260)||(cat_id == 164)||(cat_id == 159)||(cat_id == 181)||(cat_id == 165))
{ obj.src = "image.asp?col=3&itemid=" + img_id; return;}
if(obj.src != "image.asp?col=3&ItemId="+obj.name)
obj.src = "image.asp?col=3&ItemId="+obj.name; items_count = ind; var top = 0 ; var left = 0 ; rootElement = obj; if (!rootElement) return; while(rootElement.tagName.toLowerCase() != 'body') { top += rootElement.offsetTop; left += rootElement.offsetLeft; rootElement = rootElement.offsetParent;}
var slink = (moz==true)?obj.parentNode.href:obj.parentElement.href; if(slink.indexOf("java") == -1) slink = slink + '&shape='+document.general_frm.shape_selected.value; newNote = document.createElement("div"); newNote.id = "div_" + nIndex + "_" + ind; newNote.style.cursor='hand'; if(slink.indexOf("java") == -1)
newNote.onclick=function goto_location(){document.location=slink;}; else
newNote.onclick=function goto_location(){eval(slink);}; newNote.innerHTML = "<img border=0 src='_images/"+set_shape+"_D.gif'>"; newNote.style.position = 'absolute'; newNote.style.zindex = z_index; if(cat_id==164)
{ newNote.style.top = top+76; newNote.style.left = left+52;}
else
{ newNote.style.top = top+2; newNote.style.left = left+30;}
newNote.style.visibility = 'visible'; document.body.appendChild(newNote);}
var rootElement; var isFirst = true; function show_div1(obj){ var top = 0 ; var left = 0 ; rootElement = obj; while(rootElement.tagName.toLowerCase() != 'body') { top += rootElement.offsetTop; left += rootElement.offsetLeft; rootElement = rootElement.offsetParent;}
document.all['itemmenu'].style.visibility='visible'; document.all['itemmenu'].style.top = top + 20 ; document.all['itemmenu'].style.left = left; isFirst = true;}
function clear_shapes_big(){ for(i=0;i<10;i++)
if(document.all['div'+i]){ var oldy = document.getElementById("div"+i); document.body.removeChild(oldy);}
}
var last_div_id; last_div_id = 0; function show_div_big(cat_id,ind,obj,set_shape,img_id,srcURL)
{ if (srcURL!=undefined)
{ obj.src = site + "/" + srcURL; return;}
if ((cat_id == 180)||(cat_id == 164))
{ obj.src = site+"/_images/jewelry/"+img_id+"_"+set_shape+"_b.gif"; return;}
if ((cat_id == 260)||(cat_id == 164)||(cat_id == 159)||(cat_id == 181)||(cat_id == 165))
{ obj.src = "_images/jewelry/" + srcURL; return;}
var str = srcURL; str = str.replace(/small0/, ""); str = str.replace(/.gif/, "_bbr.jpg"); obj.src = "_images/jewelry/shapes/" + str;}
var rootElement; var isFirst = true; function show_div1(obj){ var top = 0 ; var left = 0 ; rootElement = obj; while(rootElement.tagName.toLowerCase() != 'body') { top += rootElement.offsetTop; left += rootElement.offsetLeft; rootElement = rootElement.offsetParent;}
document.all['itemmenu'].style.visibility='visible'; document.all['itemmenu'].style.top = top + 20 ; document.all['itemmenu'].style.left = left; isFirst = true;}
var isShow = false; function hide_menu(obj){ if(event.srcElement.id == 'itemmenu')
{ if (!isFirst) document.all['avi'].value = event.srcElement.id; isFirst = false;}
}
function MouseOver(obj)
{ oldbgcolor = obj.bgColor; obj.style.color='#000000'; obj.bgColor='#FFF1D7';}
function MouseOut(obj)
{ obj.style.color='#000000'; obj.bgColor= oldbgcolor;}
function help_popup(stext){window.open("help_page.asp?help="+stext,"openNew","scrollbars=yes,left=0,top=0,resizable=yes,toolbar=no,height=500,width=350");}
function show_cert(name){window.open("show_cert.asp?file="+name,"openNew","scrollbars=yes,left=0,top=0,resizable=yes,toolbar=no,height=600,width=750");}
function show_pic(name){window.open("show_pic.asp?file="+name,"openNew","scrollbars=yes,left=0,top=0,resizable=yes,toolbar=no,height=650,width=750");}
function diamond_to_compare(cat_id,ItemID){ ReffererCategoryID = ""; ReffererItemID = ""; FramedWindow = ""; ShowCloseWindowTitle = "1"; ChangeDiamondTabData("dc",cat_id,"-1","ShowCloseWindowTitle=1&compare="+ItemID);}
function view_compare(cat_id,order_field,sort_way,framed){ var order_by = ""; var sortway = ""; if (order_field != undefined) order_by = "sortfield="+order_field; if (sort_way != undefined) sortway = "&sortway="+sort_way; if(cat_id == undefined) cat_id = "130"; compareView = 0; ShowCloseWindowTitle = 1
if(framed!=undefined) ShowCloseWindowTitle = 0; ChangeDiamondTabData("dc",cat_id,'',order_by+sortway);}
function compare_win(cat_id,item_id,useDynamic){ document.frm_search.target = "_parent"; var slots = ""; for(i=0;i<document.frm_search.compare.length;i++)
{ if(document.frm_search.compare[i].checked==true)
slots = slots + document.frm_search.compare[i].value + ",";}
if(slots == "")
{ alert("Please check diamond to compare.")
return false;}
else
slots = slots + '-1'
compareView = 1; ShowCloseWindowTitle = 0; document.getElementById("frmWrap").innerHTML = "<iframe scrolling='no' frameborder='0'  id='main_ifrm' src='" + site + "blank.htm'></iframe>"; ChangeDiamondTabData("dc",cat_id,''+slots+'',''); return;}
function compare(cat_id,useDynamic)
{ document.frm_search.target = "_parent"; var slots = ""; for(i=0;i<document.frm_search.compare.length;i++)
{ if(document.frm_search.compare[i].checked==true)
slots = slots + document.frm_search.compare[i].value + ",";}
if(slots == "")
{ var msg="<b>Please add a stone <br>first <input type='checkbox' checked='checked'/>and then press</b><br>"; msg+="<img src='_images/but_compare.gif'/>"; DrMsg.Show(msg,"comp",275,83); return false;}
else
slots = slots + '-1'; ChangeDiamondTabData("dc",cat_id,''+slots+'','');}
function compare_diamonds(cat_id,sfrom,sitem){ if((cat_id == "130") || (cat_id == "131") || (cat_id == "53"))
document.frm_search.action = "compare.asp"; else
document.frm_search.action = "compare.asp?cid=" + cat_id + "&compare_diamonds=1"; if (sfrom!= "frame")
document.frm_search.target = "_parent"; else
{ document.frm_search.target = "_self"; document.frm_search.action = "DiamondFrame.asp?itemid="+ sitem +"&cid="+ cat_id +"&action=dc";}
document.frm_search.submit();}
function get_image(obj){ for(j=0;j<=obj.childNodes.length-1;j++){ if(obj.childNodes[j].tagName == "IMG"){ return obj.childNodes[j];}
else{ return get_image(obj.childNodes[0]);}
}
}
function ReplaceItemImage(target_obj,src_pic){ target_obj.src = site+"/" + src_pic;}
function replace_pic(src_pic,target_obj){ image_obj = eval("document.getElementById('"+target_obj+"')"); image_obj.src = site+"/_uploads/" + src_pic
}
function replace_image(obj_name,pic_src){ eval("document.getElementById('"+obj_name+"').src = pic_src");}
function doTab(tab_id){ document.paging.page_num.value= ""; document.paging.currect_page.value=""; document.paging.tab.value = tab_id; document.paging.submit();}
function add_earring(){ var bool_checked = false; for(i=0;i<=document.all['ItemID'].length-1;i++)
if(document.all['ItemID'][i].checked==true)
bool_checked = true; if(bool_checked == false){ alert("Please select your style."); return false;}
else
return true;}
function zoom_in_item(cid,item,col){ var width = 610; var height = 550; var s_shape ; s_shape = document.general_frm.shape_selected.value; if((cid==59))
{ width = 630; height = 550;}
document.getElementById("frmWrap").innerHTML = "<iframe scrolling='No' frameborder='0'  id='main_ifrm' src='" + site + "blank.htm'></iframe>"; open_div("zoom_item.asp?col="+ col +"&cid=" + cid + "&shape="+ s_shape +"&itemid="+item,width,height);}
function zoom_in(cid,item,enableSelect){ var width = 610; var height = 530; var s_shape ; s_shape = document.general_frm.shape_selected.value; if((cid==59))
{ width = 630; height = 530;}
document.getElementById("frmWrap").innerHTML = "<iframe scrolling='No' frameborder='0'  id='main_ifrm' src='blank.htm'></iframe>"; open_div("zoom_item.asp?cid=" + cid + "&shape="+ s_shape +"&itemid="+item+"&ens="+enableSelect,width,height);}
function view_item(slink){ top.document.location = site + "/" + slink;}
function sorttable(field,sort,page){ document.paging.sortfield.value=field; document.paging.sortway.value=sort; document.paging.submit();}
function set_style(val){ document.paging.cid.value = val ; document.paging.currect_page.value = "1" ; document.paging.action = "build_your_ring.asp?cid=" + val + "&cmb=1"; document.paging.submit();}
function set_style_3d(val){ document.paging.cid.value = val ; document.paging.currect_page.value = "1" ; document.paging.submit();}
function view_compare_diamonds(stype){ var DiamStr = new Array(2); DiamStr[0] = new String(""); DiamStr[1] = new String(""); var counter = 0; for(i=0;i<document.frm_search.compare.length;i++)
{ if(document.frm_search.compare[i].checked==true)
{ counter ++; DiamStr[counter-1] = document.frm_search.compare[i].value; if(counter == 3)
{ dv = document.getElementById("lyr5"); Ypos = getY(document.getElementById("comp")); Xpos = getX(document.getElementById("comp")) - 250; ElementTop = Ypos; ElementLeft = Xpos; StartTop = Ypos; StartLeft = 0 ; dv.style.top = ElementTop; dv.style.visibility = 'visible'; idII = window.setInterval("runElement(1)", 1); return false;}
}
}
if(counter != 2) { dv = document.getElementById("lyr5"); Ypos = getY(document.getElementById("comp")) ; Xpos = getX(document.getElementById("comp")) - 250; ElementTop = Ypos; ElementLeft = Xpos; StartTop = Ypos; StartLeft = 0; dv.style.top = ElementTop; dv.style.visibility = 'visible'; idII = window.setInterval("runElement(1)", 1); return false;}
var sDiam1 = DiamStr[0].split("-"); var sDiam2 = DiamStr[1].split("-"); if(stype == 'certificates') view_certificates(sDiam1[0],sDiam2[0]); if(stype == 'pictures') view_pictures(sDiam1[0],sDiam2[0]); return;}
function view_pictures(id1,id2){ var s1 = screen.width/2 - 10; var s2 = screen.width/2 - 10; document.all("frmWrap").innerHTML = "<iframe scrolling='Auto' frameborder='0'  id='main_ifrm' src='" + site + "blank.htm'></iframe>"; open_div("diamonds_view.asp?item1="+ id1 +"&item2=" + id2 ,1000,480);}
function view_certificates(id1,id2){ var s1 = screen.width/2 - 10; var s2 = screen.width/2 - 10; document.all("frmWrap").innerHTML = "<iframe scrolling='Auto' frameborder='0'  id='main_ifrm' src='" + site + "blank.htm'></iframe>"; open_div("gradings_view.asp?item1="+ id1 +"&item2=" + id2 ,1000,500);}
function open_grading(num,stype,frame,url)
{ var site_url = site; if(url!=undefined) site_url = url; if(stype == '2')
{ top.document.getElementById("frmWrap").innerHTML = "<iframe scrolling='no' frameborder='0'  id='main_ifrm' src='blank.htm'></iframe>"; open_div("grading_report.asp?pic=" + num + "&type="+stype ,600,380);}
else{ if(frame=='1')
open_win(site_url+"/grading_report.asp?pic=" + num + "&type="+stype,750,500); else
{ top.document.getElementById("frmWrap").innerHTML = "<iframe scrolling='Auto' frameborder='0'  id='main_ifrm' src='blank.htm'></iframe>"; open_div("grading_report.asp?pic=" + num + "&type="+stype ,750,500);}
}
}
function print_item(ntype,item_id,cat_id)
{ str = site + "/PrintItem.asp?cid="+cat_id+"&item=" + item_id + "&type="+ ntype + "&print=1"; open_win_1(str,900,7000);}
function item_print(){window.print();}
function open_help(str,nWidth,nHeight,cid){ if(isNaN(nWidth)) nWidth = 480; if(isNaN(nHeight)) nHeight = 400; document.getElementById("frmWrap").innerHTML = "<iframe scrolling='Auto' frameborder='0'  id='main_ifrm' src='blank.htm'></iframe>"; open_div("help.asp?cid="+ cid +"&help=" + str,nWidth,nHeight); return;}
function openlayer(str,n_width,n_height){ document.getElementById("frmWrap").innerHTML = "<iframe scrolling='no' frameborder='0'  id='main_ifrm'  src='blank.htm'></iframe>"; open_div(str,n_width,n_height);}
function open_win_1(str,n_width,n_height){window.open(str,"myWindow","scrollbars=yes,left=0,top=0,toolbar=yes,height="+n_height+",width="+n_width);}
function open_win(str,n_width,n_height){window.open(str,"myWindow","scrollbars=1,left=0,top=0,toolbar=no,resizable=yes,height="+n_height+",width="+n_width);}
function open_modal(str,Args){window.showModalDialog(str,"myWindow",Args);}
function open_print(){window.open("PrintOrder.asp","displayWindow","scrollbars=1,toolbar=no,width=800,height=500,top=0,left=0'");}
function open_help_self(str){ var sArgs = "help: No;scroll:yes;status:yes;center:yes;resizable:yes;dialogWidth:500px;dialogLeft:0;dialogTop:0;dialogHeight:400px"; window.showModalDialog("help.asp?help="+str,"displayWindow",sArgs); return;}
function open3D(osrc,owidth,oheight,nitem){ if(IE7andMOZ){DWidth = 575;DHeight=520}
else{DWidth = 595;DHeight=520}
document.getElementById("frmWrap").innerHTML = "<iframe scrolling='no' frameborder='0'  id='main_ifrm' src='" + site + "blank.htm'></iframe>"; open_div(site + "/" + osrc,DWidth,DHeight);}
function open_div(osrc,owidth,oheight,nTop,nLeft){ top.document.getElementById('main_div').style.display='block'; top.document.getElementById('main_div').style.width = owidth; top.document.getElementById('main_div').style.height = oheight; top.document.getElementById('main_ifrm').src = osrc; top.document.getElementById('main_ifrm').width= owidth; top.document.getElementById('main_ifrm').height = oheight; top.document.getElementById('main_div').style.visibility = 'visible'; top.document.getElementById('main_div').style.top = (nTop!=undefined)?nTop:top.document.body.scrollTop; var TbLeft = getX(top.document.getElementById("MainTBL"))+top.document.getElementById('main_div').offsetWidth; top.document.getElementById('main_div').style.left = (nLeft!=undefined)?nLeft:(TbLeft - top.document.getElementById('main_div').offsetWidth);}
function video_clip(item){ var sArgs = "help: No;scroll:no;edge:raised;unadorned:on;status:yes;center:yes;resizable:no;dialogWidth:576px;dialogLeft:0;dialogTop:0;dialogHeight:513px"; window.showModalDialog("video_item.asp?itemid="+item,"displayWindow",sArgs);}
function cleanString(str) { for (; str.charAt(str.length-1) == " ";) { str = str.slice(0,(str.length-2));}
for (; str.charAt(0) == " ";) { str = str.slice(1,(str.length-1));}
return str;}
function checkEmail(strCheck) { var isValidField = true; if (strCheck != "" && (((strCheck.lastIndexOf('@')<1)||(strCheck.lastIndexOf('.')<1)||(strCheck.lastIndexOf('.')<2+strCheck.lastIndexOf('@'))||(strCheck.lastIndexOf('.')>strCheck.length-3)||(strCheck.lastIndexOf('.')<strCheck.length-5)||(strCheck.lastIndexOf(' ')!=-1)||(strCheck.lastIndexOf('.@')!=-1)||(strCheck.lastIndexOf('@.')!=-1)))) { alert("The eMail inserted in is not valid"); isValidField = false; return isValidField;}
else
return true;}
function check_fields(){ var isValid = true; var email1 = cleanString(document.frm1.FreindEmail1.value); var email2 = cleanString(document.frm1.FreindEmail2.value); var yname = cleanString(document.frm1.YourName.value); var yEmail = cleanString(document.frm1.YourEmail.value); if (email1 != "")
if(checkEmail(document.frm1.FreindEmail1.value) == false)
{ alert("Please insert correct email address."); document.frm1.FreindEmail1.focus(); return false;}
if (email2 != "")
if(checkEmail(document.frm1.FreindEmail2.value) == false)
{ alert("Please insert correct email address."); document.frm1.FreindEmail2.focus(); return false;}
if ((email1 == "")&&(email2 == ""))
{ alert("Please insert email address."); return false;}
if (yname=="")
{ alert("Please insert your name."); document.frm1.YourName.focus(); return false;}
if (yEmail=="")
{ alert("Please insert your email."); document.frm1.YourEmail.focus(); return false;}
if (yEmail != "")
if(checkEmail(document.frm1.YourEmail.value) == false)
{ alert("Please insert correct email address.")
document.frm1.YourEmail.focus()
return false;}
return true;}
function open_new() { document.getElementById("frmWrap").innerHTML = "<iframe scrolling='no' frameborder='0'  id='main_ifrm' src='" + site + "blank.htm'></iframe>"; open_div("feedback-item.asp",500,500); return; var is_one_checked = false; for(i=0;i<document.frmFeedBack.length;i++)
{ if(document.frmFeedBack[i].checked==true)
is_one_checked = true;}
if(is_one_checked == false){ alert("Please rate this item before clicking 'Send'."); return false;}
var myWindow = window.open ('', 'myWindow', 'scrollbars=1,toolbar=no,width=300,height=200,top=100,left=100'); document.frmFeedBack.submit();}
function AddShopping()
{ if(document.all['ringsize'])
if(document.frm1.ringsize.value==''){ alert("Please select Ring Size"); return;}
document.frm1.submit();}
function select_ring(slink){ if(document.all['ringsize'])
if(document.all['ringsize'].value==''){ alert("Please select Ring Size"); document.all['ringsize'].focus(); return;}
if(document.all['ringsize'])
document.location= slink + "&ringsize=" + document.all['ringsize'].value; else
document.location= slink;}
function openNewWin3d(){window.open(site+"/show3d.asp","displayWindow","left=100,top=50,resizable=yes,scrollbars=no,toolbar=no,height=460,width=950");}
function fieldValidate(strInputName, intType, strUserName, bolIsMust) { this.inputName = strInputName; this.type = intType; this.userName = strUserName; this.isMust = bolIsMust;}
function cleanString(str) { for (; str.charAt(str.length-1) == " ";) { str = str.slice(0,(str.length-2));}
for (; str.charAt(0) == " ";) { str = str.slice(1,(str.length-1));}
return str;}
function cleanSpace(str) { var arrTemp = str.split(" "); str = arrTemp.join(""); arrTemp = str.split("-"); str = arrTemp.join(""); return str;}
function isValidCharacter(str, strType) { var isMail = false; var isURL = false; var isFile = false; if (strType == "eMail")
isMail = true; else if (strType == "URL")
isURL = true; else if (strType == "file")
isFile = true; for (i=0; i<str.length; i++) { if (!isMail && str.charCodeAt(i) == 64)
return false; if (!isURL && !isFile && (str.charCodeAt(i) == 58 || str.charCodeAt(i) == 41 || str.charCodeAt(i) == 40))
return false; if (!isURL && str.charCodeAt(i) == 47)
return false; if (!isFile && str.charCodeAt(i) == 92)
return false; if (str.charCodeAt(i)<45 || str.charCodeAt(i)>122 || str.charCodeAt(i)==96 || (str.charCodeAt(i)>58 && str.charCodeAt(i)<63) || (str.charCodeAt(i)>90 && str.charCodeAt(i)<92) || (str.charCodeAt(i)>92 && str.charCodeAt(i)<95)) { return false;}
}
return true;}
function IsValidData(objForm,oArrInputs) { var strCheck = ""; var isValid = true; if(oArrInputs){ var arrInputs = new Array(); for (count=0; count<oArrInputs.length; count++)
arrInputs[count] = oArrInputs[count];}
for (count=0; count<arrInputs.length; count++) { if (objForm[arrInputs[count].inputName]) { strCheck = cleanString(""+objForm[arrInputs[count].inputName].value).toLowerCase(); switch (arrInputs[count].type) { case 0: { if (arrInputs[count].isMust && strCheck == "") { alert("Please enter " + arrInputs[count].userName + ""); objForm[arrInputs[count].inputName].focus(); objForm[arrInputs[count].inputName].select(); isValid = false; return isValid;}
break;}
case 17: { if (arrInputs[count].isMust && Mod10(strCheck) == false) { alert("The card number you have entered is invalid."); objForm[arrInputs[count].inputName].focus(); objForm[arrInputs[count].inputName].select(); isValid = false; return isValid;}
break;}
case 1: { var arrTempValue = strCheck.split("."); if (arrInputs[count].isMust && strCheck == "") { alert("Please enter a valid " + arrInputs[count].userName + ""); objForm[arrInputs[count].inputName].focus(); objForm[arrInputs[count].inputName].select(); isValid = false; return isValid;}
if (arrTempValue.length > 2) { alert("Please enter a valid " + arrInputs[count].userName + ""); objForm[arrInputs[count].inputName].focus(); objForm[arrInputs[count].inputName].select(); isValid = false; return isValid;}
else { for (iCounter=0; iCounter < arrTempValue.length; iCounter++) { if (isNaN(arrTempValue[iCounter])) { alert("Please enter a valid " + arrInputs[count].userName + " is not valid !"); objForm[arrInputs[count].inputName].focus(); objForm[arrInputs[count].inputName].select(); isValid = false; return isValid;}
}
}
break;}
case 2: { if (arrInputs[count].isMust && strCheck == "") { alert("Please enter " + arrInputs[count].userName); objForm[arrInputs[count].inputName].focus(); objForm[arrInputs[count].inputName].select(); isValid = false; return isValid;}
break;}
case 3: { if (arrInputs[count].isMust) { var bSelected = false; var oControl = objForm[arrInputs[count].inputName]; if (oControl.length) { for (nIndex = 0; nIndex < oControl.length; nIndex++) { if (oControl[nIndex].checked) { bSelected = true; break;}
}
}
else { bSelected = oControl.checked;}
if (!bSelected) { alert("" + arrInputs[count].userName + "."); return bSelected;}
}
break;}
case 4: { if (arrInputs[count].isMust) { var bSelected = false; var oControl = objForm[arrInputs[count].inputName]; if (oControl.length) { for (nIndex = 0; nIndex < oControl.length; nIndex++) { if (oControl[nIndex].checked) { bSelected = true; break;}
}
}
else { bSelected = oControl.checked;}
if (!bSelected) { alert("Please select a " + arrInputs[count].userName + "."); return bSelected;}
}
break;}
case 5: { if (arrInputs[count].isMust && (objForm[arrInputs[count].inputName].selectedIndex == -1 || objForm[arrInputs[count].inputName].value == "")) { alert("No " + arrInputs[count].userName + " was selected !"); objForm[arrInputs[count].inputName].focus(); isValid = false; return isValid;}
break;}
case 6: { if (arrInputs[count].isMust && strCheck == "") { alert("Please enter " + arrInputs[count].userName + " !"); isValid = false; return isValid;}
break;}
case 7: { if (arrInputs[count].isMust && (strCheck == "" && !(objForm["Exist_"+arrInputs[count].inputName]))){ alert("No " + arrInputs[count].userName + " was selected !"); objForm[arrInputs[count].inputName].focus(); objForm[arrInputs[count].inputName].select(); isValid = false; return isValid;}
var arrFilePath = strCheck.split("\\"); var strFileName = arrFilePath[arrFilePath.length-1]; if (!isValidCharacter(strFileName, "file")) { alert("File name is not valid !"); objForm[arrInputs[count].inputName].focus(); objForm[arrInputs[count].inputName].select(); isValid = false; return isValid;}
break;}
case 8: { if (arrInputs[count].isMust && strCheck == "") { alert("Please enter " + arrInputs[count].userName + " !"); objForm[arrInputs[count].inputName].focus(); objForm[arrInputs[count].inputName].select(); isValid = false; return isValid;}
if (!isValidDate(strCheck) && strCheck != "") { alert("The date inserted in " + arrInputs[count].userName + " is not valid"); objForm[arrInputs[count].inputName].focus(); objForm[arrInputs[count].inputName].select(); isValid = false; return isValid;}
break;}
case 9: { if (arrInputs[count].isMust && strCheck == "") { alert("Please enter " + arrInputs[count].userName + " !"); objForm[arrInputs[count].inputName].focus(); objForm[arrInputs[count].inputName].select(); isValid = false; return isValid;}
if (strCheck != "" && (((strCheck.lastIndexOf('@')<1)||(strCheck.lastIndexOf('.')<1)||(strCheck.lastIndexOf('.')<2+strCheck.lastIndexOf('@'))||(strCheck.lastIndexOf('.')>strCheck.length-3)||(strCheck.lastIndexOf('.')<strCheck.length-5)||(strCheck.lastIndexOf(' ')!=-1)||(strCheck.lastIndexOf('.@')!=-1)||(strCheck.lastIndexOf('@.')!=-1)))) { alert("Please enter a valid " + arrInputs[count].userName + ""); objForm[arrInputs[count].inputName].focus(); objForm[arrInputs[count].inputName].select(); isValid = false; return isValid;}
break;}
case 10: { var arrTempValue = strCheck.split("."); if (arrInputs[count].isMust && strCheck == "") { alert("Please enter a valid " + arrInputs[count].userName + ""); objForm[arrInputs[count].inputName].focus(); objForm[arrInputs[count].inputName].select(); isValid = false; return isValid;}
if (arrTempValue.length > 2) { alert("Please enter a valid " + arrInputs[count].userName + ""); objForm[arrInputs[count].inputName].focus(); objForm[arrInputs[count].inputName].select(); isValid = false; return isValid;}
else { if (arrTempValue.length > 1) { if (isNaN(arrTempValue[arrTempValue.length-1]) || arrTempValue[arrTempValue.length-1].length > 2) { alert("Please enter a valid " + arrInputs[count].userName + ""); objForm[arrInputs[count].inputName].focus(); objForm[arrInputs[count].inputName].select(); isValid = false; return isValid;}
}
var arrTempValue = arrTempValue[0].split(","); if (isNaN(arrTempValue[0])) { alert("Please enter a valid " + arrInputs[count].userName + " is not valid !"); objForm[arrInputs[count].inputName].focus(); objForm[arrInputs[count].inputName].select(); isValid = false; return isValid;}
for (iCounter=1; iCounter < arrTempValue.length; iCounter++) { if (isNaN(arrTempValue[iCounter]) || arrTempValue[iCounter].length != 3) { alert("Please enter a valid " + arrInputs[count].userName + ""); objForm[arrInputs[count].inputName].focus(); objForm[arrInputs[count].inputName].select(); isValid = false; return isValid;}
}
}
break;}
case 11: { if (arrInputs[count].isMust && strCheck == "") { alert("Please enter " + arrInputs[count].userName + " !"); objForm[arrInputs[count].inputName].focus(); objForm[arrInputs[count].inputName].select(); isValid = false; return isValid;}
if ((arrInputs[count].isMust || strCheck != "") && (strCheck.indexOf("http://") != 0 || !isValidCharacter(strCheck, "URL") || strCheck=="http://") || strCheck=="http://www.") { alert("The URL inserted in " + arrInputs[count].userName + " is not valid"); objForm[arrInputs[count].inputName].focus(); objForm[arrInputs[count].inputName].select(); isValid = false; return isValid;}
break;}
case 12: { if (arrInputs[count].isMust && strCheck == "") { alert("No " + arrInputs[count].userName + " was selected !"); isValid = false; return isValid;}
break;}
case 13: { break;}
case 14: { objForm[arrInputs[count].inputName].value = document.all[arrInputs[count].inputName+"Control"].Dom.body.innerHTML; strCheck = objForm[arrInputs[count].inputName].value
if (arrInputs[count].isMust && strCheck == "") { alert("No " + arrInputs[count].userName + " was selected !"); isValid = false; return isValid;}
break;}
case 15: { if (arrInputs[count].isMust && strCheck == "") { alert("Please enter " + arrInputs[count].userName + " !"); objForm[arrInputs[count].inputName].focus(); objForm[arrInputs[count].inputName].select(); isValid = false; return isValid;}
if (isNaN(cleanSpace(strCheck))) { alert("Please enter a valid " + arrInputs[count].userName + ""); objForm[arrInputs[count].inputName].focus(); objForm[arrInputs[count].inputName].select(); isValid = false; return isValid;}
if (strCheck.length <10) { alert("Phone number is a required field and must include the area code"); objForm[arrInputs[count].inputName].focus(); objForm[arrInputs[count].inputName].select(); isValid = false; return isValid;}
break;}
case 16: { if (strCheck == "") { alert("Please enter " + arrInputs[count].userName + " !"); objForm[arrInputs[count].inputName].focus(); objForm[arrInputs[count].inputName].select(); isValid = false; return isValid;}
if (strCheck.length < 2 || strCheck.length > 10 || strCheck.indexOf(" ") != -1) { alert("Please enter a valid " + arrInputs[count].userName + ""); objForm[arrInputs[count].inputName].focus(); objForm[arrInputs[count].inputName].select(); isValid = false; return isValid;}
break;}
default: { if (!customCheck(objForm, arrInputs[count], strCheck))
return false; else
continue;}
}
}
}
return isValid;}
function Mod10(ccNumb) { var valid = "0123456789"
var len = ccNumb.length; var iCCN = parseInt(ccNumb); var sCCN = ccNumb.toString(); sCCN = sCCN.replace (/^\s+|\s+$/g,''); var iTotal = 0; var bNum = true; var bResult = false; var temp; var calc; for (var j=0; j<len; j++) { temp = "" + sCCN.substring(j, j+1); if (valid.indexOf(temp) == "-1"){bNum = false;}
}
if(!bNum){ bResult = false;}
if((len == 0)&&(bResult)){ bResult = false;} else{ if(len >= 15){ for(var i=len;i>0;i--){ calc = parseInt(iCCN) % 10; calc = parseInt(calc); iTotal += calc; i--; iCCN = iCCN / 10; calc = parseInt(iCCN) % 10 ; calc = calc *2; switch(calc){ case 10: calc = 1; break; case 12: calc = 3; break; case 14: calc = 5; break; case 16: calc = 7; break; case 18: calc = 9; break; default: calc = calc;}
iCCN = iCCN / 10; iTotal += calc;}
if ((iTotal%10)==0){ bResult = true;} else { bResult = false;}
}
}
return bResult;}
function re_order(fld){ var last_sort_fld = document.paging.sortfield.value; var last_sort_way = document.paging.sortway.value; if (fld == last_sort_fld)
document.paging.sortway.value = (last_sort_way == "asc")?"desc":"asc"; else
document.paging.sortway.value = "asc"; if ((fld == 'carat') && (last_sort_fld == '')) document.paging.sortway.value = "desc"; document.paging.sortfield.value = fld; document.paging.submit();}
function re_order_compare(fld,ItemID){ var last_sort_fld = document.paging.sortfield.value; var last_sort_way = document.paging.sortway.value; if (fld == last_sort_fld)
document.paging.sortway.value = (last_sort_way == "asc")?"desc":"asc"; else
document.paging.sortway.value = "asc"; if ((fld == 'carat') && (last_sort_fld == '')) document.paging.sortway.value = "desc"; var sort_way = (last_sort_way == "asc")?"desc":"asc"; extraData = "sortway=" + sort_way; extraData = extraData + "&sortfield=" + fld; ChangeDiamondTabData("fsd","130",ItemID,extraData);}
function move_to(dest){ if(aff_id!="0")
top.location.href = dest+"&aff_id="+aff_id; else
top.location.href = dest;}
var startPos = 0; function check()
{ if (document.getElementById('main_div'))
document.getElementById('main_div').style.top = document.body.scrollTop + startPos ; if (document.getElementById('main_div')){ var TbLeft = getX(document.getElementById("MainTBL")) + document.getElementById("MainTBL").offsetWidth; top.document.getElementById('main_div').style.left = (TbLeft - top.document.getElementById('main_div').offsetWidth);}
}
function view_diamond(item_id){document.getElementById("DiamondPage").innerHTML=GetSourceHtml("diamond_clean.asp?item="+item_id);}
var idI; var LoadingMenu = false; function GetSourceHtml(url,sData)
{ if(sData==undefined) sData = "a"; var xmlhttpObj; if (window.XMLHttpRequest)
{ try { xmlhttpObj=new XMLHttpRequest(); xmlhttpObj.open("POST",url,false); xmlhttpObj.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xmlhttpObj.send(sData);}
catch (e)
{ alert("(Mozilla) - " + e); return null;}
}
else if (window.ActiveXObject)
{ xmlhttpObj=new ActiveXObject("Microsoft.XMLHTTP")
if (xmlhttpObj)
{ xmlhttpObj.open("POST",url,false); xmlhttpObj.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
xmlhttpObj.send(sData);}
}
return xmlhttpObj.responseText;}
var cursor; function getPosition(e) { e = e || window.event; cursor = {x:0, y:0}; if (e.pageX || e.pageY) { cursor.x = e.pageX; cursor.y = e.pageY;}
else { var de = document.documentElement; var b = document.body; cursor.x = e.clientX + (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0); cursor.y = e.clientY + (de.scrollTop || b.scrollTop) - (de.clientTop || 0);}
return cursor;}
function ChangeDiamondTabData(action,categoryID,itemID,extraData)
{ if (document.getElementById("dividerin"))
var tabDiv = top.document.getElementById("dividerin"); else
var tabDiv = top.document.getElementById("dividerin_out"); if (document.getElementById("pdLi")){ document.getElementById("pdLi").className= 'folder_off'; document.getElementById("fsdLi").className= 'folder_off'; document.getElementById("dcLi").className='folder_off'; document.getElementById(action+"Li").className='folder_on';}
urlReferer = ""; if (isNaN(itemID))
tabDiv.innerHTML=GetSourceHtml(site+"/diamond_Tab.asp?src_url="+urlReferer+"&compare="+itemID+"&cid="+categoryID+"&act="+action+"&cview="+ compareView +"&"+extraData); else
tabDiv.innerHTML=GetSourceHtml(site+"/diamond_Tab.asp?frame="+ FramedWindow +"&ItemID="+ReffererItemID+"&ccid="+ReffererCategoryID+"&item="+itemID+"&cid="+categoryID+"&act="+action+"&cview="+ compareView +"&"+extraData); return;}
function ChangeDiamondTabSwitchCompare(action,categoryID,itemID,t,click)
{ if(click==undefined) click = "0"; if (document.getElementById("dividerin"))
var tabDiv=document.getElementById("dividerin"); else
var tabDiv=document.getElementById("dividerin_out"); compareView++; compareView%=2; tabDiv.innerHTML=GetSourceHtml(site+"/diamond_Tab.asp?click="+ click +"&ShowCloseWindowTitle="+ShowCloseWindowTitle+"&frame="+ FramedWindow +"&ItemID="+ReffererItemID+"&ccid="+ReffererCategoryID+"&item="+itemID+"&cid="+categoryID+"&act=dc&cview="+compareView);}
function BrowserObj(){ var name = navigator.appName.toLowerCase(); var info = navigator.appVersion.toLowerCase(); var ver = parseInt(info); this.ns = (name.indexOf('netscape')!=-1) ? true : false; this.ie = (name.indexOf('microsoft internet explorer')!=-1) ? true : false; this.ns4 = (this.ns && parseInt(ver)==4) ? true : false; this.ns5 = (this.ns && parseInt(ver)==5) ? true : false; this.ie4 = (this.ie && info.indexOf('msie 4')!=-1) ? true : false; this.ie5 = (this.ie && info.indexOf('msie 5')!=-1) ? true : false; this.ie6 = (this.ie && info.indexOf('msie 6')!=-1) ? true : false; this.min = (ver>=4) ? true : false;}
var browser = new BrowserObj(); function PlatformObj() { var info = navigator.appVersion.toLowerCase(); this.win = (info.indexOf('windows')!=-1) ? true : false; this.mac = (info.indexOf('macintosh')!=-1) ? true : false;}
var platform = new PlatformObj(); function getElmtRef(strID) { if (document.getElementById) { return document.getElementById(strID);} else if (document.all) { return document.all[strID];}
}
function cacheImages(strDir, strExt) { if (arguments.length < 3) return; for (var i=2; i<arguments.length; i++) { var n = arguments[i]; if (n == undefined) { break;}
if (n != undefined && n.charAt(n.length-1)=='B') { eval(n + "_off =  new Image"); eval(n + "_off.src = \'" + strDir + n + "_off." + strExt + "\'"); eval(n + "_on =  new Image"); eval(n + "_on.src = \'" + strDir + n + "_on." + strExt + "\'");} else { eval(n + " = new Image"); var imgName = n.toString(); if (imgName.substring(0,4) == 'img_') { imgName = imgName.substring(4);}
eval(n + ".src = \'"+ strDir + imgName + "." + strExt + "\'");}
}
}
function openWindow(url, name, width, height, options) { if (!name) name = "_default"; if (!width) width = 640; if (!height) height = 420; if (!options) options = "scrollbars=yes,menubar=yes,toolbar=yes,location=yes,status=yes,resizable=yes"; var newWin = window.open( url, name, "width=" + width + ",height=" + height + "," + options ); newWin.focus();}
function openWindowCentered(url, name, width, height, options) { var screenWidth = screen.availWidth; var screenHeight = screen.availHeight; if (!name) name = "_default"; if (!width) width = 640; if (!height) height = 420; var popW = width; var popH = height; var leftPos = (screenWidth-popW)/2; var topPos = (screenHeight-popH)/2; if (!options) options = "scrollbars=yes,menubar=yes,toolbar=yes,location=yes,status=yes,resizable=yes"; var newWin = window.open( url, name, "width=" + width + ",height=" + height + "," + ",top=" + topPos + ",left=" + leftPos + options ); newWin.focus();}
var priNavDefault = 'priJewelry'; var priNavActive = ''; var priNavIDs = new Array('priRings','priLeo','priDiamond','priGold','priJewelry','priWatches'); function onPrimaryNavBtn(strID) { if (priNavActive != '') { setPrimaryNavBtnOff(priNavActive); setPrimarySubNavBtnOff(priNavActive);}
if ((strID == priNavIDs[priNavIDs.length-1]) || (strID == priNavIDs[priNavIDs.length-2])) { getElmtRef('priDivider').style.backgroundColor = "transparent";} else { getElmtRef('priDivider').style.backgroundColor = "#FFFFFF";}
priNavActive = strID; setPrimaryNavBtnOn(priNavActive); setPrimarySubNavBtnOn(priNavActive);}
function setPrimaryNavBtnOn(strID) { getElmtRef(strID + 'Link').style.color = "#666666"; getElmtRef(strID).style.backgroundColor = "#FFFFFF";}
function setPrimaryNavBtnOff(strID) { getElmtRef(strID + 'Link').style.color = "#FFFFFF"; getElmtRef(strID).style.backgroundColor = "transparent";}
function setPrimarySubNavBtnOn(strID) { getElmtRef(strID + 'Sub').style.display = "inline";}
function setPrimarySubNavBtnOff(strID) { getElmtRef(strID + 'Sub').style.display = "none";}
window.onload = function() { if (getElmtRef("globalSearchText") != null) { getElmtRef("globalSearchText").onfocus = function() { if (getElmtRef("globalSearchText").value == 'Search'){ getElmtRef("globalSearchText").value = '';}
}
getElmtRef("globalSearchText").onblur = function() { if (getElmtRef("globalSearchText").value == ''){ getElmtRef("globalSearchText").value = 'Search';}
}
}
}
function checkFieldArrayEmpty(field)
{ for (i = 0; i < field.length; i++)
{ if(field[i].checked == true)
return true;}
alert("Pick at least one choice"); return false;}
function AC_AddExtension(src, ext)
{ if (src.indexOf('?') != -1)
return src.replace(/\?/, ext+'?'); else
return src + ext;}
function AC_Generateobj(objAttrs, params, embedAttrs)
{ var str = '<object '; for (var i in objAttrs)
str += i + '="' + objAttrs[i] + '" '; str += '>'; for (var i in params)
str += '<param name="' + i + '" value="' + params[i] + '" /> '; str += '<embed '; for (var i in embedAttrs)
str += i + '="' + embedAttrs[i] + '" '; str += ' ></embed></object>'; document.write(str);}
function AC_FL_RunContent(){ var ret = AC_GetArgs
( arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" , "application/x-shockwave-flash" ); AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);}
function AC_SW_RunContent(){ var ret = AC_GetArgs
( arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000" , null ); AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);}
function AC_GetArgs(args, ext, srcParamName, classid, mimeType){ var ret = new Object(); ret.embedAttrs = new Object(); ret.params = new Object(); ret.objAttrs = new Object(); for (var i=0; i < args.length; i=i+2){ var currArg = args[i].toLowerCase(); switch (currArg){ case "classid":
break; case "pluginspage":
ret.embedAttrs[args[i]] = args[i+1]; break; case "src":
case "movie":
args[i+1] = AC_AddExtension(args[i+1], ext); ret.embedAttrs["src"] = args[i+1]; ret.params[srcParamName] = args[i+1]; break; case "onafterupdate":
case "onbeforeupdate":
case "onblur":
case "oncellchange":
case "onclick":
case "ondblClick":
case "ondrag":
case "ondragend":
case "ondragenter":
case "ondragleave":
case "ondragover":
case "ondrop":
case "onfinish":
case "onfocus":
case "onhelp":
case "onmousedown":
case "onmouseup":
case "onmouseover":
case "onmousemove":
case "onmouseout":
case "onkeypress":
case "onkeydown":
case "onkeyup":
case "onload":
case "onlosecapture":
case "onpropertychange":
case "onreadystatechange":
case "onrowsdelete":
case "onrowenter":
case "onrowexit":
case "onrowsinserted":
case "onstart":
case "onscroll":
case "onbeforeeditfocus":
case "onactivate":
case "onbeforedeactivate":
case "ondeactivate":
case "type":
case "codebase":
ret.objAttrs[args[i]] = args[i+1]; break; case "width":
case "height":
case "align":
case "vspace":
case "hspace":
case "class":
case "title":
case "accesskey":
case "name":
case "id":
case "tabindex":
ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1]; break; default:
ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];}
}
ret.objAttrs["classid"] = classid; if (mimeType) ret.embedAttrs["type"] = mimeType; return ret;}
function hideSelects(){ var selElems=document.getElementsByTagName('select'); var numElems=selElems.length; for(i=0; i < numElems; i++) { selElems[i].style.visibility = "hidden";}
}
function unhideSelects(){ var selElems=document.getElementsByTagName('select'); var numElems=selElems.length; for(i=0; i < numElems; i++) { selElems[i].style.visibility = "visible";}
}
function redirect(url, closeWindow){ if (opener && !opener.closed){ opener.location.href = url; if(closeWindow){ window.close();}
}else{ window.location.href = url;}
}
function getR2netRedirectUrl(url) { var R2netUrl = url + 'Nic=' + GetCookie('Nic'); document.location.href = R2netUrl;}
function getCookieVal (offset) { var endstr = document.cookie.indexOf (";", offset); if (endstr == -1)
endstr = document.cookie.length; return unescape(document.cookie.substring(offset, endstr));}
function GetCookie (name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + alen; if (document.cookie.substring(i, j) == arg)
return getCookieVal (j); i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break;}
return null;}
function SetCookie (name, value) { var argv = SetCookie.arguments; var argc = SetCookie.arguments.length; var defaultexp = new Date (); defaultexp.setTime (defaultexp.getTime() + (24 * 60 * 60 * 1000 * 31)); var expires = (argc > 2) ? argv[2] : defaultexp; var path = (argc > 3) ? argv[3] : "/"; var domain = (argc > 4) ? argv[4] : null; var secure = (argc > 5) ? argv[5] : false; document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : "");}
