function fixNumber(number){return(number<10)?'0'+number:number;}
function fixMonth(number){number=number+1;return(number<10)?'0'+number:number;}
function getLocalDate(year,month,day,dateFormat){if(dateFormat.length<2){dateFormat='yyyy-mm-dd';}
dateFormat=dateFormat.replace('yyyy',year);dateFormat=dateFormat.replace('mm',month);dateFormat=dateFormat.replace('dd',day);dateFormat=dateFormat.replace('d',day);dateFormat=dateFormat.replace('m',month);return dateFormat;}
function runClock(timeDiff,dateFormat){var now=new Date();var newTime;newTime=now.getTime()-timeDiff;now.setTime(newTime);var localDate=getLocalDate(now.getFullYear(),fixMonth(now.getMonth()),fixNumber(now.getDate()),dateFormat);document.getElementById('time').innerHTML=fixNumber(now.getHours())+':'+fixNumber(now.getMinutes())+':'+fixNumber(now.getSeconds());setTimeout('runClock(timeDiff,"'+dateFormat+'");',1000);}
function timeDiff(Year,Month,Day,Hour,Minute,Second,dateFormat){var timeDifferense;var serverClock=new Date(Year,Month-1,Day,Hour,Minute,Second);var clientClock=new Date();var serverSeconds;var clientSeconds;timeDiff=clientClock.getTime()-serverClock.getTime()-3000;runClock(timeDiff,dateFormat);}