function crearInstancia()
{
  XMLHttp = false;
  if(window.XMLHttpRequest)
  {
    return new XMLHttpRequest();
  }
  else if(window.ActiveXObject)
  {
    var versiones = ["Msxml2.XMLHTTP.7.0", "Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "Msxml2.XMLHTTP.3.0", "Msxml2.XMLHTTP.2.0", "Microsoft.XMLHTTP"];
		for(var i=0; i<versiones.length;i++)
		{
		  try
				{
				  XMLHttp = new ActiveXObject(versiones[i]);
						if(XMLHttp)
						{
						  return XMLHttp;
								break;
						}
				}
				catch(e)
				{}
		}
  }
}
function CargarDatos()
{
  XMLHttp = crearInstancia()
  if(XMLHttp)
  {
    url = "http://www.radio-oeste.com.ar/Structure.xml"
		XMLHttp.onreadystatechange=cambiaEstado
		XMLHttp.open("GET", url, true)
		XMLHttp.send(null)
  }
}
function cambiaEstado()
{
  if(XMLHttp.readyState==4)
  {
    var respuesta = XMLHttp.responseXML
		if(respuesta.documentElement.nodeName)
		{
				var salida = "";
		  xmlDatos = respuesta.getElementsByTagName("Section")
				var Pages;
				for(var c=0; c<xmlDatos.length; c++)
				{
  				  Pages = xmlDatos[c].getElementsByTagName("Page");
						
  						if(Pages.length>0)
  						{
    				  if(xmlDatos[c].getElementsByTagName("Model")[0].firstChild.nodeValue.replace(/^\s+/g,'').replace(/\s+$/g,'')=="Producto1")
    						{
      						salida += "<table cellpadding='0' cellspacing='0' class='mainW'><tr>"
      						salida += "<td class='cdaItemMenuIzq' onclick=\"if(Element.getStyle('" + xmlDatos[c].getElementsByTagName("ID")[0].firstChild.nodeValue + "', 'display')=='none'){ Effect.BlindDown('" + xmlDatos[c].getElementsByTagName("ID")[0].firstChild.nodeValue + "'); return false;}else{Effect.BlindUp('" + xmlDatos[c].getElementsByTagName("ID")[0].firstChild.nodeValue + "'); return false;}\">"
      						salida += xmlDatos[c].getElementsByTagName("Name")[0].firstChild.nodeValue
      						salida += "</td></tr><tr><td>";
      						salida += "<div style='display:none;vertical-align:top;' id='";
      						salida += xmlDatos[c].getElementsByTagName("ID")[0].firstChild.nodeValue + "'>";
      						salida += "<table cellpadding='0' cellspacing='0' border='0'>";
    						  for(var i=0; i<Pages.length; i++)
    								{
          				salida += "<tr><td class='cdaItemMenuIzqSub' onclick='document.location.href=\"";
    										salida += Pages[i].getElementsByTagName("File")[0].firstChild.nodeValue + "?PageId=" + Pages[i].getElementsByTagName("ID")[0].firstChild.nodeValue + "&SectionId=" + xmlDatos[c].getElementsByTagName("ID")[0].firstChild.nodeValue + "\"' id='" + Pages[i].getElementsByTagName("ID")[0].firstChild.nodeValue + "'>";
    										salida += Pages[i].getElementsByTagName("Name")[0].firstChild.nodeValue + "</td></tr>";
    								}
    						  salida += "</table></div></td></tr></table>";
						  }
				  }
				}
				if(!salida) salida = "<div class='cdaItemMenuIzq'>No se cargó el menu</div>";
				document.getElementById("pnlMenu").innerHTML = salida;
		}
  }
}

function SetItemSelected()
{
  var pagina_id = Request.QueryString("PageId");
  var seccion_id = Request.QueryString("SectionId");
  
/*  if(pagina_id==null)
  {
    document.location.href="http://www.yahoo.com.ar";
  }
  else
  {*/
  if(document.getElementById(pagina_id)!=null)
  {
    document.getElementById(pagina_id).className = "cdaItemMenuIzqSubOn";
    document.getElementById(seccion_id).style.display = "block";
  }
/*  else
  {
    alert("no se encontro elemento");
  }*/
//    
//    
 // }
}

