(function(a){function h(){a.fn.ajaxSubmit.debug&&window.console&&window.console.log&&window.console.log("[jquery.form] "+Array.prototype.join.call(arguments,""))}a.fn.ajaxSubmit=function(b){function c(){function q(){if(!A++){i.detachEvent?i.detachEvent("onload",q):i.removeEventListener("load",q,false);var w=0,r=true;try{if(B)throw"timeout";var x,u;u=i.contentWindow?i.contentWindow.document:i.contentDocument?i.contentDocument:i.document;if(u.body==null&&!w&&a.browser.opera){w=1;A--;setTimeout(q,100);
return}m.responseText=u.body?u.body.innerHTML:null;m.responseXML=u.XMLDocument?u.XMLDocument:u;m.getResponseHeader=function(E){var F={"content-type":p.dataType};return F[E]};if(p.dataType=="json"||p.dataType=="script"){var C=u.getElementsByTagName("textarea")[0];m.responseText=C?C.value:m.responseText}else if(p.dataType=="xml"&&!m.responseXML&&m.responseText!=null)m.responseXML=v(m.responseText);x=a.httpData(m,p.dataType)}catch(G){r=false;a.handleError(p,m,"error",G)}if(r){p.success(x,"success");
y&&a.event.trigger("ajaxSuccess",[m,p])}y&&a.event.trigger("ajaxComplete",[m,p]);y&&!--a.active&&a.event.trigger("ajaxStop");if(p.complete)p.complete(m,r?"success":"error");setTimeout(function(){e.remove();m.responseXML=null},100)}}function v(w,r){if(window.ActiveXObject){r=new ActiveXObject("Microsoft.XMLDOM");r.async="false";r.loadXML(w)}else r=(new DOMParser).parseFromString(w,"text/xml");return r&&r.documentElement&&r.documentElement.tagName!="parsererror"?r:null}var o=k[0];if(a(":input[name=submit]",
o).length)alert('Error: Form elements must not be named "submit".');else{var p=a.extend({},a.ajaxSettings,b),s=jQuery.extend(true,{},a.extend(true,{},a.ajaxSettings),p),z="jqFormIO"+(new Date).getTime(),e=a('<iframe id="'+z+'" name="'+z+'" />'),i=e[0];if(a.browser.msie||a.browser.opera)i.src='javascript:false;document.write("");';e.css({position:"absolute",top:"-1000px",left:"-1000px"});var m={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},
getResponseHeader:function(){},setRequestHeader:function(){},abort:function(){this.aborted=1;e.attr("src","about:blank")}},y=p.global;y&&!a.active++&&a.event.trigger("ajaxStart");y&&a.event.trigger("ajaxSend",[m,p]);if(s.beforeSend&&s.beforeSend(m,s)===false)s.global&&jQuery.active--;else if(!m.aborted){var A=0,B=0;if(s=o.clk){var D=s.name;if(D&&!s.disabled){b.extraData=b.extraData||{};b.extraData[D]=s.value;if(s.type=="image"){b.extraData[name+".x"]=o.clk_x;b.extraData[name+".y"]=o.clk_y}}}setTimeout(function(){var w=
k.attr("target"),r=k.attr("action");k.attr({target:z,method:"POST",action:p.url});b.skipEncodingOverride||k.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"});p.timeout&&setTimeout(function(){B=true;q()},p.timeout);var x=[];try{if(b.extraData)for(var u in b.extraData)x.push(a('<input type="hidden" name="'+u+'" value="'+b.extraData[u]+'" />').appendTo(o)[0]);e.appendTo("body");i.attachEvent?i.attachEvent("onload",q):i.addEventListener("load",q,false);o.submit()}finally{k.attr("action",
r);w?k.attr("target",w):k.removeAttr("target");a(x).remove()}},10)}}}if(!this.length){h("ajaxSubmit: skipping submit process - no element selected");return this}if(typeof b=="function")b={success:b};b=a.extend({url:this.attr("action")||window.location.toString(),type:this.attr("method")||"GET"},b||{});var d={};this.trigger("form-pre-serialize",[this,b,d]);if(d.veto){h("ajaxSubmit: submit vetoed via form-pre-serialize trigger");return this}if(b.beforeSerialize&&b.beforeSerialize(this,b)===false){h("ajaxSubmit: submit aborted via beforeSerialize callback");
return this}var f=this.formToArray(b.semantic);if(b.data){b.extraData=b.data;for(var g in b.data)if(b.data[g]instanceof Array)for(var l in b.data[g])f.push({name:g,value:b.data[g][l]});else f.push({name:g,value:b.data[g]})}if(b.beforeSubmit&&b.beforeSubmit(f,this,b)===false){h("ajaxSubmit: submit aborted via beforeSubmit callback");return this}this.trigger("form-submit-validate",[f,this,b,d]);if(d.veto){h("ajaxSubmit: submit vetoed via form-submit-validate trigger");return this}d=a.param(f);if(b.type.toUpperCase()==
"GET"){b.url+=(b.url.indexOf("?")>=0?"&":"?")+d;b.data=null}else b.data=d;var k=this,j=[];b.resetForm&&j.push(function(){k.resetForm()});b.clearForm&&j.push(function(){k.clearForm()});if(!b.dataType&&b.target){var n=b.success||function(){};j.push(function(q){a(b.target).html(q).each(n,arguments)})}else b.success&&j.push(b.success);b.success=function(q,v){for(var o=0,p=j.length;o<p;o++)j[o].apply(b,[q,v,k])};d=a("input:file",this).fieldValue();f=false;for(g=0;g<d.length;g++)if(d[g])f=true;if(b.iframe||
f)a.browser.safari&&b.closeKeepAlive?a.get(b.closeKeepAlive,c):c();else a.ajax(b);this.trigger("form-submit-notify",[this,b]);return this};a.fn.ajaxForm=function(b){return this.ajaxFormUnbind().bind("submit.form-plugin",function(){a(this).ajaxSubmit(b);return false}).each(function(){a(":submit,input:image",this).bind("click.form-plugin",function(c){var d=this.form;d.clk=this;if(this.type=="image")if(c.offsetX!=undefined){d.clk_x=c.offsetX;d.clk_y=c.offsetY}else if(typeof a.fn.offset=="function"){var f=
a(this).offset();d.clk_x=c.pageX-f.left;d.clk_y=c.pageY-f.top}else{d.clk_x=c.pageX-this.offsetLeft;d.clk_y=c.pageY-this.offsetTop}setTimeout(function(){d.clk=d.clk_x=d.clk_y=null},10)})})};a.fn.ajaxFormUnbind=function(){this.unbind("submit.form-plugin");return this.each(function(){a(":submit,input:image",this).unbind("click.form-plugin")})};a.fn.formToArray=function(b){var c=[];if(this.length==0)return c;var d=this[0],f=b?d.getElementsByTagName("*"):d.elements;if(!f)return c;for(var g=0,l=f.length;g<
l;g++){var k=f[g],j=k.name;if(j)if(b&&d.clk&&k.type=="image")!k.disabled&&d.clk==k&&c.push({name:j+".x",value:d.clk_x},{name:j+".y",value:d.clk_y});else if((k=a.fieldValue(k,true))&&k.constructor==Array)for(var n=0,q=k.length;n<q;n++)c.push({name:j,value:k[n]});else k!==null&&typeof k!="undefined"&&c.push({name:j,value:k})}if(!b&&d.clk){b=d.getElementsByTagName("input");g=0;for(l=b.length;g<l;g++){f=b[g];(j=f.name)&&!f.disabled&&f.type=="image"&&d.clk==f&&c.push({name:j+".x",value:d.clk_x},{name:j+
".y",value:d.clk_y})}}return c};a.fn.formSerialize=function(b){return a.param(this.formToArray(b))};a.fn.fieldSerialize=function(b){var c=[];this.each(function(){var d=this.name;if(d){var f=a.fieldValue(this,b);if(f&&f.constructor==Array)for(var g=0,l=f.length;g<l;g++)c.push({name:d,value:f[g]});else f!==null&&typeof f!="undefined"&&c.push({name:this.name,value:f})}});return a.param(c)};a.fn.fieldValue=function(b){for(var c=[],d=0,f=this.length;d<f;d++){var g=this[d];g=a.fieldValue(g,b);g===null||
typeof g=="undefined"||g.constructor==Array&&!g.length||(g.constructor==Array?a.merge(c,g):c.push(g))}return c};a.fieldValue=function(b,c){var d=b.name,f=b.type,g=b.tagName.toLowerCase();if(typeof c=="undefined")c=true;if(c&&(!d||b.disabled||f=="reset"||f=="button"||(f=="checkbox"||f=="radio")&&!b.checked||(f=="submit"||f=="image")&&b.form&&b.form.clk!=b||g=="select"&&b.selectedIndex==-1))return null;if(g=="select"){g=b.selectedIndex;if(g<0)return null;c=[];b=b.options;d=(f=f=="select-one")?g+1:b.length;
for(g=f?g:0;g<d;g++){var l=b[g];if(l.selected){l=a.browser.msie&&!l.attributes.value.specified?l.text:l.value;if(f)return l;c.push(l)}}return c}return b.value};a.fn.clearForm=function(){return this.each(function(){a("input,select,textarea",this).clearFields()})};a.fn.clearFields=a.fn.clearInputs=function(){return this.each(function(){var b=this.type,c=this.tagName.toLowerCase();if(b=="file"||b=="text"||b=="password"||c=="textarea")this.value="";else if(b=="checkbox"||b=="radio")this.checked=false;
else if(c=="select")this.selectedIndex=-1})};a.fn.resetForm=function(){return this.each(function(){if(typeof this.reset=="function"||typeof this.reset=="object"&&!this.reset.nodeType)this.reset()})};a.fn.enable=function(b){if(b==undefined)b=true;return this.each(function(){this.disabled=!b})};a.fn.selected=function(b){if(b==undefined)b=true;return this.each(function(){var c=this.type;if(c=="checkbox"||c=="radio")this.checked=b;else if(this.tagName.toLowerCase()=="option"){c=a(this).parent("select");
b&&c[0]&&c[0].type=="select-one"&&c.find("option").selected(false);this.selected=b}})}})(jQuery);jQuery.cookie=function(a,h,b){if(typeof h!="undefined"){b=b||{};if(h===null){h="";b.expires=-1}var c="";if(b.expires&&(typeof b.expires=="number"||b.expires.toUTCString)){if(typeof b.expires=="number"){c=new Date;c.setTime(c.getTime()+b.expires*24*60*60*1E3)}else c=b.expires;c="; expires="+c.toUTCString()}var d=b.path?"; path="+b.path:"",f=b.domain?"; domain="+b.domain:"";b=b.secure?"; secure":"";document.cookie=[a,"=",encodeURIComponent(h),c,d,f,b].join("")}else{h=null;if(document.cookie&&document.cookie!=
""){b=document.cookie.split(";");for(c=0;c<b.length;c++){d=jQuery.trim(b[c]);if(d.substring(0,a.length+1)==a+"="){h=decodeURIComponent(d.substring(a.length+1));break}}}return h}};(function(a){var h=a.browser.msie&&a.browser.version==6,b=null;a.fn.jOverlay=function(c){function d(n){if(c.center)a.center(n);else h&&a.center("#jOverlayContent",{top:a(window).scrollTop()+"px",marginLeft:"",marginTop:"",left:""})}a("#jOverlay").length&&a.closeOverlay();b!==null&&clearTimeout(b);c=a.extend({},a.fn.jOverlay.options,c||{});var f=c.onSuccess||c.success,g=this.is("*")?this:"#jOverlayContent",l=h?"absolute":"fixed",k=/([^\/\\]+)\.(png|gif|jpeg|jpg|bmp)$/i.test(c.url),j=c.imgLoading?"<img id='jOverlayLoading' src='"+
c.imgLoading+"' style='position:"+l+"; z-index:"+(c.zIndex+9)+";'/>":"";a("body").prepend(j+"<div id='jOverlay' /><div id='jOverlayContent' style='position:"+l+"; z-index:"+(c.zIndex+5)+"; display:none;'/>");a("#jOverlayContent").data("options",c);a("#jOverlayLoading").load(function(){d(this)});if(h){a("select").hide();a("#jOverlayContent select").show()}a("#jOverlay").css({backgroundColor:c.color,position:l,top:"0px",left:"0px",filter:"alpha(opacity="+c.opacity*100+")",opacity:c.opacity,"-khtml-opacity":c.opacity,
"-moz-opacity":c.opacity,zIndex:c.zIndex,width:!h?"100%":a(window).width()+"px",height:!h?"100%":a(document).height()+"px"}).slideDown(200);a.trim(c.html)&&a(g).html(c.html);if(this.is("*")){a("#jOverlayContent").data("jOverlayElementPrev",this.prev());a("#jOverlayContent").html(this.show().data("display",c.autoHide?"none":this.css("display")));if(!k){d("#jOverlayContent");a("#jOverlayContent").slideDown(200);!c.url&&a.isFunction(f)&&f(this)}}k&&a("<img/>").load(function(){var n=a.resize(this.width,
this.height);a(this).css({width:n.width,height:n.height});a(g).html(this);d("#jOverlayContent");d("#jOverlayLoading");a("#jOverlayLoading").fadeOut(500);a("#jOverlayContent").slideDown(200);a.isFunction(f)&&f(a(g))}).error(function(){alert("Image ("+c.url+") not found.");a.closeOverlay()}).attr({src:c.url,alt:c.url});c.url&&!k&&a.ajax({type:c.method,data:c.data,url:c.url,success:function(n){a("#jOverlayLoading").fadeOut(500);a(g).html(n).slideDown(200);d("#jOverlayContent");a.isFunction(f)&&f(n)},
error:function(){alert("URL ("+c.url+") not found.");a.closeOverlay()}});if(c.data&&!c.url){a("#jOverlayLoading").fadeOut(500);a(g).html(c.data).slideDown(200);d("#jOverlayContent");a.isFunction(f)&&f(responseText)}if(h){a(window).scroll(function(){d("#jOverlayContent")});a(window).resize(function(){a("#jOverlay").css({width:a(window).width()+"px",height:a(document).height()+"px"});d("#jOverlayContent")})}c.closeOnEsc?a(document).keydown(function(n){n.keyCode==27&&a.closeOverlay()}):a(document).unbind("keydown");
c.bgClickToClose&&a("#jOverlay").click(a.closeOverlay);if(c.timeout&&Number(c.timeout)>0)b=window.setTimeout(a.closeOverlay,Number(c.timeout));a("#jOverlayContent").css(c.css||{})};a.resize=function(c,d){var f=a(window).width()-150,g=a(window).height()-150;if(c>f){d*=f/c;c=f;if(d>g){c*=g/d;d=g}}else if(d>g){c*=g/d;d=g;if(c>f){d*=f/c;c=f}}return{width:c,height:d}};a.center=function(c,d){c=a(c);var f=c.width();c.css(a.extend({},{width:f+"px",marginLeft:"-"+f/2+"px",marginTop:"-"+c.height()/2+"px",height:"auto",
top:!h?"50%":a(window).scrollTop()+a(window).height()/2+"px",left:"50%"},d||{}))};a.fn.jOverlay.options={method:"GET",data:"",url:"",color:"#000",opacity:"0.6",zIndex:9999,center:true,imgLoading:"",bgClickToClose:true,success:null,onSuccess:null,timeout:0,autoHide:true,css:{},html:"",closeOnEsc:true};a.fn.jOverlay.setDefaults=function(c){a.fn.jOverlay.options=a.extend({},a.fn.jOverlay.options,c||{})};a.closeOverlay=function(){var c=a("#jOverlayContent");c.data("options");var d=c.data("jOverlayElementPrev");
h&&a("select").show();if(d){var f=c.children();d.after(f.css("display",f.data("display")));f.removeData("display");c.removeData("jOverlayElementPrev")}c.removeData("options");a("#jOverlayLoading, #jOverlayContent, #jOverlay").remove()}})(jQuery);if(!document.ELEMENT_NODE){document.ELEMENT_NODE=1;document.ATTRIBUTE_NODE=2;document.TEXT_NODE=3;document.CDATA_SECTION_NODE=4;document.ENTITY_REFERENCE_NODE=5;document.ENTITY_NODE=6;document.PROCESSING_INSTRUCTION_NODE=7;document.COMMENT_NODE=8;document.DOCUMENT_NODE=9;document.DOCUMENT_TYPE_NODE=10;document.DOCUMENT_FRAGMENT_NODE=11;document.NOTATION_NODE=12}
document._importNode=function(a,h){switch(a.nodeType){case document.ELEMENT_NODE:var b=document.createElement(a.nodeName);if(a.attributes&&a.attributes.length>0)for(var c=0,d=a.attributes.length;c<d;)if(a.attributes[c].nodeName=="class")b.className=a.getAttribute(a.attributes[c++].nodeName);else b.setAttribute(a.attributes[c].nodeName,a.getAttribute(a.attributes[c++].nodeName));if(h&&a.childNodes&&a.childNodes.length>0){c=0;for(d=a.childNodes.length;c<d;)b.appendChild(document._importNode(a.childNodes[c++],
h))}return b;case document.TEXT_NODE:case document.CDATA_SECTION_NODE:case document.COMMENT_NODE:return document.createTextNode(a.nodeValue)}};if(typeof navigator.geolocation=="undefined"||navigator.geolocation.shim)(function(){(function(){if(!(window.google&&google.gears)){var b=null;if(typeof GearsFactory!="undefined")b=new GearsFactory;else try{b=new ActiveXObject("Gears.Factory");b.getBuildInfo().indexOf("ie_mobile")!=-1&&b.privateSetGlobalObject(this)}catch(c){if(typeof navigator.mimeTypes!="undefined"&&navigator.mimeTypes["application/x-googlegears"]){b=document.createElement("object");b.style.display="none";b.width=0;b.height=0;b.type=
"application/x-googlegears";document.documentElement.appendChild(b)}}if(b){window.google||(google={});if(!google.gears)google.gears={factory:b}}}})();var a=function(){var b=google.gears.factory.create("beta.geolocation"),c=function(d,f){return function(g){d(g);f.lastPosition=g}};return{shim:true,type:"Gears",lastPosition:null,getCurrentPosition:function(d,f,g){var l=this;d=c(d,l);b.getCurrentPosition(d,f,g)},watchPosition:function(d,f,g){b.watchPosition(d,f,g)},clearWatch:function(d){b.clearWatch(d)},
getPermission:function(d,f,g){b.getPermission(d,f,g)}}},h=function(){var b=false,c=function(){if(!l()&&!b){b=true;var j=document.createElement("script");j.src=(document.location.protocol=="https:"?"https://":"http://")+"www.google.com/jsapi?callback=_google_loader_apiLoaded";j.type="text/javascript";document.getElementsByTagName("body")[0].appendChild(j)}},d=[],f=function(j){d.push(j)},g=function(){if(l())for(;d.length>0;){var j=d.pop();j()}};window._google_loader_apiLoaded=function(){g()};var l=
function(){return window.google&&google.loader},k=function(j){if(l())return true;f(j);c();return false};c();return{shim:true,type:"ClientLocation",lastPosition:null,getCurrentPosition:function(j,n,q){var v=this;if(k(function(){v.getCurrentPosition(j,n,q)}))if(google.loader.ClientLocation){var o=google.loader.ClientLocation;o={coords:{latitude:o.latitude,longitude:o.longitude,altitude:null,accuracy:43E3,altitudeAccuracy:null,heading:null,speed:null},address:{city:o.address.city,country:o.address.country,
country_code:o.address.country_code,region:o.address.region},timestamp:new Date};j(o);this.lastPosition=o}else n==="function"&&n({code:3,message:"Using the Google ClientLocation API and it is not able to calculate a location."})},watchPosition:function(j,n,q){this.getCurrentPosition(j,n,q);var v=this,o=setInterval(function(){v.getCurrentPosition(j,n,q)},1E4);return o},clearWatch:function(j){clearInterval(j)},getPermission:function(){return true}}};navigator.geolocation=window.google&&google.gears?
a():h()})();$(document).ready(function(){function a(){var e=k,i=$("#notice_data-text").val().length;e=e-i;i=$("#notice_text-count");if(e.toString()!=i.text())if(!f||e==0){i.text()!=String(e)&&i.text(e);h($("#notice_data-text"),g);h($(".form_comment #notice_data-text"),l);e<0?$("#form_notice").addClass("warning"):$("#form_notice").removeClass("warning");if(!f){f=true;window.setTimeout(b,500)}}}function h(e,i){e[0].style.height=0;var m=e[0].scrollHeight;e[0].style.height=m>i?m+15+"px":i+"px"}function b(){f=false;
a(null)}function c(e){if(e.keyCode==13||e.keyCode==10){$("#form_notice").submit();e.preventDefault();e.stopPropagation();$("#notice_data-text").blur();$("body").focus();return false}return true}function d(){var e=document.createElement("input");e.setAttribute("type","hidden");e.setAttribute("name","ajax");e.setAttribute("value",1);this.appendChild(e)}var f=false,g=30,l=20;$("#notice_data-text").css({height:g,"overflow-y":"hidden"});$(".form_comment #notice_data-text").css({height:l});var k=$("#notice_text-count").text();
if($("#notice_data-text").length){$("#notice_data-text").bind("keyup",a);$("#notice_data-text").bind("keydown",c);a()}$("p.form_guide").hide();$("form :input").focus(function(){$(this).nextAll("p.form_guide").slideDown(100)}).blur(function(){$(this).nextAll("p.form_guide").slideUp(100)});var j={dataType:"xml",beforeSubmit:function(e,i){$(i).addClass("processing");return true},success:function(e){e=document._importNode($("form",e).get(0),true);var i=e.id,m=i.replace("disfavor","favor");$("form#"+m).replaceWith(e);
$("form#"+i).ajaxForm(n).each(d)}},n={dataType:"xml",beforeSubmit:function(e,i){$(i).addClass("processing");return true},success:function(e){e=document._importNode($("form",e).get(0),true);var i=e.id,m=i.replace("favor","disfavor");$("form#"+m).replaceWith(e);$("form#"+i).ajaxForm(j).each(d)}},q={dataType:"xml",success:function(e){e=document._importNode($("form",e).get(0),true);var i=e.id,m=i.replace("leave","join");$("form#"+m).replaceWith(e);$("form#"+i).ajaxForm(v).each(d)}},v={dataType:"xml",
success:function(e){e=document._importNode($("form",e).get(0),true);var i=e.id,m=i.replace("join","leave");$("form#"+m).replaceWith(e);$("form#"+i).ajaxForm(q).each(d)}};$("form.form_favor").ajaxForm(j).each(d);$("form.form_disfavor").ajaxForm(n).each(d);$("form.form_group_join").ajaxForm(q).each(d);$("form.form_group_leave").ajaxForm(v).each(d);$("#form_user_nudge").ajaxForm({dataType:"xml",beforeSubmit:function(){$("#form_user_nudge input[type=submit]").attr("disabled","disabled");$("#form_user_nudge input[type=submit]").addClass("disabled")},
success:function(e){$("#form_user_nudge").replaceWith(document._importNode($("#nudge_response",e).get(0),true));$("#form_user_nudge input[type=submit]").removeAttr("disabled");$("#form_user_nudge input[type=submit]").removeClass("disabled")}});$("#form_user_nudge").each(d);var o={dataType:"xml",beforeSubmit:function(){$(".form_user_follow input[type=submit]").attr("disabled","disabled");$(".form_user_follow input[type=submit]").addClass("disabled")},success:function(e){e=document._importNode($("form",
e).get(0),true);var i=e.id,m=i.replace("unfollow","follow");$("form#"+m).replaceWith(e);$("form#"+i).ajaxForm(p).each(d);$("dd.followers, .cur_following span").text(parseInt($("dd.followers, .cur_following span").text())+1);$(".form_user_follow input[type=submit]").removeAttr("disabled");$(".form_user_follow input[type=submit]").removeClass("disabled")}},p={dataType:"xml",beforeSubmit:function(){$(".form_user_unfollow input[type=submit]").attr("disabled","disabled");$(".form_user_unfollow input[type=submit]").addClass("disabled")},
success:function(e){e=document._importNode($("form",e).get(0),true);var i=e.id,m=i.replace("follow","unfollow");$("form#"+m).replaceWith(e);$("form#"+i).ajaxForm(o).each(d);$("#profile_send_a_new_message").remove();$("#profile_nudge").remove();$("dd.followers, .cur_following span").text(parseInt($("dd.followers, .cur_following span").text())-1);$(".form_user_unfollow input[type=submit]").removeAttr("disabled");$(".form_user_unfollow input[type=submit]").removeClass("disabled")}};$(".form_user_follow").ajaxForm(o).each(d);
$(".form_user_unfollow").ajaxForm(p).each(d);var s={dataType:"xml",beforeSubmit:function(){var e="";$.ajax({async:false,type:"GET",url:$("address .url")[0].href+"delete?confirm=1",success:function(i){e=i}});if(confirm(e))return true;return false},success:function(e){if($("#error",e).length>0){var i=document._importNode($("p",e).get(0),true);i=i.textContent||i.innerHTML;alert(i)}else if($("#success",e).length>0){i=document._importNode($("p",e).get(0),true);i=i.textContent||i.innerHTML;$("#"+i).fadeOut(500,
function(){$("#"+i).remove()});$("body")[0].id==="shownotice"&&window.location.replace($("address .url")[0].href)}}};$("form.form_delete").ajaxForm(s).each(d);var z={dataType:"xml",iframe:true,beforeSubmit:function(){if($("#notice_data-text").length>0&&$("#notice_data-text").get(0).value.length==0){$("#form_notice").addClass("warning");return false}UploadProgress();$("#notice_data-attach_selected button").hide();$("#form_notice").addClass("processing");$("#notice_action-submit").attr("disabled","disabled");
$("#notice_action-submit, #notice_data-text, ul.form_data :text, ul.form_data textarea, ul.extra_fields :text").addClass("disabled");return true},error:function(e,i){$("#form_notice").removeClass("processing");$("#notice_action-submit").removeAttr("disabled");$("#notice_data-attach_selected button").show();$("#notice_action-submit, #notice_data-text, ul.form_data :text, ul.form_data textarea, ul.extra_fields :text").removeClass("disabled");if(i=="timeout")alert("Sorry! We had trouble sending your notice. The servers are overloaded. Please try again, and contact the site administrator if this problem persists");
else if($(".error",e.responseXML).length>0)$("#form_notice").append(document._importNode($(".error",e.responseXML).get(0),true));else{i=[200,201,202,203,204,205,206,300,301,302,303,304,305,306,307];if(jQuery.inArray(parseInt(e.status),i)<0)alert("Sorry! We had trouble sending your notice ("+e.status+" "+e.statusText+"). Please report the problem to the site administrator if this happens again.");else{$("#notice_data-text").val("");a()}}},success:function(e){if($("#error",e).length>0){e=document._importNode($("body",
e).get(0),true);e=e.innerHTML;if($("#content_inner",e).length>0)e=$(".error",e);if($("#notice_data-text").length>0&&$("body")[0].id!="newnotice"){$("#error").remove();$("#form_instream, #comment_form_box").prepend(e)}else $("#page_notice dd").html(e)}else{if($("#command_result",e).length>0){e=document._importNode($("p",e).get(0),true);e=e.textContent||e.innerHTML;alert(e)}else{li=$("li",e).get(0);li_id=$(li).attr("id");if($("#"+li.id).length==0){if($("body")[0].id==="share"){$("body").prepend('<div id="blueface"></div>').fadeIn();
setTimeout("window.close()",2E3)}if($("body")[0].id==="newnotice"||$("body")[0].id==="editnotice")window.location.replace($(".timestamp",li).attr("href"));if($("#newcomment",e).length>0){e=$("#reply_to-id").val();var i="#comments_primary #comment-"+e;$("#comments_primary h2 span").append(" + 1");if(e.length>0){$(i+" .comments").length<1&&$(i).append('<ol class="comments"></ol>');$($(i+" .comments")[0]).append(document._importNode(li,true))}else $("#comments_primary .comments").prepend(document._importNode(li,
true))}else{e=$("#notice_in-reply-to").val();i="#notices_primary #notice-"+e;if(e.length>0){$(i+" .notices").length<1&&$(i).append('<ol class="notices"></ol>');$($(i+" .notices")[0]).append(document._importNode(li,true))}else $("#notices_primary .notices").prepend(document._importNode(li,true))}$("#"+li_id).hide();$("#"+li_id).fadeIn(500);$("form#delete"+li_id).ajaxForm(s).each(d);NoticeWithAttachment($("#"+li_id))}}$("#notice_data-text, #notice_data-attach, #notice_in-reply-to, #reply_to-id").val("");
$("#notice_data-attach_selected").remove();a();$(".comment_reply, .notice_reply span").removeClass("active");$("#comment_form_box").append($(".form_comment"));$("#sub_header").append($("#form_instream").hide());$("li#nav_status").removeClass("current");$(".notice_reply .reply").hide()}$("#form_notice").removeClass("processing");$("#notice_data-attach_selected button").show();$("#notice_action-submit, #notice_data-text, ul.form_data :text, ul.form_data textarea, ul.extra_fields :text").removeClass("disabled");
$("#notice_action-submit").removeAttr("disabled")}};$("#form_notice").ajaxForm(z).each(d);$.fn.jOverlay.options={method:"GET",data:"",url:"",color:"#000",opacity:"0.6",zIndex:99,center:false,imgLoading:$("address .url")[0].href+"theme/web/images/illustrations/loading.gif",bgClickToClose:true,success:function(){$("#jOverlayContent").append("<button>&#215;</button>");$("#jOverlayContent button").click($.closeOverlay);ExternalLink()},timeout:0,autoHide:true,css:{top:"0%",left:"35%"}};if($("#notice_data-text").length>
0&&$("body")[0].id!="newnotice"&&$("body")[0].id!="editnotice")$("body")[0].id==="shownotice"?CommentReply():StatusToggle();Tooltip("*:not(.sort a, #site_nav_global_primary a, #aside_nav a)");Tooltip("#site_nav_global_primary a:not(.search_type_more a)","top");Tooltip(".sort a, .search_type_more a","left");$("address .url").click(function(){if($("body")[0].id==="share"){window.close();opener.location.href=$(this)[0].href}});FormValidation("username");FormValidation("password",$("#username"));FormValidation("confirm",
$("#password"),"change");FormValidation("email",null,"change");FormValidation("newpassword");FormValidation("newconfirm",$("#newpassword"),"change");FormValidation("youremail",null,"change",true);$("#selectall").click(function(){$(this).parents("fieldset:eq(0)").find(":checkbox").attr("checked",this.checked)});$("#register #optionaltoggle").attr("checked")==false&&$("#optionaltoggle").parents("li:eq(0)").addClass("hidden").find("ul").hide();$("#register #optionaltoggle").click(function(){$(this).parents("li:eq(0)").toggleClass("hidden").find("ul").toggle()});
NoticeReply();ExternalLink();NavSort();ProfileInfoClick();SearchType();NoticeAttachments();NoticeDataAttach();FrontSwitch(0);ConnectOrCreate();if($("body")[0].id==="newnotice"){MediaSearch();$(".form_evnt").length==0&&$("#url").change(AttachmentLoad)}if($("#form_notice:not(.form_text, .form_comment)").length){$("textarea").css({height:g,"overflow-y":"hidden"});$("textarea").bind("keyup change",function(){h($(this),g)});h($("textarea"),g)}$("#notice_data-text").change(AttachmentLoad)});
function FormValidation(a,h,b,c){$(".formval #formval-"+a).length==0&&$("#"+a).after('<div class="formval"><span id="formval-'+a+'"></span></div>');var d=$(".formval #formval-"+a),f=$("#"+a).val(),g=$("#nav_home img").attr("alt");b=b?b:"keyup change";c=c?c:false;$(".form_settings:not(#form_login)  #"+a).bind(b,function(){var l=this,k=h?h.val():null;if(a=="newpassword")k=g;if(this.value!=this.lastValue){this.timer&&clearTimeout(this.timer);l.value==0||l.value==f&&c==false?d.fadeOut():d.fadeIn();var j=
a=="username"?$("address .url")[0].href+"<em>"+l.value+"</em>":"Checking";d.removeClass().addClass("checking").html(j);this.timer=setTimeout(function(){$.getJSON(window.location.protocol+$("address .url")[0].href.substr(5)+"formvalidation?field="+a+"&other="+k+"&q="+l.value,function(n){d.removeClass().addClass(n.status).attr({title:n.msg});a!="username"&&d.html(n.msg);Tooltip(".formval span")})},300);this.lastValue=this.value}})}
function ConnectOrCreate(){$("#create_new, #connect_existing").hide();$(".connect_or_create .create").click(function(){$("#create_new").fadeIn();$("#connect_existing").hide();$("#username").focus()});$(".connect_or_create .connect").click(function(){$("#connect_existing").fadeIn();$("#create_new").hide();$("#existingusername").focus()})}
function NoticeReply(){$("ul.reply").hide();$("#content .notice").each(function(){var a=$(this)[0],h=$($(".author .url",a)[0]).attr("title"),b=$($(".notice_reply .reply",a)[0]).attr("rel"),c=1;$(".notice_reply",a).click(function(){$(".notice_reply span").removeClass("active");$(".notice_reply .reply").hide();if(c==1){$(".notice_reply span",a).addClass("active");$(".notice_reply .reply",a).show();c=0}else{$(".reply_status a",a).removeClass("current");$("li#nav_status").removeClass("current");$("#sub_header").append($("#form_instream").hide());
$("#notice_data-text, #notice_in-reply-to").val("");c=1}});$(".notice_reply .reply_status a",a).click(function(){var d=$("#notice_data-text");if(d.length>0&&!$("#form_notice").hasClass("form_comment")){$(this).addClass("current");$("li#nav_status").removeClass("current");NoticeReplySet(h,b);$($(a)[0]).append(" ").append($("#form_instream").show());d.css({width:$("#form_notice").width()-115});d[0].focus();if(d[0].setSelectionRange){var f=d.val().length;d[0].setSelectionRange(f,f)}return false}})})}
function NoticeReplySet(a,h){rgx_username=/^@[0-9a-zA-Z\-_.]*$/;if(a.match(rgx_username)){var b=$("#notice_data-text");if(b.length){replyto=a+" ";b.val(replyto+b.val().replace(RegExp(replyto,"i"),""));$("#notice_in-reply-to").val(h);return false}}return true}
function StatusToggle(){$("#site_nav_global_post li#nav_status a").click(function(){if($("#sub_header #form_instream").length!=0){$("#form_instream").slideToggle(200);$(this).parent("li").toggleClass("current");if($(this)[0].rel){var a=$("#notice_data-text");NoticeReplySet(username,notice_id);a[0].focus();if(a[0].setSelectionRange){var h=a.val().length;a[0].setSelectionRange(h,h)}}}else{$(".notice_reply span").removeClass("active");$(".notice_reply .reply").hide();$(".reply_status a",this).removeClass("current");
$("li#nav_status").removeClass("current");$("#sub_header").append($("#form_instream").show());$("#notice_data-text, #notice_in-reply-to").val("");$(this).parent("li").addClass("current")}return false})}function ExternalLink(){$("a[rel=me], a:not(.attachment)[rel*=external]").attr("target","_blank")}
function NavSort(){$("#nav_sort li").hide();$("#nav_sort li.current").show();$("#nav_sort").removeClass("current");$("#nav_sort li.current a, #nav_sort span").click(function(){$("#nav_sort li:not(.current)").show();$("#nav_sort").addClass("current");return false});$("#nav_sort li:not(.current) a").click(function(){$("#nav_sort li").hide();$("#nav_sort li").removeClass("current");$(this).closest("li").show();$(this).closest("li").addClass("current")});$("body").click(function(){$("#nav_sort li").hide();
$("#nav_sort li.current").show();$("#nav_sort").removeClass("current")})}function ProfileInfoClick(){$("#entity_more_info dl").hide();$("#entity_more_info .more_info").click(function(){$(".more_info.more").toggle();$("#entity_more_info dl").slideToggle(100);return false})}function NoticeAttachments(){$("#content .notices .notice").each(function(){var a=$(this)[0];NoticeWithAttachment(a);AttachmentToggle(a);ExpandLikers(a)})}
function NoticeWithAttachment(a){$("a.attachment",a).click(function(){$().jOverlay({url:$("address .url")[0].href+"attachment/"+$(this).attr("id").substring(11)+"/ajax"});return false});$("a.attachment_expand",a).click(function(){if($("span.loading",a).length>0)return false;else if($(".attachment_view",a).length==0){$("a.attachment_expand",a).append('<span class="loading">Loading</div>');$.get($("address .url")[0].href+"attachment/"+$(this).attr("id").substring(11)+"/ajax",function(b){$("div.entry-avatar, div.entry-thumbnail",
a).hide();$("span.loading").remove();$("p.entry-heading",a).after($(".attachment_view",b));$("#oembed_info",a).prepend('<span class="attachment_hide">\u00d7</span>');AttachmentToggle(a);ExternalLink();$(".attachment_hide",a).click(function(){$("div.entry-avatar, div.entry-thumbnail",a).show();$(".attachment_view",a).hide()})})}else{$("div.entry-avatar, div.entry-thumbnail",a).hide();$(".attachment_view",a).show()}return false});var h;$("a.thumbnail",a).hover(function(){var b=$(this);$("a.thumbnail").children("img").hide();
b.closest(".entry-title").addClass("ov");if(b.children("img").length==0)h=setTimeout(function(){$.get($("address .url")[0].href+"attachment/"+b.attr("id").substring(11)+"/thumbnail",null,function(c){b.append(c)})},500);else b.children("img").show()},function(){clearTimeout(h);$("a.thumbnail").children("img").hide();$(this).closest(".entry-title").removeClass("ov")})}
function AttachmentToggle(a){$(".attachment_toggle",a).show();$(".oembed_info_more",a).hide();$(".attachment_toggle",a).click(function(){$(this).text($(this).text()=="+"?"-":"+");$(".oembed_info_more",a).slideToggle(100)})}function ExpandLikers(a){var h=$(".notice-options .likes:not(.null)",a);h.click(function(){$.get($("address .url")[0].href+"likers/"+$(this).attr("id").substring(6)+"/ajax",function(b){h.hide();h.after(b);Tooltip(".liker")})})}
function ShowComments(a){var h=$(".entry-options .notice_comment a",a);h.click(function(){$.get($("address .url")[0].href+"showcomments/"+$(this).attr("rel")+"/ajax",function(b){h.addClass("active").addClass("loading");h.closest(".entry-options").after(b)});return false})}
function SearchType(){$(".search_type_more").hide();$("#search_type").click(function(){$(".search_type_more").toggle();$(this).toggleClass("active")});$("#search_type .search_type_more a").click(function(){$("#form_search").attr("action",$(this).attr("href"));$("#search_type .search_type_more li").removeClass("current");$(this).parent("li").addClass("current");$(".search_type_more").hide();$("#search_type").removeClass("active");$(".search_toggle").text($(this).text());$("#q").focus();return false})}
function NoticeDataAttach(){NDA=$("#notice_data-attach");NDA.change(function(){S='<div id="notice_data-attach_selected" class="success"><code>'+$(this).val()+'</code> <button>&#215;</button><div id="uploadprogressbar"><span>0%</span></div></div>';NDAS=$("#notice_data-attach_selected");K=$("#notice_kind").val();if(NDAS.length>0)NDAS.replaceWith(S);else if(K=="status")$("#form_notice").append(S);else{$("label[for=notice_data-attach]").after(S);NDA.hide()}$("#notice_data-attach_selected button").click(function(){$("#notice_data-attach_selected").remove();
NDA.val("").show()})});NAT=$("#notice_attach-thumbnail");NATL=$("label[for=notice_attach-thumbnail]");NAT.change(function(){R='<div id="notice_attach-thumbnail_selected" class="success">Thumbnail: <code>'+$(this).val()+"</code> <button>&#215;</button></div>";NATR=$("#notice_attach-thumbnail_selected");K=$("#notice_kind").val();if(NATR.length>0)NATR.replaceWith(R);else{NATL.after(R).hide();NAT.hide()}$("#notice_attach-thumbnail_selected button").click(function(){$("#notice_attach-thumbnail_selected").remove();
NAT.val("").show();NATL.show()})})}
function CommentReply(){$("#content .comment .comment_reply").click(function(){var a=$(this).attr("rel");if($(this).hasClass("active")){$(".comment_reply").removeClass("active");$("#comment_form_box").append($(".form_comment"));$("#reply_to-id").val("")}else{$(".comment_reply").removeClass("active");$(this).addClass("active");$("#comment-"+a).append($(".form_comment"));$("#reply_to-id").val(a)}$("#notice_data-text").css({width:$("#form_notice").width()-115});return false})}
function Tooltip(a,h){var b="tooltip";$(a).each(function(){if($(this).attr("title").length>0){var c=$(this).attr("title");$(this).mouseover(function(){$("#"+b).remove();$("body").append('<div class="'+b+'" id="'+b+'"><p>'+c+"</p></div>");$(this).removeAttr("title");$("#"+b).css({opacity:0.9,display:"none"}).fadeIn(400)}).mousemove(function(d){var f=$(this).offset(),g=$(this).width(),l=$(this).height();if(h=="left")$("#"+b).css({left:f.left+g+5,top:f.top+2}).addClass("tooltip_left");else h=="top"?
$("#"+b).css({left:d.pageX-20,top:f.top+l+15}).addClass("tooltip_top"):$("#"+b).css({left:d.pageX-20,top:f.top-25}).addClass("tooltip_bottom")}).mouseout(function(){$("#"+b).remove();$(this).attr("title",c)})}})}
function MediaSearch(){$("#form_notice a.media_search").click(function(){var a=$(this)[0].href+"/ajax";$().jOverlay({url:a,success:function(){var h=$("#jOverlayContent");h.append("<button>&#215;</button>");$("button",h).click($.closeOverlay);$("#search",h).click(function(){var b=$("#q",h).val().replace(/\s\s+/,"");if(b){$("#resultbox",h).addClass("loading");$.get(a+"?q="+b,function(c){$("#resultbox",h).removeClass("loading");$("#resultbox",h).html(c);$("a",h).click(function(){$("#url").val($(this).attr("href"));
$("#url").each(AttachmentLoad);$.closeOverlay();return false})})}return false})}});return false})}function FrontSwitch(a){$(".switch").hide();$(".s"+a).fadeIn();if(a<9)a++;else a=0;t=setTimeout("FrontSwitch("+a+")",3E3)}
function UploadProgress(){var a=$("#UPLOAD_IDENTIFIER").val();$("#uploadprogressbar").fadeIn();setInterval(function(){$.getJSON($("address .url")[0].href+"extlib/uploadprogress/uploadprogress.php?id="+a,function(h){h=Math.floor(100*parseInt(h.bytes_uploaded)/parseInt(h.bytes_total));$("#uploadprogressbar span").text(h+"%").width(h+"%")})},1500);return true}
function AttachmentLoad(){geturl=new RegExp("((http|https):(([A-Za-z0-9$_.+!*(),;/?#:@&~=-])|%[A-Fa-f0-9]{2}){2,}(#([a-zA-Z0-9][a-zA-Z0-9$_.+!*(),;/?#:@&~=%-]*))?([A-Za-z0-9$_+!*();/?#:~-]))","g");var a=$(this).val().match(geturl);$("ul.form_data :text:not(#url), ul.form_data textarea:not(#url), #tags").val("").change();$("#attachment_preview, #form_notice .attachment_view, #page_notice .error").remove();if(a&&a.length>0){$("label[for=url]").removeClass("loading");if($(this).attr("id")==="notice_data-text")$.each(a,
function(b,c){$("label[for=url]").addClass("loading");$.ajax({type:"GET",url:$("address .url")[0].href+"main/oembed?url="+encodeURIComponent(c),dataType:"json",success:function(d){$("#form_notice").append('<div class="attachment_view success"><a href="'+c+'" class="attachment">'+d.title+"</a></div>");$("label[for=url]").removeClass("loading");$(".attachment_view a[href="+c+"]").click(function(){return false})},error:function(){$("label[for=url]").removeClass("loading")}})});else{var h=a[0].replace(/(\/#\/|#)/g,
"/");setTimeout(function(){$("label[for=url]").addClass("loading");$.ajax({type:"GET",url:$("address .url")[0].href+"main/oembed?url="+encodeURIComponent(h)+"&maxwidth=300",dataType:"json",success:function(b){if(b){$("ul.form_data :text, #tags, ul.form_data textarea").val("").change();$("#url").val(b.resource_url);if($("#notice_kind").val()==b.type||$("#notice_kind").val()=="link"){if(b.type=="audio"){$("#author").val(b.author_name?b.author_name:"");$("#title").val(b.title?b.title:"")}$("#aside_primary").html(b.preview);
$("textarea:not(#url)").change()}else $("#notice_kind").val()!="link"&&$("#page_notice dd").html('<p class="error">Error. Try posting this URL as '+b.type+".</p>")}$("label[for=url]").removeClass("loading")},error:function(){$("label[for=url]").removeClass("loading")}})},1500)}}delete a};
