$(window).load(function(){$("#content .rate").each(function(){var a=$("div",this),b=a.text(),g=$(this),c=$("a",this);if(g.hasClass("off"))c.click(function(){return false});else{g.mouseout(function(){c.removeClass("hover");a.text(b)});c.mouseover(function(){var d=$(this);d.prevAll().andSelf().addClass("hover");a.text(d.attr("title"))}).click(function(){if(EM.user.isLoggedIn()===true){a.text("Saving...");g.unbind();c.unbind().click(function(){return false}).removeClass("hover pSel");g.addClass("off");
var d=$(this),e=$(this.parentNode.parentNode.parentNode).attr("class"),h=e.match(/id_(\d+)/)[1];e=e.match(/type_(\d+)/)[1];d.prevAll().andSelf().addClass("sel");$.getJSON("/rating/add.json.php?type="+e+"&id="+h+"&value="+d.text(),function(f){f.code===200?a.text("Thank you!"):a.text("Error")})}else EM.user.login(this);return false})}})});$(function(){var a=$("#itemComments form"),b=a.find("textarea");a.submit(function(){if(!$.trim(b.val())){b.addClass("fieldError").focus().bind("keydown keypress keyup blur",function(){b.removeClass("fieldError").unbind()});return false}})});$(function(){var a=$("#gallery ul"),b=$("#gallery_thumbs"),g=Math.ceil(a.find("li").length/7),c=$("#gallery_main").css({height:422,overflow:"hidden"}),d=$("<div/>").attr("id","gallery_caption").hide().appendTo(c),e,h,f=0,l,i,j,m=c.find("img:first").attr("title");m&&d.text(m).fadeIn(666);$("#gallery li a").each(function(k){$(this).click(function(){if(l===k)return false;d.fadeOut(333);var n=c.find("img:eq("+k+")");c.find("img:visible").fadeOut(333);n.fadeIn(333,function(){var o=n.attr("title");o&&d.text(o).fadeIn(666)});
l=k;return false})});if(g>1){e=$("<div/>").attr("id","gallery_up").click(function(){if(f!==0){f--;j=0-427*f;a.animate({top:j},"slow")}}).appendTo(b);h=$("<div/>").attr("id","gallery_down").click(function(){if(f+1!==g){f++;j=0-427*f;a.animate({top:j},"slow")}}).appendTo(b);b.hover(function(){i&&clearTimeout(i);e.animate({top:0});h.animate({bottom:0})},function(){i&&clearTimeout(i);i=setTimeout(function(){e.animate({top:-19});h.animate({bottom:-19})},1E3)})}});
