var hmURL = "http://www.esmas.com/";
var cmURL = "http://www.esmascompras.com/";
var imgURL = "http://i.esmas.com/img/univ/portal/headerv3/";
var he = ".esmasHdr_";
var ff = "font-family: Arial, Helvetica, sans-serif;";
var tc = 'cellspacing="0" cellpadding="0" border="0"';
var isCentered = false;




var nav = new Array(
		"head_nav_dep.gif",hmURL+"deportes/",
		"head_nav_fut.gif",hmURL+"deportes/futbol/",
		"head_nav_esp.gif",hmURL+"espectaculos/",
		"head_nav_cine.gif",hmURL+"espectaculos/cine/",
		"head_nav_nov.gif",hmURL+"espectaculos/telenovelas/",
		"head_nav_not.gif",hmURL+"noticierostelevisa/",
		"head_nav_nin.gif",hmURL+"ninos/",
		"head_nav_muj.gif",hmURL+"mujer/",
		"head_nav_sal.gif",hmURL+"salud",
		"head_nav_emp.gif","http://esmas2006.occ.com.mx"
);




var serv = new Array(
		"head_ico_tarabu.gif",hmURL+"musica/",
		"head_ico_tv.gif","http://www.tarabu.com/MicWeb/EsmasTv/es_home_cplayer.aspx",
		"head_ico_player_2.gif","http://www.esmasplayer.com/",
		"head_ico_guiatv.gif",hmURL+"espectaculos/canalestv/",
		"head_ico_gyygs.gif","javascript:NewWindow('http://gyggs.com/','nosettings')",
		"head_ico_movil.gif","javascript:NewWindow('"+hmURL+"movil/','nosettings')"
);


var upBnr2 = false;
function comprasvs(forma){
	if(forma.esearch.value == ""){
		alert("Por favor introduce por lo menos una  palabra");
		return false;
	}
	if (forma.meta[2].checked == true){
		forma.action = "http://www.esmascompras.com/pesquisa/pesquisa.asp";
		forma.palavra.value = escape(forma.esearch.value);
		return true;
	}
	else {
		return true;
	}
}
function writeSmallDate(){
	monthNames = new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");theDate = new Date();document.write(monthNames[theDate.getMonth()] +" " + theDate.getDate() + ", "  + theDate.getFullYear());
}
function makeHomePage(caller) { 
	var agt=navigator.userAgent.toLowerCase(); 
	if ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1)) {
		caller.style.behavior='url(#default#homepage)'; 
		caller.setHomePage(caller);
	} 
}


function writeHeader (logIzq, logDer, site, canal, subcanal, url1, url2, cent, upBnr, ssl) {
	(ssl != null)?imgURL="https://login.esmas.com/img/univ/portal/headerv3/":ssl2=false;
	(upBnr != null)?upBnr2=upBnr:upBnr2=false;
	(cent != null)?isCentered=true:isCentered=false;
	(logIzq != "")?logI=logIzq:logI=imgURL+"portal/gris/head_l_esmasgrd.gif";(url1 != "")?URL1=url1:URL1=hmURL;
	(logDer != "")?logD=logDer:logD=imgURL+"spacer.gif";(url2 != "")?URL2=url2:URL2='';
	
	out = '';
	out += '<style>';
	out += '	'+he+'Search { color: #3A3A3A; font-size: 9px; '+ff+' letter-spacing: 1px; vertical-align: middle; text-align: left; width: 40px;}';
	out += '	'+he+'SearchText { color: #3A3A3A; font-size: 9px; '+ff+' border: thin groove; border-bottom: thin groove; width: 145px;}';
	out += '	'+he+'Icon { width: 52px; align: center; }';
	out += '	'+he+'Fecha{ color: #FFFFFF; font-size: 9px; font-family : Verdana, Arial, Helvetica; font-weight: bold;}';
	out += '	'+he+'reg2,'+he+'reg2:visited{'+ff+' color : #FFFFFF; font-size : 9px; text-decoration:none;letter-spacing: 1px;}';
	out += '	'+he+'reg2:hover{'+ff+' color : #FFFFFF; font-size : 9px; text-decoration:none;letter-spacing: 1px;}';
	out += '</style>';
	out += '<table bgcolor="#FFFFFF" '+tc+' width="750px">';
	out += '	<tr><td width="5px"><img src="'+imgURL+'spacer.gif" width="5" height="5" alt="" border="0"></td>';
	out += '		<td width="130px" align="left"><a href="'+URL1+'"><img src="'+imgURL+'head_l_esmas.gif" width="98" height="83" alt="" border="0"></a></td>';
	out += '		<td valign="middle">';
	out += '			<table '+tc+' align="center">';
	out += '					<tr><td>';
	out += '						<table height="62px" align="center"><tr>';
	for(i=0;i<serv.length;i++){
		out += '<td><a href="' + serv[i+1] + '">';
		out += '<img src="'+imgURL+serv[i]+'" border="0">';
		out += '</a></td>';
		i++;
		if(i<(serv.length-1))
			out += '<td width="25"><img src="'+imgURL+'spacer.gif" width="25" height="5" alt="" border="0"></td>';
	};
	out += '							</tr>';
	out += '						</table>';
	out += '					</td></tr>';
	out += '					<tr><td align="center">';
	out += '						<table height="30px" '+tc+' align="center">';
	out += '							<tr>';
	out += '								<form action="http://buscador.esmas.com/esmasr.php" method="post" onsubmit="return comprasvs(this);" name="esmas_search">';
	out += '								<td width="5px"<img src="'+imgURL+'spacer.gif" width="1" height="1" alt="" border="0"></td>';
	out += '								<td width="10px"><input type="Radio" name="tipo" value="0"></td>';
	out += '								<td class="esmasHdr_Search">internet</td>';
	out += '								<td width="10px"><input type="Radio" name="tipo" value="1" checked></td>';
	out += '								<td class="esmasHdr_Search">esmas</td>';
	out += '								<td width="150px"><input type="Text" name="esearch" class="esmasHdr_SearchText"></td>';
	out += '								<td width="60px"><input type="image" src="'+imgURL+'head_bt_buscar.gif" width="57" height="21" alt="" border="0"></td>';
	out += '								</form>';
	out += '								<td width="75px" valign="middle" align="right"><img src="'+imgURL+'head_l_google.gif" width="75" height="25" alt="" border="0"></td>';
	if(logDer == ""){
	out += '								<td width="415" align="right">';
	out += '									<table '+tc+'>';
	out += '										<tr><td align="right"><a href="'+hmURL+'mapadesitio/"><img src="'+imgURL+'head_bt_mapa.gif" width="72" height="7" alt="" border="0"></a></td></tr>';
	out += '										<tr><td align="right"><img src="'+imgURL+'spacer.gif" width="1" height="2" alt="" border="0"></td></tr>';
	if((typeof(plecas)=="undefined")||(typeof(plecas['paginicio']) == "undefined")||(plecas['paginicio'][0]==''))
		out += '<tr><td align="right"><a href="#" onclick="makeHomePage(this)"><img src="'+imgURL+'head_bt_paginainicio.gif" width="161" height="10" alt="" border="0"></a></td></tr>';
	else{
		out += '<tr><td align="right"><a href="#" onclick="makeHomePage(this)"><img src="'+plecas['paginicio'][0]+'" width="161" height="10" alt="" border="0"></a></td></tr>';
	}
	out += '									</table>';
	out += '								</td>';
	hdr_columnas = '4';
	}else{
		hdr_columnas='5';
	}
	out += '								<td width="5px"><img src="'+imgURL+'spacer.gif" width="1" height="2" alt="" border="0"></td>';
	out += '							</tr>';
	out += '						</table>';
	out += '					</td></tr>';
	out += '				</table>';
	out += '			</td>';
	if(logDer != "") out += '<td width="125" align="center"><a href='+URL2+'><img src="'+logD+'" alt="" border="0"></a></td>';
	out += '			<td width="5px"><img src="'+imgURL+'spacer.gif" width="5" height="1" alt="" border="0"></td>';
	out += '		</tr>';
	out += '		<tr>';
	out += '			<td colspan="'+hdr_columnas+'">';
	out += '				<table '+tc+'>';
	out += '					<tr >';
	out += '						<td width="5px"><img src="'+imgURL+'spacer.gif" width="5" height="1" alt="" border="0"></td>';
	out += '						<td background="'+imgURL+'head_back_fecha.gif" width="130" height="23" style="padding-right: 5px;" align="center"><font class="esmasHdr_Fecha"><scr'+'ipt>writeSmallDate();</scr'+'ipt></font></td>';
	menu = 1;
	for(i=0;i<nav.length;i++){
		out += '<td><a href="' + nav[i+1] + '">';
		out += '<img src="'+imgURL+ nav[i] +'" alt="" border="0" ';
		if(typeof( window['arMenu'+menu] ) != "undefined"){
			out += 'onMouseOver="subir(' + (menu) + ')" onMouseOut="bajar(' + (menu) + ')"';
		}
		out += '></a></td>';
		i++;menu++;
	}
	out += '						<td width="5px"><img src="'+imgURL+'spacer.gif" width="5" height="1" alt="" border="0"></td>';
	out += '					</tr>';
	out += '				</table>';
	out += '			</td>';
	out += '		</tr>';
	out += '		<tr><td colspan="'+hdr_columnas+'" height="5"><img src="'+imgURL+'spacer.gif" width="1" height="5" alt="" border="0"></td></tr>';
	out += '	</table>';
	document.write(out);
}





var arMenu1 = new Array(
		"140","211",
		"Blogs","http://blogs.esmas.com/deportes/",
		"Beisbol",hmURL+"deportes/beisbol/",
		"Estadísticas MLB","http://sef.esmas.com/sedep/flat/tor44/torneo.php?src=275",
		"Basquetbol",hmURL+"deportes/basquetbol/",
		"Estadísticas NBA","http://sef.esmas.com/sedep/flat/tor38/torneo.php?src=185",
		"Futbol Americano",hmURL+"deportes/futbolamericano/",
		"Mundo Deportivo",hmURL+"deportes/otrosdeportes/",
		"Club América",hmURL+"clubamerica/",
		"Selección Mexicana",hmURL+"seleccionmexicana/",
		"Biografías",hmURL+"deportes/biografias/",
		"Fotogalería",hmURL+"deportes/fotogaleria/",
		"TV a la carta","http://www.esmastv.com.mx",
		"Pregúntale a los Brizio",hmURL+"losbrizio/"
);




var arMenu2 = new Array(
		"208","211",
		"Futbol México",hmURL+"deportes/futbol/",
		"Futbol Internacional",hmURL+"deportes/futbolinternacional/",
		"Estadísticas",hmURL+"sef/futbol/",
		"Club América",hmURL+"clubamerica/",
		"Selección Mexicana",hmURL+"seleccionmexicana/",
		"Pregúntale a los Brizio",hmURL+"losbrizio/"
);




var arMenu3 = new Array(
		"261","211",
		"Cine",hmURL+"espectaculos/cine/",
		"Blogs","http://blogs.esmas.com/espectaculos/",
		"Música/Tarabu",hmURL+"musica/",
		"Fotogalería",hmURL+"espectaculos/fotogaleria/",
		"TV a la carta","http://www.esmastv.com.mx",
		"Biografías",hmURL+"espectaculos/artistas/",
		"Guía de TV",hmURL+"espectaculos/canalestv/",
		"Programas de TV",hmURL+"espectaculos/programastv/",
		"Películas",hmURL+"espectaculos/cine/peliculas/",
		"Revistas",hmURL+"revistas"
);




var arMenu4 = new Array(
		"340","211",
		"Blogs","http://blogs.esmas.com/espectaculos/?cat=2",
		"Películas",hmURL+"espectaculos/cine/peliculas/",
		"Trailers","http://www.esmastv.com.mx/",
		"Fotogalerías",hmURL+"espectaculos/fotogaleria/",
		"Biografías",hmURL+"espectaculos/artistas/"
);




var arMenu5 = new Array(
		"395","211",
		"Blogs","http://blogs.esmas.com/espectaculos/?cat=5",
		"Destilando Amor",hmURL+"destilandoamor/",
		"Yo amo a Juan Querendón",hmURL+"yoamoajuanquerendon/",
		"Bajo las Riendas del Amor",hmURL+"bajolasriendasdelamor/",
		"Lola. Érase una vez",hmURL+"lolaeraseunavez/",
		"Muchachitas como tú",hmURL+"muchachitascomotu/",
		"La Madrastra",hmURL+"lamadrastra/",
		"La Fea Más Bella",hmURL+"lafeamasbella",
		"Rebelde",hmURL+"rebelde/",
		"Más telenovelas",hmURL+"telenovelas/"
);




var arMenu6 = new Array(
		"475","211",
		"México",hmURL+"noticierostelevisa/mexico/",
		"Internacionales",hmURL+"noticierostelevisa/internacionales/",
		"Conductores",hmURL+"noticierostelevisa/conductores/",
		"Biografías",hmURL+"noticierostelevisa/biografias/",
		"Fotogalería",hmURL+"noticierostelevisa/fotogaleria/",
		"TV en vivo y a la carta","http://www.esmastv.com.mx/"
);




var arMenu7 = new Array(
		"550","211",
		"Biografías",hmURL+"ninos/biografias/",
		"Burbujas",hmURL+"burbujas/",
		"Chabelo","http://www.chabelo.com/",
		"El Chavo del Ocho",hmURL+"elchavodel8/",
		"Juegos",hmURL+"ninos",
		"Tareas","http://ninos.esmas.com/divertitareas/",
		"Tienda","javascript:NewWindow('http://esmas.prml.com.mx/esmas/catalogo/dsp_store.cfm?StoreID=122','nosettings')"
);




var arMenu8 = new Array(
		"590","211",
		"Sexo y Amor",hmURL+"mujer/sexoyamor/",
		"Belleza y Moda",hmURL+"mujer/belleza/",
		"Dietas y Ejercicios",hmURL+"mujer/saludable/",
		"Mamá y Bebé",hmURL+"mujer/mamaybebe/",
		"Recetas de Cocina",hmURL+"mujer/cocina/",
		"Blog Mujer","http://blogs.esmas.com/mujer/",
		"Fotogalerías",hmURL+"mujer/fotogaleria/",
		"Tests",hmURL+"mujer/interactiva/483338.html",
		"Horóscopos",hmURL+"horoscopos/",
		"Kamasutra","javascript:openVideoGal('"+hmURL+"mujer/galerias/3818/')",
		"Autoexplórate","javascript:NewWindow('/mujer/interactiva/exploracion/','exploracion','610','430','no')"
);

var cuantosSubMenus = 10;
var ie=(document.all);
var ns=(document.layers);
var ns6=(document.getElementById&&!document.all);
if(document.location.href.indexOf("https")>-1){imgURL="https://login.esmas.com/img/univ/";}

for (a=1; a<cuantosSubMenus+1; a++) {
	if(typeof(window['arMenu'+a]) != "undefined"){
		contenidoMenu=eval("arMenu"+a);
		d=0;
		c='<table '+tc+' width="120"><tr><td><img src="'+imgURL+'head_lay_back.gif" width="120" height="1"></td></tr>';
		for(b=2;b<contenidoMenu.length;b++){
			c+='<tr><td align="left" bgcolor="#81898B" height="17" onMouseOut="mOut2(this,\'#81898B\');" onMouseOver="mOvr2(this,\'#81898B\');" onClick="mClk2(this);" style="padding-left:7px;padding-right:2px"><a href="'+contenidoMenu[b+1]+'" class="esmasHdr_reg2">'+contenidoMenu[b]+'</a></td></tr>';		
			(b<contenidoMenu.length-3)?c+='<tr><td background="'+imgURL+'head_lay_dots.gif" bgcolor="#7093C1"><img src="'+imgURL+'spacer.gif" height=1 width=1 ></td></tr>':c+='';
			b++;
		}
		c+='<tr><td><img src="'+imgURL+'head_lay_back.gif" width="120" height="1"></td></tr></table>';
		if (ie||ns6){
			document.write('<div id="menu_ie'+a+'" style="position:absolute;left:'+contenidoMenu[0]+'px;top:'+ contenidoMenu[1] +'px;visibility:hidden" onMouseOver="entroAlLayer()" onMouseOut="salioDelLayer()">'+c+'</div>');
		}
		if(ns){
			document.write('<layer left="'+contenidoMenu[0]+'" top="'+ contenidoMenu[1] +'" visibility="hide" onMouseOver="entroAlLayer()" onMouseOut="salioDelLayer()" id="menu_ns'+a+'">'+c+'</layer>');
		}
	}
}		

estaSobreSubMenu = 0;
menuArriba = 1;
timeID1 = setTimeout("bajarSubMenus()", 1);
timeID2 = setTimeout("bajarSubMenus()", 1);

function entroAlLayer(){
	estaSobreSubMenu = 1;
	clearTimeout(timeID1);
	clearTimeout(timeID2);
}
function salioDelLayer(){
	estaSobreSubMenu = 0;
	timeID1 = setTimeout("bajarSubMenus()", 100);
}
function bajarSubMenus(rollover){
	for (a=1;a<cuantosSubMenus+1;a++)
	{
		if(typeof(window['arMenu'+a]) != "undefined"){
			if (ie){
				menu = eval('document.all.menu_ie'+a);
				menu.style.visibility='hidden';
			}
			if(ns){
				menu = eval('document.menu_ns'+a);
				menu.visibility='hide';
			}
			if (ns6){
				menu = eval(document.getElementById('menu_ie'+a));
				menu.style.visibility='hidden';
			}
		}
	}
}
function subir(queMenu){
	clearTimeout(timeID2);
	bajarSubMenus();
	if (ie){
		menu = eval('document.all.menu_ie'+queMenu);
		var contenidoMenu=eval("arMenu" + queMenu);
		if(isCentered){
			var winW = Math.round((document.body.offsetWidth-750)/2);
			(winW<0)?winW=0:winW-=15;
			(contenidoMenu[0])?posx = parseInt(contenidoMenu[0]) + winW:posx = winW;
			menu.style.left= posx + 'px';
		}	
		if(!upBnr2){if(contenidoMenu[1] != null){menu.style.top= (parseInt(contenidoMenu[1])-94) + 'px';}}
		menu.style.visibility='visible';
	}
	if(ns){
		menu = eval('document.menu_ns'+queMenu);
		menu.visibility='show';
	}
	if(ns6){
		menu = eval(document.getElementById('menu_ie'+queMenu));
		contenidoMenu=eval("arMenu"+queMenu);
		if(isCentered){
			winW = Math.round((window.innerWidth-750)/2);
			(winW<0)?winW=0:winW-=15;
			(contenidoMenu[0])?posx = parseInt(contenidoMenu[0]) + winW:posx = winW;
			menu.style.left=posx+'px';
		}
		if(!upBnr2){if(contenidoMenu[1] != null){menu.style.top= (parseInt(contenidoMenu[1])-89) + 'px';}}
		menu.style.visibility="visible";
	}
}
function bajar(queMenu){
	timeID2 = setTimeout("bajarSubMenus()", 100);
	menuArriba = queMenu;
}
function mOvr2(src,clrOver) {
if (!src.contains(event.fromElement)) {
		src.style.cursor = 'hand';
		src.bgColor = clrOver;
	}
}
function mOut2(src,clrIn) {
if (!src.contains(event.toElement)) {
		src.style.cursor = 'default';
		src.bgColor = clrIn;
	}
}
function mClk2(src){
	src.children.tags('A')[0].click();
}