// JQUERY PLUGIN - EASING
jQuery.easing={easein:function(x,t,b,c,d){return c*(t/=d)*t+b},easeinout:function(x,t,b,c,d){if(t<d/2)return 2*c*t*t/(d*d)+b;var a=t-d/2;return-2*c*a*a/(d*d)+2*c*a/d+c/2+b},easeout:function(x,t,b,c,d){return-c*t*t/(d*d)+2*c*t/d+b},expoin:function(x,t,b,c,d){var a=1;if(c<0){a*=-1;c*=-1}return a*(Math.exp(Math.log(c)/d*t))+b},expoout:function(x,t,b,c,d){var a=1;if(c<0){a*=-1;c*=-1}return a*(-Math.exp(-Math.log(c)/d*(t-d))+c+1)+b},expoinout:function(x,t,b,c,d){var a=1;if(c<0){a*=-1;c*=-1}if(t<d/2)return a*(Math.exp(Math.log(c/2)/(d/2)*t))+b;return a*(-Math.exp(-2*Math.log(c/2)/d*(t-d))+c+1)+b},bouncein:function(x,t,b,c,d){return c-jQuery.easing['bounceout'](x,d-t,0,c,d)+b},bounceout:function(x,t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b}else{return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b}},bounceinout:function(x,t,b,c,d){if(t<d/2)return jQuery.easing['bouncein'](x,t*2,0,c,d)*.5+b;return jQuery.easing['bounceout'](x,t*2-d,0,c,d)*.5+c*.5+b},elasin:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b},elasout:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b},elasinout:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d/2)==2)return b+c;if(!p)p=d*(.3*1.5);if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);if(t<1)return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b},backin:function(x,t,b,c,d){var s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b},backout:function(x,t,b,c,d){var s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},backinout:function(x,t,b,c,d){var s=1.70158;if((t/=d/2)<1)return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b},linear:function(x,t,b,c,d){return c*t/d+b}};

// JQUERY PLUGIN - MOUSE WHEEL
(function($){$.fn.extend({mousewheel:function(f){if(!f.guid)f.guid=$.event.guid++;if(!$.event._mwCache)$.event._mwCache=[];return this.each(function(){if(this._mwHandlers)return this._mwHandlers.push(f);else this._mwHandlers=[];this._mwHandlers.push(f);var s=this;this._mwHandler=function(e){e=$.event.fix(e||window.event);$.extend(e,this._mwCursorPos||{});var delta=0,returnValue=true;if(e.wheelDelta)delta=e.wheelDelta/120;if(e.detail)delta=-e.detail/3;if(window.opera)delta=-e.wheelDelta;for(var i=0;i<s._mwHandlers.length;i++)if(s._mwHandlers[i])if(s._mwHandlers[i].call(s,e,delta)===false){returnValue=false;e.preventDefault();e.stopPropagation();}return returnValue;};if($.browser.mozilla&&!this._mwFixCursorPos){this._mwFixCursorPos=function(e){this._mwCursorPos={pageX:e.pageX,pageY:e.pageY,clientX:e.clientX,clientY:e.clientY};};$(this).bind('mousemove',this._mwFixCursorPos);}if(this.addEventListener)if($.browser.mozilla)this.addEventListener('DOMMouseScroll',this._mwHandler,false);else this.addEventListener('mousewheel',this._mwHandler,false);else this.onmousewheel=this._mwHandler;$.event._mwCache.push($(this));});},unmousewheel:function(f){return this.each(function(){if(f&&this._mwHandlers){for(var i=0;i<this._mwHandlers.length;i++)if(this._mwHandlers[i]&&this._mwHandlers[i].guid==f.guid)delete this._mwHandlers[i];}else{if($.browser.mozilla&&!this._mwFixCursorPos)$(this).unbind('mousemove',this._mwFixCursorPos);if(this.addEventListener)if($.browser.mozilla)this.removeEventListener('DOMMouseScroll',this._mwHandler,false);else this.removeEventListener('mousewheel',this._mwHandler,false);else this.onmousewheel=null;this._mwHandlers=this._mwHandler=this._mwFixCursorPos=this._mwCursorPos=null;}});}});$(window).one('unload',function(){var els=$.event._mwCache||[];for(var i=0;i<els.length;i++)els[i].unmousewheel();});})(jQuery);

//jcarousellite_1.0.1.min.js
//(function($){$.fn.jCarouselLite=function(o){o=$.extend({btnPrev:null,btnNext:null,btnGo:null,mouseWheel:false,auto:null,speed:200,easing:null,vertical:false,circular:true,visible:3,start:0,scroll:1,beforeStart:null,afterEnd:null},o||{});return this.each(function(){var b=false,animCss=o.vertical?"top":"left",sizeCss=o.vertical?"height":"width";var c=$(this),ul=$("ul",c),tLi=$("li",ul),tl=tLi.size(),v=o.visible;if(o.circular){ul.prepend(tLi.slice(tl-v-1+1).clone()).append(tLi.slice(0,v).clone());o.start+=v}var f=$("li",ul),itemLength=f.size(),curr=o.start;c.css("visibility","visible");f.css({overflow:"hidden",float:o.vertical?"none":"left"});ul.css({margin:"0",padding:"0",position:"relative","list-style-type":"none","z-index":"1"});c.css({overflow:"hidden",position:"relative","z-index":"2",left:"0px"});var g=o.vertical?height(f):width(f);var h=g*itemLength;var j=g*v;f.css({width:f.width(),height:f.height()});ul.css(sizeCss,h+"px").css(animCss,-(curr*g));c.css(sizeCss,j+"px");if(o.btnPrev)$(o.btnPrev).click(function(){return go(curr-o.scroll)});if(o.btnNext)$(o.btnNext).click(function(){return go(curr+o.scroll)});if(o.btnGo)$.each(o.btnGo,function(i,a){$(a).click(function(){return go(o.circular?o.visible+i:i)})});if(o.mouseWheel&&c.mousewheel)c.mousewheel(function(e,d){return d>0?go(curr-o.scroll):go(curr+o.scroll)});if(o.auto)setInterval(function(){go(curr+o.scroll)},o.auto+o.speed);function vis(){return f.slice(curr).slice(0,v)};function go(a){if(!b){if(o.beforeStart)o.beforeStart.call(this,vis());if(o.circular){if(a<=o.start-v-1){ul.css(animCss,-((itemLength-(v*2))*g)+"px");curr=a==o.start-v-1?itemLength-(v*2)-1:itemLength-(v*2)-o.scroll}else if(a>=itemLength-v+1){ul.css(animCss,-((v)*g)+"px");curr=a==itemLength-v+1?v+1:v+o.scroll}else curr=a}else{if(a<0||a>itemLength-v)return;else curr=a}b=true;ul.animate(animCss=="left"?{left:-(curr*g)}:{top:-(curr*g)},o.speed,o.easing,function(){if(o.afterEnd)o.afterEnd.call(this,vis());b=false});if(!o.circular){$(o.btnPrev+","+o.btnNext).removeClass("disabled");$((curr-o.scroll<0&&o.btnPrev)||(curr+o.scroll>itemLength-v&&o.btnNext)||[]).addClass("disabled")}}return false}})};function css(a,b){return parseInt($.css(a[0],b))||0};function width(a){return a[0].offsetWidth+css(a,'marginLeft')+css(a,'marginRight')};function height(a){return a[0].offsetHeight+css(a,'marginTop')+css(a,'marginBottom')}})(jQuery);

(function($){$.fn.jCarouselLite=function(o){o=$.extend({btnPrev:null,btnNext:null,btnGo:null,mouseWheel:false,auto:null,hoverPause:false,speed:200,easing:null,vertical:false,circular:true,visible:3,start:0,scroll:1,beforeStart:null,afterEnd:null},o||{});return this.each(function(){var running=false,animCss=o.vertical?"top":"left",sizeCss=o.vertical?"height":"width";var div=$(this),ul=$("ul",div),tLi=$("li",ul),tl=tLi.size(),v=o.visible;if(o.circular){ul.prepend(tLi.slice(tl-v+1).clone()).append(tLi.slice(0,o.scroll).clone());o.start+=v-1;}
var li=$("li",ul),itemLength=li.size(),curr=o.start;div.css("visibility","visible");li.css({overflow:"hidden",float:o.vertical?"none":"left"});ul.css({margin:"0",padding:"0",position:"relative","list-style-type":"none","z-index":"1"});div.css({overflow:"hidden",position:"relative","z-index":"2",left:"0px"});var liSize=o.vertical?height(li):width(li);var ulSize=liSize*itemLength;var divSize=liSize*v;li.css({width:li.width(),height:li.height()});ul.css(sizeCss,ulSize+"px").css(animCss,-(curr*liSize));div.css(sizeCss,divSize+"px");if(o.btnPrev){$(o.btnPrev).click(function(){return go(curr-o.scroll);});if(o.hoverPause){$(o.btnPrev).hover(function(){stopAuto();},function(){startAuto();});}}
if(o.btnNext){$(o.btnNext).click(function(){return go(curr+o.scroll);});if(o.hoverPause){$(o.btnNext).hover(function(){stopAuto();},function(){startAuto();});}}
if(o.btnGo)
$.each(o.btnGo,function(i,val){$(val).click(function(){return go(o.circular?o.visible+i:i);});});if(o.mouseWheel&&div.mousewheel)
div.mousewheel(function(e,d){return d>0?go(curr-o.scroll):go(curr+o.scroll);});var autoInterval;function startAuto(){stopAuto();autoInterval=setInterval(function(){go(curr+o.scroll);},o.auto+o.speed);};function stopAuto(){clearInterval(autoInterval);};if(o.auto){if(o.hoverPause){div.hover(function(){stopAuto();},function(){startAuto();});}
startAuto();};function vis(){return li.slice(curr).slice(0,v);};function go(to){if(!running){if(o.beforeStart)
o.beforeStart.call(this,vis());if(o.circular){if(to<0){ul.css(animCss,-((curr+tl)*liSize)+"px");curr=to+tl;}else if(to>itemLength-v){ul.css(animCss,-((curr-tl)*liSize)+"px");curr=to-tl;}else curr=to;}else{if(to<0||to>itemLength-v)return;else curr=to;}
running=true;ul.animate(animCss=="left"?{left:-(curr*liSize)}:{top:-(curr*liSize)},o.speed,o.easing,function(){if(o.afterEnd)
o.afterEnd.call(this,vis());running=false;});if(!o.circular){$(o.btnPrev+","+o.btnNext).removeClass("disabled");$((curr-o.scroll<0&&o.btnPrev)||(curr+o.scroll>itemLength-v&&o.btnNext)||[]).addClass("disabled");}}
return false;};});};function css(el,prop){return parseInt($.css(el[0],prop))||0;};function width(el){return el[0].offsetWidth+css(el,'marginLeft')+css(el,'marginRight');};function height(el){return el[0].offsetHeight+css(el,'marginTop')+css(el,'marginBottom');};})(jQuery);

//javascript
function sethtml(div,content)
{
    var search = content;
    var script;

    while( script = search.match(/(<script[^>]+javascript[^>]+>\s*(<!--)?)/i))
    {
      search = search.substr(search.indexOf(RegExp.$1) + RegExp.$1.length);

      if (!(endscript = search.match(/((-->)?\s*<\/script>)/))) break;

      block = search.substr(0, search.indexOf(RegExp.$1));
      search = search.substring(block.length + RegExp.$1.length);

      var oScript = document.createElement('script');
      oScript.text = block;
      document.getElementsByTagName("head").item(0).appendChild(oScript);
    }

    //document.getElementById(div).innerHTML=content;
}

jQuery(document).ready(function(){
   //console.log("jquery - ready");

   //menü betű szebb mozillában és chrome-ban
   if(jQuery.browser.mozilla==true || jQuery.browser.webkit==true){
       jQuery("#navigation-main").css("fontFamily", "Ubuntu, serif")
   }
   
   //---------------------------------------------------------------------
   //urlap ellenorzes
   
   
   if( jQuery("form#google_finder").length ){
       jQuery("form#google_finder").validVal({"language":page_lang});
    }
    

    if( jQuery("form#login").length ){
       var ajax_form = jQuery("form#login").validVal({"language":page_lang});
    }
    
   jQuery( ".login-submit-button" ).click(function( event ) {
        event.preventDefault();
	form_data = ajax_form.submitform();
        //console.log(form_data);
	if ( form_data ) {
		jQuery.ajax({
			type: "POST",
			url: "login.php",
			data: form_data,
                        ontentType: "text/html; charset=iso-8859-2",
			async: false,
			success: function( msg ) {
				//console.log(msg);
                                var t, t1 = [];

                                if(msg.match(/&Error=/g)){
                                    t = msg.split("&Error=");
                                    //console.log(t);
                                    t1 = t[1].split("&");
                                    //console.log("t1: " + t1[0]);
                                    if(t1[0]>=0 || t1[0]<10){
                                        errmsg = login_errmsg[t1[0]];
                                        jQuery(".login-ok-button").click();
                                        jQuery(".login-errmsg-text").text(errmsg);
                                    }
                                    event.preventDefault();
                                }

                                if(msg.match(/script language=/g)){
                                   sethtml("#header", msg);
                                }
				//ajax_form.resetform();
			}
		});
	}       
    });


   //---------------------------------------------------------------------
   //kulső link
   jQuery("a.external").attr("target", "_blank");
   jQuery(".hide_").hide();
   jQuery(".show_").show();
   jQuery(".login-ok-button").click(function(e){
       jQuery("#login-ok, #login-errmsg").toggle();
       jQuery(".login-errmsg-text").text("");
       e.preventDefault();
   });
   //---------------------------------------------------------------------
   //menu kezeles


   /*ha normal menun van akkor elrejti a submenuket*/
   jQuery("li.normal-menu, #search_menu, #login_menu, .bg_data, .jCarouselLite").hover(function(){
        //minden kutyu elrejtese
        jQuery("ul.submenu-block").hide();
   });

   jQuery("li.submenu-item").hover(function(){
       jQuery(this).addClass("submenu-item-bg-hover");
   },function(){
       jQuery(this).removeClass("submenu-item-bg-hover");
   });

   /*a olyan elemen van, ahol van submenu megjeleniti*/
   jQuery(".submenu-menu").hover(function(){

      //felhasznalói dobozok, menuk elrejtese
      jQuery("ul.submenu-block, .user-box").hide();
      //submenu megjelenitese
      jQuery(this).children("ul.submenu-block").show();
   });

   //normal-menu -> menu bg csere ha az egér rajta van
   jQuery(".normal-menu").hover(function(){
      jQuery(this).addClass("normal-menu-hover");
   },function(){
       jQuery(this).removeClass("normal-menu-hover");
   });

   //submenu-menu -> menu bg csere ha az egér rajta van
   jQuery(".submenu-menu").hover(function(){
      jQuery(this).addClass("submenu-menu-hover");
   },function(){
       jQuery(this).removeClass("submenu-menu-hover");
   });

   //login -> menu bg csere ha az egér rajta van
   jQuery(".login-button-off:not('.loggedin-box')").hover(function(){
      jQuery(this).addClass("login-button-off-hover");
   },function(){
       jQuery(this).removeClass("login-button-off-hover");
   });

    //search -> menu bg csere ha az egér rajta van
   jQuery(".search-button-off").hover(function(){
      jQuery(this).addClass("search-button-off-hover");
   },function(){
       jQuery(this).removeClass("search-button-off-hover");
   });


   //---------------------------------------------------------------------
   //kereso
   //kereso megjelenitese, tobbi elrejtese
   jQuery(".search-button-off, .search-toggle").click(function(e){
        jQuery(".login-box-el").hide();
        jQuery("#search-box").slideToggle("slow");
        e.preventDefault();
   });

   //---------------------------------------------------------------------
   //belepes + belepve
   jQuery(".login-button-off, .login-toggle").click(function(e){

      //masok panel eltüntetese
      jQuery(".search-box-el").hide();

      //2 class jön a második a kinyitandó panel id-je #-nelkul
      var cl = (jQuery(this).attr("class")).split(" ");
      elementId = jQuery.trim(cl[1]);

      //a panel azonosítója
      if(elementId){
          //console.log("Ok"+"#"+ elementId);
          jQuery("#"+ elementId).slideToggle("slow");
      }
      //console.log(cl);
      e.preventDefault();
   });

   //jQuery("a.infowin").fancybox({'width': 620,'height':350,'autoScale':false,'type':'iframe'});


    //korhinta
   jQuery(".jCarouselLite").show().jCarouselLite({
        auto: true,
        scroll: 0.8,
        visible: 6,
        btnNext: ".shop-product-scroll-right",
        btnPrev: ".shop-product-scroll-left",
        speed: 1200,
        circular: true,
        mouseWheel: true,
        hoverPause: true
    });


    /*/ha az egér rajta van
    jQuery(".jCarouselLite-item").hover(function(){
       jQuery(this).addClass("jCarouselLite-item-bg");
    }, function(){
       jQuery(this).removeClass("jCarouselLite-item-bg");
    });*/

   
});


