//variables for scrolling 
	document.loaded = 0    
var mainDiv=false;	
	var top;
	var products_on = null
	var motorsport_on = null
	var castroloil_on = null
	var businesslinks_on = null
	var worldwidesites_on = null
	var search_on = null
	var popup_on = null
	var scrolltop = null
	var cardrop_on = null
	var f1drop_on = null
	var superbikesdrop_on = null
	var rallydrop_on = null
	var partnerdrop_on = null
	var timeID = null
	var isNS = null
	var HIDDEN = null
    var VISIBLE = null
	var browser = navigator.appName;
	var menuimage = null
	var copyt = null
	var copysize = null
	var home_on  = null
	var docs_on  = null
	var x,y
	


	function handlerMM(e){
	x = ns4 ? e.pageX : event.clientX
	y = ns4 ? e.pageY : event.clientY
	flag=1
}

    /* Show an object */
    function showObject(obj) {
		if (obj != null && document.loaded == 1)
		{
        	obj.visibility = VISIBLE;
		}
    }

	

    /* Hide an object */
    function hideObject(IEobj,NSobj,ex,exi,items,menuimage) {
	
if (document.loaded == 1){
		if (!ns4){
								
				yy = IEobj.pixelTop;
				xx = IEobj.pixelLeft;
		}
		
		else{
			yy = document.main.document[NSobj.id].top
			xx = document.main.document[NSobj.id].left
			xx = xx - 2
			
		} 

		dooit = false
		if(ie){
			x = event.clientX
			y = event.clientY
		}
		if(mainDiv){
			x=x-mainDiv.x;
			y=y-mainDiv.y;
		}
		//alert (yy)
		//alert (ex)
		//alert (xx)
		yy = parseInt(yy,10)
		yy = yy-1;
		items = parseInt(items,10)
//		alert(y+" "+(yy))
		if (y <= yy){ dooit = true}
		if (y >= (yy + (items * 14))) { dooit = true}
		if (x >= (ex-1)){ dooit = true}
		if (x <= (exi+1)){ dooit = true}
		if (x <= xx) { dooit = true}	
		
		//alert(items)
		
		if (dooit == true){
		
		MM_swapImgRestore()
		MM_swapImage(menuimage,'','../images/menu/' + menuimage + '_off.gif',1)
			
			
				if (browser != "Netscape"){
				
		        		IEobj.visibility = HIDDEN;
					
					}
					
				else {
						document.main.document[NSobj.id].hidden = true;
				}
		}
    }
}
	
	
	
	
/* Hide an object in the upwards direction*/
    function hideObjectUp(IEobj,NSobj,ex,exi,items,menuimage) {
	
	if (document.loaded == 1){
		
		if (browser != "Netscape"){
								
				objStringy = IEobj.top
				
				lenf = objStringy.length;
				
				yy = objStringy.substring(0,(lenf - 2));
				
				objStringx = IEobj.left
				
				lenf = objStringx.length;
				
				xx = objStringx.substring(0,(lenf - 2));
				
						
		}
		
		else{
		 
			yy = document [NSobj.id].top
			xx = document [NSobj.id].left
			xx = xx - 2
			
		} 
		
		dooit = false
		if (browser != "Netscape"){
		x = (document.layers) ? e.pageX : event.clientX
		y = (document.layers) ? e.pageY : event.clientY
		}
		

		
		yy = parseInt(yy,10)
		yy = yy-1;
		items = parseInt(items,10)
		if (y >= (yy + (items * 14))) { dooit = true}
		if (x >= (ex-1)){ dooit = true}
		if (x <= (exi+1)){ dooit = true}
		if (x <= xx) { dooit = true}	
		
		
		if (dooit == true){
		
		
			
				if (browser != "Netscape"){
				
		        		IEobj.visibility = HIDDEN;
					
					}
					
				else {
						document[NSobj.id].hidden = true;
				}
		}
    }	
}

	

/* Hide a MENU object */
    function hideMenuObject(IEobj,NSobj,ex,exi,items) {
	
	if (document.loaded == 1){	
	
		if (browser != "Netscape"){
								
				objStringy = IEobj.top
				
				lenf = objStringy.length;
				
				yy = objStringy.substring(0,(lenf - 2));
				
				objStringx = IEobj.left
				
				lenf = objStringx.length;
				
				xx = objStringx.substring(0,(lenf - 2));
				
						
		}
		
		else{
		 
			yy = document [NSobj.id].top
			xx = document [NSobj.id].left
			xx = xx - 2
			
		} 
		
		dooit = false
		if (browser != "Netscape"){
		x = (document.layers) ? e.pageX : event.clientX
		y = (document.layers) ? e.pageY : event.clientY
		}

		
		yy = parseInt(yy,10)
		yy = yy-1;
		items = parseInt(items,10)
		if (y <= yy){ dooit = true}
		if (y >= (yy + (items * 16))) { dooit = true}
		if (x >= (ex-1)){ dooit = true}
		if (x <= (exi+1)){ dooit = true}
		if (x <= xx) { dooit = true}	
				
		if (dooit == true){
			
			
				if (browser != "Netscape"){
				
		        		IEobj.visibility = HIDDEN;
					
					}
					
				else {
						document[NSobj.id].hidden = true;
				}
		}
    }
}
	
	
	

 function hidepopupObject(IEobj,NSobj) {
								if (browser != "Netscape"){
						        		IEobj.visibility = HIDDEN;
										}
									else {
						document[NSobj.id].hidden = true;
				}
		}
		

		
		
		
		
if (navigator.appName == "Netscape") {
	layerRef="document.layers";
  	styleSwitch="";
    } else {
    	layerRef="document.all";
    	styleSwitch=".style";
    }	
		
    
function showLayer(layerName) {
 	eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
}
  	
function hideLayer(layerName) {
	eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
}


ns=0;
layerRef="document.all"
styleSwitch=".style"
if (navigator.appName == "Netscape") {
	ns=1;
	layerRef="document.layers"
  	styleSwitch=""

}

menutop=262;
if (ns) menutop=260;

function sety(layerName,y) {
 	eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.top='+y);
}	
	
	
function reddy() //don't try and do anything till it's all loaded up
        {		
				setspeed();
				document.loaded = 1;
                checkstatus();
			
        }
		

//function launchwin(url){	

//		var newwin1 = window.open(url,null,"height=200,width=300,status=no,toolbar=no,menubar=no,scrollbars=yes,top=10,left=10");
//}

function legalWin(url){	

		var newwin2 = window.open(url,null,"height=550,width=417,status=no,toolbar=no,menubar=no,scrollbars=yes,top=10,left=10");
}

function legalWin1(url){	

		var newwin4 = window.open(url,null,"height=550,width=420,status=no,toolbar=no,menubar=no,scrollbars=yes,top=10,left=10");
}

function legalWin2(url){	

		var newwin6 = window.open(url,null,"height=700,width=815,status=no,toolbar=no,menubar=no,scrollbars=yes,top=0,left=0");
}



function compWin(url){	

		var newwin3 = window.open(url,null,"height=500,width=420,status=no,toolbar=no,menubar=no,scrollbars=yes,top=10,left=10");
}


function compWin2(url){	

		var newwin5 = window.open(url,null,"height=550,width=455,status=no,toolbar=no,menubar=no,scrollbars=yes,top=10,left=10");
}


function openWin ( width, height, name, url ) 
{
	win = window.open(url, name, "height="+height+",width="+width);
}

function printable (url) 
{
		var newwin4 = window.open(url,null,"height=450,width=600,status=no,toolbar=no,menubar=yes,scrollbars=yes,top=10,left=10");
}


function checkMe(form){
	
	if((document.subs.mypassword.value)==(document.subs.anotherpassword.value))
	{
	    gotocheckbox = true;
	}
	else{
		alert("Your passwords do not match.");
		document.subs.mypassword.focus();
		return false;
	}
	
 if (gotocheckbox == true)
{	
	if ((document.subs.legal.checked) == false){
		alert("You must accept the Legal Notice by checking the box.");
		document.subs.legal.focus();
		return false;
		}
	

	// is country element filled?

    if (isFilled(document.subs.mycountry) == false) {
    alert("You must enter a country.");
    document.subs.mycountry.focus();
    return false;
    }
	
	    // is address element a real email address?

    if (isEmail(document.subs.myemail) == false) { 
    alert("Please enter a valid email address.");
    document.subs.myemail.focus();
    return false;
    }

}
}




/* This function validates the form to ensure all required elements
*  are filled in  */

function isEmail(elm) {







	/* 	Work By:	Ian Walters
		Date:		31/05/2001
		Purpose:	To add extra validation to email. Do not accept illegal characters
	*/
		var requiredChars = false;
		var legalChars = false;
		
		// first check that required characters exist
		
		if	(elm.value.indexOf("@") + "" != "-1" &&
        	elm.value.indexOf(".") + "" != "-1" &&
        	elm.value != "")
			{
			requiredChars = true;
			}
		else
			{
			requiredChars = false;
			}
		
		// next, check there are no illegal characters
		// NB: this list can be amended as needed
		
		var aIllegalChars = new Array(" ","+","#",",","'","~","<",">","/","\\","{","}","[","]")
		for (var i=0;i<aIllegalChars.length;i++)
			{
			if (elm.value.indexOf(aIllegalChars[i]) != -1)
				{
				legalChars = false;
				break;
				}
			else legalChars = true;	
			}
	
		// return true value only if required and legal chars
	
		if (requiredChars == true && legalChars == true)
			{
			return true;
			}
		else
			{
			return false;
			}
		}

// Check for null and for empty

/*	Work By:	Ian Walters
	Date:		31/05/2001
	Purpose:	To provide new function for validating MailAUrl form
*/

function isReadyMailAUrl(form) {

	// check all fields have been entered

	if (isFilled(form.txtYourName) == false)
		{
    	alert("Please enter your name.");
    	form.txtYourName.focus();
    	return false;
    	}
	
	if (isFilled(form.txtYourEmail) == false)
		{
    	alert("Please enter your email address.");
    	form.txtYourEmail.focus();
    	return false;
    	}

	// check email address valid
	
	if (isEmail(form.txtYourEmail) == false) { 
    	alert("Please enter a valid email address.");
    	form.txtYourEmail.focus();
    	return false;
    	}
	
	if (isFilled(form.txtTheirName) == false)
		{
    	alert("Please enter your friend's name.");
    	form.txtTheirName.focus();
    	return false;
    	}
	
	//check email address valid
	
	if (isEmail(form.txtTheirEmail) == false) { 
    	alert("Please enter a valid email address.");
    	form.txtTheirEmail.focus();
    	return false;
    	}

	if (isFilled(form.txtTheirEmail) == false)
		{
    	alert("Please enter your friend's email address.");
    	form.txtTheirEmail.focus();
    	return false;
    	}

	
	}

/*	Work By:	Ian Walters
	Date:		01/06/2001
	Purpose:	To validate the sub competition form
*/	

function isReadySubCompetition(form) {
	
	
	var formElements = form.elements;
	var elementName;
	var nullErrMessage = "Please enter ";
	for (var i=0;i<form.elements.length;i++)
		{
		elementName = form.elements[i].name;
		if (form.elements[i].value == null||form.elements[i].value == "")
			{
			switch(elementName) {
				case "txtYourFirstName":
					raiseError("Your First Name",elementName);
					return false;
					break;
				case "txtYourLastName":
					raiseError("Your Last Name",elementName);
					return false;
					break;
				case "txtYourEmail":
					raiseError("Your Email Address",elementName);
					return false;
					break;
				case "txtFriend1Name":
					raiseError("Friend 1's Name",elementName);
					return false;
					break;
				case "txtFriend1Email":
					raiseError("Friend 1's Email Address",elementName);
					return false;
					break;
				case "txtFriend2Name":
					raiseError("Friend 2's Name",elementName);
					return false;
					break;
				case "txtFriend2Email":
					raiseError("Friend 2's Email Address",elementName);
					return false;
					break;
				case "txtFriend3Name":
					raiseError("Friend 3's Name",elementName);
					return false;
					break;
				case "txtFriend3Email":
					raiseError("Friend 3's Email",elementName);
					return false;
					break;
				}
			}
		else 
			{
			//alert(document.forms.frmSubCompetition.txtYourEmail.value);
			if(elementName.indexOf("Email")!=-1)
				{
				if(isEmail(form[elementName])==false)
					{
					alert("Please enter a valid email address");
					form[elementName].focus();
					return false;
					break;
					}
				}
			else if(form.selCountry.value=="Select below")
				{
				alert("Please select a country");
				form.selCountry.focus();
				return false;
				break;
				}
			}
		}
	if (form.legal.checked == false)
		{
		alert("You must accept the terms and conditions to enter the competition");
		document.forms.subs.legal.focus();
		return false;
		}
	}

function raiseError(strMessage, errorElementName) {
	var nullErrMessage = "Please Enter "
	nullErrMessage = nullErrMessage + strMessage;
	alert(nullErrMessage);
	//eval ("document.forms['subs']." + errorElementName + ".focus()");
	}
	

function isReady(form) {
	// is email address filled?
	
	if (isFilled(form.email) == false) {
    alert("Please enter your email address.");
    form.email.focus();
    return false;
    }

	
    // is address element a real email address?

    if (isEmail(form.email) == false) { 
    alert("Please enter a valid email address.");
    form.email.focus();
    return false;
    }


    // is name element filled?

    if (isFilled(form.name) == false) {
    alert("Please enter your name.");
    form.name.focus();
    return false;
    }


	 // is country element filled?

    if (isFilled(form.country) == false) {
    alert("You must enter a country.");
    form.country.focus();
    return false;
    }
	
	if ((document.subs.legal.checked) == false){
	alert("You must accept the Terms & Conditions by checking the box.");
	return false;

	}
	
}


function pagenumberwriter()
{
	
	var counter=0;
	
	while(eval('typeof copy'+ (counter + 1)+'Div =="object"')){
//	alert(counter);
		counter++;
	}
	
	if(typeof pagenumDiv=='object')pagenumDiv.write( "<span class='page' style='font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; color: #666666; '><font size='1'>" + pagenumber + "|" + counter + "</span>");
	if(counter>1){
		if(typeof pagenumDiv=='object')pagenumDiv.inherit();
		if(typeof upbuttoffDiv=='object')upbuttoffDiv.inherit();
		if(typeof downbuttoffDiv=='object')downbuttoffDiv.inherit();
	}
}


var pagenumber = 1;
var leftarrowOn=new Image();
leftarrowOn.src="../images/left_arrow_on.gif";
var leftarrowOff=new Image();
leftarrowOff.src="../images/left_arrow_off.gif";
var rightarrowOn=new Image();
rightarrowOn.src="../images/right_arrow_on.gif";
var rightarrowOff=new Image();
rightarrowOff.src="../images/right_arrow_off.gif";

function nextpage(direction)
{
	

	if (eval('typeof copy'+ (pagenumber + direction)+'Div =="object"'))
	{
		eval( 'copy' + pagenumber + 'Div.hide()');
		
		pagenumber += direction;
		
		eval( 'copy' + pagenumber + 'Div.show()');
	}
	checkpage()
	pagenumberwriter()
}


function checkpage()
{
	if(eval('typeof copy'+ (pagenumber - 1)+'Div =="object"'))
	{
		roll('leftarrowImg',leftarrowOn)
	}
	else
	{
		roll('leftarrowImg',leftarrowOff)
	}
	
	if(eval('typeof copy'+ (pagenumber + 1)+'Div =="object"'))
	{
		roll('rightarrowImg',rightarrowOn)
	}
	else
	{
		roll('rightarrowImg',rightarrowOff)
	}
	
}
function popWin( url, name, height, width, resizer ) {
	var outStr = 'height=' + height + ',width=' + width;
    if (resizer != 'true') {
    	outStr = outStr + ',menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars,resizable=no';
    }
    else {
        outStr = outStr + ',menubar=no,toolbar=no,location=no,directories=no,status,scrollbars,resizable=yes';
        }
    window.open(url, name, outStr);
}

