
function test(num){
	if(!num){
	return 0
	}else{
	return num
	}

}
var DOM_OBJECT_TREE = []

function setDomObjectTree(){
		var object = arguments[0].childNodes
		for (var i=0; i<object.length;i++){
			DOM_OBJECT_TREE.push(object[i])
			if(object[i].hasChildNodes()) setDomObjectTree(object[i]);
		}
	}
/*
Function: CMP
Description: Comprueba que el objeto sea o no de la clase asignada.
Arguments: Nothing
Return: Nothing
UrlDoc:	http://foxnet.es
Return:	Class
*/

function GetParams(name){
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");  
  var regexS = "[\\?&]"+name+"=([^&#]*)";  
  var regex = new RegExp( regexS );  
  var results = regex.exec( window.location.href );  
  if( results == null ){
  return undefined;
  }else{   
  return results[1];}
}
 
 /*
Function: CMP
Description: Comprueba que el objeto sea o no de la clase asignada.
Arguments: Nothing
Return: Nothing
UrlDoc:	http://foxnet.es
Return:	Class
*/

function listen(event, elem, func) {
    if (elem.addEventListener)  // W3C DOM
        elem.addEventListener(event,func,false);
    else if (elem.attachEvent) { // IE DOM
		elem['on'+event]= func
         //var r = elem.attachEvent("on"+event, func);
	//return r;
    }
    else throw 'No es posible aņadir evento';
}

var ToolKit = new ToolKits
function ToolKits(){
	this.version = "0.1";
	this.navegadorVersion = navigator.appVersion.split("MSIE")
	this.navegadorVersionNum = parseFloat(this.navegadorVersion[1])
	this.navegador =  navigator.userAgent.toLowerCase();
	this.navegadorIsGecko = this.navegador.indexOf('gecko')!=-1; //si el motor es gecko, es Mozilla, Netscape, Safari, etc
	
	this.getProperty = function(id,propiedad){ 
		 if(typeof(id)=="object"){var elemento=id}else{var elemento=document.getElementById(id);}
			
			if (this.navegadorIsGecko) {
			var resultado = document.defaultView.getComputedStyle(elemento,null).getPropertyValue(propiedad);
			}else{
			var resultado = eval("elemento.currentStyle."+propiedad);
			}
			return resultado;
		}

}


  
function borrarCaja(obj){
    obj.backup = obj.value
    obj.value = ""
}
function recuperarCaja(obj){

if(obj.value==""){obj.value = obj.backup}
}

function OpenInfo()
 {
 var windoName;
 windowName =window.open('javaversion.html','faq','width=400,height=400,Toolbar =NO,Titlebar=NO,Status =NO,Menubar =NO,Location =NO,Directories =NO,Resizable=SI,resizable=si');
 windowName.focus();
 } 

 function OpenEmpresa(id,event){
 if(event.__ClkEvent!=null){
     windowName =window.open('detalleempresas.aspx?id='+id,'faq','width=810,height=510,Toolbar =NO,Titlebar=NO,Status =NO,Menubar =NO,Location =NO,Directories =NO,Resizable=SI,resizable=si');
     windowName.focus();
 return !windowName
 }
 } 
 
  /*
Function: LogoSyK
Description: Inserta un logo en el apple  pasado por parametro
Arguments: idApple=Id del parametro
*/
 function LogoSyK(idApple)
    {
        this.imageLogo;
        this.applet;
        this.width;
        this.height;
        
        this.Init=function(id)
        {
                        
            this.applet = document.getElementById(id);
            
            this.imageLogo = ToolKit.navegadorIsGecko? document.createElement("iframe") : document.createElement("<iframe frameborder='0'/>");
            
            this.width = 50
            this.height = 31
            
            this.imageLogo.style.top = this.applet.getBoundingClientRect().top+this.applet.offsetHeight-this.height+13+"px"
            this.imageLogo.style.zIndex = "9999"
            this.imageLogo.id = "logoSyK"
            this.imageLogo.style.width =  this.width+"px"
            this.imageLogo.style.height = this.height+"px"
            this.imageLogo.scrolling ="no"
            this.imageLogo.setAttribute("frameborder" ,"0")
            this.imageLogo.style.left = this.applet.getBoundingClientRect().left+this.applet.offsetWidth- this.width-8+"px"
            this.imageLogo.src = "logo.html"
            document.body.appendChild(this.imageLogo)
            
            var _this=this;
            
            listen("resize",window,function(){_this.Refrescar()});
        }
        
        this.Refrescar=function()
        {
            this.imageLogo.style.top = this.applet.getBoundingClientRect().top+this.applet.offsetHeight-this.height+"px"
            this.imageLogo.style.left = this.applet.getBoundingClientRect().left+this.applet.offsetWidth-this.width -8+"px"
        }
        
        this.Init(idApple);
        
    }
