function WriteSwf(img,wsize,hsize){
	document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\""+wsize+"\" height=\""+hsize+"\">");
    document.write("<param name=\"movie\" value=\""+img+"\">");
    document.write("<param name=\"quality\" value=\"high\">");
    document.write("<param name=wmode value=transparent>");
    document.write("<embed src=\""+img+"\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\""+wsize+"\" height=\""+hsize+"\"></embed>");
	document.write("</object>");
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

// Example: obj = findObj("image1");
function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}

function MM_findObj(theObj, theDoc)
{
  var p, i, foundObj;
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  return foundObj;
}




function check_pass(){
	var myErr='';var addErr=false;
	myObj1=MM_findObj('pass');
	myObj2=MM_findObj('pass2');
	if(myObj1.value=='' || myObj1.value!=myObj2.value){
		addErr=false
	   	myObj1.style.border='1px solid red';
		myObj2.style.border='1px solid red';
	}else{
		myObj1.style.border='1px solid #7F9DB9';
		myObj2.style.border='1px solid #7F9DB9';
	}
	document.MM_returnValue = (myErr=='');
}
	
function check_form(){
	var myErr='';var addErr=false;
	backMsg=MM_findObj('back-msg');
	try{
		backMsg.style.display='none';
	}catch(err){}
	
	for(var i=0;i<req_flds.length;i++){
		myObj=MM_findObj(req_flds[i]);
		if (myObj.type=='text'||myObj.type=='password'||myObj.type=='hidden'){
      		if (myObj.value.length==0){addErr=true}
		}
		else if (myObj.type=='textarea'){
      		if(myObj.value.length<1){addErr=true}
		}
		else if (myObj.type=='select-one'||myObj.type=='select-multiple'){
      		if(myObj.selectedIndex==0){addErr=true}
		}	
	   if (addErr){
		   myErr+='* Il campo '+req_flds[i]+' è vuoto!\n'; addErr=false
	   	   myObj.style.border='1px solid red';
	   }else{
		   myObj.style.border='1px solid #7F9DB9';
	   }
	}
	
	if (myErr!=''){
			//alert('The required information is incomplete or contains errors:\t\t\t\t\t\n\n'+myErr);
			//alert('La form contiene degli errori!\tVerificare i campi segnati in rosso!')		
			
			errDiv=MM_findObj('error');
			errDiv.innerHTML='La form contiene degli errori!<BR>Verificare i campi segnati in rosso!';
			errDiv.style.display='block';
	}
  	document.MM_returnValue = (myErr=='');
}


function WriteSwf(img,wsize,hsize,opt){
	document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\""+wsize+"\" height=\""+hsize+"\">");
    document.write("<param name=\"movie\" value=\""+img+"\">");
    document.write("<param name=\"quality\" value=\"high\">");
    document.write("<param name=wmode value=transparent>");

    if(opt != null){
    	var params = opt.split("$");
		out='';
    	for(var i=0;i<params.length;i++){
    		  var tmp = params[i];
		      var paramss = tmp.split(">>");

		      var strAtt = paramss[0];
		      var strVal = paramss[1];

		      out+="<param name="+strAtt+" value="+strVal+"> \n";

		      strAtt="";
		      strVal="";

    	}
		document.write(out); 
    }

    document.write("<embed src=\""+img+"\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\""+wsize+"\" height=\""+hsize+"\" wmode=\"transparent\"");
	
	if(opt != null){
    	var params = opt.split("$$");
		out='';
    	for(var i=0;i<params.length;i++){
    		  var tmp = params[i];
		      var paramss = tmp.split(">>");

		      var strAtt = paramss[0];
		      var strVal = paramss[1];

		      document.write(" "+strAtt+"=\""+strVal+"\"");

		      strAtt="";
		      strVal="";

    	}
    } 
	document.write("></embed>");
	document.write("</object>");
}

