﻿function ChangeImage(obj,value)
{
	if (value)
	{
	    document.getElementById("empresa").src = "images/but01.gif";
	    document.getElementById("servicios").src = "images/but02.gif";
	    document.getElementById("productos").src = "images/but03.gif";
	    document.getElementById("referencias").src = "images/but04.gif";
	    document.getElementById("empleo").src = "images/but05.gif";
		obj.src = "images/" + obj.name + "o.gif";
	}
	else
	{
		obj.style.cursor = 'hand';
	}
}
function ClearImages()
{
    document.getElementById("empresa").src = "images/but01.gif";
    document.getElementById("servicios").src = "images/but02.gif";
    document.getElementById("productos").src = "images/but03.gif";
    document.getElementById("referencias").src = "images/but04.gif";
    document.getElementById("empleo").src = "images/but05.gif";
}

function XHConn()
{
  var xmlhttp, bComplete = false;
  try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
  catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
  catch (e) { try { xmlhttp = new XMLHttpRequest(); }
  catch (e) { xmlhttp = false; }}}
  if (!xmlhttp) return null;
  this.connect = function(sURL, sMethod, sVars, fnDone)
  {
    if (!xmlhttp) return false;
    bComplete = false;
    sMethod = sMethod.toUpperCase();

    try {
      if (sMethod == "GET")
      {
        xmlhttp.open(sMethod, sURL+"?"+sVars, true);
        sVars = "";
      }
      else
      {
        xmlhttp.open(sMethod, sURL, true);
        xmlhttp.setRequestHeader("Method", "POST "+sURL+" HTTP/1.1");
        xmlhttp.setRequestHeader("Content-Type",
          "application/x-www-form-urlencoded");
      }
      xmlhttp.onreadystatechange = function(){
        if (xmlhttp.readyState == 4 && !bComplete)
        {
          bComplete = true;
          fnDone(xmlhttp);

        }};
      xmlhttp.send(sVars);
    }
    catch(z) { return false; }
    return true;
  };
  return this;
}

function cargar_contenido(id)
{
	//document.getElementById("contenido").innerHTML = '<br /><br /><p class=\"carga\"> <img src=\"imagenes/cargando.gif\" alt=\"Cargando\" /><img src=\"imagenes/cargando.png\" alt=\"Cargando\" /></p>';
	var myConn = new XHConn();
		if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más nuevo.");
		var peticion = function (oXML) {  document.getElementById("contenido").innerHTML = oXML.responseText; };
		myConn.connect(id+".html", "GET", "", peticion);
}
function cargar_menu(id)
{
	//document.getElementById("menu").innerHTML = '<br /><br /><p class=\"carga\"> <img src=\"imagenes/cargando.gif\" alt=\"Cargando\" /><img src=\"imagenes/cargando.png\" alt=\"Cargando\" /></p>';
	var myConn = new XHConn();
		if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más nuevo.");
		var peticion = function (oXML) {  document.getElementById("menu").innerHTML = oXML.responseText; };
		myConn.connect(id+".html", "GET", "", peticion);
}
function OpenCenterPopUp(url, name, width, height)
{
	var TopLeftX=screen.width / 2 - width/2;
	var TopLeftY=screen.height / 2 - height/2;
	window.open(url,name,'top='+TopLeftY+', left='+TopLeftX+', width='+width+',height='+height+',directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=no');											
}
