var dom = {
	document	: document,
	functions	: new Array(),
	loaded 		: false,
	loadTimer	: '',
	slider 		: {
		init : function(id,par,direction){
			if(typeof direction =='undefined' || direction==''){ direction = -1; }
			
			this.prop = 'marginLeft';
			this.mult = 0.8;
			this.multFactor = 1.2;
			this.factor = 3;
			this.o = parent.getElement(id);
			this.h = 720+14+2; //14 è il padding
			t = parseFloat(parent.getStyle(this.o,this.prop)); //di quanto spostarsi
			alert(t+" "+this.h+" "+Math.abs(t)/this.h);
			this.x = t!=0?parseInt(Math.abs(t)/this.h):0; //fattore di moltiplicazione degli spostamenti
			alert(this.x);
			this.timeout = setTimeout('dom.slider.slide("'+id+'","'+par+'","'+direction+'")',5);
			this.finished = false;
			if(direction!=this.direction){
				clearInterval(this.interval);
				this.interval = 0;
			}
			this.direction = direction;
		},
		slide : function(id,par,direction){			
			t = parseFloat(parent.getStyle(this.o,this.prop)); //di quanto spostarsi
			
			//this.mult = (direction==-1 && Math.abs(t)-(x*this.h)<(this.h/2) || direction==1 && Math.abs(t)-(x*this.h)>(this.h/2))?(this.mult*this.multFactor<20?this.mult*this.multFactor:20):(this.mult/this.multFactor>1?this.mult/this.multFactor:1);
			t = t+(this.factor*this.direction*this.mult);
			
			if((this.direction == 1 && t<=this.h*(this.x-1)) || (this.direction!=1 && Math.abs(t)<=this.h*(this.x+1))){
				//alert(direction+" "+t+" "+(this.h*(this.x-1)));
				parent.setStyle(this.o,this.prop,t+"px");
				if(this.interval==0){
					this.interval = setInterval('dom.slider.slide("'+id+'","'+par+'","'+this.direction+'")',25);
				}
			} else {
				this.finished = true;
				if(this.direction!=1 && Math.abs(t)>this.h){ parent.setStyle(this.o,this.prop,(this.x+1)*this.h*this.direction+"px"); }
				else if(this.direction==1 && t!=this.h*(this.x-1)){	parent.setStyle(this.o,this.prop,(this.x-1)*this.h*direction+"px");	}
				clearInterval(this.interval);
				this.interval = 0;
			}
		},
		stop : function (){
			if(this.direction!=1 || this.finished){
				clearInterval(this.interval);
				this.interval = 0;
			}
			clearTimeout(this.timeout);
			this.timeout = 0;
		}		
	}
}

dom.onload = function(){
	this.loadTimer = '';
	if(this.document.body!=null){
		this.loaded = true;
		for(_i=0;_i<this.functions.length;_i++){
			eval(this.functions[_i]);
		}
	} else { if(this.loadTimer==''){ this.loadTimer = setTimeout("dom.onload()",300); } }
}

dom.addOnload = function(callback){
	dom.functions[dom.functions.length] = callback;
}

dom.onload();

function createElement(elmName){
	if(arguments.length==1){
		return document.createElement(elmName);
	} else {
		if(document.all==undefined){
			ret = document.createElement(elmName);
			for(i=1;i<arguments.length;i++){
				eval("ret.setAttribute('"+arguments[i]+"','"+arguments[++i]+"')");
			}
		} else {
			props = "";
			for(i=1;i<arguments.length;i++){
				props += ' '+arguments[i]+'="'+arguments[++i]+'"';
			}
			eval("ret = document.createElement('<'+elmName+props+'>')");
		}
		return ret;
	}
}

function destroyElement(elmName){
	if(getElement(elmName)){
		document.body.removeChild(getElement(elmName));
	}
}

function getElement(elm){
	try {
		return document.getElementById(elm);
	} catch(e){
		try {
			return document.all(elm);
		} catch(e){ return false; }
	}
}

function setStyle(obj,property,value){
	if(obj!=null){
		try{
			eval('obj.style.'+property+' = "'+value+'"');
		} catch (e){
			eval('obj.'+property+' = "'+value+'"');
		}
	}
}

function getStyle(obj,property){
	if(obj!=null){
		try{ eval('ret = obj.style.'+property+';'); }
		catch (e){ eval('ret = obj.'+property+';'); }
		return ret;
	}
	return null;
}

function scrollTop(){
	if (document.documentElement && document.documentElement.scrollTop)
		theTop = document.documentElement.scrollTop;
	else if (document.body)
		theTop = document.body.scrollTop;
	return theTop;
}

function scrollLeft(){
	if (document.documentElement && document.documentElement.scrollLeft)
		theTop = document.documentElement.scrollLeft;
	else if (document.body)
		theTop = document.body.scrollLeft;
	return theTop;
}

function setAttribute(obj,attr,value){
	if(typeof eval("obj."+attr)!="undefined") {
		eval("obj."+attr+" = function(){ "+value+" }");
	} else if(obj.setAttribute){
		obj.setAttribute(attr,value);
	}
}

function checkFCK(item){
	if(typeof(FCKeditorAPI)!="undefined"){
		return ((FCKeditorAPI.GetInstance(item).GetXHTML() != '' && FCKeditorAPI.GetInstance(item).GetXHTML() != '<br>'))?1:0;
	} else {
		return ((document.forms['main'].elements[item].value != '' && document.forms['main'].elements[item].value != '<br>'))?1:0;
	}
}

function fetchFCK(item){
	return escape(((typeof(FCKeditorAPI)!="undefined")?FCKeditorAPI.GetInstance(item).GetXHTML():document.forms['main'].elements[item].value));
}

var Table = {
};

Table.create = function(){
	table = createElement("table");
}
Table.addThead = function(){
	thead = createElement("thead");
	table.appendChild(thead);
}
Table.addTbody = function(){
	tbody = createElement("tbody");
	table.appendChild(tbody);
}
Table.addTfoot = function(){
	tfoot = createElement("tfoot");
	table.appendChild(tfoot);
}
Table.addTr = function(dest){
	tr = createElement("tr");
	eval("dest.appendChild(tr)");
	return tr;
}
Table.addTd = function(dest){
	td = createElement("td");
	eval("dest.appendChild(td)");
	return td;
}
Table.display = function(dest){
	eval("dest.appendChild(table)");
}
Table.object = function(){
	return table;
}

function offsetX(event){
	if(event.offsetX){
		return event.offsetX;
	} else if(event.layerX){
		return event.layerX;
	} else {
		return false;
	}
}

function offsetY(event){
	if(event.offsetY){
		return event.offsetY;
	} else if(event.layerY){
		return event.layerY;
	} else {
		return false;
	}
}

var tinyId;
tinyId = new Array();
function initEditor(id) {
	tinyMCE.execCommand('mceAddControl', false, id);
	tinyId[tinyId.length] = id;
}

function toggle(act){
	id = 'testo';
	if(act==false){
		alert("remove");
		tinyMCE.execCommand('mceRemoveControl', false, id);
	} else {
		alert("add");
		tinyMCE.execCommand('mceAddControl', false, id);
	}
}

function doLogout(){
	ajax.load('utenti.php','logout&sezione=main');
}

Array.in_array = function(arr,key){
	for(i=0;i<arr.length;i++){
		if(arr[i]==key){ return i; }
	}
	return -1;
}

function in_array(arr,key){
	for(i=0;i<arr.length;i++){
		if(arr[i]==key){ return i; }
	}
	return -1;
}

/* --------------------------------------------------------------------------------------- */

function setStar(id){
	getElement('star1').src=path+(id>=1?"images/star.png":"images/emptystar.png");
	getElement('star2').src=path+(id>=2?"images/star.png":"images/emptystar.png");
	getElement('star3').src=path+(id>=3?"images/star.png":"images/emptystar.png");
	getElement('star4').src=path+(id>=4?"images/star.png":"images/emptystar.png");
	getElement('star5').src=path+(id==5?"images/star.png":"images/emptystar.png");
}

function resetStar(val){
	getElement('star1').src=path+(val>=1?"images/star.png":(val<0.5?"images/emptystar.png":"images/halfstar.png"));
	getElement('star2').src=path+(val>=2?"images/star.png":(val<1.5?"images/emptystar.png":"images/halfstar.png"));
	getElement('star3').src=path+(val>=3?"images/star.png":(val<2.5?"images/emptystar.png":"images/halfstar.png"));
	getElement('star4').src=path+(val>=4?"images/star.png":(val<3.5?"images/emptystar.png":"images/halfstar.png"));
	getElement('star5').src=path+(val==5?"images/star.png":(val<4.5?"images/emptystar.png":"images/halfstar.png"));
}

function addVote(i,v){
	ajax.load(document.location,'v&v='+v+'&i='+i);
}

function sendComment(i,v,n){
	ajax.load(document.location,'c&v='+v+'&i='+i+'&n='+n);
}

function loadMostVoted(){
	ajax.load(document.location,'r');
}

function loadMostVisited(){
	
	ajax.load(document.location,'v');
}

function loadTopTen(){
	ajax.load(document.location,'t');
}

function register(){
	f = document.forms['register'];
	if(f.nickname.value==''){
		f.nickname.focus();
		alert('Il campo Nickname e\' obbligatorio!');
		return;
	} else if(f.nickname.value.length<3 || f.nickname.value.length>25){
		f.nickname.focus();
		alert('Il campo Nickname dev\'essere compreso tra 3 e 25 caratteri!');
		return;
	}
	if(f.pass.value==''){
		f.pass.focus();
		alert('Il campo Password e\' obbligatorio!');
		return;
	} else if(f.pass.value.length<3 || f.pass.value.length>25){
		f.pass.focus();
		alert('Il campo Password dev\'essere compreso tra 3 e 25 caratteri!');
		return;
	} else if(f.pass.value!=f.repass.value){
		f.pass.focus();
		alert('I campi Password e Riperti Password non coincidono!');
		return;
	}
	if(f.nome.value==''){
		f.nome.focus();
		alert('Il campo Nome e\' obbligatorio!');
		return;
	} else if(f.nome.value.length<3 || f.nome.value.length>50){
		f.nome.focus();
		alert('Il campo Nome dev\'essere compreso tra 3 e 50 caratteri!');
		return;
	}
	if(f.cognome.value==''){
		f.cognome.focus();
		alert('Il campo Cognome e\' obbligatorio!');
		return;
	} else if(f.cognome.value.length<3 || f.cognome.value.length>50){
		f.cognome.focus();
		alert('Il campo Cognome dev\'essere compreso tra 3 e 50 caratteri!');
		return;
	}
	if(f.nascita.value==''){
		f.nascita.focus();
		alert('Il campo Data di Nascita e\' obbligatorio!');
		return;
	} else {
		go = false;
		n = f.nascita.value.split("/");
		if(n.length==3){
			n[0] = parseInt(1*n[0]);
			n[1] = parseInt(1*n[1]);
			n[2] = parseInt(1*n[2]);
			y = new Date();
			y = y.getFullYear();
			if((n[0]>0 && n[0]<32) && (n[1]>0 && n[1]<13) && (n[2]>1900 && n[2]<=y)){
				go = true;
			}
		}
		if(!go){
			f.nome.focus();
			alert('Il campo Data di Nascita dev\'essere nel formato giorno/mese/anno!');
			return;
		}
	}
	if(f.provincia.options[f.provincia.options.selectedIndex].value==''){
		f.provincia.focus();
		alert('Selezionare la provincia di residenza!');
	}
	/*if(f.cap.value==''){
		f.cap.focus();
		alert('Il campo C.A.P. e\' obbligatorio!');
		return;
	}
	if(f.localita.value==''){
		f.localita.focus();
		alert('Il campo Localita e\' obbligatorio!');
		return;
	} else if(f.localita.value.length<3 || f.localita.value.length>50){
		f.localita.focus();
		alert('Il campo Localita dev\'essere compreso tra 3 e 50 caratteri!');
		return;
	}
	if(f.indirizzo.value==''){
		f.indirizzo.focus();
		alert('Il campo Indirizzo e\' obbligatorio!');
		return;
	} else if(f.indirizzo.value.length<3 || f.indirizzo.value.length>50){
		f.nome.focus();
		alert('Il campo Indirizzo dev\'essere compreso tra 3 e 50 caratteri!');
		return;
	}
	if(f.civico.value==''){
		f.civico.focus();
		alert('Il campo Civico e\' obbligatorio!');
		return;
	} else if(f.civico.value.length<3 || f.civico.value.length>50){
		f.civico.focus();
		alert('Il campo Civico dev\'essere compreso tra 3 e 50 caratteri!');
		return;
	}
	if(f.telefono.value==''){
		f.telefono.focus();
		alert('Il campo Recapito Telefonico e\' obbligatorio!');
		return;
	} else if(f.telefono.value.length<3 || f.telefono.value.length>50){
		f.telefono.focus();
		alert('Il campo Recapito Telefonico dev\'essere compreso tra 3 e 50 caratteri!');
		return;
	}*/
	if(f.email.value==''){
		f.email.focus();
		alert('Il campo Email e\' obbligatorio!');
		return;
	} else if(f.email.value.length<3 || f.email.value.length>50){
		f.email.focus();
		alert('Il campo Email dev\'essere compreso tra 3 e 50 caratteri!');
		return;
	} else if(!checkMail(f.email.value)){
		alert('Il campo Email deve contenere un indirizzo email valido!');
		return;
	}
	if(getElement('terminisi').checked!=true){
		alert('Per poter proseguire nel processo di registrazione si devono accettare i Termini D\'Uso!');
		return;
	}
	if(getElement('infosi').checked!=true){
		alert('Per poter proseguire nel processo di registrazione si deve accettare l\'informativa per la Privacy!');
		return;
	}
	/*if(getElement('fan').checked!=true && getElement('artista').checked!=true){
		alert('Per poter proseguire nel processo di registrazione si deve selezionare tra Fan e Artista!');
		return;
	}*/
	f.action = 'music-showcase/registrati/';
	f.submit();
}

function registerBrothers(){
	d1 = new Date();
	y = d1.getFullYear();
	f = document.forms['register'];
	if(f.nome1.value==''){
		f.nome1.focus();
		alert('Il campo Nome e\' obbligatorio!');
		return;
	} else if(f.nome1.value.length<3 || f.nome1.value.length>50){
		f.nome1.focus();
		alert('Il campo Nome dev\'essere compreso tra 3 e 50 caratteri!');
		return;
	}
	if(f.cognome1.value==''){
		f.cognome1.focus();
		alert('Il campo Cognome e\' obbligatorio!');
		return;
	} else if(f.cognome1.value.length<3 || f.cognome1.value.length>50){
		f.cognome1.focus();
		alert('Il campo Cognome dev\'essere compreso tra 3 e 50 caratteri!');
		return;
	}
	if(f.nascita1.value==''){
		f.nascita1.focus();
		alert('Il campo Data di Nascita e\' obbligatorio!');
		return;
	} else {
		go = false;
		n = f.nascita1.value.split("/");
		if(n.length==3){
			n[0] = parseInt(1*n[0]);
			n[1] = parseInt(1*n[1]);
			n[2] = parseInt(1*n[2]);
			y1 = new Date(n[2],n[1]-1,n[0]);
			if((n[0]>0 && n[0]<32) && (n[1]>0 && n[1]<13) && (n[2]>1900 && n[2]<=y)){
				go = true;
			}
		}
		if(!go){
			f.nascita1.focus();
			alert('Il campo Data di Nascita dev\'essere nel formato giorno/mese/anno!');
			return;
		}
	}
	if(f.email1.value==''){
		f.email1.focus();
		alert('Il campo Email e\' obbligatorio!');
		return;
	} else if(f.email1.value.length<3 || f.email1.value.length>50){
		f.email1.focus();
		alert('Il campo Email dev\'essere compreso tra 3 e 50 caratteri!');
		return;
	} else if(!checkMail(f.email1.value)){
		f.email1.focus();
		alert('Il campo Email deve contenere un indirizzo email valido!');
		return;
	}
	if(f.telefono1.value==''){
		f.telefono1.focus();
		alert('Il campo Telefono e\' obbligatorio!');
		return;
	} else if(f.telefono1.value.length<3 || f.telefono1.value.length>50){
		f.telefono1.focus();
		alert('Il campo Telefono dev\'essere compreso tra 3 e 50 caratteri!');
		return;
	} else if(isNaN(f.telefono1.value)){
		f.telefono1.focus();
		alert('Il campo Telefono accetta solo valori numerici!');
		return;
	}
	if(f.associazione1.options[f.associazione1.options.selectedIndex].value==''){
		f.associazione1.focus();
		alert('Selezionare la tipologia di Tesseramento!');
	}
	if(f.numerotessera1.value==''){
		f.numerotessera1.focus();
		alert('Il campo Numero Tessera e\' obbligatorio!');
		return;
	}
	
	if(getElement('tipo2').checked==true){
		if(f.datatesseramento1.value==''){
			f.datatesseramento1.focus();
			alert('Il campo Data di Tesseramento e\' obbligatorio!');
			return;
		} else {
			go = false;
			n = f.datatesseramento1.value.split("/");
			if(n.length==3){
				n[0] = parseInt(1*n[0]);
				n[1] = parseInt(1*n[1]);
				n[2] = parseInt(1*n[2]);
				t1 = new Date(n[2],n[1]-1,n[0]);
				if((n[0]>0 && n[0]<32) && (n[1]>0 && n[1]<13) && (n[2]>1900 && n[2]<=y)){
					go = true;
				}
			}
			if(!go){
				f.datatesseramento1.focus();
				alert('Il campo Data di Tesseramento dev\'essere nel formato giorno/mese/anno!');
				return;
			}
		}
		if(f.datadonazione1.value==''){
			f.datadonazione1.focus();
			alert('Il campo Data di Data prima donazione e\' obbligatorio!');
			return;
		} else {
			go = false;
			n = f.datadonazione1.value.split("/");
			if(n.length==3){
				n[0] = parseInt(1*n[0]);
				n[1] = parseInt(1*n[1]);
				n[2] = parseInt(1*n[2]);
				d1 = new Date(n[2],n[1]-1,n[0]);
				if((n[0]>0 && n[0]<32) && (n[1]>0 && n[1]<13) && (n[2]>1900 && n[2]<=y)){
					go = true;
				}
			}
			if(!go){
				f.datadonazione1.focus();
				alert('Il campo Data di Data prima donazione dev\'essere nel formato giorno/mese/anno!');
				return;
			}
		}
		if(f.sededonazione1.value==''){
			f.sededonazione1.focus();
			alert('Il campo Sede Donazione e\' obbligatorio!');
			return;
		} else if(f.sededonazione1.value.length<3 || f.sededonazione1.value.length>50){
			f.sededonazione1.focus();
			alert('Il campo Sede Donazione dev\'essere compreso tra 3 e 50 caratteri!');
			return;
		}
		if(f.comunedonazione1.value==''){
			f.comunedonazione1.focus();
			alert('Il campo Comune Donazione e\' obbligatorio!');
			return;
		} else if(f.comunedonazione1.value.length<3 || f.comunedonazione1.value.length>50){
			f.comunedonazione1.focus();
			alert('Il campo Comune Donazione dev\'essere compreso tra 3 e 50 caratteri!');
			return;
		}
		if(f.provincia1.options[f.provincia1.options.selectedIndex].value==''){
			f.provincia1.focus();
			alert('Selezionare la Provincia!');
		}
	}
	
	if(f.nome2.value==''){
		f.nome2.focus();
		alert('Il campo Nome e\' obbligatorio!');
		return;
	} else if(f.nome2.value.length<3 || f.nome1.value.length>50){
		f.nome2.focus();
		alert('Il campo Nome dev\'essere compreso tra 3 e 50 caratteri!');
		return;
	}
	if(f.cognome2.value==''){
		f.cognome2.focus();
		alert('Il campo Cognome e\' obbligatorio!');
		return;
	} else if(f.cognome2.value.length<3 || f.cognome2.value.length>50){
		f.cognome2.focus();
		alert('Il campo Cognome dev\'essere compreso tra 3 e 50 caratteri!');
		return;
	}
	if(f.nascita2.value==''){
		f.nascita2.focus();
		alert('Il campo Data di Nascita e\' obbligatorio!');
		return;
	} else {
		go = false;
		n = f.nascita2.value.split("/");
		if(n.length==3){
			n[0] = parseInt(1*n[0]);
			n[1] = parseInt(1*n[1]);
			n[2] = parseInt(1*n[2]);
			y2 = new Date(n[2],n[1]-1,n[0]);
			if((n[0]>0 && n[0]<32) && (n[1]>0 && n[1]<13) && (n[2]>1900 && n[2]<=y)){
				go = true;
			}
		}
		if(!go){
			f.nascita2.focus();
			alert('Il campo Data di Nascita dev\'essere nel formato giorno/mese/anno!');
			return;
		}
	}
	if(f.email2.value==''){
		f.email2.focus();
		alert('Il campo Email e\' obbligatorio!');
		return;
	} else if(f.email2.value.length<3 || f.email2.value.length>50){
		f.email2.focus();
		alert('Il campo Email dev\'essere compreso tra 3 e 50 caratteri!');
		return;
	} else if(!checkMail(f.email2.value)){
		f.email2.focus();
		alert('Il campo Email deve contenere un indirizzo email valido!');
		return;
	}
	if(f.telefono2.value==''){
		f.telefono2.focus();
		alert('Il campo Telefono e\' obbligatorio!');
		return;
	} else if(f.telefono2.value.length<3 || f.telefono2.value.length>50){
		f.telefono2.focus();
		alert('Il campo Telefono dev\'essere compreso tra 3 e 50 caratteri!');
		return;
	} else if(isNaN(f.telefono2.value)){
		f.telefono2.focus();
		alert('Il campo Telefono accetta solo valori numerici!');
		return;
	}
	if(f.associazione2.options[f.associazione2.options.selectedIndex].value==''){
		f.associazione2.focus();
		alert('Selezionare la tipologia di Tesseramento!');
	}
	if(f.numerotessera2.value==''){
		f.numerotessera2.focus();
		alert('Il campo Numero Tessera e\' obbligatorio!');
		return;
	}
	if(f.datatesseramento2.value==''){
		f.datatesseramento2.focus();
		alert('Il campo Data di Tesseramento e\' obbligatorio!');
		return;
	} else {
		go = false;
		n = f.datatesseramento2.value.split("/");
		if(n.length==3){
			n[0] = parseInt(1*n[0]);
			n[1] = parseInt(1*n[1]);
			n[2] = parseInt(1*n[2]);
			t2 = new Date(n[2],n[1]-1,n[0]);
			if((n[0]>0 && n[0]<32) && (n[1]>0 && n[1]<13) && (n[2]>1900 && n[2]<=y)){
				go = true;
			}
		}
		if(!go){
			f.datatesseramento2.focus();
			alert('Il campo Data di Tesseramento dev\'essere nel formato giorno/mese/anno!');
			return;
		}
	}
	if(f.datadonazione2.value==''){
		f.datadonazione2.focus();
		alert('Il campo Data Prima Donazione e\' obbligatorio!');
		return;
	} else {
		go = false;
		n = f.datadonazione2.value.split("/");
		if(n.length==3){
			n[0] = parseInt(1*n[0]);
			n[1] = parseInt(1*n[1]);
			n[2] = parseInt(1*n[2]);
			d2 = new Date(n[2],n[1]-1,n[0]);
			if((n[0]>0 && n[0]<32) && (n[1]>0 && n[1]<13) && (n[2]>1900 && n[2]<=y)){
				go = true;
			}
		}
		if(!go){
			f.datadonazione2.focus();
			alert('Il campo Data Prima Donazione dev\'essere nel formato giorno/mese/anno!');
			return;
		}
	}
	if(f.sededonazione2.value==''){
			f.sededonazione2.focus();
			alert('Il campo Sede Donazione e\' obbligatorio!');
			return;
	} else if(f.sededonazione2.value.length<3 || f.sededonazione2.value.length>50){
		f.sededonazione2.focus();
		alert('Il campo Sede Donazione dev\'essere compreso tra 3 e 50 caratteri!');
		return;
	}
	if(f.comunedonazione2.value==''){
		f.comunedonazione2.focus();
		alert('Il campo Comune Donazione e\' obbligatorio!');
		return;
	} else if(f.comunedonazione2.value.length<3 || f.comunedonazione2.value.length>50){
		f.comunedonazione1.focus();
		alert('Il campo Comune Donazione dev\'essere compreso tra 3 e 50 caratteri!');
		return;
	}
	if(f.provincia2.options[f.provincia2.options.selectedIndex].value==''){
		f.provincia2.focus();
		alert('Selezionare la Provincia!');
	}
	if(f.concerto.options[f.concerto.options.selectedIndex].value==''){
		f.concerto.focus();
		alert('Selezionare l\'Evento!');
	}
	if(getElement('infosi').checked!=true){
		alert('Per poter proseguire nel processo di registrazione si deve accettare l\'informativa per la Privacy!');
		return;
	}
	d = new Date(1982,0,1); // 1-01-1982
	d = d.getTime();
	t = new Date(1991,0,1); // 1-01-1991 controllo 18 anni
	t = t.getTime();
	if(y1.getTime()<d || y2.getTime()<d){ //uno dei due è più vecchio
		alert("Ci dispiace, non avete i requisiti richiesti per partecipare all'iniziativa, entrambi i donatori devono avere meno di 27 anni (vedi Chi può partecipare). Un sentito grazie ugualmente per la vostra donazione!");
		return;
	} else if(y1.getTime()>=t || y2.getTime()>=t){
		alert("Ci dispiace, non avete i requisiti richiesti per partecipare all'iniziativa, entrambi i donatori devono essere maggiorenni (vedi Chi può partecipare). Un sentito grazie ugualmente per la vostra donazione!");
		return;
	}/* else if(d1.getTime()<t){
		alert("Ci dispiace, non avete i requisiti richiesti per partecipare all'iniziativa, la donazione dev'essere effettuata nel periodo febbraio - dicembre 2009 (vedi Chi può partecipare). Un sentito grazie ugualmente per la vostra donazione!");
		return;
	}*/
	
	f.action = 'fratelli-di-sangue/registrati/';
	f.submit();
}

function checkMail(field) {
	var goodEmail = field.match(/\b(^(\S{1,}@).{3,}((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,6}))$)\b/gi);
	if (goodEmail){
		return true;
	} else {
		return false;
	}
}

function registranewsletter(){
	with(document.forms['newsletter']){
		if(mail.value==''){
			mail.focus();
			alert('Il campo Email dev\'essere compreso tra 3 e 50 caratteri!');
		} else if(!checkMail(mail.value)){
			alert('Il campo Email deve contenere un indirizzo email valido!');
		} else {
			act = getElement('iscrivi').checked?"i":"c";
			//act = 'i';
			ajax.load(path+"newsletters/",act+'&m='+mail.value);
		}
	}
}

function doSub(o,e){
	if((e?e.keyCode:window.event.keyCode)=="13"){ o.submit();}
}

function checkpass(f){
	f = document.forms[f];
	if(f.pass.value==''){
		f.pass.focus();
		alert('Il campo Password e\' obbligatorio!');
		return;
	} else if(f.pass.value.length<3 || f.pass.value.length>25){
		f.pass.focus();
		alert('Il campo Password dev\'essere compreso tra 3 e 25 caratteri!');
		return;
	} else if(f.pass.value!=f.repass.value){
		f.pass.focus();
		alert('I campi Password e Riperti Password non coincidono!');
		return;
	}
	f.action = 'music-showcase/my-musicanelsangue/';
	f.submit();
}

function modificadati(){
	f = document.forms['moddati'];
	if(f.nome.value==''){
		f.nome.focus();
		alert('Il campo Nome e\' obbligatorio!');
		return;
	} else if(f.nome.value.length<3 || f.nome.value.length>50){
		f.nome.focus();
		alert('Il campo Nome dev\'essere compreso tra 3 e 50 caratteri!');
		return;
	}
	if(f.cognome.value==''){
		f.cognome.focus();
		alert('Il campo Cognome e\' obbligatorio!');
		return;
	} else if(f.cognome.value.length<3 || f.cognome.value.length>50){
		f.cognome.focus();
		alert('Il campo Cognome dev\'essere compreso tra 3 e 50 caratteri!');
		return;
	}
	if(f.nascita.value==''){
		f.nascita.focus();
		alert('Il campo Data di Nascita e\' obbligatorio!');
		return;
	} else {
		go = false;
		n = f.nascita.value.split("/");
		if(n.length==3){
			n[0] = parseInt(1*n[0]);
			n[1] = parseInt(1*n[1]);
			n[2] = parseInt(1*n[2]);
			y = new Date();
			y = y.getFullYear();
			if((n[0]>0 && n[0]<32) && (n[1]>0 && n[1]<13) && (n[2]>1900 && n[2]<=y)){
				go = true;
			}
		}
		if(!go){
			f.nome.focus();
			alert('Il campo Data di Nascita dev\'essere nel formato giorno/mese/anno!');
			return;
		}
	}
	if(f.provincia.options[f.provincia.options.selectedIndex].value==''){
		f.provincia.focus();
		alert('Selezionare la provincia di residenza!');
	}
	if(f.email.value==''){
		f.email.focus();
		alert('Il campo Email e\' obbligatorio!');
		return;
	} else if(f.email.value.length<3 || f.email.value.length>50){
		f.email.focus();
		alert('Il campo Email dev\'essere compreso tra 3 e 50 caratteri!');
		return;
	} else if(!checkMail(f.email.value)){
		alert('Il campo Email deve contenere un indirizzo email valido!');
		return;
	}
	f.action = 'music-showcase/my-musicanelsangue/';
	f.submit();
}

function est(str){
	str = str.substr(str.lastIndexOf(".")+1,str.length);
	return (str=='gif' || str=="jpg" || str=="png" || str=='jpeg')?true:false;
}

function scroll(id,w){
	l = 720;
	id = getElement(id);
	alert(id);
	m = parseInt(getStyle(id,'marginLeft'));
	while(i<l){
		
		i++;
	}
}
