//addLoadListener(loadtime());

//addLoadListener(setPics());

loadtime(); 

function addLoadListener(fn)
{
if (typeof window.addEventListener != 'undefined')
  {
window.addEventListener('load', fn, false);
  }
else if (typeof document.addEventListener != 'undefined')
  {
document.addEventListener('load', fn, false);
  }
else 
if (typeof window.attachEvent != 'undefined')
  {
   window.attachEvent('onload', fn);
  }
else
  {
    var oldfn = window.onload;
    if (typeof window.onload != 'function')
    {
     window.onload = fn;
    }
    else
    {
      window.onload = function()
      {
        oldfn();
        fn();
      };
    }
  }
}

function attachEventListener(target, eventType, functionRef, capture)
{
  if (typeof target.addEventListener != "undefined")
  {
    target.addEventListener(eventType, functionRef, capture);
  }
  else if (typeof target.attachEvent != "undefined")
  {
    target.attachEvent("on" + eventType, functionRef);
  }
  else
  {
    eventType = "on" + eventType;

    if (typeof target[eventType] == "function")
    {
      var oldListener = target[eventType];

      target[eventType] = function()
      {
        oldListener();

        return functionRef();
      }
    }
    else
    {
      target[eventType] = functionRef;
    }
  }

  return true;
}

function getEventTarget(event)
{
  var targetElement = null;

  if (typeof event.target != "undefined")
  {
    targetElement = event.target;
  }
  else
  {
    targetElement = event.srcElement;
  }

  while (targetElement.nodeType == 3 && targetElement.parentNode != null)
  {
    targetElement = targetElement.parentNode;
  }

  return targetElement;
}


function getDateString() {

        var dateObj = new Date();
        var monthName = new Array("Jan.","Feb.","March","April","May","June","July","Aug.","Sept.","Oct.","Nov.","Dec.");
        var dayName = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
        var day = dayName[dateObj.getDay()];
        var month = monthName[dateObj.getMonth()];
        var year = dateObj.getYear();
        if (year < 2000) {

                year = year + 1900;
        }

        return  day  + "&nbsp;&nbsp;" + month + " " + dateObj.getDate() + ", " + year

}


<!-- clock -->

function createtime()
{
  var time = new Date()
  var hours = time.getHours()
  var minutes = time.getMinutes()
  var seconds = time.getSeconds()
  var abbrev = "AM"
  if (hours>=12)
     abbrev="PM"
  if (hours>12)
    {
     hours=hours-12
    }
  if (hours==0)
      hours=12
  if (minutes<=9)
      minutes="0"+minutes
  if (seconds<=9)
      seconds="0"+seconds
  var ctime=""+hours+":"+minutes+":"+seconds+" "+abbrev+""
  if (document.all)
      document.all.clock.innerHTML=ctime
      else 
  if (document.getElementById)
      document.getElementById("clock").innerHTML=ctime
      else
      document.write(ctime) 
   }
//if (!document.all&&!document.getElementById)
//createtime();

function loadtime()
    {
     if (!document.all&&!document.getElementById)
     createtime();
     if (document.all||document.getElementById)
     setInterval("createtime()",1000);
     //alert("loadtime");
     }




//loadtime();

function setPics()
  {

   //scales fonts sizes dependant upon screen width
     var sWidth = screen.width;
      //calculates the actual font size, then stores it in a global variable (fSize)
        fSize = parseInt((sWidth/100)+0);
     //now the css class is written in with the variable font size

       document.write('<style type="text/css">');
       if (screen.width <= 801) {
       document.write('.topnav ul { font-size: 10px; padding-left: 1em; }'); 
        }
          document.write('</style>');

       document.write('<style type="text/css">');
       if (screen.width <= 801) {
       document.write('#caftalogo { /*top: 150px; */ left: 320px; }'); 
       }
          document.write('</style>');

       document.write('<style type="text/css">');
       if (screen.width <= 801) {
       document.write('/* img.ot { width: 267px; height: 90px;  } .ea { width: 243px; height: 68px;   } .ca { width: 166px; height: 55px;   }*/'); 
       }
          document.write('</style>');
       document.write('<style type="text/css">');
       if (screen.width <= 801) {
       document.write('#caftalogo { /*top: 150px; */ left: 400px; }'); 
       }
          document.write('</style>');

       document.write('<style type="text/css">');
       if (screen.width <= 650) {
       document.write('#caftalogo { /*top: 150px; */ left: 250px; }'); 
       document.write('#otexalogo { top: 100px;  }'); 
       document.write('#otexalogo { right: 550px;}'); 
       }
          document.write('</style>');

       document.write('<style type="text/css">');
       if (screen.width <= 650) {
       document.write('/* #otexalogo { right: 0px;  } .ea { width: 202px; height: 57px;   } .ca { width: 138px; height: 46px;   }*/'); 


       }
          document.write('</style>');
       
       


       document.write('<style type="text/css">');
       if (screen.width >800) {
       document.write('#content { width: 75%; }'); 
       }
       document.write('</style>');
//alert("setPics");
}


