// JavaScript Document
var xmlHttpMenu = null;
var xmlHttpContent = null;
//var intContador = 0;
var http_request = false;
var http_login = false;
var winPopup = null;

var sessionVar = "intranet2.php"
var sessionNum = 7;

	function getXmlHttpObject()
	{
		var tmpXmlHttp=null;
		
		if (window.XMLHttpRequest){     // Firefox, Safari, ...
				tmpXmlHttp = new XMLHttpRequest(); 
		}
		else
		if (window.ActiveXObject){   // ActiveX version Internet Explorer
			   tmpXmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		return tmpXmlHttp;
	}		
	
	
	
	function calResolution()
	{
		miRegla = document.styleSheets.length
		x = screen.width
		y = screen.height
		
		if((x <= 800) && (y <= 600))
		{
			alert("normal")
		}
		else
		{
			tamHeigthIE = y*0.55
			tamHeigthFx = y*0.50
//			alert(tamHeigthIE)
			
			if (document.all)
			{
				document.styleSheets[1].addRule("#content", "height: "+tamHeigthIE+"px")
				document.styleSheets[1].addRule("#pageNav", "height: "+tamHeigthIE+"px")
	//			alert("IE:"+ miRegla);
			}
			else
			{
				document.styleSheets[1].cssRules[19].style.height = tamHeigthFx+"px"
				document.styleSheets[1].cssRules[18].style.height = tamHeigthFx+"px"
	//			alert("Firefox: "+miRegla);
			}

		}
		
		
		
		
/*
		if((x == 640) && (y == 480))
		{
			alert("Pequeñita")
		}
		else
		{
			if((screen.width == 800) && (screen.height == 600))
			{
				tamHeigthIE = "300px"
				tamHeigthFx = "260px"
				alert("Mediana")
			}
			else
			{
				if((screen.width == 1152) && (screen.height == 864))
				{
					tamHeigthIE = y*0.51
					tamHeigthFx = y*0.51
					alert(tamHeigthIE)
				}
				else
				{
					tamHeigthIE = y*0.51
					tamHeigthFx = y*0.51
					alert("DEDDE"+tamHeigthFx)
				}
				
				if (document.all)
				{
					document.styleSheets[1].addRule("#content", "height: "+tamHeigthIE+"px")
					document.styleSheets[1].addRule("#pageNav", "height: "+tamHeigthIE+"px")
//					alert("IE:"+ miRegla);
				}
				else
				{
					document.styleSheets[1].cssRules[19].style.height = tamHeigthFx+"px"
					document.styleSheets[1].cssRules[18].style.height = tamHeigthFx+"px"
//					alert("Firefox: "+miRegla);
				}
			}
		}*/
		getContent('inicio.php','1')
	}
	
	
	
	function getContent(content, subMenu){
		xmlHttpMenu = null;
		xmlHttpContent = null;
		xmlHttpMenu= getXmlHttpObject();
		xmlHttpContent = getXmlHttpObject();
		if ((xmlHttpMenu == null)||(xmlHttpContent == null)){
			alert("Browser does not support HTTP Request")
			return
		}		
		var url = ""; 
		var url2 = "";
		url="subMenus.php?q="+subMenu;
		xmlHttpMenu.onreadystatechange=SetContent; 
		xmlHttpMenu.open("GET",url,true);
		xmlHttpMenu.send(null);

		url2 = content;
		xmlHttpContent.onreadystatechange = SetContent;
		xmlHttpContent.open("GET",url2,true)			
		xmlHttpContent.send(null);		
		MM_showHideLayers('subMenu'+subMenu,'','hide','cierre','','show')
		if ((subMenu == 7) || (subMenu == "7_1"))
		{
			sessionVar = content;
			sessionNum = subMenu;
		}
	}

	function SetContent()
	{
		if(xmlHttpContent.readyState == 4)
			{
				document.getElementById("destiny").innerHTML = "" + xmlHttpContent.responseText;
			}
		if(xmlHttpMenu.readyState == 4)
			{
				document.getElementById("dest1").innerHTML = "" + xmlHttpMenu.responseText;	
			}
	}
		
	function sombreado(obj, status) 
	{
		obj.style.backgroundColor = (1 == status) ? '#EEEEEE' : '#FFFFFF';
		return;
	}

	function OpenWin(URL)
	{
	   winURL = window.open(URL)
	}
	
	function OpenFile(URL, ventana, tam, type)
	{
	   propWin = "width=700px, height=500px, scrollbars=NO, top=100%, left=110%, resizable=" + tam;
	   winFile = window.open(URL, ventana, propWin)
	}

	function OpenPopup(URL, ventana, name)
	{
		nameB = name;
		urlWin = URL+"?p="+name
  	    winPopup = window.open(urlWin, ventana, "width=420px, height=325px, top=120%, left=300%, scrollbars = yes")
		winPopup.focus();
	}
	
	function closePopup()
	{		
		if(winPopup && !winPopup.closed){
			winPopup.close();
		}
	}
