// neurotix.com web site - javascript library
// By Jenner Fusari
// Version: 2.0
// Support for:
//   - Netscape Navigator 4.x
//   - Microsoft Internet Explorer 4.x
//   - Microsoft Internet Explorer 5.x
//   - Netscape Navigator 6.x
//   - Mozilla Mxx

var bvers = navigator.appVersion;
var bname = navigator.appName;
var expDays = 30;
var exp = new Date();
var n = 0; // 1: Netscape Navigator 4.x 
var ie = 0; // 1: Microsoft Internet Explorer 4.x
var bw6 = 0; // 1: Microsoft Internet Explorer 5.x o Netscape Navigator 6.x
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

if (document.all)            {n=0;ie=1;bw6=0;};
if (document.layers)         {n=1;ie=0;bw6=0;};
if (document.getElementById) {n=0;ie=0;bw6=1;};

if (bvers.substring(0,1) < 4) {oldbrowser=1;}
else {if (bname == 'Opera') {oldbrowser=1;} else {oldbrowser=0}};

function showLayers (nomelayer) {
if (bw6) {document.getElementById(nomelayer).style.visibility="visible";};
if (n) {document.layers[nomelayer].visibility="show"};
if (ie) {document.all[nomelayer].style.visibility="visible";}
};

function hideLayers (nomelayer) {
if (bw6) {document.getElementById(nomelayer).style.visibility="hidden";};
if (n) {document.layers[nomelayer].visibility="hide";};
if (ie) {document.all[nomelayer].style.visibility="hidden";};
};

function activeCell (cellname) {
if (n) {document.layers[cellname].bgColor="404055";};
if (bw6) {document.getElementById(cellname).style.backgroundColor="404055"};
};

function inactiveCell (cellname) {
if (n) {document.layers[cellname].bgColor="000000";};
if (bw6) {document.getElementById(cellname).style.backgroundColor="000000"};
};

function setmarker(){
  SetCookie ('neurotix', currPage, exp);
};

function gotomarker (){
  var markedPage = GetCookie('neurotix');
  if (markedPage != null) {parent.location.href=markedPage;}
  else {parent.location.href='index.phtml';};
};

function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
  endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
};

function GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
  var j = i + alen;
  if (document.cookie.substring(i, j) == arg)
  return getCookieVal (j);
  i = document.cookie.indexOf(" ", i) + 1;
  if (i == 0) break;
  }
  return null;
};

function SetCookie (name, value) {
  var argv = SetCookie.arguments;
  var argc = SetCookie.arguments.length;
  var expires = (argc > 2) ? argv[2] : null;
  var path = (argc > 3) ? argv[3] : null;
  var domain = (argc > 4) ? argv[4] : null;
  var secure = (argc > 5) ? argv[5] : false;
  document.cookie = name + "=" + escape (value) +
  ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
  ((path == null) ? "" : ("; path=" + path)) +
  ((domain == null) ? "" : ("; domain=" + domain)) +
  ((secure == true) ? "; secure" : "");
};

function DeleteCookie (name) {
  var exp = new Date();
  exp.setTime (exp.getTime() - 1);
  var cval = GetCookie (name);
  document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
};

function openSiteMap (callingpage,lang) {
  if (bw != 0) {if (lang == "i") {window.open("map-i.phtml?capage="+callingpage, "neurotixmap", "width=220,height=430,scrollbars,left=30,top=30");}
          else {window.open("map-e.phtml?capage="+callingpage, "neurotixmap", "width=220,height=430,scrollbars,left=30,top=30");}}
  else {if (lang == "i") {window.open("map-i.phtml?capage="+callingpage, "neurotixmap", "width=220,height=430,scrollbars,left=30,top=30");}
        else {window.open('map-e.phtml?capage='+callingpage, 'neurotixmap', 'width=220,height=430,scrollbars,left=30,top=30');}};
};

function openPage (mypage,pgname,pgopt) {
  window.open(mypage,pgname,pgopt);
};
