function NewWindow(mypage,myname,w,h,scroll)
{
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable=no'
	
	if(myname!="nosettings")
	{		
        	win = window.open(mypage,myname,settings)
	}
	else 
	{
		win = window.open(mypage,myname)
     }        
}

function writeBanner(sit,chn,sub,w,h,pos)
{
	var bnrTxt = "";
	
	bnrTxt = "";
	bnrTxt += '	<IFRAME WIDTH="' + w + '" HEIGHT="' + h + '" MARGINWIDTH="0" MARGINHEIGHT="0" ';
	bnrTxt += 'HSPACE="0" VSPACE="0" FRAMEBORDER="0" SCROLLING="no" BORDERCOLOR="#000000" ';
	bnrTxt += 'SRC="http://ads.esmas.com/html.ng/site=' + sit + '&canal=' + chn + '&subcanal=' + sub + '&adsize=' + w + 'x' + h + '&tile=' + pos + '">';
	bnrTxt += '	<SCR' + 'IPT language="JavaScript1.1" ';
	bnrTxt += '		SRC="http://ads.esmas.com/js.ng/Params.richmedia=yes&site=' + sit + '&canal=' + chn + '&subcanal=' + sub + '&adsize=' + w + 'x' + h + '&tile=' + pos + '">';
	bnrTxt += '	</SCR' + 'IPT>';
	bnrTxt += '	</IFRAME>';
	
	document.write(bnrTxt);
}


var mostrarBM="no";
var mostrarBM2="si";

function bannerM()
{	
	out='';
	if(mostrarBM=="si")
	{

		out+='<tr><td><script>writeBanner("esmas","movilmx","","120","600","10");</script></td></tr>';
	}
	
	else
	{
	
		out+='<tr><td bgcolor="#000000" width="180" height="398"><img src="http://www.esmas.com/movil/usa/img_barra/spacer.gif" width="121" height="398"></td></tr>';
	
	}
	
	document.write(out);
}




function bannerM2()
{	
	out='';
	if(mostrarBM2=="si")
	{
		out+='<tr><td><script>writeBanner("esmas","esmasmovil","","180","100","6");</script></td></tr>';
		out+='<tr><td><img src="http://www.esmas.com/movil/usa/img_barra/spacer.gif" width="120" height="2"</td></tr>';
		out+='<tr><td><script>writeBanner("esmas","esmasmovil","","180","100","7");</script></td></tr>';
		out+='<tr><td><img src="http://www.esmas.com/movil/usa/img_barra/spacer.gif" width="120" height="2"</td></tr>';
		out+='<tr><td><script>writeBanner("esmas","esmasmovil","","180","100","8");</script></td></tr>';
		out+='<tr><td><img src="http://www.esmas.com/movil/usa/img_barra/spacer.gif" width="120" height="2"</td></tr>';
		out+='<tr><td><script>writeBanner("esmas","esmasmovil","","180","100","9");</script></td></tr>';
		out+='<tr><td><img src="http://www.esmas.com/movil/usa/img_barra/spacer.gif" width="120" height="2"</td></tr>';
		out+='<tr><td><script>writeBanner("esmas","esmasmovil","","180","100","10");</script></td></tr>';
		/*out+='<tr><td><img src="http://www.esmas.com/movil/usa/img_barra/spacer.gif" width="120" height="5"</td></tr>';
		out+='<tr><td><script>writeBanner("esmas","esmasmovil","","120","111","6");</script></td></tr>';*/
	
	}
	
	else
	{
	
		out+='<tr><td bgcolor="#000000" width="120" height="600"><img src="http://www.esmas.com/movil/usa/img_barra/spacer.gif" width="120" height="600"></td></tr>';
	
	}
	
	document.write(out);
}



function compatibilidades()
{
	ventana1 = window.open('http://latam-web.buongiorno.com/mex/searcher/ua_esmas/ua_index.html?idCountry=mx', 'ventana1', 'scrollbars=no, location=no, directories=no, resizable=no, status=no, toolbar=no, menubar=no, width=770, height=475');
    ventana1.focus();
}



function Tonos_Esmas(n)
{
	if(n==1)
	{
    	parent.location.href="http://latam-web.buongiorno.com/mex/searcher/searcherParserV2.html?CustomerID=esmas3&XSLfile=tonre_ini.xsl&nextPage=index2.html&DefaultXMLfile=../xml_am/web/Esmas.xml&Country=mex&codigo=tt_"
	}

	if(n==2)
	{
    	parent.location.href="http://mexw.buongiorno.com/mex/pmsdata.html?target=web_esmas_usa/web/monf_ini_html&SM_ALIASCATEGORY=mn_top,mn_new"
	}
	
	if(n==3)
	{
    	parent.location.href="http://mexw.buongiorno.com/mex/pmsdata.html?target=web_esmas_usa/web/poli_ini.html&SM_ALIASCATEGORY=pl_top,pl_new"
	}
	
	if(n==4)
	{
    	parent.location.href="http://mexw.buongiorno.com/mex/pmsdata.html?target=web_esmas_usa/web/real_ini_html&SM_ALIASCATEGORY=sx_top,sx_new"
	}
	if(n==5)
	{
		parent.location.href="http://mexw.buongiorno.com/mex/pmsdata.html?target=web_esmas_usa/web/real_ini_html&SM_ALIASCATEGORY=sx_top_att,sx_new_att"
	}
	if(n==6)
	{
		parent.location.href="http://mexw.buongiorno.com/mex/pmsdata.html?target=web_esmas_usa/web/poli_ini.html&SM_ALIASCATEGORY=pl_top_att,pl_new_att"
	}



}

function Promociones_Esmas(n)
{

	parent.location.href="http://www2.esmas.com/movil/mex/promociones.php"
	
	homeURL = "http://www.esmas.com/cosmosfiles/html/portal/"; 
	window.open(homeURL + 'pop_promociones.html','_det','width=350,height=440'); 

}

function Salvapantallas_Esmas(n)
{

	if(n==1)
	{
    	parent.location.href="http://mexw.buongiorno.com/mex/pmsdata.html?target=web_esmas_usa/web/salva_ini.html&SM_ALIASCATEGORY=wp_top,wp_new"
	}
	
	if(n==2)
	{
    	parent.location.href="http://mexw.buongiorno.com/mex/pmsdata.html?target=web_esmas_usa/web/anima_ini_html&SM_ALIASCATEGORY=an_top,an_new"
	}
	
	if(n==3)
	{
    	parent.location.href="http://mexw.buongiorno.com/mex/pmsdata.html?target=web_esmas_usa/web/nomcolor_ini_html&SM_ALIASCATEGORY=wn_top,wn_new"
	}

	if(n==4)
	{
    	parent.location.href="http://mexw.buongiorno.com/mex/pmsdata.html?target=web_esmas_int/web/fondos_ini_html&SM_ALIASCATEGORY=ps_top,ps_new"
	}
	
	if(n==5)
	{
    	parent.location.href="http://mexw.buongiorno.com/mex/pmsdata.html?target=web_esmas_int/web/logos_ini_html&SM_ALIASCATEGORY=ls_top,ls_new"
	}
	if(n==6)
	{
    	parent.location.href="http://mexw.buongiorno.com/mex/pmsdata.html?target=web_esmas_usa/web/salva_ini.html&SM_ALIASCATEGORY=wp_top_att,wp_new_att"
	}
	
}


function Juegos_Esmas(n)
{

	if(n==1)
	{
    	parent.location.href="http://mexw.buongiorno.com/mex/pmsdata.html?target=web_esmas_usa/web/juegos_ini_html&SM_ALIASCATEGORY=jg_top,jg_new"
	}
	if(n==2)
	{
    	parent.location.href="http://mexw.buongiorno.com/mex/pmsdata.html?target=web_esmas_usa/web/juegos_ini_html&SM_ALIASCATEGORY=jg_top_att,jg_new_att"
	}

}


function Esmas(n)
{

		if(n==1)
		{
			parent.location.href="http://carnalitos.esmas.com"
		
		}
		
}



var height = 23; // height of the menu headers
var iheight =20; // height of the menu_items

var bgc = "black" // background color of the item
var tc = "white" // text color of the item

var over_bgc = "silver";
var over_tc = "white";

var speed = 0;
var timerID = "";
var N = (document.all) ? 0 : 1;
var width = 165
var self_menu = new Array();

function write_menu()
{


 	smc = 0; // count the position of the self_menu
 	document.write("<div style='position:relative;clear:both;' align='justify'>");
  	mn = 0;
  	mni = 1;
  	start = -1;

  	for(i=0;i<Link.length;i++) 
	{
  		la = Link[i].split("|");
  		if (la[0] == "0") 
		{
   			 if(start == 0) 
			 {
		      document.write("</div>");
		      h =  csmc * iheight * 1.1;
		      tmn = mn; //-h
		      self_menu[smc] = new Array(tmn,h,0,-2);
		      smc++;
		      mn--;
		     }
    		 csmc = 0;
	 		if(la[1]!="Tonos")
		    {
				document.write("<br><div class='menu' style='top:"+mn+";height:"+height+"' id='down"+smc+"' onclick='pull_down("+smc+","+mni+")'>&nbsp;&nbsp;"+ la[1] +"<br><img src='http://www.esmas.com/movil/1024/plecas_1024/spacer_gris.gif' width='165' height='1'></div>");
			}
			else
			{
				document.write("<br><div class='menu' style='top:"+mn+";height:"+height+"' id='down"+smc+"' onclick='pull_down("+smc+","+mni+")'>&nbsp;&nbsp;"+ la[1] +"&nbsp;&nbsp<img src='http://www.esmas.com/movil/usa/esmas_milventicuatro/tarabu_navizq_sinespacio.gif' width='57' height='13'><br><img src='http://www.esmas.com/movil/1024/plecas_1024/spacer_gris.gif' width='165' height='1'></div>");
			}
		    //document.write("<br><div class='menu' style='top:"+mn+";height:"+height+"' id='down"+smc+"' onclick='pull_down("+smc+","+mni+")'>&nbsp;&nbsp;"+ la[1] +"<br><img src='http://www.esmas.com/movil/usa/plecas_1024/spacer_gris.gif' width='165' height='1'></div>");
		    self_menu[smc] = new Array(mn,height,0,mni);
		    smc++;
		    mni++;
		    mn+=height;
		    start = 1;
   		} 
   
   		else
   		if (la[0] == "2") 
		{
    		if(start == 0) 
			{
     		 document.write("</div>");
		      h =  csmc * iheight * 1.1;
		      tmn = mn; //-h
		      self_menu[smc] = new Array(tmn,h,0,-2);
		      smc++;
		      mn--;
		    }
     		csmc = 0;
		    document.write("<a href="+ la[2] +" style='text-decoration:none'><div class='menu' style='top:"+mn+";height:"+height+"' id='down"+smc+"'>&nbsp;&nbsp;"+ la[1] +"<br><img src='http://www.esmas.com/movil/usa/plecas_1024/spacer_gris.gif' width='165' height='1' border='0'></div></a>");
  			self_menu[smc] = new Array(mn,height,0,mni);
		    smc++;
		    mni++;
		    mn+=height;
		    start = 1;
 		}
   
   
   
	   	else
	    if (la[0] == "3") 
		{
		    if(start == 0) 
			{
		      document.write("</div>");
		      h =  csmc * iheight * 1.1;
		      tmn = mn; //-h
		      self_menu[smc] = new Array(tmn,h,0,-2);
		      smc++;
		      mn--;
		    }
		    csmc = 0;
		    document.write("<div class='menu2' style='top:"+mn+";height:"+height+"' id='down"+smc+"'><img src='http://www.esmas.com/movil/usa/plecas_1024/pleca_secciones_1024.gif' width='165' height='26'  border='0'></div>");
		    self_menu[smc] = new Array(mn,height,0,mni);
		    smc++;
		    mni++;
		    mn+=height;
		    start = 1;
	   }
   
	   else
	   if (la[0] == "4") 
	   {
		    if(start == 0) 
			{
		      document.write("</div>");
		      h =  csmc * iheight * 1.1;
		      tmn = mn; //-h
		      self_menu[smc] = new Array(tmn,h,0,-2);
		      smc++;
		      mn--;
		    }
		    csmc = 0;
		    document.write("<div class='menu2' style='top:"+mn+";height:"+height+"' id='down"+smc+"'><img src='http://www.esmas.com/movil/usa/plecas_1024/pleca_soporte_1024.gif' width='165' height='26'  border='0'></div>");
		    self_menu[smc] = new Array(mn,height,0,mni);
		    smc++;
		    mni++;
		    mn+=height;
		    start = 1;
	   }
   
   
    
	    else
	    if (la[0] == "5") 
		{
		    if(start == 0) 
			{
		      document.write("</div>");
		      h =  csmc * iheight * 1.1;
		      tmn = mn; //-h
		      self_menu[smc] = new Array(tmn,h,0,-2);
		      smc++;
		      mn--;
		    }
		    csmc = 0;
		    document.write("<div class='menu2' style='top:"+mn+";height:"+height+"' id='down"+smc+"'><img src='http://www.esmas.com/movil/usa/img_barra/spacer.gif' width='1' height='5'><br><img src='http://www.esmas.com/movil/usa/img_barra/pleca_encuesta.gif' width='120' height='25'><br>&iquest;Pregunta?<br><input name='radiobutton' type='radio' value='radiobutton'>Respuesta 1<br><input name='radiobutton' type='radio' value='radiobutton'>Respuesta 2<br><input name='radiobutton' type='radio' value='radiobutton'>Respuesta 3<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='image' src='http://www.esmas.com/movil/usa/img_barra/btn_votar.gif' name='votar'></div>");
		    self_menu[smc] = new Array(mn,height,0,mni);
		    smc++;
		    mni++;
		    mn+=height;
		    start = 1;
	   }
   
	   else
	   if (la[0] == "6") 
	   {
		    if(start == 0) 
			{
		      document.write("</div>");
		      h =  csmc * iheight * 1.1;
		      tmn = mn; //-h
		      self_menu[smc] = new Array(tmn,h,0,-2);
		      smc++;
		      mn--;
		     }
		    csmc = 0;
		    document.write("<a href="+ la[2] +" style=text-decoration:none'><div class='menu' style='top:"+mn+";height:"+height+"' id='down"+smc+"'>&bull;&nbsp;&nbsp;"+ la[1] +"<br><img src='http://www.esmas.com/movil/usa/img_barra/puntitos_navizq.gif' width='120' height='1'  border='0'></div></a>");
		    self_menu[smc] = new Array(mn,height,0,mni);
		    smc++;
		    mni++;
		    mn+=height;
		    start = 1;
	   }
   
       else
	    if (la[0] == "8")
		{
		    if(start == 0) 
			{
		      document.write("</div>");
		      h =  csmc * iheight * 1.1;
		      tmn = mn; //-h
		      self_menu[smc] = new Array(tmn,h,0,-2);
		      smc++;
		      mn--;
		    }
		    csmc = 0;
		    document.write("<a href="+ la[2] +" style=text-decoration:none'><div class='menu' style='top:"+mn+";height:"+height+"' id='down"+smc+"'>&bull;&nbsp;&nbsp;"+ la[1] +"</div></a>");
		    self_menu[smc] = new Array(mn,height,0,mni);
		    smc++;
		    mni++;
		    mn+=height;
		    start = 1;
	   }
   
   
   
	   else 
	   {
		    if(start == 1) 
			{
		      if(N)mn+=2;
		       document.write("<div class='item_panel' id='down"+smc+"' style='top:"+mn+"'>");
		       start = 0;
		     }
		
		    document.write("<a href='"+la[2]+"'");
		    if (la[3] != "") document.write(" target='" + la[3] + "' ");
		    document.write("><div class='item' id='d"+i+"' align='left' style='height:"+iheight);
		    if (N) document.write(";width:132");
		    document.write("' onmouseover='color(this.id)' onmouseout='uncolor(this.id)'>"+ la[1] + "</div></a>");
		    csmc++;
	   }
   }
   if (start == 0)
   {
     document.write("</div>");
     h =  csmc * iheight;
     tmn = mn + 5; //-h
     self_menu[smc] = new Array(tmn,h,0);
     name = "down" + (self_menu.length-1);
     obj = document.getElementById(name);
   
   }
   document.write("</div>");
 

}

function color(obj) {
 document.getElementById(obj).style.backgroundColor = over_bgc;
 document.getElementById(obj).style.color = over_tc
}

function uncolor(obj) {
 document.getElementById(obj).style.backgroundColor = bgc;

}

function pull_down(nr,c) 
{
	 if (timerID == "") 
	 {
		 to = self_menu[nr+1][1]
		 begin = nr + 2;
		 if (timerID != "") clearTimeout(timerID);
		 if (self_menu[nr+1][2] == 0) 
		 {
		  self_menu[nr+1][2] = 1;
		  if(nr == self_menu.length-2) {to++;}
		  epull_down(begin,to,0);
	     } 
		 else
		 {
			  to = 0;
			  self_menu[nr+1][2] = 0;
			  name = "down"+(nr+2);
			  open_item = 0;
			  for(i=0;i<nr;i++)
			  {
				   if(self_menu[i][2] == 1)
				    {open_item += self_menu[i][1];
				    }
			  }
			  if (N == false) {open_item-= (c*1)};
			  if (nr== self_menu.length-2) {val = self_menu[self_menu.length-1][1];to=-1;}
			  else  val = parseInt(document.getElementById(name).style.top) -(open_item)-(c*height*1.04);
			  epull_up(begin,to,val);
		  }
	  }
}

function epull_down(nr,to,nowv)
{
	 name = "down" + (nr-1);
	 obj = document.getElementById(name).style.clip = "rect(0,"+width+","+(nowv+1)+",0)";
	 for (i=nr;i<self_menu.length;i++) 
	 {
	  name = "down" + i;
	  obj = document.getElementById(name);
	  obj.style.top = parseInt(obj.style.top)+1;
	 }
	 nowv++;
	 if(nowv < to) timerID = setTimeout("epull_down("+nr+","+to+","+nowv+")",speed);
	 else timerID = ""; 
}

function epull_up(nr,to,nowv) 
{
	 name = "down" + (nr-1);
	 obj = document.getElementById(name).style.clip = "rect(0,"+width+","+nowv+",0)";
	 for (i=nr;i<self_menu.length;i++)
	 {
	  name = "down" + i;
	  obj = document.getElementById(name);
	  obj.style.top = parseInt(obj.style.top)-1;
	 }
	 nowv--;
	 if(nowv > to) timerID = setTimeout("epull_up("+nr+","+to+","+nowv+")",speed);
	 else timerID = "";
}

function startup(nr) 
{
	 write_menu();
	 if (nr != 0) 
	 {
		 for(i=0;i<self_menu.length;i++)
		 {
		  if(self_menu[i][3] == nr) pull_down(i,nr)
		  i==self_menu.length;
		 }
	 }
}



var Link = new Array();
  Link[0] = "3|||";
  Link[1] = "2|Home Móvil|http://www.esmas.com/movil/usa/index.html|";
 // Link[2] = "2|Futbol|http://www.esmas.com/movil/usa/home_futbol.html|";
//  Link[3] = "2|Deportes|http://www.esmas.com/movil/usa/home_deportes.html|";
  Link[2] = "2|Mizada|http://www.esmas.com/movil/usa/home_mizada.html|";
  
  Link[3] = "0|Tonos|";
  Link[4] = "1|Tonos Monofónicos|javascript:Tonos_Esmas(2);|";
  Link[5] = "1|Tonos Polifónicos|javascript:Tonos_Esmas(3);|";
  //Link[6] = "1|Contenido exclusivo AT&T|javascript:Tonos_Esmas(6);|";
  Link[6] = "2|Sonidos Reales|javascript:Tonos_Esmas(4);|";
  //Link[8] = "2|Sonidos Reales AT&T|javascript:Tonos_Esmas(5);|";
  Link[7] = "0|Imágenes|javascript:Salvapantallas_Esmas(1);|";
  Link[8] = "1|Salvapantallas|javascript:Salvapantallas_Esmas(1);|";
  Link[9] = "1|Animaciones|javascript:Salvapantallas_Esmas(2);|";
  Link[10] = "1|Logonombres|javascript:Salvapantallas_Esmas(3);|";
 // Link[13] = "1|Contenido exclusivo AT&T|javascript:Salvapantallas_Esmas(6);|";
  Link[11] = "0|Hotnews|";  
  Link[12] = "1|Amor y Pareja|http://www.esmas.com/movil/usa/servicios_hn_ayp.html|";
  Link[13] = "1|Estilo de Vida|http://www.esmas.com/movil/usa/servicios_hn_est.html|";
  Link[14] = "1|Esotéricos|http://www.esmas.com/movil/usa/servicios_hn_eso.html|"; 
  Link[15] = "1|Humor|http://www.esmas.com/movil/usa/servicios_hn_hum.html|"; 
  Link[16] = "0|Diversión|";  
  Link[17] = "1|Amor y Pareja|http://www.esmas.com/movil/usa/servicios_dv_ayp.html|";
  Link[18] = "1|Estilo de Vida|http://www.esmas.com/movil/usa/servicios_dv_est.html|";
  Link[19] = "1|Esotéricos|http://www.esmas.com/movil/usa/servicios_dv_eso.html|";  
  Link[20] = "1|Humor|http://www.esmas.com/movil/usa/servicios_dv_hum.html|";  
 // Link[24] = "1|Información/Noticias|http://www.esmas.com/movil/usa/servicios_dv_inf.html|";  
  Link[21] = "2|Juegos|javascript:Juegos_Esmas(1);|"; 
  //Link[25]= "2|Juegos AT&T|javascript:Juegos_Esmas(2);|";
  Link[22] = "4|||";
  //Link[24] = "2|Instrucciones|http://www.esmas.com/movil/usa/home_instrucciones.html|";
  Link[23] = "2|Compatibilidades|javascript:compatibilidades();|";
  Link[24] = "2|Ayuda|http://www.esmas.com/movil/usa/home_ayuda.html|";
  Link[25] = "2|Otros Países|http://www2.esmas.com/movil/intropais.php|";
  

