function getRefToDiv(divID,oDoc) {

  if( document.getElementById ) {
    return document.getElementById(divID); }
  if( document.all ) {
    return document.all[divID]; }
  if( !oDoc ) { oDoc = document; }
  if( document.layers ) {
    if( oDoc.layers[divID] ) { return oDoc.layers[divID]; } else {
      //repeatedly run through all child layers
      for( var x = 0, y; !y && x < oDoc.layers.length; x++ ) {

        y = getRefToDiv(divID,oDoc.layers[x].document); }
    return y; } }
  return false;
}

function getZeroPrint(number)

	{
		strNum='';
		if (number<10) strNum='0';
		strNum+=(number);
		return strNum;
	}

function display_count(Time_Left,down,days,hours,minutes,seconds)

	{
//	if (down) getRefToDiv('countdown_title').innerHTML = '<font color=#FFCC00>Selamat Berpuasa !!</font>';
//	else getRefToDiv('countdown_title').innerHTML = '<font color=#FFCC00>Selamat Aidil Fitri !!</font>';

	if (down) getRefToDiv('countdown_title').innerHTML = '<font color=#FFCC00>Selamat Bercuti !!</font>';
	else getRefToDiv('countdown_title').innerHTML = '<font color=#FFCC00>Selamat Bersekolah !!</font>';

	dps = ''; hps = ''; mps = ''; sps = '';if(days == 1) dps ='';if(hours == 1) hps ='';if(minutes == 1) mps ='';if(seconds == 1) sps ='';if (days!=0) getRefToDiv('countdown').innerHTML = days + ' hari' + dps + ' ';else getRefToDiv('countdown').innerHTML ='';getRefToDiv('countdown').innerHTML += hours + ' jam<br>' + hps + ' ';getRefToDiv('countdown').innerHTML += minutes + ' minit' + mps + ' dan ';getRefToDiv('countdown').innerHTML += seconds + ' saat' + sps;
	}

function tarikh_puasa(year, month, day, hour, minute)

         {

         document.write('<div dir="ltr" class="countdown_title" id="countdown_title"></div><br/><div dir="ltr" class="countdown" id="countdown"></div><br/>');

         Today = new Date();
         Todays_Year = Today.getFullYear() - 2000;
         Todays_Month = Today.getMonth() + 1;



         //Server_Date = (new Date(7, 9, 9,
         //                        22, 9, 51)).getTime();

		 Server_Date = (new Date(Todays_Year, Todays_Month, Today.getDate(),
                                 Today.getHours(), Today.getMinutes(), Today.getSeconds())).getTime();

         Todays_Date = (new Date(Todays_Year, Todays_Month, Today.getDate(),
                                 Today.getHours(), Today.getMinutes(), Today.getSeconds())).getTime();

         count( year, month, day, hour, minute, (Todays_Date - (Server_Date)) );
         }

function count(year, month, day, hour, minute, time_difference)

         {

         Today = new Date();
         Todays_Year = Today.getFullYear() - 2000;
         Todays_Month = Today.getMonth() + 1;

         Todays_Date = (new Date(Todays_Year, Todays_Month, Today.getDate(),
                                 Today.getHours(), Today.getMinutes(), Today.getSeconds())).getTime();

         Target_Date = (new Date(year, month, day, hour, minute, 00)).getTime();
         Time_Left = Math.round((Target_Date - Todays_Date + time_difference ) / 1000);

		 down=0;
		 if (Time_Left>=0) down=1;

         Time_Left = Math.abs(Time_Left);
		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;
    	display_count(Time_Left,down,days,hours,minutes,seconds);
         setTimeout('count(' + year + ',' + month + ',' + day + ',' + hour + ',' + minute + ',' +

                     time_difference + ');', 1000);
         }

		 //Masukkan tarikh kat sini 09-01-04 sekolah (Masuk sekolah 4 hb letak 3hb)
		 tarikh_puasa(10, 01, 03, 23, 59)
