var onload_scripts = function(){};
function add_onload_script(funcion){
	var aux_onload_scripts = onload_scripts;
	onload_scripts = function(){
		aux_onload_scripts();
		funcion();
	};
}

function urlencode(str) {
	return escape(str).replace(/\+/g,'%2B').replace(/%20/g, '+').replace(/\*/g, '%2A').replace(/\//g, '%2F').replace(/@/g, '%40');
}

var Aparecer = function(objct, velocidad, tope) {
	tope = tope || 1;
	if(typeof objct == "object")
		var objeto = objct;
	else
		var objeto = document.getElementById(objct);
	var timer;
	var IE = /*@cc_on!@*/false;
	var opacidad;
	
	function Aparecer(){
		if(!IE)
			objeto.style.opacity = 0;
		else
			objeto.style.filter = "alpha(opacity=0)";
		opacidad = 0;
		
		timer = setInterval(function() {
			if(opacidad < tope){
				opacidad = opacidad+velocidad;
				if(!IE)
					objeto.style.opacity = parseFloat(opacidad);
				else
					objeto.style.filter = "alpha(opacity="+opacidad*100+")";
			}
			else {
				clearInterval(timer);
			}
		}, 1);
	}Aparecer();
};

function isEmail(id){
	return /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(document.getElementById(id).value);
}

function isVacio(id){
	if(trim(document.getElementById(id).value).length == 0 || document.getElementById(id).value==undefined){
		return true;
	}else{
		return false;
	}
}

function trim(txt){
	return txt.replace(/^\s+|\s+$/g,"");
}
