var inanimate=false; var closable = false; var pathname = window.location.pathname $(document).ready(function(){ $(".kid").on("change", function(){ var c = $(this).attr('id'); var val = $(this).val(); $("#kids"+c).show(); $("#kids"+c+" .childage").hide(); if (parseInt(val) == 0) $("#kids"+c).hide(); while (val > 0) { $("#kids"+c+" .childage_"+val).show(); val--; } return false; }); var dateToday = new Date(); var dates = $("#from").datepicker({ dateFormat: 'yy-mm-dd', regional: 'hu', dayNames: [ "Vasárnap", "Hétfő", "Kedd", "Szerda", "Csütörtök", "Péntek", "Szombat" ], dayNamesMin: [ "V", "H", "K", "Sz", "Cs", "P", "Sz" ], monthNames: [ "Január", "Február", "Március", "Április", "Május", "Június", "Július", "Augusztus", "Szeptember", "Október", "November", "December" ], firstDay: 1, //defaultDate: "+1w", minDate: dateToday, onSelect: function(selectedDate) { var option = this.id == "from" ? "minDate" : "maxDate", instance = $(this).data("datepicker"), date = $.datepicker.parseDate(instance.settings.dateFormat || $.datepicker._defaults.dateFormat, selectedDate, instance.settings); dates.not(this).datepicker("option", option, date); }, beforeShowDay: function(date){ var tiltott = ["2015-12-23","2017-12-24","2017-12-25","2017-12-26"]; var string = jQuery.datepicker.formatDate('yy-mm-dd', date); return [ tiltott.indexOf(string) == -1 ]; } }); $(window).scroll(function(){ if ($(window).outerWidth() < 1136) { var pos = $('.menu_drop').position(); if (pos.top == 0 || $(window).scrollTop() > 170) { $('.menu_drop').css('top', 0); } if ($(window).scrollTop() <= 170) { $('.menu_drop').css('top', -$(window).scrollTop()+170); } } if ($(window).outerWidth() < 641) { var pos = $('.menu_drop').position(); if (pos.top == 0 || $(window).scrollTop() > 105) { $('.menu_drop').css('top', 0); } if ($(window).scrollTop() <= 105) { $('.menu_drop').css('top', -$(window).scrollTop()+105); } } }); var pos = $('.menu_drop').position(); //$('#searchinput').val(pos.top+", "+$(window).outerWidth()); if (pos.top == 0 || $(window).scrollTop() > 170) { $('.menu_drop').css('top', 0); } if ($(window).scrollTop() <= 170) { $('.menu_drop').css('top', -$(window).scrollTop()+170); } if ($(window).outerWidth() < 641) { var pos = $('.menu_drop').position(); if (pos.top == 0 || $(window).scrollTop() > 105) { $('.menu_drop').css('top', 0); } if ($(window).scrollTop() <= 105) { $('.menu_drop').css('top', -$(window).scrollTop()+105); } } $(".article_text").dotdotdot(); $(".month_text").dotdotdot(); $(".search_description").dotdotdot(); $(".minicard_text").dotdotdot(); $(".card_text").dotdotdot(); $("#newsletterTopButton, .newsletterTop #close").on("click", function(){ $(".newsletterTop").slideToggle(); $(".newsletterTop .newsletter #newsLetterName").focus(); }) $("[name=NewsLetterUnButton]").on("click",function(e){ e.preventDefault(); var mail = $('[name=NewsLetterUnEmail]').val(); $.ajax({ type:"get", url:"https://hotelcorvinus.hu/caller.php", data:{mail: mail, f: 'delNewsletter'}, dataType:"json", success: function(data) { $('div#newsLetterError').html(data.msg); } }); }); $("#newsLetterSubmit").on("click",function(e){ e.preventDefault(); var name = $('#newsLetterName').val(); var mail = $('#newsLetterMail').val(); var decl = $('#newsDeclaration').is(":checked"); $.ajax({ type:"get", url:"https://hotelcorvinus.hu/caller.php", data:{name: name, mail: mail, decl: decl, f: 'addNewsletter'}, dataType:"json", success: function(data) { $('p.newsletterError').show(); if (parseInt(data.succ) == 1) { $('p.newsletterError').css('color', '#E26143'); $('#newsLetterName').val(''); $('#newsLetterMail').val(''); } else { $('p.newsletterError').css('color', '#E26143'); } $('p.newsletterError').html(data.msg); } }); }); $(window).resize(function(){ setContainer(); //$(".arajanlat").html($(document).outerWidth()); }); if (pathname == '/') { var jslider=$('#slider').bxSlider({ speed : 700, auto : true, autoControls : false, responsive : true, pause : 5000, controls : false, pager : false }); var menup_width =0; $(".menu > li").each(function(){menup_width+=$(this).outerWidth();}); //alert($(".menu_slide").width()+"\n"+menup_width); if(menup_width<=$(".menu_slide").outerWidth()) { $(".menupager").each(function(){$(this).remove();}); } $("#nextslide").click(function(event){jslider.goToNextSlide(); event.stopPropagation();}); //$(".bx-wrapper").click(function(){jslider.goToNextSlide();}); //$(".slide_element").on('click',function(){top.location.href=$(this).attr("url");}); $("#prevslide").click(function(event){jslider.goToPrevSlide(); event.stopPropagation();}); var slider_count=jslider.getSlideCount(); for(var i=0;i"); } var dotwidth=$(".sliderdot").outerWidth()+2; $(".dotholder").width(dotwidth*slider_count); $(".slideholder").mouseenter(function(){ $("#nextslide").animate({opacity: 1}); $("#prevslide").animate({opacity: 1}); $(".slider_control").animate({opacity: 1}); jslider.stopAuto(); }); $(".slideholder").mouseleave(function(){ $("#nextslide").animate({opacity: 0}); $("#prevslide").animate({opacity: 0}); $(".slider_control").animate({opacity: 0}); jslider.startAuto(); }); } $(".menu_drop").on("click", function() { if($(this).attr("opened")=="false") { var pos = $('.menu_drop').position(); $(this).css("background-image", "url('https://hotelcorvinus.hu//img/menu_bg_responsive_open.png')"); $(this).attr("opened", "true"); $("body").css("overflow", "hidden"); if ($(window).outerWidth() < 641) { $("ul.menu").css("height", $(window).height() - pos.top - 71); $("ul.menu").css("top", pos.top + 51); } else { $("ul.menu").css("height", $(window).height() - pos.top - 67); $("ul.menu").css("top", pos.top + 60); } $(".menu").slideToggle(); } else { $(this).css("background-image", "url('https://hotelcorvinus.hu//img/menu_bg_responsive.png')"); $(this).attr("opened", "false"); $("body").css("overflow", "auto"); $(".menu").slideToggle(); } }); $(".sliderdot").mouseenter(function(){$(this).animate({opacity: 0.7});}); $(".sliderdot").mouseleave(function(){$(this).animate({opacity: 0.3});}); $(".sliderdot").click(function(event){ jslider.goToSlide($(this).attr("x")); event.stopPropagation(); }); $(".slideholder").click(function(){ var csnum=jslider.getCurrentSlide(); top.location.href=$('.slide_element[x="'+csnum+'"]').attr("href"); }); //menu2 //$(".cartbtn").click(function(){$("#cartdd").css({"display":"inline"});}); $("#cartbtn").on("click", function(){ $("#cartdd").slideToggle(); $("#lockdd").css({display:"none"}); $("#searchdd").css({display:"none"}); $("#menudd").css({display:"none"}); }); $("#lockbtn").on("click", function(){ $("#lockdd").slideToggle(); $("#searchdd").css({display:"none"}); $("#cartdd").css({display:"none"}); $("#menudd").css({display:"none"}); }); $("#searchbtn").on("click", function(){ $("#searchdd").slideToggle(); $("#lockdd").css({display:"none"}); $("#cartdd").css({display:"none"}); $("#menudd").css({display:"none"}); }); $("#menubtn").on("click", function(){ closable=!closable; if(closable==true) {$("#menudd").slideToggle();} $("#searchdd").css({display:"none"}); $("#lockdd").css({display:"none"}); $("#cartdd").css({display:"none"}); }); $(".reg_col .title").on("click",function(){ $(this).parent(".reg_col").children(".regcontent").slideToggle(); }); $("#searchdd li").on("click",function(event){event.stopPropagation();}); $("#sumbtn").on("click",function(event){event.stopPropagation();}); //$(".stopprop").on("click",function(event){event.stopPropagation();}); //$(".pdel").on("click",function(event){event.stopPropagation();}); $(".productpage .grid .count").keyup( function() { var jcount = $(".productpage .grid .count").val(); var jid = $(".productpage .grid .id").val(); $.get("https://hotelcorvinus.hu/caller.php",{f:"getprice",id:jid, count:jcount}) .done(function(data){ var sumprice=data; $(".productpage .grid #sumprice").html(sumprice+" Ft"); }); } ); $(document).on("click",".product_contact_send", function(){ var jname = $("#name").val(); $("#name").val(""); var jemail = $("#email").val(); $("#email").val(""); var jmsg = $("#msg").val(); $("#msg").val(""); var jkey = $("#key").val(); $("#key").val(""); var jtitle = $("#title").val(); //if(jname.lenght>0 && jemail.lenght>0 && jtitle.lenght>0 && jmsg.lenght>0) $.post("https://hotelcorvinus.hu/caller.php", {f:"sendproductmsg",name:jname,email:jemail,message:jmsg,title:jtitle,key:jkey}) .done(function(data){ alert(data); var rand = Math.random()*50+400; $("#captcha").css("background-image","url('https://hotelcorvinus.hu/cimage.php?"+rand+"')"); }); }); //uj menuslide $("ul.menu .mname").on("click", function(){ if ($(this).attr("opened")== "false") { $(this).parent().find("ul").slideDown("quick"); $(this).attr("opened","true"); } else { $(this).parent().find("ul").slideUp("quick"); $(this).attr("opened","false"); //alert('teszt') } } ); $("#addcartbtn").click(function(){ var id = $(this).attr("pid"); var count = $(this).attr("pcount"); addcart(id, count); }); $(document).on("click", "#captcha",function(){ var rand = Math.random()*50+400; $(this).css("background-image","url('https://hotelcorvinus.hu/cimage.php?"+rand+"')"); }); $(".opendetails").click(function(){ $("#d_"+$(this).attr("d")).slideToggle(); }); $(".details").click(function(){ $(this).slideToggle(); }); $("#searchinput").on("keypress", function(e) { if(e.which === 13) { var q = $("#searchinput").val(); $.get("https://hotelcorvinus.hu/caller.php", {f:"getpageurl"}) .done(function(data){top.location.href=data+'search/'+q;}); e.preventDefault(); } }); $(".searchbtn").on("click", function(){ var q = $("#searchinput").val(); $.get("https://hotelcorvinus.hu/caller.php", {f:"getpageurl"}) .done(function(data){top.location.href=data+'search/'+q;}); }); /* $(".menudown").on("click", function(){ var elementArray = $(".menu li").get(); if ($(".menu_slide").height() >= 124 && $(".menu_slide").css("margin-top").replace("px", "") > ($(".menu_slide").height()-62)*-1){ var nexttop = parseInt($(".menu_slide").css("margin-top").replace("px", ""))-62; $(".menu_slide").animate({"margin-top":nexttop}); } }); $(".menuup").on("click", function(){ if ($(".menu_slide").height() >= 124 && $(".menu_slide").css("margin-top").replace("px", "") < 0){ //($(".menu").height()-62)){ var nexttop = parseInt($(".menu_slide").css("margin-top").replace("px", ""))+62; $(".menu_slide").animate({"margin-top":nexttop}); } }); */ $(".menuup").on("mouseenter", function(){ slideMenuUp() }); $(".menudown").on("mouseenter", function(){ slideMenuDown() }); $(".menuup").on("click", function(){ slideMenuUp() }); $(".menudown").on("click", function(){ slideMenuDown() }); $(".tab_btn").on("click", function(){ var jorder = $(this).attr("content"); var jid = $(this).attr("pid"); $(".tab_btn").removeClass("active_tab"); $(this).addClass("active_tab"); //$(this).css({"background-color", "#b5b5b5 !important"},{"color","white !important"},{"z-index","3"}); /* background-color: #b5b5b5 !important; color: white !important; z-index: 3; */ $.get("https://hotelcorvinus.hu/caller.php",{f:"tab_content", order:jorder, id:jid}) .done(function(data){ $(".tab_content").html(data); }); }); }); /////////////////////////////////////////////////////////////////////////////////////////////////////// function slideMenuUp() { var elementArray= $(".menu li").get(); var actIndex=parseInt($(".menu").attr("index")); var nextWidth = parseInt($(".menu").css("margin-left"))+parseInt($(elementArray[actIndex-1]).outerWidth()); if($.isNumeric(nextWidth) && window.inanimate==false){ window.inanimate=true; $(".menu").animate({"margin-left":nextWidth}, 300, "linear",function(){$(".menu").attr("index", actIndex-1); window.inanimate=false;}); if(actIndex-1==0) { $(".menu").animate({"margin-left":0}, 300); } } //$(".menu").attr("ml", nextWidth); } function slideMenuDown() { var elementArray= $(".menu li").get(); var actIndex=parseInt($(".menu").attr("index")); var nextWidth = parseInt($(".menu").css("margin-left"))-parseInt($(elementArray[actIndex]).outerWidth()); if(actIndex<((elementArray).length-3) && inanimate==false){ window.inanimate=true; //$(".menu").attr("index", actIndex+1); $(".menu").animate({"margin-left":nextWidth}, 300, "linear",function(){$(".menu").attr("index", actIndex+1); window.inanimate=true;inanimate=false;}); } //$(".menu").attr("ml", nextWidth); } function addcart(jid, jcount) { if(jcount==0) { jcount=$("#count_"+jid).val(); } $.get("https://hotelcorvinus.hu/caller.php", {f:"addcart", id:jid, count:jcount}).done (function(data){ alert(data); menu2Reload(); }); } function modcart(jid, jcount, reload, popup) { if(jcount==0) { jcount=$("#count_"+jid).val(); } if(jcount<=0){delcart(jid);}else{ $.get("https://hotelcorvinus.hu/caller.php", {f:"modcart", id:jid, count:jcount}).done (function(data){ if(popup==true) { alert(data); } menu2Reload(); if(reload==true) { top.location.href=''; } });} } function delcart(jid) { var res=confirm("Biztosan törölni akarja a tételt?"); if(res==true){ var jcount=0; var reload=true; $.get("https://hotelcorvinus.hu/caller.php", {f:"modcart", id:jid, count:jcount}).done (function(data){ menu2Reload(); if(reload==true) { top.location.href=''; } });} } function initSlider() { var elementh = $(".slide_element").height(); max = elementh*$(".slide_element").length; } function menu2Reload() { //alert($(".cartdd").html()); $.get("https://hotelcorvinus.hu/caller.php", {f:"menu2reload"}) .done(function(reload){ $("#cartdd").html(reload); }); cartnumber(); } function cartnumber() { $.get("https://hotelcorvinus.hu/caller.php", {f:"cartnumber"}) .done(function(data2){ var string ="("+data2+")"; $(".cartcount").html(string) }); } function resetPwd() { var jemail = $("#lemail").val(); if(jemail=="") { alert("Írja be a bejelentkező mezőbe a email címét, majd kattintson ismét a linkre!"); } else { $.get("https://hotelcorvinus.hu/caller.php",{f:"resetpwd", email:jemail}) .done(function(data){ alert(data); }); } } function labelclick(jid) { $.get("https://hotelcorvinus.hu/caller.php", {f:"labelclick", id:jid}); } function setContainer() { //$(".container").css("margin-top", $(".head").outerHeight()); //$(".container").css("height",$(this).height()-parseInt($("#head").outerHeight())); if(parseInt($(window).outerWidth())>1136) { $(".menu").css("display","block"); $(".menu_drop").attr("opened","true"); $(".menu_drop").css("background-image", "url('https://hotelcorvinus.hu/img/menu_bg_responsive_open.png')"); $(".menu").attr("dropable","false"); $("ul.menu").css("height", 93); } else { var pos = $('.menu_drop').position(); //$('#searchinput').val(pos.top+", "+$(window).outerWidth()); if (pos.top == 0 || $(window).scrollTop() > 170) { $('.menu_drop').css('top', 0); } if ($(window).scrollTop() <= 170) { $('.menu_drop').css('top', -$(window).scrollTop()+170); } if ($(window).outerWidth() < 641) { if (pos.top == 0 || $(window).scrollTop() > 105) { $('.menu_drop').css('top', 0); } if ($(window).scrollTop() <= 105) { $('.menu_drop').css('top', -$(window).scrollTop()+105); } } $(".menu").css("display","none"); $(".menu_drop").attr("opened","false"); $(".menu_drop").css("background-image", "url('https://hotelcorvinus.hu/img/menu_bg_responsive.png')"); $(".menu").attr("dropable","true"); $("ul.menu").css("height", $(window).height() - 67); } }