

var img;
var img_mo;
var img_cl;
img = new Array();
img_mo = new Array();
img_cl = new Array();


if (location.href.indexOf('print=true') == -1 && location.href.indexOf('singleframe=true') == -1 && top.location.href.indexOf('frameid=') != -1) {
  top.location.href = top.location.href.replace('frameid=', 'framenoid=');
}

function toggleMenu()
{
  var elements = document.getElementsByName('submenu');

  //In IE7 getElementsByName only works for input fields (as it apparantly should be). If there are no elements returned, determine them by tag.
  if (elements.length == 0) {
    var trElements = document.getElementsByTagName('tr');
    var arr = new Array();
    for(i = 0,iarr = 0; i < trElements.length; i++) {
      att = trElements[i].getAttribute("name");
      if(att == 'submenu') {
        arr[iarr] = trElements[i];
        iarr++;
      }
    } 
    elements = arr;
  }
  //

  for(var i = 0; i < elements.length; i++)
  {
    var element = elements[i];
    var display = element.style.display;
    if (display == ''){
      element.style.display = 'none';

    }
    if (display == 'none'){
      element.style.display = '';
    }
  }
}

function setCookie(name, value, expire) {
  if (expire == '') {
    document.cookie = name + '=' + escape(value) + '; path=/';
  } else {
    var expires = new Date();
    expires.setTime(expires.getTime() + expire);

    document.cookie = name + '=' + escape(value) + ((expire == null) ? '' : ('; expires=' + expires.toGMTString())) + '; path=/';
  }
}


function getCookie(name) {
   var search = name + "=";
   var val = "";
   var offset,end;
   
   if(document.cookie.length > 0) { // if there are any cookies
      offset = document.cookie.indexOf(search) 

      if(offset != -1) { // if cookie exists 
         offset += search.length;

         // set index of beginning of value
         end = document.cookie.indexOf(";", offset) 

         // set index of end of cookie value
         if (end == -1) {
            end = document.cookie.length;
         }

         val = unescape(document.cookie.substring(offset, end));
      } 
   }

   return val;
}

function initMo(uniqueid, origImgSrc, overImgSrc, clickImgSrc) {
  if (origImgSrc != '') {
    img[uniqueid] = new Image();
    img[uniqueid].src = origImgSrc;
  }
  if (overImgSrc != '') {
    img_mo[uniqueid] = new Image();
    img_mo[uniqueid].src = overImgSrc;
  }
  if (clickImgSrc != '') {
    img_cl[uniqueid] = new Image();
    img_cl[uniqueid].src = clickImgSrc;
  }
}


function mov(uniqueid) {
  if (img_mo[uniqueid]) {
    document[uniqueid].src = img_mo[uniqueid].src;
  }
}


function mou(uniqueid) {
  if(img[uniqueid]) {
    document[uniqueid].src = img[uniqueid].src;
  }
}


function md(uniqueid) {
  if (img_cl[uniqueid]) {
    document[uniqueid].src = img_cl[uniqueid].src;
  }
}



function showWindow(uniqueid,id,qs,width,height) {
  var windowObj;
  windowObj = eval('top.Info' + uniqueid);

  if (windowObj !=null && (windowObj + "" != "undefined") && !windowObj.closed) {
    windowObj.focus();
  } else {
    windowObj = null;
    windowObj = top.open('/web/show/id=' + id + qs,'Info'+uniqueid,'toolbar=no,width=' + width + ',height=' + height + ',directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no');
    top.name = 'wm';

    if (windowObj != null) {
      windowObj.focus();
    }     
  }
  reload = false;
}

function newSession() {
  if (getCookie('session') == 'set') {
    return false;
  } else {
    setCookie('session', 'set', '');
    if (getCookie('session') == 'set') {
      return true;
    } else {
      return false;
    }
  }
}

