document.domain="gaygate.com";
var openMessageWindow=function(a){var b="send";if(arguments.length>1)b=arguments[1];(new Window({href:"/message/"+b+"/"+a,name:"message"+a,width:400,height:400})).open()},openProfileWindow=function(a){(new Window({href:"/profile/"+a+"/",name:"profile"+a,width:600,height:570,scrolling:true})).open()},openHelpWindow=function(a){(new Window({href:"/help/small/"+a+"/",name:"help"+a,width:550,height:250,scrolling:true})).open()},openPhoto=function(a){a.stop();a=this.get("href").match(/^\/photo\/([^\/]+)\//);a=
a===null?"photo"+Math.round(Math.random()*1E3):"photo"+a[1];(new Window({href:this.get("href"),name:a,width:600,height:720,scrolling:true})).open()},mainSetProfileLinks=function(){$$("a.profileLink").each(function(a){a.removeEvents();a.addEvent("click",function(b){b.stop();b=this.get("href").replace(/^\/profile\/(.+)\/$/,"$1");openProfileWindow(b)})})},GGRequest=new Class({Implements:Options,initialize:function(a){$type(a.onComplete)=="function"&&this.onOK(a.onComplete);a.onComplete=this.handleResponse.bind(this);
this.mRequest=new Request.JSON(a);this.mErrorHandlers=$H({});this.mOKHandler=$empty()},handleResponse:function(a){if($type(a)!==false)if(a.result=="error"){var b=a.message.replace(/^E_/,"").toUpperCase();$type(this.mErrorHandlers[b])=="function"&&this.mErrorHandlers[b](a)}else $type(this.mOKHandler)=="function"&&this.mOKHandler(a)},onOK:function(a){this.mOKHandler=a;return this},onComplete:function(a){return this.onOK(a)},onError:function(a,b){this.mErrorHandlers[a.toUpperCase()]=b;return this},send:function(){this.mRequest.send();
return this}}),Notice=new Class({Implements:Options,options:{error:false,clean:false},initialize:function(a,b){this.setOptions(b);var c=(new Element("h4",{"class":"notice",text:a})).set("tween",{duration:200});this.options.error===true&&c.addClass("error");$A(["lb","rb","lt","rt"]).each(function(d){(new Element("div",{"class":d})).inject(c)});this.moEl=c},show:function(a){this.options.clean===true&&$$("h4.notice").each(function(b){b.destroy()});this.moEl.fade("hide").inject($(a),"top").fade("in")}});
Notice.removeAll=function(){$$("h4.notice").each(function(a){a.destroy()})};
window.addEvent("domready",function(){mainSetProfileLinks();$$("a.messageLink").each(function(a){a.addEvent("click",function(b){b.stop();b=this.get("href").match(/^\/message\/([^\/]+)\/([^\/]+)\/$/);openMessageWindow(b[2],b[1])})});$$("a.helpLink").each(function(a){a.addEvent("click",function(b){b.stop();b=this.get("href").match(/^\/help\/small\/([^\/]+)\/$/);openHelpWindow(b[1])})});$$("a.webcamLink").each(function(a){a.addEvent("click",function(b){b.stop();b=this.get("href").replace(/^\/webcam\/view\/(\w+)\//,
"$1");(new Window({href:this.get("href"),name:"webcam"+b,width:480,height:410})).open()})});$$("a.photoLink").each(function(a){a.addEvent("click",openPhoto)});$("menu_close")&&$("menu_close").addEvent("click",function(a){a.stop();$("confirmCloseText")&&!confirm($("confirmCloseText").get("text"))||window.close()});$("startWebcam")&&$("startWebcam").addEvent("click",function(a){a.stop();(new Window({href:"/webcam/publish/",name:"webcamPublish",width:480,height:440})).open()})});
