var cookiename = "ssp";
var today = new Date();
var cookie_expire_date = new Date(today.getTime() + (8 * 7 * 86400000));


function Set_Cookie(name,value,expires,path,domain,secure) {
    document.cookie = name + "=" +escape(value) +
        ( (expires) ? ";expires=" + expires.toGMTString() : "") +
        ( (path) ? ";path=" + path : "") + 
        ( (domain) ? ";domain=" + domain : "") +
        ( (secure) ? ";secure" : "");
}

function Get_Cookie(name) {
    var start = document.cookie.indexOf(name+"=");
    var len = start+name.length+1;
    if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
    if (start == -1) return null;
    var end = document.cookie.indexOf(";",len);
    if (end == -1) end = document.cookie.length;
    return unescape(document.cookie.substring(len,end));
}


function sh(dId){
	var imgId = "img"+dId;
	
	if(	document.getElementById(dId).className == "b_ch" ){
		document.getElementById(dId).className = "b_c";
		document.getElementById(imgId).src="images/min.gif";
		document.getElementById(imgId).alt="Verklein dit venster ...";

		var add = Get_Cookie(cookiename);
		var cookiestring = add.replace("|"+dId, "");
		Set_Cookie(cookiename, cookiestring, cookie_expire_date, "/", "", "");
	}
	else{
		document.getElementById(dId).className = "b_ch";
		document.getElementById(imgId).src="images/plus.gif";
		document.getElementById(imgId).alt="Vouw dit venster uit ...";

		var add = Get_Cookie(cookiename);
		if(add != null){
			var cookiestring = add.replace("|"+dId, "");
			var cookiestring = cookiestring+"|"+dId;
		}
		else{
			var cookiestring = "|"+dId;
		}
		Set_Cookie(cookiename, cookiestring, cookie_expire_date, "/", "", "");
	}
}

function closeOnload(){
	var ids = Get_Cookie(cookiename);
	if(ids != null){
		var ids_array = ids.split("|");
		for(i = 1; i < ids_array.length; i++){
			var imgId = "img"+ids_array[i];
			if(document.getElementById(ids_array[i]) != undefined){
				document.getElementById(ids_array[i]).className = "b_ch";
				document.getElementById(imgId).src="images/plus.gif";
				document.getElementById(imgId).alt="Vouw dit venster uit ...";
			}
		}
	}
}

function delc(){
	var today = new Date();
	var cookie_expire_date = new Date(today.getTime() + (8 * 7 * 86400000));
	Set_Cookie("closed", "", cookie_expire_date, "/", "", "");
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

window.onload = function(e) {
  closeOnload();
}

