//<![CDATA[
	window.onload = function () { applesearch.init(); preloader(); updateClock(); setInterval('updateClock()', 1000 ) }
//]]>

function preloader() 
{
     // counter
     var i = 0;
     // create object
     imageObj = new Image();

     // set image list
     images = new Array();
     images[0]="images/srch_r_f2.gif"

     // start preloading
     for(i=0; i<=1; i++) 
     {
          imageObj.src=images[i];
     }
}

function PadDigits(n, totalDigits) 
    { 
        n = n.toString(); 
        var pd = ''; 
        if (totalDigits > n.length) 
        { 
            for (i=0; i < (totalDigits-n.length); i++) 
            { 
                pd += '0'; 
            } 
        } 
        return pd + n.toString(); 
    } 
	
function updateClock ( )
{
  var currentTime = new Date ( );

  var curr_date = currentTime.getDate();
  var curr_month = currentTime.getMonth();
  curr_month++;
  var curr_year = currentTime.getFullYear();
  var currentHours = currentTime.getHours ( );
  var currentMinutes = currentTime.getMinutes ( );
  var currentSeconds = currentTime.getSeconds ( );

  // Pad the minutes and seconds with leading zeros, if required
  currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
  currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;

  // Choose either "AM" or "PM" as appropriate
  var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";

  // Convert the hours component to 12-hour format if needed
  currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;

  // Convert an hours component of "0" to "12"
  currentHours = ( currentHours == 0 ) ? 12 : currentHours;

  // Compose the string for display
  var currentTimeString = PadDigits(curr_month, 2) + "/" + PadDigits(curr_date, 2) + "/" + curr_year + " | " + currentHours + ":" + currentMinutes + ":" + currentSeconds + " " + timeOfDay;

  // Update the time display
  document.getElementById("datetime").innerHTML = currentTimeString;
}

function submitenter(myfield,e)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;

if (keycode == 13)
   {
   //myfield.form.submit();
   window.location.href='search.php?search=' + document.getElementById('srch_fld').value
   return false;
   }
else
   return true;
}

