////////////////////////////////////////// // COPYRIGHT 2005 - M.H. & G.O. FOR CVP // ////////////////////////////////////////// function hideddrivetip(){ } function ddrivetip(){} function loadreadystate(){ document.loadedcheck.isloaded.value = 'NOPEWNIE'; } function protect(e) { if(event.button==2) { alert("(C) Creative Video. Our images cannot legally be copied without our prior permission."); return false; } } function trap() { if(document.images) for(i=0;i 0 && req.readyState < 4) req.abort(); // kill if 1,2,3 req.open('get', 'checkout_finance_ajax.php?finance_productID='+finance_productID+'&order_zone='+order_zone+'&order_total='+order_total+'&order_total_ex='+order_total_ex); req.onreadystatechange = handleResponse; req.send(null); } function store_wp_deposit_amount(orderID,deposit_amount){ req.open('get', 'worldpay_ajax.php?do='+store_wp_deposit_amount+'&orderID='+orderID+'&deposit_amount='+deposit_amount); req.onreadystatechange = do_nothing; req.send(null); } function show_small_basket() { req.open('get', 'basket_functions_ajax.php?do=show_small_basket', true); //req2.open('get', 'basket2.php'); req.onreadystatechange = handleResponse; req.send(null); // setTimeout('show_small_quotation()',2000); if (debugmode == 'yes') {alert('showing small basket');} } function update_basket2() { req.open('get', 'basket_functions_ajax.php?do=update_small_basket', true); whereto= "yourbasket22"; req.onreadystatechange = handleResponse; req.send(null); } function show_bank(card) { abort_the_bastard(); req.open('get', 'bin_finder.php?do=find_bank&bin='+card); //, true whereto= "card"; req.onreadystatechange = handleResponse; req.send(null); } function check_company(postcode,company_number){ req.open('get', 'companies_house_parse2.php?comppostcode='+postcode+'&compnumber='+company_number); // var temp = '

' // scroll(0,0) // document.getElementById("company").innerHTML = temp; whereto= "company"; req.onreadystatechange = handleResponse; req.send(null); } function check_company3(postcode,company_number){ req.open('get', 'companies_house_parse3.php?comppostcode='+postcode+'&compnumber='+company_number); // var temp = '

' // scroll(0,0) // document.getElementById("company").innerHTML = temp; whereto= "company"; req.onreadystatechange = handleResponse; req.send(null); } function check_postcode(p) { var postcodeRegEx = /(^[A-Z]{1,2}[0-9]{1,2})([0-9][A-Z]{2}$)/i; var post=p.toUpperCase(); document.cvp.company_postcode.value=post.replace(postcodeRegEx,"$1 $2");; } function check_vat(vat_number){ req.open('get', 'check_vat_ajax.php?vat_number='+vat_number); // var temp = '

' // scroll(0,0) // document.getElementById("vat_check").innerHTML = temp; whereto= "vat_check"; req.onreadystatechange = handleResponse; req.send(null); } function show_quantity_mic(productID) { req.open('get', 'show_the_quantity.php?do=show_public_quantity&productID='+productID); //req.open('get', 'basket2.php'); req.onreadystatechange = handleResponse; req.send(null); } function hide_quantity_mic(productID) { req.open('get', 'show_the_quantity.php?do=hide_public_quantity&productID='+productID); //req.open('get', 'basket2.php'); req.onreadystatechange = handleResponse; req.send(null); } function do_nothing() { } /* function gobasket(ugabuga){ if (isdefined(ugabuga)){ window.location=('http://www.creativevideo.co.uk/public/basket_script.php?parameter=' + ugabuga); } else { window.location=('http://www.creativevideo.co.uk/public/basket_script.php'); } } */ function gobasket(ugabuga){ if (isdefined(ugabuga)){ window.location=('http://www.creativevideo.co.uk/public/checkout.secure?parameter=' + ugabuga); } else { window.location=('http://www.creativevideo.co.uk/public/checkout.secure'); } } function gocheckout(){ window.location='http://www.creativevideo.co.uk/public/checkout.secure'; } //function goquote(){ // window.location='http://www.creativevideo.co.uk/public/view_quote.php'; //} function goquote(ugabuga){ if (isdefined(ugabuga)){ window.location=('http://www.creativevideo.co.uk/public/view_quote.php?parameter=' + ugabuga); } else { window.location=('http://www.creativevideo.co.uk/public/view_quote.php'); } } function gosubmitquote(){ window.location='http://www.creativevideo.co.uk/public/submit_quote.php'; } ///////////////////////////////////////////////////////////////////////////////////////////////////////////// function add_to_basket(productID, product_name, price, qty) { if(document.loadedcheck.isloaded.value == 'NOPEWNIE') { var what = 'blahka = check_if_loaded(\'basket\');' var temp = '






Please be patient, Loading

Please click here if it takes more than 3 seconds
' scroll(0,0) document.getElementById("content").innerHTML = temp; // qty = document.add.quantity.options[document.add.quantity.selectedIndex].value //abort_the_bastard() req.open('get', 'basket_functions_ajax.php?do=add_to_basket&productID='+productID+'@'+product_name+'@'+price+'@'+qty); req.onreadystatechange = handleResponse; req.send(null); } } function add_to_basket_pop(productID,qty) { req.open('get', 'basket_functions_ajax.php?do=add_to_basket_pop&productID='+productID+'&qty='+qty); req.onreadystatechange = handleResponse; // or do_nothing ?? req.send(null); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////// function add_promo_to_basket(productID, product_name, price, qty, promoID) { var what = 'blahka = check_if_loaded(\'basket\');' scroll(0,0) var temp = '






Please be patient, Loading

Please click here if it takes more than 3 seconds
' document.getElementById("content").innerHTML = temp; // qty = document.add.quantity.options[document.add.quantity.selectedIndex].value abort_the_bastard() req.open('get', 'basket_functions_ajax.php?do=add_promo_to_basket&productID='+productID+'@'+product_name+'@'+price+'@'+qty+'@'+promoID); req.onreadystatechange = do_nothing; req.send(null); if(document.kiepskizartajax.naprawdekiepskizartajax.value == 'NOPEWNIE'){ var delay_timeout; delay_timeout = (1000); setTimeout('gobasket();',delay_timeout); } if (debugmode == 'yes') {alert('adding to basket');} } //////////////////////////////////////////////////// function optional_basket(productID, product_name, price, qty, parentID, czeked) { var kontrola = czeked; if (kontrola == true){ //add_optional_to_basket(productID, product_name, price, qty, parentID); add_to_basket(productID, product_name, price, qty) setTimeout('show_small_basket()',2000); } else { req.open('get', 'basket_functions_ajax.php?do=remove_optional_from_basket&productID='+productID); req.onreadystatechange = do_nothing; req.send(null); } } function add_optional_to_basket(productID, product_name, price, qty, parentID) { // qty = document.add.quantity.options[document.add.quantity.selectedIndex].value abort_the_bastard() req.open('get', 'basket_functions_ajax.php?do=add_optional_to_basket&productID='+productID+'@'+product_name+'@'+price+'@'+qty+'&parentID='+parentID); req.onreadystatechange = do_nothing; req.send(null); } function remove_from_basket(id) {// id=refID var what = 'blahka = check_if_loaded(\'basket\');' scroll(0,0) var temp = '






Loading

Please click here if it takes more than 3 seconds
' document.getElementById("content").innerHTML = temp; abort_the_bastard() req.open('get', 'basket_functions_ajax.php?do=remove_from_basket&refID='+id); req.onreadystatechange = do_nothing; req.send(null); delay_timeout = (1000); setTimeout('gocheckout();',delay_timeout); } function updatequantity(id,qty) { // id=refID and manot need quantity if use document.form.quantity.options[etc /* var qty = document.('form'+'id').('qty'+'id').value */ scroll(0,0) var what = 'blahka = check_if_loaded(\'basket\');' var temp = '






Loading

Please click here if it takes more than 3 seconds
' document.getElementById("content").innerHTML = temp; abort_the_bastard() req.open('get', 'basket_functions_ajax.php?do=update_quantity&refID='+id+'&quantity='+qty); req.onreadystatechange = do_nothing; req.send(null); delay_timeout = (1000); setTimeout('gocheckout();',delay_timeout); } function update_shipping(shippingID) { if(document.loadedcheck.isloaded.value == 'NOPEWNIE') { scroll(0,0) var what = 'blahka = check_if_loaded(\'checkout\');' var temp = '






Loading

Please click here if it takes more than 3 seconds
' document.getElementById("content").innerHTML = temp; // abort_the_bastard() req.open('get', 'basket_functions_ajax.php?do=update_shipping&shippingID='+shippingID); req.onreadystatechange = do_nothing; req.send(null); if(document.kiepskizartajax.naprawdekiepskizartajax.value == 'NOPEWNIE') { var delay_timeout; delay_timeout = (1000); setTimeout('gocheckout();',delay_timeout); } if (debugmode == 'yes') {alert('updating shipping');} } } function update_postcode(postcode) { scroll(0,0) abort_the_bastard() req.open('get', 'basket_functions_ajax.php?do=update_postcode&postcode='+postcode); req.onreadystatechange = do_nothing; req.send(null); if(document.kiepskizartajax.naprawdekiepskizartajax.value == 'NOPEWNIE'){ window.location='http://www.creativevideo.co.uk/public/checkout.secure'; } } function view_item(productID) { req.open('get', 'basket_functions_ajax.php?do=view_item&productID='+productID); req.onreadystatechange = handleResponse; req.send(null); } function show_basket() { scroll(0,0); if (blahka == ""){ document.getElementById("content").innerHTML = '






Loading

Please click here if it takes more than 3 seconds
'; } else { document.getElementById("content").innerHTML = '






Loading

Please click here if it takes more than 3 seconds
'; } abort_the_bastard() req.open('get', 'basket_functions_ajax.php?do=show_basket'); //req.open('get', 'basket2.php'); req.onreadystatechange = do_nothing; req.send(null); if(document.kiepskizartajax.naprawdekiepskizartajax.value == 'NOPEWNIE'){ var delay_timeout; delay_timeout = (1000); setTimeout('gobasket();',delay_timeout); } if (debugmode == 'yes') {alert('showing basket');} } function checkout() { scroll(0,0); document.getElementById("content").innerHTML = '






Loading

Please click here if it takes more than 3 seconds
'; gocheckout(); abort_the_bastard() req.open('get', 'basket_functions_ajax.php?do=checkout'); req.onreadystatechange = do_nothing; req.send(null); if(document.kiepskizartajax.naprawdekiepskizartajax.value == 'NOPEWNIE'){ var delay_timeout; delay_timeout = (1000); setTimeout('gocheckout();',delay_timeout); } if (debugmode == 'yes') {alert('checkout');} } ///////////////////////////////////////////////////////////////////////////////// QUOTE RELATED function show_small_quotation() { // req.open('get', 'quote_functions_ajax.php?do=show_small_quotation', true); //req2.open('get', 'basket2.php'); if (debugmode == 'yes') { alert('Showing small quotation'); } // req.onreadystatechange = handleResponse; // req.send(null); } function show_quotation() { scroll(0,0); document.getElementById("content").innerHTML = '






Loading

Please click here if it takes more than 3 seconds
'; req.open('get', 'quote_functions_ajax.php?do=show_quotation'); //req.open('get', 'basket2.php'); if (debugmode == 'yes') { alert('Showing quotation'); } req.onreadystatechange = do_nothing; req.send(null); if(document.kiepskizartajax.naprawdekiepskizartajax.value == 'NOPEWNIE'){ var delay_timeout; delay_timeout = (1000); setTimeout('goquote();',delay_timeout); } } function submit_quote() { document.getElementById("content").innerHTML = '






Loading

Please click here if it takes more than 3 seconds
'; req.open('get', 'quote_functions_ajax.php?do=submit_quote'); req.onreadystatechange = do_nothing; req.send(null); if(document.kiepskizartajax.naprawdekiepskizartajax.value == 'NOPEWNIE'){ var delay_timeout; delay_timeout = (1000); setTimeout('gosubmitquotequote();',delay_timeout); } } function remove_from_quotation(id) {// id=refID document.getElementById("content").innerHTML = '






Loading

Please click here if it takes more than 3 seconds
'; req.open('get', 'quote_functions_ajax.php?do=remove_from_quotation&refID='+id); req.onreadystatechange = do_nothing; req.send(null); if(document.kiepskizartajax.naprawdekiepskizartajax.value == 'NOPEWNIE'){ var delay_timeout; delay_timeout = (1000); setTimeout('goquote();',delay_timeout); } } function optional_quote(productID, product_name, price, qty, parentID, czeked) { var kontrola = czeked; if (kontrola == true){ add_optional_to_quotation(productID, product_name, price, qty, parentID); //setTimeout('show_small_quotation()',2000); } else { req.open('get', 'quote_functions_ajax.php?do=remove_optional_from_quotation&productID='+productID); req.onreadystatechange = do_nothing; req.send(null); // setTimeout('show_small_quotation()',2000); } } function add_optional_to_quotation(productID, product_name, price, qty, parentID) { // qty = document.add.quantity.options[document.add.quantity.selectedIndex].value req.open('get', 'quote_functions_ajax.php?do=add_optional_to_quotation&productID='+productID+'@'+product_name+'@'+price+'@'+qty+'&parentID='+parentID); req.onreadystatechange = do_nothing; req.send(null); } function add_to_quotation(productID, product_name, qty) { document.getElementById("content").innerHTML = '






Loading

Please click here if it takes more than 3 seconds
'; // qty = document.add.quantity.options[document.add.quantity.selectedIndex].value abort_the_bastard(); req.open('get', 'quote_functions_ajax.php?do=add_to_quotation&productID='+productID+'@'+product_name+'@'+qty); if (debugmode == 'yes') { alert('quote_functions_ajax.php?do=add_to_quotation&productID='+productID+'@'+product_name+'@'+qty); } req.onreadystatechange = do_nothing; req.send(null); if(document.kiepskizartajax.naprawdekiepskizartajax.value == 'NOPEWNIE'){ var delay_timeout; delay_timeout = (1000); setTimeout('goquote();',delay_timeout); } } function updateqquantity(id,qty) { document.getElementById("content").innerHTML = '






Loading

Please click here if it takes more than 3 seconds
'; // id=refID and manot need quantity if use document.form.quantity.options[etc /* var qty = document.('form'+'id').('qty'+'id').value */ req.open('get', 'quote_functions_ajax.php?do=update_quantity&refID='+id+'&quantity='+qty); req.onreadystatechange = do_nothing; req.send(null); delay_timeout = (1000); setTimeout('goquote();',delay_timeout); } function show_admin_quotation() { req.open('get', 'quote_functions_ajax.php?do=show_admin_quotation'); //req.open('get', 'basket2.php'); req.onreadystatechange = handleResponse; req.send(null); } function show_stock_level(orderwise_code) { req.open('get', 'orderwise.web.api.php?orderwise_code='+orderwise_code); req.onreadystatechange = handleResponse; req.send(null) } /* SHIPPING ADDRESS */ function add_billing_address(mid) { // alert("add_billing_address"); req.open('get', 'new_checkout_ajax_functions.php?do=new_billing_address&mid='+mid); req.onreadystatechange = handleResponse; req.send(null); } function save_billing_address(mid,first_name,surname,company,address1,address2,address3,city,county,postcode,country,mobile,landline,email) { req.open('get', 'new_checkout_ajax_functions.php?do=save_billing_address&mid='+mid+'&first_name='+first_name+'&surname='+surname+'&company='+company+'&address1='+address1+'&address2='+address2+'&address3='+address3+'&city='+city+'&county='+county+'&postcode='+postcode+'&country='+country+'&mobile='+mobile+'&landline='+landline+'&email='+email); req.onreadystatechange = handleResponse; req.send(null); } function use_billing_address(addressID) { req.open('get', 'new_checkout_ajax_functions.php?do=use_billing_address&addressID='+addressID); req.onreadystatechange = handleResponse; req.send(null); } function show_left_billing_address(addressID) { req.open('get', 'new_checkout_ajax_functions.php?do=show_left_billing_address&addressID='+addressID); req.onreadystatechange = handleResponse; req.send(null); } /* SHIPPING ADDRESS */ function add_shipping_address(mid) { // alert("add_billing_address"); req.open('get', 'new_checkout_ajax_functions.php?do=new_shipping_address&mid='+mid); req.onreadystatechange = handleResponse; req.send(null); } function save_shipping_address(mid,first_name,surname,company,address1,address2,address3,city,county,postcode,country,mobile,landline,email) { req.open('get', 'new_checkout_ajax_functions.php?do=save_shipping_address&mid='+mid+'&first_name='+first_name+'&surname='+surname+'&company='+company+'&address1='+address1+'&address2='+address2+'&address3='+address3+'&city='+city+'&county='+county+'&postcode='+postcode+'&country='+country+'&mobile='+mobile+'&landline='+landline+'&email='+email); req.onreadystatechange = handleResponse; req.send(null); } function use_shipping_address(addressID) { req.open('get', 'new_checkout_ajax_functions.php?do=use_shipping_address&addressID='+addressID); req.onreadystatechange = handleResponse; req.send(null); } function show_left_shipping_address(addressID) { req.open('get', 'new_checkout_ajax_functions.php?do=show_left_shipping_address&addressID='+addressID); req.onreadystatechange = handleResponse; req.send(null); } function do_flag(flag) { req.open('get', 'new_checkout_ajax_functions.php?do=do_flag&iso='+flag); req.onreadystatechange = handleResponse; req.send(null); } function find_address(type,postcode) { req.open('get', 'new_checkout_ajax_functions.php?do=get_postcode&postcode='+postcode+'&type='+type); req.onreadystatechange = handleResponse; req.send(null); } function show_shipping_methods(orderID){ req.open('get', 'new_checkout_ajax_functions.php?do=show_shipping_methods&orderID='+orderID); req.onreadystatechange = handleResponse; req.send(null); } function use_shipping_method(orderID){ //. check the vars req.open('get', 'new_checkout_ajax_functions.php?do=use_shipping_method&orderID='+orderID); req.onreadystatechange = handleResponse; req.send(null); dotab('step_4'); } function choose_country_form(country_code) // this simplicity is only an example and does cater for the other forms { if(country_code!='826') { hidetab('uk_address'); } else { showtab('uk_address'); } } function billing_address_saver(){ var error=0; var first_name=document.checkout_form.b_first_name.value; if(first_name==""){ error=1; } var surname=document.checkout_form.b_surname.value; if(surname==""){ error=1; } var address1=document.checkout_form.b_address1.value; if(address1==""){ error=1; } var city=document.checkout_form.b_city.value; if(city==""){ error=1; } var postcode=document.checkout_form.b_postcode.value; if(postcode==""){ error=1; } var email=document.checkout_form.b_email.value; if(email==""){ error=1; } var memberID=document.checkout_form.memberID.value; if(error==0) { save_billing_address(memberID,document.checkout_form.b_first_name.value,document.checkout_form.b_surname.value,document.checkout_form.b_company.value,document.checkout_form.b_address1.value,document.checkout_form.b_address2.value,document.checkout_form.b_address3.value,document.checkout_form.b_city.value,document.checkout_form.b_county.value,document.checkout_form.b_postcode.value,document.checkout_form.b_country.value,document.checkout_form.b_mobile.value,document.checkout_form.b_landline.value,document.checkout_form.b_email.value); } else { alert('Please enter your details. All fields are required.'); } } function show_payment_methods(orderID){ req.open('get', 'new_checkout_ajax_functions.php?do=show_payment_methods&orderID='+orderID); req.onreadystatechange = handleResponse; req.send(null); // WHY IS THIS BIT HERE // document.getElementById("save_shipping_method").disabled=false; } function showx(id){ if (document.getElementById(id)){ document.getElementById(id).style.display = 'block'; } } function hidex(id){ if (document.getElementById(id)){ document.getElementById(id).style.display = 'none'; } } function select_option(payment_method,option_value,active_status) { if(payment_method!='') { //alert(option_value); hidex('option_list'); showx('payment_form'); document.getElementById("default_select").innerHTML = option_value; document.checkout_form.payment_method_hidden.value=payment_method; if(active_status=="2") { document.checkout_form.save_payment_method.disabled=false; } req.open('get', 'new_checkout_ajax_functions.php?do=show_a_payment_method&payment_method='+payment_method); req.onreadystatechange = handleResponse; req.send(null); // option_number will have the div name for the information that can be present in new_checkout. // dont do this as block - instead do as // document.getElementById(payment_method).style.display = 'block'; } else { hidex('option_list'); document.getElementById("default_select").innerHTML=''; document.checkout_form.payment_method_hidden.value=''; document.checkout_form.save_payment_method.disabled=true; } } function cvn_helper_timout(){ var timout=setTimeout("hidex('cvn_help');",10000); } function cvn_helper(){ showx('cvn_help'); cvn_helper_timout(); req.open('get', 'new_checkout_ajax_functions.php?do=cvn_helper'); req.onreadystatechange = handleResponse; req.send(null); } // Card form: // Card number: function card_save_number(card_number,card_type){ req.open('get', 'https://www.creativevideo.co.uk/public/new_checkout_ajax_functions.php?do=card_save_number&card_number='+card_number+'&card_type='+card_type); req.onreadystatechange = handleResponse; req.send(null); } function card_save_issue_number(issue_number){ req.open('get', 'https://www.creativevideo.co.uk/public/new_checkout_ajax_functions.php?do=card_save_issue_number&issuer_number='+issuer_number); req.onreadystatechange = handleResponse; req.send(null); } function card_save_issuer(issuer){ req.open('get', 'https://www.creativevideo.co.uk/public/new_checkout_ajax_functions.php?do=card_save_issuer&issuer='+issuer); req.onreadystatechange = handleResponse; req.send(null); } function card_save_startm(startm){ req.open('get', 'https://www.creativevideo.co.uk/public/new_checkout_ajax_functions.php?do=card_save_startm&startm='+startm); req.onreadystatechange = handleResponse; req.send(null); } function card_save_starty(starty){ req.open('get', 'https://www.creativevideo.co.uk/public/new_checkout_ajax_functions.php?do=card_save_starty&starty='+starty); req.onreadystatechange = handleResponse; req.send(null); } function card_save_expirem(expirem){ req.open('get', 'https://www.creativevideo.co.uk/public/new_checkout_ajax_functions.php?do=card_save_expirem&expirem='+expirem); req.onreadystatechange = handleResponse; req.send(null); } function card_save_expirey(expirey){ req.open('get', 'https://www.creativevideo.co.uk/public/new_checkout_ajax_functions.php?do=card_save_expirey&expirey='+expirey); req.onreadystatechange = handleResponse; req.send(null); } function card_save_cvn(cvn){ req.open('get', 'https://www.creativevideo.co.uk/public/new_checkout_ajax_functions.php?do=card_save_cvn&cvn='+cvn); req.onreadystatechange = handleResponse; req.send(null); } function validateForm(card_number) { if (validate_cvp_cc(card_number)) { document.getElementById("is_card_valid").innerHTML = ''; document.getElementById("cc_number").style.backgroundColor='#abf7b1'; document.getElementById("cc_number").disabled=true; //alert("OK"); } else { document.getElementById("cc_number").disabled=false; document.getElementById("cc_number").style.backgroundColor='#ff8989'; document.getElementById("is_card_valid").innerHTML = ''; alert("Invalid card number. Please check and try again."); //alert("INVALID"); return false; } } function edit_address(addressID){ } function delete_address(addressID){ // have confirm and then ajax etc } function enable_select_shipping_button(thevar) { if(thevar=='') { document.getElementById("save_shipping_method").disabled=true; } else { document.getElementById("save_shipping_method").disabled=false; } } //////////////////////////////////////////////////////////////////////////////////// Handling functions /* function handleResponse() { if(req.readyState == 4){ var response = req.responseText; var update = new Array(); if(response.indexOf('' != -1)) { update = response.split(''); contentreturned = update[0]; variant = update[1]; if (variant == 'small') { document.getElementById("yourbasket22").innerHTML = contentreturned;} else { document.getElementById("basket_div").innerHTML = contentreturned;} } } //alert("loading: " + req.readyState); } */ // YO I don't know if this will definitely work, the above is an unadultarated backup function handleResponse() { if(req.readyState == 4){ var response = req.responseText; var update = new Array(); if(response.indexOf('||' != -1)) { update = response.split('||'); contentreturned = update[0]; variant = update[1]; extra = update[2]; more_extra = update[3]; //alert(contentreturned); //alert(variant); product_added a2berror if (variant == 'small') { document.getElementById("yourbasket22").innerHTML = contentreturned; if (debugmode == 'yes') { alert('yourbasket22');} } else if(variant=='voucher_area') { if(extra=='ok') { document.getElementById("voucher_area").innerHTML='Voucher applied'; } else { document.getElementById("voucher_area").innerHTML='Voucher not accepted'; } } else if(variant=='address_split_billing') { var addressbits = new Array(); addressbits = contentreturned.split('#'); address1 = addressbits[0]; city = addressbits[1]; county = addressbits[2]; postcode = addressbits[3]; document.checkout_form.b_address1.value=address1; document.checkout_form.b_city.value=city; document.checkout_form.b_county.value=county; document.checkout_form.b_postcode.value=postcode; document.getElementById("b_address1").style.borderColor='#ff0000'; } else if(variant=='address_split_shipping') { var addressbits = new Array(); addressbits = contentreturned.split('#'); address1 = addressbits[0]; city = addressbits[1]; county = addressbits[2]; postcode = addressbits[3]; document.checkout_form.s_address1.value=address1; document.checkout_form.s_city.value=city; document.checkout_form.s_county.value=county; document.checkout_form.s_postcode.value=postcode; } else if(variant=='address_split_main') { var addressbits = new Array(); addressbits = contentreturned.split('#'); address1 = addressbits[0]; city = addressbits[1]; county = addressbits[2]; postcode = addressbits[3]; document.checkout_form.address1.value=address1; document.checkout_form.city.value=city; document.checkout_form.county.value=county; document.checkout_form.postcode.value=postcode; } /* BILLING ADDRESS */ else if (variant == 'billing_address_trigger') { document.getElementById("billing_address_div").innerHTML = contentreturned; document.getElementById("save_billing").disabled=true; } else if (variant == 'billing_address_trigger_saved') { document.getElementById("billing_address_div").innerHTML = contentreturned; document.getElementById("save_billing").disabled=false; } else if (variant == 'use_billing_address') { var addressID=extra; show_left_billing_address(addressID); } else if (variant == 'show_left_billing_address') { document.getElementById("left_billing_address_output").innerHTML = contentreturned; document.getElementById("left_billing_address_output").style.display = 'inline'; } /* SHIPPING ADDRESS */ else if (variant == 'shipping_address_trigger') { document.getElementById("shipping_address_div").innerHTML = contentreturned; document.getElementById("save_shipping").disabled=true; } else if (variant == 'shipping_address_trigger_saved') { document.getElementById("shipping_address_div").innerHTML = contentreturned; document.getElementById("save_shipping").disabled=false; } else if (variant == 'use_shipping_address') { var addressID=extra; show_left_shipping_address(addressID); document.getElementById("alt_delivery_message").innerHTML = more_extra; } else if (variant == 'show_left_shipping_address') { document.getElementById("left_shipping_address_output").innerHTML = contentreturned; document.getElementById("left_shipping_address_output").style.display = 'inline'; show_shipping_methods(extra); } /* SHIPPING METHOD */ else if (variant == 'show_shipping_methods') { document.getElementById("shipping_method_div").innerHTML = contentreturned; } /* PAYMENT METHOD */ else if (variant == 'show_payment_methods') { document.getElementById("payment_method_div").innerHTML = contentreturned; hidex('payment_form'); } /* CVN HELPER */ else if (variant == 'cvn_help') { document.getElementById("cvn_help").innerHTML = contentreturned; } /* REVIEW */ else if (variant == 'order_review_trigger') { document.getElementById("order_review_div").innerHTML = contentreturned; } /* FLAG */ else if (variant == 'flag') { document.getElementById("flag").innerHTML = contentreturned; } /* Show the selected payment method ready for entering details */ else if (variant == 'payment_form') { document.getElementById("payment_form").innerHTML = contentreturned; } else if (variant == 'stock_status'){ document.getElementById("stock_status").innerHTML = contentreturned; } else if (variant == 'quotation'){ document.getElementById("yourquote22").innerHTML = contentreturned; if (debugmode == 'yes') { alert('yourquote22');} } else if (variant == 'stock_checker'){ document.getElementById("stock_check_div").innerHTML = contentreturned; } else if (variant == 'quotationno'){ /* document.getElementById("yourquote22").innerHTML = "";*/ if (debugmode == 'yes') { alert('dont display, empty quote');} } else if (variant == 'menu'){ document.getElementById("masterdiv").innerHTML = contentreturned; if (debugmode == 'yes') { alert('masterdiv');} } else if (variant == 'vat_check'){ if(contentreturned=='no'){ document.getElementById('vat_reg_number').style.backgroundColor='#FF7D7D'; document.company_form.vat_check_button.value='Check'; } else if(contentreturned=='yes'){ document.getElementById('vat_reg_number').style.backgroundColor='#CCFFBB'; document.company_form.vat_check_button.value='Valid'; document.company_form.vat_check_button.disabled=true; //document.company_form.vat_reg_number_hidden.value = document.getElementById('vat_reg_number').value; document.getElementById('vat_reg_number').disabled=true; } else { document.getElementById('vat_reg_number').style.backgroundColor='#ffffff'; document.company_form.vat_check_button.value='Check'; } //document.getElementById("vat_check").innerHTML = contentreturned; if (debugmode == 'yes') { alert('vat_check');} } else if (variant == 'company'){ if(contentreturned=='no'){ document.getElementById('company_reg_number').style.backgroundColor='#FF7D7D'; document.company_form.company_check_button.value='Check'; } else if(contentreturned=='yes'){ document.getElementById('company_reg_number').style.backgroundColor='#CCFFBB'; document.company_form.company_check_button.value='Valid'; document.company_form.company_check_button.disabled=true; document.getElementById('company_reg_number').disabled=true; } else { document.getElementById('company_reg_number').style.backgroundColor='#ffffff'; document.company_form.company_check_button.value='Check'; } //document.getElementById("company").innerHTML = contentreturned; if (debugmode == 'yes') { alert('company');} } else if (variant == 'card'){ document.getElementById("card").innerHTML = contentreturned; if (debugmode == 'yes') { alert('card');} } else if (variant == 'finance_div'){ document.getElementById("finance_div").innerHTML = contentreturned; } // CHECKOUT / BASKET else if (variant == 'add2berror') { var delay_timeout; delay_timeout = (1000); setTimeout('gobasket(contentreturned);',delay_timeout); } else if (variant == 'add2qerror'){ if(document.kiepskizartajax.naprawdekiepskizartajax.value == 'NOPEWNIE'){ var delay_timeout; delay_timeout = (1000); setTimeout('goquote(contentreturned);',delay_timeout); } if (debugmode == 'yes') { alert('masterdiv');} } else if(variant=='popadd'){ do_nothing(); } else { document.getElementById("content").innerHTML = contentreturned; if (debugmode == 'yes') {alert('writing to content');} //blahka=''; } } } //alert("loading: " + req.readyState); } function handleEnter (field, event) { var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode; if (keyCode == 13) { var i; for (i = 0; i < field.form.elements.length; i++) if (field == field.form.elements[i]) break; i = (i + 1) % field.form.elements.length; field.form.elements[i].focus(); return false; } else return true; } function do_owt() { // nothing happening here } function showhidetab(divid) { if (document.getElementById(divid).style.display == "block") { iState = 1; } else { iState = 0; } document.getElementById(divid).style.display = iState ? "none" : "block"; } function showhidemic(divid) { if (document.getElementById(divid).style.display == "block") { iState = 1; } else { iState = 0; } document.getElementById(divid).style.display = iState ? "none" : "block"; } function dotab(id,mID,addressID,orderID,paymentID,shippingID) { if(document.getElementById(id)) { if(id=="step_1") { document.getElementById('step_1').style.display = 'block'; document.getElementById('step_2').style.display = 'none'; document.getElementById('step_3').style.display = 'none'; document.getElementById('step_4').style.display = 'none'; document.getElementById('step_5').style.display = 'none'; // also deactivate the later links and hide the left unrelated // links 2 and 3 and 4 and 5 deactivate showtab('shipping_address_dead_link'); hidetab('shipping_address_active_link'); showtab('shipping_method_dead_link'); hidetab('shipping_method_active_link'); showtab('payment_method_dead_link'); hidetab('payment_method_active_link'); showtab('order_review_dead_link'); hidetab('order_review_active_link'); } else if(id=="step_2") { document.getElementById('step_1').style.display = 'none'; document.getElementById('step_2').style.display = 'block'; document.getElementById('step_3').style.display = 'none'; document.getElementById('step_4').style.display = 'none'; document.getElementById('step_5').style.display = 'none'; // now show the billing addres on the left ?? and show relevant link ?? // links 3 and 4 and 5 deactivate showtab('billing_address_active_link'); showtab('shipping_address_active_link'); hidetab('shipping_address_dead_link'); showtab('shipping_method_dead_link'); hidetab('shipping_method_active_link'); showtab('payment_method_dead_link'); hidetab('payment_method_active_link'); showtab('order_review_dead_link'); hidetab('order_review_active_link'); // do an ajax billing address in the left column if(mID=="x") { } else { show_left_billing_address(mID,addressID,orderID); } } else if(id=="step_3") { document.getElementById('step_1').style.display = 'none'; document.getElementById('step_2').style.display = 'none'; document.getElementById('step_3').style.display = 'block'; document.getElementById('step_4').style.display = 'none'; document.getElementById('step_5').style.display = 'none'; // links 4 and 5 deactivate showtab('billing_address_active_link'); showtab('shipping_address_active_link'); hidetab('shipping_address_dead_link'); showtab('shipping_method_active_link'); hidetab('shipping_method_dead_link'); showtab('payment_method_dead_link'); hidetab('payment_method_active_link'); showtab('order_review_dead_link'); hidetab('order_review_active_link'); // do an ajax shipping address in the left column if(mID=="x") { } else { show_left_shipping_address(mID,addressID,orderID); } document.getElementById("save_shipping_method").disabled=true; // at this point we now know the shipping address so once the button is clicked and the shipping section displays, the ajax needs to fetch the relevant // shipping options and display them in shipping_method_div so an ajax trigger is requried and then the variant also - along with the actual PHP } else if(id=="step_4") { document.getElementById('step_1').style.display = 'none'; document.getElementById('step_2').style.display = 'none'; document.getElementById('step_3').style.display = 'none'; document.getElementById('step_4').style.display = 'block'; document.getElementById('step_5').style.display = 'none'; // link 5 deactivate only showtab('billing_address_active_link'); showtab('shipping_address_active_link'); hidetab('shipping_address_dead_link'); showtab('shipping_method_active_link'); hidetab('shipping_method_dead_link'); showtab('payment_method_active_link'); hidetab('payment_method_dead_link'); showtab('order_review_dead_link'); hidetab('order_review_active_link'); // this bit needs adding //show_left_selected_shipping_method(mID,shippingID,orderID); show_payment_methods(orderID); // something to do with storing the shipping id (and storing the cost before vat in the orders table } else if(id=="step_5") { document.getElementById('step_1').style.display = 'none'; document.getElementById('step_2').style.display = 'none'; document.getElementById('step_3').style.display = 'none'; document.getElementById('step_4').style.display = 'none'; document.getElementById('step_5').style.display = 'block'; showtab('billing_address_active_link'); showtab('shipping_address_active_link'); hidetab('shipping_address_dead_link'); showtab('shipping_method_active_link'); hidetab('shipping_method_dead_link'); hidetab('payment_method_dead_link'); showtab('payment_method_active_link'); hidetab('order_review_dead_link'); showtab('order_review_active_link'); } else { document.getElementById('step_1').style.display = 'none'; document.getElementById('step_2').style.display = 'none'; document.getElementById('step_3').style.display = 'none'; document.getElementById('step_4').style.display = 'none'; document.getElementById('step_5').style.display = 'none'; // deactivate all apart from 1 } } } function showtab(id) { if(document.getElementById(id)) { document.getElementById(id).style.display = 'block'; } } function hidetab(id) { if(document.getElementById(id)) { document.getElementById(id).style.display = 'none'; } } function post_billing_address(some_values){ // save the fields // now show the next tab dotab('step_2'); } function post_shipping_address(some_values){ // save the fields // now show the next tab dotab('step_3'); } function post_shipping_method(some_values){ // save the fields // now show the next tab dotab('step_4'); } function post_payment_method(some_values){ // save the fields // now show the next tab dotab('step_5'); } function post_payment(some_values){ // save the fields // now post to the payment bit alert('Here the payment would be processed accordingly. - Perhaps use a confirm????'); } //////////////////////////////////////////////// function only_letters(myfield, e, dec) { var key; var keychar; if (window.event) key = window.event.keyCode; else if (e) key = e.which; else return true; keychar = String.fromCharCode(key); // control keys if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27) ) return true; else if ((("abcdefghijklmnopqrstuvwxyz").indexOf(keychar) > -1)) return true; else if (dec && (keychar == ".")) { myfield.form.elements[dec].focus(); return false; } else return false; } function ignore_Spaces(string) { var temp = ""; string = '' + string; splitstring = string.split(" "); for(i = 0; i < splitstring.length; i++) temp += splitstring[i]; return temp; } function capitalizeMe(obj) { val = obj.value; newVal = ''; val = val.split(' '); for(var c=0; c < val.length; c++) { newVal += val[c].substring(0,1).toUpperCase() + val[c].substring(1,val[c].length) + ' '; } obj.value = newVal; } ///// payment methods function show_pay(method) { if(method=="visa") { document.getElementById("show_pay_box").innerHTML='We accept Visa card'; } else if(method=="mastercard") { document.getElementById("show_pay_box").innerHTML='We accept Mastercard'; } else if(method=="switch_maestro") { document.getElementById("show_pay_box").innerHTML='We accept Maestro'; } else if(method=="solo") { document.getElementById("show_pay_box").innerHTML='We accept Solo card'; } else if(method=="v12") { document.getElementById("show_pay_box").innerHTML='Personal finance'; } else if(method=="cheque") { document.getElementById("show_pay_box").innerHTML='We accept UK cheque'; } else if(method=="cvp") { document.getElementById("show_pay_box").innerHTML='Commercial Finance'; } else if(method=="bank") { document.getElementById("show_pay_box").innerHTML='Bank transfers accepted'; } else if(method=="collect") { document.getElementById("show_pay_box").innerHTML='We allow collection'; } else { document.getElementById("show_pay_box").innerHTML='Payment methods'; } } function hide_pay() { document.getElementById("show_pay_box").innerHTML='Payment methods'; }