var IE = document.all?true:false

// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)

// Set-up to use getMouseXY function onMouseMove
document.onmousemove = getMouseXY;

var tempX = 0
var tempY = 0

// Main function to retrieve mouse x-y pos.s
function getMouseXY(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX
    tempY = e.pageY
  }  
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  
  return true
}
function desplegar_contraer(id)
{
	if(document.getElementById(id).style.display!='') document.getElementById(id).style.display='';
	else document.getElementById(id).style.display='none';
}
var selec_menu_btn_pocoyo = 0;
var selec_menu_btn_mundopocoyo = 0;
var selec_menu_btn_comunidad = 0;
var selec_menu_btn_tienda = 0;
function moveMenu_pocoyo()
{
        setTimeout('moveMenu2_pocoyo()',10);
}
function moveMenu2_pocoyo()
{
        if(selec_menu_btn_pocoyo==1 || selec_menu_btn_pocoyo==2)
        {
                var num_w = 68;
                var w_str =  '' + document.getElementById('menu_btn_pocoyo').style.width;
                var p_w_str_px = w_str.indexOf('px');
                if(p_w_str_px>=0)
                {
                        w_str = w_str.substring(0,p_w_str_px);
                }
                num_w = new Number(w_str);
                var num_x = 6;
                var x_str =  '' + document.getElementById('menu_btn_pocoyo').style.left;
                var p_x_str_px = x_str.indexOf('px');
                if(p_x_str_px>=0)
                {
                        x_str = x_str.substring(0,p_x_str_px);
                }
                num_x = new Number(x_str);
                if(selec_menu_btn_pocoyo==1 && num_w>40) num_w--;
                if(selec_menu_btn_pocoyo==2 && num_w<68) num_w++;
                if(selec_menu_btn_pocoyo==1 && num_w>40) num_x++;
                if(selec_menu_btn_pocoyo==2 && num_w<68) num_x--;
                if(num_w>40 && num_w<68) document.getElementById('menu_btn_pocoyo').style.width=num_w;
                if(num_w>40 && num_w<68) document.getElementById('menu_btn_pocoyo').style.left=num_x;
                if(num_w<=40 || num_w>=68)
                {
                        selec_menu_btn_pocoyo=0;
                }
                else
                {
                        setTimeout('moveMenu_pocoyo()',10);
                }
        }
}
function moveMenu_mundopocoyo()
{
        setTimeout('moveMenu2_mundopocoyo()',10);
}
function moveMenu2_mundopocoyo()
{
        if(selec_menu_btn_mundopocoyo==1 || selec_menu_btn_mundopocoyo==2)
        {
                var num_w = 68;
                var w_str =  '' + document.getElementById('menu_btn_mundopocoyo').style.width;
                var p_w_str_px = w_str.indexOf('px');
                if(p_w_str_px>=0)
                {
                        w_str = w_str.substring(0,p_w_str_px);
                }
                num_w = new Number(w_str);
                var num_x = 6;
                var x_str =  '' + document.getElementById('menu_btn_mundopocoyo').style.left;
                var p_x_str_px = x_str.indexOf('px');
                if(p_x_str_px>=0)
                {
                        x_str = x_str.substring(0,p_x_str_px);
                }
                num_x = new Number(x_str);
                if(selec_menu_btn_mundopocoyo==1 && num_w>40) num_w--;
                if(selec_menu_btn_mundopocoyo==2 && num_w<68) num_w++;
                if(selec_menu_btn_mundopocoyo==1 && num_w>40) num_x++;
                if(selec_menu_btn_mundopocoyo==2 && num_w<68) num_x--;
                if(num_w>40 && num_w<68) document.getElementById('menu_btn_mundopocoyo').style.width=num_w;
                if(num_w>40 && num_w<68) document.getElementById('menu_btn_mundopocoyo').style.left=num_x;
                if(num_w<=40 || num_w>=68)
                {
                        selec_menu_btn_mundopocoyo=0;
                }
                else
                {
                        setTimeout('moveMenu_mundopocoyo()',10);
                }
        }
}
function moveMenu_comunidad()
{
        setTimeout('moveMenu2_comunidad()',10);
}
function moveMenu2_comunidad()
{
        if(selec_menu_btn_comunidad==1 || selec_menu_btn_comunidad==2)
        {
                var num_w = 68;
                var w_str =  '' + document.getElementById('menu_btn_comunidad').style.width;
                var p_w_str_px = w_str.indexOf('px');
                if(p_w_str_px>=0)
                {
                        w_str = w_str.substring(0,p_w_str_px);
                }
                num_w = new Number(w_str);
                var num_x = 6;
                var x_str =  '' + document.getElementById('menu_btn_comunidad').style.left;
                var p_x_str_px = x_str.indexOf('px');
                if(p_x_str_px>=0)
                {
                        x_str = x_str.substring(0,p_x_str_px);
                }
                num_x = new Number(x_str);
                if(selec_menu_btn_comunidad==1 && num_w>40) num_w--;
                if(selec_menu_btn_comunidad==2 && num_w<68) num_w++;
                if(selec_menu_btn_comunidad==1 && num_w>40) num_x++;
                if(selec_menu_btn_comunidad==2 && num_w<68) num_x--;
                if(num_w>40 && num_w<68) document.getElementById('menu_btn_comunidad').style.width=num_w;
                if(num_w>40 && num_w<68) document.getElementById('menu_btn_comunidad').style.left=num_x;
                if(num_w<=40 || num_w>=68)
                {
                        selec_menu_btn_comunidad=0;
                }
                else
                {
                        setTimeout('moveMenu_comunidad()',10);
                }
        }
}

function moveMenu_tienda()
{
        setTimeout('moveMenu2_tienda()',10);
}
function moveMenu2_tienda()
{
        if(selec_menu_btn_tienda==1 || selec_menu_btn_tienda==2)
        {
                var num_w = 68;
                var w_str =  '' + document.getElementById('menu_btn_tienda').style.width;
                var p_w_str_px = w_str.indexOf('px');
                if(p_w_str_px>=0)
                {
                        w_str = w_str.substring(0,p_w_str_px);
                }
                num_w = new Number(w_str);
                var num_x = 6;
                var x_str =  '' + document.getElementById('menu_btn_tienda').style.left;
                var p_x_str_px = x_str.indexOf('px');
                if(p_x_str_px>=0)
                {
                        x_str = x_str.substring(0,p_x_str_px);
                }
                num_x = new Number(x_str);
                if(selec_menu_btn_tienda==1 && num_w>40) num_w--;
                if(selec_menu_btn_tienda==2 && num_w<68) num_w++;
                if(selec_menu_btn_tienda==1 && num_w>40) num_x++;
                if(selec_menu_btn_tienda==2 && num_w<68) num_x--;
                if(num_w>40 && num_w<68) document.getElementById('menu_btn_tienda').style.width=num_w;
                if(num_w>40 && num_w<68) document.getElementById('menu_btn_tienda').style.left=num_x;
                if(num_w<=40 || num_w>=68)
                {
                        selec_menu_btn_tienda=0;
                }
                else
                {
                        setTimeout('moveMenu_tienda()',10);
                }
        }
}
function flash_id(cadena)
{
	var patron = /.*\/([\w-]+)\.swf$/i;
	if (patron.test(cadena))
	{
		return (RegExp.$1);
	}
	return "PeliculaFlash";
}

function EscribeBloquePublicidadFlash(archivoswf, cadenaclicktag, ancho, alto, wmode, idflash, array_param)
{
	if (idflash == "")
	{
		idflash = flash_id(archivoswf);
	}
	if (wmode != "transparent")
	{
		wmode="opaque";
	}

	var cadena = '';
	
  if (!window.addEventListener)
	{
  
  cadena = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ' + 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" ' + 'width="' + ancho + '" height="' + alto + '" id="' + idflash + '">\n';
	cadena = cadena + '<param name="movie" value="' + archivoswf + cadenaclicktag + '" />\n'; 
	cadena = cadena + '<param name="wmode" value="' + wmode +'" />\n';
	cadena = cadena + '<param name="quality" value="high" />\n';
	cadena = cadena + '<param name="menu" value="false" />\n';
	cadena = cadena + '<param name="loop" value="false" />\n';
	cadena = cadena + '<param name="name" value="' + idflash + '" />\n';
	cadena = cadena + '<param name="id" value="' + idflash + '" />\n';
	cadena = cadena + '<param name="AllowScriptAccess" value="always" />\n';
	cadena = cadena + '<param name="flashvars" value="';
  for(var i=0;i<array_param.length;i+=2)
	  cadena = cadena + ((i==0)?'':'&')+ array_param[i] + '=' + array_param[i+1];
  cadena = cadena + '" />\n';
	cadena = cadena + '</object>\n';
  }
  else
  {
  cadena = cadena + '<embed flashvars=';
  for(var i=0;i<array_param.length;i+=2)
	  cadena = cadena + ((i==0)?'':'&')+ array_param[i] + '=' + array_param[i+1];
  cadena = cadena + ' id="' + idflash + '" loop="false" menu="false" wmode="' + wmode + '" src="' + archivoswf + cadenaclicktag + '" quality="high" menu="false" width="' + ancho + '" height="' + alto + '" name="' + idflash + '" type="application/x-shockwave-flash" ' + ' pluginspage="http://www.macromedia.com/go/getflashplayer" AllowScriptAccess="always">\n';
	cadena = cadena + '</embed>\n';
  }
	document.write(cadena);
}



