AC_FL_RunContent = 0;

opacidad=0;
fadeando=false;

var url='avisoLegal.html';
var xmlHttpAvisoLegal = null;
var primera=true;

function abrirAviso(){
	if(isMinIE7 || isMoz){
		abrirAvisoCompliant();
	}else if(isIE){
		abrirAvisoIE6();
	}else{
		try{
			abrirAvisoCompliant();
		}catch(error1){
			try{
				abrirAvisoIE6();
			}catch(error2){
				alert('Su navegador no es compatible con los estandares, por favor utilize un navegador compatible estándares o redirija manualmente a "http://localhost:8080/WEBRC/avisoLegal.html" para ver la información legal');
			}
		}
	}
}

function abrirAvisoIE6(){
	var izquierda=document.getElementById('contenedorPrincipal').offsetLeft;
	var popup=window.open("popAvisoLegal.html","miVentana", "width=800,height=600,toolbar=no,directories=no,menubar=no,status=yes,scrollbars=yes");
	eje_x=(window.screen.availWidth)/2-400;
	eje_y=(window.screen.availHeight)/2-300;
	popup.moveTo(eje_x,eje_y);
}

function abrirAvisoCompliant(){
	if (primera) {
		cargarAvisoLegal();
		primera=false;
	}
	if (!fadeando) {
		if (document.getElementById('mascara')) {
			oMascara = document.getElementById('mascara');
			oMascara.style.display='block';
		}
		oDiv = document.getElementById('avisoLegal');
		oDiv.style.display = 'block';
		fadeando = true;
		fadeIn();
	}
}

function getXmlHttpObject(){
	var xmlHttp = null;
	try{
		xmlHttp = new XMLHttpRequest();
	}catch (e){
		try{
			xmlHttp = new ActiveXObject('Msxml2.XMLHTTP');
		}catch (e2) {
			xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');
		}
	}
	return xmlHttp;
}

function avisoLegalChanged(){ 
	if (xmlHttpAvisoLegal.readyState == 4){
		document.getElementById('avisoLegal').innerHTML += xmlHttpAvisoLegal.responseText;
	}
}

function cargarAvisoLegal() {
	xmlHttpAvisoLegal = getXmlHttpObject();
	if (xmlHttpAvisoLegal == null) {
		alert ('Error: Su navegador no soperta AJAX');
		return;
	}
	xmlHttpAvisoLegal.onreadystatechange=avisoLegalChanged;
	xmlHttpAvisoLegal.open('GET',url,true);
	xmlHttpAvisoLegal.send(null);
}

function cerrarAviso(){
	if(isMinIE7 || isMoz){
		cerrarAvisoCompliant();
	}else{
		cerrarAvisoIE6();
	}
}

function cerrarAvisoCompliant(){
	if (!fadeando) {
		oDiv.display = '';
		oMascara.style.display='none';
		fadeando = true;
		fadeOut();
	}
}

function cerrarAvisoIE6(){
	window.close();
}

function fadeOut(){
	if (opacidad > 1) {
		opacidad-=5;
		setOpacity(oDiv, opacidad);
		setTimeout('fadeOut(oDiv),opacidad',1);
	}
	else{
		oDiv.style.display='none';
		fadeando=false;
	}
}

function fadeIn(){
	if (opacidad < 99) {
		opacidad+=5;
		setOpacity(oDiv, opacidad);
		setTimeout('fadeIn(oDiv),opacidad',1);
	}
	else{
		opacidad=100;
		setOpacity(oDiv, opacidad);
		fadeando=false;
	}
}

function setOpacity(obj, opacity) {
	opacity = (opacity == 100)?99.999:opacity;
	obj.style.filter = "alpha(opacity:"+opacity+")";
	obj.style.KHTMLOpacity = opacity/100;
	obj.style.MozOpacity = opacity/100;
	obj.style.opacity = opacity/100;
}

var sUserAgent = navigator.userAgent;
var fAppVersion = parseFloat(navigator.appVersion);

function compareVersions(sVersion1, sVersion2) {
	var aVersion1 = sVersion1.split(".");
	var aVersion2 = sVersion2.split(".");
	if (aVersion1.length > aVersion2.length) {
		for (var i=0; i < aVersion1.length - aVersion2.length; i++) {
			aVersion2.push("0");
		}
	} else if (aVersion1.length < aVersion2.length) {
		for (var i=0; i < aVersion2.length - aVersion1.length; i++) {
			aVersion1.push("0");
		}
	}

	for (var i=0; i < aVersion1.length; i++) {
		if (aVersion1[i] < aVersion2[i]) {
			return -1;
		} else if (aVersion1[i] > aVersion2[i]) {
			return 1;
		}
	}

	return 0;
}

var isOpera = sUserAgent.indexOf("Opera") > -1;
var isKHTML = sUserAgent.indexOf("KHTML") > -1 || sUserAgent.indexOf("Konqueror") > -1 || sUserAgent.indexOf("AppleWebKit") > -1; 

if (isKHTML) {
	isSafari = sUserAgent.indexOf("AppleWebKit") > -1;
	isKonq = sUserAgent.indexOf("Konqueror") > -1;
}

var isIE = sUserAgent.indexOf("compatible") > -1 && sUserAgent.indexOf("MSIE") > -1 && !isOpera;

var isMinIE4 = isMinIE5 = isMinIE5_5 = isMinIE6 = isMinIE7 = false;

if (isIE) {
	var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
	reIE.test(sUserAgent);
	var fIEVersion = parseFloat(RegExp["$1"]);
	isMinIE4 = fIEVersion >= 4;
	isMinIE5 = fIEVersion >= 5;
	isMinIE5_5 = fIEVersion >= 5.5;
	isMinIE6 = fIEVersion >= 6.0;
	isMinIE7 = fIEVersion >= 7;
}

var isMoz = sUserAgent.indexOf("Gecko") > -1 && !isKHTML;
var isNS4 = !isIE && !isOpera && !isMoz && !isKHTML && (sUserAgent.indexOf("Mozilla") == 0) 
			&& (navigator.appName == "Netscape") && (fAppVersion >= 4.0 && fAppVersion < 5.0);

var isWin = (navigator.platform == "Win32") || (navigator.platform == "Windows");
var isMac = (navigator.platform == "Mac68K") || (navigator.platform == "MacPPC") || (navigator.platform == "Macintosh");

var isUnix = (navigator.platform == "X11") && !isWin && !isMac;
