 // vars and function to reload page if window is resized in Navigator
	
	var isNS;
	var isIE;
	var isGecko;

	if (document.getElementById) {
		isGecko = true;
	}
	
	if (parseInt(navigator.appVersion) >= 4) {
		if (navigator.appName == "Netscape") {
   		  if (navigator.appVersion.indexOf(4.08) < 0) {
            isNS = true;        		
		  }
		} else if (document.all) {
		  isIE = true; 
		} 
	}   
	
	function resizeHandler () {
		location.reload()
		return false	
	}
	
	if(isNS) {
		window.captureEvents(Event.RESIZE)
		window.onresize = resizeHandler;
	}
	

   
	
function pageInit() {


// in case JSNavIdArray and JSNavStylesArray don't exist
// i.e. full page security gateway
if (!window.JSNavIdArray || !window.JSNavStylesArray) {
	return;
}

var isRightNav = false;

// highlight current section in main menu
/*
if (isIE) {

for (i=0; i<JSNavStylesArray.length; i++) {
	if (JSNavStyle == JSNavStylesArray[i]) {
		isRightNav = true;
	}
}

if (isRightNav) {
	for (i=0; i<JSNavIdArray.length; i++) {
		if (JSNavIdArray[i] == SecondLevel) {
			var whichClass = eval("sidenav" + SecondLevel + ".className");
			var whichPos = whichClass.lastIndexOf("Off");
			var newClass = whichClass.substring(0,whichPos);
			// catch if mouse still in menu cell
			if (whichPos == -1) { 
				whichPos = whichClass.lastIndexOf("On");
			}	
			eval("sidenav" + SecondLevel + ".onmouseover = ''");
			eval("sidenav" + SecondLevel + ".onmouseout = ''");
			eval("sidenav" + SecondLevel + ".className = '" + newClass + "On'");
			}
		}
	}
}
*/

if (document.getElementById) {

for (i=0; i<JSNavStylesArray.length; i++) {
	if (JSNavStyle == JSNavStylesArray[i]) {
		isRightNav = true;
	}
}

if (isRightNav) {
	for (i=0; i<JSNavIdArray.length; i++) {
		if (JSNavIdArray[i] == SecondLevel) {
		
			var whichClass = eval("document.getElementById(\"sidenav" + SecondLevel + "\").className");
			var whichPos = whichClass.lastIndexOf("Off");
			// if mouse still in the cell then class is "On"
			if (whichPos == -1) {
				whichPos = whichClass.lastIndexOf("On");
			}	
			var newClass = whichClass.substring(0,whichPos);
			
			eval("document.getElementById(\"sidenav" + SecondLevel + "\").onmouseover = ''");
			eval("document.getElementById(\"sidenav" + SecondLevel + "\").onmouseout = ''");
			eval("document.getElementById(\"sidenav" + SecondLevel + "\").className = '" + newClass + "On'");

			}
		}
	}
}

}

// custom function for Barnsley and Motherwell to make the site the home page
// link to custom reg file

function homepage(whichsite){

var sitename = whichsite.toLowerCase();

if(isIE) {
		if(navigator.userAgent.indexOf("Win")>-1) {
 alert("To make " +  whichsite + " FC you home page\r\rclick 'OK'\rselect 'Open this file from its current location'\rin the dialog box that pops up\r\rthen click 'OK' again.");location.href="/vsite/static/files/" + sitename + "/" + sitename + "fc.reg";
		} 
	else if(navigator.userAgent.indexOf("Mac")>-1) {
 alert("To make " + whichsite + " FC your homepage Ctrl+Click the page background\rand choose 'Set Home Page' from the popup menu (Internet Explorer Only)");
		}
		
} else {
 alert("Unfortunately, the home page cannot be set automatically.\r\rIf you are using Netscape Navigator please chose\r'Navigator' from Edit > Preferences\rcheck the Home Page button\rand enter http://www." + sitename + "fc.co.uk/\rin the Home Page location box");
	}

}

// function to change styles in the page in IE only

function changeStyleOn(linkId,styleClass) {
if (document.all) {
var changestyle = "document.all." + linkId + ".className = '" + styleClass + "On'";
eval(changestyle);
	}
}

function changeStyleOff(linkId,styleClass) {
	if (document.all) {
		var changestyle = "document.all." + linkId + ".className = '" + styleClass + "Off'";
		eval(changestyle);
	}
	
}


// return all form values to default => browse is "return all" search

function browseCat() {

	  formfields = new Array("SportTypeId", "CountryId", "venue", "textfield");
	  formdefaults = new Array(0, 0, "", "");
	  
	  for (i=0; i<formfields.length; i++) {
	  eval("document.form." + formfields[i] + ".value = '" + formdefaults[i] + "'");
	  }
	  
	  document.form.UseStartDate.checked = false;
	  document.form.UseEndDate.checked = false;
	  
	  document.form.submit();
	 
}

	  
function tellaFriend(CURL) {
sendMail = window.open(CURL,'sendMail','width=250,height=300,resizeable=no,status=no,scrollbars=no');
sendMail.focus();
}

// -- Functions to redirect clubcall links to Salamander --------------------
var alternativeServer = "217.158.112.238";
var originalServer = "www.clubcall.com";

function replaceLinks() {
  var allLinks = document.getElementsByTagName('A');
  var message = "";
  for (p in allLinks) {
    var thisLink = allLinks[p];
    var thisLinkHref = thisLink.href;
    var newHref = convertLink(thisLinkHref);
    thisLink.href = newHref;
  }
}

function convertLink(href) {
  var newHref = href.replace(originalServer, alternativeServer);
  return newHref;
}
// ---------------------------------------------------------------------------

//all of the following script is for the benefit of the text scroller

//took out a call to reset interpreter, if not working then put back in.
//scrollheight needs to be defined, must match value in scroll:default.
//width not important
var scrollerwidth=162;
var scrollerheight=100;

//these orig hard coded vals probably not needed

var pausebetweenimages=1000;
var scrollSpeed = 5; 
var origSpeed = 5;
var height = 0;


//scrolling is done differently for netscape and ie.
//ie -> two divs are scrolled and clipped to give the appearance of scrolling.
//ie -> the innerHTML content of each div tag is swapped so that it all looks okay.
//ie -> ie4 ignores overflow:hidden. instead change clipping, you'll see what i mean in the code.


//netscape -> we're using the UTF-8 format. This unfortunately is ignored by netscape if you do a document.write, causes the display to mess up badly.
//netscape -> so to get around this, each bit of content is placed in its own div and is scrolled and placed as necessary.


//both -> the same functions are used for all scrolls on same page. to distinguish between boxes the winid has been used. 


function locateObject(n, d) { //v3.0

//this function finds the div in question and returns it back to the caller
//recursive to go through DOM

  var p,i,x;
  if(!d){
   d=document;

  }   
  if((p=n.indexOf("?"))>0&&parent.frames.length)
  {
	d=parent.frames[n.substring(p+1)].document;
    n=n.substring(0,p);
  }
  
  if(!(x=d[n])&&d.all) 
  {
	
	x=d.all[n];
  }

  for (i=0;!x&&i<d.forms.length;i++) 
  {
	
	x=d.forms[i][n];
  }
  
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) 
  {
	x=locateObject(n,d.layers[i].document);
  }


  return x;
  
}

function movevText1Block(whichdiv, id)
{
//first function called, two functions that move alternate divs.

vSlideContent = eval("vSlideContent_" + id);
if (document.all)
{
	//IE browsers
	//name of current div is passed in, eval it to get the correct scroll to move 
	tdiv=eval(whichdiv)
	
	var strDivSecond = "vText1_" + id;
	
	if (tdiv.style.pixelTop>0&&tdiv.style.pixelTop<=eval("scrollSpeed" + id))
	{
		//sets up when div is moved into place (offset by 5 to pass if statement) then to zero to fail it.
		tdiv.style.pixelTop=0
	
		
// i.e now set to zero so next time when the below func is called it won't enter this block
		
		setTimeout("movevText1Block('" + tdiv.id + "','" +  id + "')",eval("pause" + id))

				
// start moving the second div at the same time that the first one moves.
		
		setTimeout("movevText2Block('" + strDivSecond + "','" +  id + "')",eval("pause" + id))

		return
	}
	if (tdiv.style.pixelTop>=tdiv.offsetHeight*-1)
	{	
	
		//if the movement to get the div under way has started then continue to move the div with a timeout of 10ms between movement.
		//this can be played with to get a smoother scroll
		
		//move the div
		tdiv.style.pixelTop-=eval("scrollSpeed" + id);
		
		if(tdiv.style.pixelTop <=0)
		{
			//if the top of the box has reached the top of the scroll area, start clipping. 
			//this is required as ie4 ignores overflow:hidden
			
			tdiv.style.clip = "rect("+ (tdiv.style.pixelTop*-1) + "px, " + 100 + "%, " + 100 +  "%, " + 0 + "px)";
			
		}
		else
		{
			//if we've still not reached the top then we need to unclip the bottom as the boxes come 'shrunk'
			botHeight=(scrollerheight-tdiv.style.pixelTop);
			botHeight = 100;
			tdiv.style.clip = "rect("+ 0 + "px, " + 100 + "%, " + (botHeight+1) +  "px, " + 0 + "px)";			
		}
		
			
		setTimeout("movevText1Block('" + tdiv.id + "','" +  id + "')",100)
	
	}
	else
	{
		//i.e. stopped moving and now set to the bottom of the cycle ready to go again.
		//squash box to make invisible.
		
		tdiv.style.clip ='rect(0,100%,0,0)';
		tdiv.style.pixelTop=scrollerheight;

	
		//swap text in div so that it now hold the text for the next relevant scroller
			
		if ((vSlideContent.length > 1) && (eval("count" + id)!=vSlideContent.length-1))
		{
			
			newcount = eval("count" + id) + 1;
			eval("count" + id + " = " + newcount);
		}
		else
		{
			
			eval("count" + id + " = " + 0);
		}
		
		tdiv.innerHTML=vSlideContent[eval("count" + id)];
		
	}
}

else
{
        
        //netscape browsers 
		
        tlayer=eval(whichdiv);
		//get the layer (div) object using name passed in
		
        if (tlayer.top>0&&tlayer.top<=5)

        {
                //set layer up. functionality here, much the same as above. uses locateObject to pass divs into funtions though. 
				//shouldn't have needed to as the eval was meant to handle this, but its netscape....
				tlayer.top=0

                setTimeout("movevText1Block(locateObject('vTextMain_" + id + "').document.layers['vText" + eval("count" + id) + "_" + id + "']," + id + ")",eval("pause" + id))
                
				if ((vSlideContent.length > 1) && (eval(eval("count" + id)+1)==vSlideContent.length))
                {
					setTimeout("movevText2Block(locateObject('vTextMain_" + id + "').document.layers['vText" + 0 + "_" + id + "']," + id + ")",eval("pause" + id))
                }
                else
                {
					setTimeout("movevText2Block(locateObject('vTextMain_" + id + "').document.layers['vText" + eval(eval("count" + id)+1) + "_" + id + "']," + id + ")",eval("pause" + id))
                }

                return
        }
        
        if (tlayer.top>=tlayer.document.height*-1)
        {
        tlayer.top-=eval("scrollSpeed" + id)
                
        
		setTimeout("movevText1Block(locateObject('vTextMain_" + id + "').document.layers['vText" + eval("count" + id) + "_" + id + "']," + id + ")",100)
        
        }
        else
        {
               //in ie had to replace content, here just make sure that the right divs are being moved.         
                tlayer.top=scrollerheight; //+5;
                
                
                count = eval("count" + id);
          
                if ((vSlideContent.length > 1) && (eval("count" + id)!=vSlideContent.length-1)) {
                        newcount = eval("count" + id) + 1;
                        eval("count" + id + " = " + newcount);
                } else {
						eval("count" + id + " = " + 0);
                }
                
               
        }
}

//function end
}

function movevText2Block(whichdiv, id)
{


vSlideContent = eval("vSlideContent_" + id);

	if (document.all)
	{
		tdiv2=eval(whichdiv)
		
		var strDivFirst = "vText0_" + id;
		var strDivSecond = "vText1_" + id;

		if (tdiv2.style.pixelTop>0&&tdiv2.style.pixelTop<=eval("scrollSpeed" + id))
		{
			tdiv2.style.pixelTop=0
			
			setTimeout("movevText2Block('" + strDivSecond + "','" +  id + "')",eval("pause" + id))
			setTimeout("movevText1Block('" + strDivFirst + "','" + id + "')",eval("pause" + id))
			return
		}
		
		if (tdiv2.style.pixelTop>=tdiv2.offsetHeight*-1)
		{

			tdiv2.style.pixelTop-=eval("scrollSpeed" + id);
			
			if(tdiv2.style.pixelTop <= 0)
			{	
				tdiv2.style.clip = "rect("+ (tdiv2.style.pixelTop*-1) + "px, " + 100 + "%, " + 100 +  "%, " + 0 + "px)";
			}
			else
			{
				botHeight2 = (scrollerheight-tdiv2.style.pixelTop);
				botHeight2 = 100;
				tdiv2.style.clip = "rect("+ 0 + "px, " + 100 + "%, " + (botHeight2+1) +  "px, " + 0 + "px)";			
			}
		
			
			
			setTimeout("movevText2Block('" + strDivSecond + "','" +  id + "')",100)
		}
		else
		{	

			tdiv2.style.clip ='rect(0,100%,0,0)';
			tdiv2.style.pixelTop=scrollerheight; //5				
			
			if ((vSlideContent.length > 1) && (eval("count" + id)!=vSlideContent.length-1))
			{				
				newcount = eval("count" + id) + 1;
				eval("count" + id + " = " + newcount);
			}
			else
			{				
				eval("count" + id + " = " + 0);
			}
			
			tdiv2.innerHTML=vSlideContent[eval("count" + id)];
			
		}
		
}

else if (document.layers)
{
        
       
        tlayer2=eval(whichdiv);

        if (tlayer2.top>0&&tlayer2.top<=5)

        {
        
                tlayer2.top=0

                
                setTimeout("movevText2Block(locateObject('vTextMain_" + id + "').document.layers['vText" + eval("count" + id) + "_" + id + "']," + id + ")",eval("pause" + id))
				
				if ((vSlideContent.length > 1) && (eval(eval("count" + id)+1)==vSlideContent.length))
                {
					setTimeout("movevText1Block(locateObject('vTextMain_" + id + "').document.layers['vText" + 0 + "_" + id + "']," + id + ")",eval("pause" + id))
                }
                else
                {
					setTimeout("movevText1Block(locateObject('vTextMain_" + id + "').document.layers['vText" + eval(eval("count" + id)+1) + "_" + id + "']," + id + ")",eval("pause" + id))
                }
				
				
                

                return
        }
        
        if (tlayer2.top>=tlayer2.document.height*-1)
        {
        tlayer2.top-=eval("scrollSpeed" + id)
                
        
		setTimeout("movevText2Block(locateObject('vTextMain_" + id + "').document.layers['vText" + eval("count" + id) + "_" + id + "']," + id + ")",100)
        
        }
        else
        {
                        
                tlayer2.top=scrollerheight+5;
                
                
                count = eval("count" + id);
                
                if ((vSlideContent.length > 1) && (eval("count" + id)!=vSlideContent.length-1))
                {
                        newcount = eval("count" + id) + 1;
                        eval("count" + id + " = " + newcount);
                }
                else
                {
                        
                        eval("count" + id + " = " + 0);
                }
                
                
        }
}
  
//function end
}

function startVTextScroll(id){

//initialisation function that sets divs up and starts the scrolling.
//find the correct div based on the id passed in

strLocateFirst = "vText0_" + id;
strLocateSecond = "vText1_" + id;
strLocateMain = "vTextMain_" + id;
vSlideContent = eval("vSlideContent_" + id)

if (!locateObject(strLocateFirst))
{	
	return;
}

if (document.all)
{   	
		
		//ie browsers ignore inline stylesheets. know bug
		//instead need to set style on boxes manually.
	
		locateObject(strLocateMain).style.height = 100;
		//locateObject(strLocateMain).style.position = 'relative';
		locateObject(strLocateMain).style.top = 0;
		locateObject(strLocateMain).style.left = 0;
		locateObject(strLocateMain).style.visibility = 'visible';
		locateObject(strLocateMain).style.overflow = 'hidden';
		
		
	
		locateObject(strLocateMain).zindex = 10;
		
      	locateObject(strLocateSecond).style.top=scrollerheight;
        locateObject(strLocateSecond).style.width = '100%';
        locateObject(strLocateSecond).style.height = '100%';
        //locateObject(strLocateSecond).style.position = 'absolute';
        locateObject(strLocateSecond).style.zindex = -1;
        locateObject(strLocateSecond).style.padding = 1;
        locateObject(strLocateSecond).style.visibility = 'visible';
		locateObject(strLocateSecond).style.clip = 'rect(0,100%,100%,0)';
		
		
        locateObject(strLocateFirst).style.top=1;
        locateObject(strLocateFirst).style.width = '100%';
        locateObject(strLocateFirst).style.height = '100%';
        //locateObject(strLocateFirst).style.position = 'absolute';
        locateObject(strLocateFirst).style.clip = 'rect(0,100%,100%,0)';
        locateObject(strLocateFirst).style.zindex = -2;
        locateObject(strLocateFirst).style.padding = 1;
        locateObject(strLocateFirst).style.visibility = 'visible';
        
        
           
        locateObject(strLocateFirst).visibility='visible';

        locateObject(strLocateSecond).visibility='visible';
        
        
       
        movevText1Block(locateObject(strLocateFirst), id)
}
else if (document.layers)
{
             
        //set up divs for netscape in loop.
		
        locateObject(strLocateMain).visibility='show';
		
		var i = 1;
        
        for(i;i<eval("vSlideContent_" + id + ".length");i++) 
        {
			currentLayer = "vText" + i + "_" + id;

			locateObject(currentLayer).visibility = 'show';
			locateObject(currentLayer).top = scrollerheight + 5;
			
        
        }

	
		movevText1Block(locateObject(strLocateFirst), id)
        //movevText1Block(locateObject(strLocateFirst), id)
        
}
}
