function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	}
	else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}
/*funciones que se llaman desde otros js*/
function idioma(){
	var loc =new String(window.location);
	var lang =new String('es');

	if(loc.indexOf('/es/')!=-1){lang='es';}
	if(loc.indexOf('/en/')!=-1){lang='en';}
	if(loc.indexOf('=ES')!=-1){lang='es';}
	if(loc.indexOf('=EN')!=-1){lang='en';}
	if(loc.indexOf('cambioIdioma=EN')!=-1){lang='es';}
	if(loc.indexOf('cambioIdioma=ES')!=-1){lang='en';}
	
	return lang;
} 
/*Para eliminar los espacios en blanco, elimina los espacios en blanco, retornos de carro y linea*/
function nospaces(t) {
	t = t.replace(/  /,"\r\n");
	while (t.search(/(\r\n\r\n)|(\n\n)|(\n)|(\r)|(  )| (&nbps;)/) != -1) {
		t = t.replace(/\r\n\r\n/g, "");
		t = t.replace(/\n\n/g, "");
		t = t.replace(/\n/g,"");
		t = t.replace(/\r/g,"");
		t = t.replace(/  /g,"");
		t = t.replace(/&nbsp;/g,"");
	}
	return t;
}
/*Funcion para generar el title del enlace, elimina los tags html dentro de el tag a si los tiene*/
function Depuro(text){
	text=nospaces(text);
	var caracteres=new Array('<span','</span>','<img','<br/>','<br>','<br />','<INPUT','<input','<p','</p>','<em>','</em>','<strong>','</strong>','<SPAN','</SPAN>','<IMG','<BR/>','<BR>','<BR />','<P','</P>','<EM>','</EM>','<STRONG>','</STRONG>');	
	var numc= new Array('5','7','4','5','4','6','6','6','2','4','4','5','8','9');
	for(var i=0; i< caracteres.length; i++){
		//alert('['+caracteres[i]+']'+text.indexOf(caracteres[i]));
		while(text.indexOf(caracteres[i])!=-1){
			if(text.indexOf(caracteres[i])==0){
				if(i==1 || i==3){text= text.substring(text.indexOf(caracteres[i])+numc[i],text.length);}
				else{text=text.substr(text.indexOf('>')+1,text.length);}
			}else{
				if(i==1 || i==3){
					var num=parseInt(text.indexOf(caracteres[i]))+ parseInt(numc[i]);
					text=text.substr(0,text.indexOf(caracteres[i]))+' '+text.substring(num,text.length);
				}else{
					var num=parseInt(text.indexOf(caracteres[i]));
					var ocu=text.substr(num,text.length);
					var num2=parseInt(ocu.indexOf('>')+1)+ parseInt(num);
					text=text.substr(0,num)+' '+text.substr(num2,text.length);
				}			
			}
		}
	}
	return text;
}