/*** * Copyright 2004-2005 Glass Dimensions, Inc. * All rights reserved. * * BE SURE TO CHANGE THE ITEM PRICING TAB TO BE (MSRP * .7) FOR COLLECTORS CLUB * AND (MSRP * .5) for ISA * * When setting up the item of the month, there is one change necessary to this * file (pricing.js): set item_of_the_month equal to the appropriate item id in quotes. * * See collectorsclub.html comments for all necessary changes to that file * when setting up the item of the month. */ var design_of_the_month = "3058"; var GDCC_standard_discount = 15; var GDCC_item_of_the_month_discount = 30; var ISA_standard_discount = 40; var ISA_item_of_the_month_discount = 50; function ShippingCalculator(){ popup = window.open('http://glassdimensions.com/site/shipcalc.html','shipcalc','width=600,height=290'); popup.focus(); } var winnum = 1; function Popup(p,w,h){ // // The second arg to window.open MUST NOT contain any spaces // or you get an invalid argument javascript error from at least IE 6 // // tack on the value of the global 'winnum' counter to get a new // window each time. // var winname = "popup" + winnum; winnum += 1; var popup = window.open('http://shop.glassdimensions.com/'+p,winname,'width='+w+',height='+h+'resizable=yes,scrollbars=yes'); popup.focus(); } function zoom(item,image){ // // The second arg to window.open MUST NOT contain any spaces // or you get an invalid argument javascript error from at least IE 6 // // tack on the value of the global 'winnum' counter to get a new // window each time. // var winname = "zoom" + winnum; winnum += 1; popup = window.open('',winname,'width=600,height=500,resizable=yes,scrollbars=yes'); open_header = 'Glass Dimensions - ' + item + '            '; close_header = ''; body = '
'; body += '' + item + ''; footer = '
'; popup.document.open("text/html", "replace"); popup.document.write(open_header+close_header+body+footer); popup.document.close(); } function Hide(tag,content){ var gdi = 0; gdi = location.hostname.search(/glassdimensions/gi) != -1; if(gdi && content=="nl"){ document.writeln(tag); } else if(!gdi && content=="gdi"){ document.writeln(tag); } } function discountPercent(pricelevel,itemid) { var discPercent = 0; switch(pricelevel){ case "3 - ISA": if ( itemid == design_of_the_month ) discPercent = ISA_item_of_the_month_discount; else discPercent = ISA_standard_discount; break; case "4 - Collectors Club": if ( itemid == design_of_the_month ) discPercent = GDCC_item_of_the_month_discount; else discPercent = GDCC_standard_discount; break; case "2 - Wholesale": discPercent = -1; break; default : discPercent = 0; break; } return discPercent; } function retailPricing(discPercent,strPrice) { var floatPrice = parseFloat(strPrice); if(discPercent != 0 ) floatPrice = floatPrice * 100 / (100-discPercent); return "$ " + floatPrice.toFixed(2); } function CollectorsClubPricing(d,sp,pl) { var special_offer_ends = '

Offer ends June 30, 2004

'; var login = '

Login to view member pricing.' + '

'; var join_today ='

Join today and receive '+ GDCC_item_of_the_month_discount + ' % off the list price!' + '

' + special_offer_ends; var regularPrice = ""; var yourPrice = ""; sp = sp.replace("$",""); var dp = discountPercent(pl,d); var rp = retailPricing(dp,sp); sp = "$ " + sp; if(dp > 0){ regularPrice = '

Design: ' + d + '  Regular Price: ' + rp + '


'; yourPrice = '

Your Price This Month: ' + sp + '

'; document.write(regularPrice + yourPrice); //document.write( special_offer_ends ); } // // Uncomment this 'else if' when // Collectors Club tab is made public . . . // Be sure to add a Collectors Club item that when purchased // gives a customer member status. Also, define a promotional url // http://glassdimensions.com/join. // //else if( pricelevel.search("MSRP")!= -1 ) //{ // document.write(join_today); //} // handles wholesale else if(dp==-1) { regularPrice = '

Design: ' + d + '  Regular Price: ' + rp + '


'; document.write(regularPrice); } else { regularPrice = '

Design: ' + d + '  Regular Price: ' + rp + '


'; document.write(regularPrice + login); } } function itemTemplatePricing(d,sp,pl) { sp = sp.replace("$",""); dp = discountPercent(pl,d); rp = retailPricing(dp,sp); sp = "$ " + sp; var designPrice = 'Design: ' + d + '  Regular Price: ' + rp; var cc1 = '

Design of the Month
' + designPrice + '

'; var cc2 = '

Your Price This Month: ' + sp + '

'; if(dp > 0 && d == design_of_the_month) document.write(cc1 + cc2); else if(dp > 0 && d != design_of_the_month) document.write('

' + designPrice + '

Your Price: ' + sp + '

'); else document.write('

Design: ' + d + '  Price: ' + sp + '

'); } function DonationMessage(page,subtotal,org){ var don = 0; if( org == "" ) org = location.search; if(org.search(/P10059/gi)!=-1){ don = 10; org = "Charlestown Mother's Association"; } else if(org.search(/V1232/gi)!=-1){ don = 20; org = "Rhode Island Hospital Guild"; } if(page.match(/welcome/gi) && don > 0){ document.write("\

Glass Dimensions will donate\\" + don + "% to the " + org + "\\for every purchase you make!\"); } else if(page.match(/checkout/gi)){ document.write("\

After you click the 'Submit Order' button,"); if( don > 0 ){ donAmt = subtotal*(don/100); document.write("\Glass Dimensions will donate $" + donAmt.toFixed(2) + " to the \" + org + " and "); } document.write("\you will receive a confirmation email.\"); } } function gdi_design_group_onsubmit(){ var size = document.getElementById("gdi_design_size").value; if(size != "0"){ document.getElementById('buyid').value = size; return ns_onsubmit(); } else{ alert("Please indicate your selection to be added to the cart."); return 0; } } function gdi_design_group_init(){ // this init function is currently only relevant // to the gdi_design_group pages which will have // a global variable gdi_design_group defined // prior to the inclusion of this group.js file... // If not, let's get out of here! // if(window.console) { // window.console.log("init function."+typeof(gdi_design_group)) // } // else { // alert("typeof(gdi_design_group)) // } if(typeof(gdi_design_group) == 'undefined'){ return; } // Netsuite's convention is to craft the 'add to // cart' form name by combining 'form' and the // internalid of the particular design. This // script depends on this convention, so, we // should keep an eye on this. var ns_form_name = "form" + gdi_design_group; // For ornaments (internalid is 676), we simply // need to set the engraving option to the // appropriate value based on the buypage category. if(typeof(gdi_buypage_cat) != 'undefined'){ if(gdi_buypage_cat=="teacher"){ document.forms[ns_form_name].elements["custcolornament_engraving"].value=22; } return; } // In order to insert our check for the selection // of design size, it's necessary to swap in our // own onSubmit handler for the netsuite 'add to cart' // form and save the netsuite onSubmit handler to // be called after we do our checking. // ns_onsubmit = document.forms[ns_form_name].onsubmit; document.forms[ns_form_name].onsubmit = gdi_design_group_onsubmit; }