// 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();
}

function chgConfigPagamenti(obj) {
    if (obj.value.toLowerCase()=='paypal') {
       if (confirm('Reimpostare i valori predefiniti di test?')) {
            document.getElementById('txt_strURLPagamentiCC').value='https://www.paypal.com/cgi-bin/webscr?cmd=_xclick';
            document.getElementById('txt_strChiaveAvvioCC').value='';
            document.getElementById('txt_strChiaveEsitoCC').value='';
            document.getElementById('txt_strIdNegozioCC').value='p.scuderi@ipsonline.it';
            document.getElementById('txt_iCodiceValutaCC').value='EUR';
        } 
    
    }
    
    if (obj.value.toLowerCase()=='bankpass') {
        if (confirm('Reimpostare i valori predefiniti di test?')) {
            document.getElementById('txt_strURLPagamentiCC').value='http://sis-test-bankpass.ssb.it/bankpass/master/main?PAGE=MASTER';
            document.getElementById('txt_strChiaveAvvioCC').value='rAPu5Nto2kv76B2cPJjWhADuwjACYLELtAo3AEAYUymbkqADjA';
            document.getElementById('txt_strChiaveEsitoCC').value='EAAYYXC3LcEj8D3uq7kREiAE9vxgFaCbpSLZqjAzA8Dx7iJrVP';
            document.getElementById('txt_strIdNegozioCC').value='010500000000001';
            document.getElementById('txt_iCodiceValutaCC').value='978';
        }
    
    }
    
    if (obj.value.toLowerCase()=='@pos') {        
        if (confirm('Reimpostare i valori predefiniti di test?')) {
            document.getElementById('txt_strURLPagamentiCC').value='http://atpostest.ssb.it/atpos/pagamenti/main?PAGE=MASTER';
            document.getElementById('txt_strChiaveAvvioCC').value='-gp8Tp7G8cABgcN4x-7YjqPXzH--J3HpmUxXG3PWdVa2nYfrGJ';
            document.getElementById('txt_strChiaveEsitoCC').value='';
            document.getElementById('txt_strIdNegozioCC').value='129280505050505';
            document.getElementById('txt_iCodiceValutaCC').value='978';
        }
    }
    
    if (obj.value.toLowerCase()=='setefi') {        
        if (confirm('Reimpostare i valori predefiniti di test?')) {
            document.getElementById('txt_strURLPagamentiCC').value='https://www.monetaonline.it/MPI/MPIRequest.asp';
            document.getElementById('txt_strChiaveAvvioCC').value='Sostituire il file inclusioni/custom_pagamenti.asp';
            document.getElementById('txt_strChiaveEsitoCC').value='con quello fornito dalla banca e chiamarlo con lo stesso nome';
            document.getElementById('txt_strIdNegozioCC').value='';
            document.getElementById('txt_iCodiceValutaCC').value='978';
        }
    }
}
