var explicitnohistory=0;
function draggablize_cartproducts(){draggablize_byclass('cartproduct',removefromcartdroparea);};function draggablize_products(){draggablize_byclass('product','magazin_cart','drag_handle1_for_');draggablize_byclass('product','magazin_cart','drag_handle2_for_');};function flash_cart(wheredrop){if((wheredrop!='')&&(wheredrop!='undefined')){new Effect.Highlight(wheredrop,{duration:1.0,startcolor:'#FFFF99',endcolor:'#FAFAFA',restorecolor:'#FAFAFA'});}};function categories_load(where){var pars='random='+Math.random();ajax_load('ajax.categories_load.php',pars,where);};loaded_subcategories=[];function subcategory_toggle(where,subcategory_id,catparent){if(loaded_subcategories[subcategory_id]=='yes'){if($(where).style.display==''){$(where).style.display='none';Element.removeClassName(catparent,'categ-minus');Element.addClassName(catparent,'categ-plus');}else{$(where).style.display='';Element.removeClassName(catparent,'categ-plus');Element.addClassName(catparent,'categ-minus');}}else{Element.removeClassName(catparent,'categ-plus');Element.addClassName(catparent,'categ-minus');var pars='subcategory_id='+subcategory_id+'&random='+Math.random();ajax_load('ajax.categories_load.php',pars,where,'loaded_subcategories['+subcategory_id+']="yes"');}};var last_products_mode='';var last_products_parameter='';var last_products_offset='';function products_load_featured(){last_products_mode='featured';var pars='mode=featured&random='+Math.random();ajax_load('ajax.products_load.php',pars,products_where);htmlhistory_add('p-featured');};function products_load_latest(){last_products_mode='latest';var pars='mode=latest&random='+Math.random();ajax_load('ajax.products_load.php',pars,products_where);htmlhistory_add('p-latest');};function products_load_from_category(category_id,offset){last_products_mode='category';
last_products_parameter=category_id;last_products_offset=offset;var pars='mode=category&category_id='+category_id+'&random='+Math.random();if(offset!='undefined')pars=pars+'&offset='+offset;ajax_load('ajax.products_load.php',pars,products_where);if(typeof(offset)=='undefined')offset=0;
page=Math.floor(offset/number_products_per_page)+1;
if (explicitnohistory!=1) {htmlhistory_add('p-category-'+page+'-'+category_id);} else {explicitnohistory=0;}};function products_load_from_search(searchstring,offset){if(searchstring==''){products_load_featured();}else{$('search_text').value=searchstring;last_products_mode='search';last_products_parameter=searchstring;last_products_offset=offset;var pars='mode=search'+'&random='+Math.random();if(offset!='undefined')pars=pars+'&offset='+offset;pars=pars+'&string='+URLEncode(searchstring);ajax_load('ajax.products_load.php',pars,products_where);if(typeof(offset)=='undefined')offset=0;page=Math.floor(offset/number_products_per_page)+1;htmlhistory_add('p-search-'+page+'-'+searchstring.replace(/ /g,'-'));}};function products_load_from_fav(offset){last_products_mode='fav';last_products_offset=offset;var pars='mode=fav&random='+Math.random();if(offset!='undefined')pars=pars+'&offset='+offset;ajax_load('ajax.products_load.php',pars,products_where);if(typeof(offset)=='undefined')offset=0;page=Math.floor(offset/number_products_per_page)+1;htmlhistory_add('p-fav-'+page);};function products_load_offsetted(offset){last_products_offset=offset;if(last_products_mode=='category'){products_load_from_category(last_products_parameter,offset);}else if(last_products_mode=='search'){products_load_from_search(last_products_parameter,offset);}else if(last_products_mode=='fav'){products_load_from_fav(offset);}else if(last_products_mode=='latest'){products_load_latest();}else if(last_products_mode=='featured'){products_load_featured();}else if(last_products_mode==''){products_load_featured();}else{alert('INVALID MODE AT LOADING OFFSETTED PRODUCTS ['+last_products_mode+']');}};function products_reload(){products_load_offsetted(last_products_offset);};function product_details_popup(product_id){var pars='id='+product_id+'&viewing_from=popup&random='+Math.random();ajax_load_dialog('ajax.products_load_details.php',pars,' ','','570');};function product_details_inline(where,product_id){if($(where).innerHTML==''){var pars='id='+product_id+'&viewing_from=inline&where='+where+'&random='+Math.random();ajax_load('ajax.products_load_details.php',pars,where);}else{$(where).innerHTML='';}};function product_details_overlay(product_id){var pars='id='+product_id+'&viewing_from=overlay&random='+Math.random();ajax_load('ajax.products_load_details.php',pars,products_where);htmlhistory_add('p-product-'+product_id);};function product_moreimages(product_id,viewing_from){var pars='id='+product_id+'&random='+Math.random();var afteract;if(viewing_from=='popup'){afteract='win.closeButton.customMouseUp=function(){product_details_popup(0,'+product_id+');win.closeButton.customMouseUp=function(){win.hide()}};';}else{afteract='win.closeButton.customMouseUp=function(){win.hide()}';}ajax_load_dialog('ajax.products_load_moreimages.php',pars,' ',afteract);};function product_zoomimage(image_id){$('product_moreimage').innerHTML='<img src="img_get.php?id='+image_id+'&maxw=512&maxh=384">';};function cart_load(whereupdate,whereflash,dropon,element){var pars='dropon='+dropon+'&element='+element+'&random='+Math.random();var afteract='';afteract="flash_cart('"+whereflash+"'); draggablize_cartproducts();";ajax_load('ajax.cart_edit.php',pars,whereupdate,afteract);};var hash_params=false;function checkout1(){var pars='random='+Math.random();if(hash_params=='p-profile'){products_reload();}ajax_load_dialog('ajax.checkout1.php',pars,'Checkout','checkout1_continue("magazin_checkout_placeholder", "init")');};function checkout2(){var pars='random='+Math.random();if(hash_params=='p-profile'){products_reload();}ajax_load('ajax.checkout2.php',pars,'magazin_products','checkout2_continue("magazin_checkout_placeholder", "init")');};function checkout3(){var pars='random='+Math.random();if(hash_params=='p-profile'){products_reload();}ajax_load('ajax.checkout3.php',pars,'magazin_products','checkout3_continue("magazin_checkout_placeholder", "init")');};function product_addtocart(whereupdate,whereflash,element,wherewrite,wherelink,optionsform,whereadded){var pars='dropon=manualadd'+'&element=product_'+element+'&random='+Math.random();if((typeof(optionsform)!='undefined')&&(optionsform!='')){options=Form.serialize(optionsform);if(options!=''){pars+='&'+options;}}var afteractions="flash_cart('"+whereflash+"');";afteractions+="draggablize_cartproducts();";if(wherewrite!=wherelink){Element.hide(wherelink);Element.show(wherewrite);afteractions+="Element.hide('"+wherewrite+"');Element.show('"+whereadded+"');";afteractions+="Effect.Fade('"+whereadded+"', {duration:1,afterFinish:function(){Effect.Appear('"+wherelink+"');}});";afteractions+="$('beforecart').innerHTML='';";afteractions+="blackborder_goto_cart('"+element+"');";}ajax_load('ajax.cart_edit.php',pars,whereupdate,afteractions);};function blackborder_goto_cart(element){pr=$('product_'+element);bd=$('blackborder_div');bs=bd.style;bs.left=pr.offsetLeft+'px';bs.top=pr.offsetTop+'px';bs.width=pr.offsetWidth+'px';bs.height=pr.offsetHeight+'px';bs.display='';lh=$('magazin_cart');new Effect.Parallel([new Effect.Move(bd,{x:lh.offsetLeft,y:lh.offsetTop+lh.offsetHeight-(pr.offsetHeight/2),mode:'absolute'}),new Effect.Scale(bd,50),new Effect.Fade(bd)]);};function product_setcartcount(whereupdate,whereflash,element,amount){var pars='dropon=setcount'+'&element=cartproduct_'+element+'&amount='+amount+'&random='+Math.random();ajax_load('ajax.cart_edit.php',pars,whereupdate,"flash_cart('"+whereflash+"'); draggablize_cartproducts()");};function product_removefromcart(whereupdate,whereflash,element){var pars='dropon=manualremove'+'&element=cartproduct_'+element+'&random='+Math.random();ajax_load('ajax.cart_edit.php',pars,whereupdate,"flash_cart('"+whereflash+"'); draggablize_cartproducts()");};function emptycart(whereupdate,whereflash){var pars='element=emptycart'+'&random='+Math.random();ajax_load('ajax.cart_edit.php',pars,whereupdate,"flash_cart('"+whereflash+"'); draggablize_cartproducts()");};function do_search(searchstring){products_load_from_search(searchstring);};function do_search_key(event,searchstring){if(event.keyCode==13){do_search(searchstring);}};var last_whereupdate='';var last_nextaction='';function checkout1_continue(whereupdate,nextaction,goconfirmation){last_whereupdate=whereupdate;last_nextaction=nextaction;var pars='random='+Math.random();pars=pars+'&nextaction='+nextaction;if(goconfirmation==true){pars=pars+'&goconfirmation=true';}if(nextaction!='init'){pars=pars+'&'+Form.serialize('checkout_form');}var afteractions='win.doCenter();';if(nextaction=='finalization'){afteractions=afteractions+"cart_load('magazin_cart_loadhere', '', 'undefined', '');";}ajax_load('ajax.checkout1_continue.php',pars,whereupdate,afteractions);};function checkout2_continue(whereupdate,nextaction,goconfirmation){last_whereupdate=whereupdate;last_nextaction=nextaction;var pars='random='+Math.random();pars=pars+'&nextaction='+nextaction;if(goconfirmation==true){pars=pars+'&goconfirmation=true';}if(nextaction!='init'){pars=pars+'&'+Form.serialize('checkout_form');}var afteractions='win.doCenter();';if(nextaction=='finalization'){afteractions=afteractions+"cart_load('magazin_cart_loadhere', '', 'undefined', '');";}ajax_load('ajax.checkout2_continue.php',pars,whereupdate,afteractions);};function checkout3_continue(whereupdate,nextaction,goconfirmation){last_whereupdate=whereupdate;last_nextaction=nextaction;var pars='random='+Math.random();pars=pars+'&nextaction='+nextaction;if(goconfirmation==true){pars=pars+'&goconfirmation=true';}if(nextaction!='init'){pars=pars+'&'+Form.serialize('checkout_form');}var afteractions='win.doCenter();';if(nextaction=='finalization'){afteractions=afteractions+"cart_load('magazin_cart_loadhere', '', 'undefined', '');";}ajax_load('ajax.checkout3_continue.php',pars,whereupdate,afteractions);};backaction='';function checkout1_back(whereupdate){checkout1_continue(whereupdate,backaction);};function checkout2_back(whereupdate){checkout2_continue(whereupdate,backaction);};function checkout3_back(whereupdate){checkout3_continue(whereupdate,backaction);};function user_edit_profile(loadparam){var pars='random='+Math.random();if(loadparam!='load'){if($('userinfo_editprofile_form')!=null){pars+='&'+Form.serialize('userinfo_editprofile_form');}}ajax_load('ajax.userinfo_editprofile.php',pars,products_where);htmlhistory_add('p-profile');};function user_order_history(){var pars='random='+Math.random();ajax_load('ajax.order_history.php',pars,products_where);htmlhistory_add('p-history');};function userinfo_load(where){var pars='random='+Math.random();if($('userinfo_login_form')!=null){pars+='&'+Form.serialize('userinfo_login_form');}ajax_load('ajax.userinfo.php',pars,where);};function show_dialog_login(additional_info){var pars='random='+Math.random();if($('userinfo_login_form')==null){}else{pars+='&'+Form.serialize('userinfo_login_form');}pars+='&additional_info='+URLEncode(additional_info);ajax_load_dialog('ajax.userinfo_login.php',pars,'Login','',545);};function do_login_key(event){if(event==13){show_dialog_login();}else if(event.keyCode==13){show_dialog_login();}return true;};function show_dialog_forgotlinks(){var pars='random='+Math.random();if($('userinfo_forgotlinks_form')==null){}else{pars+='&'+Form.serialize('userinfo_forgotlinks_form');}ajax_load_dialog('ajax.userinfo_forgotlinks.php',pars,'Forgot my Links','',454);};function do_forgotlinks_key(event){if((event==13)||(event.keyCode==13)){show_dialog_forgotlinks();}};function dialog_forgotpassword(where){var pars='random='+Math.random();if($('userinfo_login_form')==null){}else{pars+='&'+Form.serialize('userinfo_login_form');}ajax_load('ajax.userinfo_forgotpassword.php',pars,where,'win.doCenter();');};function dialog_registeruser(){var pars='random='+Math.random();if($('userinfo_register_form')==null){}else{pars+='&'+Form.serialize('userinfo_register_form');}ajax_load_dialog('ajax.userinfo_register.php',pars,'Register','',545);};function do_register_key(event){if((event==13)||(event.keyCode==13)){dialog_registeruser();}};function do_editprofile_key(event){if((event==13)||(event.keyCode==13)){user_edit_profile();}};function user_logout(where){var pars='logout=true&random='+Math.random();ajax_load('ajax.userinfo.php',pars,where,"products_load_latest()");$('dialog_content').innerHTML='text';};function product_setfav(product_id,favstatus,noreload){if(favstatus=='true'){syes='show';sno='hide';}else{syes='hide';sno='show';}Element.removeClassName('productfavyes_'+product_id,sno);Element.addClassName('productfavyes_'+product_id,syes);Element.removeClassName('productfavno_'+product_id,syes);Element.addClassName('productfavno_'+product_id,sno);if(noreload!='noreload'){var pars='product_id='+product_id+'&favstatus='+favstatus+'&random='+Math.random();ajax_load('ajax.product_setfav.php',pars,'');}};var all_addresses=[];function address_setfrom(address_id,idext,adrsz){all_addresses=all_addresses||adrsz;if(typeof(idext)=='undefined')idext='';p='address'+idext+'_';for(i=0;i<all_addresses.length;i++){if(address_id==all_addresses[i][0]){a=all_addresses[i];$(p+'title')&&($(p+'title').value=a[1]);$(p+'firstname')&&($(p+'firstname').value=a[2]);$(p+'lastname')&&($(p+'lastname').value=a[3]);$(p+'street')&&($(p+'street').value=a[4]);$(p+'postcode')&&($(p+'postcode').value=a[5]);$(p+'city')&&($(p+'city').value=a[6]);$(p+'stateprovince_c')&&($(p+'stateprovince_c').value=a[7]);$(p+'stateprovince_t')&&($(p+'stateprovince_t').value=a[7]);$(p+'country_id')&&($(p+'country_id').value=a[8]);$(p+'email')&&($(p+'email').value=a[9]);country_showstates(idext);}}};var addresses_last_where='';var addresses_last_sortable=false;function address_load(where,sortable){addresses_last_where=where||addresses_last_where;if(typeof(sortable)=='boolean'){addresses_last_sortable=sortable;}else{addresses_last_sortable=addresses_last_sortable;}var pars='mode=load&random='+Math.random();if(sortable==true){pars+='&sortable=true';}ajax_load('ajax.address_edit.php',pars,where);};function address_delete(address_id){var pars='mode=del&id='+address_id+'&random='+Math.random();if(addresses_last_sortable==true){pars+='&sortable=true';}ajax_load('ajax.address_edit.php',pars,addresses_last_where);};function address_save(paramformname){var pars='mode=add&random='+Math.random();var formname='checkout_form';if($(paramformname)==null){}else{formname=paramformname;}if(check_address_form_elements($(formname))){if($(formname)==null){}else{pars+='&'+Form.serialize(formname);}if(addresses_last_sortable==true){pars+='&sortable=true';}ajax_load('ajax.address_edit.php',pars,addresses_last_where);}};function check_address_form_elements(n){var cool=true;var i;if(n){if(n.nodeType==1){if(typeof(n.name)!='undefined'){switch(n.name){case '':case 'userinfo_editprofile_form_addresses':case 'checkout_form':case 'billing_same_as_shipping':case 'address_title':case 'address_country_id':case 'address_stateprovince_t':case 'address_stateprovince_c':case 'address_email':break;case 'address_firstname':if(n.value==''){cool=false;alert('Please complete First Name');}break;case 'address_lastname':if(n.value==''){cool=false;alert('Please complete Last Name');}break;case 'address_street':if(n.value==''){cool=false;alert('Please complete Street');}break;case 'address_city':if(n.value==''){cool=false;alert('Please complete City');}break;case 'address_postcode':if(n.value==''){cool=false;alert('Please complete Post Code');}break;default:alert("UNKNOWN ADDRESS VALIDATION FIELD: "+n.name);break;}if(!cool){n.focus();}}}var children=n.childNodes;for(i=0;i<children.length;i++){cool=cool&&check_address_form_elements(children[i]);}}return cool;};function country_showstates(idext){p='address'+idext+'_';cvalu=$(p+'country_id')&&$(p+'country_id').value;if(cvalu==223){Element.show(p+'staterow');Element.show(p+'zipcodespan');Element.hide(p+'provincerow');Element.hide(p+'postcodespan');$(p+'stateprovince_t').value='';}else{Element.hide(p+'staterow');Element.hide(p+'zipcodespan');Element.show(p+'provincerow');Element.show(p+'postcodespan');$(p+'stateprovince_c').value='';}};function starrating_over(id,stars){Element.removeClassName(id,'starrating0');Element.removeClassName(id,'starrating1');Element.removeClassName(id,'starrating2');Element.removeClassName(id,'starrating3');Element.removeClassName(id,'starrating4');Element.removeClassName(id,'starrating5');Element.addClassName(id,'starrating'+stars);};function starrating_out(id,stars){Element.removeClassName(id,'starrating'+stars);Element.addClassName(id,'starrating0');};function starrating_click(id,stars,where){var pars='id='+id+'&stars='+stars+'&random='+Math.random();$(where).innerHTML='Saving...';var afteract="$('"+where+"').innerHTML = 'Saved';";ajax_load('ajax.product_addrating.php',pars,'',afteract);};function comment_toggleview(product_id,forcehide){if(forcehide==true){Element.hide('product_comment_row_'+product_id);}else{Element.toggle('product_comment_row_'+product_id);}};function comment_submit(product_id){var pars='mode=add'+'&product_id='+product_id+'&random='+Math.random()+'&comment='+URLEncode($F('product_comment_text_'+product_id));var afteractions='';afteractions+="$('commenting_link_"+product_id+"').innerHTML = 'Comment saved';";$('commenting_link_'+product_id).innerHTML='Saving comment...';ajax_load('ajax.product_comment.php',pars,'',afteractions);};function comment_toggleviewall(product_id){where='product_comments_row_'+product_id;if($(where).style.display==''){$(where).style.display='none';}else{$(where).style.display='';var pars='mode=view'+'&product_id='+product_id+'&random='+Math.random();ajax_load('ajax.product_comment.php',pars,'all_comments_'+product_id);}};function userinfo_editprofile_settab(tabid){Element.removeClassName('userinfo_editprofile_tab_basic','userinfo_editprofile_currenttab');Element.removeClassName('userinfo_editprofile_tab_addresses','userinfo_editprofile_currenttab');Element.addClassName('userinfo_editprofile_tab_'+tabid,'userinfo_editprofile_currenttab');Element.hide('userinfo_editprofile_content_basic');Element.hide('userinfo_editprofile_content_addresses');Element.show('userinfo_editprofile_content_'+tabid);};function addresses_make_sortable(){Sortable.create('addresses',{tagname:'div',tag:'div',onUpdate:function(){var pars='mode=sort&random='+Math.random();pars+='&'+Sortable.serialize('addresses');pars+='&sortable=true';ajax_load('ajax.address_edit.php',pars,addresses_last_where);}});};function product_editincart(incartid){var pars='incartid='+incartid+'&random='+Math.random();ajax_load_dialog('ajax.product_edit.php',pars,'Edit Product','',545);};function product_editincart_key(event){if((event==13)||(event.keyCode==13)){var pars='random='+Math.random();if($('product_edit_form')==null){}else{pars+='&'+Form.serialize('product_edit_form');}ajax_load_dialog('ajax.product_edit.php',pars,'Saved','',545);}};function billing_same_as_shipping_check(){v=$F('billing_same_as_shipping');if(v=='on'){Element.show('billing_same_as_shipping_da');Element.hide('billing_same_as_shipping_nu');}else{Element.hide('billing_same_as_shipping_da');Element.show('billing_same_as_shipping_nu');}} 
