portal_url = 'http://www.fbn.nl'


/***********************************************************
 * ShowHideDownloadDescription
   * show desc when they are hidden;
   * hide desc which are shown;
   * change icon plus/minus.
 **********************************************************/
function ShowHideDownloadDescription(id) {
	if (document.getElementById || document.all) {
		img_plus = "images/icon_nav_plus.gif";
		img_minus = "images/icon_nav_minus.gif";
		id_opener = id + "-opener";
		object_opener = document.getElementById(id_opener);
		object = document.getElementById(id);
		object_collapsed = object.style.display;
		if (object_collapsed == 'none') {
			object.style.display = '';
			object_opener.src = img_minus;
		} else {
			object.style.display = 'none';
			object_opener.src = img_plus;
		}
	}
}

/***********************************************************
 * StyleSwitcher
   * a swithcher for ALL browsers?!
 **********************************************************/

// Cookie
function chooseStyle (newstyle){
	var expdate = new Date();
	expdate.setTime(expdate.getTime() + (1000*3600*24*365));
	document.cookie = 'style=' + newstyle + '; expires=' + expdate.toGMTString() + '; path=/';
	//alert ('This style choice will persist for a year unless changed again.');

        try
        {
            // Also reload other frames.
            for(i = 0; i < parent.frames.length; i++)
            {
                if(parent.frames[i] == self)
                    continue;

                parent.frames[i].location = parent.frames[i].location;
            }
        } catch(e) { }

        self.location = self.location;
}

if(document.cookie.indexOf('style=1')>=0) 
  document.write('<link rel="stylesheet" type="text/css" href="styleTextMedium.css">\n');
else if (document.cookie.indexOf('style=2')>=0)
  document.write('<link rel="stylesheet" type="text/css" href="styleTextLarge.css">\n');


/* BELOW CODE NOT USED ANYMORE! ______________________ */


function winOnLoad()
{ 
    var agt=navigator.userAgent.toLowerCase();
    var is_mac    = (agt.indexOf("mac")!=-1);
      if (!is_mac) {
        //initPortlets();
      }
}


function stripLocation() {
  var loc = window.location.href;
  l = loc.split('#')[0]
  return l
}

/***********************************************************
 * initPortlets
 * set open close action on portlets
 **********************************************************/
function initPortlets() {

  // right col only
  rc = xGetElementById('portal-column-two');
  aH = xGetElementsByTagName('h5',rc);  // Headers
  aHbar = xGetElementsByClassName('ACC_portlet_accent',rc);  // Header - accentbars
  aC = xGetElementsByClassName('portletBody',rc); // collapsable body

  for (i = 0; i < aH.length; ++i) {
    h = aH[i]; // sTag element (trigger)
    accentbar = aHbar[i];  
    c = aC[i]; // collapsible element (target)
    if (h && c) {
      parid = h.parentNode.id;
      h.accentBar = accentbar;
      h.collapsibleEle = c;
      cook = xGetCookie('h_' + parid);
      h.collapsed = parseFloat(cook);
      h.onclick = fnOnClick;
      h.id = 'h_' + parid;
      h.onclick();
    }
  }

}

/***********************************************************
 * fnOnClick
 * action on portlet headers
 **********************************************************/
function fnOnClick() {
  var displayVar, title, classNameVar, classAccent;

  if (!(this.collapsed)) {
    displayVar = 'block';
    title = 'verbergen';
    classNameVar = 'open';
    classAccent = 'openAccent';
    cook = 0;
  }
  else {
    displayVar  = 'none';
    title = 'openen';
    classNameVar = 'closed';
    classAccent = 'closedAccent';
    cook = 1;
  }

  xSetCookie(this.id,cook);
  this.className = classNameVar;
  // also accent bar below h5:
  if (!(this.accentBar)) { this.accentBar.className = classAccent; }

  this.collapsibleEle.style.display = displayVar;
  this.setAttribute('title', 'Klik om te ' + title + '.' );
  this.collapsed = !this.collapsed;
}

