<!--
// number of time you want it to pop
var test=0;
var MAXHITS = 100000;
var cookiename= "2208749";

var nHits = eval(getCookie(cookiename)); // get current count

var expdate = new Date();
expdate.setTime(expdate.getTime() +  (10 * 24 * 60 * 60 * 1000));

// setCookie
function setCookie (name, value, expires) {
        if (!expires) expires = new Date();
document.cookie = name + "=" + escape (value) + "; expires=" +
expires.toGMTString() +  "; path=/";
}

// number of page hits so far stored in cookie
nHits += 1;
setCookie(cookiename, nHits, expdate);

// getCookie
function getCookie (name) {
var dcookie = document.cookie;
var cname = name + "=";
var clen = dcookie.length;
var cbegin = 0;
while (cbegin < clen) {
 var vbegin = cbegin + cname.length;
 if (dcookie.substring(cbegin, vbegin) == cname) {
 var vend = dcookie.indexOf (";", vbegin);
 if (vend == -1) vend = clen;
 return unescape(dcookie.substring(vbegin, vend));
 }
 cbegin = dcookie.indexOf(" ", cbegin) + 1;
 if (cbegin == 0) break;
 }
return null;
}

 //** AOL
aol_checkjd='Mozilla/4.61 [en] (WinNT; I)';


var ableToPop = true;
if(aol_checkjd.indexOf("AOL") > 0) {
 ableToPop = false;
}

if (nHits > MAXHITS) {
 ableToPop = false;
}

//** browser **
bName = navigator.appName;
bVer = parseInt(navigator.appVersion);
version="n2";
if (bName == "Netscape" && bVer == 2) version = "n2";
if (bName == "Netscape" && bVer >= 3) version = "n3";
if (bName == "Microsoft Internet Explorer" && bVer >= 2) version = "e3";
if (bName == "Microsoft Internet Explorer" && bVer >= 4) version = "e4";

if ( version == "n2" || version == "e3" ) ableToPop = false;
if (navigator.appName.indexOf("WebTV") > -1 ) ableToPop=false;


if ( ableToPop )  {
 if (nHits==null) { setCookie (name, 1); var test=1;comenzar(); }
 else
 { if (nHits<=MAXHITS) {
     setCookie (name, ++nHits);
	var test=1;
    comenzar();
   }
 }
}


var ns = (document.layers)? true:false;
var ie = (document.all)? true:false;
var puntox = 0;
var puntoy = 0;
var posx;
var posy;

function mover(x,y)
{
	if (ns)
	{
		document.layers['mierda'].left = x;
		document.layers['mierda'].top = y;
	}
	else
	{
		document.all('mierda').style.posLeft = x;
		document.all('mierda').style.posTop = y;
	}
}

function destino()
{
	puntox = puntobueno(300);
	puntoy = puntobueno(2400);
}

function movimiento()
{
	if (ns)
	{
		posx = document.layers['mierda'].left ;
		posy = document.layers['mierda'].top;
	}
	else
	{
		posx = document.all('mierda').style.posLeft;
		posy = document.all('mierda').style.posTop;
	}

	auxx=posx;
	auxy=posy;	
	if ( (puntox-posx)>0 )
	{
		auxx = posx + 1;
	}
	else
	{
		if ((puntox-posx)<0)
		{
			auxx = posx - 1;
		}
	}

	if ( (puntoy-posy)>0 )
	{
		auxy = posy + 1;
	}
	else
	{
		if ((puntoy-posy)<0)
		{
			auxy = posy - 1;
		}
	}
	mover(auxx,auxy);
}
i=0;
function comenzar()
{
	if (!llegada())
    {
       movimiento();
       setTimeout('comenzar()',10);
    }
    else
    {
       destino();
       setTimeout('comenzar()',10);
    }
}	

function llegada()
{
	if ( (posx==puntox) && (posy==puntoy) )
	{
		return true;
	}
	else
	{
		return false;
	}
}

function puntobueno (coord)
{
    valido = false;
    while (!valido)
    {
	punto = parseInt(Math.random() * 1000);
    if (punto<coord)
    {
       valido = true;
    }
    }
    return punto;
}

destino();

//-->
