function bwAddEvent(obj, evType, fn){ 
 if (obj.addEventListener){ 
   obj.addEventListener(evType, fn, false); 
   return true; 
 } else if (obj.attachEvent){ 
   var r = obj.attachEvent("on"+evType, fn); 
   return r; 
 } else { 
   return false; 
 } 
}

function switchFontSize (ckname,val){
	
	
	
	var bd = $E('BODY');
	
	switch (val) {
		case 'inc':
			if (CurrentFontSize+1 < 6) {
				bd.removeClass('fs'+CurrentFontSize);
				CurrentFontSize++;
				bd.addClass('fs'+CurrentFontSize);
			}		
		break;
		case 'dec':
			if (CurrentFontSize-1 > 0) {
				bd.removeClass('fs'+CurrentFontSize);
				CurrentFontSize--;
				bd.addClass('fs'+CurrentFontSize);
			}		
		break;
		default:
			bd.removeClass('fs'+CurrentFontSize);
			CurrentFontSize = val;
			bd.addClass('fs'+CurrentFontSize);		
	}
	Cookie.set(ckname, CurrentFontSize,{duration:365});
}

function changeFontSize(sizeDifference){
		currentFontSize = parseInt(currentFontSize) + parseInt(sizeDifference * 5);
	
		if(currentFontSize > maximumFontSize){
			currentFontSize = maximumFontSize;
		}else if(currentFontSize < minimumFontSize){
			currentFontSize = minimumFontSize;
		}
		setFontSize(currentFontSize);
	}

	function setFontSize(fontSize){
		/*if($debug_this_script){alert ('fontsize is being set: ' + fontSize);}*/
		var stObj = (document.getElementById) ? document.getElementById('main_content') : document.all('main_content');
		document.body.style.fontSize = fontSize + '%';
	}
	
	function revertStyles(){
		currentFontSize = defaultFontSize;
		changeFontSize(0);
	}
	
function equalHeight(){
	makeEqualHeight ($('bottom-modules').getChildren());
}

function makeEqualHeight(divs) {
	if(!divs || divs.length < 2) return;
	var maxh = 0;
	divs.each(function(el, i){
		var ch = el.getCoordinates().height;
		maxh = (maxh < ch) ? ch : maxh;		
	},this);
	divs.each(function(el, i){
		el.setStyle('height', maxh-el.getStyle('padding-top').toInt()-el.getStyle('padding-bottom').toInt());		
	},this);
}
	


