/* UNIVERSAL FUNCTIONALITY */
function popup(url,ancho,alto,id,extras){
	if(navigator.userAgent.indexOf("Mac")>0){ancho=parseInt(ancho)+15;alto=parseInt(alto)+15;}
	var left = (screen.availWidth-ancho)/2;
	var top = (screen.availHeight-alto)/2;
	if(extras!=""){extras=","+extras;};
	var ventana = window.open(url,id,'width='+ancho+',height='+alto+',left='+left+',top='+top+',screenX='+left+',screenY='+top+extras);
	//var bloqueado = "AVISO:\n\nPara ver este contenido es necesario que desactive\nel Bloqueo de Ventanas para este Sitio."
	var bloqueado = "WARNING:\n\nIn order to use this functionality, you need\nto deactivate Popup Blocking for this site."
	if(ventana==null || typeof(ventana.document)=="undefined"){ alert(bloqueado) }else{ return ventana; };
}

function inspect(obj) {
	var str = "";
	for (var k in obj)
		str += "obj." + k + " = " + obj[k] + "<br>";
	(window.open('about:blank')).document.write(str);
}

function readCookie(name){
	var cookieValue = "";
	var search = name + "=";
	if(document.cookie.length > 0){ 
		offset = document.cookie.indexOf(search);
		if (offset != -1){ 
			offset += search.length;
			end = document.cookie.indexOf(";", offset);
			if (end == -1) end = document.cookie.length;
			cookieValue = unescape(document.cookie.substring(offset, end))
		}
	}
	return cookieValue;
}

function writeCookie(name, value, hours){
	var expire = "";
	if(hours != null){
		expire = new Date((new Date()).getTime() + hours * 3600000);
		expire = "; expires=" + expire.toGMTString();
	}
	document.cookie = name + "=" + escape(value) + expire;
}
	
function emailvalido(obj,nombre) {msg=""; if(obj.value!=""){var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/;var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;if (reg1.test(obj.value) || !reg2.test(obj.value)){msg= "\n* "+nombre+' is invalid.'}} return msg}

function mostrar_mascara(texto){	
	ancho = (window.innerWidth)? window.innerWidth : document.body.clientWidth;
	alto = (window.innerHeight)? window.innerHeight : document.body.clientHeight;
	div = document.createElement("div");
	document.body.appendChild(div);
	div.style.position = 'absolute'; div.style.top = '0px'; div.style.left = '0px';
	div.style.width = ancho+'px'; div.style.height = alto+'px';	div.style.backgroundColor = '#FFFFFF'; 
	div.style.textAlign = 'center'; div.style.fontSize = '18px'; color = '#000000';
	if(document.all){
		div.style.filter = 'alpha(opacity=80)';
	}else{
		div.style.opacity = '0.8';
		div.style.mozOpacity = '0.8';
		div.style.khtmlOpacity = '0.8';
	}
	div.innerHTML = '<div style="height:'+((alto/2)-20)+'px"></div>'+texto;
	window.scrollTo(0,0);
}

/* SITEWIDE FUNCTIONALITY */
MyBella = document.MyBella || {};



