﻿// JavaScript Document
var areeVett='';
var mostreDown='';
var elemNews='';
var freccieTxt_01='';
var freccieTxt_02='';
var freccieTxt_03='';
var msgFromSite='';
var searchFocus=false;

function lang_set(lang,p1,p2) {
	//alert('english version will be on line soon!');
	document.location.href='/lang/set.php?idLang='+lang;
}
function menu_goto(idA,url,p1) {
	document.location.href='/'+url;
}
function input_clear(f,field, txt) {
	if (f!='' && field!='') 
		if (document.forms[f][field].value==txt) document.forms[f][field].value='';
}
function input_write(f, field, txt) {
	if (f!='' && field!='') 
		if (document.forms[f][field].value=='') document.forms[f][field].value=txt;
}
function logIn() {
	login_general('form_front_login','username_login','psw_login','msg_loginbox','msg_ko02','');
	return false;
	/*var strErr='';
	var val='';
	
	document.getElementById("msg_loginbox").innerHTML='';
	document.getElementById("msg_loginbox").className='';
	document.getElementById("msg_loginbox").style.display='none';
	with (document.form_front_login) {
		if (username_login.value=='' || username_login.value=='Email') strErr+='1';
		if (psw_login.value=='' || psw_login.value=='password') strErr+='1';
		
		if (strErr!='') {
			document.getElementById("msg_loginbox").innerHTML='Error Occurred!';
			document.getElementById("msg_loginbox").className='msg_ko02';
			document.getElementById("msg_loginbox").style.display='block';
		} else {
			loading_on("loadind",'site','...',1,'','','');
			//controllo account
			var parametri=lanfre_formCollection(document.form_front_login,'','');
			var risultato=lanfre_getCode_sincrono("/utenti/checkAccount.php", parametri, 0,"",0,"","");
			
			//alert(risultato);
			if (risultato=='OK') {
				parametri='';
				lanfre_getCode("/00account.php",'account_box',parametri,'', 0,'',0,'','','');
				
				//se sono nella scheda di un artista
				if (areeVett=='artista') artisti_menu_load();
				//se sono nella scheda di una mostra
				if (areeVett=='mostra') {
					if (document.getElementById('annoMostra')) val=document.form_front.annoMostra.value;
					mostre_menu_load(val);
				}
				
			} else {
				document.getElementById("msg_loginbox").innerHTML='Error Occurred!';
				document.getElementById("msg_loginbox").className='msg_ko02';
				document.getElementById("msg_loginbox").style.display='block';
			}
			loading_off('','','');
		}
	}
	
	return false;*/
}
function login_big() {
	login_general('form_front','email_login_big','psw_login_big','msg','msg_ko','');
	/*return false;*/
}
function login_general(mioform,elemUsername,elemPsw,elemMsg,classErr,p2) {
	var strErr='';
	var val='';
	
	if (elemMsg!='') {
		document.getElementById(elemMsg).innerHTML='';
		document.getElementById(elemMsg).className='';
		document.getElementById(elemMsg).style.display='none';
	}
	with (document.forms[mioform]) {
		if (elements[elemUsername].value=='' || elements[elemUsername].value=='Email') strErr+='1';
		if (elements[elemPsw].value=='' || elements[elemPsw].value=='password') strErr+='1';
		
		if (strErr!='') {
			if (elemMsg!='') {
				document.getElementById(elemMsg).innerHTML='Error Occurred!';
				document.getElementById(elemMsg).className=classErr;
				document.getElementById(elemMsg).style.display='block';
			}
		} else {
			loading_on("loadind",'site','...',1,'','','');
			//controllo account
			//var parametri=lanfre_formCollection(document.forms[mioform],'','');
			var parametri='username_login='+elements[elemUsername].value+'&psw_login='+elements[elemPsw].value;
			var risultato=lanfre_getCode_sincrono("/utenti/checkAccount.php", parametri, 0,"",0,"","");
			
			//alert(risultato);
			if (risultato=='OK') {
				if (document.getElementById('account_box')) {
					parametri='';
					lanfre_getCode("/00account.php",'account_box',parametri,'', 0,'',0,'','','');
				}
				
				if (document.getElementById('login_big_box')) {
					parametri='';
					lanfre_getCode("/utenti/00account_big.php",'login_big_box',parametri,'', 0,'',0,'','','');
				}
				
				if (document.getElementById('coordinate')) {
					parametri='';
					lanfre_getCode("/utenti/00coordinate.php",'coordinate',parametri,'', 0,'',0,'','','');
				}
				
				//se sono nella scheda di un artista
				if (areeVett=='artista') artisti_menu_load();
				//se sono nella scheda di una mostra
				if (areeVett=='mostra') {
					if (document.getElementById('annoMostra')) val=document.form_front.annoMostra.value;
					mostre_menu_load(val);
				}
				
			} else {
				if (elemMsg!='') {
					document.getElementById(elemMsg).innerHTML='Error Occurred!';
					document.getElementById(elemMsg).className=classErr;
					document.getElementById(elemMsg).style.display='block';
				}
			}
			loading_off('','','');
		}
	}
	
	return false;
}
function login_mod() {
	var strErr='';
	var val='';
	
	document.getElementById('msg').innerHTML='';
	document.getElementById('msg').className='';
	document.getElementById('msg').style.display='none';

	with (document.form_front) {
		//psw
		if (psw_mod.value!='') {
			if (psw_mod.value.indexOf(' ')!=-1 || psw_mod.value.indexOf('&nbsp;')!=-1 || psw_mod.value.length<5 || psw_mod.value.length>20 ) {
				strErr+='1';
			}
		} else {
			strErr+='1';
		}
		
		//email
		if (!checkEmailFormat(email_mod.value)) {
			strErr+='1';
		}
		
		if (strErr!='') {
			document.getElementById('msg').innerHTML='Error Occurred!';
			document.getElementById('msg').className='msg_ko';
			document.getElementById('msg').style.display='block';
		} else {
			loading_on("loadind",'site','...',1,'','','');
			//controllo account
			//var parametri=lanfre_formCollection(document.form_front,'','');
			var parametri='email_mod='+email_mod.value+'&psw_mod='+psw_mod.value;
			var risultato=lanfre_getCode_sincrono("/utenti/account_update.php", parametri, 0,"",0,"","");
			
			//alert(risultato);
			if (risultato=='OK') {
				document.getElementById('msg').innerHTML=msgFromSite;
				document.getElementById('msg').className='msg_ok03';
				document.getElementById('msg').style.display='block';
			} else {
				document.getElementById('msg').innerHTML='Error Occurred!';
				document.getElementById('msg').className='msg_ko';
				document.getElementById('msg').style.display='block';
			}
			loading_off('','','');
		}
	}
}
function login_delete() {
	var strErr='';
	var val='';
	
	document.getElementById('msg').innerHTML='';
	document.getElementById('msg').className='';
	document.getElementById('msg').style.display='none';

	with (document.form_front) {
		//psw
		if (psw_del.value!='') {
			if (psw_del.value.indexOf(' ')!=-1 || psw_del.value.indexOf('&nbsp;')!=-1 || psw_del.value.length<5 || psw_del.value.length>20 ) {
				strErr+='1';
			}
		} else {
			strErr+='1';
		}
		
		//email
		if (!checkEmailFormat(email_del.value)) {
			strErr+='1';
		}
		
		if (strErr!='') {
			document.getElementById('msg').innerHTML='Error Occurred!';
			document.getElementById('msg').className='msg_ko';
			document.getElementById('msg').style.display='block';
		} else {
			loading_on("loadind",'site','...',1,'','','');
			//controllo account
			//var parametri=lanfre_formCollection(document.form_front,'','');
			var parametri='email_del='+email_del.value+'&psw_del='+psw_del.value;
			var risultato=lanfre_getCode_sincrono("/utenti/account_delete.php", parametri, 0,"",0,"","");
			
			//alert(risultato);
			if (risultato=='OK') {
				delete_logOut();
			} else {
				document.getElementById('msg').innerHTML='Error Occurred!';
				document.getElementById('msg').className='msg_ko';
				document.getElementById('msg').style.display='block';
			}
			loading_off('','','');
		}
	}
}
function delete_logOut() {
	parametri='';
	lanfre_getCode("/utenti/logOut.php",'',parametri,"document.location.href='/utenti/account_deleted.php'", 0,'',0,'','','');
}
function logOut() {
	parametri='';
	lanfre_getCode("/utenti/logOut.php",'',parametri,"document.location.href='/index.php'", 0,'',0,'','','');
	/*var strErr='';
	var val='';
		
	with (document.form_front_login) {
		document.getElementById("msg_loginbox").innerHTML='';
		document.getElementById("msg_loginbox").className='';
		document.getElementById("msg_loginbox").style.display='none';
		
		loading_on("loadind",'site','...',1,'','','');
		//controllo account
		var parametri=lanfre_formCollection(document.form_front_login,'','');
		var risultato=lanfre_getCode_sincrono("/utenti/logOut.php", parametri, 0,"",0,"","");
		
		//alert(risultato);
		if (risultato=='OK') {
			if (document.getElementById('account_box')) {
				parametri='';
				lanfre_getCode("/00account.php",'account_box',parametri,'', 0,'',0,'','','');
			}
			
			if (document.getElementById('login_big_box')) {
				parametri='';
				lanfre_getCode("/utenti/00account_big.php",'login_big_box',parametri,'', 0,'',0,'','','');
			}
				
			//se sono nella scheda di un artista
			if (areeVett=='artista') {
				//se sono in post devo ricaricre tutto
				if (document.form_front.Gruppo_selected) {
					if (document.form_front.Gruppo_selected.value=='post') {
						if (document.form_front.idArtista) val=document.form_front.idArtista.value;
						artisti_load(val,'');
					}	
				} else {	//ricarico solo menù
					artisti_menu_load();
				}
			}
			//se sono nella scheda di una mostra
			if (areeVett=='mostra') {
				//alert('mostreDown='+mostreDown);
				if (mostreDown=='post') {
					//if (document.form_front.idMostra) val=document.form_front.idMostra.value;
					if (document.getElementById('idMostra')) val=document.getElementById('idMostra').value;
					//alert("val="+val);
					mostre_load(val,'');
				} else {
					if (document.getElementById('annoMostra')) val=document.form_front.annoMostra.value;
					mostre_menu_load(val);
				}
			}
			
		} else {
			document.getElementById("msg_loginbox").innerHTML='Error Occurred!';
			document.getElementById("msg_loginbox").className='msg_ko';
			document.getElementById("msg_loginbox").style.display='block';
		}
		loading_off('','','');
	}*/
}
function psw_lost() {
	var strErr='';
	var val='';
	
	document.getElementById('msg').innerHTML='';
	document.getElementById('msg').className='';
	document.getElementById('msg').style.display='none';
	with (document.form_front) {
		if (email_lost.value=='') strErr+='1';
		if (tel_lost.value=='') strErr+='1';
		
		if (strErr!='') {
			document.getElementById('msg').innerHTML='Error Occurred!';
			document.getElementById('msg').className='msg_ko';
			document.getElementById('msg').style.display='block';
		} else {
			loading_on("loadind",'site','...',1,'','','');
			//controllo account
			//var parametri=lanfre_formCollection(document.forms[mioform],'','');
			var parametri='email_lost='+email_lost.value+'&tel_lost='+tel_lost.value;
			var risultato=lanfre_getCode_sincrono("/utenti/psw_lost.php", parametri, 0,"",0,"","");
			
			//alert(risultato);
			if (risultato=='OK') {
				document.getElementById('psw_lost_box').innerHTML='<div class="msg_ok02">'+msgVett[0]+'</div>';
			} else {
				document.getElementById('msg').innerHTML='Error Occurred!';
				document.getElementById('msg').className='msg_ko';
				document.getElementById('msg').style.display='block';
			}
			loading_off('','','');
		}
	}
}

function artisti_load(idA,p1) {
	var idArea='';
	if (document.getElementById('page_gallery')) document.form_front.page_gallery.value='';
	if (document.getElementById('idArea')) idArea=document.form_front.idArea.value;
	parametri='idArtista='+idA;
	//alert(parametri);
	//lanfre_getCode("artista.php",'content01',parametri,'artisti_gallery_load();artisti_menu_load();load_bannerAREA(\'sx\',\'\');load_bannerFULL(\'sx\',\'\');load_bannerAREA(\'dx\',\'\');load_bannerFULL(\'dx\',\'\');', 0,'',0,'','','');
	lanfre_getCode("artista.php",'content01',parametri,'artisti_gallery_load();artisti_menu_load();load_bannerAREA(\'sx\',\'\');load_bannerAREA(\'dx\',\'\');', 0,'',0,'','','');
}
function artisti_load_xIntro(idA,p1) {
	var idArea='';

	if (document.form_front.idArtista) document.form_front.idArtista.value=idA;
	//alert(parametri);
	document.form_front.target='';
	document.form_front.action='artisti.php';
	document.form_front.submit();
}
function artisti_gallery_load() {
	var parametri=lanfre_formCollection(document.form_front,'','');
	//alert(parametri);
	lanfre_getCode("gallery.php",'artisti_gallery',parametri,"checkMediaType('gallery_box','','');", 0,'',0,'','','');
}
function artisti_gallery_nav(idA,mypage) {
	document.form_front.page_gallery.value=mypage;
	
	var parametri='idArtista='+idA+'&page_gallery='+mypage;
	//alert(parametri);
	lanfre_getCode("gallery.php",'artisti_gallery',parametri,"checkMediaType('gallery_box','','');", 0,'site',0,'','','');
}
function artisti_menu_load() {
	var idA='';
	var valIntro='';
	var valPost='';
	var valDown='';
	//se sono nìin artisti.php
	if (document.form_front.idArtista) idA=document.form_front.idArtista.value
	//se sono in index.php
	if (document.form_front.intro) valIntro=document.form_front.intro.value
	
	var parametri='idArtista='+idA+'&intro='+valIntro;
	//alert(parametri);
	lanfre_getCode("00menu.php",'artisti_menu',parametri,'', 0,'',0,'','','');
}
function artisti_selectGruppo(idG,p1) {
	if (document.form_front.Gruppo_selected) {
		if (document.getElementById('artista_add_ico_box0'+document.form_front.Gruppo_selected.value)) document.getElementById('artista_add_ico_box0'+document.form_front.Gruppo_selected.value).className='display_none';
		if (document.getElementById('art_list_'+document.form_front.Gruppo_selected.value)) document.getElementById('art_list_'+document.form_front.Gruppo_selected.value).className='display_none';
		if (document.getElementById('art_voceMenu_'+document.form_front.Gruppo_selected.value)) document.getElementById('art_voceMenu_'+document.form_front.Gruppo_selected.value).className='button03';
		if (document.getElementById('artista_add_ico_box0post')) document.getElementById('artista_add_ico_box0post').className='display_none';
		if (document.getElementById('artista_add_ico_box0download')) document.getElementById('artista_add_ico_box0download').className='display_none';
	
		document.form_front.Gruppo_selected.value=idG;
	}
	
	document.getElementById('artista_add_ico_box0'+idG).className='display_block';
	document.getElementById('art_list_'+idG).className='display_block';
	document.getElementById('art_voceMenu_'+idG).className='button03 button03_on';
	
	if (idG=='post') {
		document.getElementById('artista_add_ico_box0post').className='display_block';
	} else if (idG=='download') {
		document.getElementById('artista_add_ico_box0download').className='display_block';
	}
}
/*function banner_load() {
	//alert(document.forms.length);
	var parametri='page_banner='+document.form_back.page_banner.value;
	//alert(parametri);
	lanfre_getCode("/admin/banner/list.php",'list_content_box',parametri,'', 0,'',0,'','','');
}*/
function load_bannerAREA(dove,p1) {
	var idArea='';
	var idArea_dettaglio='';
	
	if (dove=='') dove='sx';
	
	 if (document.getElementById('idArea')) idArea=document.form_front.idArea.value;
	 if (document.getElementById('idArea_dettaglio')) idArea_dettaglio=document.form_front.idArea_dettaglio.value;
	 
	var parametri='idArea='+idArea+'&idArea_dettaglio='+idArea_dettaglio;
	//alert(parametri);
	lanfre_getCode("/banner/00"+dove+"_box.php",'banner_'+dove+'_box',parametri,'', 0,'',0,'','','');
}


function art_intro_gallery_load() {
	var parametri='';
	//alert(parametri);
	lanfre_getCode("intro_gallery.php",'artisti_gallery',parametri,"checkMediaType('gallery_box','','');", 0,'',0,'','','');
}
function art_intro_gallery_nav(idA,mypage) {
	document.form_front.page_gallery.value=mypage;
	
	var parametri='page_gallery='+mypage;
	//alert(parametri);
	lanfre_getCode("intro_gallery.php",'artisti_gallery',parametri,"checkMediaType('gallery_box','','');", 0,'site',0,'','','');
}
function post_read() {
	var idA='';
	var idAD='';
	
	if (document.getElementById('art_list_post_pub')) document.getElementById('art_list_post_pub').className='';
	if (document.getElementById('art_list_post_read')) document.getElementById('art_list_post_read').className='ico_on';
	if (document.getElementById('art_list_post_read')) document.getElementById('art_list_post_read_txt').className='txtOn';
	if (document.getElementById('art_list_post_write')) document.getElementById('art_list_post_write').className='';
	if (document.getElementById('art_list_post_write')) document.getElementById('art_list_post_write_txt').className='';
	
	if (document.form_front.idArea) idA=document.form_front.idArea.value;
	if (document.form_front.idArea_dettaglio) idAD=document.form_front.idArea_dettaglio.value;
	
	var parametri='idArea='+idA+'&idArea_dettaglio='+idAD;
	//alert(parametri);
	lanfre_getCode("post_read.php",'artista_content',parametri,'', 0,'site',0,'','','');
}
function post_write() {
	if (document.getElementById('art_list_post_pub')) document.getElementById('art_list_post_pub').className='';
	if (document.getElementById('art_list_post_read')) document.getElementById('art_list_post_read').className='';
	if (document.getElementById('art_list_post_read')) document.getElementById('art_list_post_read_txt').className='';
	if (document.getElementById('art_list_post_write')) document.getElementById('art_list_post_write').className='ico_on';
	if (document.getElementById('art_list_post_write')) document.getElementById('art_list_post_write_txt').className='txtOn';

	if (document.form_front.idArea) idA=document.form_front.idArea.value;
	if (document.form_front.idArea_dettaglio) idAD=document.form_front.idArea_dettaglio.value;
	
	var parametri='idArea='+idA+'&idArea_dettaglio='+idAD;
	//alert(parametri);
	lanfre_getCode("post_write.php",'artista_content',parametri,'', 0,'site',0,'','','');
}
function post_pub() {
	//if (document.getElementById('art_list_post_pub')) document.getElementById('art_list_post_pub').className='ico_on';
	//if (document.getElementById('art_list_post_read')) document.getElementById('art_list_post_read').className='';
	//if (document.getElementById('art_list_post_write')) document.getElementById('art_list_post_write').className='';

	if (document.form_front.idArea) idA=document.form_front.idArea.value;
	if (document.form_front.idArea_dettaglio) idAD=document.form_front.idArea_dettaglio.value;
	
	//var parametri='idArea='+idA+'&idArea_dettaglio='+idAD;
	var parametri=lanfre_formCollection(document.form_front,'','');
	//alert(parametri);
	lanfre_getCode("post_pub.php",'artista_content',parametri,'', 0,'site',0,'','','');
}













































/*MOSTRE*/
function mostre_load(idA,p1) {
	var idArea='';
	var annoMostra='';
	if (document.getElementById('page_gallery')) document.form_front.page_gallery.value='';
	if (document.getElementById('idArea')) idArea=document.form_front.idArea.value;
	if (document.getElementById('annoMostra')) annoMostra=document.form_front.annoMostra.value;
	parametri='idMostra='+idA;
	//alert(parametri);
	//lanfre_getCode("mostra.php",'content01',parametri,'mostre_gallery_load();mostre_menu_load();load_bannerAREA(\'sx\',\'\');load_bannerFULL(\'sx\',\'\');load_bannerAREA(\'dx\',\'\');load_bannerFULL(\'dx\',\'\');', 1,'site',1,'','','');
	lanfre_getCode("mostra.php",'content01',parametri,"mostre_gallery_load();mostre_menu_load('"+annoMostra+"');load_bannerAREA('sx','');load_bannerAREA('dx','');", 0,'',0,'','','');
}
function mostre_gallery_load() {
	var parametri=lanfre_formCollection(document.form_front,'','');
	//alert(parametri);
	lanfre_getCode("gallery.php",'artisti_gallery',parametri,"checkMediaType('gallery_box','','');", 0,'',0,'','','');
}
function mostre_gallery_nav(idA,mypage) {
	document.form_front.page_gallery.value=mypage;
	
	var parametri='idMostra='+idA+'&page_gallery='+mypage
	//alert(parametri);
	lanfre_getCode("gallery.php",'artisti_gallery',parametri,"checkMediaType('gallery_box','','');", 0,'',0,'','','');
}
function mostre_menu_load(anno_mostra) {
	var idM='';
	if (document.form_front.idMostra) idM=document.form_front.idMostra.value;

	var valIntro='';
	if (document.form_front.intro) valIntro=document.form_front.intro.value;

	var parametri='idMostra='+idM+'&mostra_anno='+anno_mostra+'&intro='+valIntro;
	//alert(parametri);
	lanfre_getCode("00menu.php",'artisti_menu',parametri,'', 0,'',0,'','','');
}
function mostre_nav(idM,annoM,p1) {
	var parametri='mostra_anno='+annoM;
	//alert(parametri);
	lanfre_getCode("00menu.php",'artisti_menu',parametri,'', 0,'',0,'','','');
}
function mostre_intro_gallery_load() {
	var parametri='';
	//alert(parametri);
	lanfre_getCode("intro_gallery.php",'artisti_gallery',parametri,"checkMediaType('gallery_box','','');", 0,'',0,'','','');
}
function mostre_downloadOn(idG,p1) {
	if (document.getElementById('mostre_add_ico_box01_link01')) document.getElementById('mostre_add_ico_box01_link01').className='mostre_nav_ico01 display_none';
	if (document.getElementById('mostre_add_ico_box01_link02')) document.getElementById('mostre_add_ico_box01_link02').className='mostre_nav_ico01 display_none';
	if (document.getElementById('mostre_bt_anni')) document.getElementById('mostre_bt_anni').className='button04 ';
	if (document.getElementById('mostre_list_1')) document.getElementById('mostre_list_1').className='display_none ';
	
	if (idG=='download') {
		if (document.getElementById('art_voceMenu_post')) document.getElementById('art_voceMenu_post').className='button04 ';
		if (document.getElementById('mostre_list_post')) document.getElementById('mostre_list_post').className='display_none';
		if (document.getElementById('mostre_add_ico_box01')) document.getElementById('mostre_add_ico_box01').className='display_none';
		if (document.getElementById('mostre_add_ico_box02')) document.getElementById('mostre_add_ico_box02').className='display_none';
		if (document.getElementById('mostre_add_ico_box0post')) document.getElementById('mostre_add_ico_box0post').className='display_none';

		if (document.getElementById('art_voceMenu_download')) document.getElementById('art_voceMenu_download').className='button04 button04_on';
		if (document.getElementById('mostre_list_download')) document.getElementById('mostre_list_download').className='display_block';
		if (document.getElementById('mostre_add_ico_box0download')) document.getElementById('mostre_add_ico_box0download').className='display_block';
		mostreDown='download';
	} else if (idG=='post') {
		if (document.getElementById('art_voceMenu_download')) document.getElementById('art_voceMenu_download').className='button04 ';
		if (document.getElementById('mostre_list_download')) document.getElementById('mostre_list_download').className='display_none';
		if (document.getElementById('mostre_add_ico_box01')) document.getElementById('mostre_add_ico_box01').className='display_none';
		if (document.getElementById('mostre_add_ico_box02')) document.getElementById('mostre_add_ico_box02').className='display_none';
		if (document.getElementById('mostre_add_ico_box0download')) document.getElementById('mostre_add_ico_box0download').className='display_none';


		if (document.getElementById('art_voceMenu_post')) document.getElementById('art_voceMenu_post').className='button04 button04_on';
		if (document.getElementById('mostre_list_post')) document.getElementById('mostre_list_post').className='display_block';
		if (document.getElementById('mostre_add_ico_box0post')) document.getElementById('mostre_add_ico_box0post').className='display_block';
		mostreDown='post';
	}
}
function incorso_downloadOn(idG,p1) {
	if (document.getElementById('mostre_add_ico_box01_link01')) document.getElementById('mostre_add_ico_box01_link01').className='mostre_nav_ico01 display_none';
	if (document.getElementById('mostre_add_ico_box01_link02')) document.getElementById('mostre_add_ico_box01_link02').className='mostre_nav_ico01 display_none';
	if (document.getElementById('mostre_bt_anni')) document.getElementById('mostre_bt_anni').className='button03 ';
	if (document.getElementById('mostre_list_1')) document.getElementById('mostre_list_1').className='display_none ';
	
	if (idG=='download') {
		if (document.getElementById('art_voceMenu_post')) document.getElementById('art_voceMenu_post').className='button03 ';
		if (document.getElementById('mostre_list_post')) document.getElementById('mostre_list_post').className='display_none';
		if (document.getElementById('mostre_add_ico_box01')) document.getElementById('mostre_add_ico_box01').className='display_none';
		if (document.getElementById('mostre_add_ico_box02')) document.getElementById('mostre_add_ico_box02').className='display_none';
		if (document.getElementById('mostre_add_ico_box0post')) document.getElementById('mostre_add_ico_box0post').className='display_none';

		if (document.getElementById('art_voceMenu_download')) document.getElementById('art_voceMenu_download').className='button03 button03_on';
		if (document.getElementById('mostre_list_download')) document.getElementById('mostre_list_download').className='display_block';
		if (document.getElementById('mostre_add_ico_box0download')) document.getElementById('mostre_add_ico_box0download').className='display_block';
		mostreDown='download';
	} else if (idG=='post') {
		if (document.getElementById('art_voceMenu_download')) document.getElementById('art_voceMenu_download').className='button03 ';
		if (document.getElementById('mostre_list_download')) document.getElementById('mostre_list_download').className='display_none';
		if (document.getElementById('mostre_add_ico_box01')) document.getElementById('mostre_add_ico_box01').className='display_none';
		if (document.getElementById('mostre_add_ico_box02')) document.getElementById('mostre_add_ico_box02').className='display_none';
		if (document.getElementById('mostre_add_ico_box0download')) document.getElementById('mostre_add_ico_box0download').className='display_none';


		if (document.getElementById('art_voceMenu_post')) document.getElementById('art_voceMenu_post').className='button03 button03_on';
		if (document.getElementById('mostre_list_post')) document.getElementById('mostre_list_post').className='display_block';
		if (document.getElementById('mostre_add_ico_box0post')) document.getElementById('mostre_add_ico_box0post').className='display_block';
		mostreDown='post';
	}
}
function mostre_setYear() {
	if (mostreDown=='') {
		document.location.href='/mostre/mostre.php';
	} else {
		if (mostreDown=='download') {
			if (document.getElementById('art_voceMenu_download')) document.getElementById('art_voceMenu_download').className='button04';
			if (document.getElementById('mostre_list_download')) document.getElementById('mostre_list_download').className='display_none';
			if (document.getElementById('mostre_add_ico_box0download')) document.getElementById('mostre_add_ico_box0download').className='display_none';
		} else if (mostreDown=='post') {
			if (document.getElementById('art_voceMenu_post')) document.getElementById('art_voceMenu_post').className='button04';
			if (document.getElementById('mostre_list_post')) document.getElementById('mostre_list_post').className='display_none';
			if (document.getElementById('mostre_add_ico_box0post')) document.getElementById('mostre_add_ico_box0post').className='display_none';
		}

		if (document.getElementById('mostre_add_ico_box01')) document.getElementById('mostre_add_ico_box01').className='display_block';
		if (document.getElementById('mostre_add_ico_box02')) document.getElementById('mostre_add_ico_box02').className='display_block';
		if (document.getElementById('mostre_add_ico_box01_link01')) document.getElementById('mostre_add_ico_box01_link01').className='mostre_nav_ico02 ';
		if (document.getElementById('mostre_add_ico_box01_link02')) document.getElementById('mostre_add_ico_box01_link02').className='mostre_nav_ico01 ';
		if (document.getElementById('mostre_bt_anni')) document.getElementById('mostre_bt_anni').className='button04 button04_on';
		if (document.getElementById('mostre_list_1')) document.getElementById('mostre_list_1').className='';
		
		mostreDown='';
	}
}



function setStyle(elem, stile) {
	if (document.getElementById(elem)) document.getElementById(elem).className=stile;
}

function clearANDhide(elem) {
	if (document.getElementById(elem)) {
		document.getElementById(elem).innerHTML='';
		document.getElementById(elem).className='';
		document.getElementById(elem).style.display='none';
	}
}

function user_checkFormAdd() {
	var strErr='';
	
	clearANDhide('msg');

	with (document.form_front) {
		//privacy
		if (!privacy[0].checked) strErr=errVett[11];
		
		//press
		if (press_sezione.value!='') {
			if (press_nometestata.value=='') strErr=errVett[10];
		}
		
		//psw
		if (psw_signin.value!='') {
			if (psw_signin.value.indexOf(' ')!=-1 || psw_signin.value.indexOf('&nbsp;')!=-1 || psw_signin.value.length<5 || psw_signin.value.length>20 ) {
				strErr=errVett[8];
			} else if (psw_signin.value != psw_signin_confirm.value) {
				strErr=errVett[9];
			}
		} else {
			strErr=errVett[8];
		}
		
		//telelfono
		if (tel.value=='') strErr=errVett[13];

		//email
		if (checkEmailFormat(email_signin.value)) {
			if (email_signin.value != email_signin_confirm.value) {
				strErr=errVett[7];
			} else {
				//controllo se email già presente in DB
				var parametri='email='+email_signin.value;
				var risultato=lanfre_getCode_sincrono("/utenti/checkEmail.php", parametri, 0,"",0,"","");
				if (risultato=='DOUBLE') {
					strErr=errVett[12];
				} else if (risultato!='OK') {
					strErr=errVett[6];
				}
			}
		} else {
			strErr=errVett[6];
		}
		
		//paese
		if (paese.value=='') strErr=errVett[5];
		//cap
		if (cap.value=='' || isNaN(cap.value)) strErr=errVett[4];
		//citta
		if (citta.value=='') strErr=errVett[3];
		//indirizzo
		if (indirizzo.value=='') strErr=errVett[2];
		//cognome
		if (cognome.value=='') strErr=errVett[1];
		//nome
		if (nome.value=='') strErr=errVett[0];
		
		
		
		if (strErr!='') {
			document.getElementById("msg").innerHTML=strErr;
			document.getElementById("msg").className='msg_ko';
			document.getElementById("msg").style.display='block';
		} else {
			var parametri=lanfre_formCollection(document.form_front,'','');;
			//alert(parametri);
			lanfre_getCode("insert.php",'singin_content',parametri,'', 0,'',0,'','','');
		}
	}
	
}





function news_selectArchivio(elem,p1) {
	if (document.form_front.idNews_last) {
		if (elem=='0') {
			document.getElementById('news_voceMenu_1').className='button04';
			
			document.getElementById('news_voceMenu_'+elem).className='button04 button04_on';
			document.getElementById('subList_0').className=''
		}
	}
	
}
function news_loadTrimestre(idNewslast,idNewsFirst,p1) {
	elemNews='';
	document.form_front.idNews_last.value=idNewslast;
	//alert('loadTrimestre='+document.form_front.idNews_last.value);
	
	/*if (document.getElementById('mostre_add_ico_box01')) document.getElementById('mostre_add_ico_box01').className='display_none';
	if (document.getElementById('mostre_add_ico_box02')) document.getElementById('mostre_add_ico_box02').className='display_none';*/
	
	news_load(idNewsFirst,'');
}
function news_load(idA,p1) {
	if (idA!='') {
		var idArea='';
		var annoMostra='';
		var idNewslast=''
		if (document.getElementById('page_gallery')) document.form_front.page_gallery.value='';
		if (document.getElementById('idArea')) idArea=document.form_front.idArea.value;
		if (document.getElementById('annoMostra')) annoMostra=document.form_front.annoMostra.value;
		if (document.getElementById('idNews_last')) idNewslast=document.form_front.idNews_last.value;
		parametri='idMostra='+idA+'&idNews_last='+idNewslast;
		//alert(parametri);
		//lanfre_getCode("mostra.php",'content01',parametri,'mostre_gallery_load();mostre_menu_load();load_bannerAREA(\'sx\',\'\');load_bannerFULL(\'sx\',\'\');load_bannerAREA(\'dx\',\'\');load_bannerFULL(\'dx\',\'\');', 1,'site',1,'','','');
		lanfre_getCode("mostra.php",'content01',parametri,"mostre_gallery_load();news_menu_load('"+idNewslast+"');load_bannerAREA('sx','');load_bannerAREA('dx','');", 0,'',0,'','','');
	}
}
function news_menu_load(idNewslast) {
	var idM='';
	if (document.form_front.idMostra) idM=document.form_front.idMostra.value;

	var valIntro='';
	if (document.form_front.intro) valIntro=document.form_front.intro.value;

	var parametri='idMostra='+idM+'&idNews_last='+idNewslast;
	//alert(parametri);
	lanfre_getCode("00menu.php",'artisti_menu',parametri,'', 0,'',0,'','','');
}


function search_start() {
	with (document.form_front) {
		if (search_key.value!='' && search_key.value!='Cerca nel Sito' && search_key.value!='Search Contents') {
			action='/search/index.php';
			submit();
		/*} else {
			return false;*/
		}
	}
}


function search_setBG(cosa) {
	if (document.getElementById('search_key')) {
		
		switch (cosa) {
			case 'on':
				document.getElementById('search_key').className='on';
				//document.getElementById('search_key').focus();
			break;
			
			default:
				//alert('blur='+searchFocus);
				if (document.form_front.search_key.value=='' || document.form_front.search_key.value=='Cerca nel Sito' || document.form_front.search_key.value=='Search Contents') {
					document.getElementById('search_key').className='';
					searchFocus=false;
				}
		}
		
	}
	
}
function search_setFocus() {
	searchFocus=true;
}
function search_setBG_02(cosa) {
	//alert(searchFocus);
	if (document.getElementById('search_key')) {
		if (!searchFocus) {
			if (document.form_front.search_key.value=='' || document.form_front.search_key.value=='Cerca nel Sito' || document.form_front.search_key.value=='Search Contents') document.getElementById('search_key').className='';
		} else {
			document.getElementById('search_key').className='on';
		}
	}
	
}
function search_input_clear(f,field, txt) {
	if (f!='' && field!='') {
		if (document.forms[f][field].value==txt) document.forms[f][field].value='';
		searchFocus=true;
	}
}
function search_input_write(f, field, txt) {
	if (f!='' && field!='') {
		if (document.forms[f][field].value=='') document.forms[f][field].value=txt;
		searchFocus=false;
	}
}



















function info_load(idA,p1) {
	var idArea='';

	if (document.form_front.idArtista) document.form_front.idArtista.value=idA;
	//alert(parametri);
	document.form_front.target='';
	document.form_front.action='info.php';
	document.form_front.submit();
}





function set_freccieTxt(cosa) {
	//alert('dio can='+cosa);
	switch (cosa) {
		case 'prev':
			document.getElementById('menu_dx_txt').style.backgroundImage='url(/images/ico_left01.png)';
			document.getElementById('navigatorTXT').innerHTML=freccieTxt_02;
		break;
		case 'next':
			document.getElementById('menu_dx_txt').style.backgroundImage='url(/images/ico_right01.png)';
			document.getElementById('navigatorTXT').innerHTML=freccieTxt_03;
		break;
		default:
			document.getElementById('menu_dx_txt').style.backgroundImage='';
			document.getElementById('navigatorTXT').innerHTML=freccieTxt_01;			
	}
}
















/*SHOP*/
function shop_load(idA,p1) {
	var idArea='';
	if (document.getElementById('page_gallery')) document.form_front.page_gallery.value='';
	if (document.getElementById('idArea')) idArea=document.form_front.idArea.value;
	parametri='idShop='+idA;
	//alert(parametri);
	lanfre_getCode("details.php",'content01',parametri,'shop_gallery_load();shop_menu_load();load_bannerAREA(\'sx\',\'\');load_bannerAREA(\'dx\',\'\');', 0,'',0,'','','');
}
function shop_load_xIntro(idA,p1) {
	var idArea='';

	if (document.form_front.idShop) document.form_front.idShop.value=idA;
	//alert(parametri);
	document.form_front.target='';
	document.form_front.action='index.php';
	document.form_front.submit();
}
function shop_gallery_load() {
	var parametri=lanfre_formCollection(document.form_front,'','');
	//alert(parametri);
	lanfre_getCode("gallery.php",'artisti_gallery',parametri,"checkMediaType('gallery_box','','');", 0,'',0,'','','');
}
function shop_gallery_nav(idA,mypage) {
	document.form_front.page_gallery.value=mypage;
	
	var parametri='idShop='+idA+'&page_gallery='+mypage;
	//alert(parametri);
	lanfre_getCode("gallery.php",'artisti_gallery',parametri,"checkMediaType('gallery_box','','');", 0,'site',0,'','','');
}
function shop_menu_load() {
	var idA='';
	var valIntro='';
	var valPost='';
	var valDown='';
	//se sono nìin artisti.php
	if (document.form_front.idShop) idA=document.form_front.idShop.value
	//se sono in index.php
	if (document.form_front.intro) valIntro=document.form_front.intro.value
	
	var parametri='idShop='+idA+'&intro='+valIntro;
	//alert(parametri);
	lanfre_getCode("00menu.php",'artisti_menu',parametri,'', 0,'',0,'','','');
}
function shop_selectGruppo(idG,p1) {
	if (document.form_front.Gruppo_selected) {
		if (document.getElementById('artista_add_ico_box0'+document.form_front.Gruppo_selected.value)) document.getElementById('artista_add_ico_box0'+document.form_front.Gruppo_selected.value).className='display_none';
		if (document.getElementById('art_list_'+document.form_front.Gruppo_selected.value)) document.getElementById('art_list_'+document.form_front.Gruppo_selected.value).className='display_none';
		if (document.getElementById('art_voceMenu_'+document.form_front.Gruppo_selected.value)) document.getElementById('art_voceMenu_'+document.form_front.Gruppo_selected.value).className='button03';
		if (document.getElementById('artista_add_ico_box0post')) document.getElementById('artista_add_ico_box0post').className='display_none';
		if (document.getElementById('artista_add_ico_box0download')) document.getElementById('artista_add_ico_box0download').className='display_none';
	
		document.form_front.Gruppo_selected.value=idG;
	}
	
	document.getElementById('artista_add_ico_box0'+idG).className='display_block';
	document.getElementById('art_list_'+idG).className='display_block';
	document.getElementById('art_voceMenu_'+idG).className='button03 button03_on';
	
	if (idG=='post') {
		document.getElementById('artista_add_ico_box0post').className='display_block';
	} else if (idG=='download') {
		document.getElementById('artista_add_ico_box0download').className='display_block';
	}
}
function shop_intro_gallery_load() {
	var parametri='';
	//alert(parametri);
	lanfre_getCode("intro_gallery.php",'artisti_gallery',parametri,"checkMediaType('gallery_box','','');", 0,'',0,'','','');
}
function shop_intro_gallery_nav(idA,mypage) {
	document.form_front.page_gallery.value=mypage;
	
	var parametri='page_gallery='+mypage;
	//alert(parametri);
	lanfre_getCode("intro_gallery.php",'artisti_gallery',parametri,"checkMediaType('gallery_box','','');", 0,'site',0,'','','');
}
function shop_checkForm() {
	var strErr='';
	var prodSelect=false;
	var prod_qnt='';
	
	clearANDhide('msg');

	with (document.form_front) {
		//privacy
		if (!privacy.checked) strErr=errVett[11];
		
		//telelfono
		if (tel.value=='') strErr=errVett[13];

		//email
		if (checkEmailFormat(email_signin.value)) {
			if (email_signin.value != email_signin_confirm.value) {
				strErr=errVett[7];
			/*} else {
				//controllo se email già presente in DB
				var parametri='email='+email_signin.value;
				var risultato=lanfre_getCode_sincrono("/utenti/checkEmail.php", parametri, 0,"",0,"","");
				if (risultato=='DOUBLE') {
					strErr=errVett[12];
				} else if (risultato!='OK') {
					strErr=errVett[6];
				}*/
			}
		} else {
			strErr=errVett[6];
		}
		
		//paese
		if (paese.value=='') strErr=errVett[5];
		//cap
		if (cap.value=='' || isNaN(cap.value)) strErr=errVett[4];
		//citta
		if (citta.value=='') strErr=errVett[3];
		//indirizzo
		if (indirizzo.value=='') strErr=errVett[2];
		//cognome
		if (cognome.value=='') strErr=errVett[1];
		//nome
		if (nome.value=='') strErr=errVett[0];
		
		//prodotti
		/*for (var i=0;i<idProdotto.length;i++) {
			//alert(idProdotto[i].value);
			if (idProdotto[i].checked) {
				prodSelect=true;
				prod_qnt=eval('qnt_'+idProdotto[i].value);
				//alert(prod_qnt);
				//controllo se inserita quantità
				if (prod_qnt.value=='' || isNaN(prod_qnt.value)) strErr=errVett[15];
			}
		}
		if (!prodSelect) strErr=errVett[14];*/
		
		for (var i=0;i<elements.length;i++) {
			if (elements[i].type=='checkbox') {
				//alert(elements[i].name.substring(0,10));
				if (elements[i].name.substring(0,10)=='idProdotto') {
					//alert('check= '+elements[i].checked);
					if (elements[i].checked) {
						prodSelect=true;
						prod_qnt=eval('qnt_'+elements[i].value);
						//alert(prod_qnt);
						//controllo se inserita quantità
						if (prod_qnt.value=='' || isNaN(prod_qnt.value)) strErr=errVett[15];
					}
				}
			}
		}
		if (!prodSelect) strErr=errVett[14];
		
		
		
		
		if (strErr!='') {
			document.getElementById("msg").innerHTML=strErr;
			document.getElementById("msg").className='msg_ko';
			document.getElementById("msg").style.display='block';
		} else {
			var parametri=lanfre_formCollection(document.form_front,'','');;
			//alert(parametri);
			lanfre_getCode("kart_send.php",'singin_content',parametri,'', 0,'',0,'','','');
		}
	}
	
}
































function checkMediaType(elem,p1,p2) {
	if (document.getElementById(elem)) {
		var urlMedia=document.getElementById(elem).innerHTML;
		urlMedia=urlMedia.replace(' ','');
		/*alert('URL=='+urlMedia);
		alert('Lunghezza URL=='+urlMedia.length);
		alert('estensione=='+urlMedia.substr((urlMedia.length-4),4));*/
		//alert('=='+urlMedia);
		if (urlMedia.substr((urlMedia.length-4),4)=='.flv') play_video(urlMedia,elem);
	}
}

function play_video(video,elem) {
	//alert(video);
	var so = new SWFObject("/FLV_player/FLV_player_liquido.swf?auto_start=false&video="+video, "mymovie", "575", "264", "8", "");

	so.addParam("quality", "best");
	so.addParam("wmode", "transparent");
	so.addParam("salign", "t");
	so.addParam('flashvars',video);

	so.write(elem,"");
}


