// ------------------------------------------------------------
// Program : utilities.js
// Authors : A Wonderful Choice Ltd
// Created : Dec 2000
// Modifications 
// Date   Who   What
// 01.12.00 JME Initial version
// ------------------------------------------------------------

// Common Javascript file for Fly Ties

//Get system date month
function getCurrentMonth()
{
  var today = new Date();
  return today.getMonth();
}

//Work out file that equates to month - note months go from 0 to 11
function getMonthFile()
{
  var currentMonth = getCurrentMonth();  
  if (currentMonth == "0") {
    return "jackbasic";
  }
  else if (currentMonth == "1") {
    return "hare";
  }
  else if (currentMonth == "2") {
    return "swblue";
  }
  else if (currentMonth == "3") {
    return "embuz1";
  }
  else if (currentMonth == "4") {
    return "embuz2";
  }
  else if (currentMonth == "5") {
    return "embuz3";
  }
  else if (currentMonth == "6") {
    return "bewlor";
  }
  else if (currentMonth == "7") {
    return "damsel";
  }
  else if (currentMonth == "8") {
    return "eurohop";
  }
  else if (currentMonth == "9") {
    return "redoct";
  }
  else if (currentMonth == "10") {
    return "murrough";
  }
  else if (currentMonth == "11") {
    return "dandy";
  }
  else {
    return "close";

  }
}


//Check for client Browser
function browserCheck()
{
  if (navigator.appName.indexOf("Netscape") != -1) {
    return "NN";
  }
  else if (navigator.appName.indexOf("Microsoft") != -1) {
    return "IE";
  }
}


//Check for a not null String
function isBlank(strToCheck)
{
  for (var i = 0; i < strToCheck.length; i++)
    {
      var chrToCheck = strToCheck.charAt(i);
      if ((chrToCheck != ' ') && (chrToCheck != '\n') && (chrToCheck != '\t'))
        return false;
    }
  return true;
}

/* Function that swaps images. */
/* Fireworks generated for rollovers */

function di20(id, newSrc) {
    var theImage = FWFindImage(document, id, 0);
    if (theImage) {
        theImage.src = newSrc;
    }
}

/* Functions that track and set toggle group button states. */

function FWFindImage(doc, name, j) {
    var theImage = false;
    if (doc.images) {
        theImage = doc.images[name];
    }
    if (theImage) {
        return theImage;
    }
    if (doc.layers) {
        for (j = 0; j < doc.layers.length; j++) {
            theImage = FWFindImage(doc.layers[j].document, name, 0);
            if (theImage) {
                return (theImage);
            }
        }
    }
    return (false);
}

