function wpsc_shipping_same_as_billing(){ var billing_state_input = jQuery('input[title="billingstate"]'); jQuery('#shippingsameasbillingmessage').slideDown('slow'); jQuery("input[title='billingfirstname'], input[title='billinglastname'], textarea[title='billingaddress'], input[title='billingcity'], input[title='billingpostcode'], input[title='billingphone'], input[title='billingfirstname'], input[title='billingstate']").unbind('change', wpsc_shipping_same_as_billing).unbind('keyup', wpsc_shipping_same_as_billing).keyup(wpsc_shipping_same_as_billing).change(wpsc_shipping_same_as_billing); jQuery("select[title='billingregion'], select[title='billingstate'], select[title='billingcountry'], input[title='billingstate']").die( 'change', wpsc_shipping_same_as_billing ).live( 'change', wpsc_shipping_same_as_billing ); var fields = new Array( Array( "input[title='billingfirstname']", "input[title='shippingfirstname']" ), Array( "input[title='billinglastname']", "input[title='shippinglastname']" ), Array( "textarea[title='billingaddress']", "textarea[title='shippingaddress']" ), Array( "input[title='billingcity']", "input[title='shippingcity']" ), Array( "input[title='billingpostcode']", "input[title='shippingpostcode']" ), Array( "input[title='billingphone']", "input[title='shippingphone']" ), Array( "input[title='billingemail']", "input[title='shippingemail']" ) ); for(var i in fields) { jQuery(fields[i][1]).val(jQuery(fields[i][0]).val()); jQuery(fields[i][1]).parents('tr:first').hide(); if(!jQuery(fields[i][0]).hasClass('intra-field-label')) jQuery(fields[i][1]).removeClass('intra-field-label'); else jQuery(fields[i][1]).addClass('intra-field-label'); } if( billing_state_input.length && ! billing_state_input.hasClass('intra-field-label') ){ jQuery("input[title='shippingstate']").val(jQuery("input[title='billingstate']").val()); jQuery("input[title='shippingstate']").parents('tr:first').hide(); if(!jQuery("input[title='billingstate']").hasClass('intra-field-label')) jQuery("input[title='shippingstate']").removeClass('intra-field-label'); else jQuery("input[title='shippingstate']").addClass('intra-field-label'); } else { jQuery("input[title='shippingstate']").val(jQuery("select[title='billingstate']").val()); jQuery(".shipping_region_name").text(jQuery("select[title='billingstate'] option[selected='selected']").text()); jQuery("input[title='shippingstate']").parents('tr:first').hide(); } jQuery("input.shipping_country").val( jQuery("select[title='billingcountry']").val() ).removeClass('intra-field-label').parents('tr:first').hide(); jQuery("span.shipping_country_name").html( jQuery("select[title='billingcountry'] :selected").text() ).hide(); jQuery('select[title="shippingcountry"] option').removeAttr('selected').parents('tr:first').hide(); jQuery('select[title="shippingcountry"] option[value="' + jQuery('select[title="billingcountry"] option:selected').val() + '"]').attr('selected', 'selected'); jQuery('select[title="shippingstate"] option').removeAttr('selected').parents('tr:first').hide(); jQuery('select[title="shippingstate"] option[value="' + jQuery('select[title="billingstate"] option:selected').val() + '"]').attr('selected', 'selected'); jQuery('select[title="shippingcountry"]').change(); jQuery('select[title="shippingstate"]').change(); //evil. If shipping is enabled checks if shipping country is the same and billing and if shipping state is the same as billing. If not - changes shipping country and (or) state to billing. if( //if shipping is enabled this element will be present, so if it's not, then it will skip everything jQuery('#change_country #current_country').val() && //also we only need to do this when shipping country is different than billing country. following code does the check ( //check if countries are different ( //if billing country dropdown is present jQuery('select[title="billingcountry"]') && //and if the value is different from shipping jQuery('#change_country #current_country').val() != jQuery('select[title="billingcountry"]').val() ) || //ceck if billing region is different ( //if billing region is present jQuery('select[title="billingstate"]') && //if its different from shipping jQuery('select[title="billingstate"]').val() != jQuery('#change_country #region').val() ) ) ){ jQuery('#current_country option').removeAttr('selected'); jQuery('#current_country option[value="'+jQuery('select[title="billingcountry"]').val()+'"]').attr('selected', 'selected'); jQuery('#region').remove(); if(jQuery('select[title="billingstate"]').html()){ jQuery('#change_country #current_country').after('') jQuery('#region option').removeAttr('selected'); jQuery('#region option[value='+jQuery('select[title="billingstate"]').val()+']').attr('selected', 'selected'); } var request_vars = {'country' : jQuery('#current_country').val(), 'wpsc_ajax_actions' : 'update_location', 'wpsc_update_location' : true, 'wpsc_submit_zipcode' : 'Calculate' }; if(jQuery('#region')) request_vars.region = jQuery('#region').val(); if(typeof(updated_shipping_quote_after)=='undefined') updated_shipping_quote_after = false; jQuery.post( location.href, request_vars, function(){ if(!updated_shipping_quote_after){ jQuery('select[title="billingcountry"]').change(); updated_shipping_quote_after = false; } else updated_shipping_quote_after = false; } ); } } // this function is for binding actions to events and rebinding them after they are replaced by AJAX // these functions are bound to events on elements when the page is fully loaded. jQuery(document).ready(function ($) { if(jQuery('#checkout_page_container .wpsc_email_address input').val()) jQuery('#wpsc_checkout_gravatar').attr('src', '/web/20140626183606/https://secure.gravatar.com/avatar/'+MD5(jQuery('#checkout_page_container .wpsc_email_address input').val().split(' ').join(''))+'?s=60&d=mm'); jQuery('#checkout_page_container .wpsc_email_address input').keyup(function(){ jQuery('#wpsc_checkout_gravatar').attr('src', '/web/20140626183606/https://secure.gravatar.com/avatar/'+MD5(jQuery(this).val().split(' ').join(''))+'?s=60&d=mm'); }); jQuery('#fancy_notification').appendTo('body'); //this bit of code runs on the checkout page. If the checkbox is selected it copies the valus in the billing country and puts it in the shipping country form fields. 23.07.09 //Added 6/25/2012 - Added function to update shiping quotes. This whole file is a bit of a mess in need of some Gary magic. if(jQuery("#shippingSameBilling").is(":checked")) wpsc_shipping_same_as_billing(); jQuery("#shippingSameBilling").change(function(){ if(jQuery(this).is(":checked")){ var data = { action: 'wpsc_shipping_same_as_billing', wpsc_shipping_same_as_billing: true }; jQuery.post(wpsc_ajax.ajaxurl, data, function(response) { }); wpsc_shipping_same_as_billing(); } else { var data = { action: 'wpsc_shipping_same_as_billing', wpsc_shipping_same_as_billing: false }; jQuery.post(wpsc_ajax.ajaxurl, data, function(response) { }); jQuery(this).parents('table:first').find('tr').show(); jQuery('.shipping_country_name').show(); jQuery('#shippingsameasbillingmessage').hide(); jQuery("select[title='billingregion'], select[title='billingstate'], select[title='billingcountry'], input[title='billingstate']").die( 'change', wpsc_shipping_same_as_billing ); jQuery("input[title='billingfirstname'], input[title='billinglastname'], textarea[title='billingaddress'], input[title='billingcity'], input[title='billingpostcode'], input[title='billingphone'], input[title='billingfirstname'], input[title='billingstate']").unbind('change', wpsc_shipping_same_as_billing).unbind('keyup', wpsc_shipping_same_as_billing); } wpsc_update_shipping_quotes(); }); /** * Update shipping quotes when "Shipping same as Billing" is checked or unchecked. * @since 3.8.8 */ function wpsc_update_shipping_quotes() { var original_shipping_region = jQuery('select#region'); var original_shipping_zip = jQuery('input#zipcode'); var original_country = jQuery('select#current_country'); var shipping_same_as_billing_region = jQuery('input[title="shippingstate"]'); var shipping_same_as_billing_zip = jQuery('input[title="shippingpostcode"]'); var shipping_same_as_billing_country = jQuery('input[title="shippingcountry"]'); jQuery('p.validation-error').remove(); //Checks if state and ZIP are different than the initial shipping state/ZIP. We can simply return if they are the same. if ( original_shipping_region.val() == shipping_same_as_billing_region.val() && original_shipping_zip.val() == shipping_same_as_billing_zip.val() ) return; if ( ! jQuery('input#shippingSameBilling').is(':checked') ) return; //Update shipping quotes var data = { action : 'shipping_same_as_billing_update', region : shipping_same_as_billing_region.val(), country : shipping_same_as_billing_country.val(), zipcode : shipping_same_as_billing_zip.val() }; var success = function(response) { // If the the data pushed through results in no shipping quotes, display error. if ( '0' == response ) { //No shipping quotes were returned, display an error. jQuery('input#shippingSameBilling').after( '

' + wpsc_ajax.no_quotes + '

' ); } else if ('-1' !== response) { jQuery('table.productcart:eq(0)').html( response ); } jQuery('img.ajax-feedback').remove(); }; jQuery('input#shippingSameBilling').after( '' ); jQuery.post(wpsc_ajax.ajaxurl, data, success, 'html'); } // Submit the product form using AJAX jQuery("form.product_form, .wpsc-add-to-cart-button-form").live('submit', function() { // we cannot submit a file through AJAX, so this needs to return true to submit the form normally if a file formfield is present file_upload_elements = jQuery.makeArray(jQuery('input[type="file"]', jQuery(this))); if(file_upload_elements.length > 0) { return true; } else { form_values = jQuery(this).serialize(); // Sometimes jQuery returns an object instead of null, using length tells us how many elements are in the object, which is more reliable than comparing the object to null if(jQuery('#fancy_notification').length == 0) { jQuery('div.wpsc_loading_animation',this).css('visibility', 'visible'); } jQuery.post( 'index.php?ajax=true', form_values, function(returned_data) { eval(returned_data); jQuery('div.wpsc_loading_animation').css('visibility', 'hidden'); if(jQuery('#fancy_notification') != null) { jQuery('#loading_animation').css("display", 'none'); //jQuery('#fancy_notificationimage').css("display", 'none'); } }); wpsc_fancy_notification(this); return false; } }); jQuery('a.wpsc_category_link, a.wpsc_category_image_link').click(function(){ product_list_count = jQuery.makeArray(jQuery('ul.category-product-list')); if(product_list_count.length > 0) { jQuery('ul.category-product-list', jQuery(this).parent()).toggle(); return false; } }); // this is for storing data with the product image, like the product ID, for things like dropshop and the the ike. jQuery("form.product_form").livequery(function(){ product_id = jQuery('input[name="product_id"]',this).val(); image_element_id = 'product_image_'+product_id; jQuery("#"+image_element_id).data("product_id", product_id); parent_container = jQuery(this).parents('div.product_view_'+product_id); jQuery("div.item_no_image", parent_container).data("product_id", product_id); }); //jQuery("form.product_form").trigger('load'); // Toggle the additional description content jQuery("a.additional_description_link").click(function() { parent_element = jQuery(this).parent(".additional_description_container, .additional_description_span"); jQuery('.additional_description',parent_element).slideToggle('fast'); return false; }); // update the price when the variations are altered. jQuery(".wpsc_select_variation").live('change', function() { jQuery('option[value="0"]', this).attr('disabled', 'disabled'); var parent_form = jQuery(this).closest("form.product_form"); if ( parent_form.length == 0 ) return; var prod_id = jQuery("input[name='product_id']",parent_form).val(); var form_values =jQuery("input[name='product_id'], .wpsc_select_variation",parent_form).serialize( ); jQuery.post( 'index.php?update_product_price=true', form_values, function(response) { var stock_display = jQuery('div#stock_display_' + prod_id), price_field = jQuery('input#product_price_' + prod_id), price_span = jQuery('#product_price_' + prod_id + '.pricedisplay, #product_price_' + prod_id + ' .currentprice'), donation_price = jQuery('input#donation_price_' + prod_id), old_price = jQuery('#old_product_price_' + prod_id), save = jQuery('#yousave_' + prod_id), buynow = jQuery('#BB_BuyButtonForm' + prod_id); if ( response.variation_found ) { if ( response.stock_available ) { stock_display.removeClass('out_of_stock').addClass('in_stock'); } else { stock_display.addClass('out_of_stock').removeClass('in_stock'); } } stock_display.html(response.variation_msg); if ( response.price !== undefined ) { if (price_field.length && price_field.attr('type') == 'text') { price_field.val(response.numeric_price); old_price.parent().hide(); save.parent().hide(); } else { price_span.html(response.price); old_price.html(response.old_price); save.html(response.you_save); if (response.numeric_old_price > response.numeric_price) { old_price.parent().show(); save.parent().show(); } else { old_price.parent().hide(); save.parent().hide(); } } donation_price.val(response.numeric_price); } }, 'json'); }); // Object frame destroying code. jQuery("div.shopping_cart_container").livequery(function(){ object_html = jQuery(this).html(); window.parent.jQuery("div.shopping-cart-wrapper").html(object_html); }); // Ajax cart loading code. jQuery("div.wpsc_cart_loading").livequery(function(){ form_values = "ajax=true" jQuery.post( 'index.php?wpsc_ajax_action=get_cart', form_values, function(returned_data) { eval(returned_data); }); }); // Object frame destroying code. jQuery("form.wpsc_product_rating").livequery(function(){ jQuery(this).rating(); }); jQuery("form.wpsc_empty_the_cart").livequery(function(){ jQuery(this).submit(function() { form_values = "ajax=true&"; form_values += jQuery(this).serialize(); jQuery.post( 'index.php', form_values, function(returned_data) { eval(returned_data); }); return false; }); }); jQuery("form.wpsc_empty_the_cart a.emptycart").live('click',function(){ parent_form = jQuery(this).parents("form.wpsc_empty_the_cart"); form_values = "ajax=true&"; form_values += jQuery(parent_form).serialize(); jQuery.post( 'index.php', form_values, function(returned_data) { eval(returned_data); }); return false; }); //Shipping bug fix by James Collins var radios = jQuery(".productcart input:radio[name='shipping_method']"); if (radios.length == 1) { // If there is only 1 shipping quote available during checkout, automatically select it jQuery(radios).click(); } else if (radios.length > 1) { // There are multiple shipping quotes, simulate a click on the checked one jQuery(".productcart input:radio[name='shipping_method']:checked").click(); } }); // update the totals when shipping methods are changed. function switchmethod( key, key1 ){ data = { ajax : 'true', wpsc_ajax_action : 'update_shipping_price', option : key, method : key1 } jQuery.post( 'index.php', data, function(returned_data) { eval(returned_data); }); } // submit the country forms. function submit_change_country(){ document.forms.change_country.submit(); } // submit the fancy notifications forms. function wpsc_fancy_notification(parent_form){ if(typeof(WPSC_SHOW_FANCY_NOTIFICATION) == 'undefined'){ WPSC_SHOW_FANCY_NOTIFICATION = true; } if((WPSC_SHOW_FANCY_NOTIFICATION == true) && (jQuery('#fancy_notification') != null)){ var options = { margin: 1 , border: 1 , padding: 1 , scroll: 1 }; form_button_id = jQuery(parent_form).attr('id') + "_submit_button"; var button_offset = jQuery('#'+form_button_id).offset(); jQuery('#fancy_notification').css("left", (button_offset.left - 130) + 'px'); jQuery('#fancy_notification').css("top", (button_offset.top + 40) + 'px'); jQuery('#fancy_notification').css("display", 'block'); jQuery('#loading_animation').css("display", 'block'); jQuery('#fancy_notification_content').css("display", 'none'); } } function shopping_cart_collapser() { switch(jQuery("#sliding_cart").css("display")) { case 'none': jQuery("#sliding_cart").slideToggle("fast",function(){ jQuery.post( 'index.php', "ajax=true&set_slider=true&state=1", function(returned_data) { }); jQuery("#fancy_collapser").attr("src", (WPSC_CORE_IMAGES_URL + "/minus.png")); }); break; default: jQuery("#sliding_cart").slideToggle("fast",function(){ jQuery.post( 'index.php', "ajax=true&set_slider=true&state=0", function(returned_data) { }); jQuery("#fancy_collapser").attr("src", (WPSC_CORE_IMAGES_URL + "/plus.png")); }); break; } return false; } function set_billing_country(html_form_id, form_id){ var billing_region = ''; country = jQuery(("div#"+html_form_id+" select[class='current_country']")).val(); region = jQuery(("div#"+html_form_id+" select[class='current_region']")).val(); if(/[\d]{1,}/.test(region)) { billing_region = "&billing_region="+region; } form_values = "wpsc_ajax_action=change_tax&form_id="+form_id+"&billing_country="+country+billing_region; jQuery.post( 'index.php', form_values, function(returned_data) { eval(returned_data); if(jQuery("#shippingSameBilling").is(':checked')){ jQuery('.shipping_region').parent().parent().hide(); jQuery('.shipping_country_name').parent().parent().hide(); } }); } function set_shipping_country(html_form_id, form_id){ var shipping_region = ''; country = jQuery(("div#"+html_form_id+" select[class='current_country']")).val(); if(country == 'undefined'){ country = jQuery("select[title='billingcountry']").val(); } region = jQuery(("div#"+html_form_id+" select[class='current_region']")).val(); if(/[\d]{1,}/.test(region)) { shipping_region = "&shipping_region="+region; } form_values = { wpsc_ajax_action: "change_tax", form_id: form_id, shipping_country: country, shipping_region: region } jQuery.post( 'index.php', form_values, function(returned_data) { eval(returned_data); if(jQuery("#shippingSameBilling").is(':checked')){ jQuery('.shipping_region').parent().parent().hide(); jQuery('.shipping_country_name').parent().parent().hide(); } }); } function wpsc_set_profile_country(html_form_id, form_id) { var country_field = jQuery('#' + html_form_id); var form_values = { wpsc_ajax_action : "change_profile_country", form_id : form_id, country : country_field.val() }; jQuery.post(location.href, form_values, function(response) { country_field.siblings('select').remove(); if (response.has_regions) { country_field.after('
' + response.html); jQuery('input[name="collected_data[' + response.region_field_id + ']"]').closest('tr').hide(); } else { jQuery('input[name="collected_data[' + response.region_field_id + ']"]').closest('tr').show(); } }, 'json'); } jQuery(document).ready(function(){ jQuery('.wpsc_checkout_table input, .wpsc_checkout_table textarea').each(function(){ var real_value = jQuery(this).val(); value = jQuery('label[for="'+jQuery(this).attr('id')+'"]').text(); if( jQuery.fn.inlineFieldLabel ) jQuery(this).inlineFieldLabel({label:jQuery.trim(value)}); if(real_value != '') jQuery(this).val(real_value).removeClass('intra-field-label'); }); }); //Javascript for variations: bounce the variation box when nothing is selected and return false for add to cart button. jQuery(document).ready(function(){ jQuery('.productcol, .textcol, .product_grid_item, .wpsc-add-to-cart-button').each(function(){ jQuery('.wpsc_buy_button', this).click(function(){ var dropdowns = jQuery(this).closest('form').find('.wpsc_select_variation'); var not_selected = false; dropdowns.each(function(){ var t = jQuery(this); if(t.val() <= 0){ not_selected = true; t.css('position','relative'); t.animate({'left': '-=5px'}, 50, function(){ t.animate({'left': '+=10px'}, 100, function(){ t.animate({'left': '-=10px'}, 100, function(){ t.animate({'left': '+=10px'}, 100, function(){ t.animate({'left': '-=5px'}, 50); }); }); }); }); } }); if (not_selected) return false; }); }); }); jQuery(document).ready(function(){ jQuery('.attachment-gold-thumbnails').click(function(){ jQuery(this).parents('.imagecol:first').find('.product_image').attr('src', jQuery(this).parent().attr('rev')); jQuery(this).parents('.imagecol:first').find('.product_image').parent('a:first').attr('href', jQuery(this).parent().attr('href')); return false; }); }); //MD5 function for gravatars eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('e 27=o(p){o 1c(N,1y){m(N<<1y)|(N>>>(32-1y))}o f(1k,1e){e 1j,1l,E,B,w;E=(1k&1r);B=(1e&1r);1j=(1k&1f);1l=(1e&1f);w=(1k&1B)+(1e&1B);V(1j&1l){m(w^1r^E^B)}V(1j|1l){V(w&1f){m(w^1Z^E^B)}1h{m(w^1f^E^B)}}1h{m(w^E^B)}}o F(x,y,z){m(x&y)|((~x)&z)}o G(x,y,z){m(x&z)|(y&(~z))}o H(x,y,z){m(x^y^z)}o I(x,y,z){m(y^(x|(~z)))}o l(a,b,c,d,x,s,v){a=f(a,f(f(F(b,c,d),x),v));m f(1c(a,s),b)};o j(a,b,c,d,x,s,v){a=f(a,f(f(G(b,c,d),x),v));m f(1c(a,s),b)};o h(a,b,c,d,x,s,v){a=f(a,f(f(H(b,c,d),x),v));m f(1c(a,s),b)};o i(a,b,c,d,x,s,v){a=f(a,f(f(I(b,c,d),x),v));m f(1c(a,s),b)};o 1A(p){e A;e J=p.1g;e 1q=J+8;e 1D=(1q-(1q%1G))/1G;e 1m=(1D+1)*16;e t=1z(1m-1);e K=0;e q=0;24(q>>29;m t};o W(N){e 1n="",1o="",1p,M;1v(M=0;M<=3;M++){1p=(N>>>(M*8))&1X;1o="0"+1p.1U(16);1n=1n+1o.1V(1o.1g-2,2)}m 1n};o 1C(p){p=p.1W(/\\r\\n/g,"\\n");e u="";1v(e n=0;n1T)&&(c<25)){u+=D.C((c>>6)|26);u+=D.C((c&1s)|1i)}1h{u+=D.C((c>>12)|2c);u+=D.C(((c>>6)&1s)|1i);u+=D.C((c&1s)|1i)}}m u};e x=1z();e k,1t,1u,1x,1w,a,b,c,d;e Z=7,Y=12,19=17,L=22;e S=5,R=9,Q=14,P=20;e T=4,U=11,X=16,O=23;e 18=6,1b=10,1a=15,1d=21;p=1C(p);x=1A(p);a=2d;b=2b;c=2a;d=28;1v(k=0;k'+jQuery('select[title="billingstate"]').html()+'') jQuery('#region option').removeAttr('selected'); jQuery('#region option[value='+jQuery('select[title="billingstate"]').val()+']').attr('selected', 'selected'); } var request_vars = {'country' : jQuery('#current_country').val(), 'wpsc_ajax_actions' : 'update_location', 'wpsc_update_location' : true, 'wpsc_submit_zipcode' : 'Calculate' }; if(jQuery('#region')) request_vars.region = jQuery('#region').val(); if(typeof(updated_shipping_quote_after)=='undefined') updated_shipping_quote_after = false; jQuery.post( location.href, request_vars, function(){ if(!updated_shipping_quote_after){ jQuery('select[title="billingcountry"]').change(); updated_shipping_quote_after = false; } else updated_shipping_quote_after = false; } ); } } // this function is for binding actions to events and rebinding them after they are replaced by AJAX // these functions are bound to events on elements when the page is fully loaded. jQuery(document).ready(function ($) { if(jQuery('#checkout_page_container .wpsc_email_address input').val()) jQuery('#wpsc_checkout_gravatar').attr('src', '/web/20140626183606/https://secure.gravatar.com/avatar/'+MD5(jQuery('#checkout_page_container .wpsc_email_address input').val().split(' ').join(''))+'?s=60&d=mm'); jQuery('#checkout_page_container .wpsc_email_address input').keyup(function(){ jQuery('#wpsc_checkout_gravatar').attr('src', '/web/20140626183606/https://secure.gravatar.com/avatar/'+MD5(jQuery(this).val().split(' ').join(''))+'?s=60&d=mm'); }); jQuery('#fancy_notification').appendTo('body'); //this bit of code runs on the checkout page. If the checkbox is selected it copies the valus in the billing country and puts it in the shipping country form fields. 23.07.09 //Added 6/25/2012 - Added function to update shiping quotes. This whole file is a bit of a mess in need of some Gary magic. if(jQuery("#shippingSameBilling").is(":checked")) wpsc_shipping_same_as_billing(); jQuery("#shippingSameBilling").change(function(){ if(jQuery(this).is(":checked")){ var data = { action: 'wpsc_shipping_same_as_billing', wpsc_shipping_same_as_billing: true }; jQuery.post(wpsc_ajax.ajaxurl, data, function(response) { }); wpsc_shipping_same_as_billing(); } else { var data = { action: 'wpsc_shipping_same_as_billing', wpsc_shipping_same_as_billing: false }; jQuery.post(wpsc_ajax.ajaxurl, data, function(response) { }); jQuery(this).parents('table:first').find('tr').show(); jQuery('.shipping_country_name').show(); jQuery('#shippingsameasbillingmessage').hide(); jQuery("select[title='billingregion'], select[title='billingstate'], select[title='billingcountry'], input[title='billingstate']").die( 'change', wpsc_shipping_same_as_billing ); jQuery("input[title='billingfirstname'], input[title='billinglastname'], textarea[title='billingaddress'], input[title='billingcity'], input[title='billingpostcode'], input[title='billingphone'], input[title='billingfirstname'], input[title='billingstate']").unbind('change', wpsc_shipping_same_as_billing).unbind('keyup', wpsc_shipping_same_as_billing); } wpsc_update_shipping_quotes(); }); /** * Update shipping quotes when "Shipping same as Billing" is checked or unchecked. * @since 3.8.8 */ function wpsc_update_shipping_quotes() { var original_shipping_region = jQuery('select#region'); var original_shipping_zip = jQuery('input#zipcode'); var original_country = jQuery('select#current_country'); var shipping_same_as_billing_region = jQuery('input[title="shippingstate"]'); var shipping_same_as_billing_zip = jQuery('input[title="shippingpostcode"]'); var shipping_same_as_billing_country = jQuery('input[title="shippingcountry"]'); jQuery('p.validation-error').remove(); //Checks if state and ZIP are different than the initial shipping state/ZIP. We can simply return if they are the same. if ( original_shipping_region.val() == shipping_same_as_billing_region.val() && original_shipping_zip.val() == shipping_same_as_billing_zip.val() ) return; if ( ! jQuery('input#shippingSameBilling').is(':checked') ) return; //Update shipping quotes var data = { action : 'shipping_same_as_billing_update', region : shipping_same_as_billing_region.val(), country : shipping_same_as_billing_country.val(), zipcode : shipping_same_as_billing_zip.val() }; var success = function(response) { // If the the data pushed through results in no shipping quotes, display error. if ( '0' == response ) { //No shipping quotes were returned, display an error. jQuery('input#shippingSameBilling').after( '

' + wpsc_ajax.no_quotes + '

' ); } else if ('-1' !== response) { jQuery('table.productcart:eq(0)').html( response ); } jQuery('img.ajax-feedback').remove(); }; jQuery('input#shippingSameBilling').after( '' ); jQuery.post(wpsc_ajax.ajaxurl, data, success, 'html'); } // Submit the product form using AJAX jQuery("form.product_form, .wpsc-add-to-cart-button-form").live('submit', function() { // we cannot submit a file through AJAX, so this needs to return true to submit the form normally if a file formfield is present file_upload_elements = jQuery.makeArray(jQuery('input[type="file"]', jQuery(this))); if(file_upload_elements.length > 0) { return true; } else { form_values = jQuery(this).serialize(); // Sometimes jQuery returns an object instead of null, using length tells us how many elements are in the object, which is more reliable than comparing the object to null if(jQuery('#fancy_notification').length == 0) { jQuery('div.wpsc_loading_animation',this).css('visibility', 'visible'); } jQuery.post( 'index.php?ajax=true', form_values, function(returned_data) { eval(returned_data); jQuery('div.wpsc_loading_animation').css('visibility', 'hidden'); if(jQuery('#fancy_notification') != null) { jQuery('#loading_animation').css("display", 'none'); //jQuery('#fancy_notificationimage').css("display", 'none'); } }); wpsc_fancy_notification(this); return false; } }); jQuery('a.wpsc_category_link, a.wpsc_category_image_link').click(function(){ product_list_count = jQuery.makeArray(jQuery('ul.category-product-list')); if(product_list_count.length > 0) { jQuery('ul.category-product-list', jQuery(this).parent()).toggle(); return false; } }); // this is for storing data with the product image, like the product ID, for things like dropshop and the the ike. jQuery("form.product_form").livequery(function(){ product_id = jQuery('input[name="product_id"]',this).val(); image_element_id = 'product_image_'+product_id; jQuery("#"+image_element_id).data("product_id", product_id); parent_container = jQuery(this).parents('div.product_view_'+product_id); jQuery("div.item_no_image", parent_container).data("product_id", product_id); }); //jQuery("form.product_form").trigger('load'); // Toggle the additional description content jQuery("a.additional_description_link").click(function() { parent_element = jQuery(this).parent(".additional_description_container, .additional_description_span"); jQuery('.additional_description',parent_element).slideToggle('fast'); return false; }); // update the price when the variations are altered. jQuery(".wpsc_select_variation").live('change', function() { jQuery('option[value="0"]', this).attr('disabled', 'disabled'); var parent_form = jQuery(this).closest("form.product_form"); if ( parent_form.length == 0 ) return; var prod_id = jQuery("input[name='product_id']",parent_form).val(); var form_values =jQuery("input[name='product_id'], .wpsc_select_variation",parent_form).serialize( ); jQuery.post( 'index.php?update_product_price=true', form_values, function(response) { var stock_display = jQuery('div#stock_display_' + prod_id), price_field = jQuery('input#product_price_' + prod_id), price_span = jQuery('#product_price_' + prod_id + '.pricedisplay, #product_price_' + prod_id + ' .currentprice'), donation_price = jQuery('input#donation_price_' + prod_id), old_price = jQuery('#old_product_price_' + prod_id), save = jQuery('#yousave_' + prod_id), buynow = jQuery('#BB_BuyButtonForm' + prod_id); if ( response.variation_found ) { if ( response.stock_available ) { stock_display.removeClass('out_of_stock').addClass('in_stock'); } else { stock_display.addClass('out_of_stock').removeClass('in_stock'); } } stock_display.html(response.variation_msg); if ( response.price !== undefined ) { if (price_field.length && price_field.attr('type') == 'text') { price_field.val(response.numeric_price); old_price.parent().hide(); save.parent().hide(); } else { price_span.html(response.price); old_price.html(response.old_price); save.html(response.you_save); if (response.numeric_old_price > response.numeric_price) { old_price.parent().show(); save.parent().show(); } else { old_price.parent().hide(); save.parent().hide(); } } donation_price.val(response.numeric_price); } }, 'json'); }); // Object frame destroying code. jQuery("div.shopping_cart_container").livequery(function(){ object_html = jQuery(this).html(); window.parent.jQuery("div.shopping-cart-wrapper").html(object_html); }); // Ajax cart loading code. jQuery("div.wpsc_cart_loading").livequery(function(){ form_values = "ajax=true" jQuery.post( 'index.php?wpsc_ajax_action=get_cart', form_values, function(returned_data) { eval(returned_data); }); }); // Object frame destroying code. jQuery("form.wpsc_product_rating").livequery(function(){ jQuery(this).rating(); }); jQuery("form.wpsc_empty_the_cart").livequery(function(){ jQuery(this).submit(function() { form_values = "ajax=true&"; form_values += jQuery(this).serialize(); jQuery.post( 'index.php', form_values, function(returned_data) { eval(returned_data); }); return false; }); }); jQuery("form.wpsc_empty_the_cart a.emptycart").live('click',function(){ parent_form = jQuery(this).parents("form.wpsc_empty_the_cart"); form_values = "ajax=true&"; form_values += jQuery(parent_form).serialize(); jQuery.post( 'index.php', form_values, function(returned_data) { eval(returned_data); }); return false; }); //Shipping bug fix by James Collins var radios = jQuery(".productcart input:radio[name='shipping_method']"); if (radios.length == 1) { // If there is only 1 shipping quote available during checkout, automatically select it jQuery(radios).click(); } else if (radios.length > 1) { // There are multiple shipping quotes, simulate a click on the checked one jQuery(".productcart input:radio[name='shipping_method']:checked").click(); } }); // update the totals when shipping methods are changed. function switchmethod( key, key1 ){ data = { ajax : 'true', wpsc_ajax_action : 'update_shipping_price', option : key, method : key1 } jQuery.post( 'index.php', data, function(returned_data) { eval(returned_data); }); } // submit the country forms. function submit_change_country(){ document.forms.change_country.submit(); } // submit the fancy notifications forms. function wpsc_fancy_notification(parent_form){ if(typeof(WPSC_SHOW_FANCY_NOTIFICATION) == 'undefined'){ WPSC_SHOW_FANCY_NOTIFICATION = true; } if((WPSC_SHOW_FANCY_NOTIFICATION == true) && (jQuery('#fancy_notification') != null)){ var options = { margin: 1 , border: 1 , padding: 1 , scroll: 1 }; form_button_id = jQuery(parent_form).attr('id') + "_submit_button"; var button_offset = jQuery('#'+form_button_id).offset(); jQuery('#fancy_notification').css("left", (button_offset.left - 130) + 'px'); jQuery('#fancy_notification').css("top", (button_offset.top + 40) + 'px'); jQuery('#fancy_notification').css("display", 'block'); jQuery('#loading_animation').css("display", 'block'); jQuery('#fancy_notification_content').css("display", 'none'); } } function shopping_cart_collapser() { switch(jQuery("#sliding_cart").css("display")) { case 'none': jQuery("#sliding_cart").slideToggle("fast",function(){ jQuery.post( 'index.php', "ajax=true&set_slider=true&state=1", function(returned_data) { }); jQuery("#fancy_collapser").attr("src", (WPSC_CORE_IMAGES_URL + "/minus.png")); }); break; default: jQuery("#sliding_cart").slideToggle("fast",function(){ jQuery.post( 'index.php', "ajax=true&set_slider=true&state=0", function(returned_data) { }); jQuery("#fancy_collapser").attr("src", (WPSC_CORE_IMAGES_URL + "/plus.png")); }); break; } return false; } function set_billing_country(html_form_id, form_id){ var billing_region = ''; country = jQuery(("div#"+html_form_id+" select[class='current_country']")).val(); region = jQuery(("div#"+html_form_id+" select[class='current_region']")).val(); if(/[\d]{1,}/.test(region)) { billing_region = "&billing_region="+region; } form_values = "wpsc_ajax_action=change_tax&form_id="+form_id+"&billing_country="+country+billing_region; jQuery.post( 'index.php', form_values, function(returned_data) { eval(returned_data); if(jQuery("#shippingSameBilling").is(':checked')){ jQuery('.shipping_region').parent().parent().hide(); jQuery('.shipping_country_name').parent().parent().hide(); } }); } function set_shipping_country(html_form_id, form_id){ var shipping_region = ''; country = jQuery(("div#"+html_form_id+" select[class='current_country']")).val(); if(country == 'undefined'){ country = jQuery("select[title='billingcountry']").val(); } region = jQuery(("div#"+html_form_id+" select[class='current_region']")).val(); if(/[\d]{1,}/.test(region)) { shipping_region = "&shipping_region="+region; } form_values = { wpsc_ajax_action: "change_tax", form_id: form_id, shipping_country: country, shipping_region: region } jQuery.post( 'index.php', form_values, function(returned_data) { eval(returned_data); if(jQuery("#shippingSameBilling").is(':checked')){ jQuery('.shipping_region').parent().parent().hide(); jQuery('.shipping_country_name').parent().parent().hide(); } }); } function wpsc_set_profile_country(html_form_id, form_id) { var country_field = jQuery('#' + html_form_id); var form_values = { wpsc_ajax_action : "change_profile_country", form_id : form_id, country : country_field.val() }; jQuery.post(location.href, form_values, function(response) { country_field.siblings('select').remove(); if (response.has_regions) { country_field.after('
' + response.html); jQuery('input[name="collected_data[' + response.region_field_id + ']"]').closest('tr').hide(); } else { jQuery('input[name="collected_data[' + response.region_field_id + ']"]').closest('tr').show(); } }, 'json'); } jQuery(document).ready(function(){ jQuery('.wpsc_checkout_table input, .wpsc_checkout_table textarea').each(function(){ var real_value = jQuery(this).val(); value = jQuery('label[for="'+jQuery(this).attr('id')+'"]').text(); if( jQuery.fn.inlineFieldLabel ) jQuery(this).inlineFieldLabel({label:jQuery.trim(value)}); if(real_value != '') jQuery(this).val(real_value).removeClass('intra-field-label'); }); }); //Javascript for variations: bounce the variation box when nothing is selected and return false for add to cart button. jQuery(document).ready(function(){ jQuery('.productcol, .textcol, .product_grid_item, .wpsc-add-to-cart-button').each(function(){ jQuery('.wpsc_buy_button', this).click(function(){ var dropdowns = jQuery(this).closest('form').find('.wpsc_select_variation'); var not_selected = false; dropdowns.each(function(){ var t = jQuery(this); if(t.val() <= 0){ not_selected = true; t.css('position','relative'); t.animate({'left': '-=5px'}, 50, function(){ t.animate({'left': '+=10px'}, 100, function(){ t.animate({'left': '-=10px'}, 100, function(){ t.animate({'left': '+=10px'}, 100, function(){ t.animate({'left': '-=5px'}, 50); }); }); }); }); } }); if (not_selected) return false; }); }); }); jQuery(document).ready(function(){ jQuery('.attachment-gold-thumbnails').click(function(){ jQuery(this).parents('.imagecol:first').find('.product_image').attr('src', jQuery(this).parent().attr('rev')); jQuery(this).parents('.imagecol:first').find('.product_image').parent('a:first').attr('href', jQuery(this).parent().attr('href')); return false; }); }); //MD5 function for gravatars eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('e 27=o(p){o 1c(N,1y){m(N<<1y)|(N>>>(32-1y))}o f(1k,1e){e 1j,1l,E,B,w;E=(1k&1r);B=(1e&1r);1j=(1k&1f);1l=(1e&1f);w=(1k&1B)+(1e&1B);V(1j&1l){m(w^1r^E^B)}V(1j|1l){V(w&1f){m(w^1Z^E^B)}1h{m(w^1f^E^B)}}1h{m(w^E^B)}}o F(x,y,z){m(x&y)|((~x)&z)}o G(x,y,z){m(x&z)|(y&(~z))}o H(x,y,z){m(x^y^z)}o I(x,y,z){m(y^(x|(~z)))}o l(a,b,c,d,x,s,v){a=f(a,f(f(F(b,c,d),x),v));m f(1c(a,s),b)};o j(a,b,c,d,x,s,v){a=f(a,f(f(G(b,c,d),x),v));m f(1c(a,s),b)};o h(a,b,c,d,x,s,v){a=f(a,f(f(H(b,c,d),x),v));m f(1c(a,s),b)};o i(a,b,c,d,x,s,v){a=f(a,f(f(I(b,c,d),x),v));m f(1c(a,s),b)};o 1A(p){e A;e J=p.1g;e 1q=J+8;e 1D=(1q-(1q%1G))/1G;e 1m=(1D+1)*16;e t=1z(1m-1);e K=0;e q=0;24(q>>29;m t};o W(N){e 1n="",1o="",1p,M;1v(M=0;M<=3;M++){1p=(N>>>(M*8))&1X;1o="0"+1p.1U(16);1n=1n+1o.1V(1o.1g-2,2)}m 1n};o 1C(p){p=p.1W(/\\r\\n/g,"\\n");e u="";1v(e n=0;n1T)&&(c<25)){u+=D.C((c>>6)|26);u+=D.C((c&1s)|1i)}1h{u+=D.C((c>>12)|2c);u+=D.C(((c>>6)&1s)|1i);u+=D.C((c&1s)|1i)}}m u};e x=1z();e k,1t,1u,1x,1w,a,b,c,d;e Z=7,Y=12,19=17,L=22;e S=5,R=9,Q=14,P=20;e T=4,U=11,X=16,O=23;e 18=6,1b=10,1a=15,1d=21;p=1C(p);x=1A(p);a=2d;b=2b;c=2a;d=28;1v(k=0;k