$.noConflict(); jQuery(document).ready(function($) { $("input.date").datepicker({onSelect:function(selectedDate) { if($(this).attr("name") == "wyjazd-od") { if($("input[name=powrot-przed]").val() < $(this).val()) { var arr = $(this).val().split("-"); //var myDate=new Date($(this).val()); var myDate=new Date(arr[0], arr[1]-1, arr[2]); myDate.setDate(myDate.getDate()+21); $("input[name=powrot-przed]").datepicker("setDate", myDate); } } }}); $("#nemail").css('color','black'); $('#nemail').val('Podaj swój e-mail'); $('#emaillubtel').val('e-mail lub telefon'); $("a.calendar").click(function (event) { event.preventDefault(); //$(this).parent().children(":first-child").datepicker("show"); $(this).prev().datepicker("show"); }); $("form", "div.ibe, div.ibe-duze, div.ibe-adv").submit(function(event) { //event.preventDefault(); var countries = Array(); $("input:checkbox", $(this)).each(function() { var flag = true; var obj; if($(this).attr("checked") == true) { //alert($(this).next().html()); if($(this).next().html().match(/ /)) { tmp = $(this).prev().prev(); if(tmp.length) obj = tmp; else obj = $(this).parent().prev().children(":last-child").prev(); while(flag) { if(obj.html().match(/ /)) { tmp = obj.prev().prev().prev(); if(tmp.length) obj = tmp; else obj = obj.parent().prev().children(":last-child").prev(); } else { countries.push(obj.html()); flag = false; } } } else { countries.push($(this).next().html()); } } }); $.unique(countries); var page; if($(this).parent().parent().attr("id").match(/wrap/)) //sg page = "sg"; else if($(this).parent().parent().attr("id").match(/left2/)) //krok2+ page = "krok2"; else //krok1 page = "krok1"; for(key in countries) { try { // var pageTracker = _gat._getTracker("UA-8221887-1"); pageTracker._trackPageview("/qbe/"+page+"/"+countries[key]); } catch(err) {} /**/ } try { // var pageTracker = _gat._getTracker("UA-8221887-1"); pageTracker._trackPageview("/qbe/all-"+page+"/"+countries.toString()); } catch(err) {} //alert(countries); }); $("a.lupa").click(function (event) { event.preventDefault(); $(this).parent().fadeOut("fast", function (){$("div.ibe-duze").fadeIn("slow");}); $("div#banner").fadeOut("fast", function () { $("img#banner-overlay").css("z-index", -5); //IE hack $("img#banner-overlay-maly").css("z-index", 5); //IE hack $(this).addClass("banner-maly"); $(this).fadeIn("slow"); }); }); $("a.lupa-minus").click(function (event) { event.preventDefault(); $(this).parent().fadeOut("fast", function(){$("div.ibe").fadeIn("slow");}); $("div#banner").fadeOut("fast", function () { $("img#banner-overlay").css("z-index", 5); //hack for IE $("img#banner-overlay-maly").css("z-index", -5); //hack for IE $(this).removeClass("banner-maly"); $(this).fadeIn("slow"); }); }); $("a.expandIBE").click(function(event) { event.preventDefault(); $("div.ibe").fadeOut("fast", function(){$("div.ibe-adv").fadeIn("slow");}); $("div.ibe-duze").fadeOut("fast"); $("div#banner").fadeOut("fast"); }); $("a.expandIBEpion").click(function(event) { event.preventDefault(); $("div.ibe").fadeOut("fast", function(){$("div.ibe-adv").fadeIn("slow");}); }); $("a.contractIBEpion").click(function(event) { event.preventDefault(); $("div.ibe-adv").fadeOut("fast", function() { $("div.ibe").fadeIn("slow"); }); }); $("a.contractIBE").click(function(event) { event.preventDefault(); $("div.ibe-adv").fadeOut("fast", function() { $("div.ibe").fadeIn("slow"); $("img#banner-overlay").css("z-index", 5); //hack for IE $("img#banner-overlay-maly").css("z-index", -5); //hack for IE $("div#banner").removeClass("banner-maly"); $("div#banner").fadeIn("slow"); }); }); /* //BANNER var count = $("li", "ul#banner-menu").length; $("li", "ul#banner-menu").click(function(event) { event.preventDefault(); $("a", "ul#banner-menu li").removeClass("active"); $("a", this).addClass("active"); var position = count - $(this).index() - 1; $("div.banner-active").fadeOut("fast", function() { $("div.banner-item", "div#banner").removeClass("banner-active"); var items = $("div.banner-item", "div#banner").toArray(); $(items[position]).fadeIn("slow", function() { $(this).addClass("banner-active"); }); }); }); /**/ //ROTATING BOXES //var container = $("div#box-container"); $("a", "div.pagination").click(function(event) { var container = $(this).parent().prev().prev().children(":first-child"); var length; if(container.children(":first-child").attr("class") == "box180") length = 378; else length = 760; //alert(container.attr("class")); event.preventDefault(); var position = $(this).index(); if($(this).text() != "»" && $(this).text() != "«") { $("a", $(this).parent()).removeClass("active"); $(this).addClass("active"); var left = (position - 1) * length; container.stop(true, true).animate({left: left * -1}); } else { position = $("a.active", $(this).parent()).index(); if($(this).text() == "«") { if(position > 1) { $("a", $(this).parent()).removeClass("active"); var items = $("a", $(this).parent()).toArray(); $(items[position - 1]).addClass("active"); container.stop(true, true).animate({left: '+='+length}); } } else if($(this).text() == "»") { if(position < $("a", $(this).parent()).length - 2) { $("a", $(this).parent()).removeClass("active"); var items = $("a", $(this).parent()).toArray(); $(items[position + 1]).addClass("active"); container.stop(true, true).animate({left: '-='+length}); } } } }); $("div.ramka").each(function() { var height = $(this).height(); $(this).css("top", height * -1 - 25); }); $(".arrow-right").click(function(event) { event.preventDefault(); var obj = $(this).parent().next(); if(obj.css("display") == "none") obj.fadeIn("fast"); else obj.fadeOut("fast"); } ); $("img.close").click(function() { $(this).parent().fadeOut("fast"); }); $(".oferta").click(function(event) { event.preventDefault(); var obj = $(this).next(); if(obj.attr("class") == "gallery") { if(obj.css("display") == "none") { obj.fadeIn("fast"); $("div.obrazki", obj).children().each(function() { $(this).css("display", "none"); }); $("div.obrazki", obj).children(":first-child").fadeIn("fast"); $("span", "div.gallerycounter").text("1 z "+$("div.obrazki", obj).children().length); $("div.gallerycounter", obj).data("pic", 1); } else obj.fadeOut("fast"); } } ); $("img.gallerynext").click(function() { var obj = $(this).parent().prev(); $(obj.children()).each(function () { //alert($(this).css("display")); if($(this).css("display") == "inline") { $(this).fadeOut("fast", function() { var next = $(this).next(); var counter = $(this).parent().next(); var index = counter.data("pic"); index = index + 1; if(next.length) { next.fadeIn("slow"); $("span", counter).text(index+" z "+$(this).parent().children().length); } else { $(this).parent().children(":first").fadeIn("slow"); index = 1; $("span", counter).text(index+" z "+$(this).parent().children().length); } counter.data("pic", index); }); } }); }); $("img.galleryprev").click(function() { var obj = $(this).parent().prev(); $(obj.children()).each(function () { //alert($(this).css("display")); if($(this).css("display") == "inline") { $(this).fadeOut("fast", function() { var prev = $(this).prev(); var counter = $(this).parent().next(); var index = counter.data("pic"); index = index - 1; if(prev.length) { prev.fadeIn("slow"); $("span", counter).text(index+" z "+$(this).parent().children().length); } else { $(this).parent().children(":last").fadeIn("slow"); index = $(this).parent().children().length; $("span", counter).text(index+" z "+$(this).parent().children().length); } counter.data("pic", index); }); } }); }); $("a.compare").click(function(event) { event.preventDefault(); var get = ""; var i = 0; var flag= false; $("input.ticks").each(function() { if($(this).attr("checked") == true) { get += "id[]="+$(this).attr("name")+"&"; flag = true; } }); //alert(get); if(flag) { cmpW = 1020; cmpH = 550; cmpX = screen.width/2 - cmpW/2; cmpY = screen.height/2 - cmpH/2; window.open("/compare.php?"+get, "cmpWin", "width="+cmpW+", height="+cmpH+",left="+cmpX+",top="+cmpY+",location=0,status=0,toolbar=0,directories=0,menubar=0,resizable=0,scrollbars=1"); } else { alert("Nie wybrano żadnej oferty do porównania"); } }); $("#tabs").tabs(); //alert($("#tabs").tabs("length")); $(".ui-widget-content", "#tabs").each(function() { $(this).css("backgroundImage", "none"); } ); $("a#gotoopis").click(function(event) { event.preventDefault(); $("#tabs").tabs('select', 1); }); $("a.lb", "#tabs").lightBox(); $("a.doschowka").click(function(event) { event.preventDefault(); var id = $(this).attr("id"); //alert(id); $.get("/schowek.php", {id: id}, function(data) { alert(data); location.reload(); }); }); $("a.deleteSchowek").click(function(event) { event.preventDefault(); var get = "action=del&"; var i = 0; var flag= false; $("input.ticks").each(function() { if($(this).attr("checked") == true) { get += "id[]="+$(this).attr("name")+"&"; flag = true; } }); //alert(get); if(flag) { $.get("/schowek.php", get, function(data) { alert(data); location.reload(); }); } else { alert("Nie wybrano żadnej oferty do usunięcia"); } }); /* $("select", "#wycena").change(function() { var cena = 0; $(".wycena", "#wycena").each(function() { var temp = new Array(); temp = $(this).val().split(':'); //alert($(this).val()); if(temp.length <= 1) cena += Number(temp[0]); else cena *= Number(temp[0]); }); //alert(cena); $("#cena", "#wycena").text("cena "+cena+" PLN"); }); /**/ $("form.zapytaj").submit(function(event) { event.preventDefault(); if($("input[name=email]", $(this)).val().match(/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/)) $.post("/sendpytanieooferte.php", $("form.zapytaj").serialize(), function(data){alert(data);}); else { //$("input[name=email]", $(this)).css("border", "1px solid #ff0000"); alert("Proszę podać poprawny adres email."); } }); $("form#pytania").submit(function(event) { event.preventDefault(); var emaillubtel = $("#emaillubtel").val(); if (emaillubtel == "" || emaillubtel == "e-mail lub telefon" ) { $("#emaillubtel").focus(); $('#emaillubtel').val('e-mail lub telefon'); alert("Proszę podać poprawny adres email lub telefon."); } else $.post("/sendpytania.php", $("form#pytania").serialize(), function(data) { alert(data); }); }); /* $('#emaillubtel').click(function(){ var emaillubtel = $("#emaillubtel").val(); if (emaillubtel == "" || emaillubtel == "e-mail lub telefon" ) { $("#emaillubtel").focus(); $('#emaillubtel').val(''); return false; } else $("#emaillubtel").focus(); return false; }); /**/ $('#nemail').click(function(){ $("#nemail").removeClass("valid"); var nemail = $("#nemail").val(); if (nemail == "" || nemail == "Podaj swój e-mail" ) { $("#nemail").focus(); $("#nemail").css('color','black'); $('#nemail').val(''); return false; } else $("#email").focus(); return false; }); $('#subnews').click(function(){ var nemail = $("#nemail").val(); if (nemail == "" || nemail == "Podaj swój e-mail") { $("#nemail").addClass("valid"); $("#nemail").css('color','red'); $("#nemail").val(); $('#nemail').val('Podaj swój e-mail'); return false; } }); $("a#checkAll", "div.tablica").click(function(event) { event.preventDefault(); $("input:checkbox", "div.tablica").each(function() { $(this).attr("checked", true); }); }); $("a#uncheckAll", "div.tablica").click(function(event) { event.preventDefault(); $("input:checkbox", "div.tablica").each(function() { $(this).attr("checked", false); }); }); $("input.dummy").click(function(event) { event.preventDefault(); $(this).parent().parent().prev().children(":first-child").fadeIn("fast"); }); $("img.ack").click(function() { $(this).parent().fadeOut("fast"); //$("input#dummy").attr("value", "test"); var value= Array(); //var checked = array(); $("input:checkbox", $(this).parent()).each(function() { if($(this).attr("checked") == true) { //checked.push($(this).attr("name")); $("input[name="+$(this).attr("name")+"]:checkbox", "div.tablica").attr("checked", true); if(value.length < 10) { tmp = $(this).next().html().replace(" ", ""); value.unshift(tmp); } /* if(value.length < 30) else if(!value.match(/.../)) value += "..."; /**/ } }); if(value.length == 0) value.push("dowolny"); $.unique(value); $("input.dummy").val(value.toString()); }); var q = $.parseQuery(); if(q.typ_listy == undefined) q.typ = $("input[name=typ_listy]:checked").val(); else q.typ = q.typ_listy; $("input[name=typ_listy]:radio", "div.tablica").each(function() { if($(this).attr("value") == q.typ_listy) $(this).attr("checked", true); }); $("div.regionsContent", "div.tablica").load("/regions.php", q); //$("div#wycena").load("/wycena.php", $.parseQuery()); $("input[name=typ_listy]:radio", "div.tablica").click(function() { $("div.regionsContent", "div.tablica").html('
