	var running   = false;
	var timeoutId = null;
	var url       = "";
	var refresh   = 1;
	var minimumRefresh = 30;
	var rCount=0;

    var reloadseconds=0;
    var secondssinceloaded=0;

    var dc=true;

	starttime=new Date();
	starttime=starttime.getTime();

	function viewPage()
	{
		running = true;
		refresh = document.getElementById("refreshid").value;

		minimumRefresh = 30;

		if ( (document.getElementById("urlid")).value == "" )
		{
			alert("Please enter a web address.");
			return;
		}

		url     = document.getElementById("urlid").value;

		if ( url.indexOf( 'http://' ) == -1 )
		{
			url = "http://" + url;
		}

		if ( url.indexOf( 'lazywebtools' ) != -1 )
		{
			alert("You may not use the refresher with this site.");
			return;
		}

		if ( url.indexOf( 'lfs.net' ) != -1 )
		{
			alert("You may not use the refresher with this site.");
			return;
		}

		if ( url.indexOf( 'lfsforum' ) != -1 )
		{
			alert("You may not use the refresher with this site.");
			return;
		}

		if ( url.indexOf( 'ebay' ) != -1 )
		{
			minimumRefresh = 1;
		}

		if ( url.indexOf( 'worldtalklive' ) != -1 )
		{
			minimumRefresh = 1;
		}

		if ( url.indexOf( 'bbbutton' ) != -1 )
		{
			minimumRefresh = 1;
		}

		if ( url.indexOf( 'ticketmaster' ) != -1 )
		{
			minimumRefresh = 1;
		}

		if ( url.indexOf( 'finance.yahoo' ) != -1 )
		{
			minimumRefresh = 5;
		}

		if ( url.indexOf( 'gaia' ) != -1 )
		{
			minimumRefresh = 5;
		}

		if ( url.indexOf( 'brainfuse' ) != -1 )
		{
			minimumRefresh = 1;
		}

		if ( url.indexOf( 'app-mlas-02' ) != -1 )
		{
			minimumRefresh = 1;
		}		

		if ( url.indexOf( 'majorfm' ) != -1 )
		{
			alert("You may not use the refresher with this site.");
			stop();
			return;
		}

		if ( url.indexOf( 'satradiodot' ) != -1 )
		{
			alert("You may not use the refresher with this site.");
			stop();
			return;
		}

		if ( url.indexOf( 'liddell' ) != -1 )
		{
			alert("You may not use the refresher with this site.");
			stop();
			return;
		}

		if ( url.indexOf( 'onebillionpageviews' ) != -1 )
		{
			alert("You may not use the refresher with this site.");
			stop();
			return;
		}
		
		if ( url.indexOf( '1billionpageviews' ) != -1 )
		{
			alert("You may not use the refresher with this site.");
			stop();
			return;
		}

		if ( refresh == "" || refresh < minimumRefresh )
		{
			alert("The refresh rate must be at least " + minimumRefresh + " seconds.");
			stop();
			return;
		}

		var answer = confirm("This page refresher must not be used for malicious purposes.\nLazyWebTools is not responsible for the use of this tool.\nPlease note that when using this tool it is still YOUR IP address that hits the target site.\nBy hitting OK you can continue to use the tool and you agree that you are not using this tool for malicious purposes.\n\nContinue?")
		if (!answer)
		{
			stop();
			return;
		}


        displayCountdown();

    	starttime=new Date();
	    starttime=starttime.getTime();
		top.window.frames["main"].location.href = url;
		timeoutId = setTimeout( "changePage()", 1000 );		
	}

	function displayCountdown()
	{
		dc = document.getElementById("dc").checked;
	}

	function changePage()
	{
		if ( running )
		{
			rCount++;
	        nowtime= new Date();
	        nowtime=nowtime.getTime();
	        secondssinceloaded=(nowtime-starttime)/1000;
	        reloadseconds=Math.round(refresh-secondssinceloaded);
			var s="s";
			if (refresh>=secondssinceloaded)
			{
				if (dc)
				{
					if (reloadseconds == 1) s="";				
					window.status="Running...page will refresh in "+reloadseconds+ " second" + s;
				}
				else
				{
					window.status="";
				}
			}
			else
			{
				clearTimeout(timeoutId);
				if (rCount == 10 )
				{
					top.window.frames['ads'].location.href = "ads.html";
					rCount = 0;
				}
				top.window.frames['main'].location.href = url;
			    
		        starttime=new Date();
			    starttime=starttime.getTime();
			}
			timeoutId = setTimeout("changePage()",1000);		
		}
	}

	function stop()
	{
		if ( running )
		{
			running = false;
			clearTimeout( timeoutId );
			window.status="Refreshing stopped.";
		}
	}
