			var codeLighter = function() {
				// andr3a [ www.3site.it ] [ andrea@3site.it ]
				var used = Array();
				function codeLighter_add(str) {
					var codeLighterTextarea_add = '';
					var to_span = 'novalue';
					if(!document.getElementById('codeTextarea')) {
						alert('You need a TEXTAREA with id="codeTextarea" to use these buttons!');
					}
					if(document.getElementById('codeLighterTextareaSpanChecker')!=null) {
						to_span = document.getElementById('codeLighterTextareaSpanChecker').innerHTML;
						to_span = parseInt(to_span);
					}
					if(document.getElementById('codeLighter' + str).value == '['+str+']') {
						codeLighterTextarea_add = '['+str+']';
						document.getElementById('codeLighter' + str).value = '[/'+str+']';
						this.total.push('[/'+str+']');
						if(to_span!='novalue') {
document.getElementById('codeLighterTextareaSpanChecker').innerHTML = (to_span+1);
						}
					}
					else {
						for(var a=(this.total.length-1); a>=0; a--) {
							codeLighterTextarea_add += this.total[a];
							var my_str = this.total[a].substr(2, (this.total[a].length-3));
							document.getElementById('codeLighter' + my_str).value = '['+my_str+']';
							if(to_span!='novalue') {
								to_span--;
							}
							if(my_str==str) {
								break;
							}
						}
						if(this.total.length==0) {
					codeLighterTextarea_add += '[/'+str+']';
					document.getElementById('codeLighter' + str).value = '['+str+']';
							if(to_span!='novalue') {
								to_span--;
							}
						}
						this.total = Array();
						if(to_span!='novalue') {
		document.getElementById('codeLighterTextareaSpanChecker').innerHTML = to_span;
						}
					}
	document.getElementById('codeTextarea').value += codeLighterTextarea_add;
	document.getElementById('codeTextarea').focus();
					return true;
				}
				function codeLighter_closeTags(ar) {
					var to_span = 'novalue';
					for(var a=(ar.length-1); a>=0; a--) {
						document.getElementById('codeTextarea').value += ar[a];
						var my_str = ar[a].substr(2, (ar[a].length-3));
						document.getElementById('codeLighter' + my_str).value = '['+my_str+']';
					}
					this.total = Array();
					if(document.getElementById('codeLighterTextareaSpanChecker')!=null) {
						to_span = document.getElementById('codeLighterTextareaSpanChecker').innerHTML;
						to_span = parseInt(to_span);
					}
					if(to_span!='novalue') {
						document.getElementById('codeLighterTextareaSpanChecker').innerHTML = '0';
				}
					document.getElementById('codeTextarea').focus();
				}
				function codeLighter_maxChars() {
					if(this.counter!=false) {
					var check_len = document.getElementById('codeTextarea').value.length;
						var rest_len = 0;
						if ( check_len >= this.counter ) {
							document.getElementById('codeTextarea').value = document.getElementById('codeTextarea').value.substring(0, this.counter);
						}
						else {
							rest_len = this.counter - check_len;
						}
						document.getElementById('codeLighterTextareaSpanCounter').innerHTML = rest_len;
					}
					else {
						document.getElementById('codeLighterTextareaSpanCounter').innerHTML = document.getElementById('codeTextarea').value.length;
					}
				}
				this.total = used;
				this.add = codeLighter_add;
				this.close = codeLighter_closeTags;
				this.maxChars = codeLighter_maxChars;
				this.counter = false;
			}
			var codeLighter = new codeLighter();



//codice per il secondo form con funzione di formattazione [Versione Inglese]
var codeLighter2 = function() {
var used = Array();
function codeLighter2_add(str) {
var codeLighterTextarea_add = '';
var to_span = 'novalue';
if(!document.getElementById('codeTextarea2')) {
alert('You need a TEXTAREA with id="codeTextarea2" to use these buttons!');
}
if(document.getElementById('codeLighterTextareaSpanChecker')!=null) {
to_span = document.getElementById('codeLighterTextareaSpanChecker').innerHTML;
to_span = parseInt(to_span);
}
if(document.getElementById('codeLighter2' + str).value == '['+str+']') {
codeLighterTextarea_add = '['+str+']';
document.getElementById('codeLighter2' + str).value = '[/'+str+']';
this.total.push('[/'+str+']');
if(to_span!='novalue') {
document.getElementById('codeLighterTextareaSpanChecker').innerHTML = (to_span+1);
}
}
else {
for(var a=(this.total.length-1); a>=0; a--) {
codeLighterTextarea_add += this.total[a];
var my_str = this.total[a].substr(2, (this.total[a].length-3));
document.getElementById('codeLighter2' + my_str).value = '['+my_str+']';
if(to_span!='novalue') {
to_span--;
}
if(my_str==str) {
break;
}
}
if(this.total.length==0) {
codeLighterTextarea_add += '[/'+str+']';
document.getElementById('codeLighter2' + str).value = '['+str+']';
if(to_span!='novalue') {
to_span--;
}
}
this.total = Array();
if(to_span!='novalue') {
document.getElementById('codeLighterTextareaSpanChecker').innerHTML = to_span;
}
}
document.getElementById('codeTextarea2').value += codeLighterTextarea_add;
document.getElementById('codeTextarea2').focus();
return true;
}

function codeLighter2_closeTags(ar) {
var to_span = 'novalue';
for(var a=(ar.length-1); a>=0; a--) {
document.getElementById('codeTextarea2').value += ar[a];
var my_str = ar[a].substr(2, (ar[a].length-3));
document.getElementById('codeLighter2' + my_str).value = '['+my_str+']';
}
this.total = Array();
if(document.getElementById('codeLighterTextareaSpanChecker')!=null) {
to_span = document.getElementById('codeLighterTextareaSpanChecker').innerHTML;
to_span = parseInt(to_span);
}
if(to_span!='novalue') {
document.getElementById('codeLighterTextareaSpanChecker').innerHTML = '0';
}
document.getElementById('codeTextarea2').focus();
}

function codeLighter2_maxChars() {
if(this.counter!=false) {
var check_len = document.getElementById('codeTextarea2').value.length;

var rest_len = 0;
if ( check_len >= this.counter ) {
document.getElementById('codeTextarea2').value = document.getElementById('codeTextarea2').value.substring(0, this.counter);
}
else {
rest_len = this.counter - check_len;
}
document.getElementById('codeLighterTextareaSpanCounter').innerHTML = rest_len;
}
else {
document.getElementById('codeLighterTextareaSpanCounter').innerHTML = document.getElementById('codeTextarea2').value.length;
					}
				}
				this.total = used;
				this.add = codeLighter2_add;
				this.close = codeLighter2_closeTags;
				this.maxChars = codeLighter2_maxChars;
				this.counter = false;
			}
			var codeLighter2 = new codeLighter2();



//codice per il terzo form con funzione di formattazione [Pagina POSIZIONE]
var codeLighter3 = function() {
var used = Array();
function codeLighter3_add(str) {
var codeLighterTextarea_add = '';
var to_span = 'novalue';
if(!document.getElementById('codeTextarea3')) {
alert('You need a TEXTAREA with id="codeTextarea3" to use these buttons!');
}
if(document.getElementById('codeLighterTextareaSpanChecker')!=null) {
to_span = document.getElementById('codeLighterTextareaSpanChecker').innerHTML;
to_span = parseInt(to_span);
}
if(document.getElementById('codeLighter3' + str).value == '['+str+']') {
codeLighterTextarea_add = '['+str+']';
document.getElementById('codeLighter3' + str).value = '[/'+str+']';
this.total.push('[/'+str+']');
if(to_span!='novalue') {
document.getElementById('codeLighterTextareaSpanChecker').innerHTML = (to_span+1);
}
}
else {
for(var a=(this.total.length-1); a>=0; a--) {
codeLighterTextarea_add += this.total[a];
var my_str = this.total[a].substr(2, (this.total[a].length-3));
document.getElementById('codeLighter3' + my_str).value = '['+my_str+']';
if(to_span!='novalue') {
to_span--;
}
if(my_str==str) {
break;
}
}
if(this.total.length==0) {
codeLighterTextarea_add += '[/'+str+']';
document.getElementById('codeLighter3' + str).value = '['+str+']';
if(to_span!='novalue') {
to_span--;
}
}
this.total = Array();
if(to_span!='novalue') {
document.getElementById('codeLighterTextareaSpanChecker').innerHTML = to_span;
}
}
document.getElementById('codeTextarea3').value += codeLighterTextarea_add;
document.getElementById('codeTextarea3').focus();
return true;
}

function codeLighter3_closeTags(ar) {
var to_span = 'novalue';
for(var a=(ar.length-1); a>=0; a--) {
document.getElementById('codeTextarea3').value += ar[a];
var my_str = ar[a].substr(2, (ar[a].length-3));
document.getElementById('codeLighter3' + my_str).value = '['+my_str+']';
}
this.total = Array();
if(document.getElementById('codeLighterTextareaSpanChecker')!=null) {
to_span = document.getElementById('codeLighterTextareaSpanChecker').innerHTML;
to_span = parseInt(to_span);
}
if(to_span!='novalue') {
document.getElementById('codeLighterTextareaSpanChecker').innerHTML = '0';
}
document.getElementById('codeTextarea3').focus();
}

function codeLighter3_maxChars() {
if(this.counter!=false) {
var check_len = document.getElementById('codeTextarea3').value.length;

var rest_len = 0;
if ( check_len >= this.counter ) {
document.getElementById('codeTextarea3').value = document.getElementById('codeTextarea3').value.substring(0, this.counter);
}
else {
rest_len = this.counter - check_len;
}
document.getElementById('codeLighterTextareaSpanCounter').innerHTML = rest_len;
}
else {
document.getElementById('codeLighterTextareaSpanCounter').innerHTML = document.getElementById('codeTextarea3').value.length;
					}
				}
				this.total = used;
				this.add = codeLighter3_add;
				this.close = codeLighter3_closeTags;
				this.maxChars = codeLighter3_maxChars;
				this.counter = false;
			}
			var codeLighter3 = new codeLighter3();



//codice per il quarto form con funzione di formattazione [Pagina POSIZIONE]
var codeLighter4 = function() {
var used = Array();
function codeLighter4_add(str) {
var codeLighterTextarea_add = '';
var to_span = 'novalue';
if(!document.getElementById('codeTextarea4')) {
alert('You need a TEXTAREA with id="codeTextarea4" to use these buttons!');
}
if(document.getElementById('codeLighterTextareaSpanChecker')!=null) {
to_span = document.getElementById('codeLighterTextareaSpanChecker').innerHTML;
to_span = parseInt(to_span);
}
if(document.getElementById('codeLighter4' + str).value == '['+str+']') {
codeLighterTextarea_add = '['+str+']';
document.getElementById('codeLighter4' + str).value = '[/'+str+']';
this.total.push('[/'+str+']');
if(to_span!='novalue') {
document.getElementById('codeLighterTextareaSpanChecker').innerHTML = (to_span+1);
}
}
else {
for(var a=(this.total.length-1); a>=0; a--) {
codeLighterTextarea_add += this.total[a];
var my_str = this.total[a].substr(2, (this.total[a].length-3));
document.getElementById('codeLighter4' + my_str).value = '['+my_str+']';
if(to_span!='novalue') {
to_span--;
}
if(my_str==str) {
break;
}
}
if(this.total.length==0) {
codeLighterTextarea_add += '[/'+str+']';
document.getElementById('codeLighter4' + str).value = '['+str+']';
if(to_span!='novalue') {
to_span--;
}
}
this.total = Array();
if(to_span!='novalue') {
document.getElementById('codeLighterTextareaSpanChecker').innerHTML = to_span;
}
}
document.getElementById('codeTextarea4').value += codeLighterTextarea_add;
document.getElementById('codeTextarea4').focus();
return true;
}

function codeLighter4_closeTags(ar) {
var to_span = 'novalue';
for(var a=(ar.length-1); a>=0; a--) {
document.getElementById('codeTextarea4').value += ar[a];
var my_str = ar[a].substr(2, (ar[a].length-3));
document.getElementById('codeLighter4' + my_str).value = '['+my_str+']';
}
this.total = Array();
if(document.getElementById('codeLighterTextareaSpanChecker')!=null) {
to_span = document.getElementById('codeLighterTextareaSpanChecker').innerHTML;
to_span = parseInt(to_span);
}
if(to_span!='novalue') {
document.getElementById('codeLighterTextareaSpanChecker').innerHTML = '0';
}
document.getElementById('codeTextarea4').focus();
}

function codeLighter4_maxChars() {
if(this.counter!=false) {
var check_len = document.getElementById('codeTextarea4').value.length;

var rest_len = 0;
if ( check_len >= this.counter ) {
document.getElementById('codeTextarea4').value = document.getElementById('codeTextarea4').value.substring(0, this.counter);
}
else {
rest_len = this.counter - check_len;
}
document.getElementById('codeLighterTextareaSpanCounter').innerHTML = rest_len;
}
else {
document.getElementById('codeLighterTextareaSpanCounter').innerHTML = document.getElementById('codeTextarea4').value.length;
					}
				}
				this.total = used;
				this.add = codeLighter4_add;
				this.close = codeLighter4_closeTags;
				this.maxChars = codeLighter4_maxChars;
				this.counter = false;
			}
			var codeLighter4 = new codeLighter4();



function inshr(numero){
if (numero=="0"){
//document.forms[0].messaggio.value = document.forms[0].messaggio.value + "[HR]";
document.getElementById('codeTextarea').value += "[HR]";
document.getElementById('codeTextarea').focus();
return true;
}
else if (numero=="1"){
//document.forms[0].messaggio2.value = document.forms[0].messaggio2.value + "[HR]";
document.getElementById('codeTextarea2').value += "[HR]";
document.getElementById('codeTextarea2').focus();
return true;
}
else if (numero=="2"){
//document.forms[0].messaggio3.value = document.forms[0].messaggio3.value + "[HR]";
document.getElementById('codeTextarea3').value += "[HR]";
document.getElementById('codeTextarea3').focus();
return true;
}
else if (numero=="3"){
//document.forms[0].messaggio4.value = document.forms[0].messaggio4.value + "[HR]";
document.getElementById('codeTextarea4').value += "[HR]";
document.getElementById('codeTextarea4').focus();
return true;
}
}


//funzione per contare i caratteri e fermare inserimento nella textarea
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) {
field.value = field.value.substring(0, maxlimit);
} else {
countfield.value = maxlimit - field.value.length;
}
}


// funzione per far comparire la pop-up per anterpima della news appena scritta
function OpenPreviewWindow(sezione){
if (sezione=="0"){
if (document.getElementById('codeTextarea').length != 0 && document.getElementById('codeTextarea').value != ''){
document.cookie ='Messaggio = ' + escape(document.getElementById('codeTextarea').value);
document.cookie ='Messaggio2 = ';
document.cookie ='Messaggio3 = ';
document.cookie ='Messaggio4 = ';
window.open('anteprima.asp', 'preview', 'scrollbars=yes,width=630,height=500,left=90')
}
else{
alert("Per visualizzare un\'anteprima,\ndovresti inserire del testo..\nNon credi..!?!?");
return false
}
}
else if (sezione=="1"){
if (document.getElementById('codeTextarea').length != 0 && document.getElementById('codeTextarea').value != '' && document.getElementById('codeTextarea2').length != 0 && document.getElementById('codeTextarea2').value != ''){
document.cookie ='Messaggio = ' + escape(document.getElementById('codeTextarea').value);
document.cookie ='Messaggio2 = ' + escape(document.getElementById('codeTextarea2').value);
document.cookie ='Messaggio3 = ';
document.cookie ='Messaggio4 = ';
window.open('anteprima.asp', 'preview', 'scrollbars=yes,width=630,height=500,left=90')
}
else{
alert("Per visualizzare un\'anteprima,\ndovresti inserire del testo..\nNon credi..!?!?");
return false
}
}
else if (sezione=="2"){

if (document.getElementById('codeTextarea').length != 0 && document.getElementById('codeTextarea').value != '' && document.getElementById('codeTextarea2').length != 0 && document.getElementById('codeTextarea2').value != '' && document.getElementById('codeTextarea3').length != 0 && document.getElementById('codeTextarea3').value != '' && document.getElementById('codeTextarea4').length != 0 && document.getElementById('codeTextarea4').value != ''){
document.cookie ='Messaggio = ' + escape(document.getElementById('codeTextarea').value);
document.cookie ='Messaggio2 = ' + escape(document.getElementById('codeTextarea2').value);
document.cookie ='Messaggio3 = ' + escape(document.getElementById('codeTextarea3').value);
document.cookie ='Messaggio4 = ' + escape(document.getElementById('codeTextarea4').value);
window.open('anteprima.asp', 'preview', 'scrollbars=yes,width=630,height=500,left=90')
}
else{
alert("Per visualizzare un\'anteprima,\ndovresti inserire del testo..\nNon credi..!?!?");
return false
}
}
}


//funzione per disabilitare e cambiare il testo sul tasto submit nel momento di invio dati
function disabilita(){
document.forms['form1'].submit.value = "Attendere..";
document.forms['form1'].submit.disabled = true;
}

//funzione per disabilitare e cambiare il testo sul tasto submit nel momento di invio dati
function disabilita2(){
document.forms['frm'].submit.value = "Wait..";
document.forms['frm'].submit.disabled = true;
}

//funzione per disabilitare e cambiare il testo sul tasto submit nel momento di invio dati
function disabilita3(nomeform){
document.forms[nomeform].submit.value = "Wait..";
document.forms[nomeform].submit.disabled = true;
}

//funzione che serve ad attivare i check box anche cliccando sul testo/immagine corrispondente
function changeBox(cbox) {
box = eval(cbox);
box.checked = !box.checked;
if (box.disabled==true){
box.checked = false;
}
}



function WM_toggle(id){
if (document.all){
if(document.all[id].style.display == 'none'){
document.all[id].style.display = '';
} else {
document.all[id].style.display = 'none';
}
return false;
} else if (document.getElementById){
if(document.getElementById(id).style.display == 'none'){
document.getElementById(id).style.display = 'block';
} else {
document.getElementById(id).style.display = 'none';
}
return false;
}
}



// funzione per far visualizzare il LAYOUT form inserire LAYOUT del pannello gestionale
function preview(foto){
if (foto!=""){
document.getElementById("swap").src = "../img/layout_"+ foto +".gif";
}
else{
document.getElementById("swap").src = "../img/layout_0.gif";
}
}



//funzione che mi apre pop-up (vedi: POP PDF)
function openwindow2(Url, Wid, Hei){
window.open (Url, '', 'toolbar=no,status=yes,menubar=no,scrollbars=yes,fullscreen=no,resizable=no,width='+Wid+',height='+Hei);
}


//funzione che mi permette di centrare la popup, esempio su Pannello Controllo PDF
function resizeWin(Larghezza,Altezza)
{
var sizeH= Altezza;
var sizeW= Larghezza;
var posH=0;
var posW=0;
if (sizeH<=screen.height)
sizeH=30+sizeH;
if (sizeW<=screen.width)
sizeW=30+sizeW
self.resizeTo(sizeW,sizeH);
if (((screen.height-sizeH)/2)>0)
posW=((screen.height-sizeH)/2);
if (((screen.width-sizeW)/2)>0)
posH=((screen.width-sizeW)/2);
self.moveTo(posW,posH);
}




//funzione che mi permette di inserire i codici per visualizzare gli smile nel guest
function addSmile(picName) {
	document.form1.messaggio.value = document.form1.messaggio.value +" "+ picName;
	document.form1.messaggio.focus();
}




//funzione che mi visualizza le pop up nascoste nelle maschere di ricerca
/***********************************************
* Drop Down/ Overlapping Content- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

function getposOffset(overlay, offsettype){
var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
var parentEl=overlay.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function overlay(curobj, subobjstr, opt_position){
if (document.getElementById){
var subobj=document.getElementById(subobjstr)
subobj.style.display=(subobj.style.display!="block")? "block" : "none"
var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
subobj.style.left=xpos+"px"
subobj.style.top=ypos+"px"
return false
}
else
return true
}

function overlayclose(subobj){
document.getElementById(subobj).style.display="none"
}



//funzione che utilizzo nel Modulo UTENTI e mi permette di controllare
function check(numero)
{
if (numero==1)
{

if (document.form1.addmoduli.value==1)
{

if (document.form1.number.value==0)
{
alert("Attenzione !!!\n\nSe non attivi alcun Modulo Gestionale...\n\nDevi impostare a NO il campo Aggiungi Moduli..");
document.form1.addmoduli.focus();
return false;
}

else
{
for ( var i = 0 ; i < document.form1.number.value; i++ )
{
if (document.form1.elements["modulo"+ parseInt(i+1)].value==0)
{
alert("Attenzione !!\n\nI Moduli, se selezionati, non possono essere vuoti...\n\nControlla il Modulo "+ parseInt(i+1))
document.form1.elements["modulo"+ parseInt(i+1)].focus();
return false;
}
if (document.form1.elements["modulo"+ parseInt(i+1)].options[document.form1.elements["modulo"+ parseInt(i+1)].options.selectedIndex].value==13 && document.form1.stropzioneguest.value==0)
{
alert("Attenzione !!\n\nSe hai selezionato il Modulo Guestbook, devi indicare quale modello abilitare");
document.form1.stropzioneguest.focus();
return false;
}
}
}
}

//if (document.form1.addmoduli.value==2)
//{
//if (document.form1.number.value==0 && document.form1.strlivello.value!=0)
//{
//alert("Attenzione !!!\n\nSe non attivi alcun Modulo Gestionale...\n\nDevi disabilitare l\'utente..");
//document.form1.strlivello.focus();
//return false;
//}
//else
//{
//for ( var i = 0 ; i < document.form1.number.value; i++ )
//{
//if (document.form1.elements["modulo"+ parseInt(i+1)].value==0)
//{
//alert("Attenzione !!\n\nI Moduli, se selezionati, non possono essere vuoti...\n\nControlla il Modulo "+ parseInt(i+1))
//document.form1.elements["modulo"+ parseInt(i+1)].focus();
//return false;
//}
//if (document.form1.elements["modulo"+ parseInt(i+1)].options[document.form1.elements["modulo"+ parseInt(i+1)].options.selectedIndex].value==13 && document.form1.stropzioneguest.value==0)
//{
//alert("Attenzione !!\n\nSe hai selezionato il Modulo Guestbook, devi indicare quale modello abilitare");
//document.form1.stropzioneguest.focus();
//return false;
//}
//if (document.form1.modulo1.options[document.form1.modulo1.options.selectedIndex].value!=40)
//{
//alert("Attenzione !!\n\nDevi inserire come primo modulo quello relativo al ACCOUNT");
//document.form1.modulo1.focus();
//return false;
//}
//}
//}
//}

}
else
{
if (document.form1.number.value==0 && document.form1.strlivello.value!=0)
{
alert("Attenzione !!!\n\nSe non attivi alcun Modulo Gestionale...\n\nDevi disabilitare l\'utente..");
document.form1.strlivello.focus();
return false;
}
else
{
for ( var i = 0 ; i < document.form1.number.value; i++ )
{
if (document.form1.elements["modulo"+ parseInt(i+1)].value==0)
{
alert("Attenzione !!\n\nI Moduli, se selezionati, non possono essere vuoti...\n\nControlla il Modulo "+ parseInt(i+1))
document.form1.elements["modulo"+ parseInt(i+1)].focus();
return false;
}
if (document.form1.elements["modulo"+ parseInt(i+1)].options[document.form1.elements["modulo"+ parseInt(i+1)].options.selectedIndex].value==13 && document.form1.stropzioneguest.value==0)
{
alert("Attenzione !!\n\nSe hai selezionato il Modulo Guestbook, devi indicare quale modello abilitare");
document.form1.stropzioneguest.focus();
return false;
}
if (document.form1.modulo1.options[document.form1.modulo1.options.selectedIndex].value!=40)
{
alert("Attenzione !!\n\nDevi inserire come primo modulo quello relativo al ACCOUNT");
document.form1.modulo1.focus();
return false;
}
}
}
}
}


function show_calendar(str_target, lang, str_datetime){
var lang = lang;
if (lang=="en"){
var arr_months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
var week_days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
}
else if (lang=="fr"){
var arr_months = ["Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"];
var week_days = ["Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"];
}
else if (lang=="de"){
var arr_months = ["Januar", "Februar", "M&auml;rz", "April", "Mai", "Juni", "Juli", "August", "September", "Okctober", "November", "Dezember"];
var week_days = ["Son", "Mon", "Die", "Mit", "Don", "Fre", "Sam"];
}
else if (lang=="es"){
var arr_months = ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"];
var week_days = ["Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "S&aacute;b"];
}
else{
var arr_months = ["Gennaio", "Febbario", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"];
var week_days = ["Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab"];
}

var n_weekstart = 0; // day week starts from (normally 0 or 1)
 
var dt_datetime = ((str_datetime == null || str_datetime == "") ? new Date() : str2dt(str_datetime));
 
var dt_prev_month = new Date(dt_datetime);
dt_prev_month.setMonth(dt_datetime.getMonth() - 1);
 
var dt_next_month = new Date(dt_datetime);
dt_next_month.setMonth(dt_datetime.getMonth() + 1);
 
var dt_firstday = new Date(dt_datetime);
dt_firstday.setDate(1);
dt_firstday.setDate(1 - (7 + dt_firstday.getDay() - n_weekstart) % 7);
 
var dt_lastday = new Date(dt_next_month);
dt_lastday.setDate(0);
 
  // html generation (feel free to tune it for your particular application)
  // print calendar header
  var str_buffer = new String("<html>\n" +
                              "<head>\n" +
                              "<title>Calendar</title>\n" +
					"<LINK rel=\"stylesheet\" href=\"../css/style.css\" type=\"text/css\">\n" +
                              "</head>\n" +
                              "<body>\n" +
                              "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\">\n<Tbody>\n" +
                              "<tr><td bgcolor=\"#000000\">\n" +
                              "<table cellspacing=\"1\" cellpadding=\"2\" border=\"0\" width=\"100%\">\n" +
                              "<tr>\n <td bgcolor=\"#0000FE\"><a href=\"javascript:window.opener.show_calendar('" +
                              str_target +
					"', '"+ lang +"', '" +
                              dt2dtstr(dt_prev_month) +
                              " ' + document.cal.time.value);\">" +
                              "<img src=\"../img/freccia_sx2.gif\" width=\"10\" height=\"9\" border=\"0\"" +
                              " alt=\"" +
                              arr_months[dt_datetime.getMonth()-1] +
                              "\"></a></td>\n" +
                              " <td bgcolor=\"#0000FE\" colspan=\"5\" align=\"center\" valign=\"middle\">" +
                              "<font color=\"#FFFF80\" class=\"corpo\">" +
                              arr_months[dt_datetime.getMonth()] +
                              " " +
                              dt_datetime.getFullYear() +
                              "</font></td>\n" +
                              " <td bgcolor=\"#0000FE\" align=\"right\"><a href=\"javascript:window.opener.show_calendar('" +
                              str_target +
					"', '"+ lang +"', '" +
                              dt2dtstr(dt_next_month) +
                              " ' + document.cal.time.value);\">" +
                              "<img src=\"../img/freccia_dx2.gif\" width=\"10\" height=\"9\" border=\"0\"" +
                              " alt=\"" +
                              arr_months[dt_datetime.getMonth()+1] +
                              "\"></a></td>\n</tr>\n");
 
  var dt_current_day = new Date(dt_firstday);
 
  // print weekdays titles
  str_buffer += "<tr>\n";
 
  for ( var n = 0 ; n < 7 ; n++)
    str_buffer += " <td bgcolor=\"#CCCCCC\" align=\"center\">" +
    "<font color=\"white\" class=\"corpo\">" +
    week_days[(n_weekstart + n) % 7] +
    "</font></td>\n";
 
  // print calendar table
  str_buffer += "</tr>\n";
  while (dt_current_day.getMonth() == dt_datetime.getMonth() ||
         dt_current_day.getMonth() == dt_firstday.getMonth())
    {
      // print row heder
      str_buffer += "<tr>\n";
 
      for ( var n_current_wday = 0 ; n_current_wday < 7 ; n_current_wday++)
        {
          if (dt_current_day.getDate() == dt_datetime.getDate() &&
              dt_current_day.getMonth() == dt_datetime.getMonth())
              // print current date
              str_buffer += " <td bgcolor=\"#FF0000\" align=\"right\">";
          else if (dt_current_day.getDay() == 0 || dt_current_day.getDay() == 6)
                   // weekend days
                   str_buffer += " <td bgcolor=\"#E0ECE8\" align=\"right\">";
          else // print working days of current month
               str_buffer += " <td bgcolor=\"white\" align=\"right\">";

          if (dt_current_day.getMonth() == dt_datetime.getMonth())
              // print days of current month

              str_buffer += "<a href=\"javascript:window.opener." +
                            str_target +
                            ".value='" + dt2dtstr(dt_current_day) + "'; window.close();\">" +
                            "<font color=\"black\" class=\"corpo\">";
          else // print days of other months
               str_buffer += "<a href=\"javascript:window.opener." +
                             str_target +
                             ".value='" + dt2dtstr(dt_current_day) + "'; window.close();\">" +
                             "<font color=\"gray\" class=\"corpo\">";
 
          str_buffer += dt_current_day.getDate() + "</font></a></td>\n";
          dt_current_day.setDate(dt_current_day.getDate() + 1);
        }
 
      // print row footer
      str_buffer += "</tr>\n";
    }

  // print calendar footer
  str_buffer += "<tr bgcolor=\"#000000\" ><td colspan=\"7\" height=\"15\" class=\"corpo2\" align=\"center\" valign=\"middle\" bgcolor=\"#0000FE\">\n<form name=\"cal\" style=\"margin:0px;\">" +
                "<input type=\"hidden\" name=\"time\" value=\""+dt2tmstr(dt_datetime) +
                "\"><a href=\"javascript:window.close();\"><font color=\"#FFFF80\">Close Window</font></a>\n" +
		    "</form>\n</td></tr>\n" +
                "</Tbody>\n</table>\n" +
                "</td>\n</tr>\n</Tbody>\n</table>\n" +
                "</body>\n" +
                "</html>\n";

 
  var vWinCal = window.open("", "Calendario", "width=250,height=205,status=no,resizable=yes,top=200,left=200");
  vWinCal.opener = self;
  var calc_doc = vWinCal.document;
  calc_doc.write(str_buffer);
  calc_doc.close();
}
 
// datetime parsing and formatting routimes. modify them if you wish other datetime format
function str2dt(str_datetime)
{
  var re_date = /^(\d{1,2})\/(\d{1,2})\/(\d{4})\s+(\d{1,2})\:(\d{1,2})\:(\d{1,2})$/;
 
  if (!re_date.exec(str_datetime)) return(alert("Invalid Datetime format: " + str_datetime));
 
  return(new Date (RegExp.$3, RegExp.$2-1, RegExp.$1, RegExp.$4, RegExp.$5, RegExp.$6));
}

function dt2dtstr(dt_datetime){
//var dt = dt_datetime.getDate() + "-";

var day = dt_datetime.getDate();
var month = dt_datetime.getMonth() + 1;
var dt = ((day < 10) ? "0" + day : day) + "/";
dt += ((month < 10) ? "0" + month : month);
dt += "/" + dt_datetime.getFullYear();
return(dt);
}
 
function dt2tmstr(dt_datetime){
var dt = dt_datetime.getHours() + ":";
dt += ((dt_datetime.getMinutes() < 10) ? "0" + dt_datetime.getMinutes() : dt_datetime.getMinutes()) + ":";
dt += ((dt_datetime.getSeconds() < 10) ? "0" + dt_datetime.getSeconds() : dt_datetime.getSeconds());
return(dt);
}




//**************************************** Inizio Script per popup Avviso Fatture Non Pagate ******************
//Specify display mode. 3 possible values are:
//1) "always"- This makes the fade-in box load each time the page is displayed
//2) "oncepersession"- This uses cookies to display the fade-in box only once per browser session
//3) integer (ie: 5)- Finally, you can specify an integer to display the box randomly via a frequency of 1/integer...
// For example, 2 would display the box about (1/2) 50% of the time the page loads.

var displaymode="always"

var enablefade="yes" //("yes" to enable fade in effect, "no" to disable)
var autohidebox=["no", 8] //Automatically hide box after x seconds? [yes/no, if_yes_hide_after_seconds]
var showonscroll="yes" //Should box remain visible even when user scrolls page? ("yes"/"no)
var IEfadelength=1 //fade in duration for IE, in seconds
var Mozfadedegree=0.05 //fade in degree for NS6+ (number between 0 and 1. Recommended max: 0.2)

////////No need to edit beyond here///////////

if (parseInt(displaymode)!=NaN)
var random_num=Math.floor(Math.random()*displaymode)

function displayfadeinbox(){
var ie=document.all && !window.opera
var dom=document.getElementById
iebody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
objref=(dom)? document.getElementById("fadeinbox") : document.all.fadeinbox
var scroll_top=(ie)? iebody.scrollTop : window.pageYOffset
var docwidth=(ie)? iebody.clientWidth : window.innerWidth
docheight=(ie)? iebody.clientHeight: window.innerHeight
var objwidth=objref.offsetWidth
objheight=objref.offsetHeight
objref.style.left=docwidth/2-objwidth/2+"px"
objref.style.top=scroll_top+docheight/2-objheight/2+"px"

if (showonscroll=="yes")
showonscrollvar=setInterval("staticfadebox()", 50)

if (enablefade=="yes" && objref.filters){
objref.filters[0].duration=IEfadelength
objref.filters[0].Apply()
objref.filters[0].Play()
}
objref.style.visibility="visible"
if (objref.style.MozOpacity){
if (enablefade=="yes")
mozfadevar=setInterval("mozfadefx()", 90)
else{
objref.style.MozOpacity=1
controlledhidebox()
}
}
else
controlledhidebox()
}

function mozfadefx(){
if (parseFloat(objref.style.MozOpacity)<1)
objref.style.MozOpacity=parseFloat(objref.style.MozOpacity)+Mozfadedegree
else{
clearInterval(mozfadevar)
controlledhidebox()
}
}

function staticfadebox(){
var ie=document.all && !window.opera
var scroll_top=(ie)? iebody.scrollTop : window.pageYOffset
objref.style.top=scroll_top+docheight/2-objheight/2+"px"
}

function hidefadebox(){
objref.style.visibility="hidden"
if (typeof showonscrollvar!="undefined")
clearInterval(showonscrollvar)
}

function controlledhidebox(){
if (autohidebox[0]=="yes"){
var delayvar=(enablefade=="yes" && objref.filters)? (autohidebox[1]+objref.filters[0].duration)*1000 : autohidebox[1]*1000
setTimeout("hidefadebox()", delayvar)
}
}

function initfunction(){
setTimeout("displayfadeinbox()", 200)
}

function getCk(name) {
  var nameEQ = name + '=';
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

//if(getCk('pop')!="ok"){ //ho disabilitato questa riga, così la popup apparirà ogni volta che apro la pagina

if(getCk('pop')!="o"){
if (displaymode=="oncepersession" && getCk("pop")== "" || displaymode=="always" || parseInt(displaymode)!=NaN && random_num==0){
if (window.addEventListener)
window.addEventListener("load", initfunction, false)
else if (window.attachEvent)
window.attachEvent("onload", initfunction)
else if (document.getElementById)
window.onload=initfunction
document.cookie = 'pop=ok; path=/';
}
}

//**************************************** Fine Script per popup Avviso Fatture Non Pagate ******************



//funzione utilizzata nella sezione NEWSLetter per copiare i medesimi contenuti nella versione in INGLESE
function pasttxt(){
document.forms[1].titolo2.value = document.forms[1].titolo.value;
document.forms[1].messaggio2.value = document.forms[1].messaggio.value;
}


function nascondi(nome){
var stato = document.getElementById("tbl" + nome).style.display;
if (stato != "none"){
// Nascondo la riga
document.getElementById("tbl" + nome).style.display = "none";
}
}
function apri(nome){
var statoapri = document.getElementById("tbl" + nome).style.display;
if (statoapri == "none"){
// Visualizzo la riga
document.getElementById("tbl" + nome).style.display = "";
}
}


//funzione utilizzata in INVIO NEWSLETTER e AVVISI
function change(){
var utente=document.form1.id_iscritto.options[document.form1.id_iscritto.options.selectedIndex].value;
var change=document.form1.r_pagina.options[document.form1.r_pagina.options.selectedIndex].value;

if (utente=="@" || utente=="@2"){
document.form1.r_pagina.disabled = false;
if (change=="0"){
document.form1.submit.disabled = true;
}
else {
document.form1.submit.disabled = false;
}
}
else if (utente=="0"){
document.form1.r_pagina.disabled = true;
document.form1.submit.disabled = true;
}
else{
document.form1.r_pagina.disabled = true;
document.form1.submit.disabled = false;
document.form1.r_pagina.options.selectedIndex = 0;
}
}




//funzione utilizzata nella sezione PRODOTTI per copiare i medesimi contenuti nella versione in INGLESE
function pasttxt_2(){
document.forms[1].categoria_en.value = document.forms[1].categoria.value;
}