function loadswf(swf, w, h){
	document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"");
	document.write("codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\"");
   	document.write("width=\""+w+"\" height=\""+h+"\">");
    document.write("<param name='movie' value='"+swf+"' />\n");
	if(w==850){
		document.write("<param name='flashVars' value='idcategoria=6' />\n");
	}
	
    document.write("<param name='quality' value='high' /><param name='wmode' value='transparent' />\n");
    if(w==850){
		document.write("<embed src=\""+swf+"\" quality=\"high\" wmode=\"transparent\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\""+w+"\" height=\""+h+"\"></embed>");
	}
	else{
		document.write("<embed src=\""+swf+"\" quality=\"high\" wmode=\"transparent\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\""+w+"\" height=\""+h+"\" flashVars=\"idcategoria=6\"></embed>");
	}
    document.write("</object>\n");
}

function loadswfgallery(swf, w, h, idc){

	document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"");
	document.write("codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\"");
   	document.write("width=\""+w+"\" height=\""+h+"\">");
    document.write("<param name='movie' value='"+swf+"' />\n");
	if(w==850){
		document.write("<param name='flashVars' value='idcategoria="+idc+"' />\n");
	}
	
    document.write("<param name='quality' value='high' /><param name='wmode' value='transparent' />\n");
    if(w==850){
		document.write("<embed src=\""+swf+"\" quality=\"high\" wmode=\"transparent\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\""+w+"\" height=\""+h+"\" flashVars=\"idcategoria="+idc+"\"></embed>");
	}
	else{
		document.write("<embed src=\""+swf+"\" quality=\"high\" wmode=\"transparent\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\""+w+"\" height=\""+h+"\"></embed>");
	}
    document.write("</object>\n");
}

function evidenzia(id, w, bg){
	var curleft = curtop = 0;
	if(id!=""){
		
		obj = document.getElementById(id);
		if (obj.offsetParent) {
			curleft = obj.offsetLeft;
			curtop = obj.offsetTop;
			while (obj = obj.offsetParent) {
				curleft += obj.offsetLeft;
				curtop += obj.offsetTop;
			}
			
			if(bg!="") document.getElementById('box_onmouse').style.background = '#' + bg;
			if(w!="") document.getElementById('box_onmouse').style.width = w + 'px';
			
			document.getElementById('box_onmouse').style.left = (curleft - 8) + 'px';
			document.getElementById('box_onmouse').style.top = (curtop - 2) + 'px';
			document.getElementById('box_onmouse').style.display = 'block';
		}
		
	}
	
	else{
		document.getElementById('box_onmouse').style.background = '#d2ddb7';
		document.getElementById('box_onmouse').style.width = '170px';
		document.getElementById('box_onmouse').style.left = 0;
		document.getElementById('box_onmouse').style.top = 0;
		document.getElementById('box_onmouse').style.display = 'none';
	}
}

function seleziona_voce(id, w, bg){
	var curleft = curtop = 0;
	
	obj = document.getElementById(id);
	if (obj.offsetParent) {
		curleft = obj.offsetLeft;
		curtop = obj.offsetTop;
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		}
		
		if(bg!="") document.getElementById('box_onmouse_sel').style.background = '#' + bg;
		if(w!="") document.getElementById('box_onmouse_sel').style.width = w + 'px';
		
		document.getElementById('box_onmouse_sel').style.left = (curleft - 8) + 'px';
		document.getElementById('box_onmouse_sel').style.top = (curtop - 2) + 'px';
		document.getElementById('box_onmouse_sel').style.display = 'block';
	}
		
}

var indirizzoEmail;

function checkEmailAddress(field) {

     var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.biz)|(\..{2,2}))$)\b/gi);
     
     if (goodEmail){
        indirizzoEmail = true
     } 
     else {
        alert('Inserire un indirizzo email valido');
        field.focus();
        field.select();
        indirizzoEmail = false;
        }
  	return indirizzoEmail;
}

function controlloLogin(){
	thisform = document.form_login;
	
	if(thisform.email.value==''){
		alert("inserire un indirizzo email");
		thisform.email.focus();
		return;
	}
	
	if(!checkEmailAddress(thisform.email)){
		return;
	}
	
	if(thisform.password.value==''){
		alert("inserire la password");
		thisform.password.focus();
		return;
	}
	
	thisform.action = "_class/azioni.class.php";
	thisform.submit();
}

function controlloNewpass(){
	thisform = document.form_newpass;
	
	if(thisform.email.value==''){
		alert("inserire un indirizzo email");
		thisform.email.focus();
		return;
	}
	
	if(!checkEmailAddress(thisform.email)){
		return;
	}
	
	thisform.action = "_class/azioni.class.php";
	thisform.submit();
}

function submitRicerca(){
	thisform = document.form_ricerca;
	
	if(thisform.cerca.value==''){
		alert("inserire una chiave di ricerca");
		thisform.cerca.focus();
		return;
	}
	else
		thisform.submit();
}

function zoomEmas(image){
	zommFin=window.open("emas_popup.php?image="+image , "popup", "left=100, top=80, scrollbars=1, status=0, resizable=1, directories=0, toolbars=1, menubar=0, height=500, width=700");
	zommFin.focus();
}

