
Type.registerNamespace("UnitedVirtualities.Web.UI.Webparts.Behaviors");UnitedVirtualities.Web.UI.Webparts.Behaviors.Game=function(element)
{UnitedVirtualities.Web.UI.Webparts.Behaviors.Game.initializeBase(this,[element]);};UnitedVirtualities.Web.UI.Webparts.Behaviors.Game.prototype={_flashObject:null,_idUsuario:"",_desafiado:"",_desafiadoEmail:"",_idJuego:"",_puntos:"",_desafiante:"",_desafianteEmail:"",_server:"http://clients.shoshkey.com/speedy/aula365/",_postURL:"http://clients.shoshkey.com/speedy/aula365/registro.php",_postURLDebug:"http://argentina.aula365.local/_testing/default.aspx",start:function(FKInstancia,AKInstancia,url)
{var svc=null;if(typeof(Aula365)!="undefined")
{svc=new Aula365.Json();}
if(svc)
{if(FKInstancia)
{svc.Activities_Insert("socialactivity.resources.access",FKInstancia);}}
switch(AKInstancia.toLowerCase())
{case"uv.vueltaalcole2009":this.launch(FKInstancia,AKInstancia,url);break;default:var registered=false;var user=this.getCurrentUser();if(user)
{var userType=user.get_UserType();if(userType)
{registered=(userType.AKInstancia.toLowerCase()=="tipousuario.registered");}}
if(registered)
{if(svc)
{var postUri=this._postURL;postUri+="?";postUri+="ID="+user.get_FKInstancia();postUri+="&";postUri+="Nombre="+user.get_FirstName();postUri+="&";postUri+="Apellido="+user.get_LastName();postUri+="&";postUri+="Email="+user.get_Email();postUri+="&";postUri+="FechaNacimiento=01/01/1900";var callbackOnSucceed={behavior:this,FKInstancia:FKInstancia,AKInstancia:AKInstancia,url:url,invoke:function(data)
{switch(data.toLowerCase())
{case"1":case"&error=0":this.behavior.launch(FKInstancia,AKInstancia,url);break;}}};svc.UV_Invoke(postUri,"GET",Function.createDelegate(callbackOnSucceed,callbackOnSucceed.invoke));}}
else if(typeof(InvokeUserRegistration)!="undefined")
{InvokeUserRegistration("try");}
break;}},launch:function(FKInstancia,AKInstancia,url)
{switch(AKInstancia.toLowerCase())
{case"uv.vueltaalcole2009":var w=Competir.Web.UI.OpenNamedPopup(url,AKInstancia.replace(/\./,""),800,600);if(w)
{w.focus();}
break;default:var target=this.get_Target();if(target)
{this._idUsuario=Competir.Web.API.getValue("user","id","");this._desafiante=Competir.Web.API.getValue("querystring","desafiante","");this._desafianteEmail=Competir.Web.API.getValue("querystring","desafianteemail","");this._flashObject=new Competir.Web.UI.SWFObject(url,AKInstancia,"100%","100%","noscale","TL","false","transparent","high");this._flashObject.addVariable("idusuario",this._idUsuario);this._flashObject.addVariable("desafiado",this._desafiado);this._flashObject.addVariable("desafiadoemail",this._desafiadoEmail);this._flashObject.addVariable("idjuego",this._idJuego);this._flashObject.addVariable("puntos",this._puntos);this._flashObject.addVariable("desafiante",this._desafiante);this._flashObject.addVariable("desafianteemail",this._desafianteEmail);this._flashObject.addVariable("server",this._server);this._flashObject.write(target.getContentsContainer());target.show();}
break;}},stop:function()
{var target=this.get_Target();if(target)
{this._flashObject=null;Competir.Web.UI.setInnerHTML(target.getContentsContainer(),"");target.hide();}},getCurrentUser:function()
{var rv=null;var context=Competir.MiEmpresa.Context.getCurrent();if(context)
{var user=context.get_User();if(user)
{if(user.get_FKInstancia()!=0)
{rv=user;}}}
return rv;},_onApplicationLoad:function(o)
{var action=Competir.Web.API.getValue("querystring","action","");switch(action.toLowerCase())
{case"vac2009":this.start(null,"UV.VueltaAlCole2009","/vueltaalcole2009/default.aspx");break;default:this._idJuego=Competir.Web.API.getValue("querystring","idjuego","");this._puntos=Competir.Web.API.getValue("querystring","puntos","");this._desafiado=Competir.Web.API.getValue("user","firstname","");this._desafiadoEmail=Competir.Web.API.getValue("user","email","");if(this._puntos)
{if(this._desafiado)
{if(this._desafiadoEmail)
{this.start();}}}
break;}}};UnitedVirtualities.Web.UI.Webparts.Behaviors.Game.registerClass("UnitedVirtualities.Web.UI.Webparts.Behaviors.Game",Competir.Web.UI.Webparts.Behaviors.BaseWebpartBehavior);Type.registerNamespace("Competir.Web.API");Competir.Web.API.invokeUVMethod=function(name,arguments)
{name=name.replace("(","");name=name.replace(")","");var fn=eval(name);if(fn)
{if(arguments)
{fn.apply(window,arguments);}
else
{fn.apply(window);}}};