var lastFragmentId=null,intervalId=null,timeoutId=null,emailPattern=/^[a-zA-Z0-9\._-]+@[a-zA-Z0-9\.-]+\.[a-zA-Z]{2,4}$/;function showErrorDialog(a){jQuery("#ajax_dialog").remove();jQuery("body").append('<div id="ajax_dialog" title="'+Lang.jQueryDialogErrorTitle+'"><p>'+a+"</p></div>");jQuery("#ajax_dialog").dialog({bgiframe:true,modal:true,buttons:{OK:function(){jQuery(this).dialog("destroy")}}});jQuery.setFragment({id:""})}function showProgressbar(b){var a=jQuery("#progressbar");if(!a.length&&!intervalId){window.scrollTo(0,0);jQuery("#tartalom_kozep").prepend('<div id="progressbar"></div>');jQuery("#progressbar").progressbar({value:0});intervalId=window.setInterval("showProgressbar("+b+")",b*100)}else{a.progressbar("option","value",(a.progressbar("option","value")+10)%110)}}function hideProgressbar(){window.clearInterval(intervalId);intervalId=null;jQuery("#progressbar").remove()}function ajaxRequestCompleteFunction(b,a){hideProgressbar();if(a!="success"){showErrorDialog(Lang.ajaxRequestErrorMessage)}else{if(b.responseText.indexOf('<div id="tartalom_kozep">')>=0){jQuery("#kozep").html(b.responseText)
}else{showErrorDialog(b.responseText)}}}function createDateField(b,a){jQuery("#"+b).attr("readonly","readonly");jQuery("#birth_date").datepicker({changeMonth:true,changeYear:true,closeText:Lang.jQueryDatepickerCloseText,currentText:Lang.jQueryDatepickerCurrentText,dateFormat:"yy-mm-dd",dayNames:[Lang.dayNames[0],Lang.dayNames[1],Lang.dayNames[2],Lang.dayNames[3],Lang.dayNames[4],Lang.dayNames[5],Lang.dayNames[6]],dayNamesMin:[Lang.dayNamesMin[0],Lang.dayNamesMin[1],Lang.dayNamesMin[2],Lang.dayNamesMin[3],Lang.dayNamesMin[4],Lang.dayNamesMin[5],Lang.dayNamesMin[6]],dayNamesShort:[Lang.dayNamesMin[0],Lang.dayNamesMin[1],Lang.dayNamesMin[2],Lang.dayNamesMin[3],Lang.dayNamesMin[4],Lang.dayNamesMin[5],Lang.dayNamesMin[6]],defaultDate:new Date(1970,0,1),firstDay:1,maxDate:0,minDate:new Date(1900,0,1),monthNames:[Lang.monthNames[0],Lang.monthNames[1],Lang.monthNames[2],Lang.monthNames[3],Lang.monthNames[4],Lang.monthNames[5],Lang.monthNames[6],Lang.monthNames[7],Lang.monthNames[8],Lang.monthNames[9],Lang.monthNames[10],Lang.monthNames[11]],monthNamesShort:[Lang.monthNames[0],Lang.monthNames[1],Lang.monthNames[2],Lang.monthNames[3],Lang.monthNames[4],Lang.monthNames[5],Lang.monthNames[6],Lang.monthNames[7],Lang.monthNames[8],Lang.monthNames[9],Lang.monthNames[10],Lang.monthNames[11]],nextText:Lang.jQueryDatepickerNextText,prevText:Lang.jQueryDatepickerPrevText,showButtonPanel:true,yearRange:"-140:+140",onClose:function(d,c){if(a&&!d){showErrorDialog(a)
}this.blur()}})}function page(a){showProgressbar(2);jQuery.ajax({url:a,data:{rand:Math.random()},type:"POST",complete:function(c,b){hideProgressbar();if(b!="success"){showErrorDialog(Lang.ajaxRequestErrorMessage)}else{if(c.responseText.indexOf('<div id="tartalom_kozep">')<0){showErrorDialog(c.responseText)}else{if(c.responseText.indexOf("<html>")<0){jQuery("#kozep").html(c.responseText)}else{document=c.responseText}}}}})}function submitForm(c,b,e){showProgressbar(c);var a,d={rand:Math.random()};if(e){a=jQuery("#"+e+" input:visible, #"+e+" select");a.each(function(f,g){switch(this.type){case"checkbox":d[this.name]=this.checked;break;case"radio":if(this.checked){d[this.name]=this.value}break;default:d[this.name]=this.value;break}})}jQuery.ajax({url:b,data:d,complete:ajaxRequestCompleteFunction})}function category(b,d,a,c){showProgressbar(2);jQuery.ajax({url:b,data:{id:d,order:a,dir:c,rand:Math.random()},type:"GET",complete:ajaxRequestCompleteFunction})}function search(c,a,e,b){showProgressbar(c);var d={rand:Math.random()};
if(Number(c)>5){if(e){d.expressions=e}if(b){d.category_prefix=b}}jQuery.ajax({url:a,data:d,type:"POST",complete:ajaxRequestCompleteFunction})}function login(a){jQuery.ajax({url:a,data:{rand:Math.random(),login_name:jQuery("#login_name").val(),passwd:jQuery("#passwd").val()},complete:function(c,b){if(b!="success"){showErrorDialog(Lang.ajaxRequestErrorMessage)}else{if(c.getResponseHeader("Content-Location")){location.href=c.getResponseHeader("Content-Location")}else{showErrorDialog(c.responseText)}}}})}function refreshCart(a){if(lastFragmentId!="cart"){jQuery.setFragment({id:"cart",href:a})}else{if(timeoutId){clearTimeout(timeoutId)}timeoutId=window.setTimeout("cart('"+a+"')",1000)}}function cart(a){showProgressbar(2);var b=jQuery("#f1 input:visible:not([value=])"),c={rand:Math.random()};b.each(function(d,e){c[this.name]=this.value});jQuery.ajax({url:a,data:c,complete:ajaxRequestCompleteFunction})}function order_address(a){showProgressbar(2);var b=jQuery("#f1 input:visible"),c={rand:Math.random()};b.each(function(d,e){if(this.checked){c[this.name]=this.value
}});jQuery.ajax({url:a,data:c,complete:ajaxRequestCompleteFunction})}function order_confirmation(a){showProgressbar(2);var b=jQuery("#f1 input:visible"),c={rand:Math.random()};b.each(function(d,e){switch(this.type){case"checkbox":c[this.name]=this.checked;break;default:c[this.name]=this.value;break}});jQuery.ajax({url:a,data:c,complete:ajaxRequestCompleteFunction})}function showOrderDeleteConfirmDialog(b,a,d,c){jQuery("#ajax_dialog").remove();jQuery("body").append('<div id="ajax_dialog" title="'+d+'"><p>'+c+"</p></div>");jQuery("#ajax_dialog").dialog({bgiframe:true,modal:true,buttons:{Mégsem:function(){jQuery(this).dialog("destroy")},OK:function(){showProgressbar(2);jQuery.ajax({url:b,data:{operation:"delete",id:a,rand:Math.random()},complete:ajaxRequestCompleteFunction});jQuery(this).dialog("destroy")}}})}jQuery(window).bind("hashchange",function(b){var a=jQuery.deparam.fragment(),c=a.id||"default";switch(c){case"default":if(lastFragmentId!=null){location.replace(location.href)}break;case"category":category(a.href,a.catId,a.order,a.dir);
break;case"search":search(a.maxSec,a.href,a.expr,a.catPref);break;case"registration":submitForm(a.maxSec,a.href,"f1");break;case"login":login(a.href);break;case"password_reminder":submitForm(a.maxSec,a.href,a.formId);break;case"cart":if(timeoutId){clearTimeout(timeoutId)}timeoutId=window.setTimeout("cart('"+a.href+"')",700);break;case"order_address":order_address(a.href);break;case"order_confirmation":order_confirmation(a.href);break;default:if(c!=null){page(a.href)}break}lastFragmentId=c});jQuery(window).trigger("hashchange");
