function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

function adsPosition(position,adsWidth, adsHeight) {
	var topOffset;
	var leftOffset;
	if(position.toLowerCase().indexOf("up") >= 0) {
		topOffset = document.body.scrollTop + 20;
	} else if(position.toLowerCase().indexOf("down") >= 0) {
		topOffset = document.body.scrollTop+document.body.offsetHeight - (adsHeight + 30);
	} else {
		xMoveToE(position,parseInt((document.body.offsetWidth)/2) - 450,1);
		return false;
	}
	
	if(position.toLowerCase().indexOf("left") > 0) {
		leftOffset=document.body.scrollLeft + 10;
	} else if(position.toLowerCase().indexOf("right") > 0) {
		leftOffset=document.body.scrollLeft+document.body.offsetWidth - (adsWidth+30);
	} else {
		
	}
	eval(position + ".style.top=" + topOffset);
	eval(position + ".style.left=" + leftOffset);
	setTimeout("adsPosition('" + position + "'," + adsWidth + "," + adsHeight + ");",50);
}

function pushAds(adsUrl, adsSrc, adsWidth, adsHeight,position) {
	MM_reloadPage(true);
	if(adsSrc.substring(adsSrc.lastIndexOf(".") + 1) != "swf") {
		document.write("<div id=" + position + " style='position: absolute;width:" + (adsWidth + 10) + ";top:0;left:0;visibility: visible;z-index: 0'><a href='" + adsUrl + "' target = '_blank'><img src='" + adsSrc + "' WIDTH='" + adsWidth + "' HEIGHT='" + adsHeight + "'  border = 0></a></div>");
	} else {
		document.write("<div id=" + position + " style='position: absolute;width:" + (adsWidth + 10) + ";top:0;left:0;visibility: visible;z-index: 0'><EMBED src='" + adsSrc + "' quality=high  WIDTH='" + adsWidth + "' HEIGHT='" + adsHeight + "' TYPE='application/x-shockwave-flash'></EMBED></div>");
	}
	adsPosition(position,adsWidth,adsHeight);
}

function xMoveToE(layerName,currentX,lastDirc){
	if (currentX >= parseInt((document.body.offsetWidth)/2) + 300)	{
		lastDirc=-1;
	}
	if (currentX <= parseInt((document.body.offsetWidth)/2) - 450) {
		lastDirc=1;
	}
	currentX=currentX+lastDirc*4
	eval("document.all." + layerName + ".style.left=" + currentX);
	eval("document.all." + layerName + ".style.top=document.body.scrollTop+300")
	setTimeout("xMoveToE('" + layerName + "'," + currentX + "," + lastDirc + ");",10)
}