
// JavaScript Document
var PHPDOTNET;
PHPDOTNET = "93ece335a959940cc93c2fce5cf037f6";

function attivaAzienda()
{
	//document.getElementById('piva');	
	//document.getElementById('societa');	
	document.getElementById('linefrase').style.display='';	
	document.getElementById('linearag').style.display='';	
	document.getElementById('lineanome').bgColor ='#FFFFCC';	
	document.getElementById('lineacognome').bgColor ='#FFFFCC';	
	document.getElementById('lineapiva').style.display='';	
	document.getElementById('ob_rag').style.display='';
	document.getElementById('ob_piva').style.display='';
}

function attivaPrivato()
{
	document.getElementById('piva').value="";	
	document.getElementById('societa').value="";	
	document.getElementById('linefrase').style.display='none';
	document.getElementById('linearag').style.display='none';	
	document.getElementById('lineapiva').style.display='none';	
	document.getElementById('ob_rag').style.display='none';	
	document.getElementById('lineanome').bgColor ='#FAFBFF';	
	document.getElementById('lineacognome').bgColor ='#FAFBFF';
	document.getElementById('ob_piva').style.display='none';
}

function attivaProfessionista()
{
	document.getElementById('societa').value="";	
	document.getElementById('linefrase').style.display='none';
	document.getElementById('linearag').style.display='none';	
	document.getElementById('lineapiva').style.display='';	
	document.getElementById('ob_rag').style.display='none';	
	document.getElementById('lineanome').bgColor ='#FAFBFF';	
	document.getElementById('lineacognome').bgColor ='#FAFBFF';	
	document.getElementById('ob_piva').style.display='';
}

function InviaCommento(prodid,user)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }
	var str= document.getElementById('comment_area').value;
	if(str=='') return;
	str=encodeURIComponent(str);
	document.getElementById('formcomment');
	document.getElementById('inivabt').style.display='none';
	document.getElementById('load').style.display='';
	document.getElementById('comment_area').disabled=1;
	
	var url="ajax.php";
	url=url+"?SESSID="+user;
	url=url+"&op=sendcom";
	url=url+"&prod="+prodid;
	param="comm="+str;
	xmlHttp.open("POST",url,true);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", param.length);
	xmlHttp.setRequestHeader("Connection", "close");
	
	xmlHttp.onreadystatechange = function() {
						if (xmlHttp.readyState == 4 ) {
							commentoInviato(xmlHttp.responseText);
						}
					}
	xmlHttp.send(param);
}

function commentoInviato(str) 
{ 
	document.getElementById('formthanks').style.display='';
	document.getElementById('formcomment').style.display='none';
}


function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    	xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
   	 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

var ping,idv,timeoutTimer,statocheck;

function sendPassword()
{

xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }
	ping=xmlHttp;
var mail=document.getElementById('mail').value;	
if(mail=='') return;
timeoutTimer = setTimeout(onTimeout2, 15000);
document.getElementById('sendbut').style.display='none';	
document.getElementById('loader').style.display='';
var url="ajax.php";
url=url+"?mail="+mail;
url=url+"&op=sendpwd";
xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 && xmlHttp.responseText!='') {
            updatepage(xmlHttp.responseText);
        }
    }
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function onTimeout2()
{
	clearTimeout(timeoutTimer);
	ping.abort();
	Noupdatepage();
}

function updatepage(str) 
{ 
	clearTimeout(timeoutTimer);
	ping.abort();
	document.getElementById('sendbut').style.display='';	
	document.getElementById('loader').style.display='none';	
	var divres = document.getElementById('result');
	divres.innerHTML=str;
}

function Noupdatepage() 
{ 
	document.getElementById('sendbut').style.display='';	
	document.getElementById('loader').style.display='none';	
	alert('Impossibile Completare la Richiesta');
}


function InviaNuovaPassword()
{
}


function ControllaDatiUtente()
{
	var msgCF=ControllaCF(document.formUserInfo.codf.value);
	if( msgCF!='')
	{
		alert( msgCF);
		return false;
	}
	var msgPI=ControllaPIVA(document.formUserInfo.piva.value);
	if( msgPI!='')
	{
		alert( msgPI);
		return false;
	}
	return true;
}

/**************************************
	Controllo del Codice Fiscale
	Linguaggio: JavaScript
***************************************/

function ControllaCF(cf)
{
	var validi, i, s, set1, set2, setpari, setdisp;
	var msg='';
	if( cf == '' )  return '';
	cf = cf.toUpperCase();
	if( cf.length != 16 )
		msg= "La lunghezza del codice fiscale non e'\n"
		+"corretta: il codice fiscale dovrebbe essere lungo\n"
		+"esattamente 16 caratteri.\n";
	validi = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
	for( i = 0; i < 16; i++ ){
		if( validi.indexOf( cf.charAt(i) ) == -1 )
			msg= "Il codice fiscale contiene un carattere non valido `" +
				cf.charAt(i) +
				"'.\nI caratteri validi sono le lettere e le cifre.\n";
	}
	set1 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	set2 = "ABCDEFGHIJABCDEFGHIJKLMNOPQRSTUVWXYZ";
	setpari = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	setdisp = "BAKPLCQDREVOSFTGUHMINJWZYX";
	s = 0;
	for( i = 1; i <= 13; i += 2 )
		s += setpari.indexOf( set2.charAt( set1.indexOf( cf.charAt(i) )));
	for( i = 0; i <= 14; i += 2 )
		s += setdisp.indexOf( set2.charAt( set1.indexOf( cf.charAt(i) )));
	if( s%26 != cf.charCodeAt(15)-'A'.charCodeAt(0) )
		msg = "Il codice fiscale non e' corretto:\n"+
			"il codice di controllo non corrisponde.\n";
	if(msg!='')
	{
		if(ControllaPIVA(cf)=='')return "";
		else return "Il codice fiscale non e' corretto:\n"+
			"il codice di controllo non corrisponde.\n";
	}
	return msg;
}

/*****************************************
	Controllo della Partita I.V.A.
	Linguaggio: JavaScript
******************************************/

function ControllaPIVA(pi)
{
	if( pi == '' )  return '';
	if( pi.length != 11 )
		return "La lunghezza della partita IVA non e'\n" +
			"corretta: la partita IVA dovrebbe essere lunga\n" +
			"esattamente 11 caratteri.\n";
	validi = "0123456789";
	for( i = 0; i < 11; i++ ){
		if( validi.indexOf( pi.charAt(i) ) == -1 )
			return "La partita IVA contiene un carattere non valido e'" +
				pi.charAt(i) + "'.\nI caratteri validi sono le cifre.\n";
	}
	s = 0;
	for( i = 0; i <= 9; i += 2 )
		s += pi.charCodeAt(i) - '0'.charCodeAt(0);
	for( i = 1; i <= 9; i += 2 ){
		c = 2*( pi.charCodeAt(i) - '0'.charCodeAt(0) );
		if( c > 9 )  c = c - 9;
		s += c;
	}
	if( ( 10 - s%10 )%10 != pi.charCodeAt(10) - '0'.charCodeAt(0) )
		return "La partita IVA non e' valida:\n" +
			"il codice di controllo non corrisponde.\n";
	return '';
}

/*****************************************
	Controllo del codice fiscale come se fosse un codice fiscale
	Linguaggio: JavaScript
******************************************/

function ControllaPIVAFC(pi)
{
	if( pi == '' )  return '';
	if( pi.length != 11 )
		return "Codice Fiscale Non Corretto\n";
	validi = "0123456789";
	for( i = 0; i < 11; i++ ){
		if( validi.indexOf( pi.charAt(i) ) == -1 )
			return "Codice Fiscale Non Corretto\n";
	}
	s = 0;
	for( i = 0; i <= 9; i += 2 )
		s += pi.charCodeAt(i) - '0'.charCodeAt(0);
	for( i = 1; i <= 9; i += 2 ){
		c = 2*( pi.charCodeAt(i) - '0'.charCodeAt(0) );
		if( c > 9 )  c = c - 9;
		s += c;
	}
	if( ( 10 - s%10 )%10 != pi.charCodeAt(10) - '0'.charCodeAt(0) )
		return "Codice Fiscale Non Corretto\n";
	return '';
}


function CambiaStatoBarraNewsmail(id,statoMouse)
{
	var divnews = document.getElementById('newsmail'+id);
	var cella = document.getElementById('cella'+id);
	if(divnews==null) return;
	switch(statoMouse)
	 {
		case 0: //MouseOut
			if(divnews.className=='ordine-mostra') cella.className = 'cella_newsmail_aperta';
			else cella.className = 'cella_newsmail_chiusa';
			break;
		case 1: //MouseOver
			cella.className = 'cella_newsmail_hover';
			break;
	 }
}

function CambiaStatoBarraNewsmailClick(id,numdiv)
{
	var divnews;
	var cella;
	for(i=0; i<numdiv; i++)
	 {
		 divnews = document.getElementById('newsmail'+i);
		 cella = document.getElementById('cella'+i);
		 if(divnews==null) continue;
		 if(cella==null) continue;
		 if(i==id) //Cella su cui si è fatto click
		 {
			 if(divnews.className=='ordine-mostra') //Se la cella su cui si è fatto click è aperta la chiudo, altrimenti la apro
			 {
			 	cella.className = 'cella_newsmail_chiusa';
			 	divnews.className = 'ordine-nascondi';
			 }
			 else
			 {
			 	cella.className = 'cella_newsmail_aperta';
			 	divnews.className = 'ordine-mostra';
			 }
		 }
		 else //Le altre cella
		 {
			 cella.className = 'cella_newsmail_chiusa';
			 divnews.className = 'ordine-nascondi';
		 }
	 }
}

function CambiaMese(anno,uid,car,url)
{
	var mese=document.getElementById('mesi').value;
	//alert (mese+" "+uid+" "+car+" "+anno);
	document.location.href=url+"/index2.php?op=eventi&subop=giorno&a="+anno+"&m="+mese+"#date";
}

function CambiaAnno(mese,uid,car,url)
{
	var anno=document.getElementById('anni').value;
	//alert (mese+" "+uid+" "+car+" "+anno);
	document.location.href=url+"/index2.php?op=eventi&subop=giorno&a="+anno+"&m="+mese+"#date";
}

// JavaScript Document
function mail_supporto()
{
  url = "mailto:";
  url += "support";
  url += "@";
  url += "altair3d.com";
  url += "?subject=Richiesta di Supporto Altair3D&body=Scrivi qui di seguito la Segnalazione di Supporto:";
//  document.location = url;
  window.open(url);
//  event.returnValue = 0;
}

function mail_info(indirizzo)
{
  url = "mailto:";
  url += indirizzo;
  /*url += "@";
  url += "simit.it";*/

  document.location = url;
//  window.open(url);
//  event.returnValue = 0;
}

function SetImmagine(name)
{
	document.getElementById('imgC').src=name;
}

function SetImmagine2(name)
{
	document.getElementById('imgF').src=name;
}


var over_Lay = null;
/* code taken from http://home.cogeco.ca/~ve3ll/jstutor5.htm#wi */
xMouse=0;yMouse=0;      // globals to hold coordinates
document.onmousemove=getMouse; // start event listener
function getMouse(e){
	try
	{
		e=e||window.event;
		if (e.pageX||e.pageY){
			xMouse=e.pageX;yMouse=e.pageY;
		} else {
				de=document.documentElement;b=document.body;
				xMouse=e.clientX+(de.scrollLeft||b.scrollLeft)-(de.clientLeft||0);
				yMouse=e.clientY+(de.scrollTop||b.scrollTop) - (de.clientTop||0);
		}
	}
	catch(expc){}
}


function bubble(divid,msg,tabella,left,urlg){
	if(msg=="" || msg== undefined){
		try
		{
			document.getElementById(divid).removeChild(over_Layed);
		}
		catch(e){}
		RipristinaSfondo(tabella);
	}
	else
	{
		CambiaSfondo(tabella);
		over_Layed = document.createElement("div");	
		over_Layed.style.position = "absolute";
		over_Layed.style.height =20+"px";
		if(left==1)	over_Layed.style.left =xMouse-450+"px";
		else 				over_Layed.style.left =xMouse+50+"px";		
		over_Layed.style.top =yMouse-30+"px";
		over_Layed.style.display = "none";
		
		over_Layed.innerHTML = "<table width='400' border='0' cellpadding='0' cellspacing='0'>"+
 "<tr>"+
  "<td background='"+urlg+"/grafica/tab5_up3_sn.png' style='background-repeat:no-repeat; height:8px' ></td>"+
  "<td width='372' background='"+urlg+"/grafica/tab5_up2_centro.png' style='background-repeat:repeat-x;'></td>"+
  "<td width='16' valign='bottom' background='"+urlg+"/grafica/tab5_up2_ds.png' style='background-repeat:no-repeat'></td>"+
 	"</tr>"+
 	"<tr>"+
  "<td background='"+urlg+"/grafica/tab5_side_sn.png' style='background-repeat:repeat-y' width='8'></td>"+
  "<td bgcolor='#FFFFFF'>"+msg+
	"</td>"+
  "<td background='"+urlg+"/grafica/tab5_side_ds.png' style='background-repeat:repeat-y'></td>"+
 	"</tr>"+
 	"<tr>"+
  "<td background='"+urlg+"/grafica/tab5_down2_sn.png' style='background-repeat:no-repeat'></td>"+
  "<td background='"+urlg+"/grafica/tab5_down_centro.png' style='background-repeat:repeat-x' height='10'></td>"+
  "<td background='"+urlg+"/grafica/tab5_down_ds.png' style='background-repeat:no-repeat'></td>"+
 	"</tr>"+
	"</table>";
//		"<table align='left' style='border-color:#DDDDDD; border-style:outset' class='bubbles_gum'><tr><td align='justify' class='bubbles_gum'>&nbsp;&nbsp;" +msg+ "</td></tr></table>";

		document.getElementById(divid).appendChild(over_Layed);
		
		timpop1= setTimeout("showmsg('"+divid+"','"+msg+"')",0);
	}
}

function showmsg(divid,msg){
	if(msg=="" || msg== undefined){
		document.getElementById(divid).removeChild(over_Layed);
	}else{
		over_Layed.style.display = "block";
	}
}

function MostraProdotti(div,NumDiv)
{
	var x;
	var y;
	var z;
	y = document.getElementById('linksu');
	z = document.getElementById('linkgiu');
	var nome_div = 'DIV'+div;
	x = document.getElementById(nome_div);
	var p = document.getElementById('DIV1');
	if(x.className=='ordine-mostra') //Se è visibile, lo nascondo
		{
			x.className = 'ordine-nascondi'
			y.innerHTML = 'Mostra Descrizione';
			z.innerHTML = '';
			p.className = 'ordine-mostra';
		}
	else //Se è nascosto, lo mostro
		{
		 x.className = 'ordine-mostra';
		 y.innerHTML = 'Mostra Prodotti';
		 z.innerHTML = 'Mostra Prodotti';
		 p.className = 'ordine-nascondi';
		}
	
}

	function showToolTip(e,text){
		if(document.all)e = event;
		
		var obj = document.getElementById('bubble_tooltip');
		var obj2 = document.getElementById('bubble_tooltip_content');
		obj2.innerHTML = text;
		obj.style.display = 'block';
		var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
		var leftPos = e.clientX - obj.offsetWidth;
		if(leftPos<0)leftPos = 0;
		obj.style.left = leftPos + 'px';
		obj.style.top = e.clientY - obj.offsetHeight -1 + st + 'px';
	}	
	
	function hideToolTip()
	{
		document.getElementById('bubble_tooltip').style.display = 'none';
		
	}


function showToolTip2(e,text,tabella){
		
		CambiaSfondo(tabella);	
		
		
		if(navigator.userAgent.indexOf("MSIE")<0)
	   {
			var z = document.getElementById('tabella'+tabella);
			z.style.backgroundColor = '#E9F3F6';
	   }
	 else
	  {
	   var y = document.getElementById('tabella'+tabella);
	   y.background = '/grafica/sfondogradcelle.gif';
		 var z = document.getElementById('tabella'+tabella);
		 z.style.backgroundColor = '#E9F3F6';
	  }	
		
		var date = new Date();
		var curDate = null;

		/*do { curDate = new Date(); }
		while(curDate-date < 1000);*/
		
		if(document.all)e = event;
		var obj = document.getElementById('bubble_tooltip2');
		var obj2 = document.getElementById('bubble_tooltip_content2');
		obj2.innerHTML = text;
		obj.style.display = 'block';
		var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
		var leftPos = e.clientX - 410;
		if(leftPos<0)leftPos = 0;
		obj.style.left = leftPos + 'px';
		//obj.style.right = rightPos + 'px';
		obj.style.top = e.clientY + st + 'px';
	}	
	
	function CambiaSfondo(news)
	{
		 if(navigator.userAgent.indexOf("MSIE")<0)
	   {
			var z = document.getElementById('tabella'+news);
			z.style.backgroundColor = '#E9F3F6';
	   }
	 else
	  {
	   var y = document.getElementById('tabella'+news);
	   y.background = '/grafica/sfondogradcelle.gif';
		 var z = document.getElementById('tabella'+news);
		 z.style.backgroundColor = '#E9F3F6';
	  }	
	}
	
	
	function hideToolTip2(index)
	{
		document.getElementById('bubble_tooltip2').style.display = 'none';
		document.getElementById('bubble_tooltip2').style.display = 'none';		
		RipristinaSfondo(index);
	}

	function RipristinaSfondo(tabella)
	{
	 if(navigator.userAgent.indexOf("MSIE")<0)
	   {
		var z = document.getElementById('tabella'+tabella);
		z.style.backgroundColor='';
	   }
	 else
	  {
	   var y = document.getElementById('tabella'+tabella);
	   y.background = '';
		  var z = document.getElementById('tabella'+tabella);
		 z.style.backgroundColor = '';
	  }
	}


function MM_swapImgRestore()
{ //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages()
{ //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d)
{ //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage()
{ //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function mostraNascondi(titolo)
{
	var mp=document.getElementById('mainPag');
	var cp=document.getElementById('carPag');
	var lp=document.getElementById('linkPag');
	
	if(mp.style.display=='none')
	{
		mp.style.display='';
		cp.style.display='None';
		lp.innerHTML='Caratteristiche';		
	}
	else
	{
		mp.style.display='None';
		cp.style.display='';
		lp.innerHTML=titolo;
	}
	
	
}


function ControllaDatiRegUser()
{
 var x,y;
 x=0;/*
 if(document.formregutente.username.value.length<5)
 {
	alert("Inserisci una Username valida con almeno 5 caratteri!");
	document.formregutente.username.focus();
	return false; 
 }
 else
 {
	 y = document.formregutente.username.value;
	 x = x+y.indexOf(' ')+1;	 x = x+y.indexOf('@')+1;	 x = x+y.indexOf('#')+1;	 x = x+y.indexOf('.')+1;
	 x = x+y.indexOf(',')+1;	 x = x+y.indexOf(':')+1;	 x = x+y.indexOf(';')+1;	 x = x+y.indexOf('?')+1;
	 x = x+y.indexOf('!')+1;	 x = x+y.indexOf('\\')+1;	 x = x+y.indexOf('"')+1;	 x = x+y.indexOf('&')+1;
	 x = x+y.indexOf('(')+1;	 x = x+y.indexOf(')')+1;	 x = x+y.indexOf(']')+1;	 x = x+y.indexOf('[')+1;     
	 x = x+y.indexOf('=')+1;	 x = x+y.indexOf('\'')+1;	 x = x+y.indexOf('^')+1;	 x = x+y.indexOf('|')+1;
	 x = x+y.indexOf('+')+1;	 x = x+y.indexOf('-')+1;	 x = x+y.indexOf('*')+1;	 x = x+y.indexOf('/')+1;
	 x = x+y.indexOf('$')+1;	 x = x+y.indexOf('%')+1;	 x = x+y.indexOf('§')+1;	 x = x+y.indexOf('°')+1;
	 x = x+y.indexOf('ì')+1;	 x = x+y.indexOf('ù')+1;	 x = x+y.indexOf('à')+1;	 x = x+y.indexOf('ò')+1;
	 x = x+y.indexOf('è')+1;	 x = x+y.indexOf('é')+1;	 x = x+y.indexOf('ç')+1;	 x = x+y.indexOf('á')+1;
	 if(x>0)
	 {
		alert("Controlla la Username, non sono ammessi spazi e segni di punteggiatura.");
		document.formregutente.username.focus();
		return false; 
	 }
 }*/
 if(document.formregutente.email.value.length<5)
 {
	alert("Inserisci la tua E-Mail!");
	document.formregutente.email.focus();
	return false; 
 }
 if(!document.formregutente.condgen.checked)
 {
	alert('Hai scelto di non accettare quanto specificato nelle Condizioni Generali.\nLa registrazione nel nostro database non pu&ograve; essere fatta.');
	return false;
 }
  if(!document.formregutente.appspec.checked)
 {
	alert('Hai scelto di non accettare quanto specificato nelle Clausole di Approvazione Specifica.\nLa registrazione nel nostro database non pu&ograve; essere fatta.');
	return false;
 }
 /*
 if(!document.formregutente.copy.checked)
 {
	alert('Hai scelto di non accettare quanto specificato nelle condizioni di Copyright.\nLa registrazione nel nostro database non può essere fatta.');
	return false;
 }
 if(!document.formregutente.priv.checked)
 {
	alert('Hai scelto di non accettare quanto specificato nell\'informativa sul trattamento dei dati personali.\nLa registrazione nel nostro database non può essere fatta.');
	return false;
 }*/
 if(document.formregutente.seccod.value.length<3)
 {
	 alert("Inserisci il Codice di Sicurezza!");
	 document.formregutente.seccod.focus();
	 return false;
 }
 return true;	
}

function ControllaDatiRegUserDett()
{
 var x,y;
 x=0;
 if(document.formregutente.username.value.length<5)
 {
	alert("Inserisci una Username valida con almeno 5 caratteri!");
	document.formregutente.username.focus();
	return false; 
 }
 else
 {
	 y = document.formregutente.username.value;
	 x = x+y.indexOf(' ')+1;	 x = x+y.indexOf('@')+1;	 x = x+y.indexOf('#')+1;	 x = x+y.indexOf('.')+1;
	 x = x+y.indexOf(',')+1;	 x = x+y.indexOf(':')+1;	 x = x+y.indexOf(';')+1;	 x = x+y.indexOf('?')+1;
	 x = x+y.indexOf('!')+1;	 x = x+y.indexOf('\\')+1;	 x = x+y.indexOf('"')+1;	 x = x+y.indexOf('&')+1;
	 x = x+y.indexOf('(')+1;	 x = x+y.indexOf(')')+1;	 x = x+y.indexOf(']')+1;	 x = x+y.indexOf('[')+1;     
	 x = x+y.indexOf('=')+1;	 x = x+y.indexOf('\'')+1;	 x = x+y.indexOf('^')+1;	 x = x+y.indexOf('|')+1;
	 x = x+y.indexOf('+')+1;	 x = x+y.indexOf('-')+1;	 x = x+y.indexOf('*')+1;	 x = x+y.indexOf('/')+1;
	 x = x+y.indexOf('$')+1;	 x = x+y.indexOf('%')+1;	 x = x+y.indexOf('§')+1;	 x = x+y.indexOf('°')+1;
	 if(x>0)
	 {
		alert("Controlla la Username, non sono ammessi spazi e segni di punteggiatura.");
		document.formregutente.username.focus();
		return false; 
	 }
 }
 if(document.formregutente.email.value.length<5)
 {
	alert("Inserisci la tua E-Mail!");
	document.formregutente.email.focus();
	return false; 
 }
 if(document.formregutente.nome.value.length<2)
 {
	alert("Inserisci il tuo Nome!");
	document.formregutente.nome.focus();
	return false; 
 }
 if(document.formregutente.cognome.value.length<2)
 {
	alert("Inserisci il tuo Cognome!");
	document.formregutente.cognome.focus();
	return false; 
 }
 if(document.formregutente.indirizzo.value.length<2)
 {
	alert("Inserisci il tuo Indirizzo di residenza!");
	document.formregutente.indirizzo.focus();
	return false; 
 }
 if(document.formregutente.citta.value.length<2)
 {
	alert("Inserisci la tua Citta' di residenza!");
	document.formregutente.citta.focus();
	return false; 
 }
 if(document.formregutente.provincia.value.length<1)
 {
	alert("Inserisci la tua Provincia di residenza!");
	document.formregutente.provincia.focus();
	return false; 
 }
 if(document.formregutente.cap.value.length<1)
 {
	alert("Inserisci il C.A.P. della tua citta' di residenza!");
	document.formregutente.cap.focus();
	return false; 
 }
 if(document.formregutente.nazione.value.length<1)
 {
	alert("Inserisci la tua Nazione di residenza!");
	document.formregutente.nazione.focus();
	return false; 
 }
 if(document.formregutente.piva.value.length<1)
 {
	alert("Inserisci la tua Partita IVA o il tuo Codice Fiscale!");
	document.formregutente.piva.focus();
	return false; 
 }
 if(document.formregutente.tel1.value.length<1)
 {
	alert("Inserisci il tuo numero di Telefono principale!");
	document.formregutente.tel1.focus();
	return false; 
 }
 
 if(document.formregutente.legge[1].checked)
 {
	alert('Hai scelto di non accettare quanto specificato nella Legge sulla Privacy.\nLa registrazione nel nostro database non pu&ograve; essere fatta.');
	//document.formregutente.pulsantesubmit.disabled = true;
	return false;
 }
 if(document.formregutente.contratto[1].checked)
 {
	alert('Hai scelto di non accettare quanto specificato nelle Condizioni Generali del Contratto.\nLa registrazione nel nostro database non pu&ograve; essere fatta.');
	//document.formregutente.pulsantesubmit.disabled = true;
	return false;
 }
 if(document.formregutente.specifica[1].checked)
 {
	alert('Hai scelto di non accettare quanto specificato nelle Clausole Contrattuali indicate nel paragrafo dell\'Approvazione Specifica.\nLa registrazione nel nostro database non pu&ograve; essere fatta.');
	//document.formregutente.pulsantesubmit.disabled = true;
	return false;
 }
 if(document.formregutente.seccod.value.length<3)
 {
	 alert("Inserisci il Codice di Sicurezza!");
	 document.formregutente.seccod.focus();
	 return false;
 }
 return true;	
}

function EvidenziaPagamento(tipo)
{
	var x0, x1, x2, x3, x4;
//Individuo il Browser -- Quel porco di IExporer risponde MALISSIMO all'evento OnChange effettuato sui radio-button
	var InternetExplorer;
	InternetExplorer=0;
	if(navigator.userAgent.indexOf("MSIE")!=-1) InternetExplorer += 1;
	if(InternetExplorer>0) return;
//-----	
	x0 = document.getElementById('paga0');
	x1 = document.getElementById('paga1');
	x2 = document.getElementById('paga2');
	x3 = document.getElementById('paga3');
	try {x4 = document.getElementById('paga4');} catch(e){}
	try {x5 = document.getElementById('paga5');} catch(e){}
	try {x6 = document.getElementById('paga6');} catch(e){}
	x7 = document.getElementById('paga7');
	try { x10 = document.getElementById('paga10');} catch(e){}
	try { x11 = document.getElementById('paga11');} catch(e){}
	try { x12 = document.getElementById('paga12');} catch(e){}
	try { x13 = document.getElementById('paga13');} catch(e){}
	switch(tipo)
	{
		case 0: x0.innerHTML = '<b>Saldo e Ritiro merce in magazzino</b>'; x1.innerHTML = 'Bonifico Bancario <strong>Anticipato</strong>';
				x2.innerHTML = 'Versamento <strong>Anticipato</strong> con Bollettino Postale'; x3.innerHTML = 'Contrassegno'; x7.innerHTML = 'Bonifico BancoPosta <strong>Anticipato</strong>';
				try {x10.innerHTML = 'Bonifico a 30gg. DF';} catch(e){}
				try {x11.innerHTML = 'Bonifico a 60gg. DF';} catch(e){}
				try {x12.innerHTML = 'Bonifico a 90gg. DF';} catch(e){}
				try {x13.innerHTML = 'Rimessa Diretta Vista Fattura';} catch(e){}
				break;
		case 1: x0.innerHTML = 'Saldo e Ritiro merce in magazzino'; x1.innerHTML = '<b>Bonifico Bancario <strong>Anticipato</strong></b>';
				x2.innerHTML = 'Versamento <strong>Anticipato</strong> con Bollettino Postale'; x3.innerHTML = 'Contrassegno'; x7.innerHTML = 'Bonifico BancoPosta <strong>Anticipato</strong>'; 
				break;
		case 2: x0.innerHTML = 'Saldo e Ritiro merce in magazzino'; x1.innerHTML = 'Bonifico Bancario <strong>Anticipato</strong>';
				x2.innerHTML = '<b>Versamento <strong>Anticipato</strong> con Bollettino Postale</b>'; x3.innerHTML = 'Contrassegno'; x7.innerHTML = 'Bonifico BancoPosta <strong>Anticipato</strong>';
				try {x10.innerHTML = 'Bonifico a 30gg. DF';} catch(e){}
				try {x11.innerHTML = 'Bonifico a 60gg. DF';} catch(e){}
				try {x12.innerHTML = 'Bonifico a 90gg. DF';} catch(e){}
				try {x13.innerHTML = 'Rimessa Diretta Vista Fattura';} catch(e){}				
				break;
		case 3: x0.innerHTML = 'Saldo e Ritiro merce in magazzino'; x1.innerHTML = 'Bonifico Bancario <strong>Anticipato</strong>';
				x2.innerHTML = 'Versamento <strong>Anticipato</strong> con Bollettino Postale'; x3.innerHTML = '<b>Contrassegno</b>'; x7.innerHTML = 'Bonifico BancoPosta <strong>Anticipato</strong>'; 
				try {x10.innerHTML = 'Bonifico a 30gg. DF';} catch(e){}
				try {x11.innerHTML = 'Bonifico a 60gg. DF';} catch(e){}
				try {x12.innerHTML = 'Bonifico a 90gg. DF';} catch(e){}
				try {x13.innerHTML = 'Rimessa Diretta Vista Fattura';} catch(e){}				
				break;
		case 4: x4.innerHTML = '<b>RIBA 30 gg. DFFM</b>'; x5.innerHTML = 'Bonifico Bancario <strong>Anticipato</strong>'; x6.innerHTML = '<font color="#FF3333"><small>(<b>*</b>)</small> Porto Assegnato</font>';
				try {x10.innerHTML = 'Bonifico a 30gg. DF';} catch(e){}
				try {x11.innerHTML = 'Bonifico a 60gg. DF';} catch(e){}
				try {x12.innerHTML = 'Bonifico a 90gg. DF';} catch(e){}
				try {x13.innerHTML = 'Rimessa Diretta Vista Fattura';} catch(e){}				
				break;
		case 5: x4.innerHTML = 'RIBA 30 gg. DFFM'; x5.innerHTML = '<b>Bonifico Bancario <strong>Anticipato</strong></b>'; x6.innerHTML = '<font color="#FF3333"><small>(<b>*</b>)</small> Porto Assegnato</font>';
				try {x10.innerHTML = 'Bonifico a 30gg. DF';} catch(e){}
				try {x11.innerHTML = 'Bonifico a 60gg. DF';} catch(e){}
				try {x12.innerHTML = 'Bonifico a 90gg. DF';} catch(e){}
				try {x13.innerHTML = 'Rimessa Diretta Vista Fattura';} catch(e){}				
				break;
		case 6: x4.innerHTML = 'RIBA 30 gg. DFFM'; x5.innerHTML = 'Bonifico Bancario <strong>Anticipato</strong>'; x6.innerHTML = '<font color="#FF3333"><small>(<b>*</b>)</small> <b>Porto Assegnato</b></font>';
				try {x10.innerHTML = 'Bonifico a 30gg. DF';} catch(e){}
				try {x11.innerHTML = 'Bonifico a 60gg. DF';} catch(e){}
				try {x12.innerHTML = 'Bonifico a 90gg. DF';} catch(e){}
				try {x13.innerHTML = 'Rimessa Diretta Vista Fattura';} catch(e){}				
		case 7: x0.innerHTML = 'Saldo e Ritiro merce presso Sede Centrale'; x1.innerHTML = 'Bonifico Bancario <strong>Anticipato</strong>';
				x2.innerHTML = 'Versamento <strong>Anticipato</strong> con Bollettino Postale'; x3.innerHTML = 'Contrassegno'; x7.innerHTML = '<b>Bonifico BancoPosta <strong>Anticipato</strong></b>'; 
				try {x10.innerHTML = 'Bonifico a 30gg. DF';} catch(e){}
				try {x11.innerHTML = 'Bonifico a 60gg. DF';} catch(e){}
				try {x12.innerHTML = 'Bonifico a 90gg. DF';} catch(e){}
				try {x13.innerHTML = 'Rimessa Diretta Vista Fattura';} catch(e){}				
				break;
		case 10: 
				x0.innerHTML = 'Saldo e Ritiro merce presso Sede Centrale'; 
				x1.innerHTML = 'Bonifico Bancario <strong>Anticipato</strong>';
				x2.innerHTML = 'Versamento <strong>Anticipato</strong> con Bollettino Postale'; 
				x3.innerHTML = 'Contrassegno';
				try { x4.innerHTML = 'RIBA 30 gg. DFFM'; } catch(e){}
				try { x5.innerHTML = 'Bonifico Bancario <strong>Anticipato</strong>';} catch(e){}
				try { x6.innerHTML = '<font color="#FF3333"><small>(<b>*</b>)</small> Porto Assegnato</font>';} catch(e){}
				x7.innerHTML = 'Bonifico BancoPosta <strong>Anticipato</strong>'; 
				x10.innerHTML = '<b>Bonifico a 30gg. DF</b>';
				try {x11.innerHTML = 'Bonifico a 60gg. DF';} catch(e){}
				try {x12.innerHTML = 'Bonifico a 90gg. DF';} catch(e){}
				try {x13.innerHTML = 'Rimessa Diretta Vista Fattura';} catch(e){}				
				break;
		case 11: 
				x0.innerHTML = 'Saldo e Ritiro merce presso Sede Centrale'; 
				x1.innerHTML = 'Bonifico Bancario <strong>Anticipato</strong>';
				x2.innerHTML = 'Versamento <strong>Anticipato</strong> con Bollettino Postale'; 
				x3.innerHTML = 'Contrassegno';
				try { x4.innerHTML = 'RIBA 30 gg. DFFM'; } catch(e){}
				try { x5.innerHTML = 'Bonifico Bancario <strong>Anticipato</strong>';} catch(e){}
				try { x6.innerHTML = '<font color="#FF3333"><small>(<b>*</b>)</small> Porto Assegnato</font>';} catch(e){}
				x7.innerHTML = 'Bonifico BancoPosta <strong>Anticipato</strong>'; 
				try {x10.innerHTML = 'Bonifico a 30gg. DF';} catch(e){}
				x11.innerHTML = '<b>Bonifico a 60gg. DF</b>';
				try {x12.innerHTML = 'Bonifico a 90gg. DF';} catch(e){}
				try {x13.innerHTML = 'Rimessa Diretta Vista Fattura';} catch(e){}				
				break;		
		case 12: 
				x0.innerHTML = 'Saldo e Ritiro merce presso Sede Centrale'; 
				x1.innerHTML = 'Bonifico Bancario <strong>Anticipato</strong>';
				x2.innerHTML = 'Versamento <strong>Anticipato</strong> con Bollettino Postale'; 
				x3.innerHTML = 'Contrassegno';
				try { x4.innerHTML = 'RIBA 30 gg. DFFM'; } catch(e){}
				try { x5.innerHTML = 'Bonifico Bancario <strong>Anticipato</strong>';} catch(e){}
				try { x6.innerHTML = '<font color="#FF3333"><small>(<b>*</b>)</small> Porto Assegnato</font>';} catch(e){}
				x7.innerHTML = 'Bonifico BancoPosta <strong>Anticipato</strong>'; 
				try {x10.innerHTML = 'Bonifico a 30gg. DF';} catch(e){}
				try {x11.innerHTML = 'Bonifico a 60gg. DF';} catch(e){}
				x12.innerHTML = '<b>Bonifico a 90gg. DF</b>';
				try {x13.innerHTML = 'Rimessa Diretta Vista Fattura';} catch(e){}				
				break;
		case 13: 
				x0.innerHTML = 'Saldo e Ritiro merce in magazzino'; 
				x1.innerHTML = 'Bonifico Bancario <strong>Anticipato</strong>';
				x2.innerHTML = 'Versamento <strong>Anticipato</strong> con Bollettino Postale'; 
				x3.innerHTML = 'Contrassegno';
				try { x4.innerHTML = 'RIBA 30 gg. DFFM'; } catch(e){}
				try { x5.innerHTML = 'Bonifico Bancario <strong>Anticipato</strong>';} catch(e){}
				try { x6.innerHTML = '<font color="#FF3333"><small>(<b>*</b>)</small> Porto Assegnato</font>';} catch(e){}
				x7.innerHTML = 'Bonifico BancoPosta <strong>Anticipato</strong>'; 
				try {x10.innerHTML = 'Bonifico a 30gg. DF';} catch(e){}
				try {x11.innerHTML = 'Bonifico a 60gg. DF';} catch(e){}
				try {x12.innerHTML = 'Bonifico a 90gg. DF';} catch(e){}
				x13.innerHTML = '<b>Rimessa Diretta Vista Fattura</b>';				
				break;
	}

}

function RichiediDettaglioOrdine(utente,ordine)
{
	window.open('dettaglio.php?SESSID='+utente+'&op=dettaglioord&ordine='+ordine+'','_blank',
				'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=1080,height=820');
}

function MostraRichiesta(rich)
{
	var x;
	var y;
	x = document.getElementById('divrichiesta'+rich);
	y = document.getElementById('linkrichiesta'+rich);
	if(x.className=='ordine-mostra') //Se è visibile, lo nascondo
	{
		x.className = 'ordine-nascondi'
		y.innerHTML = 'Leggi Richiesta';
	}
	else //Se è nascosto, lo mostro
	{
	 x.className = 'ordine-mostra';
	 y.innerHTML = 'Nascondi Richiesta';
	}	

}

function EspandiModuloRichiestaSupp(modulo)
{
	var x;
	var y;
	x = document.getElementById('divfairichiesta'+modulo);
	y = document.getElementById('linkfairichiesta'+modulo);
	if(x.className=='ordine-mostra') //Se è visibile, lo nascondo
	{
		x.className = 'ordine-nascondi'
		y.innerHTML = 'Invia una richiesta...';
	}
	else //Se è nascosto, lo mostro
	{
	 x.className = 'ordine-mostra';
	 y.innerHTML = 'Nascondi Modulo Richiesta';
	}	
}

function EspandiModuloIscrizioneEvento()
{
	var x;
	var y;
	x = document.getElementById('Div_Iscrizione');
	y = document.getElementById('Div_IscrizioneLink');
	if(x.className=='ordine-mostra') //Se è visibile, lo nascondo
	{
		x.className = 'ordine-nascondi'
		y.innerHTML = 'Iscriviti';
	}
	else //Se è nascosto, lo mostro
	{
	 x.className = 'ordine-mostra';
	 y.innerHTML = 'Nascondi Modulo Iscrizione';
	}	
}

function MostraRispostaSupporto(utente,id)
{
	window.open('dettagliosupp.php?SESSID='+utente+'&id='+id+'&op=dettsupp','_blank',
				'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=440,height=600');	
}

function ControllaPartecipanti(NumPartecipanti)
{
	var msg_errore;
	msg_errore = '';
	if(NumPartecipanti>1)
	{
		for(i=0; i<(NumPartecipanti); i++)
		{
			mail_nome = document.getElementById('mailpartec'+i);
			nome_nome = document.getElementById('nomepartec'+i);
			if(nome_nome.value=="") msg_errore = msg_errore +'\n- Nome e Cognome del partecipante '+(i+1);
			if(mail_nome.value=="") msg_errore = msg_errore +'\n- E-Mail del partecipante '+(i+1);
		}
		if(msg_errore!='')
		{
			msg_errore = 'Completare i seguenti campi Obbligatori:\n\n' + msg_errore;
			alert(msg_errore);
			return false;
		}
	}
}

function MessaggioConferma(formn)
{
	var res=confirm('Sicuro di voler cancellare l\'iscrizione al corso?');
	if(res) formn.submit();
}


