agent = navigator.userAgent.toLowerCase(); version = navigator.appVersion.toLowerCase(); function showElement(elementName,switchName) { if ( document.getElementById(elementName) && document.getElementById(switchName) ) { if (document.getElementById(switchName).checked) { document.getElementById(elementName).style.display = "block"; } if (document.getElementById(switchName).checked == false) { document.getElementById(elementName).style.display = "none"; } } } function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function'){ window.onload = func; } else { window.onload = function() { oldonload(); func(); } } } function ProtiBotum() { if (document.getElementById("antibotinput")) { document.getElementById("antibotvalue").value = 5; document.getElementById("antibotinput").style.display = "none"; } } function install_coupon_check() { if( !document.getElementById ) return; var b = document.getElementById('btn-basket-finalize'); var codes, i, prev_codes; if( !b || !b.form || !b.form.elements ) return; for(i=0; i < b.form.elements.length; ++i) { switch( b.form.elements.item(i).name ) { case "cart_custom[coupon]": codes = b.form.elements.item(i); break; case "_coupon-prev": prev_codes = b.form.elements.item(i); break; } } if( !codes || !prev_codes ) return; var fnc = function() { var disabled = codes.value.length > 0 && codes.value != prev_codes.value; if( disabled == b.disabled ) return true; b.disabled = disabled; if( !b.src ) return true; if( disabled ) b.src = b.src.replace(/\.gif$/, '_disabled.gif'); else b.src = b.src.replace(/_disabled\.gif$/, '.gif'); return true; } codes.onkeyup = codes.onchange = codes.onclick = codes.onmousedown = fnc; } addLoadEvent(ProtiBotum); addLoadEvent(install_coupon_check); //functions function send_xmlhttprequest(callb, method, url, content, headers) { var xmlhttp = (window.XMLHttpRequest ? new XMLHttpRequest : (window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : false)); if (!xmlhttp) { return false; } xmlhttp.open(method, url); xmlhttp.onreadystatechange = function() { callb(xmlhttp); }; if (headers) { for (var key in headers) { xmlhttp.setRequestHeader(key, headers[key]); } } xmlhttp.send(content); return true; } function get_obj(objid) { obj_ent = document.getElementById(objid); if (obj_ent) { return obj_ent; } return null; } function obj_display(objid, displ) { obj_ent = get_obj(objid); if (obj_ent) { obj_ent.style.display = displ; return obj_ent; } } function set_obj_value(objid, val) { obj = get_obj(objid); if (obj) { if( obj.tagName=='input' ){ obj.value = val; }else{ obj.innerHTML = val; } return true; } return false; } function enable_next_button() { butt = get_obj('next_butt'); if (butt && next_butt_enabled) { butt.src = next_butt_enabled; butt.style.cursor = 'pointer'; butt.disabled = false; } } function disable_next_button() { butt = get_obj('next_butt'); if (butt && next_butt_disabled) { butt.src = next_butt_disabled; butt.style.cursor = 'default'; butt.disabled = true; } } function copy_one_to_another(source_obj_name, target_obj_name) { source_obj = get_obj(source_obj_name); target_obj = get_obj(target_obj_name); if (source_obj && target_obj && source_obj.value.length != '') { target_obj.value = source_obj.value; } } function show_company_form(){ switch_address_type(2) } function hide_company_form(){ obj_display('billing_profile_block_head', 'none'); obj_display('billing_profile_block', 'none'); switch_address_type(1); } function show_billing_profile(){ switch_address_type(3) } function switch_address_type(atype) { addr_type = get_obj('address_type'); if (addr_type) { addr_type.value = atype; title_type = atype - 1; if (address_type_title && address_type_title[title_type]) { row_head = get_obj('shipping_address_head'); if (row_head) { ths = row_head.getElementsByTagName('TH'); theader = ths.item(0); if (theader) { theader.innerHTML = address_type_title[title_type]; } } } if (shipping_address_instruction && shipping_address_instruction[title_type]) { instruction_obj = get_obj('shipping_address_instruction'); if (instruction_obj) { instruction_obj.innerHTML = shipping_address_instruction[title_type]; } } if (atype == 2) { try { obj_display('shipping_address_billing_data', 'table-row'); obj_display('shipping_address_company', 'table-row'); } catch(e) { obj_display('shipping_address_billing_data', ''); obj_display('shipping_address_company', ''); } obj_display('billing_profile_block_head', 'none'); obj_display('billing_profile_block', 'none'); } else { obj_display('shipping_address_billing_data', 'none'); if (atype == 1) { obj_display('shipping_address_company', 'none'); } } if (atype == 3) { try { obj_display('billing_profile_block_head', 'table-row'); obj_display('billing_profile_block', 'table-row'); obj_display('shipping_address_company', 'table-row'); } catch(e) { obj_display('billing_profile_block_head', ''); obj_display('billing_profile_block', ''); obj_display('shipping_address_company', ''); } copy_shipping_to_billing(); } } } function copy_shipping_to_billing() { //a .. - dorucovaci => o - fakturacni copy_one_to_another('afirstname', 'o_firstname'); copy_one_to_another('alastname', 'o_lastname'); copy_one_to_another('company_name', 'o_company_name'); copy_one_to_another('atin', 'tin'); copy_one_to_another('acid', 'cid'); copy_one_to_another('street', 'o_street'); copy_one_to_another('city', 'o_city'); copy_one_to_another('zip', 'o_zip'); } var services=Object(); function show_service(delivery_id, delivery_method_id){ if( !services[delivery_id] ){ services[delivery_id]=Object(); }else{ for(dmethod_id in services[delivery_id]){ services[delivery_id][dmethod_id].style.display='none'; } } if( !services[delivery_id][delivery_method_id] ){ services[delivery_id][delivery_method_id]=MM_findObj('services_'+delivery_id+'_'+delivery_method_id); } services[delivery_id][delivery_method_id].style.display='block'; MM_findObj('displayed_delivery_'+delivery_id+'_method').value=delivery_method_id; } function set_deliver_together_fn(obj, chosen) { inp = document.getElementById('set_deliver_together'); if (!chosen && obj.form && inp) { inp.value = 1; obj.form.submit(); } }