
// scripts to preload and swap images
// if (window != window.top) top.location.href = location.href;

// if (location.host == 'bluemantle.co.uk') {
//   location.host = 'www.bluemantle.co.uk';
//}

GoodBrowser = 
  (
   ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 3 )) 
   || 
   ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4 ))
  );
// if (GoodBrowser) alert("good");else alert("NOT good");

// ****** MouseOver Functions ******
// first define images - these are GLOBAL

offImageArray = new Array ;
offImageArray[0] = '/images/fireplaces.gif' ;
//offImageArray[1] = '/images/chimney.gif' ;
//offImageArray[2] = '/images/surround.gif' ;
//offImageArray[3] = '/images/gardenf.gif' ;
//offImageArray[4] = '/images/spares.gif' ;
offImageArray[5] = '/images/contact.gif' ;
//offImageArray[6] = '/images/grates.gif' ;
offImageArray[7] = '/images/home.gif' ;
//offImageArray[8] = '/images/stoves.gif' ;
//offImageArray[9] = '/images/rads.gif' ;
//offImageArray[10] = '/images/statues.gif' ;
//offImageArray[11] = '/images/clocks.gif' ;
offImageArray[12] = '/images/fireplacer.gif' ;
offImageArray[13] = '/images/fireplacea.gif' ;
offImageArray[14] = '/images/accessories.gif' ;
offImageArray[15] = '/images/bricabrac.gif' ;
offImageArray[16] = '/images/baskets.gif' ;
offImageArray[17] = '/images/discount.gif' ;
offImageArray[18] = '/images/tiles.gif' ;

onImageArray  = new Array ;
for (var i = 0 ; i < offImageArray.length ; i ++) {
  if (offImageArray[i] != null) {
    insertPoint = offImageArray[i].indexOf(".gif") ;
    onImageArray[i] = offImageArray[i].substring(0,insertPoint) + "o.gif";
  }
}

MsgArray = new Array ;
MsgArray[0] = 'Fireplace gallery' ;
//MsgArray[1] = ' ' ;
//MsgArray[2] = ' ' ;
MsgArray[3] = 'Garden Furniture and Chimney Pots' ;
MsgArray[4] = 'Fireplace spare parts' ;
MsgArray[5] = 'Contact Blue Mantle Fireplaces and Antiques' ;
MsgArray[6] = 'Dog grates' ;
MsgArray[7] = 'Blue Mantle Home Page' ;
MsgArray[8] = 'Stoves and Cooking Ranges' ;
MsgArray[9] = 'Radiators' ;
MsgArray[10] = 'Statues' ;
MsgArray[11] = 'Clocks' ;
MsgArray[12] = 'Reproduction Fireplaces, Arched Inserts, Tiled Inserts, Fireplace Surrounds'
MsgArray[13] = 'Antique Fireplaces, Antique Stoves, Antique Ranges'
MsgArray[14] = 'Accessories, Tiles, Gas Kits, Fire Guards, Fire Screens, Buckets, Fenders, Companion Sets, Mirrors'
MsgArray[15] = 'Bric-a-Brac, Statues, Clocks, Garden Furniture, Chimney Pots';
MsgArray[16] = 'Dogs, Baskets, Fire Backs';
MsgArray[17] = 'Discount Voucher';
MsgArray[18] = 'Tiles by Stovax and other leading manufacturers';

function preload() {
  var temp = new Array();
  for (var i = 0 ; i < offImageArray.length ; i ++) {
    if (offImageArray[i] != null) {
      temp[i]     = new Image();
      temp[i].src = onImageArray[i];
    }
  }
}

function swapImage(OnOff,ImageIndex,ImageName) {
  if (GoodBrowser) {
    // alert(OnOff + " - " + ImageIndex + " - " + ImageName)
    if (OnOff == "ON") {
       document[ImageName].src = onImageArray[ImageIndex] ;
       dm(MsgArray[ImageIndex]) ;
    }
    else {
       document[ImageName].src = offImageArray[ImageIndex] ;
       dm(" ") ;
    }
  }
  return true ;
}

function dm(theMsg) {
//  document.returnValue = false;
  if (GoodBrowser) {
     window.status = theMsg;
//     document.returnValue = true;
  }
}

// script to display the last updated timestamp
function updated() {
  document.writeln("Last Updated: ")
  // Get the date that the requested URL (not this document) was modified
  // Note that LAST_MODIFIED is returned in LOCAL TIME!! 
  
  document.writeln(GMTtime('Tuesday, 04 Nov 2003 17:38:49 ','GMT') + "<br />")
}

function GMTtime(a,tz) {
  // alert(a+" TZ="+tz) ; // diagnostic
  if (a.substring(0,1) == "<") {return (document.lastModified) }
  var GMTDate = new Date();
  var timeZone = tz;
  if (timeZone.length != 3) {
    var milliSeconds = Date.parse(a); // probably windows so ignore TZ
  }
  else if (tz == 'BST') {
    var milliSeconds = Date.parse(a+" GMT")
    milliSeconds -= 3600000
  } else {
    // the following will ONLY work IF 
    // tz=GMT, EST, EDT or other US time zones
    var milliSeconds = Date.parse(a+" "+tz);
  }
  GMTDate.setTime(milliSeconds)
  return(GMTDate.toGMTString())
}
