function countdown(year, month, day, hour, minute, second, format, cy, cm, cd, ch, ci, url,ft)
{
	Today = new Date();
	Todays_Year = Today.getFullYear();
	Todays_Month = Today.getMonth();                  
	
	//Todays_Date = (new Date(cy, cm-1, cd, ch, ci, Today.getSeconds())).getTime(); 
	Todays_Date = (new Date(Todays_Year, Todays_Month, Today.getDate(), Today.getHours(), Today.getMinutes(), Today.getSeconds())).getTime();            
	if(ft)
	{
		Target_Date = ft;
	}
	else
	{
		Target_Date = (new Date(year, month - 1, day, hour, minute, second)).getTime();  
	}
		
	Time_Left = Math.round((Target_Date - Todays_Date) / 1000);
	
	if(Time_Left < 0)
	{
		Time_Left = 0;
		window.location = url;
		return false;
	}
	
	switch(format)
	{
		case 0:
			document.getElementById('countdown').innerHTML = Time_Left + ' seconds';
			break;
		case 1:
			days = Math.floor(Time_Left / (60 * 60 * 24));
			Time_Left %= (60 * 60 * 24);
			hours = Math.floor(Time_Left / (60 * 60));
			Time_Left %= (60 * 60);
			minutes = Math.floor(Time_Left / 60);
			Time_Left %= 60;
			seconds = Time_Left;
			
			dps = 's'; hps = 's'; mps = 's'; sps = 's';
			if(days == 1) dps ='';
			if(hours == 1) hps ='';
			if(minutes == 1) mps ='';
			if(seconds == 1) sps ='';
			
			document.getElementById('countdown').innerHTML = days + ' day' + dps + ' ';
			document.getElementById('countdown').innerHTML += hours + ' hour' + hps + ' ';
			document.getElementById('countdown').innerHTML += minutes + ' minute' + mps + ' and ';
			document.getElementById('countdown').innerHTML += seconds + ' second' + sps;
			break;
		default: 
			document.getElementById('countdown').innerHTML = Time_Left + ' seconds';
	}
	
	setTimeout('countdown(' + year + ',' + month + ',' + day + ',' + hour + ',' + minute + ',' + second + ',' + format + ',' + cy + ',' + cm + ',' + cd + ',' + ch + ',' + ci + ',"' + url + '",' + ft + ');', 1000);
}

function jssetCookie( name, value, expires, path, domain, secure )
{
    var today = new Date();
    today.setTime( today.getTime() );
    if( expires )
    {
        expires = expires * 1000 * 60 * 60 * 24;
    }

    var expires_date = new Date( today.getTime() + (expires) );
document.cookie = name+'='+escape( value ) +
( ( expires ) ? ';expires='+expires_date.toGMTString() : '' ) + //expires.toGMTString()
( ( path ) ? ';path=' + path : '' ) +
( ( domain ) ? ';domain=' + domain : '' ) +
( ( secure ) ? ';secure' : '' );
}

function getCookie(name) {
var start = document.cookie.indexOf( name + "=" );
var len = start + name.length + 1;
if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
return null;
}
if ( start == -1 ) return null;
var end = document.cookie.indexOf( ';', len );
if ( end == -1 ) end = document.cookie.length;
return unescape( document.cookie.substring( len, end ) );
}