
if (!window['videa']) window['videa']={'name':'videa'};
if (!window['videa']['Event'])
window['videa']['Event']=function(sender){
  var me=this;
  me.name="Event Object";
  me.sender=sender;
  
  me.callBackList=new Array();
  me.addhandler=function(fn,handlerObj){
    // benne van -e mar az eventlistaban?
    for (var i=0;i<me.callBackList.length;i++){      
      if (typeof(fn)=='function'){
        if (fn==me.callBackList[i].fnRef) return;
      } else {
        alert("system.Event.addhandler error: fn param is not function");
      }    
    }
    // ha nincs akkor hozzaadjuk
    if(typeof(fn)=='function'){
      me.callBackList.push({'fnRef':fn,'handlerObjRef':handlerObj});
    } else {
      alert("system.Event.addhandler error: fn param is not function");
    }
    return;    
  }

  me.raise=function(oArg){
    for (var i=0;i<me.callBackList.length;i++){
      //try{
      	if(me.callBackList[i].fnRef){
      	  if(me.callBackList[i].handlerObjRef)
      	    me.callBackList[i].fnRef.call(me.callBackList[i].handlerObjRef,me.sender,oArg);
      	  else
      	    me.callBackList[i].fnRef(me.sender,oArg);  
      	}else{
          alert("system.Event.raise error: fn param is not a function");
        }
      /*}catch(e){
      	if(console)
      	  console.warn(me.name+" - "+new String(me.callBackList[i].fnRef).substring(0,20)+' function not found');
      } */     
    }
    return;    
  }
  return;
}
