function chk_form(frm){
	
	for(var i = 0; i < frm.elements.length; i++){
		
		//alert(frm.elements[i].name+':'+frm.elements[i].required);
		
		switch(frm.elements[i].required){
			case 'TEXT':
				if(!chk_txt(frm.elements[i],frm.elements[i].msg)) return false;
			break;
			case 'DATE':
				if(!chk_date(frm.elements[i],frm.elements[i].msg)) return false;
			break;
			case 'EMAIL':
				if(!chk_email(frm.elements[i],frm.elements[i].msg)) return false;
			break;
			case 'CHECK':
				if(!chk_checkbox(frm.elements[i],frm.elements[i].msg)) return false;
			break;
			case 'RADIO':
				if(!chk_radiobutton(frm.elements[i],frm.elements[i].msg)) return false;
			break;
		}
	}
	
}
function chk_txt(o,v){
	if(o.value.search('[a-zA-Z0-9]') == -1){
		if(arguments.length==1) alert(v)
		else if(arguments.length==2)alert(v)
		o.focus();
		return false;
	}
	return true;
}


function chk_email(o,d){
	if(o.value.search("^[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-.]?[0-9a-zA-Z])*\\.[a-zA-Z]{2,4}$") == -1){
		alert(d)
		o.focus();
		return false;
	}
	return true;
}
function chk_select(o,d){
	if(!o[o.selectedIndex].value || !o.selectedIndex){
		e=1;
		o.focus();
		return false;
	}
	return true;
}
posizione_iniziale=0;
	posizione_attuale=0;
	movimento=30;
	
	function show(numero_voci,action){
		if(numero_voci>13){
			posizione_finale=-30*(numero_voci-13);
			if(action=='avanti'){
				if(posizione_attuale!=posizione_finale){
					posizione_attuale-=movimento;
					
					document.getElementById('container_menu_prodotti').style.left=posizione_attuale+'px';
				}
			}
			else if(action=='indietro'){
				if(posizione_attuale!=posizione_iniziale){
					posizione_attuale+=movimento;
					document.getElementById('container_menu_prodotti').style.left=posizione_attuale+'px';
					
				}
			}
			else if(action=='diretto'){
				
				salti=numero_voci-13;
				
				if(salti>0){
				posizione_attuale-=movimento*salti;
					document.getElementById('container_menu_prodotti').style.left=posizione_attuale+'px';
				}
			}
		}
	}
	
	function visual_testo(frase,id){
		if(document.getElementById('div_dinamico_menu')){
			document.getElementById('div_dinamico_menu').innerHTML=frase;
		}
		/*posizione=(30*(id-1))+17;
		posizione=30+posizione+posizione_attuale;*/
	}	
	function pulisci(){
		document.getElementById('div_dinamico_menu').innerHTML='';
	}
	function carica_img(div_destinazione,url,img_destinazione){
		img = new Image();
		img.src=url;
		setTimeout("aggiungi_immagine('var_img','"+url+"')",1000);
		//alert(document.getElementById(img_destinazione).src);
		/*rimuovi_immagine('foto_big','big_img')*/
		/*rimuovi_immagine(div_destinazione,img_destinazione);
		rimuovi_immagine('foto_varianti','var_img');
		
		if(url!=''){
			
			immagine = document.createElement("IMG");
			immagine.setAttribute("src",url);
			immagine.setAttribute("id",img_destinazione);
			
			document.getElementById(div_destinazione).appendChild(immagine)
		}*/
	}
	function aggiungi_immagine(dest,obj){
		document.getElementById(dest).src=obj;	
	}
	function rimuovi_immagine(div_destinazione,img_destinazione){
		if(document.getElementById(img_destinazione)) {
			
		document.getElementById(div_destinazione).removeChild(document.getElementById(img_destinazione));
		}
	}
	function mostra_didascalia(frase){
		document.getElementById('menu_gallery_didascalia').innerHTML=frase;	
	}
	
	
	<!--
	function MM_swapImgRestore() { //v3.0
	  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}
	
	function MM_preloadImages() { //v3.0
	  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}
	
	function MM_findObj(n, d) { //v4.01
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	  if(!x && d.getElementById) x=d.getElementById(n); return x;
	}
	
	function MM_swapImage() { //v3.0
	  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}
	//-->
	
	function high(which2){
	theobject=which2
	highlighting=setInterval("highlightit(theobject)",30)
	}
	function low(which2){
	clearInterval(highlighting)
	if (which2.style.MozOpacity)
	which2.style.MozOpacity=0.3
	else if (which2.filters)
	which2.filters.alpha.opacity=50
	}
	
	function highlightit(cur2){
	if (cur2.style.MozOpacity<1)
	cur2.style.MozOpacity=parseFloat(cur2.style.MozOpacity)+0.1
	else if (cur2.filters&&cur2.filters.alpha.opacity<100)
	cur2.filters.alpha.opacity+=10
	else if (window.highlighting)
	clearInterval(highlighting)
	}