var suboption = new Array(); var option = new Array(); var optionpics = new Array(); var upgrade_selects = new Array(); var last_suboption = new Array(); var newwin; function newImage(arg) { if (document.images) { var rslt = new Image(); rslt.src = arg; return rslt; } } function switchImage(img,srcimg) { document[img].src = srcimg; } function toggleImages() { if (document.images && (preloadFlag == true)) { if(document[toggleImages.arguments[0]].src!= ('http://www.exceldiamonds.com' + toggleImages.arguments[1])) { document[toggleImages.arguments[0]].src = toggleImages.arguments[1]; } else { document[toggleImages.arguments[0]].src = toggleImages.arguments[2]; } } } function dhtmlLoadScript(url) { var e = document.createElement("script"); e.src = url; e.type="text/javascript"; document.getElementsByTagName("head")[0].appendChild(e); } var preloadFlag = false; function preloadImages() { if (document.images) { var currency_over = newImage("/pics/changecurrency_on.gif"); currency_over = newImage("/pics/currencyb_on.gif"); preloadFlag = true; } } function showLarge(type, id) { var width = 450; var height = 450; if (showLarge.arguments.length > 2) { width = showLarge.arguments[2]; height = showLarge.arguments[3]; } if (newwin && newwin.open && !newwin.closed) var is_open = true; else var is_open = false; if (type == 'main') { if (is_open) newwin.close(); newwin = window.open('/show_large.php?id='+id+'&width='+width+'&height='+height, 'BigPic', 'screenX=20,screenY=20,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width='+(width+5)+',height='+(height+5)); newwin.focus(); } else { if (is_open) newwin.close(); newwin = window.open('/show_alt_large.php?id='+id+'&width='+width+'&height='+height, 'BigPic', 'screenX=20,screenY=20,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width='+(width+5)+',height='+(height+5)); newwin.focus(); } } function openNewWindow(url,width,height) { newwin = window.open(url, '', 'screenX=20,screenY=20,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width='+width+',height='+height); newwin.focus(); } function showYouTube(id) { var width = 450; var height = 450; if (showYouTube.arguments.length > 2) { width = showYouTube.arguments[2]; height = showYouTube.arguments[3]; } var newwin = window.open('/showYouTube.php?id='+id, 'BigPic', 'screenX=20,screenY=20,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width='+(width+5)+',height='+(height+5)); newwin.focus(); } function showBoutiqueLarge(type, id) { var width = 450; var height = 450; if (showBoutiqueLarge.arguments.length > 2) { width = showBoutiqueLarge.arguments[2]; height = showBoutiqueLarge.arguments[3]; } if (newwin && newwin.open && !newwin.closed) var is_open = true; else var is_open = false; if (type == 'main') { if (is_open) newwin.close(); newwin = window.open('/show_boutique_large.php?id='+id+'&width='+width+'&height='+height, 'BigPic', 'screenX=20,screenY=20,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width='+(width+5)+',height='+(height+5)); newwin.focus(); } else { if (is_open) newwin.close(); newwin = window.open('/show_boutique_alt_large.php?id='+id+'&width='+width+'&height='+height, 'BigPic', 'screenX=20,screenY=20,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width='+(width+5)+',height='+(height+5)); newwin.focus(); } } function showLargeDiamond(prod_id) { var width = 450; var height = 450; if (showLargeDiamond.arguments.length == 3) { width = showLargeDiamond.arguments[1]; height = showLargeDiamond.arguments[2]; } var newwin = window.open('/show_large_diamond.php?id='+prod_id+'&width='+width+'&height='+height, 'BigPic', 'screenX=20,screenY=20,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width='+(width+5)+',height='+(height+5)); newwin.focus(); } function showDiamondAltPic(prod_id) { var width = 350; var height = 450; var scroll_width = 50; if (showDiamondAltPic.arguments.length == 3) { width = showDiamondAltPic.arguments[1]; height = showDiamondAltPic.arguments[2]; window_width = width + scroll_width; window_height = height > 550 ? 550 : height; } var newwin = window.open('/show_diamond_alt_pic.php?id='+prod_id+'&width='+width+'&height='+height, 'BigPic', 'screenX=20,screenY=20,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width='+(window_width+5)+',height='+(window_height+5)); newwin.focus(); } function showPriceMatch() { var width = 550; var height = 350; var scroll_width = 50; window_width = width + scroll_width; window_height = height > 550 ? 550 : height; var newwin = window.open('/pricematch.php?p=y', 'PopUp', 'screenX=20,screenY=20,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width='+(window_width+5)+',height='+(window_height+5)); newwin.focus(); } function showLargeOption(option_id) { var newwin = window.open('/show_large_option.php?option_id='+option_id, 'BigPic', 'screenX=20,screenY=20,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=350,height=450'); newwin.focus(); } function showSizeChart() { var newwin = window.open('/sizechart/', 'SizeChart', 'screenX=20,screenY=20,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=540,height=380'); newwin.focus(); } function showOption() { if (showOption.arguments.length == 0) var filename = document.optionpic.src; else var filename = document['optionpic'+showOption.arguments[0]].src; var newwin = window.open('/show_large_option.php?filename='+filename, 'BigPic', 'screenX=20,screenY=20,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=350,height=450'); newwin.focus(); } function setPackageImage(img_name,to_src) { if (document.images) { document[img_name].src = to_src; } } function showPromo(url) { var newwin = window.open(url, 'promo', 'screenX=20,screenY=20,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=550,height=300'); newwin.focus(); } function showDiamondExtras() { var newwin = window.open('/diamond-extras.php', '', 'screenX=20,screenY=20,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=550,height=380'); newwin.focus(); } function showJewelryExtras() { var newwin = window.open('/jewelry-extras.php', '', 'screenX=20,screenY=20,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=550,height=200'); newwin.focus(); } function getSelectedPackageChoice(fld) { var x; if (!fld.length) return fld.value; for (x=0;x -1 ? prod_index : ''); var pic = document.images[picname]; if (pic) pic.src = '/optionpics/'+id+'_thumb.jpg'; } if (last_suboption[pulldown_id]) { setSubOptionVisibility(last_suboption[pulldown_id],'none',prod_id); } if (!id_val) return false; if (id_val==0) return false; setSubOptionVisibility(id_val,'block',prod_id); last_suboption[pulldown_id] = id_val; return true; } function setSubOptionVisibility(suboption,visibility,prod_id) { var field_name; var field_options; var field_options_select; if (document.all) { field_name = document.all['suboption_name_' + suboption]; field_options = document.all['suboption_options_' + suboption]; field_options_select = document.all['suboption_options_select_' + suboption]; } else if (document.getElementById) { field_name = document.getElementById('suboption_name_' + suboption); field_options = document.getElementById('suboption_options_' + suboption); field_options_select = document.getElementById('suboption_options_select_' + suboption); } field_name.style.display = visibility; field_options.style.display = visibility; field_options_select.style.display = visibility; if (prod_id > 0) { suboption = prod_id + '][' + suboption; } if (visibility == 'none') { document.theFrm['options['+suboption+']'].selectedIndex = 0; document.theFrm['options['+suboption+']'].disabled = true; } else { document.theFrm['options['+suboption+']'].disabled = false; } } function populateShipping(fld) { var thefrm = fld.form; var field = fld.name.substring('billing['.length,fld.name.length-1); if (fld.type == 'select') { if (thefrm['shipping['+field+']'].selectedIndex == 0) { thefrm['shipping['+field+']'].selectedIndex = fld.selectedIndex; } } else if (thefrm['shipping['+field+']'].value == '') { thefrm['shipping['+field+']'].value = fld.value; } // populate credit card name when done with last name if (field == 'last_name' && thefrm['billing[first_name]'].value != '' && thefrm['billing[last_name]'].value != '' && thefrm['payment[name_on_card]'].value == '') { thefrm['payment[name_on_card]'].value = thefrm['billing[first_name]'].value + ' ' + thefrm['billing[last_name]'].value; } } function checkoutShipSameAsBill(fld) { var thefrm = fld.form; var flds = new Array('first_name','last_name','address1','address2','city','state','zip','country'); var from_field, to_field; setDisplay('shipping_info',(fld.checked)?'none':'block'); for (var i=0;i < flds.length;i++) { from_field = thefrm['billing['+flds[i]+']']; to_field = thefrm['shipping['+flds[i]+']']; if (from_field.type == 'select') { to_field.selectedIndex = from_field.selectedIndex; } else { to_field.value = from_field.value; } } } function changeProductPic(type, id, width, height) { if (type == 'main') { var_type = type; var_id = id; var_width = width; var_height = height; path = "/itempics/" + id + "_large.jpg"; } else { var_type = type; var_id = id; var_width = width; var_height = height; path = "/altitempics/" + id + "_large.jpg"; } pic = document.getElementById('product_pic'); pic.src = path; } function changeBoutiqueProductPic(type, id, width, height) { if (type == 'main') { var_type = type; var_id = id; var_width = width; var_height = height; path = "/boutique_itempics/" + id + "_large.jpg"; } else { var_type = type; var_id = id; var_width = width; var_height = height; path = "/boutique_altitempics/" + id + "_large.jpg"; } pic = document.getElementById('product_pic'); pic.src = path; } function cacheImages(images) { for(var i =0; i < images.length; i++) { //alert(images[i]); var im = new Image(); im.src = images[i]; } } function transferView(img, width, height) { var newwin = window.open('/transfer_view.php?pic_path='+img); newwin.focus(); } function checkApptForm(obj) { str = ''; if (obj.name.value == '') str += 'Please enter your name.\n'; if (obj.email.value == '' && obj.nightphone.value == '' && obj.dayphone.value == '') str += 'Please enter an email, day phone number, or night phone number.\n'; if (str != '') { alert(str) return false; } return true; } function checkFrm() { var elmt; for (var x=0;x 0) { end_fld.options[0] = null; } var x=0; var start = start_fld.selectedIndex; if (!include_start) start++; for (var i=start; i < start_fld.options.length; i++) { end_fld.options[x++] = new Option(start_fld.options[i].text,start_fld.options[i].value); } end_fld.selectedIndex = x - 1; } function advancedSearchDiamondClick(shuid, name) { _getElement('shuid' + shuid).checked=!_getElement('shuid' + shuid).checked; _getElement('shpicuid' + shuid).className=(_getElement('shuid' + shuid).checked)?'advanced_diamond_pic_on':'advanced_diamond_pic_off'; var label = _getElement('top_label_shape'); if(label && name){ var text = label.innerHTML; text = text.replace(', ' + name, ''); text = text.replace(name + ', ', ''); text = text.replace(name, ''); text = text.replace('All', ''); if( _getElement('shuid' + shuid).checked ){ if(text != '') text = text + ', '; text = text + name; } if(text == '') text = 'All'; label.innerHTML = text; } } function advancedSearchDiamondOver(shuid) { setDisplay('shtxtuid' + shuid, 'block'); } function advancedSearchDiamondOut(shuid) { setDisplay('shtxtuid' + shuid, 'none'); } var displayType = (document.all) ? 'block' : 'table-row-group'; var lastPayMethod = 'cc'; function setPaymentMethod(method) { if (lastPayMethod != '') { setDisplay('method_'+lastPayMethod, 'none'); } lastPayMethod = method; setDisplay('method_'+method, displayType); document.theFrm['payment[method]'].value = method; } function setPaymentMethod2() { if (document.theFrm['payment[method]'][1].checked){ setDisplay('wire_frm', 'block'); setDisplay('cc_frm', 'none'); }else{ setDisplay('cc_frm', 'block'); setDisplay('wire_frm', 'none'); } } function toggleDisplay(item) { if (_getElement(item).style.display == displayType) { setDisplay(item, 'none'); } else { setDisplay(item,displayType); } } function toggleDisplayOn(item) { setDisplay(item,displayType); } function toggleDisplayOff(item) { setDisplay(item, 'none'); } function gemex(id) { var page = 'http://www.gemex.com/livereport/partnerlink.php?linkid=1&pid='+id+'&cid=14&viewid=1&popup=y'; var NewWindow=open('','livereport','menubar=no,scrollbars=no,resizable=no,width=1000,height=664'); NewWindow.focus(); window.open(page,target="livereport"); } var old_qtvr_html = ''; var qtvr_shown = false; function showQTVR(the_type,the_id) { if (qtvr_shown) { _getElement('qtvr').innerHTML = old_qtvr_html; old_qtvr_html = ''; qtvr_shown = false; } else { var html = ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += '
Click and drag to see every angle! '; old_qtvr_html = _getElement('qtvr').innerHTML; _getElement('qtvr').innerHTML = html; qtvr_shown = true; } } function hideQTVR() { if (qtvr_shown) { _getElement('qtvr').innerHTML = old_qtvr_html; old_qtvr_html = ''; qtvr_shown = false; } } function resetStates(country,state,selected_state,add_fee) { var box = state; var selected_index = 0; box.disabled = false; while (box.options.length) box.options[0] = null; if (country.options[country.selectedIndex].value == 'USA'){ box.options[0] = new Option('Please Select',''); for(var i=0;i < us_states.length;i++){ count = i+1; box.options[count] = new Option(us_states[i][0],us_states[i][1]); if (selected_state == us_states[i][1]) selected_index = count; } if ($("method_cc")){ $("method_wire_usa").show(); $("method_wire_international").hide(); setPaymentMethod("cc"); } } else if (country.options[country.selectedIndex].value == 'CAN'){ box.options[0] = new Option('Please Select',''); for(var x=0; x < canada_states.length;x++){ count = x+1; box.options[count] = new Option(canada_states[x][0],canada_states[x][1]); if (selected_state == canada_states[x][1]) selected_index = count; } if ($("method_cc")){ setPaymentMethod("wire"); $("method_wire_usa").hide(); $("method_wire_international").show(); } }else { box.options[0] = new Option(' ',''); box.disabled = true; if ($("method_cc")){ setPaymentMethod("wire"); $("method_wire_usa").hide(); $("method_wire_international").show(); } } if (selected_index > 0) box.selectedIndex = selected_index; else box.selectedIndex = 0; if (add_fee) { addFee('country_select'); } } function addFee(elem_class) { var box = document.getElementsByClassName(elem_class)[0]; var fee_box = document.getElementById('fee_box'); var grand_total = document.getElementById('grand_total'); var gt_value = parseFloat(grand_total.innerHTML.replace(',', '')); var fee_value = document.getElementById('fee_value'); if (box.value != 'USA' && box.value != '') { if (fee_value.value == 0) { fee_box.style.display = 'block'; if (gt_value < 4500) { fee_value.value = 100; } else if (gt_value >= 4500 && gt_value < 5500) { fee_value.value = 115; } else if (gt_value >= 5500 && gt_value < 6000) { fee_value.value = 122; } else if (gt_value >= 6000 && gt_value < 6500) { fee_value.value = 130; } else if (gt_value >= 6500 && gt_value < 7000) { fee_value.value = 132; } else if (gt_value >= 7000 && gt_value < 7500) { fee_value.value = 140; } else if (gt_value >= 7500 && gt_value < 9000) { fee_value.value = 143; } else if (gt_value >= 9000 && gt_value < 11000) { fee_value.value = 150; } else if (gt_value >= 11000 && gt_value < 12000) { fee_value.value = 155; } else if (gt_value >= 12000 && gt_value < 14000) { fee_value.value = 158; } else if (gt_value >= 14000 && gt_value < 16000) { fee_value.value = 160; } else if (gt_value >= 16000 && gt_value < 17000) { fee_value.value = 165; } else if (gt_value >= 17000 && gt_value < 18000) { fee_value.value = 170; } else if (gt_value >= 18000 && gt_value < 19000) { fee_value.value = 175; } else if (gt_value >= 19000 && gt_value < 20000) { fee_value.value = 180; } else if (gt_value >= 20000 && gt_value < 21000) { fee_value.value = 185; } else if (gt_value >= 21000 && gt_value < 22000) { fee_value.value = 195; } else if (gt_value >= 22000 && gt_value < 24000) { fee_value.value = 200; } else if (gt_value >= 24000 && gt_value < 25000) { fee_value.value = 205; } else if (gt_value >= 25000 && gt_value < 26000) { fee_value.value = 210; } else if (gt_value >= 26000) { fee_value.value = 215; } fee_box.innerHTML = 'International Shipping Fee of ' + document.getElementById('currency_symbol').innerHTML + fee_value.value + ' was added to your order.'; grand_total.innerHTML = gt_value + parseFloat(fee_value.value); } } else { fee_box.style.display = 'none'; if (fee_value.value > 0) { grand_total.innerHTML = gt_value - parseFloat(fee_value.value); } fee_value.value = 0; } } function showHideSsvImages(count) { toggleBlock('ss_view_images_0'); for(var i = 1;i