
if (document.images) {
//Leftbar images  
  img01 = new Image();
  img01.src = "http://www.goodfund.org/postcodelottery/www/buttons/buttons_01.jpg";
  img012 = new Image();
  img012.src = "http://www.goodfund.org/postcodelottery/www/buttons/pbuttons_01.jpg";
  
  img02 = new Image();
  img02.src = "http://www.goodfund.org/postcodelottery/www/buttons/buttons_02.jpg";
  img022 = new Image();
  img022.src = "http://www.goodfund.org/postcodelottery/www/buttons/pbuttons_02.jpg";
  
  img03 = new Image();
  img03.src = "http://www.goodfund.org/postcodelottery/www/buttons/buttons_03.jpg";
  img032 = new Image();
  img032.src = "http://www.goodfund.org/postcodelottery/www/buttons/pbuttons_03.jpg";
}
function OnImage(name) {
	if (document.images) {
		fullname = eval(name + "2");
		document[name].src = fullname.src;
	}
}
function OffImage(name) {
  if (document.images) {
    fullname = eval(name);
	if (fullname.complete) {
      document[name].src = fullname.src;
	}
  }
}

function OpenNewWin(theURL,winName,features) {
  //alert(theURL);
  var newWin = window.open(theURL,winName,'status=yes,scrollbars=yes,resizable=no,width=585,height=580');
  //var newWin = window.open(theURL,winName,'width=585,height=580');
  newWin.focus();
}


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 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;
    }
  }
}


function getNPLDateString() {

  today = new Date();

  today_day_num = today.getDay();
  today_day_str = '';
  switch (today_day_num){
   case 1 : today_day_str = 'Monday'; break;
   case 2 : today_day_str = 'Tuesday'; break;
   case 3 : today_day_str = 'Wednesday '; break;
   case 4 : today_day_str = 'Thursday '; break;
   case 5 : today_day_str = 'Friday'; break;
   case 6 : today_day_str = 'Saturday'; break;
   default : today_day_str = 'Sunday';
  }

  today_mon_num = today.getMonth();
  today_mon_str = '';
  switch (today_mon_num){
   case 0 : today_mon_str = 'January'; break;
   case 1 : today_mon_str = 'February'; break;
   case 2 : today_mon_str = 'March'; break;
   case 3 : today_mon_str = 'April'; break;
   case 4 : today_mon_str = 'May'; break;
   case 5 : today_mon_str = 'June'; break;
   case 6 : today_mon_str = 'July'; break;
   case 7 : today_mon_str = 'August'; break;
   case 8 : today_mon_str = 'September'; break;
   case 9 : today_mon_str = 'October'; break;
   case 10 : today_mon_str = 'November'; break;
   default : today_mon_str = 'December';
  }

  return (today_day_str + ' ' + today.getDate() + ' ' + today_mon_str + ' ' + today.getFullYear());
}


// Warn users of mac os and old browsers
if (navigator && navigator.appVersion && (navigator.appVersion.indexOf("Macintosh") != -1)) {
  if (navigator.appVersion.indexOf("MSIE 5.0")>0) {
    // Check if we've warned this user before
    if(document && document.cookie && (document.cookie.indexOf("MacAlert")==-1)) {
      alert("Deze website is geoptimaliseerd voor:\n\n-Apple computer met Safari, OS 10\n-Windows computer met Internet Explorer 5.5 en hoger");
      // And set a cookie to prevent the warning from popping up on every page
      document.cookie= "MacAlert=true";
    }
  }
}
