String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")};function CheckBillingShippingDetails(){var w=document.getElementById("checkDetails").checked;var j=document.getElementById("name1").value;j=j.trim();var l=document.getElementById("name2").value;l=l.trim();var q=document.getElementById("add1").value;q=q.trim();var p=document.getElementById("add2").value;p=p.trim();var a=document.getElementById("billing_country").value;var o=document.getElementById("billing_state").value;var m=document.getElementById("billing_city").value;m=m.trim();var n=document.getElementById("billing_postcode").value;n=n.trim();var f=document.getElementById("billing_std").value;f=f.trim();var r=document.getElementById("billing_phone").value;r=r.trim();var k=document.getElementById("billing_mobile").value;k=k.trim();var u=document.getElementById("name3").value;u=u.trim();var x=document.getElementById("name4").value;x=x.trim();var c=document.getElementById("add3").value;c=c.trim();var b=document.getElementById("add4").value;b=b.trim();var h=document.getElementById("shipping_country").value;var t=document.getElementById("shipping_state").value;var s=document.getElementById("shipping_city").value;s=s.trim();var g=document.getElementById("shipping_postcode").value;g=g.trim();var d=document.getElementById("shipping_std").value;d=d.trim();var v=document.getElementById("shipping_phone").value;v=v.trim();var e=document.getElementById("shipping_mobile").value;e=e.trim();if(j==""){alert("Please Enter First Name (Billing) ");document.getElementById("name1").value="";document.getElementById("name1").focus();Error=true;return false}if(l==""){alert("Please Enter Last Name (Billing) ");document.getElementById("name2").value="";document.getElementById("name2").focus();Error=true;return false}if(q==""){alert("Please Enter Address Line 1 (Billing) ");document.getElementById("add1").value="";document.getElementById("add1").focus();Error=true;return false}if(p==""){alert("Please Enter Address Line 2  (Billing)");document.getElementById("add2").value="";document.getElementById("add2").focus();Error=true;return false}if(a==""){alert("Please Select Billing Country");document.getElementById("billing_country").value="";document.getElementById("billing_country").focus();Error=true;return false}if(o==""){alert("Please Select Billing State");document.getElementById("billing_state").value="";document.getElementById("billing_state").focus();Error=true;return false}if(m==""){alert("Please Select Billing City ");document.getElementById("billing_city").value="";document.getElementById("billing_city").focus();Error=true;return false}if(n==""){alert("Please Enter Billing Post Code");document.getElementById("billing_postcode").value="";document.getElementById("billing_postcode").focus();Error=true;return false}if(f==""||isNaN(f)||f==0){alert("Please Enter Valid STD Code (Billing)");document.getElementById("billing_std").value="";document.getElementById("billing_std").focus();Error=true;return false}if(r==""||isNaN(r)||r==0){alert("Please Enter Valid Phone Number (Billing)");document.getElementById("billing_phone").value="";document.getElementById("billing_phone").focus();Error=true;return false}if(k==""||isNaN(k)||k==0){alert("Please Enter Valid Mobile Number (Billing)");document.getElementById("billing_mobile").value="";document.getElementById("billing_mobile").focus();Error=true;return false}if(u==""){alert("Please Enter First Name (Shipping) ");document.getElementById("name3").value="";document.getElementById("name3").focus();Error=true;return false}if(x==""){alert("Please Enter Last Name (Shipping) ");document.getElementById("name4").value="";document.getElementById("name4").focus();Error=true;return false}if(c==""){alert("Please Enter Address Line 1 (Shipping) ");document.getElementById("add3").value="";document.getElementById("add3").focus();Error=true;return false}if(b==""){alert("Please Enter Address Line 2 (Shipping) ");document.getElementById("add4").value="";document.getElementById("add4").focus();Error=true;return false}if(h==""){alert("Please Select Shipping Country ");document.getElementById("shipping_country").value="";document.getElementById("shipping_country").focus();Error=true;return false}if(t==""){alert("Please Select Shipping State ");document.getElementById("shipping_state").value="";document.getElementById("shipping_state").focus();Error=true;return false}if(s==""){alert("Please Select Shipping City ");document.getElementById("shipping_city").value="";document.getElementById("shipping_city").focus();Error=true;return false}if(g==""){alert("Please Enter Post code (Shipping) ");document.getElementById("shipping_postcode").value="";document.getElementById("shipping_postcode").focus();Error=true;return false}if(d==""||isNaN(d)||d==0){alert("Please Enter Valid STD Code (Shipping) ");document.getElementById("shipping_std").value="";document.getElementById("shipping_std").focus();Error=true;return false}if(v==""||isNaN(v)||v==0){alert("Please Enter Valid Phone (Shipping) ");document.getElementById("shipping_phone").value="";document.getElementById("shipping_phone").focus();Error=true;return false}if(e==""||isNaN(e)||e==0){alert("Please Enter Valid Mobile Number (Shipping) ");document.getElementById("shipping_mobile").value="";document.getElementById("shipping_mobile").focus();Error=true;return false}if(document.getElementById("checkDetails").checked==true){if(j!=u){alert("Billing And Shipping First Name Must Be Same");document.getElementById("name3").value="";document.getElementById("name3").focus();Error=true;return false}if(l!=x){alert("Billing And Shipping Last Name Must Be Same");document.getElementById("name4").value="";document.getElementById("name4").focus();Error=true;return false}if(q!=c){alert("Billing And Shipping Address Must Be Same");document.getElementById("add3").value="";document.getElementById("add3").focus();Error=true;return false}if(p!=b){alert("Billing And Shipping Address Must Be Same");document.getElementById("add4").value="";document.getElementById("add4").focus();Error=true;return false}if(a!=h){alert("Billing And Shipping Country Must Be Same");document.getElementById("shipping_country").value="";document.getElementById("shipping_country").focus();Error=true;return false}if(o!=t){alert("Billing And Shipping State Must Be Same");document.getElementById("shipping_state").value="";document.getElementById("shipping_state").focus();Error=true;return false}if(m!=s){alert("Billing And Shipping City Must Be Same");document.getElementById("shipping_city").value="";document.getElementById("shipping_city").focus();Error=true;return false}if(n!=g){alert("Billing And Shipping Postal/Zip Code Must Be Same");document.getElementById("shipping_postcode").value="";document.getElementById("shipping_postcode").focus();Error=true;return false}if(f!=d){alert("Billing And Shipping STD Code Must Be Same");document.getElementById("shipping_std").value="";document.getElementById("shipping_std").focus();Error=true;return false}if(r!=v){alert("Billing And Shipping Phone Must Be Same");document.getElementById("shipping_phone").value="";document.getElementById("shipping_phone").focus();Error=true;return false}if(k!=e){alert("Billing And Shipping Mobile Number Must Be Same");document.getElementById("shipping_mobile").value="";document.getElementById("shipping_mobile").focus();Error=true;return false}}}function CheckBillingCountry(a){var b="ajax_countrystatecity.html?flag=checkout_billing_country&country_name="+a;var c="ajax_countrystatecity.html?flag=checkout_billing_countryCity&country_name="+a;validate(b,"selectbillingstate","GET",null);validate(c,"selectbillingcity","GET",null)}function CheckBillingState(b){if(b=="Other State"){var a="ajax_countrystatecity.html?flag=other_billing_state";validate(a,"selectbillingstate","GET",null)}}function GenerateBillingCity(c,b){if(c=="Other State"){var a="ajax_countrystatecity.html?flag=other_billing_city"}else{if(c==""){var a="ajax_countrystatecity.html?flag=other_billing_state_null"}else{var a="ajax_countrystatecity.html?flag=billingcity&StateName="+c+"&country_id="+b}}validate(a,"selectbillingcity","GET",null)}function CheckBillingCity(b){if(b=="Other City"){var a="ajax_countrystatecity.html?flag=other_billing_city";validate(a,"selectbillingcity","GET",null)}}function SetBillingState(a){document.getElementById("BillingStateSelected").value=a}function SetBillingCity(a){document.getElementById("BillingCitySelected").value=a}function CheckShippingCountry(a){var b="ajax_countrystatecity.html?flag=checkout_shipping_country&country_name="+a;var c="ajax_countrystatecity.html?flag=checkout_shipping_countryCity&country_name="+a;validate(b,"selectshippingstate","GET",null);validate(c,"selectshippingcity","GET",null)}function CheckShippingState(b){if(b=="Other State"){var a="ajax_countrystatecity.html?flag=other_shipping_state";validate(a,"selectshippingstate","GET",null)}}function GenerateShippingCity(c,b){if(c=="Other State"){var a="ajax_countrystatecity.html?flag=other_shipping_city"}else{if(c==""){var a="ajax_countrystatecity.html?flag=other_shipping_state_null"}else{var a="ajax_countrystatecity.html?flag=shippingcity&StateName="+c+"&country_id="+b}}validate(a,"selectshippingcity","GET",null)}function CheckShippingCity(b){if(b=="Other City"){var a="ajax_countrystatecity.html?flag=other_shipping_city";validate(a,"selectshippingcity","GET",null)}}function SetShippingState(a){document.getElementById("ShippingStateSelected").value=a}function SetShippingCity(a){document.getElementById("ShippingCitySelected").value=a}function printpage(){window.print()}function CheckData(){var b=false;var a=document.getElementById("myform").step.length;for(i=0;i<a;i++){if(document.getElementById("myform").step[i].checked==true){b=true}}if(b==false){alert("Please select a payment method");return false}return true};