// JavaScript Document
// ------------- funzioni che vengono eseguite al caricamento della pagina, in  funzione della pagina stessa ---------//
function eseguiOnLoad(pagina)
{
	pagina=pagina.toLowerCase();
	if (pagina.indexOf("admin_homepages.asp") >0 || pagina.indexOf("admin_contenuti.asp") >0) 
		{
			setTimeout("caricaSfondo()",500);
		}
	
}

// --------  funzioni per la valdazione dei dati -------   //
function checkCombo(obj, azione)
{
	if(obj.selectedIndex==0) 
		{
			alert('La prima opzione non &egrave; valida.');
			return;
		}
	else
		{
		obj.form.azione.value=azione;
		obj.form.submit();
		}
}

function setEditorAreaColor(instanceName,daColor) {  
editor_frame = document.getElementById(instanceName+'___Frame');  
if (editor_frame!=null) {  
editor_source = editor_frame.contentWindow.document.getElementById('eEditorArea');  
if (editor_source!=null) {  
editor_source.contentWindow.document.body.style.backgroundColor=daColor;  
return true;  
} else { return false; }  
} else { return false; }  
}  
// -------- funzioni di utilità di utilità generale ---------------------//

function apriWin(pagina,larg,altez)
{
	nw=window.open(pagina,'AA_self','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,dependent=no,screenX=0,screenY=0,width='+ larg +',height='+ altez +',top=0,left=0');
	nw.focus();
}
function apriWin2(pagina,larg,altez, opt)
{
	if (opt=='') {opt='status=yes,menubar=no,scrollbars=yes,resizable=yes';};
	opt='location=no,directories=no,copyhistory=no,dependent=no,screenX=0,screenY=0,width='+ larg +',height='+ altez +',top=0,left=0,' + opt;
	nw=window.open(pagina,'AA_self',opt);
	nw.focus();
}

function setDimensioneEditorHtml(idObj,size)
{
	document.getElementById(idObj).style.height=size;	
}


function impostaSourceImmagine(immagine,idTextBox)
{
	document.getElementById(idTextBox).value=immagine;
}

function apriFileManager(objRitorno) {
	var u;
	var width=780;
	var height=520;
	var iLeft = ( screen.width  - width ) / 2 ;
	var iTop  = ( screen.height - height ) / 2 ;
	var sOptions = 'toolbar=no,status=yes,resizable=no,dependent=yes' ;
	sOptions += ',width=' + width ;
	sOptions += ',height=' + height ;
	sOptions += ',left=' + iLeft ;
	sOptions += ',top=' + iTop ;
	u='ASPX/fileBrowser.aspx?';
	u +='modooperativo=link&idObjSource=' + objRitorno ;
	nw=window.open(u,'ASAS',sOptions);
	nw.focus();
}

