////////////////////////////////////////////////// DETECCION DE NAVEGADOR ///////////////////////////////////////////////////////////////////

var isIe6=	  	( navigator.userAgent.toLowerCase().indexOf('msie 6')!=-1 );	
var isIe7=	  	( navigator.userAgent.toLowerCase().indexOf('msie 7')!=-1 );
var isIe=	  	( isIe6 || isIe7 );

///////////////////////////////////////////////////// EVENTOS DEL NAVEGADOR /////////////////////////////////////////////////////////////////

function detectarEvento(objeto, evento, funcion) {
	if(isIe){
		objeto.attachEvent("on" + evento, funcion);	
	}else{
		objeto.addEventListener(evento, funcion, false);
	}
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function centraContenido(){
	var contenedor = document.getElementById("contenedor");
	var alturaContenedor = contenedor.offsetHeight;
	var alturaWindow = contenedor.parentNode.offsetHeight;
	if(alturaContenedor < alturaWindow){
		var marginTop = parseInt((alturaWindow - alturaContenedor) / 2)+ "px"
	}else{ 
		var marginTop = '0px';
	}
	contenedor.style.marginTop = marginTop;
	document.getElementById("mascara").style.display = "none";
}
detectarEvento(window, 'load', centraContenido);
detectarEvento(window, 'resize', centraContenido);