function check_make_purchase_button(){toggle=jQuery('#noca_gateway').attr('checked');if(toggle==true){jQuery('#OCPsubmit').show();}else{jQuery('.make_purchase').show();jQuery('#OCPsubmit').hide();}}
jQuery(document).ready(function(){jQuery("#shippingSameBilling").click(function(){jQuery('.wpsc_shipping_forms').show();jQuery("#shippingSameBilling").livequery(function(){if(jQuery(this).is(":checked")){var fname=jQuery("input[title='billingfirstname']").val();var lname=jQuery("input[title='billinglastname']").val();var addr=jQuery("textarea[title='billingaddress']").val();var city=jQuery("input[title='billingcity']").val();var pcode=jQuery("input[title='billingpostcode']").val();var phone=jQuery("input[title='billingphone']").val();var email=jQuery("input[title='billingfirstname']").val();var state=jQuery("select[title='billingregion'] :selected").text();var country=jQuery("select[title='billingcountry'] :selected").text();var countryID=jQuery("select[title='billingcountry'] :selected").val();jQuery("input[title='shippingfirstname']").val(fname);jQuery("input[title='shippinglastname']").val(lname);jQuery("textarea[title='shippingaddress']").val(addr);jQuery("input[title='shippingcity']").val(city);jQuery("input[title='shippingpostcode']").val(pcode);jQuery("input[title='shippingphone']").val(phone);jQuery("input[title='shippingemail']").val(email);jQuery("input[title='shippingstate']").val(state);jQuery("input.shipping_country").val(countryID);jQuery("span.shipping_country_name").html(country);jQuery("select#current_country").val(countryID);jQuery("select[title='shippingcountry']").val(countryID);var html_form_id=jQuery("select[title='shippingcountry']").attr('id');var form_id=jQuery("select[title='shippingcountry']").attr('name');form_id=form_id.replace("collected_data[","");form_id=form_id.replace("]","");form_id=form_id.replace("[0]","");set_shipping_country(html_form_id,form_id)
if(jQuery("select[title='billingcountry'] :selected").val()!=jQuery("select[name='country'] :selected").val()){id=jQuery("select[name='country'] :selected").val();if(id=='undefined'){jQuery("select[name='country']").val(countryID);submit_change_country();}}}else{}});});jQuery("form.product_form").submit(function(){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();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');}});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;}});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("a.additional_description_link").click(function(){parent_element=jQuery(this).parent('.additional_description_span');jQuery('.additional_description',parent_element).toggle();return false;});jQuery("div.wpsc_variation_forms .wpsc_select_variation").change(function(){parent_form=jQuery(this).parents("form.product_form");form_values=jQuery("input[name=product_id],div.wpsc_variation_forms .wpsc_select_variation",parent_form).serialize();jQuery.post('index.php?update_product_price=true',form_values,function(returned_data){eval(returned_data);if(product_id!=null){target_id="product_price_"+product_id;second_target_id="donation_price_"+product_id;buynow_id="BB_BuyButtonForm"+product_id;if(jQuery("input#"+target_id).attr('type')=='text'){jQuery("input#"+target_id).val(numeric_price);}else{jQuery("#"+target_id+".pricedisplay").html(price);}
jQuery("input#"+second_target_id).val(numeric_price);}});return false;});jQuery("div.shopping_cart_container").livequery(function(){object_html=jQuery(this).html();window.parent.jQuery("div.shopping-cart-wrapper").html(object_html);});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);});});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 span.emptycart a").livequery(function(){jQuery(this).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;});});var radios=jQuery(".productcart input:radio[name=shipping_method]");if(radios.length==1){jQuery(radios).click();}else if(radios.length>1){jQuery(".productcart input:radio[name=shipping_method]:checked").click();}});function switchmethod(key,key1){form_values="ajax=true&";form_values+="wpsc_ajax_action=update_shipping_price&";form_values+="key1="+key1+"&";form_values+="key="+key;jQuery.post('index.php',form_values,function(returned_data){eval(returned_data);});}
function submit_change_country(){document.forms.change_country.submit();}
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 container_offset={};new_container_offset=jQuery('#products_page_container').offset(options,container_offset);if(container_offset['left']==null){container_offset['left']=new_container_offset.left;container_offset['top']=new_container_offset.top;}
var button_offset={};new_button_offset=jQuery('#'+form_button_id).offset(options,button_offset)
if(button_offset['left']==null){button_offset['left']=new_button_offset.left;button_offset['top']=new_button_offset.top;}
jQuery('#fancy_notification').css("left",(button_offset['left']-container_offset['left']+10)+'px');jQuery('#fancy_notification').css("top",((button_offset['top']-container_offset['top'])-60)+'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_URL+"/images/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_URL+"/images/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);});}
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;jQuery.post('index.php',form_values,function(returned_data){eval(returned_data);});}
