var Common={sites:["divany","index","nepitelet","sportgeza","totalbike","totalcar","travelo","velvet"],__init:function(){if(!Array.prototype.indexOf)Array.prototype.indexOf=function(a,b){var c=this.length,e=Number(b)||0;e=e<0?Math.ceil(e):Math.floor(e);if(e<0)e+=c;for(;e<c;e++)if(e in this&&this[e]===a)return e;return-1};PP.__init();PopupImage.__init();this.handleAdverticum();this.fixOldImages();this.korhatar();this.buildSelectable();this.ownLinks()},buildSelectable:function(){jQuery("#features .selectable").each(function(a,
b){jQuery(b).children("ul").each(function(c,e){var h=jQuery("<select></select>").change(function(){this.value&&window.open(this.value)});jQuery(e).children().each(function(j,g){h.append(jQuery("<option></option>").text(jQuery(g).children("a").text()).attr("value",jQuery(g).children("a").attr("href")))});jQuery(e).after(jQuery("<p></p>").append(h)).remove()})})},fixEmptyAds:function(){jQuery("#features").find(".adocean").each(function(){jQuery(this).height()||jQuery(this).hide()})},fixIframes:function(){jQuery("iframe").each(function(){var a=
jQuery(this),b=a.attr("src");typeof b!="undefined"&&b.indexOf("indavideo")!=-1&&a.attr("src",b)})},fixOldImages:function(){jQuery(".kep").each(function(){var a=jQuery(this),b=a.find("img"),c=b.next();a.find(".open_popup");!a.parents("szerkfotoimage").length&&c.hasClass("kepala")&&c.width(b.width()-8)})},handleAdverticum:function(){if(typeof window.goAdverticum3=="object")window.onGoa3Invocation=function(){setTimeout(function(){jQuery(".goAdverticum").each(function(){var a=jQuery(this);if(a.html()!=
""&&!a.parents("#superbanner_container").length&&!a.parents("#custom_navi").length){if(!a.parents(".prcikk").length&&jQuery("body").hasClass("cimlap")&&a.parents("#content").length)return;var b=jQuery("<div></div>").addClass("hirdetes_bottom").append(jQuery("<span></span>").addClass("hirdetes_disc").text("h i r d e t \u00e9 s"));if(a.parents(".prcikk").length){a=a.parent();a.next().hasClass("hirdetes_bottom")||a.after(b)}else a.after(b)}b=a.parents(".prcikk");if(a.html()==""&&b.length){var c=true;
b.find(".goAdverticum").each(function(){if(jQuery(this).html()!="")c=false});if(c){b.hide();b.next().hasClass("hirdetes_bottom")&&b.next().hide()}}})},128)}},korhatar:function(){jQuery("#korhatar_elmult").click(function(){var a=document.location.href.split("?")[0];jQuery.get("http://"+document.domain+"/x.php?id=18_plusz&url="+a+"&noredirect=1");jQuery(document.body).removeClass("korhataros");Common.fixIframes()});jQuery("#korhatar_megnincs").click(function(){document.location.href="http://"+document.domain+
"/x.php?id=18_minusz&url="+document.domain})},ownLinks:function(){jQuery("#szoveg a").each(function(){var a=jQuery(this),b=a.attr("href");if(b!=""&&!a.parents(".miniapp").length&&!a.hasClass("email")){var c=b.match(/http:\/\/([\w\.]*)[^\/]\.hu/g);if(c){c=c[0].split(".hu")[0].split(".").pop().split("//").pop();if(Common.sites.indexOf(c)!=-1){c=document.domain.replace(".hu","")+"_"+document.location.href.match(/\/(\w+)\//g).shift().replace(/\//g,"")+"_cikklink";a.attr("href","/x?"+c+"="+encodeURI(b))}}}})}},
PP={avatarfilter:"",base_url:null,check_timeout:0,fresh_posts:null,id:null,ids:null,important_list:null,stored_important_list:[],items:null,load_trigger:null,new_posts:[],nofitied:false,refresh_interval:3E3,refresh_interval_default:3E4,__init:function(){jQuery("#pp_navi .close").click(function(){jQuery("#pp_navi .search").trigger("click")});jQuery("#pp_navi .search").click(function(){jQuery(this).toggleClass("open");jQuery("#pp_search").fadeToggle()});jQuery("#pp_navi .important").click(function(){var a=
jQuery(this),b=jQuery(".pp_important");a.toggleClass("open");if(PP.notified)if(a.hasClass("open")){PP.updateImportant();b.slideDown(384,PP.checkNavi)}else b.slideUp(384,function(){a.toggleClass("open");PP.updateImportant();jQuery(this).slideDown(384,PP.checkNavi)});else b.slideToggle(384,PP.checkNavi)});jQuery("#pp_navi .map").click(function(){jQuery(this).toggleClass("open");jQuery(".pp_map").slideToggle(384,PP.checkNavi)});jQuery("#pp_navi .video").click(function(){jQuery(this).toggleClass("open");
jQuery(".pp_video").slideToggle(384,PP.checkNavi)})},checkNavi:function(){jQuery("#pp_navi").toggleClass("open",!!jQuery("#pp_navi .open").length)},checkPP:function(){clearTimeout(this.check_timeout);this.check_timeout=setTimeout(function(){var a={};a["t"+(new Date).getTime()]=true;jQuery.ajax({url:PP.base_url+PP.id+".json",type:"POST",data:a,success:function(b){if(b!=null){PP.ids=[];PP.items=jQuery(".pp_post").not(".fresh_posts");PP.items.each(function(){PP.ids.push(parseInt(jQuery(this).attr("id").replace("p",
"")))});PP.new_posts=[];for(var c=0;c<b.length;c++)PP.ids.indexOf(b[c])==-1&&PP.new_posts.push(b[c]);if(PP.new_posts.length)PP.newPostsPP();else{PP.refresh_interval=PP.refresh_interval_default;PP.checkPP()}}},error:function(b){b.status!=404&&PP.checkPP()},dataType:"json"});jQuery.ajax({url:PP.base_url+PP.id+"_important.json",type:"POST",data:a,success:function(b){if(b!=null){var c=false,e=PP.important_list.find("li");if(e.length!=b.length)c=true;else e.each(function(h){if(jQuery(this).text()!=b[h])c=
true});if(c){if(!PP.notified||PP.stored_important_list.toString()!=b.toString())PP.importantNotify();PP.stored_important_list=b}}},error:function(b){b.status!=404&&PP.checkPP()},dataType:"json"})},this.refresh_interval)},importantNotify:function(){if(!this.notified){var a=jQuery("<span></span>").text("*").addClass("notif");jQuery("#pp_navi .important .icon").before(a);a.fadeIn()}jQuery("#pp_navi .important").animate({color:"#f60"},384,function(){jQuery(this).animate({color:"#24468a"},1536)});this.notified=
true},init:function(a){this.avatarfilter=(this.avatarfilter=document.location.href.match(/[?|&]a=(\w+)/gi))?this.avatarfilter[0].split("=")[1]:"";this.avatarfilter.length&&jQuery("#orszaglista").length&&jQuery(document).scrollTop(jQuery("#orszaglista").offset().top);this.id=parseInt(a);this.base_url=document.location.href.match(/http:\/\/(.*).hu\/(~\w+\/|)/g)[0]+"assets/static/pepe/";this.fresh_posts=jQuery("#new_posts").click(this.loadPPtrigger);this.fresh_post_counter=jQuery("#new_posts .count");
this.important_list=jQuery(".pp_important.pp_navi ul");this.checkPP()},loadPP:function(){var a={};a["t"+(new Date).getTime()]=true;jQuery.ajax({url:this.base_url+this.id+"_list.json",type:"POST",data:a,success:function(b){if(b.pager!=""){jQuery(".pager.top").each(function(c){var e=jQuery(b.pager).find("a").length;if(jQuery(this).find("a").length!=e||jQuery(this).find("a").length==e&&jQuery(b.pager).find("a").last().attr("href")!=jQuery(this).find("a").last().attr("href")){var h=b.pager;jQuery(this).fadeOut(511,
function(){jQuery(".pager.top")[c?"last":"first"]().remove();jQuery(".pp_post")[c?"last":"first"]().before(jQuery(h).css({display:"none"}).fadeIn())})}});if(!jQuery(".pager.top").length){jQuery(".pp_post").first().before(jQuery(b.pager).hide().fadeIn());jQuery(".pp_post").last().before(jQuery(b.pager).hide().fadeIn())}}b=b.posts;if(b.length){PP.fresh_posts.fadeOut(384,function(){jQuery(this).toggleClass("loading",false);for(var c=jQuery(".pp_post").first().prev(),e=b.length,h=jQuery(".pp_post").length-
1,j=0;j<e;j++)jQuery(jQuery(".pp_post")[h-j]).length?jQuery(jQuery(".pp_post")[h-j]).fadeOut(511,function(){jQuery(this).remove();var g=jQuery(b.pop()),k=parseInt(g.attr("id").replace("p",""));if(PP.new_posts.indexOf(k)!=-1||PP.ids.indexOf(k)==-1)g.addClass("fresh");c.after(g.hide().fadeIn())}):setTimeout(function(){var g=jQuery(b.pop()),k=parseInt(g.attr("id").replace("p",""));if(PP.new_posts.indexOf(k)!=-1||PP.ids.indexOf(k)==-1)g.addClass("fresh");c.after(g.hide().fadeIn())},511);Tinycon.setBubble(0);
PP.refresh_interval=6E4;PP.checkPP()});PopupImage.bind();typeof Gallery=="object"&&Gallery.bind()}},dataType:"json"})},loadPPtrigger:function(){clearTimeout(PP.check_timeout);PP.fresh_posts.toggleClass("loading",true);PP.loadPP()},newPostsPP:function(){if(this.fresh_posts.css("display")=="none"){this.fresh_post_counter.text(this.new_posts.length);this.fresh_posts.css({color:"#f60"}).fadeIn(384,function(){jQuery(this).animate({color:"#24468a"},1536,"linear")})}else this.fresh_post_counter.text()!=
this.new_posts.length&&this.fresh_posts.animate({color:"#f60"},384,"linear",function(){PP.fresh_post_counter.text(PP.new_posts.length);jQuery(this).animate({color:"#24468a"},1536,"linear")});Tinycon.setBubble(this.new_posts.length);this.checkPP()},updateImportant:function(){this.important_list.empty();for(var a=0;a<this.stored_important_list.length;a++)this.important_list.append(jQuery("<li></li>").text(this.stored_important_list[a]));jQuery("#pp_navi .important .notif").remove();this.notified=false}},
PopupImage={base_url:null,current:0,dim:{},cache:{0:{width:32,height:32,url:"http://galeria.index.hu/static/images/loading.gif"}},layer:{},pic_stack:[],__init:function(){this.layer.main=jQuery("<div></div>").attr({id:"popup_holder"}).click(function(a){PopupImage.close(a)});this.layer.close=jQuery("<div></div>").attr({id:"popup_close"}).click(function(a){PopupImage.close(a)});this.layer.nextPic=jQuery("<div></div>").attr("id","next_popup").addClass("next controll").append(jQuery("<div></div>").addClass("background").append(jQuery("<div></div>").append(jQuery("<span></span>")))).click(function(a){a.preventDefault();
jQuery(this).hasClass("disabled")||PopupImage.switchTo("next")});this.layer.prevPic=jQuery("<div></div>").attr("id","prev_popup").addClass("prev controll disabled").append(jQuery("<div></div>").addClass("background").append(jQuery("<div></div>").append(jQuery("<span></span>")))).click(function(a){a.preventDefault();jQuery(this).hasClass("disabled")||PopupImage.switchTo("prev")});jQuery("body").prepend(this.layer.main,this.layer.close);this.bind();if(this.pic_stack.length>1){jQuery("body").prepend(this.layer.prevPic,
this.layer.nextPic);this.layer.close.addClass("navi")}this.resize();this.base_url="//"+document.location.hostname+"/";if(document.location.pathname.indexOf("~")===1)this.base_url+=document.location.pathname.split("/")[1]+"/"},bind:function(){this.pic_stack=[];jQuery(".szerkfotoimage .kep.popup").each(function(){var a=jQuery(this),b=a.find("img"),c=b.attr("src").split("_")[0].split("/").pop();PopupImage.cache[c]={};PopupImage.pic_stack.push(c);if(!a.find("a").length){b.click(function(){PopupImage.show(jQuery(this).attr("src").split("_")[0].split("/").pop())});
b.next().click(function(){PopupImage.show(jQuery(this).prev().attr("src").split("_")[0].split("/").pop())});b.hover(function(){jQuery(this).next().toggleClass("hover")},function(){jQuery(this).next().toggleClass("hover")})}})},build:function(){this.layer.image=jQuery("<img/>").attr({id:"popup_image",alt:"Nagy m\u00e9ret\u0171 k\u00e9p",src:this.cache[this.current].url}).addClass("popup_image");this.layer.closeIcon=jQuery("<div></div>").addClass("out");this.layer.main.empty().append(this.layer.image,
this.layer.closeIcon).fadeIn();this.layer.nextPic.fadeIn();this.layer.prevPic.fadeIn();this.layer.close.fadeIn();this.resize()},checkKey:function(a){(a.keyCode||a.charCode)==27&&PopupImage.close()},close:function(){this.layer.main.fadeOut();this.layer.close.fadeOut();this.layer.nextPic.fadeOut();this.layer.prevPic.fadeOut();jQuery(window).unbind("resize",this.resize);jQuery(document).unbind("keydown",this.checkKey)},disableContextMenu:function(a){a.preventDefault();return false},get:function(a){jQuery.ajax({url:this.base_url+
"gproxy.php",data:{q:"index.hu/imagesize.php",width:this.dim.x-(PopupImage.pic_stack.length>1?140:0),height:this.dim.y,id:a},dataType:"json",success:function(b){PopupImage.current=a;PopupImage.cache[PopupImage.current]=b;PopupImage.show(PopupImage.current)}})},resize:function(){PopupImage.dim={x:jQuery(window).width(),y:jQuery(window).height()};if(PopupImage.layer.image&&PopupImage.layer.image.length){var a=Math.round((PopupImage.dim.x-PopupImage.cache[PopupImage.current].width)/2),b=Math.round((PopupImage.dim.y-
PopupImage.cache[PopupImage.current].height)/2);PopupImage.layer.image.css({top:b+"px",left:a+"px"});PopupImage.layer.closeIcon.css({top:b+PopupImage.cache[PopupImage.current].height-31+"px",left:a+PopupImage.cache[PopupImage.current].width-32+"px"})}},show:function(a){this.current=0;this.build();jQuery(window).bind("resize",this.resize);jQuery(document).bind("keydown",this.checkKey);if(typeof this.cache[a]=="undefined"||!this.cache[a].url)this.get(a);else{this.current=a;a=this.pic_stack.indexOf(this.current);
this.layer.prevPic.toggleClass("disabled",!a);this.layer.nextPic.toggleClass("disabled",a==this.pic_stack.length-1);this.build()}this.layer.image.bind("contextmenu",this.disableContextMenu)},switchTo:function(a){var b=this.pic_stack.indexOf(this.current);if(a=="prev"&&b)this.current=this.pic_stack[b-1];if(a=="next"&&b<this.pic_stack.length-1)this.current=this.pic_stack[b+1];this.pic_stack.indexOf(this.current);this.show(this.current)}};
(function(){var a={},b=null,c=null,e=document.title,h=null,j=null,g={},k={width:7,height:9,font:"8px arial",colour:"#000000",fallback:true},m=function(d){return navigator.userAgent.toLowerCase().indexOf(d)!==-1},n={chrome:m("chrome"),webkit:m("chrome")||m("safari"),safari:m("safari")&&!m("chrome"),mozilla:false},q=function(){if(!c||!b){var d;a:{d=document.getElementsByTagName("link");for(var f=0;f<d.length;f++)if(d[f].getAttribute("rel")==="icon"){d=d[f];break a}d=false}c=b=d?d.getAttribute("href"):
"/favicon.ico"}return b},o=function(){if(!j){j=document.createElement("canvas");j.width=16;j.height=16}return j},r=function(d,f){if(!o().getContext||!n.chrome&&!n.mozilla){if(g.fallback)document.title=d>0?"("+d+") "+e:e}else{var i=o().getContext("2d");f=f||"#000000";d=d||0;h=new Image;h.onload=function(){i.clearRect(0,0,16,16);i.drawImage(h,0,0);if(d>0){var l=d;i.font=g.font;i.lineWidth=1;i.textAlign="right";i.textBaseline="top";i.lineWidth=4;i.strokeStyle="#fff";i.fillStyle=g.colour;i.clearRect(15-
i.measureText(l).width,n.webkit?8:9,16,16);i.fillText(l,16,n.webkit?7:8)}p()};h.src=q()}},p=function(){if(o().getContext){for(var d=o().toDataURL(),f=document.getElementsByTagName("link"),i=document.getElementsByTagName("head")[0],l=0;l<f.length;l++)f[l].getAttribute("rel")==="icon"&&i.removeChild(f[l]);f=document.createElement("link");f.type="image/x-icon";f.rel="icon";f.href=d;document.getElementsByTagName("head")[0].appendChild(f)}};a.setOptions=function(d){g={};for(var f in k)g[f]=d[f]?d[f]:k[f];
return this};a.setImage=function(d){b=d;p();return this};a.setBubble=function(d,f){if(isNaN(d))window.console&&window.console.log("Bubble must be a number");else{r(d,f);return this}};a.reset=function(){a.setImage(c)};a.setOptions(k);window.Tinycon=a})();jQuery(document).ready(function(){Common.__init()});

