/* Begin cookie handling code for user tracking */
function getCookie(name) {
   	var cname = name + "=";
	var dc = document.cookie;
	if (dc.length > 0) {
		begin = dc.indexOf(cname);
		if (begin != -1) {
			begin += cname.length;
			end = dc.indexOf(";", begin);
			if (end == -1) end = dc.length;
				return unescape(dc.substring(begin, end));
		}
	}
	return null;
}	

function setCookie(name, value, expires) {
	document.cookie = name + "=" + escape(value) + "; path=/" + ((expires == null) ? " " : "; expires=" + expires.toGMTString());
}

function delCookie(name) {
	document.cookie = name + "=; expires=Thu, 01-Jan-70 00:00:01 GMT" + "; path=/";
}

if (getCookie("mycookie") == null) {
	var exp = new Date();
	exp.setTime(exp.getTime() + (24 * 60 * 60 * 1000 * 180));
	var today = new Date();
	id = today + "_" + Math.floor((Math.random() * 1000));
	setCookie("mycookie", id, exp);
	//document.write("The value of the cookie is: " + id);
}
/* End cookie handling for user tracking */

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;
}

function printer() {
  document.location=document.location+"?print=on";
}

function printMode() {
  if (String(document.location).match("print=on")) {
    document.write('<body><link rel="stylesheet" href="/nr/internet_2004/css/print.css" />');

  }
}

// --- ----------------------------------------------- ----			  

function emailpopup() {
  myWindow = window.open("http://register.informatica.com/email_friend/email_a_friend_fr.asp?referer=" + window.location, "email_friend", 'width=300,height=300');
}
			  
loadedjs = true;
