if(location.hostname=='www.fan-club.it') {
	var pozione,sottodominio=location.pathname+"/";
	posizione=sottodominio.indexOf("/",1);
	sottodominio=sottodominio.slice(1,posizione);
	location.href="http://www."+sottodominio+".fan-club.it";
}
function cosa_serve() {
	alert("A volte capita che nei messaggi qualcuno faccia finta di essere un altro, firmandosi con il nome di un'altra persona che scrive solitamente nello stesso sito.\nPer evitare questo è possibile autenticare il proprio messaggio utilizzando il proprio nome utente e la propria password del forum, permettendo a chi legge di essere sicuro dell'autenticità dell'autore.\nI messaggi autenticati sono identificabili dagli altri perchè cliccando sul nome dell'autore appare il profilo presente nel forum.");
}
function f_m_autenticato() {
	if(document.form_commento.messaggio_autenticato.checked) {
		document.getElementById('div_messaggio_autenticato').style.display='block';
	} else {
		document.form_commento.password.value='';
		document.getElementById('div_messaggio_autenticato').style.display='none';
	}
}
function mostradiv(div) {
	if(document.getElementById(div).style.display=="none") document.getElementById(div).style.display="block";
 	 else document.getElementById(div).style.display="none";
}
function foto(str,w,h,didascalia) {
	var scrolla="no";
	if(w>screen.width-37) {
		w=screen.width;
		scrolla="yes";
	};
	if(h>screen.height-30) {
		h=screen.height;
		scrolla="yes";
	};
	if(typeof didascalia=="undefined" || didascalia=="") didascalia="";
	 else {
	 	didascalia=urlencode(didascalia);
		h=h+40;
	}
	finestra = window.open("visualizza_foto.php?foto="+str+'&didascalia='+didascalia,Math.round(1000*Math.random()).toString(),'scrollbars='+scrolla+',resizable=no,width='+w+',height='+h+',status=no,location=no,toolbar=no');
}
function Get_Cookie(check_name) {
	var a_all_cookies=document.cookie.split(';');
	var a_temp_cookie='';
	var cookie_name='';
	var cookie_value='';
	var b_cookie_found = false;
	for (i=0;i<a_all_cookies.length;i++) {
		a_temp_cookie=a_all_cookies[i].split( '=' );
		cookie_name=a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
		if (cookie_name==check_name) {
			b_cookie_found=true;
			if (a_temp_cookie.length>1) cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			return cookie_value;
			break;
		}
		a_temp_cookie=null;
		cookie_name='';
	}
	if(!b_cookie_found) return null;
}

function Set_Cookie( name, value, expires, path, domain, secure ) {
	var today = new Date();
	today.setTime( today.getTime() );
	if (expires) expires = expires * 1000 * 60 * 60 * 24;
	var expires_date = new Date( today.getTime() + (expires) );
	document.cookie = name + "=" +escape( value ) +
		( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
		( ( path ) ? ";path=" + path : "" ) + 
		( ( domain ) ? ";domain=" + domain : "" ) +
		( ( secure ) ? ";secure" : "" );
}

function Delete_Cookie(name,path,domain) {
	if (Get_Cookie(name)) document.cookie=name+"="+
			((path) ? ";path=" + path : "") +
			((domain) ? ";domain=" + domain : "" ) +
			";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

function cookieabilitati() {
	Set_Cookie('test','none','','/','','');
	if (Get_Cookie('test')) {
		Delete_Cookie('test','/','');
		return true;
	} else {
		alert("Il tuo browser non ha i cookie abilitati, quindi non è possibile votare");
		return false;
	}
}
function Trim(StrToTrim) {
    if (typeof StrToTrim != "string") return StrToTrim;
    var StrBlank = StrToTrim.substring(0, 1);
    while (StrBlank == " ") {
        StrToTrim = StrToTrim.substring(1, StrToTrim.length);
        StrBlank = StrToTrim.substring(0, 1);
    }
    StrBlank = StrToTrim.substring(StrToTrim.length - 1, StrToTrim.length);
    while (StrBlank == " ") {
        StrToTrim = StrToTrim.substring(0, StrToTrim.length-1);
        StrBlank = StrToTrim.substring(StrToTrim.length-1, StrToTrim.length);
    }
    while (StrToTrim.indexOf("  ") != -1) {
        StrToTrim = StrToTrim.substring(0, StrToTrim.indexOf("  "));
        StrToTrim += StrToTrim.substring(StrToTrim.indexOf("  ") + 1, StrToTrim.length);
    }
    return StrToTrim;
}
