function CountDown(id, year, month, day, hour, minute, format, thisYear, thisMonth, thisDay, thisHour, thisMinute, thisSecond)
{

         Today = new Date();

         Todays_Year = thisYear; // Today.getFullYear() - 2000;
         Todays_Month = thisMonth; //Today.getMonth() + 1;                  

         //Convert both today's date and the target date into miliseconds.                           
         //Todays_Date = (new Date(Todays_Year, Todays_Month, Today.getDate(), 
         //                        Today.getHours(), Today.getMinutes(), Today.getSeconds())).getTime();                                 
         
         Todays_Date = (new Date(Todays_Year, Todays_Month, thisDay, 
                                 thisHour, thisMinute, Today.getSeconds())).getTime();    
         
         Target_Date = (new Date(year, month, day, hour, minute, 00)).getTime();                  
        
         //Find their difference, and convert that into seconds.                  
         Time_Left = Math.round((Target_Date - Todays_Date) / 1000);
         
         if(Time_Left < 0)
            Time_Left = 0;
         
         switch(id)
         {
            case 0:
                TagId = document.getElementById('CountDown0');
                break
            case 1:
                TagId = document.getElementById('CountDown1');
                break
            case 2:
                TagId = document.getElementById('CountDown2');
                break
            case 3:
                TagId = document.getElementById('CountDown3');
                break
            case 4:
                TagId = document.getElementById('CountDown4');
                break
            case 5:
                TagId = document.getElementById('CountDown5');
                break
            case 6:
                TagId = document.getElementById('CountDown6');
                break
            case 7:
                TagId = document.getElementById('CountDown7');
                break
            case 8:
                TagId = document.getElementById('CountDown8');
                break
            case 9:
                TagId = document.getElementById('CountDown9');
                break
            case 10:
                TagId = document.getElementById('CountDown10');
                break
            case 11:
                TagId = document.getElementById('CountDown11');
                break
            case 12:
                TagId = document.getElementById('CountDown12');
                break
         }
         
         
         switch(format)
               {
               case 0:
                    //The simplest way to display the time left.
                    TagId.innerHTML = Time_Left + ' seconds';
                    break;
               case 1:
                    //More datailed.
                    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';
                    //ps is short for plural suffix.
                    if(days == 1) dps ='';
                    if(hours == 1) hps ='';
                    if(minutes == 1) mps ='';
                    if(seconds == 1) sps ='';
                    
                    //document.all.countdown.innerHTML = days + ' day' + dps + ' ';
                    //document.all.countdown.innerHTML += hours + ' hour' + hps + ' ';
                    //document.all.countdown.innerHTML += minutes + ' minute' + mps + ' and ';
                    //document.all.countdown.innerHTML += seconds + ' second' + sps;
                    
                    TagId.innerHTML = days + 'd ' ;
                    TagId.innerHTML += hours + 'h ';
                    TagId.innerHTML += (minutes) + 'm ';
                    TagId.innerHTML += (seconds) + 's';
                    break;
               default: 
                    TagId.innerHTML = Time_Left + ' seconds';
               }
         
         if (thisMinute == 59)
         {
            if (minutes == 1)
            {
                thisHour = thisHour + 1;
            }
         }
         //if (thisSecond == 59)
         //{
            if (seconds == 1)
            {
                thisMinute = thisMinute + 1;
            }  
        //}
         //Recursive call, keeps the clock ticking.
         setTimeout('CountDown(' + id + ',' + year + ',' + month + ',' + day + ',' + hour + ',' + minute + ',' + format + ',' + thisYear + ',' + thisMonth + ',' + thisDay + ',' + thisHour + ',' + thisMinute + ',' + thisSecond + ');', 1000);
}

function ParseNumber(number)
{
    if (number < 10)
    {
        return '0' + number;
    }
    
    return number;
}

function ValidateChar(text)
{
    var chars = "§!¤%&/()=?`´|$£€{[]}|¨^~'* ";
    
    for (var i = 0; i <= chars.length-1; i++)
    {
        if (text.indexOf(chars.substring(i, i+1)) > -1)
        {
            return false;
        }
    }
    
    return true;
}

function IsNumeric(sText)
{
var ValidChars = "0123456789.";
var IsNumber=true;
var Char;


for (i = 0; i < sText.length && IsNumber == true; i++) 
  { 
  Char = sText.charAt(i); 
  if (ValidChars.indexOf(Char) == -1) 
     {
     IsNumber = false;
     }
  }
return IsNumber;
}


function isNumberKey(evt)
{
 var charCode = (evt.which) ? evt.which : event.keyCode

 if (charCode > 31 && (charCode < 45 || charCode > 57))
    return false;

 return true;
}

function isValidEmail(strEmail)
{
validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;

if (strEmail.search(validRegExp) == -1) 
{
  return false;
} 
return true; 
}
