// ======================================================
//detarminaContexto script - Julio Cedeño
//Realizar el llamado de una imagen según el subsitio en
//que se encuentra. Si no existe menú para ese subsitio
//recorre hacia arriba en los padres hasta encontrar un
//menú para mostrarlo
// ======================================================
function determinaFlash(idDiv,swfRuta,swfDefault,swfId,swfW,swfH)
{

	var swflash = "/"+swfRuta+"/"+swfDefault+".swf";
	swflash = determinaExistente(swfRuta,swfId,"swf",swflash);
	texto  = "<object type='application/x-shockwave-flash' data='"+swflash+"' width='"+swfW+"' height='"+swfH+"'>";
	texto += "<param name='movie' value='"+swflash+"'/>";
	texto += "<param name='bgcolor' value='FFFFFF'/>";
	texto += "<param name='wmode' value='transparent' />";
	texto += "</object>";

	idDiv.innerHTML = texto;
}


function determinaImage(idDiv,imgRuta,imgDefault,imgExt,imgId,imgW,imgH)
{
	var imgFile = "/"+imgRuta+"/"+imgDefault+"."+imgExt;
	imgFile = determinaExistente(imgRuta,imgId,imgExt,imgFile);
	document.getElementById(idDiv).innerHTML = "<img src='"+imgFile+"' border='0' />";
}

function determinaMenu(idDiv,menuConfig)
{
	menuFile = determinaExistente("js","","js","");
	menuFile = "<script type='text/javascript' src='"+menuFile+"' language='JavaScript1.2'></script>"
	document.getElementById(idDiv).innerHTML = menuFile;
}


function incluirMenuLi(idDiv)
{
	if (document.location.href.split('/').length > 4)
	{
		menuFile = determinaExistente("js","","htm","/js/generico.htm");
		if(menuFile !="")
		{
			loadSync(menuFile);
			document.getElementById(idDiv).innerHTML = xmlstr;
		}
		else
		{
			document.getElementById(idDiv).style.display = 'none';
		}
	}
}

function determinaExistente(fRuta,fId,ext,fDefault)
{
	var partes = document.location.href.split('/');
	for(i=partes.length-1;i>=0;i--)
	{
		if(HASObject.fileExist("/"+fRuta+"/"+fId+partes[i]+"."+ext))
		{
			return "/"+fRuta+"/"+fId+partes[i]+"."+ext;
		}
	}
	return fDefault;
}
