var Path_img_comunes="/images/";
var menu_ant="";
var menu_abierto="";

function vermenu(id,medida,id_img,img_0,img_1,sentido,top_abierto)
{
	var capa = parent.document.getElementById(id);
	var heig_act = capa.style.height;
	if (heig_act=="")
	{	heig_act=medida; }
	if (heig_act=="0px")
	{
		if (sentido==1)
			mover_menu(id,medida,medida,sentido,top_abierto);
		else
			mover_menu(id,medida);
	}
	else
	{
		if (sentido==1)
			mover_menu(id,"0px",medida,sentido,top_abierto);
		else
			mover_menu(id,"0px",medida);
	}
	
	if (id_img!=undefined && img_0!=undefined && img_1!=undefined)
	{
		//alert(document.getElementById(id_img).src);
		if (heig_act=="0px")
		{
			document.getElementById(id_img).src="." + Path_img_comunes + img_0;
		}
		else
		{
			document.getElementById(id_img).src="." + Path_img_comunes + img_1;
		}
	}
	
}

function mover_menu(id,medida,medida_abierto,sentido,top_abierto)
{
	var capa = parent.document.getElementById(id);
	var heig_act = capa.style.height;
	var medida_act = parseInt(medida.replace("px",""));
	var top_act = capa.style.top;
	if (heig_act=="")
	{	heig_act=medida_abierto; }
	
	if (top_act=="")
	{	top_act=top_abierto; }
	
	//alert(heig_act);	
	heig_act	= parseInt(heig_act.replace("px",""));
	if (sentido==1)
	{ top_act = parseInt(top_act.replace("px","")); }
		
	if (heig_act>medida_act)
	{
		heig_act = heig_act - 5;
		if (sentido==1)
		{	top_act = top_act + 5;}
		setTimeout("mover_menu('"+id+"','"+medida+"','" + medida_abierto + "','" + sentido + "','" + top_abierto + "');", 1);
	}
	else if (heig_act<medida_act)
	{
		heig_act = heig_act + 5;
		if (sentido==1)
		{	top_act = top_act - 5; }
		setTimeout("mover_menu('"+id+"','"+medida+"','" + medida_abierto + "','" + sentido + "','" + top_abierto + "');", 1);
	}

	document.getElementById(id).style.height=heig_act + "px";
	if (sentido==1)
	{	document.getElementById(id).style.top=top_act + "px"; }
}


function cge_bg_foto(img)
{
	/*var foto = "url(." + Path_img_comunes + img + ")";
	document.body.style.backgroundImage = foto;*/
	document.getElementById('fondo').src = "." + Path_img_comunes + img;
	
}

function visualizar_menu(menu,obj)
{
	if (obj!="")
	{
		obj.id="fondo_boton_sel";
	}
	//alert(menu_ant);
	if (menu_ant!="")
	{
		//alert ("antes " + menu_ant.id);
		menu_ant.id="fondo_boton";
		//alert ("despues " + menu_ant.id);
	}
	menu_ant=obj;
	/*var num_menus = 8;
	
	/*for (i=1;i<=num_menus;i++)
	{
		if (i==menu)
		{
			//document.getElementById(i).style.visibility="visible";
			
			//document.getElementById(i).style.height="20px";
			/*if(document.getElementById("menu_"+ i).name!="sel")
				document.getElementById("menu_"+ i).style.color="#ffffff";*/
		
		/*}
		else
		{
			document.getElementById(i).style.visibility="hidden";
			//document.getElementById(i).style.height="0px";
			/*if(document.getElementById("menu_"+ i).name!="sel")
				document.getElementById("menu_"+ i).style.color="#000";*/
		
		/*}	
		//alert(document.getElementById(i).style.visibility);
	}*/
}

function TamVentana() {
return (window.innerWidth === undefined) ? (document.documentElement === undefined) ? [document.getElementsByTagName('body')[0].clientWidth, document.getElementsByTagName('body')[0].clientHeight] : [document.documentElement.clientWidth, document.documentElement.clientHeight] : [window.innerWidth, window.innerHeight];
}

function colocarpie(img,img2,posicion_cuadro_texto)
{
	var tam = TamVentana().toString();
	//alert (tam);
	tam = tam.split(",");
	document.getElementById('pie').style.top= (tam[1]-50) + 'px';//80
	document.getElementById('titulo').style.top= (tam[1]-posicion_cuadro_texto) + 'px';//80
	
	if (document.getElementById('welcome2')!=null)
	{
		document.getElementById('welcome2').style.top= (tam[1]-95) + 'px';//125
	}
	if (img!="")
	{
		document.getElementById(img).style.top= (tam[1]-155) + 'px';//250
		document.getElementById(img2).style.top= (tam[1]-125) + 'px';//125
	}
	//alert(tam[1]);
}

function vermenu_prin(id,medida)
{
	if (menu_abierto!="")
	{
		mover_menu_prin(menu_abierto,"0px");
		menu_abierto="";
	}
	
	var capa = parent.document.getElementById(id);
	var heig_act = capa.style.height;
	if (heig_act=="")
	{	heig_act="0px"; }
	if (heig_act=="0px")
	{
		mover_menu_prin(id,medida);
		menu_abierto = id;
	}
	else
	{
		mover_menu_prin(id,"0px");
	}
	
}

function mover_menu_prin(id,medida)
{
	var capa = parent.document.getElementById(id);
	var heig_act = capa.style.height;
	var medida_act = parseInt(medida.replace("px",""));
	if (heig_act=="")
	{	heig_act="0px"; }
	
	//alert(heig_act);	
	heig_act	= parseInt(heig_act.replace("px",""));
		
	if (heig_act>medida_act)
	{
		heig_act = heig_act - 5;
		setTimeout("mover_menu_prin('"+id+"','"+medida+"');", 1);
	}
	else if (heig_act<medida_act)
	{
		heig_act = heig_act + 5;
		setTimeout("mover_menu_prin('"+id+"','"+medida+"');", 1);
	}

	document.getElementById(id).style.height=heig_act + "px";
}

function sel_menu(id,color)
{
	document.getElementById(id).style.color=color;
}


