

var img;
var img_mo;
var img_cl;
img = new Array();
img_mo = new Array();
img_cl = new Array();



function setCookie(name, value, expire) {
  if (expire == '') {
    document.cookie = name + "=" + escape(value);
  } 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 = "";

   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 initMouseOver(uniqueid, origImgSrc, overImgSrc, clickImgSrc) {
  img['I' + uniqueid + origImgSrc] = new Image();
  img['I' + uniqueid + origImgSrc].src = origImgSrc;
  img_mo['I' + uniqueid + origImgSrc] = new Image();
  img_mo['I' + uniqueid + origImgSrc].src = overImgSrc;
  img_cl['I' + uniqueid + origImgSrc] = new Image();
  img_cl['I' + uniqueid + origImgSrc].src = clickImgSrc;
}

function MouseOver(imgName) {
  document[imgName].src = img_mo[imgName].src;
}

function MouseOut(imgName) {
  document[imgName].src = img[imgName].src;
}

function MouseDown(imgName) {
  document[imgName].src = img_cl[imgName].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('/vi/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;
}


//Start rightclick blokker
var specialcase = ((navigator.userAgent.indexOf('Mac') != -1) || document.all)
var flag = 0;
var x,y,x1,y1,copyAttempt;

function donothing() {return false};

function special(e)
{
  theObj = '';
  if (window.Event)
  {
    x1 = e.screenX;
    y1 = e.screenY;
    if (e.target.parentNode) theObj = e.target.parentNode.tagName;
  }
  else
  {
    x1 = window.event.clientX;
    y1 = window.event.clientY;
    theObj = window.event.srcElement.parentElement.tagName;
  }
  var isLink = (theObj == 'A');
  if (flag && (!isLink || ((Math.abs(x-x1) > 10) || (Math.abs(y-y1) > 10))))
  {
    copyAttempt = 1;
    flag = 0;
    return false;
  }
}

function checkIt(e)
{
  copyAttempt = 0;
  if (window.Event)
  {
    x = e.screenX;
    y = e.screenY;
    theButt = (e.which == 3);
  }
  else
  {
    x = window.event.clientX;
    y = window.event.clientY;
    theButt = (window.event.button == 2);
  }
  if (theButt)
  {
    copyAttempt = 1;
    flag = 0;
    return false; // NN4 only
  }
  if (specialcase) flag = 1;
  return false;
}

function clearIt()
{
  flag = 0;
  if (copyAttempt)
  {
    copyAttempt = 0;
    return false;
  }
}

function init()
{
  if (!(document.getElementById || document.all || document.layers)) return;
  if (specialcase && document.layers)
  {
    document.captureEvents(Event.MOUSEMOVE);
    document.onmousemove = special;
  }
  for (i=0;i<document.images.length;i++)
  {
    img = document.images[i];
    img.onmousedown = checkIt;
    img.ondrag = donothing;
    img.onmouseup = donothing;
    img.oncontextmenu = donothing;    
    if (specialcase)
    {
      img.onmousemove = special;
      img.onclick = clearIt;
    }
  }
}
//End rightclick blokker