function OnlyNumbers(input_object)
{
	return input_object.value.replace(/[^0-9]/g, '');
	
}
function pad(number,length) 
{
    var str = number.toString();
    while (str.length < length)
        str = '0' + str;
    return str;
}

// this function countsdown each second from a given nr of seconds
function Countdown() 
{ 
    //alert('Countdown()');
    
	if( secsTillNextMatch == undefined)
		return;
	
	var secsLeft  = Number(secsTillNextMatch);
	var daysLeft  = Math.floor(secsLeft / 86400); 
	secsLeft      -= 86400 * daysLeft; // substract these days, so only hours are left 
	var hoursLeft = Math.floor(secsLeft / 3600); 
	secsLeft      -= 3600 * hoursLeft; // substract these hours, so only minutes are left 
	var minsLeft  = Math.floor(secsLeft / 60);  
	secsLeft      -= 60 * minsLeft; // substract these minutes, so only seconds are left 
	
	// set these values in to these elements
	var daysLeftHolder  = document.getElementById('daysLeftHolder');
	var hoursLeftHolder = document.getElementById('hoursLeftHolder');
	var minsLeftHolder  = document.getElementById('minsLeftHolder');
	var secsLeftHolder  = document.getElementById('secsLeftHolder');
	
	if(daysLeft > 0)
	{
		if(daysLeft > 1)
			plural = 'en';
		else
			plural = '';
		
		if(daysLeft >= 1)	
			daysLeftHolder.innerHTML  = daysLeft + '<span> dag' + plural + '</span>';
	}
	else
		daysLeftHolder.style.display = 'none';

	
	hoursLeftHolder.innerHTML = pad(hoursLeft, 2) + ':';
	minsLeftHolder.innerHTML  = pad(minsLeft, 2) + ':';
	secsLeftHolder.innerHTML  = pad(secsLeft, 2);	
		
	
	if(hoursLeft <= 0 && minsLeft <= 0 && secsLeft <= 0)
	{
		hoursLeftHolder.style.display = 'none';
		minsLeftHolder.style.display = 'none';
		secsLeftHolder.style.display = 'none';
	}		
		
	// repeat this function after 1 second
	secsTillNextMatch -= 1;
	setTimeout("Countdown()", 1000); 
	
} 

function OpenPopUp(url, title, width, height, params)
{
	//alert(url + width + height);
	if(isNaN(width))
		width = 400;
	if(isNaN(height))
		height = 300;
	if(params == '')
		params = 'status = 1, resizable = 1';	

	window.open(url + '&title=' + title + '&width=' + width + '&height=' + height, '', 'width = ' + width + ', height = ' + height + ',' + params);
	return false;
}


