popOffsetX=20;popOffsetY=-10;function showInfo(C,A){var D=A.parentNode.id;var B=document.getElementById(D+"-itempopup");document.body.appendChild(B);B.style.position="absolute";if(!C.pageY||!C.pageX){B.style.top=((C.clientY+(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop))+popOffsetY)+"px";B.style.left=((C.clientX+(document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft))+popOffsetX)+"px"}else{B.style.top=(C.pageY+popOffsetY)+"px";B.style.left=(C.pageX+popOffsetX)+"px"}B.style.display="block"}function moveInfo(C,A){var D=A.parentNode.id;var B=document.getElementById(D+"-itempopup");if(!C.pageY||!C.pageX){B.style.top=((C.clientY+(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop))+popOffsetY)+"px";B.style.left=((C.clientX+(document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft))+popOffsetX)+"px"}else{B.style.top=(C.pageY+popOffsetY)+"px";B.style.left=(C.pageX+popOffsetX)+"px"}}function hideInfo(C,A){var E=A.parentNode.id;var B=document.getElementById(E+"-itempopup");var D=document.getElementById(E);D.appendChild(B);B.style.position="relative"}function formTip(A,C,B){$("#"+A).hover(function(){if($("#formtip").length==0){showTip(this.id,C,B)}},function(){$("#formtip").remove()}).focus(function(){if($("#formtip").length==0){showTip(this.id,C,B)}}).blur(function(){$("#formtip").remove()})}function showTip(A,F,J){if(F==false){F="&nbsp;"}var G=document.documentElement;var H=self.innerWidth||(G&&G.clientWidth)||document.body.clientWidth;var D=H-getAbsoluteLeft(A);var C=getAbsoluteTop(A)-3;var B=new Object();B.width=250;if(D>((B.width*1)+75)){$("body").append("<div id='formtip' style='width:"+B.width*1+"px'><div id='formtip_arrowleft'></div><div id='formtip_closeleft'>"+F+"</div><div id='formtip_text'>"+J+"</div>");var I=getElementWidth(A)+11;var E=getAbsoluteLeft(A)+I}else{$("body").append("<div id='formtip' style='width:"+B.width*1+"px'><div id='formtip_arrowright' style='left:"+((B.width*1)+1)+"px'></div><div id='formtip_closeright'>"+F+"</div><div id='formtip_text'>"+J+"</div>");var E=getAbsoluteLeft(A)-((B.width*1)+15)}$("#formtip").css({left:E+"px",top:C+"px"});$("#formtip").show()}function getElementWidth(A){x=document.getElementById(A);return x.offsetWidth}function getAbsoluteLeft(A){o=document.getElementById(A);oLeft=o.offsetLeft;while(o.offsetParent!=null){oParent=o.offsetParent;oLeft+=oParent.offsetLeft;o=oParent}return oLeft}function getAbsoluteTop(A){o=document.getElementById(A);oTop=o.offsetTop;while(o.offsetParent!=null){oParent=o.offsetParent;oTop+=oParent.offsetTop;o=oParent}return oTop}function commentthumb(C,B,A){$("#comment"+C+" .comment_tools .thumbsup").hide();$("#comment"+C+" .comment_tools .thumbsdown").hide();$("#comment"+C+" .comment_tools .loading").show();$.ajax({type:"POST",url:B,data:{id:C,thumb:A},dataType:"json",error:function(D){$("#comment"+C+" .comment_tools .loading").hide();alert(D.responseText)},success:function(D){$("#comment"+C+" .comment_tools .loading").hide();if(D.status==1){switch(A){case 1:$("#comment"+C+" .comment_tools").html('You agree <img align="absmiddle" src="/images/icons/thumbup_green.gif"/>');break;case -1:$("#comment"+C+" .comment_tools").html('You disagree <img align="absmiddle" src="/images/icons/thumbdn_red.gif"/>');break}}else{alert(D.error)}}})}function rate(D,A,B,C){$("#rateable"+A+" span.inline-rating").fadeTo(300,0.2);$("#rateable"+A+" img.loading").show();$.ajax({type:"POST",url:B,data:{item:D,rateable:A,rating:C},dataType:"json",error:function(E){$("#rateable"+A+" img.loading").hide();$("#rateable"+A+" span.inline-rating").show();$("#rateable"+A+" a").blur();$("#rateable"+A+" span.inline-rating").fadeTo(300,1);if(C!="0"){alert(E.responseText)}},success:function(E){$("#rateable"+A+" img.loading").hide();if(E.status==1){if(C!="0"){$("#rateable"+A+" li.current-rating").css("width",E.rating*10+"%")}else{$("#rateable"+A+" li.current-rating").css("width","0%")}$("#rateable"+A+" span.inline-rating").fadeTo(300,1);$("#rateable"+A+" a").blur()}else{$("#rateable"+A+" a").blur();$("#rateable"+A+" span.inline-rating").fadeTo(300,1);if(C!="0"){alert(E.error)}}}})}function addfriend(A,B){$("li#friend img.loading").css({display:"inline"});$("li#friend span.friend").css({display:"none"});$.ajax({type:"POST",url:B,data:{user_id:A},dataType:"json",success:function(C){if(C.status==1){$("li#friend span.friend").html("Waiting for friendship <strong>approval</strong>.");$("li#friend img.loading").css({display:"none"});$("li#friend span.friend").css({display:"inline"})}else{if(C.status==2){$("li#friend span.friend").html('You are <strong>friends</strong>. <a href="#" title="Remove friend" onclick="removefriend('+A+", '/users/removefriend'); return false;\">Remove</a>");$("li#friend img.loading").css({display:"none"});$("li#friend span.friend").css({display:"inline"})}}}})}function removefriend(A,B){$("li#friend img.loading").css({display:"inline"});$("li#friend span.friend").css({display:"none"});$.ajax({type:"POST",url:B,data:{user_id:A},dataType:"json",success:function(C){if(C.status==1){$("li#friend span.friend").html('<img src="/images/icons/addfriend.gif" class="icon" /> <a href="#" title="Add as friend" onclick="addfriend('+A+", '/users/addfriend'); return false;\">Add as friend</a>");$("li#friend img.loading").css({display:"none"});$("li#friend span.friend").css({display:"inline"})}}})}function approvefriend(A,B){$("#friend"+A+" .friend_tool .buttons").css({display:"none"});$("#friend"+A+" .friend_tool .loading").css({display:"inline"});$.ajax({type:"POST",url:B,data:{user_id:A},dataType:"json",success:function(C){if(C.status>0){$("#friend"+A).fadeOut("fast")}}})}function rejectfriend(A,B){$("#friend"+A+" .friend_tool .buttons").css({display:"none"});$("#friend"+A+" .friend_tool .loading").css({display:"inline"});$.ajax({type:"POST",url:B,data:{user_id:A},dataType:"json",success:function(C){if(C.status==1){$("#friend"+A).fadeOut("fast")}}})}function commentCountdown(C,B){if(B){var A=B}else{var A=$("#comment"+C+" span.timeleft").text()}A=A-1;if(A!=0){$("#comment"+C+" span.timeleft").text(A);setTimeout("commentCountdown("+C+")",1000)}else{$("#comment"+C+" span.edit").remove()}}function commentMakeEditable(E,C){$("#comment"+E.comment_id+" .comment_tools a.editlink").css({display:"none"});var B='<p><textarea name="comment_content" class="textbox" id="comment_content" style="height:150px; margin:0; width:98%;">'+$("#comment"+E.comment_id+" .comment_content").html().replace(/<a href="(.+?)".*?>(.+?)<\/a>/g,"$1").replace(/<br>/g,"")+"</textarea></p>";var D='<div style="margin-bottom:8px; line-height:26px;"><div class="buttons"><input type="submit" value="Edit comment" class="button" /></div> or <a href="javascript:return false;" title="Cancel editing" class="tool">Cancel</a></div>';var A=$("#comment"+E.comment_id+" .comment_content").html();$("#comment"+E.comment_id+" .comment_content").html(B+D);$("#comment"+E.comment_id+" .comment_content input.button").click(function(){E.comment_content=$("#comment"+E.comment_id+" .comment_content textarea").val();postComment(E,"edit",C);$("#comment"+E.comment_id+" .comment_tools a.editlink").css({display:"inline"})});$("#comment"+E.comment_id+" .comment_content a").click(function(){$("#comment"+E.comment_id+" .comment_content").html(A);$("#comment"+E.comment_id+" .comment_tools a.editlink").css({display:"inline"})});return false}function setCommentReply(B){$("#newcomment input[@name=parent_id]").val(B);var A=$("#comment"+B+" .comment_content").html().substring(0,80).replace(/<br>/g,"");$("#newcomment div#comment_reply").html('<strong>Replying to comment:</strong> "'+A+'"... <a href="#" title="Cancel reply" onclick="unsetCommentReply(); return false;">Undo</a>');$("#newcomment div#comment_reply").show()}function unsetCommentReply(){$("#newcomment div#comment_reply").hide();$("#newcomment input[@name=parent_id]").val("")}function postComment(B,C,A){if(C!="add"&&C!="edit"){return false}$.ajax({type:"POST",url:A,data:B,dataType:"json",error:function(D){alert(D.responseText)},success:function(D){if(D.status==1){switch(C){case"add":$("#newcomment textarea#comment_content").val("");if(B.parent_id){if($(".reply"+B.parent_id).size()==0){$("#comment"+B.parent_id).after('<div class="replies'+B.parent_id+'"></div>')}$(".replies"+B.parent_id).append(D.html);unsetCommentReply()}else{$("div#comments").append(D.html).wrap("<div></div>")}$.scrollTo($("#comment"+D.id),800);$("#comment"+D.id).fadeIn("slow");break;case"edit":$("#comment"+B.comment_id+" .comment_content").html(D.html);break}}else{alert(D.error)}}});return false}(function(A){A.fn.charLimit=function(B,D){B=B||100;D=A.extend({container:"<span></span>",classname:"counter",format:"<strong>%1</strong> characters remaining"},D);if((navigator.userAgent.match(/iPhone/i))||(navigator.userAgent.match(/iPod/i))){return false}var C=(!D.container.match(/^<.+>$/))?A(D.container):A(D.container).insertAfter(this).addClass(D.classname);A(this).bind("keyup",function(){E(this,C)}).bind("blur",function(){E(this,C)}).bind("paste",function(){E(this,C)});function E(G,F){G=A(G);if(G.val().length>B){G.val(G.val().substring(0,B))}F.html(D.format.replace(/%1/,(B-G.val().length)))}}})(jQuery);function additem(B,A){$("li#item"+B+" img.loading").show();$.ajax({type:"POST",url:A,data:{item_id:B},dataType:"json",error:function(C){$("li#item"+B+" img.loading").hide();alert(C.responseText)},success:function(C){$("li#item"+B+" img.loading").hide();if(C.status==1){$("li#item"+B).addClass("added");$("li#item"+B+" div.itembtn a.additem").hide();$("li#item"+B+" div.itembtn a.removeitem").show()}else{alert(C.error)}}});return false}function removeitem(C,B,A){$("li#item"+C+" img.loading").show();$.ajax({type:"POST",url:B,data:{item_id:C},dataType:"json",error:function(D){$("li#item"+C+" img.loading").hide();alert(D.responseText)},success:function(D){$("li#item"+C+" img.loading").hide();if(D.status==1){$("li#item"+C).removeClass("added");$("li#item"+C+" div.itembtn a.removeitem").hide();$("li#item"+C+" div.itembtn a.additem").show();if(A==true){$("li#item"+C).fadeOut("fast").removeClass("added")}else{$("li#item"+C).removeClass("added")}}else{alert(D.error)}}});return false}(function(A){A.fn.faq=function(){A(this).find("div").hide();A(this).find("a.q").toggle(function(){A(this).next("div").fadeIn("fast")},function(){A(this).next("div").hide()})}})(jQuery);/**
 * jQuery.LocalScroll - Animated scrolling navigation, using anchors.
 * Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 6/3/2008
 * @author Ariel Flesler
 * @version 1.2.6
 **/
(function($){var g=location.href.replace(/#.*/,''),h=$.localScroll=function(a){$('body').localScroll(a)};h.defaults={duration:1e3,axis:'y',event:'click',stop:1};h.hash=function(a){a=$.extend({},h.defaults,a);a.hash=0;if(location.hash)setTimeout(function(){i(0,location,a)},0)};$.fn.localScroll=function(b){b=$.extend({},h.defaults,b);return(b.persistent||b.lazy)?this.bind(b.event,function(e){var a=$([e.target,e.target.parentNode]).filter(c)[0];a&&i(e,a,b)}):this.find('a,area').filter(c).bind(b.event,function(e){i(e,this,b)}).end().end();function c(){var a=this;return!!a.href&&!!a.hash&&a.href.replace(a.hash,'')==g&&(!b.filter||$(a).is(b.filter))}};function i(e,a,b){var c=a.hash.slice(1),d=document.getElementById(c)||document.getElementsByName(c)[0],f;if(d){e&&e.preventDefault();f=$(b.target||$.scrollTo.window());if(b.lock&&f.is(':animated')||b.onBefore&&b.onBefore.call(a,e,d,f)===!1)return;if(b.stop)f.queue('fx',[]).stop();f.scrollTo(d,b).trigger('notify.serialScroll',[d]);if(b.hash)f.queue(function(){location=a.hash;$(this).dequeue()})}}})(jQuery);
/**
 * jQuery.ScrollTo - Easy element scrolling using jQuery.
 * Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 * Date: 2/19/2008
 * @author Ariel Flesler
 * @version 1.3.3
 */
(function($){var o=$.scrollTo=function(a,b,c){o.window().scrollTo(a,b,c)};o.defaults={axis:'y',duration:1};o.window=function(){return $($.browser.safari?'body':'html')};$.fn.scrollTo=function(l,m,n){if(typeof m=='object'){n=m;m=0}n=$.extend({},o.defaults,n);m=m||n.speed||n.duration;n.queue=n.queue&&n.axis.length>1;if(n.queue)m/=2;n.offset=j(n.offset);n.over=j(n.over);return this.each(function(){var a=this,b=$(a),t=l,c,d={},w=b.is('html,body');switch(typeof t){case'number':case'string':if(/^([+-]=)?\d+(px)?$/.test(t)){t=j(t);break}t=$(t,this);case'object':if(t.is||t.style)c=(t=$(t)).offset()}$.each(n.axis.split(''),function(i,f){var P=f=='x'?'Left':'Top',p=P.toLowerCase(),k='scroll'+P,e=a[k],D=f=='x'?'Width':'Height';if(c){d[k]=c[p]+(w?0:e-b.offset()[p]);if(n.margin){d[k]-=parseInt(t.css('margin'+P))||0;d[k]-=parseInt(t.css('border'+P+'Width'))||0}d[k]+=n.offset[p]||0;if(n.over[p])d[k]+=t[D.toLowerCase()]()*n.over[p]}else d[k]=t[p];if(/^\d+$/.test(d[k]))d[k]=d[k]<=0?0:Math.min(d[k],h(D));if(!i&&n.queue){if(e!=d[k])g(n.onAfterFirst);delete d[k]}});g(n.onAfter);function g(a){b.animate(d,m,n.easing,a&&function(){a.call(this,l)})};function h(D){var b=w?$.browser.opera?document.body:document.documentElement:a;return b['scroll'+D]-b['client'+D]}})};function j(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
/*
 * Thickbox 3 - One Box To Rule Them All.
 * By Cody Lindley (http://www.codylindley.com)
 * Copyright (c) 2007 cody lindley
 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/
var tb_pathToImage = "/images/loading2_dark.gif";
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('$(o).2S(9(){1u(\'a.18, 3n.18, 3i.18\');1w=1p 1t();1w.L=2H});9 1u(b){$(b).s(9(){6 t=X.Q||X.1v||M;6 a=X.u||X.23;6 g=X.1N||P;19(t,a,g);X.2E();H P})}9 19(d,f,g){3m{3(2t o.v.J.2i==="2g"){$("v","11").r({A:"28%",z:"28%"});$("11").r("22","2Z");3(o.1Y("1F")===M){$("v").q("<U 5=\'1F\'></U><4 5=\'B\'></4><4 5=\'8\'></4>");$("#B").s(G)}}n{3(o.1Y("B")===M){$("v").q("<4 5=\'B\'></4><4 5=\'8\'></4>");$("#B").s(G)}}3(1K()){$("#B").1J("2B")}n{$("#B").1J("2z")}3(d===M){d=""}$("v").q("<4 5=\'K\'><1I L=\'"+1w.L+"\' /></4>");$(\'#K\').2y();6 h;3(f.O("?")!==-1){h=f.3l(0,f.O("?"))}n{h=f}6 i=/\\.2s$|\\.2q$|\\.2m$|\\.2l$|\\.2k$/;6 j=h.1C().2h(i);3(j==\'.2s\'||j==\'.2q\'||j==\'.2m\'||j==\'.2l\'||j==\'.2k\'){1D="";1G="";14="";1z="";1x="";R="";1n="";1r=P;3(g){E=$("a[@1N="+g+"]").36();25(D=0;((D<E.1c)&&(R===""));D++){6 k=E[D].u.1C().2h(i);3(!(E[D].u==f)){3(1r){1z=E[D].Q;1x=E[D].u;R="<1e 5=\'1X\'>&1d;&1d;<a u=\'#\'>2T &2R;</a></1e>"}n{1D=E[D].Q;1G=E[D].u;14="<1e 5=\'1U\'>&1d;&1d;<a u=\'#\'>&2O; 2N</a></1e>"}}n{1r=1b;1n="1t "+(D+1)+" 2L "+(E.1c)}}}S=1p 1t();S.1g=9(){S.1g=M;6 a=2x();6 x=a[0]-1M;6 y=a[1]-1M;6 b=S.z;6 c=S.A;3(b>x){c=c*(x/b);b=x;3(c>y){b=b*(y/c);c=y}}n 3(c>y){b=b*(y/c);c=y;3(b>x){c=c*(x/b);b=x}}13=b+30;1a=c+2G;$("#8").q("<a u=\'\' 5=\'1L\' Q=\'1o\'><1I 5=\'2F\' L=\'"+f+"\' z=\'"+b+"\' A=\'"+c+"\' 23=\'"+d+"\'/></a>"+"<4 5=\'2D\'>"+d+"<4 5=\'2C\'>"+1n+14+R+"</4></4><4 5=\'2A\'><a u=\'#\' 5=\'Z\' Q=\'1o\'>1l</a> 1k 1j 1s</4>");$("#Z").s(G);3(!(14==="")){9 12(){3($(o).N("s",12)){$(o).N("s",12)}$("#8").C();$("v").q("<4 5=\'8\'></4>");19(1D,1G,g);H P}$("#1U").s(12)}3(!(R==="")){9 1i(){$("#8").C();$("v").q("<4 5=\'8\'></4>");19(1z,1x,g);H P}$("#1X").s(1i)}o.1h=9(e){3(e==M){I=2w.2v}n{I=e.2u}3(I==27){G()}n 3(I==3k){3(!(R=="")){o.1h="";1i()}}n 3(I==3j){3(!(14=="")){o.1h="";12()}}};16();$("#K").C();$("#1L").s(G);$("#8").r({Y:"T"})};S.L=f}n{6 l=f.2r(/^[^\\?]+\\??/,\'\');6 m=2p(l);13=(m[\'z\']*1)+30||3h;1a=(m[\'A\']*1)+3g||3f;W=13-30;V=1a-3e;3(f.O(\'2j\')!=-1){1E=f.1B(\'3d\');$("#15").C();3(m[\'1A\']!="1b"){$("#8").q("<4 5=\'2f\'><4 5=\'1H\'>"+d+"</4><4 5=\'2e\'><a u=\'#\' 5=\'Z\' Q=\'1o\'>1l</a> 1k 1j 1s</4></4><U 1W=\'0\' 2d=\'0\' L=\'"+1E[0]+"\' 5=\'15\' 1v=\'15"+1f.2c(1f.1y()*2b)+"\' 1g=\'1m()\' J=\'z:"+(W+29)+"p;A:"+(V+17)+"p;\' > </U>")}n{$("#B").N();$("#8").q("<U 1W=\'0\' 2d=\'0\' L=\'"+1E[0]+"\' 5=\'15\' 1v=\'15"+1f.2c(1f.1y()*2b)+"\' 1g=\'1m()\' J=\'z:"+(W+29)+"p;A:"+(V+17)+"p;\'> </U>")}}n{3($("#8").r("Y")!="T"){3(m[\'1A\']!="1b"){$("#8").q("<4 5=\'2f\'><4 5=\'1H\'>"+d+"</4><4 5=\'2e\'><a u=\'#\' 5=\'Z\'>1l</a> 1k 1j 1s</4></4><4 5=\'F\' J=\'z:"+W+"p;A:"+V+"p\'></4>")}n{$("#B").N();$("#8").q("<4 5=\'F\' 3c=\'3b\' J=\'z:"+W+"p;A:"+V+"p;\'></4>")}}n{$("#F")[0].J.z=W+"p";$("#F")[0].J.A=V+"p";$("#F")[0].3a=0;$("#1H").11(d)}}$("#Z").s(G);3(f.O(\'37\')!=-1){$("#F").q($(\'#\'+m[\'26\']).1T());$("#8").24(9(){$(\'#\'+m[\'26\']).q($("#F").1T())});16();$("#K").C();$("#8").r({Y:"T"})}n 3(f.O(\'2j\')!=-1){16();3($.1q.35){$("#K").C();$("#8").r({Y:"T"})}}n{$("#F").34(f+="&1y="+(1p 33().32()),9(){16();$("#K").C();1u("#F a.18");$("#8").r({Y:"T"})})}}3(!m[\'1A\']){o.21=9(e){3(e==M){I=2w.2v}n{I=e.2u}3(I==27){G()}}}}31(e){}}9 1m(){$("#K").C();$("#8").r({Y:"T"})}9 G(){$("#2Y").N("s");$("#Z").N("s");$("#8").2X("2W",9(){$(\'#8,#B,#1F\').2V("24").N().C()});$("#K").C();3(2t o.v.J.2i=="2g"){$("v","11").r({A:"1Z",z:"1Z"});$("11").r("22","")}o.1h="";o.21="";H P}9 16(){$("#8").r({2U:\'-\'+20((13/2),10)+\'p\',z:13+\'p\'});3(!(1V.1q.2Q&&1V.1q.2P<7)){$("#8").r({38:\'-\'+20((1a/2),10)+\'p\'})}}9 2p(a){6 b={};3(!a){H b}6 c=a.1B(/[;&]/);25(6 i=0;i<c.1c;i++){6 d=c[i].1B(\'=\');3(!d||d.1c!=2){39}6 e=2a(d[0]);6 f=2a(d[1]);f=f.2r(/\\+/g,\' \');b[e]=f}H b}9 2x(){6 a=o.2M;6 w=1S.2o||1R.2o||(a&&a.1Q)||o.v.1Q;6 h=1S.1P||1R.1P||(a&&a.2n)||o.v.2n;1O=[w,h];H 1O}9 1K(){6 a=2K.2J.1C();3(a.O(\'2I\')!=-1&&a.O(\'3o\')!=-1){H 1b}}',62,211,'|||if|div|id|var||TB_window|function||||||||||||||else|document|px|append|css|click||href|body||||width|height|TB_overlay|remove|TB_Counter|TB_TempArray|TB_ajaxContent|tb_remove|return|keycode|style|TB_load|src|null|unbind|indexOf|false|title|TB_NextHTML|imgPreloader|block|iframe|ajaxContentH|ajaxContentW|this|display|TB_closeWindowButton||html|goPrev|TB_WIDTH|TB_PrevHTML|TB_iframeContent|tb_position||thickbox|tb_show|TB_HEIGHT|true|length|nbsp|span|Math|onload|onkeydown|goNext|Esc|or|close|tb_showIframe|TB_imageCount|Close|new|browser|TB_FoundURL|Key|Image|tb_init|name|imgLoader|TB_NextURL|random|TB_NextCaption|modal|split|toLowerCase|TB_PrevCaption|urlNoQuery|TB_HideSelect|TB_PrevURL|TB_ajaxWindowTitle|img|addClass|tb_detectMacXFF|TB_ImageOff|150|rel|arrayPageSize|innerHeight|clientWidth|self|window|children|TB_prev|jQuery|frameborder|TB_next|getElementById|auto|parseInt|onkeyup|overflow|alt|unload|for|inlineId||100||unescape|1000|round|hspace|TB_closeAjaxWindow|TB_title|undefined|match|maxHeight|TB_iframe|bmp|gif|png|clientHeight|innerWidth|tb_parseQuery|jpeg|replace|jpg|typeof|which|keyCode|event|tb_getPageSize|show|TB_overlayBG|TB_closeWindow|TB_overlayMacFFBGHack|TB_secondLine|TB_caption|blur|TB_Image|60|tb_pathToImage|mac|userAgent|navigator|of|documentElement|Prev|lt|version|msie|gt|ready|Next|marginLeft|trigger|fast|fadeOut|TB_imageOff|hidden||catch|getTime|Date|load|safari|get|TB_inline|marginTop|continue|scrollTop|TB_modal|class|TB_|45|440|40|630|input|188|190|substr|try|area|firefox'.split('|'),0,{}));


jQuery.imgAreaSelect=function(img,options){var $area=jQuery('<div></div>'),$border1=jQuery('<div></div>'),$border2=jQuery('<div></div>'),$outLeft=jQuery('<div></div>'),$outTop=jQuery('<div></div>'),$outRight=jQuery('<div></div>'),$outBottom=jQuery('<div></div>'),imgOfs,imgWidth,imgHeight,zIndex=0,fixed=false,$p,startX,startY,moveX,moveY,resizeMargin=10,resize=[],V=0,H=1,d,aspectRatio,x1,x2,y1,y2,x,y,selection={x1:0,y1:0,x2:0,y2:0,width:0,height:0};var $a=$area.add($border1).add($border2);var $o=$outLeft.add($outTop).add($outRight).add($outBottom);function update(){$a.css({left:(selection.x1+imgOfs.left)+'px',top:(selection.y1+imgOfs.top)+'px',width:Math.max(selection.width-options.borderWidth*2,0)+'px',height:Math.max(selection.height-options.borderWidth*2,0)+'px'});$outLeft.css({left:imgOfs.left+'px',top:imgOfs.top+'px',width:selection.x1+'px',height:imgHeight+'px'});$outTop.css({left:imgOfs.left+selection.x1+'px',top:imgOfs.top+'px',width:selection.width+'px',height:selection.y1+'px'});$outRight.css({left:imgOfs.left+selection.x2+'px',top:imgOfs.top+'px',width:imgWidth-selection.x2+'px',height:imgHeight+'px'});$outBottom.css({left:imgOfs.left+selection.x1+'px',top:imgOfs.top+selection.y2+'px',width:selection.width+'px',height:imgHeight-selection.y2+'px'})}function areaMouseMove(event){x=event.pageX-selection.x1-imgOfs.left;y=event.pageY-selection.y1-imgOfs.top;resize=[];if(options.resizable){if(y<=resizeMargin)resize[V]='n';else if(y>=selection.height-resizeMargin)resize[V]='s';if(x<=resizeMargin)resize[H]='w';else if(x>=selection.width-resizeMargin)resize[H]='e'}$border2.css('cursor',resize.length?resize.join('')+'-resize':options.movable?'move':'')}function areaMouseDown(event){if(event.which!=1)return false;if(options.resizable&&resize.length>0){jQuery('body').css('cursor',resize.join('')+'-resize');x1=(resize[H]=='w'?selection.x2:selection.x1)+imgOfs.left;y1=(resize[V]=='n'?selection.y2:selection.y1)+imgOfs.top;jQuery(document).mousemove(selectingMouseMove);$border2.unbind('mousemove',areaMouseMove);jQuery(document).one('mouseup',function(){resize=[];jQuery('body').css('cursor','');if(options.autoHide)$a.add($o).hide();options.onSelectEnd(img,selection);jQuery(document).unbind('mousemove',selectingMouseMove);$border2.mousemove(areaMouseMove)})}else if(options.movable){moveX=selection.x1+imgOfs.left;moveY=selection.y1+imgOfs.top;startX=event.pageX;startY=event.pageY;jQuery(document).mousemove(movingMouseMove).one('mouseup',function(){options.onSelectEnd(img,selection);jQuery(document).unbind('mousemove',movingMouseMove)})}else jQuery(img).mousedown(event);return false}function aspectRatioXY(){x2=Math.max(imgOfs.left,Math.min(imgOfs.left+imgWidth,x1+Math.abs(y2-y1)*aspectRatio*(x2>x1?1:-1)));y2=Math.round(Math.max(imgOfs.top,Math.min(imgOfs.top+imgHeight,y1+Math.abs(x2-x1)/aspectRatio*(y2>y1?1:-1))));x2=Math.round(x2)}function aspectRatioYX(){y2=Math.max(imgOfs.top,Math.min(imgOfs.top+imgHeight,y1+Math.abs(x2-x1)/aspectRatio*(y2>y1?1:-1)));x2=Math.round(Math.max(imgOfs.left,Math.min(imgOfs.left+imgWidth,x1+Math.abs(y2-y1)*aspectRatio*(x2>x1?1:-1))));y2=Math.round(y2)}function selectingMouseMove(event){x2=!resize.length||resize[H]||aspectRatio?event.pageX:selection.x2+imgOfs.left;y2=!resize.length||resize[V]||aspectRatio?event.pageY:selection.y2+imgOfs.top;if(options.minWidth&&Math.abs(x2-x1)<options.minWidth){x2=x1-options.minWidth*(x2<x1?1:-1);if(x2<imgOfs.left)x1=imgOfs.left+options.minWidth;else if(x2>imgOfs.left+imgWidth)x1=imgOfs.left+imgWidth-options.minWidth}if(options.minHeight&&Math.abs(y2-y1)<options.minHeight){y2=y1-options.minHeight*(y2<y1?1:-1);if(y2<imgOfs.top)y1=imgOfs.top+options.minHeight;else if(y2>imgOfs.top+imgHeight)y1=imgOfs.top+imgHeight-options.minHeight}x2=Math.max(imgOfs.left,Math.min(x2,imgOfs.left+imgWidth));y2=Math.max(imgOfs.top,Math.min(y2,imgOfs.top+imgHeight));if(aspectRatio)if(Math.abs(x2-x1)/aspectRatio>Math.abs(y2-y1))aspectRatioYX();else aspectRatioXY();if(options.maxWidth&&Math.abs(x2-x1)>options.maxWidth){x2=x1-options.maxWidth*(x2<x1?1:-1);if(aspectRatio)aspectRatioYX()}if(options.maxHeight&&Math.abs(y2-y1)>options.maxHeight){y2=y1-options.maxHeight*(y2<y1?1:-1);if(aspectRatio)aspectRatioXY()}selection.x1=Math.min(x1,x2)-imgOfs.left;selection.x2=Math.max(x1,x2)-imgOfs.left;selection.y1=Math.min(y1,y2)-imgOfs.top;selection.y2=Math.max(y1,y2)-imgOfs.top;selection.width=Math.abs(x2-x1);selection.height=Math.abs(y2-y1);update();options.onSelectChange(img,selection);return false}function movingMouseMove(event){x1=Math.max(imgOfs.left,Math.min(moveX+event.pageX-startX,imgOfs.left+imgWidth-selection.width));y1=Math.max(imgOfs.top,Math.min(moveY+event.pageY-startY,imgOfs.top+imgHeight-selection.height));x2=x1+selection.width;y2=y1+selection.height;selection.x1=x1-imgOfs.left;selection.y1=y1-imgOfs.top;selection.x2=x2-imgOfs.left;selection.y2=y2-imgOfs.top;update();options.onSelectChange(img,selection);event.preventDefault();return false}function imgMouseDown(event){if(event.which!=1)return false;startX=x1=event.pageX;startY=y1=event.pageY;selection.x1=selection.x2=x1-imgOfs.left;selection.y1=selection.y2=y1-imgOfs.top;selection.width=0;selection.height=0;resize=[];update();$a.add($o).show();jQuery(document).mousemove(selectingMouseMove);$border2.unbind('mousemove',areaMouseMove);options.onSelectStart(img,selection);jQuery(document).one('mouseup',function(){if(options.autoHide)$a.add($o).hide();options.onSelectEnd(img,selection);jQuery(document).unbind('mousemove',selectingMouseMove);$border2.mousemove(areaMouseMove)});return false}this.setOptions=function(newOptions){options=jQuery.extend(options,newOptions);if(newOptions.x1!=null){selection.x1=newOptions.x1;selection.y1=newOptions.y1;selection.x2=newOptions.x2;selection.y2=newOptions.y2;newOptions.show=true}imgWidth=jQuery(img).width();imgHeight=jQuery(img).height();imgOfs=jQuery(img).offset();$p=jQuery(img);while($p.length&&!$p.is('body')){if(!isNaN($p.css('z-index'))&&$p.css('z-index')>zIndex)zIndex=$p.css('z-index');if($p.css('position')=='fixed')fixed=true;$p=$p.parent()}x1=selection.x1+imgOfs.left;y1=selection.y1+imgOfs.top;x2=selection.x2+imgOfs.left;y2=selection.y2+imgOfs.top;selection.width=x2-x1;selection.height=y2-y1;update();if(newOptions.hide)$a.add($o).hide();else if(newOptions.show)$a.add($o).show();$a.css({borderWidth:options.borderWidth+'px'});$area.css({backgroundColor:options.selectionColor,opacity:options.selectionOpacity});$border1.css({borderStyle:'solid',borderColor:options.borderColor1});$border2.css({borderStyle:'dashed',borderColor:options.borderColor2});$o.css({opacity:options.outerOpacity,backgroundColor:options.outerColor});aspectRatio=options.aspectRatio&&(d=options.aspectRatio.split(/:/))?d[0]/d[1]:null;if(options.disable||options.enable===false){$a.unbind('mousemove',areaMouseMove).unbind('mousedown',areaMouseDown);jQuery(img).add($o).unbind('mousedown',imgMouseDown)}else if(options.enable||options.disable===false){if(options.resizable||options.movable)$a.mousemove(areaMouseMove).mousedown(areaMouseDown);jQuery(img).add($o).mousedown(imgMouseDown)}options.enable=options.disable=undefined};if(jQuery.browser.msie)jQuery(img).attr('unselectable','on');$a.add($o).css({display:'none',position:fixed?'fixed':'absolute',overflow:'hidden',zIndex:zIndex>0?zIndex:null});$area.css({borderStyle:'solid'});jQuery('body').append($o.add($a));initOptions={borderColor1:'#000',borderColor2:'#fff',borderWidth:1,movable:true,resizable:true,selectionColor:'#fff',selectionOpacity:0.2,outerColor:'#000',outerOpacity:0.2,onSelectStart:function(){},onSelectChange:function(){},onSelectEnd:function(){}};options=jQuery.extend(initOptions,options);this.setOptions(options)};jQuery.fn.imgAreaSelect=function(options){options=options||{};this.each(function(){if(jQuery(this).data('imgAreaSelect'))jQuery(this).data('imgAreaSelect').setOptions(options);else{if(options.enable===undefined&&options.disable===undefined)options.enable=true;jQuery(this).data('imgAreaSelect',new jQuery.imgAreaSelect(this,options))}});return this};
