// JavaScript Document


//MM find object
// 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;

}

//end of mmfind object

//  


function setColor(objName, fg, bg)

{

  obj = findObj(objName);

  if (obj.style)

  {

    obj.style.color = fg;

    //obj.style.backgroundColor = bg;

  }

}

function toggleShowHide(evId){
    ele=document.getElementById("blocco"+evId);
    if(!(ele!=null && ele.style.display!=null)){
        alert('non trovo display di trEvento'+evId);
        return false;

    }
    if(ele.style.display!='none'){
        ele.style.display='none';
    }else{
        ele.style.display='block';
    }
   // saveShowStatus();
    //return true;
}













var popUpWin=0;

function popUpWindow(URLStr, left, top, width, height)

{

  if(popUpWin)

  {

    if(!popUpWin.closed) popUpWin.close();

  }

  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width=550,height=550,left=20, top=20,screenX=20,screenY=20');

}

function enlarge(URLtoOpen,XtoOpen,YtoOpen) {
indirizzo = 'container.html?'+URLtoOpen;
//alert(indirizzo)
if (a!=null)
{
	a.close();
	a=window.open( indirizzo , "gallery" , "width=" + XtoOpen +",height=" + YtoOpen +  ",scrollbars=yes,resizable=yes" ) 	
}
	else
	{
	a=window.open( indirizzo , "gallery" ,  "width=" + XtoOpen +",height=" + YtoOpen + ",scrollbars=yes,resizable=yes" )  
}
}



//per application form
function enableform(cont)
{
if (cont.waiver[1].checked) {
//document.getElementById(submitform).disabled = false;
cont.submitform.disabled = false;
}
else if (cont.waiver[0].checked) {
cont.submitform.disabled = true;
}
}


