function switchFontSize (ckname,val){
	var bd = $E('BODY');
	switch (val) {
		case 'inc':
			if (CurrentFontSize+1 < 7) {
				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 switchTool (ckname, val) {
	createCookie(ckname, val, 365);
	window.location.reload();
}

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=/";
}

String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ""); };

function changeToolHilite(oldtool, newtool) {
	if (oldtool != newtool) {
		if (oldtool) {
			oldtool.src = oldtool.src.replace(/-hilite/,'');
		}
		newtool.src = newtool.src.replace(/.gif$/,'-hilite.gif');
	}
}

//addEvent - attach a function to an event
function jaAddEvent(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 equalHeightInit (){

	//Content and wrap col
	var ja_content = $ ('ja-content');
	var ja_colwrap = $ ('ja-colwrap');
	if (ja_content && ja_colwrap) {
		//get bottom position
		var content_coor = ja_content.getCoordinates();
		var colwrap_inner = $E('.ja-innerpad', ja_colwrap);
		var colwrap_coor = colwrap_inner.getCoordinates();
		var offset = 10;
		if (content_coor.bottom > colwrap_coor.bottom)
		{
			//colwrap_inner.setStyle('height', colwrap_inner.getStyle('height').toInt() + content_coor.bottom - colwrap_coor.bottom);
			colwrap_inner.setStyle('height', content_coor.bottom - colwrap_coor.top - offset);
		} else {
			ja_content.setStyle('height', colwrap_coor.bottom - content_coor.top + offset);
		}
	}

	//Bottom spotlight 1
	var ja_botsl = $('ja-botsl');
	if (ja_botsl)
	{
		var botsl = getElementsByClass ("ja-box.*", ja_botsl, "DIV");	
		if (botsl && botsl.length)
		{
			var maxh = ja_botsl.getCoordinates().height - ja_botsl.getStyle('padding-top').toInt() - ja_botsl.getStyle('padding-bottom').toInt();

			for (var i=0; i<botsl.length ; ++i)
			{
				if ($(botsl[i]).getCoordinates().height < maxh)
				{
					var ja_inner = getLastWrapModDiv ($(botsl[i]));	
					if (ja_inner)
					{
						ja_inner.setStyle('height', maxh - 15);
					}
				
