var xmlHttp
var url
var eventLink = ""
var eventText = ""
var tickerCounter = 0;
var tickerTimer = 50;
var tickerTimeout = 50;
var tickerWait = 5000;

function stateChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
		if (xmlHttp.status == 200) {
			var returnString = xmlHttp.responseText;
			returnString = returnString.split("/DATA/")
			eventLink = returnString[0];
			eventText = returnString[1];
			var e = document.getElementById("tickerLink");
			e.innerHTML = eventLink;
			eventTicker();
			e = null;
		}
	}
} 

function eventTicker() {
	var e = document.getElementById("tickerText");
	if (tickerCounter == (eventText.length)+1) {
		tickerCounter = 0;
		tickerTimeout = tickerWait;
		e.innerHTML = e.innerHTML.substring(0,(eventText.length)+6); // Remove the _
	}
	else {
		tickerTimeout = tickerTimer;
		e.innerHTML = "&nbsp;" + eventText.substring(0,tickerCounter) + "_";
	}
	tickerCounter++;
	e = null;
	window.setTimeout('eventTicker()',tickerTimeout);
}

function GetXmlHttpObject()
{ 
var objXMLHttp=null
if (window.XMLHttpRequest)
{
	objXMLHttp=new XMLHttpRequest()
}
else if (window.ActiveXObject)
{
	objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
}
return objXMLHttp
} 

function getNextEvent(){
url = "nextevent.asp?rnd="+Math.random();
xmlHttp = GetXmlHttpObject()
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function clearDefault(el) {
  if (el.defaultValue==el.value) el.value = ""
}
function openFAQ()
{
window.open('faq.asp?pid=faq', '', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=300,height=300,left = 200,top = 200');
} 
function addBookmark(pTitle) 
{
title = 'Nigel Rayment - ' + pTitle;
url = window.location;
 
	if (window.sidebar) 
	{ //Firefox
		window.sidebar.addPanel(title, url,"");
	} 
	else if( window.external ) 
	{ //IE
		window.external.AddFavorite( url, title); }
	else if(window.opera && window.print) 
	{ //Opera
		return true; 
	}
}
function emailproduct(id, product)
{<!--eval("page" + id + " = windowopen();")-->
window.open('emailproduct.asp?pid='+id+'&pName='+product, '', 'toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,resizable=0,width=500,height=345,left = 200,top = 200');
}

function HideShow(whichLayer)
{
if (document.getElementById)
{
// this is the way the standards work
var style2 = document.getElementById(whichLayer).style;
style2.display = style2.display? "":"none";
}
else if (document.all)
{
// this is the way old msie versions work
var style2 = document.all[whichLayer].style;
style2.display = style2.display? "":"none";
}
else if (document.layers)
{
// this is the way nn4 works
var style2 = document.layers[whichLayer].style;
style2.display = style2.display? "":"none";
}
}

function imagePop(url)
{
  window.name = "main";
  var newWindow
  newWindow = window.open(url,'newWin','scrollbars=auto,width=583,height=660,resizable=yes');
  newWindow.focus()
}