<!-- Copyright (C) 2002 Dan Heuston -->
<!-- All rights reserved            -->

/* Global variables */ 

 picDir = "images"
 browser_ver = new String

function browserDetection() {

 if(navigator.appName == "Netscape") {
  browser_ver = "Netscape"
 }
 else if(navigator.appName == "Microsoft Internet Explorer") {
  browser_ver = "IE"
 }
 
 return browser_ver
}
 

function getParam(thisURL) {

  param = new String
  
  pos = thisURL.indexOf('?')

  if(pos != -1)
   param = thisURL.substring(pos+1, thisURL.length)

  return param
}



function getCookie(cookieName) {

 buffer = ""
 
 if(document.cookie != "") {
  buffer = cookieVal(cookieName)
 }

 return buffer
}



function cookieVal(cookieName) {

  thisCookie = document.cookie.split("; ")
  for(i=0;i<thisCookie.length;i++) {
   if(cookieName==thisCookie[i].split("=")[0]) {
    return thisCookie[i].split("=")[1]
   }
  }
  return ""
}



function setCookie(cookieName, buffer, duration) {
 expireDate = new Date
 
 if(duration == "short")
  expireDate.setHours(expireDate.getHours()+2) 

 if(duration == "long")
  expireDate.setMonth(expireDate.getMonth()+3) 
     
 document.cookie = cookieName + "=" + buffer + ";expires=" + expireDate.toGMTString()
}



function deleteCookies() {

 if(document.cookie != "") {

  expireDate = new Date
  expireDate.setDate(expireDate.getDate()-1) 
  thisCookie = document.cookie.split("; ")
  
  for(i=0;i<thisCookie.length;i++) {
   cookieName = thisCookie[i].split("=")[0]
   document.cookie = cookieName + "=;expires=" + expireDate.toGMTString()
  }
  
  alert(thisCookie.length + " deleted.")
 }
}



function menuBar(thisscreen, colour) {

 if(colour == "default") 
   colour = "#ABABAB"
   
 document.writeln("<table border=0 align='top' width='100%' bgcolor=" + colour + " cellspacing=0 cellpadding=0>")
 document.writeln("<tr><td align=left>&nbsp;<b><img src='" + picDir + "\/towritelogosm.jpg' alt='[Tow-Rite]' title='' width=70 height=20 align=middle border=0><\/b><\/td>") 

 menuitems = new Array("Trailers", "Trailer Hire", "Roof Boxes", "Tow Bars", "Home")
 pagenames = new Array("trailers.htm", "trailerhire.htm", "roofboxes.htm", "towbars.htm", "index.html")

 for(i=0; i < menuitems.length; i++) {
   document.writeln("<td width=89 align=center><a class='white' href='" + pagenames[i] + "'>" + menuitems[i] + "<\/a><\/td>")
 }
 
 if(thisscreen != "")
  document.write("<tr bgcolor=#FFFF00><td colspan=6><img src='" + picDir + "\/" + thisscreen + "' alt='[Tow-Rite of Upminster]' style='color: #000000'>")
  
 document.writeln("<\/tr><\/table>")
}



function openTandC() {

 winWidth  = 600
 winHeight = 400
 winparams = "scrollbars=yes, menubar=no, width=" + winWidth + ", height=" + winHeight + ", resizable=yes, left=0, top=0, status=no"

 tcWin = window.open("hiretandc.htm", "tandcWin", winparams)

}



function stdFooter() {
 document.writeln("<p style='font-family: Arial, serif; text-align: center; font-size: 8pt; text-indent: 5; word-spacing: 0; line-height: 100%; margin: 0;	background-color : Black; color : White'>")
 document.writeln("&copy; Copyright 2002-2010 Tow-Rite of Upminster. All rights reserved.")
 document.writeln("<\/p>")
}

