function openNewWin(fileName,winHeight,winWidth,winScroll) {
  if ( arguments.length < 3 ) winWidth = 431;
  if ( arguments.length < 4 ) winScroll = 0;
  openParms = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=";
  openParms += winScroll + ",resizable=1,width=";
  openParms += winWidth + ",height="+winHeight;
  windowName = new String(Math.round(Math.random() * 100000));
  window.open(fileName,windowName,openParms)
}
function addFav() {
  if ((navigator.platform != "MacPPC") && (navigator.appName == "Microsoft Internet Explorer") && (navigator.appVersion >= "4")) {
    window.external.AddFavorite(location.href,document.title);
  }
}
function noHarvest(strUser,strDomain,strExtra,strSubj,strText) {
  if (arguments.length < 4) strSubj = ""; else strSubj = "?subject="+strSubj;
  if (arguments.length < 3) strExtra = "";
  if (strDomain == "" || arguments.length < 2) strDomain = location.host.replace("www.","");
  if (arguments.length < 5) strText = strUser+"@"+strDomain;
  return "<a "+strExtra+" href=\"mailto:"+strUser+"@"+strDomain+strSubj+"\">"+strText+"</a>";
}
function openFull(theURL) {
  window.open(theURL,"fswindow","fullscreen=1,scrollbars=auto");
}
var myWindow;
var popImage;
function openImgWindow(theURL,imgName) {
  var winName = "PopWin";
  var features = "toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=200,height=200"
  popImage = imgName;
  myWindow = window.open(theURL,winName,features);
  setTimeout("myWindow.document.images.popImage.src=popImage;",1000);
}
function createLinksToNewWindow() {
 if (!document.getElementsByTagName) return; 
 var anchors = document.getElementsByTagName("a"); 
 for (var i=0; i<anchors.length; i++) { 
   var anchor = anchors[i]; 
   if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") 
     anchor.target = "_blank"; 
 } 
} 
// -- Allow the multiple onloads
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != "function") {
    window.onload = func;
  } 
  else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}
// -- end allow the multiple onloads
function setActiveMenu() {
  var pageExt = ".htm"; // for .htm and .html
  var cssClassActive = "Active";
  // set styles in CSS
  var sPath = window.location.pathname;
  var sPageId = "";
  if (sPath.lastIndexOf(pageExt) != -1) sPageId = sPath.substring(sPath.lastIndexOf("/") + 1,sPath.lastIndexOf(pageExt));
  if (document.getElementById(sPageId)) {
    document.getElementById(sPageId).className = cssClassActive;
  } else if (sPageId == "" || sPageId.toLowerCase() == "default" || sPageId.toLowerCase() == "index") {
    if (document.getElementById("Home"))
    document.getElementById("Home").className = cssClassActive;
  }
}
addLoadEvent(setActiveMenu)

// -- end allow the multiple onloads
// -- Random image
function image() {};
num = 10;              // <---- Set the number of images here
pref = "images/picture";  // <---- Set the folder and the prefix of the image
ext = ".jpg";         // <---- Set the type of image here
image = new image();
for (var i = 0; i < num; i++) {
  image[i] = pref+i+ext;
}
function dispBgImage() {
  bgImage = image[Math.floor(Math.random() * num)];
  if (document.getElementById("top_space")) {
    document.getElementById("top_space").style.backgroundImage = "url(" + bgImage + ")";
  }
}
addLoadEvent(dispBgImage);
// -- end random image

