// JavaScript Document

var isIE
if ( navigator.appName.indexOf("Microsoft") == -1 )
 {
  //alert(" Microsoft == -1 --> Netscape")
  isIE = false ;
 }
else
 {
  //alert("IE")
  isIE = true ;
 } ; 



//  displayDay will convert a number from 0 to 6 to the name of the day
//  it will accept the getDay() method
//  it take 2 parameter, the 1st is the numeric day, the 2nd is either "s" 
//  for short day name OR any others for the long day name

function displayDay(type)
{
 var isShort
 var retValue 
 var tday = new Date() ;
 var DayRep = tday.getDay() ;
 var MthRep = tday.getMonth() ;
 var YrsRep = tday.getFullYear() ;
 var DtRep = tday.getDate() ;
 // alert ("day = " + DayRep + "   month = " + MthRep + "   year = " + YrsRep + " " + DtRep)
 if (type == "s") { isShort = true ;} ;

 switch (DayRep) {
  case 0 : retValue = (isShort ? "Sun" : "Sunday") ;
           break ;
  case 1 : retValue = (isShort ? "Mon" : "Monday") ;
           break ;
  case 2 : retValue = (isShort ? "Tue" : "Tuesday") ;
           break ;
  case 3 : retValue = (isShort ? "Wed" : "Wednesday") ;
           break ;
  case 4 : retValue = (isShort ? "Thr" : "Thursday") ;
           break ;
  case 5 : retValue = (isShort ? "Fri" : "Friday") ;
           break ;
  case 6 : retValue = (isShort ? "Sat" : "Saturday") ;
           break ;
  default : retValue = "Numeric day: out of range ** 0 to 6 only" ;
 }

 switch (MthRep) {
  case 0 : retValue = retValue + ", " + (isShort ? "Jan" : "January") ;
           break ;
  case 1 : retValue = retValue + ", " + (isShort ? "Feb" : "February") ;
           break ;
  case 2 : retValue = retValue + ", " + (isShort ? "Mar" : "March") ;
           break ;
  case 3 : retValue = retValue + ", " + (isShort ? "Apr" : "April") ;
           break ;
  case 4 : retValue = retValue + ", " + (isShort ? "May" : "May") ;
           break ;
  case 5 : retValue = retValue + ", " + (isShort ? "Jun" : "June") ;
           break ;
  case 6 : retValue = retValue + ", " + (isShort ? "Jul" : "July") ;
           break ;
  case 7 : retValue = retValue + ", " + (isShort ? "Aug" : "August") ;
           break ;
  case 8 : retValue = retValue + ", " + (isShort ? "Sep" : "September") ;
           break ;
  case 9 : retValue = retValue + ", " + (isShort ? "Oct" : "October") ;
           break ;
  case 10 : retValue = retValue + ", " + (isShort ? "Nov" : "November") ;
           break ;
  case 11 : retValue = retValue + ", " + (isShort ? "Dec" : "December") ;
           break ;
  default : retValue = retValue + ", " + "Numeric Month: out of range ** 0 to 11 only" ;
 }
 retValue = retValue + " " + DtRep + ", " + YrsRep
 return retValue
}

//  displayMonth will convert a number form 0 to 11 to the name of the month
//  it will accept the getMonth() method
//  it take 2 parameter, the 1st is the numeric month, the 2nd is either "s" 
//  for short month name OR any others for the long month name

function displayMonth(DayRep, type)
{
 var isShort
 var retValue

 if (type == "s") { isShort = true ;} ;

 switch (DayRep) {
  case 0 : retValue = (isShort ? "Jan" : "January") ;
           break ;
  case 1 : retValue =(isShort ? "Feb" : "February") ;
           break ;
  case 2 : retValue =(isShort ? "Mar" : "March") ;
           break ;
  case 3 : retValue =(isShort ? "Apr" : "April") ;
           break ;
  case 4 : return "May" ;
           break ;
  case 5 : retValue =(isShort ? "Jun" : "June") ;
           break ;
  case 6 : retValue =(isShort ? "Jul" : "July") ;
           break ;
  case 7 : retValue = (isShort ? "Aug" : "August") ;   
           break ;
  case 8 : retValue =(isShort ? "Sep" : "September") ;
           break ;
  case 9 : retValue =(isShort ? "Oct" : "October") ;
            break ;
  case 10 : retValue =(isShort ? "Nov" : "November") ;
            break ;
  case 11 : retValue =(isShort ? "Dec" : "December") ;
            break ;
  default : retValue = "Numeric month: out of range ** 0 to 11 only" ;

 }
 return retValue
}

// displayTime concatenate the hours and minute and the ampm to a string

function displayTime(thr)
{
  var theHr, theMin, theAmPm, theSec, theChgDate, TodayTime
  TodayTime = new Date() ;
  theChgDate = TodayTime.getDay() ;   
  theHr = TodayTime.getHours() + thr ;
  if (theHr >= 24 ) { theHr = theHr - 24 };
  theMin = TodayTime.getMinutes() ;
  theSec = TodayTime.getSeconds() ;
  theAmPm = (theHr == 12 && theMin == 0 ? "noon" : (theHr < 12 ? "am" : "pm")) ;
  theHr = (theHr > 12 ? theHr = theHr - 12  : theHr = theHr)
  theHr = (theHr < 10 ? theHr = "0" + theHr : theHr = theHr)
  theMin = (theMin < 10 ? theMin = "0" + theMin : theMin = theMin)
  theSec = (theSec < 10 ? theSec = "0" + theSec : theSec = theSec)
  theTime = theHr + " : " + theMin + " : " + theSec + " " + theAmPm  ;
  return theTime
 }

// timeIt will continue to change the inner text of an ID every 10 sec. only work in IE 4+
function timeIt()
{
  //if (isIE)
  {
   timerLA.innerHTML = displayTime(0) ;
   setInterval("timerLA.innerHTML = displayTime(0)", 1000) ;
   //timerOK.innerHTML = displayTime(2) ;
   //setInterval("timerOK.innerHTML = displayTime(2)", 1000) ;
   //timerJK.innerHTML = displayTime(3) ;
   //setInterval("timerJK.innerHTML = displayTime(3)", 1000) ;
   // setInterval("timerID.innerHTML = ''", 4900) ;   
  }
//else
 // {
 //  document.write(displayTime(0)) ;
 // }

}

function goTrack(doc)
{
 var sp, wl, pos, ul, pose
 
 for (var i=0;i<document.schTrack.SHIPTYPE.length;++i) {
  if (document.schTrack.SHIPTYPE[i].checked) {
   wl = document.schTrack.SHIPTYPE[i].value
  }
 }
 
 
 //switch (wl) {
 //case "CY" :  alert ("CY") ;
 //            break ; 
 //case "CFS" :  alert ("CFS") ;
 //              break ; 
 // document.schTrack.SCHTYPE[].value
 // }


 if ((wl == "CFS") && (document.schTrack.inType.value == "" ) && document.schTrack.SCHTYPE.options[0].selected) {
  alert ("Please enter you HBL!") ; 
  return false ;
 }


 wl = String(window.location)
 //alert ("the location = " + wl) ;
 pos = wl.indexOf("10.0.0.")
 if (pos >= 0) {
  ul = wl.substr(pos)
  pose = ul.indexOf("/")
  ul = ul.substring(0, pose)
  //alert (pos + " = " + pose + " = " + ul)
  document.schTrack.action = "http://" + ul + "/TrackDtl.asp" 
 }
 else {
  document.schTrack.action = "http://206.253.23.24/TrackDtl.asp" 
 }
}