<!--
// determines browser version used for a variety
// of purposes but mainly to resize images etc
function Is() {
    var agent   = navigator.userAgent.toLowerCase();
    this.major  = parseInt(navigator.appVersion);
    this.minor  = parseFloat(navigator.appVersion);
    this.ns     = ((agent.indexOf('mozilla')   != -1) &&
                  (agent.indexOf('spoofer')    == -1) &&
                  (agent.indexOf('compatible') == -1) &&
                  (agent.indexOf('opera')      == -1) &&
                  (agent.indexOf('webtv')      == -1));
    this.ns2    = (this.ns && (this.major      ==  2));
    this.ns3    = (this.ns && (this.major      ==  3));
    this.ns4    = (this.ns && (this.major      ==  4));
    this.ns6    = (this.ns && (this.major      >=  5));
    this.ie     = (agent.indexOf("msie")       != -1);
    this.ie3    = (this.ie && (this.major      <   4));
    this.ie4    = (this.ie && (this.major      ==  4) &&
                  (agent.indexOf("msie 5.0")   == -1));
    this.ie5    = (this.ie && (this.major      ==  4) &&
                  (agent.indexOf("msie 5.0")   != -1));	
    this.ieX    = (this.ie && !this.ie3 && !this.ie4);
}
//-->
<!--
function MM2_openBrWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}
//-->

<!--

rnd.today=new Date();
rnd.seed=rnd.today.getTime();
// Generates random number
function rnd() {
        rnd.seed = (rnd.seed*9301+49297) % 233280;
        return rnd.seed/(233280.0);
}

function rand(number) {
        return Math.ceil(rnd()*number);
}

// -->


<!--
// gets available width of browser window
function getBrowserWidth() {
	    if(is.ns4||is.ns6) {
	        available_width=innerWidth;
	    } else if(is.ie4||is.ie5) {
	        available_width=document.body.clientWidth;
	    }	    
		if(is.ie4 ||is.ie5||is.ns6|| is.ns4) {		
		spacer_width = available_width
		return spacer_width
		}
}

function MM_callJS(jsStr) {
  return eval(jsStr)
}
//-->

<!--
// function to move Informed Chartering Menu to correct position
// on screen. Used in all content pages.
function moveICNavBar() { 

var ie4 = (document.all) ? true : false;
var ns4 = (document.layers) ? true : false;
var ns6 = (document.getElementById && !document.all) ? true : false;

var varBrowserWidth = getBrowserWidth()
// mouseover spacer width
var spacerWidth = 8

if (varBrowserWidth > 670){
	var varNavBarLeftPos = varBrowserWidth - 215
	var varMenuLeftPos = varNavBarLeftPos
} else {
	var varNavBarLeftPos = 455
	var varMenuLeftPos = varNavBarLeftPos
}
	if (ie4) {
		document.all['icnavbar'].style.left = varNavBarLeftPos
		document.all['nav4'].style.left = varMenuLeftPos - spacerWidth
		document.all['hidedropdown'].style.width = varBrowserWidth-70				
		}
	if (ns4) {
		document.layers['icnavbar'].left = varNavBarLeftPos
		document.layers['nav4'].left = varMenuLeftPos - spacerWidth
		document.layers['hidedropdown'].width = varBrowserWidth-70		
		}
	if (ns6) {
		document.getElementById(['icnavbar']).style.left = varNavBarLeftPos
		document.getElementById(['nav4']).style.left = varMenuLeftPos - spacerWidth
		document.getElementById(['hidedropdown']).style.width = varBrowserWidth-70
	}
OSL_showHideLayers('icnavbar','','show')
}

function OSL_showHideLayers() { //v3.0
  var i,p,v,obj,args=OSL_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }	
}

//-->

function checkrequired(which) {
// required for validating general forms
var pass=true;
if (document.images) {
for (i=0;i<which.length;i++) {
var tempobj=which.elements[i];
if (tempobj.name.substring(0,8)=="required") {
if (((tempobj.type=="text"||tempobj.type=="textarea")&&
tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
tempobj.selectedIndex==0)) {
pass=false;
break;
         }
      }
   }
}

if (!pass) {
shortFieldName=tempobj.name.substring(8,30).toUpperCase();
alert("Please make sure the "+ replaceSubstring(shortFieldName,"."," ")+" field was properly completed.");
return false;
}
else
return true;
}

function validateAccountFrm(which) {
// required for validating new account form
var pass=true;
if (document.images) {
for (i=0;i<which.length;i++) {
var tempobj=which.elements[i];
if (tempobj.name.substring(tempobj.name.length-9,tempobj.name.length)=="#required") {
if (((tempobj.type=="text"||tempobj.type=="textarea")&&
tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
tempobj.selectedIndex==0)) {
pass=false;
break;
         }
      }
   }
}
if (!pass) {
shortFieldName=tempobj.name.substring(3,tempobj.name.length-9).toUpperCase();
//var newShortFieldName=shortFieldName.replace(shortFieldName,"."," ")
alert("Please make sure the "+replaceSubstring(shortFieldName,"."," ")+" field was properly completed.");
return false;
}
else
return true;
}


<!--

function addbookmark(){
var bookmarkurl="http://www.offshore-shipbrokers.co.uk"
var bookmarktitle="Offshore Shipbrokers Ltd - Serving the shipping industry"
if (document.all)
window.external.AddFavorite(bookmarkurl,bookmarktitle)
}
//-->

function showDateTime()
{
  // Returns current date and time in Wednesday 10 Jan 2004
  // declare variables and assign weekday, day, mnth and year to each

  var now = new Date();
  var wday = now.getDay();
  var mnth = now.getMonth();
  var year = now.getFullYear();
  var day = now.getDate();

// get actual day name

  if (wday ==0) dayName="Sunday";
  if (wday ==1) dayName="Monday";
  if (wday ==2) dayName="Tuesday";
  if (wday ==3) dayName="Wednesday";
  if (wday ==4) dayName="Thursday";
  if (wday ==5) dayName="Friday";
  if (wday ==6) dayName="Saturday";

// get actual month name

  if (mnth ==0) mnthName="Jan";
  if (mnth ==1) mnthName="Feb";
  if (mnth ==2) mnthName="Mar";
  if (mnth ==3) mnthName="Apr";
  if (mnth ==4) mnthName="May";
  if (mnth ==5) mnthName="Jun";
  if (mnth ==6) mnthName="Jul";
  if (mnth ==7) mnthName="Aug";
  if (mnth ==8) mnthName="Sept";
  if (mnth ==9) mnthName="Oct";
  if (mnth ==10) mnthName="Nov";
  if (mnth ==11) mnthName="Dec";

//concatenate all the variables and return to doc.write

  date = dayName + " " + day + " " + mnthName + " " + year;

  return date;
}

function showDateTimeAdv()
{
<!-- Begin
var today = new Date();
var myDay = today.getDay();
var myDate = today.getDate();
var myMnth = today.getMonth();
var Hrs = today.getHours();
var Mins = today.getMinutes();

//********** THE SWITCH *************
//11 = Date & Time. 10 = Date. 01 = Time.
var DTswitch = 11;

var DayNam = new Array(
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday");

var MnthNam = new Array(
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"July",
"Aug",
"Sept",
"Oct",
"Nov",
"Dec");
var dateSuffix = "th"
if (myDate == 1 || myDate == 21 || myDate == 31) {dateSuffix = "st";}
if (myDate == 2 || myDate == 22) {dateSuffix =  "nd";}
if (myDate == 3 || myDate == 23) {dateSuffix = "rd";}

myDate = myDate + dateSuffix

if (Hrs < 10) {Hrs = "0" + Hrs;}
if (Mins < 10) {Mins = "0" + Mins;}
var DateIt = DayNam[today.getDay()] + " " + myDate + " " + MnthNam[myMnth];
var TimeIt = Hrs+":"+Mins;
if (DTswitch == 11) {var DateTime = DateIt + "  " + TimeIt;}
if (DTswitch == 10) {var DateTime = DateIt;}
if (DTswitch == 01) {var DateTime = TimeIt;}
window.status=DateTime;
return DateTime
//  End -->
}

function previousMonth()
{
// returns previous month and year - Jan 2004
  // declare variables and assign mnth and year to each

  var now = new Date();
   var mnth = (now.getMonth())-1;

  var year = now.getFullYear();
   if (mnth==-1) { 
   					mnth=11
					year=2001					
				}; 
   
// get actual month name

  if (mnth ==0) mnthName="Jan";
  if (mnth ==1) mnthName="Feb";
  if (mnth ==2) mnthName="March";
  if (mnth ==3) mnthName="April";
  if (mnth ==4) mnthName="May";
  if (mnth ==5) mnthName="June";
  if (mnth ==6) mnthName="July";
  if (mnth ==7) mnthName="Aug";
  if (mnth ==8) mnthName="Sept";
  if (mnth ==9) mnthName="Oct";
  if (mnth ==10) mnthName="Nov";
  if (mnth ==11) mnthName="Dec";

//concatenate all the variables and return to doc.write

  date = mnthName + " " + year;

  return date;
}

function currentDate(){
// Returns current year  - 2004
var time = new Date();
var year=time.getYear();
if (year < 2000)    
year = year + 1900;
return year;
}

function replaceSubstring(inputString, fromString, toString) {

/*
Usage
replaceSubstring("hellothere", "l", "x") = "hexxothere"
replaceSubstring("this is a string", "is", "x") = "thx x a string"
replaceSubstring("Here is a long string", "", "xxx") = "Here is a long string"
replaceSubstring("Here is a long string", " ", "") = "Hereisalongstring"
' The slash is a literal character, so "\\" is a single slash
replaceSubstring("\\mysubdir\\mydatabase.nsf", "\\", "/") = "/mysubdir/mydatabase.nsf"
' If the string is "literal \s\w characters", it must be represented literally like "literal \\s\\w characters"
replaceSubstring("literal \\s\\w characters", "\\", "\\\\") = "literal \\s\\w characters"
replaceSubstring("Getting rid of unwanted words", "unwanted", "unneeded") = "Getting rid of unneeded words"
*/

   // Goes through the inputString and replaces every occurrence of fromString with toString
   var temp = inputString;
   if (fromString == "") {
      return inputString;
   }
   if (toString.indexOf(fromString) == -1) { // If the string being replaced is not a part of the replacement string (normal situation)
      while (temp.indexOf(fromString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(fromString));
         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
         temp = toTheLeft + toString + toTheRight;
      }
   } else { // String being replaced is part of replacement string (like "+" being replaced with "++") - prevent an infinite loop
      var midStrings = new Array("~", "`", "_", "^", "#");
      var midStringLen = 1;
      var midString = "";
      // Find a string that doesn't exist in the inputString to be used
      // as an "inbetween" string
      while (midString == "") {
         for (var i=0; i < midStrings.length; i++) {
            var tempMidString = "";
            for (var j=0; j < midStringLen; j++) { tempMidString += midStrings[i]; }
            if (fromString.indexOf(tempMidString) == -1) {
               midString = tempMidString;
               i = midStrings.length + 1;
            }
         }
      } // Keep on going until we build an "inbetween" string that doesn't exist
      // Now go through and do two replaces - first, replace the "fromString" with the "inbetween" string
      while (temp.indexOf(fromString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(fromString));
         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
         temp = toTheLeft + midString + toTheRight;
      }
      // Next, replace the "inbetween" string with the "toString"
      while (temp.indexOf(midString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(midString));
         var toTheRight = temp.substring(temp.indexOf(midString)+midString.length, temp.length);
         temp = toTheLeft + toString + toTheRight;
      }
   } // Ends the check to see if the string being replaced is part of the replacement string or not
   return temp; // Send the updated string back to the user
} // Ends the "replaceSubstring" function










