
function Alertar(msg)
{alert(msg);}
function ExecCommand(name,args)
{var refFn=eval(name);if(refFn)
{var fn=new refFn();if(fn)
{if(fn.execute)
{fn.execute.apply(fn,args);}}}}
function InvokeSystemCallout(targetDomElement,messageClientID,position,offsetX,offsetY,eventObject,cancelEvent)
{var objCallout=$find('ctl00_wp_SystemCallouts');if(objCallout)
{objCallout.callFromBehavior('show',[targetDomElement,messageClientID,position,offsetX,offsetY]);if(cancelEvent)
{Competir.Web.UI.cancelEvent(eventObject);}}}
function InvokeSystemDynamicCallout(referenceDomElement,messageClientID,targetDomElement,position,offsetX,offsetY,eventObject,cancelEvent)
{var objCallout=$find('ctl00_wp_SystemCallouts');if(objCallout)
{var objContainer=objCallout.getChild(messageClientID+"_container");if(objContainer)
{Competir.Web.UI.setInnerHTML(objContainer,referenceDomElement.innerHTML);InvokeSystemCallout(targetDomElement,messageClientID,position,offsetX,offsetY,eventObject,cancelEvent);}}}
function InvokeUserLogin()
{var cub=Competir.Web.UI.Webparts.CurrentUserBox.getByMode("Selector");if(cub)
{cub.show();if(cub.get_User().get_FKInstancia()!=0)
{cub.renderContent("login");}}}
function InvokeUserChange()
{var cub=Competir.Web.UI.Webparts.CurrentUserBox.getByMode("Selector");if(cub)
{cub.show();}}
function InvokeUserLogout()
{var cub=Competir.Web.UI.Webparts.CurrentUserBox.getCurrent();if(cub)
{cub.logout();}}
function InvokeUserRegistration(contentMode,parameter)
{var cub=Competir.Web.UI.Webparts.CurrentUserBox.getByMode("Registrator");if(cub)
{if(parameter)
{switch(contentMode)
{case"member":cub.get_User().set_FKInstancia(parameter);break;case"register":cub.callFromBehavior('set_LicenseCode',[parameter]);break;}}
cub.show();cub.renderContent(contentMode);}
return cub;}
function CanUserAccessToRestrictedResources(forceAccess)
{var rv=true;var output="";if(!forceAccess)
{var errorLogin="Para acceder a este recurso debes completar tu login.";if(Competir.MiEmpresa.Context.getCurrent())
{var usr=Competir.MiEmpresa.Context.getCurrent().get_User();if(usr)
{if(usr.get_FKInstancia()==0)
{output=errorLogin;}
else if(usr.get_UserType()&&usr.get_UserType().AKInstancia=="TipoUsuario.Anonymous")
{output=errorLogin;}}
else
{output=errorLogin;}}
else
{output=errorLogin;}}
if(output!="")
{rv=false;alert(output);}
return rv;}
function PublishInDefaultTemplate()
{if(Competir.MiEmpresa.Context.getCurrent())
{var breakOperation=false;if(Competir.MiEmpresa.Context.getCurrent().get_User())
{if(Competir.MiEmpresa.Context.getCurrent().get_User().get_FKInstancia()==0)
{breakOperation=true;}}
else
{breakOperation=true;}
if(breakOperation)
{alert("Para añadir contenidos a Mi Aula 365, completá tu login o registrate.");return;}}
this.execute=function(objImg,contentIDs,AKTipoWebpart)
{if(!objImg.disabled)
{this.objImg=objImg;this.operation=new Competir.MiEmpresa.Operation("webpart.publications.add");this.operation.addParameter("AKTipoWebpart",AKTipoWebpart);this.operation.addParameter("ContentIDs",contentIDs);this.operation.addListener(this);Competir.MiEmpresa.Context.getCurrent().get_ExecutionQueue().enqueue(this.operation);}};this._onOperationStarted=function(o)
{if(this.objImg)
{this.objImg.style.cursor="wait";this.objImg.disabled=true;this.objImg.src=this.objImg.src.replace("_enabled","_busy");}};this._onOperationSucceeded=function(o,e)
{if(this.objImg)
{if(o.get_Result()=="true")
{this.objImg.style.cursor="default";this.objImg.disabled=true;this.objImg.src=this.objImg.src.replace("_busy","_completed");var id="";for(var i=0;i<o.get_Parameters().length;i++)
{if(o.get_Parameters()[i].name=="ContentIDs")
{id=o.get_Parameters()[i].value;break;}}
var divFeedback=$get(id+"_DivFeedBack");if(divFeedback)
{Competir.Web.UI.show(divFeedback);Competir.Web.UI.setInnerHTML(divFeedback,"<a href='/mi_aula.aspx#"+id+"'>Encontralo en Mi Aula 365</a>");}}
else
{this.objImg.style.cursor="pointer";this.objImg.disabled=false;this.objImg.src=this.objImg.src.replace("_busy","_enabled");}}};this._onOperationFailed=function(o)
{if(this.objImg)
{this.objImg.style.cursor="pointer";this.objImg.disabled=false;this.objImg.src=this.objImg.src.replace("_busy","_enabled");}};}
function InsertCurrentAccountMovement()
{if(Competir.MiEmpresa.Context.getCurrent())
{var breakOperation=false;if(Competir.MiEmpresa.Context.getCurrent().get_User())
{if(Competir.MiEmpresa.Context.getCurrent().get_User().get_FKInstancia()==0)
{breakOperation=true;}}
else
{breakOperation=true;}
if(breakOperation)
{alert("Para añadir contenidos a Mi Aula 365, completá tu login o registrate.");return;}}
this.execute=function(akMovementType,ammount,fkRelatedObject)
{this.operation=new Competir.MiEmpresa.Operation("currentaccounts.movements.insert");this.operation.addParameter("AKInstanciaTipoMovimiento",akMovementType);this.operation.addParameter("Ammount",ammount);this.operation.addParameter("FKInstanciaRelatedObject",fkRelatedObject);this.operation.addListener(this);Competir.MiEmpresa.Context.getCurrent().get_ExecutionQueue().enqueue(this.operation);};}
function InsertEvent()
{this.execute=function(AKInstanciaTipoEvento,FKInstanciaContexto,FKInstanciaObjeto,FKInstanciaUsuario,observaciones,sumarize,param1,param2)
{this.operation=new Competir.MiEmpresa.Operation("events.insert");this.operation.addParameter("AKInstanciaTipoEvento",AKInstanciaTipoEvento);this.operation.addParameter("FKInstanciaContexto",FKInstanciaContexto);this.operation.addParameter("FKInstanciaObjeto",FKInstanciaObjeto);this.operation.addParameter("FKInstanciaUsuario",FKInstanciaUsuario);this.operation.addParameter("Observaciones",observaciones);this.operation.addParameter("Sumarize",sumarize);this.operation.addParameter("Param1",param1);this.operation.addParameter("Param2",param2);Competir.MiEmpresa.Context.getCurrent().get_ExecutionQueue().enqueue(this.operation);};}
function CreateAnonymousUser()
{this.execute=function(AKInstanciaTemplate,templateName,username,forceRemember,reuseUser,listenerControl)
{if(AKInstanciaTemplate)
{this.operation=new Competir.MiEmpresa.Operation("user.create.anonymous");this.operation.addParameter("AKInstanciaTemplate",AKInstanciaTemplate);this.operation.addParameter("TemplateName",templateName);this.operation.addParameter("Username",username);this.operation.addParameter("ForceRemember",forceRemember);this.operation.addParameter("ReuseUser",reuseUser);if(listenerControl)
{this.operation.addListener(listenerControl);}
Competir.MiEmpresa.Context.getCurrent().get_ExecutionQueue().enqueue(this.operation);}};}
function ProcessContextEvent(eventType,param1,param2)
{switch(eventType.toLowerCase())
{case"user.credit.use":if(param1==0)
{}
break;}}
function GetTextAreaValue(id)
{var rv="";var obj=$get(id);if(obj)
{rv=obj.value;}
return rv;}
function abrirPopup(url,ancho,alto)
{ancho=""+ancho;if(ancho.indexOf("%")!=-1)
{ancho=screen.width*parseInt(ancho,10)/100;}
alto=""+alto;if(alto.indexOf("%")!=-1)
{alto=screen.height*parseInt(alto,10)/100;}
var x=(screen.width-ancho)/2;var y=(screen.height-alto)/2;return window.open(url,"Popup","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0,width="+ancho+",height="+alto+",left="+x+",top="+y,"");}
function abrirPopupScroll(url,ancho,alto)
{ancho=""+ancho;if(ancho.indexOf("%")!=-1)
{ancho=screen.width*parseInt(ancho,10)/100;}
alto=""+alto;if(alto.indexOf("%")!=-1)
{alto=screen.height*parseInt(alto,10)/100;}
var x=(screen.width-ancho)/2;var y=(screen.height-alto)/2;return window.open(url,"Popup","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,copyhistory=0,width="+ancho+",height="+alto+",left="+x+",top="+y,"");}
function abrirPopupNombrado(url,nombre,ancho,alto)
{ancho=""+ancho;if(ancho.indexOf("%")!=-1)
{ancho=screen.width*parseInt(ancho,10)/100;}
alto=""+alto;if(alto.indexOf("%")!=-1)
{alto=screen.height*parseInt(alto,10)/100;}
var x=(screen.width-ancho)/2;var y=(screen.height-alto)/2;return window.open(url,nombre,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0,width="+ancho+",height="+alto+",left="+x+",top="+y,"");}
function abrirPopupLikeBlank(url,ancho,alto)
{ancho=""+ancho;if(ancho.indexOf("%")!=-1)
{ancho=screen.width*parseInt(ancho,10)/100;}
alto=""+alto;if(alto.indexOf("%")!=-1)
{alto=screen.height*parseInt(alto,10)/100;}
var x=(screen.width-ancho)/2;var y=(screen.height-alto)/2;return window.open(url,"Popup","toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1,copyhistory=1,width="+ancho+",height="+alto+",left="+x+",top="+y,"");}
function NavigateTo(url,target)
{if(!target)
{target="_self";}
switch(target.toLowerCase())
{case"_blank":window.open(url);break;case"_self":default:window.location.href=url;break;}}
function GetQueryVariable(variable)
{var rv="";var query=window.location.search.substring(1);var vars=query.split("&");for(var i=0;i<vars.length;i++)
{var pair=vars[i].split("=");if(pair[0]==variable)
{rv=pair[1];}}
return rv;}
function HoverImage(objImage,hover)
{if(objImage)
{if(hover)
{objImage.src=objImage.src.replace("_idle","_hover");}
else
{objImage.src=objImage.src.replace("_hover","_idle");}}}
function openMicrosite2(FKInstancia,idProducto,codTipoProducto,codProducto,idContenidoRelacionado,idContenidoCurso)
{var ancho=(screen.width<800)?630:(screen.width<1024)?720:920;var alto=(screen.width<800)?410:(screen.width<1024)?520:690;var x=(screen.width-ancho)/2;var y=(screen.height-alto)/2;var context=Competir.MiEmpresa.Context.getCurrent();var user=(context)?context.get_User():null;var tipoMicrosite="";switch(codTipoProducto)
{case"24":tipoMicrosite="cursos";break;case"25":case"29":tipoMicrosite="seminarios";break;case"27":case"32":tipoMicrosite="tutoriales";break;}
var email=(user)?user.get_Email():"";var url="";url+="http://mipyme.competir.com/es/microsite/"+tipoMicrosite+"/presentacion.asp";url+="?idContProducto="+idProducto;url+="&tipo="+codTipoProducto;url+="&codCurso="+codProducto;url+="&idContenido="+idContenidoRelacionado;url+="&idCurso="+idContenidoCurso;url+="&acceso=1";url+="&nameWcp=MIEMPRESA";url+="&email="+email;url+="&pkIdUsuarioWCEP=";url+="&dominio="+document.location.protocol+"//"+document.location.host;if(tipoMicrosite=="")
{alert("No se pudo determinar el origen del curso solicitado. Consulte a un administrador.");}
else
{var w=window.open(url,"rtem2","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=0,resizable=0,width="+ancho+",height="+alto+",left="+x+",top="+y);if(w)
{w.focus();}}}
function openMicrosite3(FKInstancia,idContenido)
{var ancho=772;var alto=553;var x=(screen.width-ancho)/2;var y=(screen.height-alto)/2;var context=Competir.MiEmpresa.Context.getCurrent();var user=(context)?context.get_User():null;var nombre=(user)?user.get_FirstName():"";var apellido=(user)?user.get_LastName():"";var email=(user)?user.get_Email():"";var url="";url+="http://200.43.193.34/autorun.asp";url+="?contenido="+idContenido;url+="&nombre="+nombre;url+="&apellido="+apellido;url+="&mail="+email;url+="&conmail=si";var w=window.open(url,"rtem3","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=0,resizable=0,width="+ancho+",height="+alto+",left="+x+",top="+y);if(w)
{w.focus();}}
function openMicrosite4(uri,skin,FKInstanciaPrograma,FKInstanciaCurso,FKInstanciaUsuario,ancho,alto)
{ancho=800;alto=600;var x=(screen.width-ancho)/2;var y=(screen.height-alto)/2;var context=Competir.MiEmpresa.Context.getCurrent();var user=(context)?context.get_User():null;var host=document.location.protocol+"//"+document.location.host;var FKInstanciaSolucion=(context)?context.get_FKInstancia():0;var FKInstanciaGrupo=0;if(!FKInstanciaUsuario)
{FKInstanciaUsuario=(user)?user.get_FKInstancia():0;}
var nombre=(user)?user.get_FirstName():"";var apellido=(user)?user.get_LastName():"";var email=(user)?user.get_Email():"";var url="";if(host.indexOf(".local")!=-1)
{url+="/rtev3/";}
else
{url+="/rtev3/";}
url+="RTE.aspx";url+="?uri="+uri;url+="&host="+host;url+="&skin="+skin;url+="&startup=firstlo";url+="&FKInstanciaSolucion="+FKInstanciaSolucion;url+="&FKInstanciaGrupo="+FKInstanciaGrupo;url+="&FKInstanciaUsuario="+FKInstanciaUsuario;url+="&FKInstanciaPrograma="+FKInstanciaPrograma;url+="&FKInstanciaCurso="+FKInstanciaCurso;var w=window.open(url,"rtem4","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=0,resizable=0,width="+ancho+",height="+alto+",left="+x+",top="+y);if(w)
{w.parentContext={registrationFunction:function()
{window.focus();return InvokeUserRegistration("try");},context:Competir.MiEmpresa.Context.getCurrent(),onContextEvent:function(eventType,param1,param2)
{ProcessContextEvent(eventType,param1,param2);}};w.focus();}}
function openBlog(FKInstancia)
{NavigateTo("/blogs_view.aspx?FKInstancia="+FKInstancia);}
function openHistorieta(FKInstancia)
{var w=abrirPopupNombrado("/popups/PopUp_Componentes_View.aspx?FKInstancia="+FKInstancia,"historieta",680,580);if(w)
{w.focus();}}
function openGaleria(xml,ancho,alto)
{if(!ancho)
{ancho=680;}
if(!alto)
{alto=580;}
var w=abrirPopupNombrado("/popups/PopUp_Galeria_View.aspx?xml="+xml,"galeria",ancho,alto);if(w)
{w.focus();}}
function openInfografia(FKInstancia)
{var w=abrirPopupNombrado("/popups/PopUp_Componentes_View.aspx?FKInstancia="+FKInstancia,"infografia",680,530);if(w)
{w.focus();}}
function openIlustracion(FKInstancia)
{var w=abrirPopupNombrado("/popups/PopUp_Componentes_View.aspx?FKInstancia="+FKInstancia,"ilustracion",480,500);if(w)
{w.focus();}}
function openTutorial(FKInstancia,url,ancho,alto)
{if(!ancho)
{ancho=640;}
if(!alto)
{alto=438;}
var w=abrirPopupNombrado(url,"tutorial",ancho,alto);if(w)
{w.focus();}}
function openSimulacion(FKInstancia,url)
{var w=abrirPopupNombrado(url,"simulacion",800,480);if(w)
{w.focus();}}
function openSimulador(FKInstancia,url,ancho,alto)
{if(!ancho)
{ancho=640;}
if(!alto)
{alto=438;}
var w=abrirPopupNombrado(url,"simulador",ancho,alto);if(w)
{w.focus();}}
function startDownload()
{}
function openChiste(FKInstancia)
{var w=abrirPopupNombrado("/popups/PopUp_Componentes_View.aspx?FKInstancia="+FKInstancia,"chiste",480,500);if(w)
{w.focus();}}
function openWiki(FKInstancia)
{NavigateTo("/wiki_view.aspx?FKInstancia="+FKInstancia);}
function recomendLink(idObject,template)
{var url="/popups/PopUp_Recomendar.aspx?idObject="+idObject;if(template)
{url+="&template="+template;}
var w=abrirPopupNombrado(url,"recomendar",480,500);if(w)
{w.focus();}}
function onDrop(sender,e)
{var container=e.get_container();var item=e.get_droppedItem();var position=e.get_position();item.focus();var ctx=Competir.MiEmpresa.Context.getCurrent();if(ctx.get_User().get_FKInstancia()!=0)
{var wpRenderer=$find(item.id);var sectionIndex=container.getAttribute("sectionindex");if(wpRenderer&&(wpRenderer.get_SectionIndex()!=sectionIndex|wpRenderer.get_PositionIndex()!=position))
{wpRenderer.relocateWebpart(sectionIndex,position);}}}
function recalcUI()
{if(document.recalc)
{document.recalc(true);}}