var loadedjs = false;

function plato(arg) {
  var rslt;
  if (document.getElementById) rslt = document.createElement('img');
  else rslt = new Image();
  rslt.src = arg;
  return rslt;
}

function showDivs(divId) {
  for (var i=0; i<divs.length; i++) {
    if (divId != divs[i]) toggleVisibility(divs[i],'hidden');
  }
  toggleVisibility(divId,'visible');
}

function toggleVisibility() {
  var inc, endInc=arguments.length;
  for (inc=0; inc<endInc; inc+=2) {
    var id = arguments[inc];
    if (arguments[inc+1] == 'hidden') param = "hidden";
    else if(arguments[inc+1]=='visible') param = "visible";
    if (document.layers) document.layers['container'].layers[id].visibility = param;
    else if (document.all) eval("document.all." + id + ".style.visibility = \"" + param + "\"");
    else if (document.getElementById) eval("document.getElementById(id).style.visibility = \"" + param + "\"");
  }
}


function changeImages() { 
  if (loadedjs && preloadFlag) { 
    for (var i=0; i<changeImages.arguments.length; i+=2) {
    var name = changeImages.arguments[i];
    if (typeof document[name] != "undefined") {
        document[name].src = changeImages.arguments[i+1];
    }
    }
  }
} 

function preloadImages() { 
  var imgFiles = preloadImages.arguments; 
  for (var i=0; i<imgFiles.length; i+=2) { 
    window[imgFiles[i]] = plato(imgFiles[i+1]);
    window[imgFiles[i]].src = imgFiles[i+1]; 
  } 
  preloadFlag = true; 
}

preloadImages('products','/images/topnav/products_over.gif',
              'solutions','/images/topnav/solutions_over.gif',
              'services','/images/topnav/services_over.gif',
              'customers','/images/topnav/customers_over.gif',
              'partners','/images/topnav/partners_over.gif',
              'news','/images/topnav/news_over.gif',
              'events','/images/topnav/events_over.gif',
              'company','/images/topnav/company_over.gif'
              ); 

// --- Functions relating to the Printer Friendly page ----
function go_back() {
// Due to issues with history.go(-1) and certain browsers not recognizing the 
// '?print=on' argument as a different page, this code simulates the 'back'
// functionality.
  var test=String(document.location).substring(0,String(document.location).indexOf("print=on"))
  if (test.charAt(test.length-1)=='?') {test=test.substring(0,test.length-1);}
  document.location=test;
}

		  
loadedjs = true;

