<!--
////////////////////////////////////////////////////////////////////////////////
// 
// $RCSfile: utilities.js,v $
// $Revision: 1.3 $
// $Date: 2001/12/31 01:49:51 $
//
// Description:  this file contains some functions for image management
//               NOTE: the script tag which includes this file "must"
//                     specify "JavaScript1.1" in the language attribute!
//
// Language:     JavaScript 1.1
//
////////////////////////////////////////////////////////////////////////////////

var _JSI = true;

// ************************************************************
// *** browser type query
// ***

version = parseInt(navigator.appVersion);
if (navigator.appVersion.indexOf('MSIE 5.') > -1)
  version = 5;
browser = 'OTHER';
if (navigator.appName == 'Netscape')
  browser = 'NS' + version;
if (navigator.appName == 'Microsoft Internet Explorer')
  browser = 'IE' + version;
if (navigator.appVersion.indexOf('MSIE 3') > 0)
  browser = 'IE3';

// ************************************************************
// *** load style sheet according to specific browser
// ***

var stylePath = "";
if (browser == 'NS4') {
  if (self.name != "MoTypeGuestBook") {
    stylePath = '<link rel="stylesheet" type="text/css" href="./styles/motype_ns4.css" />';
  }
  else {
    stylePath = '<link rel="stylesheet" type="text/css" ' +
                'href="http://www.motype.com/oldpages/styles/motype_ns4_gb.css" />';
  }
}
else {
  if (self.name != "MoTypeGuestBook") {
    stylePath = '<link rel="stylesheet" type="text/css" href="./styles/motype.css" />';
  }
  else {
    stylePath = '<link rel="stylesheet" type="text/css" ' +
                'href="http://www.motype.com/oldpages/styles/motype_gb.css" />';
  }
}
document.writeln(stylePath);

// ************************************************************

function unframe() {
  // in the case that the page is displayed in a frame, remove the frame
  if (top.location != self.location) { // page is "framed"
    top.location = self.location;
  }
}

// variables for arrays for the picture sets (normal & highlighted)
var bhome;
var bnews;
var bbandinfo;
var bsongs;
var bphotos;
var bpress;
var bmailform;
var bguestbook;
var blinks;
var bunframe;

function preload(pname, normalPic, highlightedPic, statusText) {
  // execute only if browser supports Image objects (JavaScript 1.1)
  if (_JSV >= 1.1) {
    self[pname] = new Array(4);
    self[pname][0] = new Image();
    self[pname][1] = new Image();
    self[pname][0].src = normalPic;
    self[pname][1].src = highlightedPic;
    self[pname][2] = statusText;
  }
}

function highlight(pname) {
  // execute only if browser supports Image objects (JavaScript 1.1)
  if (_JSV >= 1.1) {
    window.status = self[pname][2];
    document.images[pname].src = self[pname][1].src;
  }
}

function reset(pname) {
  // execute only if browser supports Image objects (JavaScript 1.1)
  if (_JSV >= 1.1) {
    window.status = "";
    document.images[pname].src = self[pname][0].src;
  }
}

function jump2anchor(targetAnchor) {
  self.location.hash = targetAnchor.substring(1, targetAnchor.length);
}

// only jump if if no anchor at all is contained in the URL (conditional)
function cjump2anchor(targetAnchor) {
  if (window.location.hash == "") {
    jump2anchor(targetAnchor);
  }
}

// overwrite possible guestbook function
// that is called with the onLoad event
function changeBannerContent(first)
{
  //  unframe();
  cjump2anchor("#top");
  eval(loadCommands);
}

// open a press article in a new window
// function openArticle(picWidth, picHeight, picURL) {
// 	 var optStr='toolbar=1,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=' + (picWidth + 40) + ',height=' + (picHeight + 40)
// 	 window.open(picURL,'articleWindow',);
// }
// -->

// function open() {}
// function yfEA() {}

////////////////////////////////////////////////////////////////////////////////
//
// Code for Handling of "arrowup" Rollovers
//
////////////////////////////////////////////////////////////////////////////////

// preload rollover image
var arrow_up_rollover = new Image();
arrow_up_rollover.src = "./pics/arrow_up_hi.gif";

var newArrowIdx = 0;

function createArrowUp() {
  var site = "./";
  if (arguments.length == 1) {
 site = arguments[0];
  }
  imgOffPath = site + "pics/arrow_up.gif";
  imgOnPath  = site + "pics/arrow_up_hi.gif";
 
  document.write("<a href=\"#top\" onMouseOver=\"document.images[" + '\'arrow_up_');
  document.write(newArrowIdx + '\'].src=\'' + imgOnPath  + '\'; ');
  document.write('window.status=\'- Top of Page -\'; ' + "return true;\" ");
  document.write("onMouseOut=\"document.images[" + '\'arrow_up_');
  document.write(newArrowIdx + '\'].src=\'' + imgOffPath + '\'; ');
  document.write('window.status=\'\'; ' + "return true;\" class=\"arrowup\">");
  document.write("<img src=\"" + imgOffPath + "\" name=\"arrow_up_");
  document.write(newArrowIdx + "\" alt=\"[up]\" class=\"arrowup\" ");
  document.write("border=\"0\" height=\"20\" width=\"20\"></a>");

  newArrowIdx++;
}
