/* common js stuff */ $(function() { $(".jsHide").addClass("hidden").hide(); $(".jsOnly").show(); $(".printMe").click(function(e) { e.preventDefault(); window.print(); }); $("#mapka area").mousemove(function() { var offset = ($(this).attr("class")).replace("mapOff", ""); mapHover(offset); } ).mouseout( function() {mapHover(0);} ); $(".barbox-mapka select[name=mapka-kraj]").change( function() { window.location = $("#contactsLink").attr("href") + "?region=" + $(this).val() + "#mapBranches"; } ); //rozbalovaci casti textu $("div.rollOut").each( function() { $("h2", $(this)).each( function() { var content = $(this).nextUntil("h2"); var firstElemIsParagraph = content.eq(0).filter("p").size(); if (firstElemIsParagraph) { var p1 = content.eq(0); content = content.filter(":not(p:first)"); if (content.size()) { p1.html( p1.html() + '...' + $("div.showMore").html() ); content.wrapAll('
'); } } else if (content.size()) { content.eq(0).before( $("div.showMore").children().clone() ); content.wrapAll('
'); } } ); $(".rollOutText", $(this)).each( function() { $(this).html( $(this).html() + $("div.hideMore").html() ); } ); } ); $("div.rollOutText").hide(); $("a.showMore").live( "click", function(e) { e.preventDefault(); var el = $(this); if ( $(this).parent("p").size() ) { el = el.parent(); } el.next(".rollOutText").show(); el.find("span.dots").hide(); $(this).hide(); } ); $("a.hideMore").live( "click", function(e) { e.preventDefault(); var el = $(this).closest("div.rollOutText"); el.hide(); if ( el.prev("p").size() ) { $("span.dots, a.showMore", el.prev("p")).show(); } else { el.prev("a.showMore").show(); } } ); //odkaz odhaluje/schovava prvek s prislusnym id $("a.showHide").toggle( function(e) { e.preventDefault(); var id = $(this).attr('id'); id = id.replace('-a', '-b'); $('#' + id).show(); }, function(e) { e.preventDefault(); var id = $(this).attr('id'); id = id.replace('-a', '-b'); $('#' + id).hide(); } ); //schovavani formularu u odberu zpravodajstvi $("a.showHideForm").click( function(e) { e.preventDefault(); var jqEl = $(this).closest("form").find(".verticalForm"); if (jqEl.hasClass("hidden")) { jqEl.removeClass("hidden").show(); } else { jqEl.addClass("hidden").hide(); } } ); //taby - kontakty, stocklist detail, dividendy $(".tabLink").click( function(e) { e.preventDefault(); var num = $(this).attr("id"); num = num.split("-"); num = num[1]; $(".tabContent").hide(); $("#tabContent-" + num).show(); $(".tabLink").closest("li").removeClass("active"); $(this).closest("li").addClass("active"); $(this).blur(); }); //kontakty velka mapa $(".mapa_points area, .mapa_links a").mousemove(function(e) { //$(this).closest(".bigmap").css("border", "1px solid black"); var num = $(this).attr("class"); num = num.split("-"); num = num[1]; var jqEl_mapwrap = $(this).closest(".mapwrap"); //jqEl_mapwrap.css("border", "1px solid black"); var jqEl_map = jqEl_mapwrap.find(".bigmap"); mapa_hover(jqEl_map, num); $(".mapa_links a.bigmapLink-"+num, jqEl_mapwrap).addClass("hover"); }).mouseout(function(e) { var jqEl_mapwrap = $(this).closest(".mapwrap"); var jqEl_map = jqEl_mapwrap.find(".bigmap"); $(".mapa_links a", jqEl_mapwrap).removeClass("hover"); mapa_hover(jqEl_map, 0); }); //velka mapa - pobocky (ajax) $(".branches .mapa_points area, .branches .mapa_links a").click( function(e) { e.preventDefault(); var region = $(this).attr("href"); region = region.substr(region.lastIndexOf("region=")+7); if (region.indexOf("&") != -1) { region = region.substr(0, region.indexOf("&")); } $.post( '/ajax/pobocky_region.php', {region:region}, function(data) { $("#branchesListCR table.tbl3 tbody").html(data.htmlBranches); $("#branchesListCR h2.region").html(data.regionName); $(".branches .mapa_links li").removeClass("active"); $(".branches .mapa_links li a[href$=region="+data.regionId+"]").parent().addClass("active"); var here = location.protocol + '//' + location.host + location.pathname + location.search; self.location.href = here + '#mapBranches'; }, 'json' ); } ); //velka mapa - bankomaty (ajax) $(".cashmachines .mapa_points area, .cashmachines .mapa_links a").click( function(e) { e.preventDefault(); var region = $(this).attr("href"); region = region.substr(region.lastIndexOf("region=")+7); if (region.indexOf("&") != -1) { region = region.substr(0, region.indexOf("&")); } $.post( '/ajax/bankomaty_region.php', {region:region}, function(data) { $("#cashmachinesListCR .results").html(data.htmlMachines); $("#cashmachinesListCR h2.region").html(data.regionName); $(".cashmachines .mapa_links li").removeClass("active"); $(".cashmachines .mapa_links li a[href$=region="+data.regionId+"]").parent().addClass("active"); var here = location.protocol + '//' + location.host + location.pathname + location.search; self.location.href = here + '#mapMachines'; }, 'json' ); } ); /* $("#mapa_points area, #mapa_links a").mousemove(function(e) { var num = $(this).attr("id"); num = num.split("-"); num = num[1]; mapa_hover(num); $("#mapa_links a#link-"+num).addClass("hover"); }).mouseout(function(e) { $("#mapa_links a").removeClass("hover"); mapa_hover(0); }).click( function(e) { e.preventDefault(); var region = $(this).attr("href"); region = region.substr(region.lastIndexOf("region=")+7); if (region.indexOf("&") != -1) { region = region.substr(0, region.indexOf("&")); } $.post( '/ajax/pobocky_region.php', {region:region}, function(data) { $("#branchesListCR table.tbl3 tbody").html(data.htmlBranches); $("#branchesListCR h2.region").html(data.regionName); $("#mapa_links li").removeClass("active"); $("#mapa_links li a[href$=region="+data.regionId+"]").parent().addClass("active"); var here = location.protocol + '//' + location.host + location.pathname + location.search; self.location.href = here + '#mapBranches'; }, 'json' ); } ); */ }); ////////////////////////////////////////// function mapHover(offset) { $("#mapka").css("backgroundPosition", "0 -"+(offset*103)+"px"); } function mapa_hover(jqEl, offset) { jqEl.css("backgroundPosition", "0 -"+(offset*295)+"px"); //$("#mapa").css("backgroundPosition", "0 -"+(offset*295)+"px"); } function ajaxInProgress(jq_el) { return jq_el.hasClass("JSdisabled"); } function ajaxEnd(jq_el) { jq_el.removeClass("JSdisabled"); } function ajaxStart(jq_el) { jq_el.addClass("JSdisabled"); }