var cliente = navigator.userAgent.toLowerCase();
var SO,navegador,version,total,lacadena;


function cliente() {
	if ( comprobar('konqueror')) {
		navegador = "Konqueror";
		SO = "Linux";
	}
	else if ( comprobar('safari')) navegador 	= "Safari"
	else if ( comprobar('omniweb')) navegador 	= "OmniWeb"
	else if ( comprobar('opera')) navegador 	= "Opera"
	else if ( comprobar('webtv')) navegador 	= "WebTV";
	else if ( comprobar('icab')) navegador 		= "iCab"
	else if ( comprobar('msie')) navegador 		= "Internet Explorer"
	else if (! comprobar('compatible')) {
		navegador = "Netscape Navigator"
		version = cliente.charAt(8);
	}
	else navegador = "An unknown navegador";

	if (!version) version = cliente.charAt(place + lacadena.length);

	if (!SO) {
		if ( comprobar('linux')) 	SO 	= "Linux";
		else if ( comprobar('x11')) SO 	= "Unix";
		else if ( comprobar('mac')) SO 	= "Mac"
		else if ( comprobar('win')) SO 	= "Windows"
		else SO 								= "an unknown operating system";
	}
}

function  comprobar(cadena) {
	indice = cliente.indexOf(cadena) + 1;
	lacadena = cadena;
	return indice;
}

var yPos = 0;

function mostrarCapaCondiciones() {
	
	getScroll();
	if (comprobar('msie 6')){
		
		prepararIE("100%", "visible");
		document.getElementById('desactivar').style["height"] = screen.availHeight;
		document.getElementById('desactivar').style["width"] = screen.availWidth-25;
		setScroll(0, 0);
		hideSelects("hidden");
	}
	visibilidadCapas("block");
}

function ocultarCapaCondiciones() {
	
	setScroll(0, yPos);
	if (comprobar('msie 6')){
		prepararIE("auto", "auto");
		hideSelects("visible");
	}
	visibilidadCapas("none");

}

function visibilidadCapas(opcion){
	document.getElementById('desactivar').style["display"] = opcion;
	document.getElementById('caja').style["display"] = opcion;
}
function getScroll(){
	if (self.pageYOffset) {
		yPos = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){
		yPos = document.documentElement.scrollTop; 
	} else if (document.body) {
		yPos = document.body.scrollTop;
	}
}

function setScroll(x, y){
	window.scrollTo(x, y); 
}

function prepararIE(height, overflow){
	bod = document.getElementsByTagName('body')[0];
	bod.style.height = height;
	bod.style.overflow = overflow;

	htm = document.getElementsByTagName('html')[0];
	htm.style.height = height;
	htm.style.overflow = overflow; 
}

function hideSelects(visibility){
	selects = document.getElementsByTagName('select');
	for(i = 0; i < selects.length; i++) {
		selects[i].style.visibility = visibility;
	}
}

