
function Giorni(){
var data = new Date ();
var mese = data.getMonth () + 1; //Questo +1 sposta avanti di un mese, perciò: gennaio = 1
var giorno = data.getDate ();

//Gennaio
if (mese == 1 && giorno == 1) //Primo giorno speciale dell'anno
{
document.write(' <img src="immagini/anno032.gif" border="0" width="210" heigth="100" />');
}
else if (mese == 1 && giorno >= 2 && giorno <= 5) //Se sono nello stesso mese (esempio: dal 2 al 5 gennaio compresi)
{
document.write(' <img src="immagini/natale_dex.gif" border="0" width="100" heigth="100" /><br /><br /><font size="3"><i>Buone Feste!</i></font>');
}
else if (mese == 1 && giorno == 6) //Giorno speciale
{
document.write(' <img src="immagini/befana.gif" border="0" width="108" heigth="109" /><br /><br /><font size="3"><i>W la Befana!</i></font>');
}

//Febbraio
else if (mese == 2  && giorno == 14) //Giorno speciale
{
document.write(' <img src="immagini/san-valentino.gif" border="0" width="120" heigth="120" /><br /><br /><font size="3"><i>San Valentino</i></font>');
}
else if (mese == 2 && giorno == 20) //Giorno speciale
{
document.write(' <img src="immagini/carnevale.gif" border="0" width="131" heigth="163" /><br /><br /><font size="3"><i>Carnevale</i></font>');
}
else if (mese == 2 && giorno == 23) //Giorno speciale
{
document.write(' <img src="immagini/happy-birthday.gif" border="0" width="200" heigth="100" /><br /><br /><font size="3"><i>To Fabio</i></font>');
}
else if (mese == 2 && giorno == 24) //Giorno speciale
{  
document.write(' <img src="immagini/happy-birthday.gif" border="0" width="200" heigth="100" /><br /><br /><font size="3"><i>To me</i></font>');
}

//Marzo
else if (mese == 3 && giorno == 8) //Giorno speciale
{
document.write(' <img src="immagini/festa-della-donna.gif" border="0" width="100" heigth="120" /><br /><br /><font size="3">Woman\'s Day</font><br />');
}
else if (mese == 3 && giorno == 13) //Giorno speciale
{
document.write(' <img src="immagini/happy-birthday.gif" border="0" width="200" heigth="100" /><br /><br /><font size="3"><i>To Ron</i></font>');
}
else if (mese == 3 && giorno == 19) //Giorno speciale
{
document.write(' <img src="immagini/happy-father.gif" border="0" width="140" heigth="110" />');
}

//Aprile
else if (mese == 4 && giorno == 1) //Giorno speciale
{
document.write(' <img src="immagini/pesce-aprile.gif" border="0" width="73" heigth="68" /><br /><br /><font size="3"><i>Pesce d\'aprile</i></font>');
}

//Maggio
else if (mese == 5 && giorno == 1) //Giorno speciale
{
document.write(' <img src="immagini/festa-lavoro.gif" border="0" width="100" heigth="100" /><br /><br /><font size="3"><i>Festa del lavoro</i></font>');
}

//Giugno
else if (mese == 6 && giorno == 2) //Giorno speciale
{
document.write(' <img src="immagini/flag-italy.gif" border="0" width="73" heigth="68" /><br /><br /<font size="3"><i>Festa della Repubblica</i></font>');
}

//Settembre
else if (mese == 9 && giorno == 11) //Giorno speciale
{
document.write(' <img src="immagini/usa-flag.gif" border="0" width="55" heigth="55" /><br /><br /><font size="3"><i>Old Glory</i></font>');
}

//Ottobre
else if (mese == 10 && giorno == 31) //Giorno speciale
{
document.write(' <img src="immagini/halloween.gif" border="0" width="97" heigth="90" /><br /><br /><font size="3"><i>Halloween\'s &nbsp;day</i></font>');
}

//Dicembre
else if (mese == 12 && giorno >= 1 && giorno <= 12)//Se sono nello stesso mese (esempio: dal 1 al 12 dicembre compresi)
{
document.write(' <img src="immagini/anno095.gif" border="0" width="170" heigth="123" /><br /><br /><font size="3"><i>Buone feste!</i></font>');
}
else if (mese == 12 && giorno == 13) //Giorno speciale
{
document.write(' <img src="immagini/s_lucia.gif" border="0" width="160" heigth="35" /><br /><br /><font size="3"><i>Santa Lucia</i></font>');
}
else if (mese == 12 && giorno >= 14 && giorno <= 20)//Se sono nello stesso mese (esempio: dal 14 al 20 dicembre compresi)
{
document.write(' <img src="immagini/anno095.gif" border="0" width="170" heigth="123" /><br /><br /><font size="3"><i>Buone feste!</i></font>');
}
else if (mese == 12 && giorno == 21) //Giorno speciale 
{
document.write(' <img src="immagini/natale28.gif" border="0" width="200" heigth="35" />');
}
else if (mese == 12 && giorno == 22) //Giorno speciale
{
document.write(' <i>Buone feste!</i><br /><br /><img src="immagini/natale396.gif" border="0" width="110" heigth="110" />');
}
else if (mese == 12 && giorno == 23) //Giorno speciale
{
document.write(' <img src="immagini/babbo054.gif" border="0" width="105" heigth="135" /><br /><br /><font size="3"><i>...s</font><font size="4">s</font><font size="5">shhh!</i></font>');
}
else if (mese == 12 && giorno == 24) //Giorno speciale
{
document.write(' <img src="immagini/nat15.gif" border="0" width="100" heigth="100" />');
}
else if (mese == 12 && giorno == 25) //Giorno speciale
{
document.write(' <img src="immagini/natale065.gif" border="1" width="195" heigth="100" />');
}
else if (mese == 12 && giorno == 26) //Giorno speciale
{
document.write(' <img src="immagini/popolo5.gif" border="0" width="131" heigth="100" />');
}
else if (mese == 12 && giorno == 27) //Giorno speciale
{
document.write(' <img src="immagini/natale156a.gif" border="0" width="83" heigth="126" /><br /><br /><font size="2"><i>"Finalmente...che faticaccia, ci rivediamo al prossimo anno...<br>Buone Feste!"</i></font>');
}
else if (mese == 12 && giorno >= 28 && giorno <= 29) //Se sono nello stesso mese (esempio: dal 28 al 29 dicembre compresi)
{
document.write(' <img src="immagini/anno095.gif" border="0" width="170" heigth="123" /><br /><br /><font size="3"><i>Buone feste!</i></font>');
}
else if (mese == 12 && giorno == 30) //Giorno speciale
{
document.write(' <img src="immagini/natale_dex.gif" border="0" width="100" heigth="100" /><br /><br /><font size="3"><i>Buon Anno!</i></font>');
}
else if (mese == 12 && giorno == 31) //Giorno speciale
{
document.write(' <img src="immagini/anno032.gif" border="0" width="210" heigth="100" />');
}

//Tutti i giorni rimanenti dell'anno
else
{
document.write(' <img src="immagini/bb.png" border="0" width="200" height="170" />'); 
}
 }
 
//Novembre-Dicembre-Gennaio
function luci(){
var data = new Date ();
var mese = data.getMonth () + 1; //Questo +1 sposta avanti di un mese, perciò: gennaio = 1
var giorno = data.getDate ();
if ((mese == 11 && giorno >= 15) || (mese == 12) || (mese==1 && giorno <= 6)) //Se sono più mesi consecutivi (dal 15 novembre al 6 gennaio)
document.write(' <img src="immagini/lunghe083.gif" border="0" width="780" heigth="4" />');
}
  
//Licenza Creative Commons
function CreativeCommon(){
document.write('<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/2.5/it/deed.it"><img alt="Licenza Creative Commons v.2.5" title="Licenza Creative Commons v.2.5" style="border:none" src="http://creativecommons.org/images/public/somerights20.png" /></a>'); 
}

//Photoman
function PhotomanBig(){
document.write('<img src="immagini/frase-photoman.gif" border="0" width="302" height="62" alt="Photoman Photos" title="Photoman Photos">'); 
}

//Vale per tutte le pagine che lo contengono					
function PhotomanSmall(){   
document.write('<a href="http://s5.histats.com/stats/r.php?14894&amp;100&amp;10&amp;urlr=&amp;photoman.altervista.org"><img src="immagini/image-small.gif" border="0" width="125" height="25" alt="Home page" title="Home page" /></a>'); 
}

//Alberello di Dicembre 
function AlbDic(){
var data = new Date ();
var mese = data.getMonth () + 1; //Questo +1 sposta avanti di un mese, perciò: gennaio = 1
var giorno = data.getDate ();
if ((mese == 12 && giorno >= 1) || (mese == 1 && giorno <= 6)) //Se sono in due mesi consecutivi (dal 1 dicembre al 6 gennaio)
document.write('<img src="immagini/albero1.gif" border="0" width="40" height="60" alt="Alberello di Natale" title="Alberello di Natale" />');
}

function Gallery(){ 
document.write('<a class="pages" href="http://s5.histats.com/stats/r.php?14894&amp;100&amp;4&amp;urlr=&amp;photoman.altervista.org/gallery-out/index.php">Photo Gallery</a>');
}

function Fabio(){ 
document.write('<a class="pages" href="http://s5.histats.com/stats/r.php?14894&amp;100&amp;5&amp;urlr=&amp;photoman.altervista.org/fabio-out/index.php">Remembering Fabio</a>');
}

//Menu a tendina
function mostraMenu(menuCorrente) {
if (document.getElementById) {
questoMenu = document.getElementById(menuCorrente).style
if (questoMenu.display == "block") {
questoMenu.display = "none"
}
else {
questoMenu.display = "block"
}
return false
}
else {
return true
}
 }

function SueFoto(){ 
document.write('<a class="hcb2" href="http://www.magnumphotos.com/Archive/C.aspx?VP3=ViewBox&ALID=2K7O3R14TE52&IT=ThumbImage01_VForm&CT=Album">Le sue foto</a>');
}

function Frasi(){
document.write('<a class="hcb2" href="http://s5.histats.com/stats/r.php?14894&100&9&urlr=&photoman.altervista.org/hcb-frasi.html">Frasi celebri</a>'); 
} 
 
//Data che si aggiorna automaticamente ogni giorno
function WebDate(){
var now = new Date();
var year = (new Date()).getFullYear();
var nameDay = new Array('domenica','lunedi','martedi','mercoledi','giovedi','venerdi','sabato');
var nameMth = new Array('gennaio','febbraio','marzo','aprile','maggio', 'giugno', 'luglio', 'agosto', 'settembre', 'ottobre', 'novembre','dicembre');
document.write(''+nameDay[now.getDay()]+ " " + now.getDate() + " " + nameMth[now.getMonth()] + " " + year+'');
}

function Drugs(){ 
document.write('<a class="drug" href="http://s5.histats.com/stats/r.php?14894&amp;100&amp;3&amp;urlr=&amp;drugfreeworld.org/land/?locale=it" target="_blank">Foundation for a DRUG-FREE World</a>');
} 

function NewIcon(){
document.write('<a href="http://s5.histats.com/stats/r.php?14894&amp;100&amp;6&amp;urlr=&amp;jalbum.net/skins/skin/Photoman\'s%20skin" target="_blank"><img src="immagini/new18.gif" border="0" width="32" height="24" alt="New!" title="New!" /></a>'); 
}

function WebDesigner(){
document.write('<a class="webDesign" href="http://s5.histats.com/stats/r.php?14894&amp;100&amp;7&amp;urlr=&amp;jalbum.net/skins/skin/Photoman\'s%20skin" target="_blank">WebDesign by Photoman Photos</a>'); 
}

//Mettimi nei tuoi Preferiti
function addbookmark(sito,titolo) { //Nescape
if( window.sidebar && window.sidebar.addPanel ) {
if (navigator.userAgent.lastIndexOf("Netscape") != -1) {
window.sidebar.addPanel(titolo, 'http://www.'+sito, '' );
}
else { //Firefox
window.sidebar.addPanel(titolo, 'http://www.'+sito, '' );
}
 }
else  if( window.opera && window.print ) { //Opera
alert("Premere Segnalibri sulla barra in alto");
} 
else if( window.external && ( navigator.platform == 'Win32' || ( window.ScriptEngine && ScriptEngine().indexOf('InScript') + 1 ) ) ) {
window.external.AddFavorite('http://'+sito, titolo);
}
 }

//Anno copyright che si aggiorna automaticamente
function AnnoDate(){
var now = new Date();
var year = now.getYear();
if (year < 1000) year += 1900;
document.write(''+ year+'');
}

function guest(){ 
window.open('http://s5.histats.com/stats/r.php?14894&100&8&urlr=&photoman.altervista.org/guestbook/form.php','guestbook','scrollbars=1,toolbar=0,location=0,directories=0,statusbar=0,menubar=0,left='+((screen.width-800)/2)+',top='+((screen.height-650)/2)+',resizable=0,width=780,height=555');
}

//W3C xhtml 1.0 per la Home
function xhtml(){
document.write('<a class="bordo" href="http://validator.w3.org/check?uri=referer"><img src="immagini/xhtml.gif" alt="W3C Valid XHTML 1.0 Transitional" title="W3C Valid XHTML 1.0 Transitional" border="0" height="21" width="68" /></a>'); 
}

//W3C CSS  per la Home
function css(){
document.write('<a class="bordo" href="http://jigsaw.w3.org/css-validator/validator?uri=photoman.altervista.org&profile=css3"><img src="immagini/css.gif" alt="W3C Valid CSS" title="W3C Valid CSS" title="W3C Valid CSS" title="Valid CSS" border="0" height="21" width="68" /></a>'); 
}

//JAlbum
function JAlbum(){
document.write('<img style="border:0px;" src="http://banners.jalbum.net/res/banners/Green/en/jalbum_88x31.gif" alt="JAlbum" title="JAlbum" /></a>'); 
}

//AllWeb Free
function AllWebFree(){
document.write('<a href="http://www.allwebfree.it/"target="_blank"><img border="0" src="http://www.allwebfree.it/banner/banner3.jpg" border="0" height="31" width="88" alt="All WEB free" title="All WEB free" /></a>'); 
}

function Altervista(){
var l='it';
document.write('<s'+'cript type="text/javascript" src="http://'+l+'.altervista.org/members_inc/cat.av?'+new Date().getTime()+'"><\/s'+'cript>');
}

function Leica(){
document.write('<a href="http://leica-camera.it/home/" target="_blank"><img src="immagini/leica.gif" border="0" width="468" height="60" alt="Leica Camera AG" title="Leica Camera AG" /></a>'); 
}

function Canon(){
document.write('<a href="http://www.canonclubitalia.com/" target="_blank"><img src="http://www.fotobanner.it/public/banner/canonclub.gif" width="468" height="60" border="0" alt="Community Fotografica Canon Club Italia" /></a>');
}

function fotobanner(){
var ban= '';
ban += '<!-- www.fotobanner.it -->';
ban += '<iframe src="http://www.fotobanner.it/banner.asp?id=19" border="0" width="468" height="60" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no" /></iframe>';
ban += '<!-- Fine codice Banner fotobanner -->';
ban += '<a class="fotobanner" href="http://www.fotobanner.it/login.asp">fotobanner.it</a>';
document.write(ban);
} 

function BannerPromotion(){
var ban='';
<!--BannerPromotion.it Inizio Codice-->
ban += '<iframe width="468" height="60" noresize="noresize" scrolling="no" frameborder="0" marginheight="0" marginwidth="0" src="http://www.bannerpromotion.it/show.php?m=10097&amp;g=1&amp;t=iframe">';
ban += '<a href="http://www.bannerpromotion.it/go.php?m=10097"><img alt="Clicca qui!" border="0" src="http://www.bannerpromotion.it/show.php?m=10097&amp;g=1&amp;t=image" width="468" height="60" /></a></iframe>';
ban += '<a href="http://www.bannerpromotion.it/bxsql-join.php?group=1&amp;refer=10097" target="_blank">';
ban += '<img src="http://www.bannerpromotion.it/images/down.gif" alt="Iscriviti subito a BannerPromotion.it" border="0" /></a>';
<!--BannerPromotion.it Fine Codice-->
document.write(ban);
}


        /*  Fine Home page */
/* ---------------------------------- */
          /* HCB-frasi */


function foto1(){
document.write('<img src="immagini/hcb-1.jpg" border="1" width="300" heigth="100" />'); 
}

function foto2(){
document.write('<img src="immagini/hcb-2.jpg" border="1" width="120" heigth="100" />'); 
}

function foto3(){
document.write('<img src="immagini/hcb-3.jpg" border="1" width="220" heigth="100" />'); 
}

function foto4(){
document.write('<img src="immagini/hcb-4.jpg" border="1" width="180" heigth="100" />'); 
}


/* ---------------------------------- */
         /* W3C per HCB */



//W3C xhtml 1.0 
function xhtmlHCB(){
document.write('<a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Transitional" title="Valid XHTML 1.0 Transitional" border="0" height="31" width="88" /></a>'); 
}

//W3C CSS 
function cssHCB(){
document.write('<a href="http://jigsaw.w3.org/css-validator/validator?uri=photoman.altervista.org/hcb-frasi.html&profile=css3"><img src="http://www.w3.org/Icons/valid-css" alt="Valid CSS" title="Valid CSS" border="0" height="31" width="88" /></a>'); 
}

/* ---------------------------------- */
            /* Scrivimi1 */



// Per scrivimi1 
function data_locale(){  
var data_ora_oggi = document.getElementById("hdn_data_locale"); 
data_ora_oggi.value = new Date().toLocaleDateString()+" - "+new Date().toTimeString();  
}
  
//Parole proibite
function xxx1(){ 
var f = document.forms.mioform1; 
var parole = new RegExp("(cazz(o|i)|fig(a|he)|fic(a|he)|merd(a|e)|coglion(i|e)|troi(a|e)|puttan(a|e)|cagat(a|e)|cagare|stronz(o|i))"); 
var stringhe = ["nome","suoemail","citta","messaggio"]; 
for (i=0; i<stringhe.length; i++){
var campo = f.elements[stringhe[i]];
if(campo.value.match(parole) && campo.value.match(parole)[0]){ 
campo.style.backgroundColor='red' 
alert("La parola '"+campo.value.match(parole)[0]+"' non è ammessa"); 
campo.focus(); 
return false; 
} 
 }
return true; 
}
function controlla1(){ 
var f = document.forms.mioform1;
//.value == "" rende il campo obbligatorio,anche lo spazio bianco iniziale fa uscire l'alert
if(f.nome.value == ""){
f.nome.style.borderColor='black'
f.nome.style.backgroundColor='yellow'
alert("Inserire il Nome");
f.nome.focus();
return false;
}
if((f.nome.value.indexOf("<") != -1) || (f.nome.value.indexOf(">") != -1) || (f.nome.value.indexOf("\\") != -1)){
f.nome.style.backgroundColor='red'
alert("I caratteri  <  > \\  non sono ammessi");
f.nome.focus();
return false;
}
if((f.citta.value.indexOf("<") != -1) || (f.citta.value.indexOf(">") != -1) || (f.citta.value.indexOf("\\") != -1)){
f.citta.style.backgroundColor='red'
alert("I caratteri  <  >  \\  non sono ammessi");
f.citta.focus();
return false; 
}
//Valida l'Email  (Campo obbligatorio)                                           
if(f.suoemail.value == ""){
f.suoemail.style.borderColor='black'
f.suoemail.style.backgroundColor='yellow'
alert("Inserire l'Email");
f.suoemail.focus();
return false;
}                                                                          
//Valida email
//Accetta _.a-z0-9 ma non ammette _. all'inizio e alla fine dell'username, min 3 caratteri iniziali
var reg = new RegExp("^([a-z0-9][_.a-z0-9]+[a-z0-9])[@][-.a-z0-9]+(\\.[a-z]{2,4})$");
if(!f.suoemail.value.match(reg)){ 
f.suoemail.style.borderColor='black'
f.suoemail.style.backgroundColor='yellow'
alert("Inserire un'Email valida");
f.suoemail.focus();
return false;
}
//(Campo obbligatorio) 
if(f.messaggio.value == ""){ 
f.messaggio.style.borderColor='black'
f.messaggio.style.backgroundColor='yellow'
alert("Inserire il Messaggio");
f.messaggio.focus();
return false;
}
if((f.messaggio.value.indexOf("<") != -1) || (f.messaggio.value.indexOf(">") != -1) || (f.messaggio.value.indexOf("\\") != -1)){
f.messaggio.style.backgroundColor='red'
alert("I caratteri  <  >  \\  non sono ammessi");
f.messaggio.focus();
return false;
}
//(Campo obbligatorio)
if(f.validator.value == ""){
f.validator.style.borderColor='black'
f.validator.style.backgroundColor='yellow'
alert("Inserire il Codice");
f.validator.focus();
return false;
}
if((f.validator.value.indexOf("<") != -1) || (f.validator.value.indexOf(">") != -1) || (f.validator.value.indexOf("\\") != -1)){
f.validator.style.backgroundColor='red'
alert("I caratteri  <  >  \\  non sono ammessi");
f.validator.focus();
return false;
}
return true;
}
//Rimuove tutti gli spazi (attacca le parole) (per Segnala sito e Scrivimi)
function ignoreSpaces(string){
var temp = "";
string = '' + string;
splitstring = string.split(" ");
for(i = 0; i < splitstring.length; i++)
temp += splitstring[i];
return temp;
}
//Caratteri max inseribili nel campo NOME (compresi gli spazi), è invisibile ma a 20 esce l'alert
function contaNomeScrivimi1(val){
max=20
if (val.nome.value.length > max){
val.nome.value = val.nome.value.substring(0,max)
rest = 0
alert("Hai inserito i 20 caratteri max consentiti !");
} 
else{
rest = max - val.nome.value.length
}
 }
//Caratteri max inseribili nel campo CITTA' (compresi gli spazi), è invisibile ma a 20 esce l'alert
function contaCittaScrivimi1(val){
max=20
if (val.citta.value.length > max){
val.citta.value = val.citta.value.substring(0,max)
rest = 0
alert("Hai inserito i 20 caratteri max consentiti !");
} 
else{
rest = max - val.citta.value.length
}
 }
//Caratteri max inseribili nel campo EMAIL (compresi gli spazi), è invisibile ma a 50 esce l'alert
function contaEmailScrivimi1(val){
max=50
if (val.suoemail.value.length > max){
val.suoemail.value = val.suoemail.value.substring(0,max)
rest = 0
alert("Hai inserito i 50 caratteri max consentiti !");
} 
else{
rest = max - val.suoemail.value.length
}
 } 
//Caratteri max inseribili nel campo MESSAGGIO (compresi gli spazi), è invisibile ma a 500 esce l'alert
function contaMessaggioScrivimi1(val){
max=500
if (val.messaggio.value.length > max){
val.messaggio.value = val.messaggio.value.substring(0,max)
rest = 0
alert("Hai inserito i 500 caratteri max consentiti !");
} 
else{
rest = max - val.messaggio.value.length
}
 }
//Colora il campo nel quale si sta digitando (per Segnala sito e Scrivimi)
function highlight(e){
eventobj=ns6? e.target : event.srcElement
if (previous!=''){
if (checkel(previous))
previous.style.borderColor=''
previous.style.backgroundColor=''
previous=eventobj
if (checkel(eventobj))
eventobj.style.borderColor=highlightcolor
eventobj.style.backgroundColor=highlightcolor
}
else{
if (checkel(eventobj))
eventobj.style.borderColor=highlightcolor
eventobj.style.backgroundColor=highlightcolor
previous=eventobj
}
 }
var highlightcolor="white"
var ns6=document.getElementById&&!document.all
var previous=''
var eventobj
//Regular expression to highlight only form elements
var intended=/INPUT|TEXTAREA|SELECT|OPTION/
//Function to check whether element clicked is form element
function checkel(which){
if (which.style&&intended.test(which.tagName)){
if (ns6&&eventobj.nodeType==3)
eventobj=eventobj.parentNode.parentNode
return true
}
else
return false
}
//Formatta il testo con B, I, U e Color
function insert_tag(codice,colore){
var tarea=document.forms.mioform1.messaggio;
tarea.focus();
if(document.selection){                //--------> IE
var selezionato=document.selection;
var rng=selezionato.createRange();
if(rng!=null && (selezionato.type=='Text' || selezionato.type=='None')){
messaggio_trg=rng.text;
}
if(rng!=null && tarea.createTextRange){
tarea.caretPos=rng.duplicate();
}
var caretPos=tarea.caretPos;
if(colore){                        //--------> colore
caretPos.text='['+codice+'='+colore+']'+messaggio_trg+'[/'+codice+']';
}
else{
caretPos.text='['+codice+']'+messaggio_trg+'[/'+codice+']';
}
 }
else if(tarea.selectionStart || tarea.selectionStart=='0'){       //-------- > FF
if(tarea.selectionStart!=tarea.selectionEnd){
var inizio_sel=tarea.selectionStart;
var fine_sel=tarea.selectionEnd;
var messaggio_trg=(tarea.value).substring(inizio_sel,fine_sel);
}
else{
var messaggio_out=prompt('Inserisci il testo da formattare','');
if(messaggio_out!=undefined && messaggio_out!=null && messaggio_out!=''){
messaggio_trg=messaggio_out;
}
else{
messaggio_trg='';
}	
 }
if(messaggio_trg!='' && messaggio_trg!=null){
var inizio_sel=tarea.selectionStart;
var fine_sel=tarea.selectionEnd;
var inizio=(tarea.value).substring(0,inizio_sel);
var fine=(tarea.value).substring(fine_sel,tarea.textLength);
if(colore){                                                             //---------> colore
tarea.value=inizio+'['+codice+'='+colore+']'+messaggio_trg+'[/'+codice+']'+fine;
}
else{
tarea.value=inizio+'['+codice+']'+messaggio_trg+'[/'+codice+']'+fine;
}
 }
  }
else{              //--------> altri Browser
var messaggio_out=prompt('INSERISCI IL TESTO DA FORMATTARE','');
if(messaggio_out!=undefined && messaggio_out!=null && messaggio_out!=''){
tarea.value+='['+codice+']'+messaggio_out+'[/'+codice+']';
}
else{
tarea.value+='['+codice+'][/'+codice+']';
}
 }
tarea.focus();
}

function Captca(){
document.write('<img src="Captcha/captca-image.php" alt="CAPTCHA image" title="CAPTCHA image" width="70" height="30" vspace="1" align="top" />');
}

/* ---------------------------------- */
            /* Segnala1 */
						
						
// Per segnala1
function data_locale2(){  
var data_ora_oggi2 = document.getElementById("hdn_data_locale2"); 
data_ora_oggi2.value = new Date().toLocaleDateString()+" - "+new Date().toTimeString();  
}						
												
//Parole proibite
function xxxScriv2(){
var f = document.forms.mioform2; 
var parole = new RegExp("(cazz(o|i)|fig(a|he)|fic(a|he)|merd(a|e)|coglion(i|e)|troi(a|e)|puttan(a|e)|cagat(a|e)|cagare|stronz(o|i))"); 
var stringhe = ["tuonome","emailsender","nomeamico","emailamico"]; 
for (i=0; i<stringhe.length; i++){
var campo = f.elements[stringhe[i]];
if(campo.value.match(parole) && campo.value.match(parole)[0]){ 
campo.style.backgroundColor='red' 
alert("La parola '"+campo.value.match(parole)[0]+"' non è ammessa"); 
campo.focus(); 
return false; 
} 
 }
return true; 
}
function controlla2(){
var f = document.forms.mioform2;
//.value == "" rende il campo obbligatorio,anche lo spazio bianco iniziale fa uscire l'alert
if(f.tuonome.value == ""){
f.tuonome.style.borderColor='black'
f.tuonome.style.backgroundColor='yellow'
alert("Inserisci il tuo Nome");
f.tuonome.focus();
return false;
}
if((f.tuonome.value.indexOf("<") != -1) || (f.tuonome.value.indexOf(">") != -1) || (f.tuonome.value.indexOf("\\") != -1)){
f.tuonome.style.backgroundColor='red'
alert("I caratteri  <  > \\  non sono ammessi");
f.tuonome.focus();
return false;
}
//Valida emailsender (Campo obbligatorio)
if(f.emailsender.value == ""){
f.emailsender.style.borderColor='black'
f.emailsender.style.backgroundColor='yellow'
alert("Inserisci la tua Email");
f.emailsender.focus();
return false;
}
//Accetta _.a-z0-9 ma non ammette _. all'inizio e alla fine dell'username, min 3 caratteri iniziali
var reg = new RegExp("^([a-z0-9][_.a-z0-9]+[a-z0-9])[@][-.a-z0-9]+(\\.[a-z]{2,4})$");
if(!f.emailsender.value.match(reg)){ 
f.emailsender.style.borderColor='black'
f.emailsender.style.backgroundColor='yellow'
alert("Inserisci una tua Email valida");
f.emailsender.focus();
return false;
}
//(Campo obbligatorio)
if(f.nomeamico.value == ""){
f.nomeamico.style.borderColor='black'
f.nomeamico.style.backgroundColor='yellow'
alert("Inserisci il Nome del tuo amico");
f.nomeamico.focus();
return false;
}
if((f.nomeamico.value.indexOf("<") != -1) || (f.nomeamico.value.indexOf(">") != -1) || (f.nomeamico.value.indexOf("\\") != -1)){
f.nomeamico.style.backgroundColor='red'
alert("I caratteri  <  > \\  non sono ammessi");
f.nomeamico.focus();
return false;
}
//Valida mailamico (Campo obbligatorio)
if(f.emailamico.value == ""){
f.emailamico.style.borderColor='black'
f.emailamico.style.backgroundColor='yellow'
alert("Inserisci l'Email del tuo amico");
f.emailamico.focus();
return false;
}
//Accetta _.a-z0-9 ma non ammette _. all'inizio e alla fine dell'username, min 3 caratteri iniziali
var reg = new RegExp("^([a-z0-9][_.a-z0-9]+[a-z0-9])[@][-.a-z0-9]+(\\.[a-z]{2,4})$");
if(!f.emailamico.value.match(reg)){ 
f.emailamico.style.borderColor='black'
f.emailamico.style.backgroundColor='yellow'
alert("Inserisci un'Email valida del tuo amico");
f.emailamico.focus();
return false;
}
return true;
}
//Caratteri max inseribili nel campo IL TUO NOME (compresi gli spazi), è invisibile ma a 20 esce l'alert
function contaTuoNomeSegnala1(val){
max=20
if (val.tuonome.value.length > max){
val.tuonome.value = val.tuonome.value.substring(0,max)
rest = 0
alert("Hai inserito i 20 caratteri max consentiti !");
} 
else{
rest = max - val.tuonome.value.length
}
 }
//Caratteri max inseribili nel campo LA TUA EMAIL (compresi gli spazi), è invisibile ma a 50 esce l'alert
function contaTuaEmailSegnala1(val){
max=50
if (val.emailsender.value.length > max){
val.emailsender.value = val.emailsender.value.substring(0,max)
rest = 0
alert("Hai inserito i 50 caratteri max consentiti !");
} 
else{
rest = max - val.emailsender.value.length
}
 } 
//Caratteri max inseribili nel campo IL NOME DEL TUO AMICO (compresi gli spazi), è invisibile ma a 20 esce l'alert
function contaNomeAmicoSegnala1(val){
max=20
if (val.nomeamico.value.length > max){
val.nomeamico.value = val.nomeamico.value.substring(0,max)
rest = 0
alert("Hai inserito i 20 caratteri max consentiti !");
} 
else{
rest = max - val.nomeamico.value.length
}
 }
//Caratteri max inseribili nel campo L'EMAIL DEL TUO AMICO (compresi gli spazi), è invisibile ma a 50 esce l'alert
function contaEmailAmicoSegnala1(val){
max=50
if (val.emailamico.value.length > max){
val.emailamico.value = val.emailamico.value.substring(0,max)
rest = 0
alert("Hai inserito i 50 caratteri max consentiti !");
} 
else{
rest = max - val.emailamico.value.length
}
 }  






