// globals -- calculate only once
// set target date to 1700GMT on August 13, 2004
var targetDate = Date.UTC(2010, 0, 15, 10, 0, 0, 0)
var oneMinute = 60 * 1000
var oneHour = oneMinute * 60
var oneDay = oneHour * 24
function getTimeUntil(targetMS) {
    var today = new Date()
    var diff = targetMS - today.valueOf()
    return Math.floor(diff)
}

function getCountDown() {
    var ms = getTimeUntil(targetDate)
    var output = ""
    var days, hrs, mins, secs
    if (ms >= 0) {
        days = Math.floor(ms/oneDay)
        ms -= oneDay * days
        hrs = Math.floor(ms/oneHour)
        ms -= oneHour * hrs
        mins = Math.floor(ms/oneMinute)
        ms -= oneMinute * mins
        secs = Math.floor(ms/1000)
        output += "Start in <b>" + days + "</b> days, <b>" + hrs + "</b> Hours, <b>" +
                  mins + "</b> Minutes, <b>" +
                  secs + "</b> Seconds"
    } else {
        output += "Race finished on 16 January 2009 14:00 (local time)"
    }
    return output
}
function updateCountDown()
	{
    //document.forms[0].timer.value = getCountDown()
    document.getElementById('timetogo').innerHTML = getCountDown()
	setTimeout("updateCountDown()", 1000)
	}
	
	
function MM_validateForm() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
    } if (errors) alert('The following error(s) occurred:\n'+errors);
    document.MM_returnValue = (errors == '');
} }	


function centerPopUp( url, name, width, height, scrollbars ) { 
 
	if( scrollbars == null ) scrollbars = "1" 
 
	str  = ""; 
	str += "resizable=1,"; 
	str += "scrollbars=" + scrollbars + ","; 
	str += "width=" + width + ","; 
	str += "height=" + height + ","; 
 
	if ( window.screen ) { 
		var ah = screen.availHeight - 30; 
		var aw = screen.availWidth - 10; 
 
		var xc = ( aw - width ) / 2; 
		var yc = ( ah - height ) / 2; 
 
		str += ",left=" + xc + ",screenX=" + xc; 
		str += ",top=" + yc + ",screenY=" + yc; 
	} 
	window.open( url, name, str ); 
}

function settekst()
{
if(document.getElementById("newsletter_email").value=="email address")
	{document.getElementById("newsletter_email").value=""}
}

