function showImage(Image_Id,Image_File) {
    document.images[Image_Id].src = Image_File;
    }

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
  }

/*
  Consente l'emissione di indirizzi e-mail nascosti
*/
function WrtLinkEmail(depart) {
  var sMailTo = "<a href=\"" + "mai" + "lto:" + "info@" +
                "totemadventure" + ".com\"" + ">info" + "@totemadventure" + ".com</a>";
  if (depart) {
    switch(depart) {
//case  TOTEM
      case "contatto1": {
        sMailTo = "<a href=\"" + "mai" + "lto:" + "info@" +
                  "totemadventure" + ".com\"" + ">info" + "@totemadventure" + ".com</a>";
        break;
      }
      case "contatto2": {
        sMailTo = "<a href=\"" + "mai" + "lto:" + "webmaster@" +
                  "totemadventure" + ".com\"" + ">webmaster" + "@totemadventure" + ".com</a>";
        break;
      }
      case "contatto3": {
        sMailTo = "<a href=\"" + "mai" + "lto:" + "segreteria@" +
                  "totemadventure" + ".com\"" + ">segreteria" + "@totemadventure" + ".com</a>";
        break;
      }
//case  RIVERRESCUE.it
      case "river-it1": {
        sMailTo = "<a href=\"" + "mai" + "lto:" + "info@" +
                  "riverrescue" + ".it\"" + ">info" + "@riverrescue" + ".it</a>";
        break;
      }
      case "river-it2": {
        sMailTo = "<a href=\"" + "mai" + "lto:" + "webmaster@" +
                  "riverrescue" + ".it\"" + ">webmaster" + "@riverrescue" + ".it</a>";
        break;
      }
      case "river-it3": {
        sMailTo = "<a href=\"" + "mai" + "lto:" + "segreteria@" +
                  "riverrescue" + ".it\"" + ">segreteria" + "@riverrescue" + ".it</a>";
        break;
      }
//case  RIVERRESCUE.eu
      case "river-eu1": {
        sMailTo = "<a href=\"" + "mai" + "lto:" + "info@" +
                  "riverrescue" + ".eu\"" + ">info" + "@riverrescue" + ".eu</a>";
        break;
      }
      case "river-eu2": {
        sMailTo = "<a href=\"" + "mai" + "lto:" + "webmaster@" +
                  "riverrescue" + ".eu\"" + ">webmaster" + "@riverrescue" + ".eu</a>";
        break;
      }
      case "river-eu3": {
        sMailTo = "<a href=\"" + "mai" + "lto:" + "segreteria@" +
                  "riverrescue" + ".eu\"" + ">segreteria" + "@riverrescue" + ".eu</a>";
        break;
      }
    }
  }
  document.write(sMailTo);
}

/*
  Consente l'emissione di testo. Attenzione! usa una classe "testopiccolo"
*/
function WrtYouAreHere(sText) {
  var sSteps = "";
  var sBefore = "<p><span class=\"" + "testop\"" + "><em>You are here: ";
  var sAfter =  "</em></span></p>";
  if (sText) {
    sSteps = sBefore + sText + sAfter;
  }
  document.write(sSteps);
}

/*
  Consente l'emissione di testo nel footer
*/
function WrtUpdFooter(sLang) {
  var sSteps = "";
  var sCreative = "<a href=\""+ "http://creativecommons.org/licenses/by-nc-nd/2.5/it/\""+" target=\""+"_blank\""+" rel=\""+"license\""+" title=\""+"Apre una nuova finestra\""+"><img alt=\""+"Creative Commons License\""+" src=\""+"http://creativecommons.org/images/public/somerights20.png\""+"/></a>";
  var sXhtml = "<a href=\""+"http://validator.w3.org/check?uri=referer\""+">" + "<img style=\""+"border:0;width:88px;height:31px;margin-top:4px;margin-left:5px\""+" src=\""+"http://www.w3.org/Icons/valid-xhtml10\""+" alt=\""+"Valid XHTML 1.0 Transitional\""+" />" + "</a>"
  var sCss =   "<a href=\""+"http://jigsaw.w3.org/css-validator/\""+">" + "<img style=\""+"border:0;width:88px;height:31px;margin-top:4px;margin-left:5px\""+" src=\""+"http://jigsaw.w3.org/css-validator/images/vcss\""+" alt=\""+"CSS Valido!\""+" />" + "</a>"
  var sBefore = "<strong><font style=\"" + "font-family:verdana;font-size:10px\"" + ">";
  var sAfter =  "</font></strong>";
  var sText = "Totem Adventure";
  var sLangLcase = "it";
  if (sLang) {sLangLcase = sLang.toLowerCase();}
  if (sLangLcase == "it") {
    sText = "S.A.F.E.&trade; - Soccorso Alluvionale e Fluviale Europa";
  } else {
    sText = "S.A.F.E.&trade; - Swiftwater And Flood education Europe - River Rescue School";
  }
    sText = sText + " - Totem Adventure Group" + " &copy;" + (ReturnYear()-3) + "-" + (ReturnYear());
//  sSteps = sCreative + sXhtml + sCss + sBefore + sText + sAfter;
  sSteps = sBefore + sText + sAfter;
  document.write(sSteps);
}

/*
  Emette la data
*/
function WrtDate() {
  var today = ReturnDate();
  document.write("" +today+ ".");
}

/*
  Ritorna anno data
*/
function ReturnYear() {
  // Get today's current date.
  var now = new Date();
  var curYear = FourDigits(now.getYear());
  return curYear;
}

/*
  Calculate four digit year.
*/
function FourDigits(number)	{
  return (number < 1000) ? number + 1900 : number;
}

/*
  Ritorna data
*/
function ReturnDate() {
  // Get today's current date.
  var now = new Date();
  // Array list of days.
  var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
  // Array list of months.
  var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
  // Calculate the number of the current day in the week.
  var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();
  // Join it all together
  var today = days[now.getDay()] + ", " +
              (ReturnYear()) + " " +
               months[now.getMonth()] + " " +
               date ;
  return today;
}

/*
  apre una finestra centrandola
You could also enhance this function to allow height and width to be percentage values. For example, if you want the window to be one half the screen width, then you could pass in 0.5 for the width. If you would like to do that, then you have to calculate the actual width and height based on the percentages. To do that, add these two lines as the first lines in the function:
   if (height <= 1) { height = Math.floor(screen.height * height); }
   if (width <= 1) { width = Math.floor(screen.width * width); }

If the value passed in is less than or equal to one, the height or width is adjusted to be that percentage of the screen size.
*/
function OpenCenteredWindow(url, widthn, heightn, name, parms) {
  var nWidth = 640;
  var nHeight = 480;
  if (widthn && typeof(widthn) == 'number') {nWidth=widthn;}
  if (heightn && typeof(heightn) == 'number') {nHeight=heightn;}
  var left = Math.floor( (screen.width - nWidth) / 2);
  var top = Math.floor( (screen.height - nHeight) / 2);
  var winParms = "top=" + top + ",left=" + left + ",height=" + nHeight + ",width=" + nWidth;
  if (parms) { winParms += "," + parms; }
  var win = window.open(url, name, winParms);
  if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
  return win;
}

/*
  apre una finestra
*/
function OpenWindow(url, name, parms) {
   var winParms = "";
   if (parms) { winParms += parms; }
   var win = window.open(url, name, winParms);
   if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
   return win;
}

/*
  apre un POPuP centrato
*/
function OpenPopUpCenter(mylink, windowname, widthn, heightn, parms) {
  if (!window.focus)return true;
  var href;
  if (typeof(mylink) == 'string') {href=mylink;} else {href=mylink.href;}
  var nWidth = 640;
  var nHeight = 480;
  if (widthn && typeof(widthn) == 'number') {nWidth=widthn;}
  if (heightn && typeof(heightn) == 'number') {nHeight=heightn;}
  var left = Math.floor( (screen.width - nWidth) / 2);
  var top = Math.floor( (screen.height - nHeight) / 2);
  var winParms = "top=" + top + ",left=" + left + ",height=" + nHeight + ",width=" + nWidth;
  if (parms) {winParms += "," + parms;}
  window.open(href, windowname, winParms);
  return false;
}

/*
  apre un POPuP centrato
*/
function OpenPopUp(mylink, windowname, parms) {
  if (!window.focus)return true;
  var href;
  if (typeof(mylink) == 'string') {
    href=mylink;
  } else {
    href=mylink.href;
  }
  var winParms = 'width=640,height=480,scrollbars=yes';
  if (parms) {winParms = parms;}
  window.open(href, windowname, winParms);
  return false;
}

/*
  impone il focus alla finestra (da usare insieme agli Openxxxx: letto su rivista)
  nella sezione header mettere
  <SCRIPT TYPE="text/javascript">
  <!--
    WinGetFocus(); oppure window.focus();
  //-->
  </SCRIPT>
*/
function WinGetFocus() {
  window.focus();
}

/*
 show an element
 changeObjectVisibility('myObjectId', 'visible');

 hide an element
 changeObjectVisibility('myObjectId', 'hidden');
*/
function changeObjectVisibility(objectId, newVisibility) {
  var styleObject = getStyleObject(objectId, document);
  if(styleObject) {
    styleObject.visibility = newVisibility;
    return true;
  } else {
    return false;
  }
}

/*

*/
function getStyleObject(objectId) {
  if(document.getElementById && document.getElementById(objectId)) {
    return document.getElementById(objectId).style;
  } else if (document.all && document.all(objectId)) {
    return document.all(objectId).style;
  } else if (document.layers && document.layers[objectId]) {
    return getObjNN4(document,objectId);
  } else {
    return false;
  }
}

/*

*/
function getObjNN4(obj,name) {
  var x = obj.layers;
  var foundLayer;
  for (var i=0;i<x.length;i++) 	{
    if (x[i].id == name)
      foundLayer = x[i];
    else if (x[i].layers.length)
      var tmp = getObjNN4(x[i],name);
      if (tmp) foundLayer = tmp;
  }
  return foundLayer;
}