function loadHeaderULine(){var width=jQuery(window).width();if(width<=1100){$("img#header_uline")[0].src="/img/header_uline1024.png";}else{if(width<1250){$("img#header_uline")[0].src="/img/header_uline1280.png";}else{$("img#header_uline")[0].src="/img/header_uline.png";}}}function setCurrCategoryId(id){if($("form#variables_form input#category_id")[0]!=null){$("form#variables_form input#category_id")[0].value=id;return true;}else{return false;}}function setCurrRecipeId(id){if($("form#variables_form input#recipe_id")[0]!=null){$("form#variables_form input#recipe_id")[0].value=id;return true;}else{return false;}}function getCurrCategoryId(){if($("form#variables_form input#category_id")[0]!=null){return $("form#variables_form input#category_id")[0].value;}else{return null;}}function getCurrRecipeId(){if($("form#variables_form input#recipe_id")[0]!=null){return $("form#variables_form input#recipe_id")[0].value;}else{return null;}}function initScrollCategory(){var category_id=getCurrCategoryId();if(category_id!=null){scrollCategory(category_id,getById("menu_scroll_content").scrollTop);}}function initColorRecipe(){var recipe_id=getCurrRecipeId();if(recipe_id!=null){if($("a#rec_"+recipe_id)[0]!=null){$("a#rec_"+recipe_id)[0].style.color="red";}}}function setMenuScrollContentHeight(){var height=jQuery(window).height();var offset=jQuery(window).scrollTop();$("div#menu_scroll_content")[0].style.height=(height-345+offset)+"px";}function scrollCategory(id,offset){getById("menu_scroll_content").scrollTop=offset;var divOffset=$("#menu_scroll_content").offset().top;var pOffset=$("a#cat_"+id).offset().top;var pScroll=pOffset-divOffset;$("div#menu_scroll_content").animate({scrollTop:"+="+pScroll+"px"},500,"easeOutBounce");}function loadCategory(id){var offset=getById("menu_scroll_content").scrollTop;$("div#menu").load("menu.php?category_id="+id,function(){setMenuScrollContentHeight();scrollCategory(id,offset);setCurrCategoryId(id);});}function loadRecipe(id){$("div#main").load("recipe.php?recipe_id="+id,function(){setCurrRecipeId(id);});}function setRecipeLinkColor(rlink){$("a.recipe").each(function(){this.style.color="";});rlink.style.color="red";}function showToolBar(){$("table#table_tool")[0].style.display="block";$("table#table_tool")[0].style.width="1px";$("table#table_tool").animate({width:"100%"},{queue:false,duration:"normal"},1000,"easeInQuad");}function loadTool(tool_name){$("div#tool").load(tool_name+".php",function(){showToolBar();$(window).scrollTop(60);});}function loadSearch(query,offset){if(offset===undefined){offset=0;}$("div#tool").load("search.php?query="+query+"&offset="+offset,function(){showToolBar();$(window).scrollTop(60);});}function loadComment(id){$("div#tool").load("comments.php?recipe_id="+id,function(){showToolBar();$(window).scrollTop(60);});}function reloadSearch(query,offset){if(offset===undefined){offset=0;}$("div#tool").load("search.php?query="+query+"&offset="+offset);}function showCloudTip(msg,x,y){jQueryCloud=$("div#cloud");jQueryCloud[0].innerHTML="<i>"+msg+"</i>";jQueryCloud[0].style.display="block";jQueryCloud[0].style.left=(x+20)+"px";jQueryCloud[0].style.top=(y-100)+"px";}function hideCloudTip(){$("div#cloud")[0].style.display="none";}$(document).ready(function(){loadHeaderULine();initScrollCategory();initColorRecipe();setMenuScrollContentHeight();$("table#table_tool")[0].style.display="none";$("div.category_link a").live("click",function(){var id=(this.id+"").split("_")[1];loadCategory(id);return false;});$("a.recipe").live("click",function(){var id=(this.id+"").split("_")[1];loadRecipe(id);setRecipeLinkColor(this);if(this.name=="recipe_menu"){$("table#table_tool")[0].style.display="none";}return false;});$(window).resize(function(){loadHeaderULine();setMenuScrollContentHeight();});$(window).scroll(function(){setMenuScrollContentHeight();});$("img#balance").live("mouseover",function(){this.src="/img/balance_on.png";showCloudTip("Przelicz<br/>objętości<br/>i wagi",$("img#balance").offset().left,$("img#balance").offset().top);});$("img#balance").live("mouseout",function(){this.src="/img/balance_off.png";hideCloudTip();});$("img#balance").live("click",function(){loadTool("scaler");});$("img#printer").live("mouseover",function(){this.src="/img/printer_on.png";showCloudTip("Drukuj<br/>ten<br/>przepis",$("img#printer").offset().left,$("img#printer").offset().top);});$("img#printer").live("mouseout",function(){this.src="/img/printer_off.png";hideCloudTip();});$("img#printer").live("click",function(){winopen("recipe_print.php?recipe_id="+getCurrRecipeId(),800,600);});$("img#plus").live("mouseover",function(){this.src="/img/plus_on.png";showCloudTip("Dodaj<br/>nowy<br/>przepis",$("img#plus").offset().left,$("img#plus").offset().top);});$("img#plus").live("mouseout",function(){this.src="/img/plus_off.png";hideCloudTip();});$("img#pen").live("mouseover",function(){this.src="/img/pen_on.png";showCloudTip("Przeglądaj<br/>i dodawaj<br/>komentarze",$("img#pen").offset().left,$("img#pen").offset().top);});$("img#pen").live("mouseout",function(){this.src="/img/pen_off.png";hideCloudTip();});$("img.delc").live("mouseover",function(){this.src="/img/delc_on.png";showCloudTip("Usuń<br/>ten<br/>komentarz",$(this).offset().left,$(this).offset().top);});$("img.delc").live("mouseout",function(){this.src="/img/delc_off.png";hideCloudTip();});$("img#plus").live("click",function(){loadTool("recipe_offerer");});$("img#pen").live("click",function(){loadComment(getCurrRecipeId());});$("div.bttn_close").live("click",function(){$("table#table_tool")[0].style.display="none";});$("span.contact").live("click",function(){d($(this).attr("name"));});});$(document).ready(adsense_vs_adblock_hack);function adsense_vs_adblock_hack(){if($("div#adsense").height()==0){var link="http://delirium.art.pl/";if(Math.random()<0.5){link="http://delirium.art.pl/";}$("div#adsense").html('<h2 ><a href="'+link+'" target="_blank">delirium.art.pl</a></h2>');}}
