var fill=function(){if(typeof mw=="undefined"){mw=$(".mid .box").width(),mb=$(".mid.box"),mx=$(".box.mixed"),s1=$(".side:first"),s2=$(".side:last"),x=mb.length?mb:mx}var e=$(".mid").height(),j=s1.width(),d=s1.find(".box:has(ol):not(:has(img))");d.css("paddingTop","0").find("a").css("padding","3px");while(e-s1.height()>0&&d.find("li:hidden").length){d.find("li:hidden").last().show()}while(e-s1.height()>100&&s1.find("dl:hidden:not(.opt)").length){s1.find("dl:hidden:not(.opt)").last().show()}if($(".mid").position().top<180){while(s1.height()-e>100&&s1.find("dl:visible:not(:has(ol))").length){s1.find("dl:visible:not(:has(ol))").last().hide()}while(s1.height()-e>0&&d.find("li:visible").length){d.find("li:visible").last().hide()}var c=s1.height(),b=d.find("li:visible").length,i=Math.floor((e-c)/b);if(i>0){d.css("paddingTop",(e-c-b*i)).find("li:visible a").css({padding:(3+Math.ceil(i/2))+"px 3px "+(3+Math.floor(i/2))+"px"})}}if(s2.position().top<180){mx.removeClass("beef").css({width:"100%",paddingTop:"0"}).find("li").css("width","auto").end().find("span").css({fontSize:"10px",lineHeight:"12px"}).filter(".th").css("width","48px").end().end().find("img").css({width:"44px",height:"44px"});if($("body > .box.mixed").length){mx.appendTo(s2)}if(mb.length){mb.css("width",(2*j)+mw+32)}x.css({marginLeft:"auto",marginRight:"auto"});while(e-s2.height()>0&&s2.find("dl:hidden").length){s2.find("dl:hidden").last().show()}while(s2.height()-e>0&&s2.find("dl:visible:not(:has(ol))").length){s2.find("dl:visible:not(:has(ol))").last().hide()}var f=s2.height(),i=Math.min(Math.floor((e-f)/6),48);if(i>0){mx.css("paddingTop",(e-f-6*i)).find("span").css({fontSize:Math.round(10+1.4*i/48)+"px",lineHeight:Math.round(12+2*i/48)+"px"}).filter(".th").css({width:(48+i)+"px"}).end().end().find("img").css({width:(44+i)+"px",height:(44+i)+"px"})}}else{if(mb.length){mb.css("width",mw)}else{mx.addClass("beef")}x.css({marginLeft:"1%",marginRight:"1%"});mx.find("img").css({width:92,height:92}).end().find("span").css({fontSize:"13px",lineHeight:"18px"}).filter(":first-child").css("width","98px");$(".foot").before(mx);var a=$(".mid").position().top<180;mx.css({width:(a?(mb.length?j+mw+28:mw):"98%")}).find("li").css("width","50%");var g=x.height();if(g-s2.height()>20){s2.find("dl:hidden:has(blockquote)").show()}while(g-s2.height()>20&&s2.find("dl:hidden").length){s2.find("dl:hidden").last().show()}if(a){if(s2.height()-g>20){s2.find("dl:visible:has(blockquote)").hide()}while(s2.height()-g>20&&s2.find("dl:visible:not(:has(ol))").length){s2.find("dl:visible:not(:has(ol))").last().hide()}}}var h=$(window).height()-($(document.body).height()-$(".foot").css("margin-top").replace("px",""));if(h>0){$(".foot").css({margin:h+"px 0 0 0"})}};$.fn.nextParentUntil=function(){return $(this).parent().nextUntil("div,dl")};var collapse=function(){if($(window).width()<600){$(".jquery-more").html("(more...)").fadeIn().nextParentUntil().slideUp()}else{$(".jquery-more").hide().nextParentUntil().slideDown()}};$(document).ready(function(){$(".crest a img").roll();if($(".side").length){$(window).load(fill).load(function(){$(this).resize(fill)})}else{$(".m").prev().append(' <a href="#" class="jquery-more" onclick="return false" style="display:none">(more...)</a>');$(".jquery-more").collapser({target:"nextParentUntil",effect:"slide",changeText:true,expandHtml:"(more...)",collapseHtml:"",expandClass:"",collapseClass:""});$(window).load(collapse).load(function(){$(this).resize(collapse)})}$(".box ol:not(:has(img)), .box.mixed ol").colorRamp();$(".box.screen a,.box.thumb a").mousedown(function(){new Image().src="show.php?t&"+$(this).attr("class").replace("t ","")});var a=jQuery(".box.thumb.popular").length?true:false;if(jQuery.cookie("zoom")!=="0"){jQuery(".zoom-y").attr("checked",true);jQuery(".zoom-n").removeAttr("checked");a?jQuery(".box.thumb img").zoom({type:"hover"}):jQuery(document.body).zoom({type:"click",spd:420})}else{jQuery(".zoom-y").removeAttr("checked");jQuery(".zoom-n").attr("checked",true)}jQuery(".box dt input").change(function(){if($(this).val()==="1"){jQuery(".zoom-y").attr("checked",true);jQuery(".zoom-n").removeAttr("checked");a?jQuery(".box.thumb img").zoom({type:"hover"}):jQuery(document.body).zoom({type:"click",spd:420});jQuery.cookie("zoom","1",{expires:90,path:"/"})}else{jQuery(".zoom-y").removeAttr("checked");jQuery(".zoom-n").attr("checked",true);a?jQuery(".box.thumb img").unbind():jQuery(document.body).unbind("click");jQuery.cookie("zoom","0",{expires:90,path:"/"})}})});jQuery.fn.zoom=function(d){var b=jQuery.extend({type:"click",spd:270,bw:7,im:15,cl:"jquery-zoom",li:"/js/ajax_small.gif",liw:64,lih:64},d);var e={sensitivity:3,interval:200,timeout:0,out:c,over:a};var f=jQuery("<img/>");f.attr("src",b.li).css({position:"absolute",left:(240-b.liw)/2+"px",top:(180-b.lih)/2+"px",width:b.liw+"px",height:b.lih+"px",border:"0"}).addClass("spinimg");return b.type=="click"?this.click(a):this.hoverIntent(e);function c(g){}function a(m){var k=jQuery(m.target);var n=k.is("a")?k:k.parents("a");if(b.type=="click"){n=(n&&n.is("a")&&n.attr("href").search(/(.*)\.(jpg|jpeg|gif|png|bmp|tif|tiff)$/gi)!=-1)?n:false}var j=(n&&n.find("img").length)?n.find("img"):false;if(n){n.setli=function(){if(j){if(b.type=="click"){var i=j.offset();f.css({left:i.left+j.outerWidth()/2-b.liw/2,top:i.top+j.outerHeight()/2-b.lih/2}).appendTo(document.body)}else{n.css({position:"relative"}).append(f)}}};n.setnli=function(){if(j&&jQuery(".spinimg").length){jQuery(".spinimg").detach()}};var g=b.type=="hover"?j.attr("src").replace("240x180.jpg","300x300.jpg"):n.attr("href");if(jQuery("div."+b.cl+' a img[src="'+g+'"]').length){if(b.type=="click"){return false}}else{if(jQuery("div."+b.cl).length){jQuery("div."+b.cl+" a.imgZoomClose").click()}}var l=function(){n.setnli();var p=j?j:n;var s=p.offset();if(b.type=="click"){var q=jQuery('<div><a href="'+n.parent().parent().find("a:not(:has(img))").attr("href")+'"><img src="'+g+'" alt="" /></a></div>').css("position","absolute").appendTo(document.body);var i={width:p.outerWidth()-2*b.bw,height:p.outerHeight()-2*b.bw,left:s.left,top:s.top}}else{var q=jQuery('<div><a href="'+n.attr("href")+'"><img src="'+g+'" alt="" /></a></div>').css("position","absolute").appendTo(document.body);var i={width:p.outerHeight()-2*b.bw,height:p.outerHeight()-2*b.bw,left:s.left+(p.outerWidth()-p.outerHeight())/2,top:s.top,opacity:"0.7"}}var t={width:q.outerWidth(),height:q.outerHeight(),"padding-bottom":"3px",opacity:"1"};var v={width:jQuery(window).width(),height:jQuery(window).height()};if(t.width>(v.width-b.im*2)){var u=v.width-b.im*2;t.height=(u/t.width)*t.height;t.width=u}if(t.height>(v.height-b.im*2)){var w=v.height-b.im*2;t.width=(w/t.height)*t.width;t.height=w}if(b.type=="click"){t.left=(v.width-t.width)/2+jQuery(window).scrollLeft();t.top=(v.height-t.height)/2+jQuery(window).scrollTop()}else{t.left=i.left-(t.width-i.width)/2;t.top=i.top-(t.height-i.height)/2}var o=jQuery('<a class="imgZoomClose" href="#">Close</a>').appendTo(q).hide();q.addClass(b.cl).css(i).animate(t,b.spd,"swing",function(){o.fadeIn(b.spd/2)});var r=function(){o.fadeOut(b.spd/2,function(){q.animate(i,b.spd/2,function(){n.css("visibility","visible");q.remove()})})};if(b.type=="hover"){q.hover(function(){clearTimeout(myTimer)},function(){myTimer=setTimeout(r,500)})}o.click(function(){r();return false})};var h=new Image();h.onload=l;h.src=g;if(!h.complete){n.setli()}if(b.type=="click"){return false}}}};$(document).keydown(function(a){if(a.keyCode==27){$("div.jquery-image-zoom a").click()}});
