// JavaScript Document

function fitBG(){

	//frm1.ancho.value=screen.width;
	//frm1.alto.value=screen.height;
	
	switch((screen.width / screen.height)){
	
		case (3/2):
			document.body.className="body32";
			break;;
			
		case (4/3):
			document.body.className="body43";
			break;;
		
		case (5/4):
			document.body.className="body54";
			break;;
			
		case (14/9):
			document.body.className="body149";
			break;;
		
		case (16/9):
			document.body.className="body169";
			break;;
			
		case (16/10):
			document.body.className="body1610";
			break;;
			
		default:
			document.body.className="BODYNA";
			break;;
		
	}

	setIEBackground();
	
	fitBottomMenu();
	
	document.body.onresize = fitBottomMenu;
	
}

function fitBottomMenu(){

	var obj = document.getElementById('BottomMenuContainer');
		
	if (document.documentElement.clientHeight > (620 + 170)){ 
		obj.style.height = String(document.documentElement.clientHeight - 620 - 10) + 'px';
	}
	else{
		obj.style.height = '170px';
	}

	var obj2 = document.getElementById('cuerpo');
	
	if ( document.documentElement.clientWidth < 1024 ){
		obj2.style.left = '10px';
		obj2.style.marginLeft = '5px';
		
		obj.style.left = '10px';
		obj.style.marginLeft = '5px';
		
	}
	else{
		obj2.style.left = '50%';
		obj2.style.marginLeft = '-512px';
		
		obj.style.left = '50%';
		obj.style.marginLeft = '-512px';
		
	}

}

function setIEBackground(){

	if(navigator.appName == 'Microsoft Internet Explorer'){

		if( parseInt(navigator.appVersion.substr(navigator.appVersion.indexOf('MSIE')+5,1)) < 9 ){
	
			var obj = document.getElementById('contenido');		
			if(obj){
				obj.style.backgroundColor = 'transparent';		
				obj.style.backgroundImage = 'url(../Imagenes/bgIE/bgIE.png)';
				obj.style.backgroundRepeat = 'no-repeat';
			}
			
			var obj2 = document.getElementById('menuContainer');
			if(obj2){
				obj2.style.backgroundColor = 'transparent';
				obj2.style.backgroundImage = 'url(../Imagenes/bgIE/bgIEm.png)';
				obj2.style.backgroundRepeat = 'no-repeat';
			}
			
			var obj3 = document.getElementById('ContenidoResto3');
			if(obj3){
				obj3.style.backgroundColor = 'transparent';
				obj3.style.backgroundImage = 'url(../Imagenes/bgIE/bgIEtxt.png)';
				obj3.style.border = '0px';
				obj3.style.backgroundRepeat = 'no-repeat';
			}
			
			var obj4 = document.getElementById('slider');
			if(obj4){
				obj4.style.backgroundColor = 'transparent';
				obj4.style.backgroundImage = 'url(../Imagenes/bgIE/bgIEsl.png)';
				obj4.style.backgroundRepeat = 'no-repeat';
				obj4.style.border = '0px';
			}
			
			var obj5 = document.getElementById('ContenidoResto2');
			if(obj5){
				obj5.style.backgroundColor = 'transparent';
				obj5.style.backgroundImage = 'url(../Imagenes/bgIE/bgIEtxt53.png)';
				obj5.style.backgroundRepeat = 'no-repeat';
				obj5.style.border = '0px';
			}
			
			var obj6 = document.getElementById('ContenidoFlash');
			if(obj6){
				obj6.style.backgroundColor = 'transparent';
				obj6.style.backgroundImage = 'url(../Imagenes/bgIE/bgIEsl33.png)';
				obj6.style.backgroundRepeat = 'no-repeat';
				obj6.style.border = '0px';
			}
			
			var obj7 = document.getElementById('ContenidoPrin');		
			if(obj7){
				obj7.style.backgroundColor = 'transparent';
				obj7.style.backgroundImage = 'url(../Imagenes/bgIE/bgIEcprin.png)';
				obj7.style.backgroundRepeat = 'no-repeat';
				obj7.style.border = '0px';
			}
			
			var obj8 = document.getElementById('ContenidoResto');		
			if(obj8){
				obj8.style.backgroundColor = 'transparent';
				obj8.style.backgroundImage = 'url(../Imagenes/bgIE/bgIEresto.png)';
				obj8.style.backgroundRepeat = 'no-repeat';
				obj8.style.border = '0px';
			}
			
			var obj9 = document.getElementById('imgContenidoFlashDown');		
			if(obj9){
				obj9.style.marginTop = '-325px';
			}
			
			if( parseInt(navigator.appVersion.substr(navigator.appVersion.indexOf('MSIE')+5,1)) < 8 ){
			
				var obj10 = document.getElementById('BPRStyles');
				obj10.href='../styles/bprIE7.css';
						
			}
		
	    }		
		
				
	}


}
