function LTrim(str)
/*
   PURPOSE: Remove leading blanks from our string.
   IN: str - the string we want to LTrim
*/
{
   var whitespace = new String(" \t\n\r");

   var s = new String(str);

   if (whitespace.indexOf(s.charAt(0)) != -1) {
      // We have a string with leading blank(s)...

      var j=0, i = s.length;

      // Iterate from the far left of string until we
      // don't have any more whitespace...
      while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
         j++;

      // Get the substring from the first non-whitespace
      // character to the end of the string...
      s = s.substring(j, i);
   }
   return s;
}

/*
==================================================================
RTrim(string) : Returns a copy of a string without trailing spaces.
==================================================================
*/
function RTrim(str)
/*
   PURPOSE: Remove trailing blanks from our string.
   IN: str - the string we want to RTrim

*/
{
   // We don't want to trip JUST spaces, but also tabs,
   // line feeds, etc.  Add anything else you want to
   // "trim" here in Whitespace
   var whitespace = new String(" \t\n\r");

   var s = new String(str);

   if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
      // We have a string with trailing blank(s)...

      var i = s.length - 1;       // Get length of string

      // Iterate from the far right of string until we
      // don't have any more whitespace...
      while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
         i--;


      // Get the substring from the front of the string to
      // where the last non-whitespace character is...
      s = s.substring(0, i+1);
   }

   return s;
}

/*
=============================================================
Trim(string) : Returns a copy of a string without leading or trailing spaces
=============================================================
*/
function trim(str)
/*
   PURPOSE: Remove trailing and leading blanks from our string.
   IN: str - the string we want to Trim

   RETVAL: A Trimmed string!
*/
{
   return RTrim(LTrim(str));
}


function isEmail(string) {
	if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1){
		return true;
	}else{
		return false;
	}
}

function numeric_dot(string) {
	if (string.search(/^[0-9\.]*$/) != -1){
		return true;
	}else{
		return false;
	}
}

function numeric(string) {
	if (string.search(/^[0-9]*$/) != -1){
		return true;
	}else{
		return false;
	}
}

function blurText(text){
	if(trim(text.value) == ''){
		text.value = text.defaultValue;
	}
}

function focusText(text){
	if(text.value == text.defaultValue){
		text.value='';
	}
}

function clear_textbox()
{
if (document.searchadviser.searchstring.value == "search our site...")
document.searchadviser.searchstring.value = "";
} 



/***********************************************
* DHTML Ticker script- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

function domticker(content, divId, divClass, delay, fadeornot){
	
	this.content=content
	this.tickerid=divId //ID of master ticker div. Message is contained inside first child of ticker div
	this.delay=delay //Delay between msg change, in miliseconds.
	this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over ticker (and pause it if it is)
	this.pointer=1
	this.opacitystring=(typeof fadeornot!="undefined")? "width: 100%; filter:progid:DXImageTransform.Microsoft.alpha(opacity=100); -moz-opacity: 1" : ""
	if (this.opacitystring!="") this.delay+=500 //add 1/2 sec to account for fade effect, if enabled
	this.opacitysetting=0.2 //Opacity value when reset. Internal use.
	document.write('<div id="'+divId+'" class="'+divClass+'"><div style="'+this.opacitystring+'">'+content[0]+'</div></div>')
	var instanceOfTicker=this
	setTimeout(function(){instanceOfTicker.initialize()}, delay)
}

domticker.prototype.initialize=function(){
	var instanceOfTicker=this
	this.contentdiv=document.getElementById(this.tickerid).firstChild //div of inner content that holds the messages
	document.getElementById(this.tickerid).onmouseover=function(){instanceOfTicker.mouseoverBol=1}
	document.getElementById(this.tickerid).onmouseout=function(){instanceOfTicker.mouseoverBol=0}
	this.rotatemsg()
}

domticker.prototype.rotatemsg=function(){
	var instanceOfTicker=this
	if (this.mouseoverBol==1) //if mouse is currently over ticker, do nothing (pause it)
		setTimeout(function(){instanceOfTicker.rotatemsg()}, 100)
	else{
		this.fadetransition("reset") //FADE EFFECT- RESET OPACITY
		this.contentdiv.innerHTML=this.content[this.pointer]
		this.fadetimer1=setInterval(function(){instanceOfTicker.fadetransition('up', 'fadetimer1')}, 100) //FADE EFFECT- PLAY IT
		this.pointer=(this.pointer<this.content.length-1)? this.pointer+1 : 0
		setTimeout(function(){instanceOfTicker.rotatemsg()}, this.delay) //update container
	}
}

// -------------------------------------------------------------------
// fadetransition()- cross browser fade method for IE5.5+ and Mozilla/Firefox
// -------------------------------------------------------------------

domticker.prototype.fadetransition=function(fadetype, timerid){
	var contentdiv=this.contentdiv
	if (fadetype=="reset")
		this.opacitysetting=0.2
	if (contentdiv.filters && contentdiv.filters[0]){
		if (typeof contentdiv.filters[0].opacity=="number") //IE6+
			contentdiv.filters[0].opacity=this.opacitysetting*100
		else //IE 5.5
			contentdiv.style.filter="alpha(opacity="+this.opacitysetting*100+")"
	}
	else if (typeof contentdiv.style.MozOpacity!="undefined" && this.opacitystring!=""){
		contentdiv.style.MozOpacity=this.opacitysetting
	}
	else
		this.opacitysetting=1
	if (fadetype=="up")
		this.opacitysetting+=0.2
	if (fadetype=="up" && this.opacitysetting>=1)
		clearInterval(this[timerid])
}



	function swaptabs(targetTab) {
		var overview_tab = document.getElementById('overview_tab');
		var riders_tab = document.getElementById('riders_tab');
		var calendar_tab = document.getElementById('calendar_tab');
		var news_tab = document.getElementById('news_tab');
		var results_tab = document.getElementById('results_tab');
		var bikes_tab = document.getElementById('bikes_tab');
		var images_tab = document.getElementById('images_tab');
		var sponsors_tab = document.getElementById('sponsors_tab');

		var overview = document.getElementById('overview');
		var riders = document.getElementById('riders');
		var calendar = document.getElementById('calendar');
		var news = document.getElementById('news');
		var results = document.getElementById('results');
		var bikes = document.getElementById('bikes');
		var images = document.getElementById('images');
		var sponsors = document.getElementById('sponsors');

		if (targetTab == 'overview') {
			overview_tab.className = 'active';
			riders_tab.className = '';
			calendar_tab.className = '';
			news_tab.className = '';
			results_tab.className = '';
			bikes_tab.className = '';
			images_tab.className = '';
			sponsors_tab.className = '';

			overview.style.display = 'block';
			riders.style.display = 'none';
			calendar.style.display = 'none';
			news.style.display = 'none';
			results.style.display = 'none';
			bikes.style.display = 'none';
			images.style.display = 'none';
			sponsors.style.display = 'none';
		}
		else if (targetTab == 'riders') {
			overview_tab.className = '';
			riders_tab.className = 'active';
			calendar_tab.className = '';
			news_tab.className = '';
			results_tab.className = '';
			bikes_tab.className = '';
			images_tab.className = '';
			sponsors_tab.className = '';

			overview.style.display = 'none';
			riders.style.display = 'block';
			calendar.style.display = 'none';
			news.style.display = 'none';
			results.style.display = 'none';
			bikes.style.display = 'none';
			images.style.display = 'none';
			sponsors.style.display = 'none';
		}
		else if (targetTab == 'calendar') {
			overview_tab.className = '';
			riders_tab.className = '';
			calendar_tab.className = 'active';
			news_tab.className = '';
			results_tab.className = '';
			bikes_tab.className = '';
			images_tab.className = '';
			sponsors_tab.className = '';

			overview.style.display = 'none';
			riders.style.display = 'none';
			calendar.style.display = 'block';
			news.style.display = 'none';
			results.style.display = 'none';
			bikes.style.display = 'none';
			images.style.display = 'none';
			sponsors.style.display = 'none';
		}
		else if (targetTab == 'news') {
			overview_tab.className = '';
			riders_tab.className = '';
			calendar_tab.className = '';
			news_tab.className = 'active';
			results_tab.className = '';
			bikes_tab.className = '';
			images_tab.className = '';
			sponsors_tab.className = '';

			overview.style.display = 'none';
			riders.style.display = 'none';
			calendar.style.display = 'none';
			news.style.display = 'block';
			results.style.display = 'none';
			bikes.style.display = 'none';
			images.style.display = 'none';
			sponsors.style.display = 'none';
		}
		else if (targetTab == 'results') {
			overview_tab.className = '';
			riders_tab.className = '';
			calendar_tab.className = '';
			news_tab.className = '';
			results_tab.className = 'active';
			bikes_tab.className = '';
			images_tab.className = '';
			sponsors_tab.className = '';

			overview.style.display = 'none';
			riders.style.display = 'none';
			calendar.style.display = 'none';
			news.style.display = 'none';
			results.style.display = 'block';
			bikes.style.display = 'none';
			images.style.display = 'none';
			sponsors.style.display = 'none';
		}
		else if (targetTab == 'bikes') {
			overview_tab.className = '';
			riders_tab.className = '';
			calendar_tab.className = '';
			news_tab.className = '';
			results_tab.className = '';
			bikes_tab.className = 'active';
			images_tab.className = '';
			sponsors_tab.className = '';

			overview.style.display = 'none';
			riders.style.display = 'none';
			calendar.style.display = 'none';
			news.style.display = 'none';
			results.style.display = 'none';
			bikes.style.display = 'block';
			images.style.display = 'none';
			sponsors.style.display = 'none';
		}
		else if (targetTab == 'images') {
			overview_tab.className = '';
			riders_tab.className = '';
			calendar_tab.className = '';
			news_tab.className = '';
			results_tab.className = '';
			bikes_tab.className = '';
			images_tab.className = 'active';
			sponsors_tab.className = '';

			overview.style.display = 'none';
			riders.style.display = 'none';
			calendar.style.display = 'none';
			news.style.display = 'none';
			results.style.display = 'none';
			bikes.style.display = 'none';
			images.style.display = 'block';
			sponsors.style.display = 'none';
		}
		else if (targetTab == 'sponsors') {
			overview_tab.className = '';
			riders_tab.className = '';
			calendar_tab.className = '';
			news_tab.className = '';
			results_tab.className = '';
			bikes_tab.className = '';
			images_tab.className = '';
			sponsors_tab.className = 'active';

			overview.style.display = 'none';
			riders.style.display = 'none';
			calendar.style.display = 'none';
			news.style.display = 'none';
			results.style.display = 'none';
			bikes.style.display = 'none';
			images.style.display = 'none';
			sponsors.style.display = 'block';
		}
	}