var submitcount=0;
function checkSubmit() {
      if (submitcount == 0)
      {
      submitcount++;
      document.Surv.submit();
      }
   }
function textCounter(field, countfield, maxlimit) {
  if (field.value.length > maxlimit)
      {field.value = field.value.substring(0, maxlimit);}
      else
      {countfield.value = maxlimit - field.value.length;}
  }

function open_MaxWindow(url,boxname) 
   {
	w = (screen.width-60) 	
	h = (screen.height-210)
	l = 30
	t = 30
	mywin = window.open(url,boxname,'toolbar=1,location=1,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=' + w + ',height=' + h + ',top=' + t + ',left=' + l);
	mywin.focus();
   }
function open_CentreWindow(url,w,h,boxname) 
   {
	var myleft = (screen.width-w)/2
	var mytop = (screen.height-50-h)/2
	mywin = window.open(url,boxname,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=' + w + ',height=' + h + ',top=' + mytop + ',left=' + myleft);
	mywin.focus();
   }
function open_FixedWindow(url,l,t,w,h,boxname) 
   {
	mywin = window.open(url,boxname,'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width=' + w + ',height=' + h + ',top=' + t + ',left=' + l);
	mywin.focus();
   }
function toggle(menuId)
   {
	thisId=document.all(menuId);
	if (thisId.style.display =="none")
	{
		thisId.style.display ="";
	}
	else
	{
		thisId.style.display ="none";
	}
   }
function ed(item)
   {
	thisId=document.all(item);
	if (thisId.style.display =="none")
	{
		thisId.style.display ="";
	}
	else
	{
		thisId.style.display ="none";
	}
   }
function OpenFoto(img){
  foto1= new Image();
  foto1.src=(img);
  Controlla(img);
}
function Controlla(img){
  if((foto1.width!=0)&&(foto1.height!=0)){
    viewFoto(img);
  }
  else{
    funzione="Controlla('"+img+"')";
    intervallo=setTimeout(funzione,20);
  }
}
function viewFoto(img){
  largh=foto1.width+20;
  altez=foto1.height+27;
  stringa="width="+largh+",height="+altez;
  finestra=window.open(img,"",stringa);
  //finestra.focus();
}
function SwapImg(el)
{
	el.src = 'images/' + el.name + '2.jpg'
}
function RestImg(el)
{
	el.src = 'images/' + el.name + '1.jpg'
}
