function so_applyStyleString(obj,str){
	if(document.all && !window.opera)
	    obj.style.setAttribute("cssText",str);
	else
	    obj.setAttribute("style",str);
}

function posTongue() {
	var content=document.getElementById('extra');
	var oldchild=document.getElementById('extra-contents');
	var child=document.createElement('div');
	child.setAttribute('id','tongue-hide');
	child.innerHTML='<a href="javascript:void(0)" onclick="columnExtra();return false;"><span id="textTongue">nascondi questa colonna</span><img id="imgTongue" class="hide" src="fileadmin/templates/img/hide_col.gif" alt="Nascondi questa colonna" /></a>';
	//content.appendChild(child);
	content.insertBefore(child,oldchild);
}

function columnExtra() {
	var extraContents=document.getElementById('extra-contents');
	(extraContents.style.display=='none')?showExtraColumn():hideExtraColumn();
}

function showExtraColumn() {
	var textTongue=document.getElementById('textTongue');
	show(textTongue,'inline');
	
	var extraContents=document.getElementById('extra-contents');
	//document.getElementById('wrapper').style.width='';
	//so_applyStyleString(document.getElementById("tongue"),"position:absolute;top:70px;right:25%;width:23px;height:200px;text-align:right;");
	document.getElementById('content').style.margin='0 25% 0 240px';
	show(extraContents,'block');
	changePic('imgTongue','fileadmin/templates/img/hide_col.gif','Nascondi questa colonna');
	
	//div#extra{float:left;width:24%;margin-left:-24%;}
	document.getElementById('extra').style.width='24%';
	document.getElementById('extra').style.margin='0 0 0 -24%';

}

function hideExtraColumn() {
	//so_applyStyleString(document.getElementById("tongue"),"top:70px;right:0px;");
	document.getElementById('content').style.margin='0 30px 0 240px';
	changePic('imgTongue','fileadmin/templates/img/show_col.gif','Mostra colonna');
	
	if ( isIE(6) ) {
		document.getElementById('extra').style.width='26px';
		document.getElementById('extra').style.margin='0 0 0 -26px';
	} else {
		document.getElementById('extra').style.width='20px';
		document.getElementById('extra').style.margin='0 0 0 -20px';
	}

	var extraContents=document.getElementById('extra-contents');
	show(extraContents,'none');

	var textTongue=document.getElementById('textTongue');
	show(textTongue,'none');
}

function show(level,action) {
	level.style.display=action;
}

function changePic(idDest,newPath,newAlt) {
	document.getElementById(idDest).src=newPath;
	document.getElementById(idDest).alt=newAlt;
}

//
// addLoadEvent()
// Adds event to window.onload without overwriting currently assigned onload functions.
// Function found at Simon Willison's weblog - http://simon.incutio.com/
//
function addLoadEvent(func)
{	
	var oldonload = window.onload;
	if (typeof window.onload != 'function'){
    	window.onload = func;
	} else {
		window.onload = function(){
		oldonload();
		func();
		}
	}
}

addLoadEvent(posTongue);	// run initLightbox onLoad