function openStat(){var popup=window.open("statistika.php","stat");popup.focus();}
function o(match_id, type){ if(type){ var popup=window.open("statistika.php?"+match_id+"&"+type,"stat"); } else { var popup=window.open("statistika.php?"+match_id,"stat"); };popup.focus();}
function openWindow(url){var popup=window.open(url,"popup");popup.focus();}
this.tooltip=function(){xOffset=165;yOffset=20;$("a.help").hover(function(e){this.t=this.title;this.title="";$("body").append("<p id='tooltip'>"+this.t+"</p>");$("#tooltip").css("top",(e.pageY-xOffset)+"px").css("left",(e.pageX+yOffset)+"px").fadeIn("fast");},function(){this.title=this.t;$("#tooltip").remove();});$("a.help").mousemove(function(e){$("#tooltip").css("top",(e.pageY-xOffset)+"px").css("left",(e.pageX+yOffset)+"px");});};$(function(){tooltip();resize_middle();start_sidebar_scroll();});function switch_razrada(el){var league_id=$(el).parent("h3").children("span.league_id").text();var search_str=$("#post_trazi").val();var d=$(el).parent("h3").children("span.d").text();var div=$(el).parent("h3").parent(div);$(el).parent("h3").children(".links").slideToggle("fast",function(){if($(el).parent("h3").attr("rel")!="loaded"){show_loader(el);}});$(el).parent().parent().children(".result").hide();$(el).parent().parent().children(".result.razrada-01").show();if($(el).parent("h3").attr("rel")!="loaded"){$.get("inc/offer_ajax.php",{league_id:league_id,d:d,search_str:search_str},function(html){$(div).children("h3.table").attr("rel","loaded");$(div).append(html);add_ticket_actions();hide_loader();});}
var arrs=$(el).attr("rel");if(arrs){$(el).parent("h3").removeClass("on");$(el).attr("rel","");}else{$(el).parent("h3").addClass("on");$(el).attr("rel","on");}
return false;}
function show_loader(el){var to=$(el).offset();var tx=to.left;var ty=to.top;var th=$(el).parent("h3").height()+6;if($(el).parent("h3").attr("rel")!="loaded"){$("#loader").css({top:(ty-5)+"px",left:(tx-9)+"px",height:th+"px"});$("#loader span").css({height:th+"px"});$("#loader").fadeTo("fast",.7);}}
function resize_middle(){/*if($("#middle").height() < $("#sidebar").height()){$("#middle").height($("#sidebar").height());}*/}
function hide_loader(){$("#loader").hide();}
function sel_coef(el){$(el).click(function(){coef_action($(this));return false;});}
function write_ticket(){return false;}
function add_ticket_actions(){}
function ticket_action(el){var href=$(el).attr("rel");var el=$(el);$.get(href,function(data){array=href.split("=");key=array[3];array=$(el).attr("class").split(" ");tclass="."+array[1];$(tclass).removeClass("on");$(el).parent().children("td").removeClass("on");$(el).addClass("on");$("div.liga").each(function(){$(this).find(tclass+":eq("+key+")").addClass("on");});$("#action").html(data);refresh_tickets();});}
function coef_action(el){my_rel=$(el).attr("rel");if(my_rel=="razrada-all"){$(el).parent(".links").parent("h3").parent("div.liga").children(".result").show();}else{$(el).parent(".links").parent("h3").parent("div.liga").children(".result").hide();$(el).parent(".links").parent("h3").parent("div.liga").children(".result."+my_rel).show();}}
function show_notice(){setTimeout(function(){$(".notice-msg").fadeOut("slow");},3000);}
function hide_notice(){$(".message").hide();}
function set_notice(txt){$(".message .notice-msg").html(txt);setTimeout(function(){$(".message").fadeOut("slow");},3000);}
var side_top=0;var side_height=0;var nav_top=0;var view_height=0;var body_height=0;var scroll_top=0;var head_height=0;var top_margin=0;var bottom_margin=0;var side_anim=false;var nav_anim=false;function start_sidebar_scroll(){setInterval(function(){body_height=$("#wrap").height();nav_top=$("#navbar").offset().top;side_top=$("#sidebar").offset().top;side_height=$("#sidebar").height();view_height=$(window).height();scroll_top=document.documentElement.scrollTop;head_height=$("#header").height();if(scroll_top>head_height){ntop=(scroll_top+15);}else{ntop=(head_height+15);}
if(nav_top!=ntop){if(!nav_anim){nav_anim=true;$("#navbar").stop().animate({top:ntop+"px"},"fast","linear",function(){nav_anim=false;});}}
bottom_margin=-((side_height-view_height)-(scroll_top-side_top));top_margin=side_top-scroll_top;if(scroll_top>head_height+15){if(side_height<view_height){ltop=(scroll_top+15);}else if(top_margin>0){ltop=scroll_top;}else if(bottom_margin>10){ltop=-10-((side_height-view_height)-scroll_top);if(ltop>(body_height-side_height-30))ltop-=30;}else{}}else{ltop=(head_height+15);}
if(ltop&&ltop!=side_top){if(!side_anim){side_anim=true;$("#sidebar").stop().animate({top:ltop+"px"},"fast","linear",function(){side_anim=false;});}}},300);}
