

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) + '; 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('/corporate/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;
    }
  }
}



/* ------------------------------------------ */
/*	Code added for splashpage                  */
/* ------------------------------------------ */

initSplashPage = function() {
	// checks if 'splashpage'-cookie is present
	// if cookie is present, then do nothing, else redirect to splash-page with
	// current url as parameter and set splash-cookie
	
	if (getCookie('splashpage') == '') {
		// set cookie with long expiration date
		setCookie('splashpage', 'true', (3 * 365 * 24 * 60 * 60 * 1000));  // 3 years from now
		
		// redirect to splashpage with current url as parameter
		document.location.href = '/splashpage/?url=' + escape(document.location.href);
	}
}

// call handler
initSplashPage();