/*
 * jQuery Color Animations
 * Copyright 2007 John Resig
 * Released under the MIT and GPL licenses.
 */
(function(D){D.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(F,E){D.fx.step[E]=function(G){if(G.state==0){G.start=C(G.elem,E);G.end=B(G.end)}G.elem.style[E]="rgb("+[Math.max(Math.min(parseInt((G.pos*(G.end[0]-G.start[0]))+G.start[0]),255),0),Math.max(Math.min(parseInt((G.pos*(G.end[1]-G.start[1]))+G.start[1]),255),0),Math.max(Math.min(parseInt((G.pos*(G.end[2]-G.start[2]))+G.start[2]),255),0)].join(",")+")"}});function B(F){var E;if(F&&F.constructor==Array&&F.length==3){return F}if(E=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(F)){return[parseInt(E[1]),parseInt(E[2]),parseInt(E[3])]}if(E=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(F)){return[parseFloat(E[1])*2.55,parseFloat(E[2])*2.55,parseFloat(E[3])*2.55]}if(E=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(F)){return[parseInt(E[1],16),parseInt(E[2],16),parseInt(E[3],16)]}if(E=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(F)){return[parseInt(E[1]+E[1],16),parseInt(E[2]+E[2],16),parseInt(E[3]+E[3],16)]}return A[D.trim(F).toLowerCase()]}function C(G,E){var F;do{F=D.curCSS(G,E);if(F!=""&&F!="transparent"||D.nodeName(G,"body")){break}E="backgroundColor"}while(G=G.parentNode);return B(F)}var A={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]}})(jQuery);
/*
 * Uploader: unobtrusive file uploads using Flash and jQuery.
 *
 * Copyright (c) 2008, Webunity
 * All rights reserved.

 * Redistribution and use of this software in source and binary forms, with or
 * without modification, are permitted provided that the following conditions
 * are met:
 * 		- Redistributions of source code must retain the above copyright
 *        notice, this list of conditions and the following disclaimer.
 * 		- Redistributions in binary form must reproduce the above copyright
 *        notice, this list of conditions and the following disclaimer in the
 *        documentation and/or other materials provided with the distribution.
 * 		- Neither the name of Webunity nor the names of its contributors may
 *        be used to endorse or promote products derived from this software
 *        without specific prior written permission of Webunity.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 * THE POSSIBILITY OF SUCH DAMAGE.
 *
 * -----
 *
 * Documentation:
 * Please refer to the wiki on <http://jquery.webunity.nl> for up to date documentation.
 */
(function(A){A.uploader=function(B,C){this.construct(B,C)};A.extend(A.uploader.prototype,{events:new Array(),_eventsQueue:new Array(),_cache:new Array(),_swf:null,_settings:null,construct:function(C,F){F=F||{};F.containerID=C;F.movieID=F.movieID||("uploader"+(this._cache.length+1));F.backgroundColor=F.backgroundColor||"#ffffff";F.wmode=F.wmode||"transparent";F.logging=F.logging||"0";F.allowedDomain=F.allowedDomain||"*";F.enabled=F.enabled||"1";F.multiple=F.multiple||"1";F.maxFileSize=F.maxFileSize||-1;F.maxQueueSize=F.maxQueueSize||-1;F.maxQueueCount=F.maxQueueCount||-1;F.maxThreads=F.maxThreads||"6";F.autoAdvanceOnCancel=F.autoAdvanceOnCancel||"1";F.autoAdvanceOnError=F.autoAdvanceOnError||"1";if(F.buttonSkin==""){F.wmode="transparent"}this._eventsQueue=this._eventsQueue||[];this._configs=this._configs||{};this._settings=F;this.events=this.events||{};A.extend(this.events,{uploaderReady:function(){},uploaderFailed:function(){},rollOver:function(){},mouseDown:function(){},mouseUp:function(){},rollOut:function(){},multipleFilesDialogOpened:function(){},multipleFilesDialogClosed:function(G){},multipleFilesDialogCancelled:function(){},singleFileDialogOpened:function(){},singleFileDialogClosed:function(G){},singleFileDialogCancelled:function(){},fileErrorSize:function(G){},fileErrorExtension:function(G){},fileErrorNotFound:function(G){},queueErrorSize:function(G){},queueErrorEmpty:function(G){},queueErrorCount:function(G){},fileAdded:function(G){},fileRemoved:function(G){},queueCleared:function(){},queueStarted:function(){},fileUploadStarted:function(G){},fileUploadProgress:function(G){},fileUploadCancelled:function(G){},fileUploadCompleted:function(G){},fileUploadError:function(G){},fileUploadServerData:function(G){},queueCancelled:function(G){},queueCompleted:function(G){}});var E=Math.floor(Math.random()*10000);var D=new Array();D.eventHandler="jQuery.uploader.eventHandler";D.elementID=this._settings.movieID;if(this._settings.buttonSkin){D.buttonSkin=this._settings.buttonSkin}D.logging=this._settings.logging;D.allowedDomain=this._settings.allowedDomain;D.enabled=this._settings.enabled;D.multiple=this._settings.multiple;D.maxFileSize=this._settings.maxFileSize;D.maxQueueSize=this._settings.maxQueueSize;D.maxQueueCount=this._settings.maxQueueCount;D.maxThreads=this._settings.maxThreads;D.autoAdvanceOnCancel=this._settings.autoAdvanceOnCancel;D.autoAdvanceOnError=this._settings.autoAdvanceOnError;fVars="";for(var B in D){if(fVars!=""){fVars+="&"}fVars+=B+"="+D[B]}swfHTML=AC_FL_GetContent("codebase","http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,45,0","width","100%","height","100%","menu","false","src",this._settings.swfURL+"?"+E,"quality","high","bgcolor",this._settings.backgroundColor,"id",this._settings.movieID,"name",this._settings.movieID+"Name","pluginspage","http://www.macromedia.com/go/getflashplayer","movie",this._settings.swfURL+"?"+E,"flashvars",fVars,"wmode",this._settings.wmode);A("#"+this._settings.containerID)[0].innerHTML=swfHTML;this._swf=A("#"+this._settings.movieID)[0];this._swf.uploader=this},_queueEvent:function(D){if(typeof this.events[D.type]==="function"){var C=arguments;this._eventsQueue.push(function(){this.events[D.type].apply(this,C)});var B=this;setTimeout(function(){B._executeNextEvent()},0)}},_executeNextEvent:function(){var B=this._eventsQueue?this._eventsQueue.shift():null;if(typeof (B)==="function"){B.apply(this)}},addZero:function(B){return(B<10)?"0"+B:B},getDateTime:function(){var B=new Date();var C={y:B.getFullYear(),m:(B.getMonth()+1),d:B.getDate(),h:B.getHours(),i:B.getMinutes(),s:B.getSeconds()};C.date=this.addZero(C.d)+"-"+this.addZero(C.m)+"-"+C.y;C.time=this.addZero(C.h)+":"+this.addZero(C.i)+":"+this.addZero(C.s);return C},parseTime:function(B){iHours=Math.round(B/3600);B-=(iHours*3600);iMinutes=Math.round(B/60);B-=(iMinutes*60);iSeconds=Math.round(B);return{h:iHours,i:iMinutes,s:iSeconds}},formatTime:function(D){var B=this.parseTime(D);var C="";if(iHours>0){C+=this.addZero(B.h)+":"}C+=this.addZero(B.i)+":";C+=this.addZero(B.s);return C},formatNumber:function(E,C,J,D){var B=E,I=isNaN(C=Math.abs(C))?2:C;var H=J==undefined?".":J;var K=D==undefined?",":D,L=B<0?"-":"";var G=parseInt(B=Math.abs(+B||0).toFixed(I))+"",F=(F=G.length)>3?F%3:0;return L+(F?G.substr(0,F)+K:"")+G.substr(F).replace(/(\d{3})(?=\d)/g,"$1"+K)+(I?H+Math.abs(B-G).toFixed(I).slice(2):"")},formatSize:function(B){if(B>=1073741824){B=this.formatNumber(B/1073741824,2,".","")+" Gb"}else{if(B>=1048576){B=this.formatNumber(B/1048576,2,".","")+" Mb"}else{if(B>=1024){B=this.formatNumber(B/1024,2)+" Kb"}else{B=this.formatNumber(B,0)+" bytes"}}}return B},setEnabled:function(B){this._swf.setEnabled(B?"1":"0")},setLogging:function(B){this._swf.setLogging(B?"1":"0")},setMultiple:function(B){this._swf.setMultiple(B?"1":"0")},setFilters:function(B){this._swf.setFilters(B)},setMaxFileSize:function(B){this._swf.setMaxFileSize(B)},setMaxQueueSize:function(B){this._swf.setMaxQueueSize(B)},setMaxQueueCount:function(B){this._swf.setMaxQueueCount(B)},setMaxThreads:function(B){this._swf.setMaxThreads(B)},setAutoAdvanceOnCancel:function(B){this._swf.setAutoAdvanceOnCancel(B?"1":"0")},setAutoAdvanceOnError:function(B){this._swf.setAutoAdvanceOnError(B?"1":"0")},remove:function(B){this._swf.remove(B)},cancel:function(B){this._swf.cancel(B)},upload:function(B,C,F,D,E){this._swf.upload(B,C,F,D,E)}});A.uploader.eventHandler=function(B,D){if(D.type){var C=A("#"+B)[0];if(!C.uploader){setTimeout(function(){A.uploader.eventHandler(B,D)},10);return }C.uploader._queueEvent(D)}};A.fn.uploader=function(B){return new A.uploader(this[0].id,B)}})(jQuery);var isIE=(navigator.appVersion.indexOf("MSIE")!=-1)?true:false;var isWin=(navigator.appVersion.toLowerCase().indexOf("win")!=-1)?true:false;var isOpera=(navigator.userAgent.indexOf("Opera")!=-1)?true:false;function AC_Generate(E,D,A){var C="";if(isIE&&isWin&&!isOpera){C+="<object ";for(var B in E){C+=B+'="'+E[B]+'" '}C+=">";for(var B in D){C+='<param name="'+B+'" value="'+D[B]+'" />'}C+="</object>"}else{C+="<embed ";for(var B in A){C+=B+'="'+A[B]+'" '}C+="> </embed>"}return C}function AC_AddExtension(B,A){if(B.indexOf(A)!=-1){return B}return(B.indexOf("?")!=-1)?B.replace(/\?/,A+"?"):B+A}function AC_GetArgs(B,E,G,D,H){var A=new Object();A.embedAttrs=new Object();A.params=new Object();A.objAttrs=new Object();for(var C=0;C<B.length;C=C+2){var F=B[C].toLowerCase();switch(F){case"classid":break;case"pluginspage":A.embedAttrs[B[C]]=B[C+1];break;case"src":case"movie":B[C+1]=AC_AddExtension(B[C+1],E);A.embedAttrs.src=B[C+1];A.params[G]=B[C+1];break;case"onafterupdate":case"onbeforeupdate":case"onblur":case"oncellchange":case"onclick":case"ondblClick":case"ondrag":case"ondragend":case"ondragenter":case"ondragleave":case"ondragover":case"ondrop":case"onfinish":case"onfocus":case"onhelp":case"onmousedown":case"onmouseup":case"onmouseover":case"onmousemove":case"onmouseout":case"onkeypress":case"onkeydown":case"onkeyup":case"onload":case"onlosecapture":case"onpropertychange":case"onreadystatechange":case"onrowsdelete":case"onrowenter":case"onrowexit":case"onrowsinserted":case"onstart":case"onscroll":case"onbeforeeditfocus":case"onactivate":case"onbeforedeactivate":case"ondeactivate":case"type":case"codebase":A.objAttrs[B[C]]=B[C+1];break;case"id":case"width":case"height":case"align":case"vspace":case"hspace":case"class":case"title":case"accesskey":case"name":case"tabindex":A.embedAttrs[B[C]]=A.objAttrs[B[C]]=B[C+1];break;default:A.embedAttrs[B[C]]=A.params[B[C]]=B[C+1]}}A.objAttrs.classid=D;if(H){A.embedAttrs.type=H}return A}function AC_FL_GetContent(){var A=AC_GetArgs(arguments,".swf","movie","clsid:d27cdb6e-ae6d-11cf-96b8-444553540000","application/x-shockwave-flash");return AC_Generate(A.objAttrs,A.params,A.embedAttrs)}function AC_FL_RunContent(){document.write(AC_FL_GetContent(arguments))}function AC_SW_GetContent(){var A=AC_GetArgs(arguments,".dcr","src","clsid:166B1BCA-3F9C-11CF-8075-444553540000",null);return AC_Generate(A.objAttrs,A.params,A.embedAttrs)}function AC_SW_RunContent(){document.write(AC_SW_GetContent(arguments))}
/*
 * GameMarkt JavaScript
 * http://gamemarkt.net/
 *
 * Copyright (c) 2009 Javier Martinez
 *
 * Date: 2009-03-03 20:17:21 -0500 (Tue, 03 Mar 2009)
 * Revision: 1
 */
$(function(){var doc=$(document),win=$(window);if(!!$("#logout, #control_panel").length){var timeout;win.scroll(function(){clearTimeout(timeout);timeout=setTimeout(function(){var scroll=win.scrollTop();feedbackButton.animate({top:scroll+100})},300)}),feedbackButton=$('<div id="feedback_button"/>').appendTo("body").click(function(e){e.stopPropagation();var overlay=$('<div id="feedback_overlay"/>').css({opacity:0,height:doc.height()}).appendTo("body").fadeTo("fast",0.8);var form=$('<div id="feedback_form"><textarea/><button/></div>').appendTo("body"),textarea=form.find("textarea").focus(),button=textarea.next().click(function(e){$.post("/index/feedback","text="+textarea.val());close()});var close=function(){form.remove();overlay.fadeTo("fast",0,function(){overlay.remove()});doc.unbind("click").unbind("keydown")};doc.click(function(e){if(e.target==overlay[0]){close()}}).keydown(function(e){if(e.which==27){close()}});win.scrollTop(0)})}var timeout,results=[],autocompleter=$('<div id="autocompleter" style="display:none"/>').appendTo("body").click(function(e){var target=$(e.target);if(target.is("p")){target.addClass("selected").siblings(".selected").removeClass("selected");var text=target.text(),el=autocompleter.data("target").val(text),fn=el.data("autocompleter");fn(text)}});var makeAutocomplete=function(selector,cls,url,fn){var el=$(selector).data("autocompleter",fn).attr("autocomplete","off").keydown(function(e){clearTimeout(timeout);autocompleter[0].className=cls;switch(e.which){case 13:if(autocompleter[0].offsetWidth>0){e.preventDefault();var selected=autocompleter.fadeOut("fast").find("p.selected"),text=selected.text();el.val(text);fn(text)}break;case 27:if(autocompleter[0].offsetWidth>0){autocompleter.fadeOut("fast")}break;case 38:case 40:var len=results.length;if(len>0){if(autocompleter[0].offsetWidth==0){autocompleter.data("target",el).show()}var selected=autocompleter.find("p.selected");if(e.which==40){var next=selected.next(),toSelect=next.length?next:autocompleter.find("p:first")}else{var previous=selected.prev(),toSelect=previous.length?previous:autocompleter.find("p:last")}selected.removeClass("selected");toSelect.addClass("selected")}break;default:if(e.which==8||e.which==46||String.fromCharCode(e.which).match(/[a-z0-9 _-]/i)){timeout=setTimeout(function(){var val=el.val();if(val.length>0){el.addClass("autocompleter_loading");$.post(url,"name="+val,function(data){el.removeClass("autocompleter_loading");results=data;autocompleter.empty();for(var i=0,j=data.length,regexp=new RegExp("("+val+")","ig");i<j;i++){$("<p"+(i==0?' class="selected"':"")+">"+data[i].replace(regexp,"<span>$1</span>")+"</p>").appendTo(autocompleter)}if(j>0){var pos=el.offset();autocompleter.css({top:pos.top+el.outerHeight(),left:pos.left,width:el.width()}).data("target",el).fadeIn("fast")}else{autocompleter.fadeOut("fast")}},"json")}else{autocompleter.fadeOut("fast")}},300)}else{autocompleter.fadeOut("fast")}}})};makeAutocomplete("#search_text","autocompleter_for_search","/posts/search",function(){});makeAutocomplete("#Post_name","autocompleter_for_post","/posts/autocomplete",function(game_name){var c=confirm(autofillMsg);if(c){var loader=$('<div class="autocompleter_loader"/>').css("opacity",0).fadeTo("fast",0.8).appendTo("body");$.post("/posts/wikipedia","name="+game_name,function(content){$("#Post_developer, #Post_publisher, #Post_genre").val("");var html=$('<div style="display:none"/>').appendTo("body");html[0].innerHTML=content;var body=html.find("#bodyContent"),p=body.find("> p:first"),features=$.trim(p.text());$("#Post_features").val(features);for(var tds=body.find("td, th"),regexp=new RegExp(game_name,"i"),i=0,j=tds.length;i<j;i++){var td=tds.eq(i),text=$.trim(td.text());if(regexp.test(text)){td.closest("table").find("tr").each(function(){var tds=$(this).children(),left=$.trim(tds.eq(0).text()),field;if(left.match(/^developer|desarrollador/i)){var field="developer"}else{if(left.match(/^publisher|distribuidor/i)){var field="publisher"}else{if(left.match(/^genre|género/i)){var field="genre"}}}if(field){var text=$.trim(tds.eq(1).text()).replace(/\n/g,", ");$("#Post_"+field).val(text)}})}}html.remove();loader.fadeOut(function(){loader.remove()})})}});doc.click(function(){if(autocompleter[0].offsetWidth>0){autocompleter.fadeOut("fast")}});doc.bind("mousedown keydown",function(e){if((e.type=="keydown"&&e.which==27)||(e.type=="mousedown"&&!$(e.target).parents(".google_maps_canvas").length)&&canvas.css("display")!="none"){canvas.hide()}});var canvas=$('<div class="google_maps_canvas"/>').appendTo("body"),canvasEl=canvas[0],canvasWidth=canvas.width(),canvasHeight=canvas.height(),map=new GMap2(canvas[0]);map.addControl(new GMapTypeControl());map.addControl(new GSmallZoomControl());canvas.hide();$('<div class="map"/>').appendTo("a.game[gmap]").click(function(e){e.preventDefault();e.stopPropagation();var loc=$(this).parents("a.game").attr("gmap").split("|");map.setCenter(new GLatLng(loc[0],loc[1]),14);canvas.css({top:Math.min(e.pageY,win.height()+win.scrollTop()-canvasHeight)-10,left:Math.min(e.pageX,win.width()+win.scrollLeft()-canvasWidth)-10}).show()});$("div.game").hover(function(){$(this).addClass("game-over")},function(){$(this).removeClass("game-over")}).click(function(e){if(e.target.nodeName!="A"){location.href=$(this).find("a.name").attr("href")}});$("img.game, img.avatar").css("opacity",0).each(function(){$(this).bind("load readystatechange",function(e){if(this.complete||(this.readyState=="complete"&&e.type=="readystatechange")){$(this).animate({opacity:1})}})[0].src=this.src});$("input[type=text], input[type=password], textarea").focus(function(){$(this).animate({backgroundColor:"#fff9c5"})}).blur(function(){$(this).animate({backgroundColor:"#fff"})});$("div.error_messages:not(div.fixed_message), div.info_messages:not(div.fixed_message)").css("cursor","pointer").click(function(){$(this).fadeOut()});$("input.focus:last, textarea.focus:last").focus();var moveSlide=function(e,i){e.preventDefault();var el=$("#carrousel"),now=el.attr("scrollLeft");el.animate({scrollLeft:now+900*i})};$("a.next_slide").click(function(e){moveSlide(e,1)});$("a.previous_slide").click(function(e){moveSlide(e,-1)});$("a.reset").click(function(e){e.preventDefault();$("#carrousel").animate({scrollLeft:0})});if(!!$("#change_location_table").show().length){var address=$("#User_location").keydown(function(e){if(e.which==13){setLocation(e)}}),lat=$("#User_lat"),lng=$("#User_lng"),locationCanvas=$("#location_canvas"),locationMap=new GMap2(locationCanvas[0]),locationGeo=new GClientGeocoder();locationMap.addControl(new GMapTypeControl());locationMap.addControl(new GSmallZoomControl());locationMap.setCenter(new GLatLng(lat.val(),lng.val()),14);var setLocation=function(e){e.preventDefault();locationGeo.getLatLng(address.val(),function(obj){if(obj){lat.val(obj.y);lng.val(obj.x);locationMap.setCenter(new GLatLng(obj.y,obj.x),14);$("#change_location_form").submit()}else{alert(noLocationFounded)}})};$("#change_location_content #change_button").click(setLocation)}var imageOpener=$("#image_opener").css({opacity:0,display:"block"}).hover(function(){imageOpener.fadeTo("fast",0.4)},function(){imageOpener.fadeTo("fast",0)}),bigImage=$("#big_image"),wrapper=bigImage.parent();$(".posts_show li.thumbnail").css("opacity",0).click(function(e){e.preventDefault();var li=$(this),link=li.children(),image=link.children(),src=link.attr("href");imageOpener.attr("href",src);bigImage.animate({opacity:0},400,function(){$('<img src="'+src+'"/>').bind("load readystatechange",function(e){if(this.complete||(this.readyState=="complete"&&e.type=="readystatechange")){var size=image.attr("alt").split("x"),css={width:parseInt(size[0]),height:parseInt(size[1])};wrapper.animate(css,function(){bigImage.css(css).animate({opacity:1},400)[0].src=src})}})[0].src=src})}).each(function(){var li=$(this),img=li.find("img.thumbnail");img.bind("load readystatechange",function(e){if(this.complete||(this.readyState=="complete"&&e.type=="readystatechange")){li.animate({opacity:1})}})[0].src=img[0].src});$("#reply_button").click(function(){setTimeout(function(){$("#Reply_text").focus()},0)});var flash=$("#flash_uploader_container").show();if(!!flash.length){var form=$("#upload_images_form").hide(),url=form.attr("action");var disableLink=function(els){return els.unbind("click").click(function(e){e.preventDefault()}).fadeTo("fast",0.2)};var removeImage=function(e){e.preventDefault();var a=$(this),href=a.attr("href"),el=a.parent().fadeTo("fast",0,function(){el.remove();if(!imagesList.children().length){imagesTable.fadeTo("fast",0)}});$.get(href)};var buttonsState=function(activate){uploadAllButton.add(clearAllButton).animate({opacity:!!container.contents().length?1:0.4},"fast")};var remove=function(id,elem,e){e.preventDefault();disableLink(elem.find("button"));uploader.remove(id)};var uploadRestore=function(id,elem,allowRemoveOrRetry){elem.find("button.cancel").hide();if(allowRemoveOrRetry){elem.find("button.retry").show();elem.find("button.delete").fadeTo("fast",1).click(function(e){remove(id,elem,e)})}else{var el=elem.find("button.retry").show();disableLink(el)}elem.removeClass("active").find("div.bar div").width(0)};var container=$("#upload_files_container"),template=decodeURIComponent(container.html()),dynTemplate=decodeURIComponent(container.find("div.progress").html()),browseButton=$("#browse_button"),uploadAllButton=$("#upload_all_button").css("opacity",0.4),clearAllButton=$("#clear_all_button").css("opacity",0.4),imagesTable=$("#images_list_table"),imagesList=$("#images_list"),thumbnailTemplate=decodeURIComponent($("<div/>").append(imagesList.children("li:first").css({display:"block",opacity:0})).html());container.empty();$("a.remove_image").click(removeImage);if(imagesTable.css("display")=="none"){imagesTable.css({opacity:0,display:"block"})}var uploader=browseButton.uploader({backendScript:url,swfURL:"/jQuery.uploader.swf"});$.extend(uploader.events,{uploaderReady:function(){this.setFilters([{description:browseButton.attr("title"),extensions:"*.jpg;*.jpeg;*.png;*.gif;*.bmp"}]);uploadAllButton.click(function(e){e.preventDefault();uploader.upload("",url,"GET",false,"image")});clearAllButton.click(function(e){e.preventDefault();uploader.remove()})},fileAdded:function(args){var id=args.fileData.id,name=args.fileData.name,html=template.replace(/\{name\}/g,name),elem=$(html).attr("id","upload_file_"+id);container.append(elem).find("div.progress").empty();elem.find("button.delete").click(function(e){remove(id,elem,e)});elem.find("button.start, button.retry").click(function(e){e.preventDefault();uploader.upload(id,url,false,false,"image")});elem.find("button.cancel").click(function(e){e.preventDefault();uploader.cancel(id)});elem.find("button.retry, button.cancel").hide();buttonsState(true)},fileRemoved:function(args){var elem=$("#upload_file_"+args.fileData.id).slideUp("fast",function(){elem.remove();buttonsState()})},fileUploadStarted:function(args){var id=args.fileData.id,elem=$("#upload_file_"+id).addClass("active").removeClass("error");disableLink(elem.find("button.delete"));elem.find("button.start, button.retry").hide();elem.find("button.cancel").show()},fileUploadProgress:function(args){var id=args.fileData.id,elem=$("#upload_file_"+id),count=this.formatSize(args.fileProgress.bytesCompleted),total=this.formatSize(args.fileProgress.bytesTotal),speed=this.formatSize(args.fileProgress.bytesPerSecond),time=this.formatTime(args.fileProgress.timeRemaining);var html=dynTemplate.replace(/\{count\}/g,count).replace(/\{total\}/g,total).replace(/\{speed\}/g,speed).replace(/\{time\}/g,time);elem.find("div.bar div").css("width",args.fileProgress.progress+"%");elem.find("div.progress").html(html)},fileUploadCancelled:function(args){var id=args.fileData.id,elem=$("#upload_file_"+id);uploadRestore(id,elem,true)},fileUploadCompleted:function(args){var id=args.fileData.id,elem=$("#upload_file_"+id);uploadRestore(id,elem,false)},fileUploadError:function(args){var id=args.fileData.id,elem=$("#upload_file_"+id).addClass("error");uploadRestore(id,elem,true)},fileUploadServerData:function(args){eval("var data = "+args.serverData);imagesTable.fadeTo("fast",1);var html=thumbnailTemplate.replace(/\{id\}/g,data.id).replace(/\{thumbnail\}/g,data.thumbnail).replace(/\{url\}/g,data.url);$(html).appendTo(imagesList).fadeTo("fast",1).find("a.remove_image").click(removeImage)}})}$("#messages a.destroy").click(function(e){e.preventDefault();var target=$(e.target),href=target.attr("href"),title=target.attr("title"),response=confirm(title);if(response){location.href=href+"?confirmed"}})});