// This code attempts to avoid hanging the browser if the server
// does not respond.

// Set a flag to check if we have gotten a connection to the server
var feed2js_ck = false;

// Delay time to check for timing out, value is in millisecods,
// so 1000 = 1 second. Try 15000 for starters
var delay_time = 15000;

// set the timer
timerID=setTimeout('feedTimeOutCheck()', delay_time);


// ---- timeout script
// Called when the time delay has passed, checks for value of 
// feed2js_ck=true  which is sent by the server script
function feedTimeOutCheck() {
	if (feed2js_ck) {
		// server has sent back an OK signal, so clear timer
		timerID = clearTimeout(timerID);
	} else {
		q = "The Feed2JS server is not responding.  Choose 'OK' to keep trying or 'Cancel' which will try and stop the browser. You may need to Reload to see the content.";

		if (confirm(q)) {
			// keep trying
			timerID=setTimeout('feedTimeOutCheck()',delay_time);
		} else {
			// cancel
			timerID = clearTimeout(timerID);
			if (navigator.appName == "Microsoft Internet Explorer") {
				// ie stop command
				document.execCommand('Stop');
			} else {
				// should work for netscape.. but others??
				window.stop();
			}
			
		}
	}
}