/*
BASE MENU-SUBMENU FUNCTIONs
*/
function switchDisplay(id)
{
	var oMenu = document.getElementById(id)
	var displayStatus = oMenu.style.display
	var displayStatusIsBlock = displayStatus == "block"

	if(displayStatusIsBlock)
	oMenu.style.display = "none"
	else
	oMenu.style.display = "block"

}
function actionMenu(id)
{
	switchDisplay("sub_"+id)
}

/*
EDITOR ACTIONS FUNCTIONs
*/
function actionTools(id)
{
	switchDisplay("textBlock"+id+"_editor_toolbar")
	switchDisplay("imgBlock"+id+"_editor_toolbar")
}
function actionOptions(id)
{
	switchDisplay("options"+id+"_toolbar")
	switchDisplay("optionRow"+id+"")
}

function optionsDisplay(id,idp)
{
	// annullata la funzione perché tutti i paragrafi, pagine news articolo, hanno una scadenza
	// resta per ora chiusa la parte prezzo e novità
	// document.getElementById("sub_news"+idp).style.display = 'none';
	document.getElementById("sub_articolo"+idp).style.display = 'none';
	if(document.getElementById("sub_"+id+idp))
	{
	document.getElementById("sub_"+id+idp).style.display = 'block'
	document.getElementById("altezza"+idp).style.height = (hBloccoRidotto+40)+'px'
	}
	else
	document.getElementById("altezza"+idp).style.height = '460px';
	
	
	
	if(id == 'indice') 
	{
		tmppos = document.getElementById("ordBlock"+idp).value;
		tmpvis = document.getElementById("statusBlock"+idp).status;
		tmpmsg = '';
		
		if(tmppos > 10 ) 
		{
			tmpmsg += 'Il paragrafo tipo "INDICE" deve essere il primo della pagina,\t\nla posizione è stata corretta ed impostata ad 1,\t\nal salvataggio della pagina, il valore sarà resettato a 10\t\n';
			document.getElementById("ordBlock"+idp).value = '1';
		}
		
		if(!tmpvis) 
		{
			tmpmsg += '\nIl paragrafo tipo "INDICE" deve essere visibile\t\nlo stato del paragrafo è stato impostato a "visibile"';
			document.getElementById("statusBlock"+idp).status = true;
		}
		
		if (tmpmsg != '') alert(tmpmsg+'\t\n\nsalvare il paragrafo prima di crearne di nuovi \t\no prima di lasciare la pagina');
	}
}


/*
MOUSE-OVER HILIGHT FUNCTIONs
*/
function hiLight(id) {
	if ( resetColorBg == '' ) resetColorBg = getBgColor(id)
	if (document.getElementById) 
	eval('document.getElementById(\''+id+'\').style.background=\''+hilghColorBg+'\''); 
	if (document.all) 
	eval('document.all.'+id+'.style.background=\''+hilghColorBg+'\''); 
}
function lowLight(id) {
	if (document.getElementById) 
	eval('document.getElementById(\''+id+'\').style.background=\''+resetColorBg+'\''); 
	if (document.all) 
	eval('document.all.'+id+'.style.background=\''+resetColorBg+'\''); 
}
function getBgColor(id) {
	if (document.getElementById) 
	eval('resetColorBg = document.getElementById(\''+id+'\').style.background'); 
	if (document.all) 
	eval('resetColorBg = document.all.'+id+'.style.background'); 
	return resetColorBg
}
var resetColorBg = ''
var hilghColorBg = '#eee'


/*
POPUP FUNCTIONs
*/
function popwin(oBj)
{
var file = (oBj.src.toString().split("SOURSE=")[1])
if(file.indexOf("/public")==0)
window.open('zoom.php?img='+file,'popwin','status=yes');
else
window.open('zoom.php?img=../up'+file,'popwin','status=yes');
}

/*
ADMIN FUNCTIONs
*/
function conferma(domanda,idp,ind)
{
	if(confirm(domanda))
	location.href='index.php?delParag='+idp+'&mp='+ind;
	else
	return false
}


