function lightswitch(boxId,buttonId,mode) {
	var cookstyle = Cookie.get('LightStatus');
	if(boxId == null) boxId = 'lights-off';
	if(buttonId == null) buttonId = 'buttonLink';
	var bgbox = document.getElementById(boxId);
	var buttonbox = document.getElementById(buttonId);
	if (cookstyle == false) {
		cookstyle = '0';
		Cookie.set('LightStatus', cookstyle, {duration:365, path:"/"});
	}
	if(mode == 'set') {
		if(cookstyle == '0') {
			cookstyle = '1';
		} else {
			cookstyle = '0';
		}
	}
	Cookie.set('LightStatus', cookstyle, {duration:365, path:"/"});
	if (cookstyle == "0") {
		// lights off
		// - set css
		bgbox.style.display = 'block';
		bgbox.style.width = '100%';
		bgbox.style.height = '10000px';
		buttonbox.style.left='790px';
	  buttonbox.style.width='219px';
		buttonbox.style.background='#000000 url(fileadmin/template/images/licht-ab.gif) no-repeat 10px 0';
		document.body.style.height = '100%';
		document.body.style.overflow='hidden';
	} else {
		// lights on
		// - set cookie
		cookstyle = '1';
		Cookie.set('LightStatus', cookstyle, {duration:365, path:"/"});
		// - set css
		bgbox.style.display = 'none';
		bgbox.style.width = '0px';
		bgbox.style.height = '0px';
		buttonbox.style.left='937px';
		buttonbox.style.width='72px';
		buttonbox.style.background='url(fileadmin/template/images/button.gif) no-repeat right';
		document.body.style.overflow='visible';
	}
}
window.addEvent('domready',lightswitch);

sectionFrameClick = function() {
	var rightCol = document.getElementById("rightCol");
	if(rightCol){
		var divsInRightCol = rightCol.getElementsByTagName("div");
		for (var i=0; i<divsInRightCol.length; i++) {
			if(divsInRightCol[i].className == 'ctElement sectionFrame1' || divsInRightCol[i].className == 'ctElement sectionFrame2') {
				var h2s = divsInRightCol[i].getElementsByTagName("h2");
				sectionFrameClickEvent = function(evt) {
					if( !evt ) {
						evt = window.event;
					}
					if(this.parentNode.className == 'ctElement sectionFrame1') {
						this.parentNode.className = 'ctElement sectionFrame2';
						document.getElementById('intranet').innerHTML += ' ';
					} else {
						this.parentNode.className = 'ctElement sectionFrame1';
						document.getElementById('intranet').innerHTML += ' ';
					}
				}
				for(var x=0; x<h2s.length; x++){
					if (h2s[x].attachEvent) {
						h2s[x].onclick = sectionFrameClickEvent;
					} else {
						h2s[x].addEventListener("click", sectionFrameClickEvent, false);
					}
				}
			}
		}
	}
}

function attachClick() {
	if (window.attachEvent) {
		window.attachEvent("onload", sectionFrameClick);
	} else {
		window.addEventListener("load", sectionFrameClick, false);
	}
}
attachClick();
