function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

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.0
  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 && document.getElementById) x=document.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 ConfirmDelete()
{
	return confirm('Sei sicuro di voler eliminare questo elemento?')
}

function sth_Browser (){
 
  // convert all characters to lowercase to simplify testing
  var agt=navigator.userAgent.toLowerCase();
  this.major = parseInt(navigator.appVersion);
  this.minor = parseFloat(navigator.appVersion);

  this.mac      = ((agt.indexOf('mac')!=-1) && (agt.indexOf('windows')==-1));
  this.windows      = ((agt.indexOf('win')!=-1) && (agt.indexOf('mac')==-1));

  this.ns      = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) &&
  					  (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) &&
                 (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)); 
  this.ns2     = (this.ns && (this.major == 2));
  this.ns3     = (this.ns && (this.major == 3));
  this.ns4     = (this.ns && (this.major == 4));
  this.ns4up   = (this.ns && (this.major >= 4));
  this.nsonly  = (this.ns && ((agt.indexOf(";nav") != -1) || (agt.indexOf("; nav") != -1)));
  this.ns6     = (this.ns && (this.major == 5));
  this.ns6up   = (this.ns && (this.major >= 5));
  this.gecko   = (agt.indexOf('gecko') != -1);
 
  this.ie      = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
  this.ie3     = (this.ie && (this.major < 4));
  this.ie4     = (this.ie && (this.major == 4) && (agt.indexOf("msie 4")!=-1) );
  this.ie4up   = (this.ie  && (this.major >= 4));
  this.ie5     = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.0")!=-1));
  this.ie5_5   = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.5") !=-1));
  this.ie5up   = (this.ie  && !this.ie3 && !this.ie4);
  this.ie5_5up = (this.ie && !this.ie3 && !this.ie4 && !this.ie5);
  this.ie6     = (this.ie && (this.major == 4) && (agt.indexOf("msie 6.")!=-1) );
  this.ie6up   = (this.ie  && !this.ie3 && !this.ie4 && !this.ie5 && !this.ie5_5);
 
  // BUG: On AOL4, returns false if IE3 is embedded browser or if this is the first
  //      browser window opened.  Thus the variables is.aol, is.aol3, and is.aol4
  //      aren't 100% reliable.
  this.aol     = (agt.indexOf("aol") != -1);
  this.aol3    = (this.aol && this.ie3);
  this.aol4    = (this.aol && this.ie4);
  this.aol5    = (agt.indexOf("aol 5") != -1);
  this.aol6    = (agt.indexOf("aol 6") != -1);

  // NOTE: Opera and WebTV spoof Navigator.  We do strict client detection. If you
  //       want to allow spoofing, take out the tests for opera and webtv.
  this.opera   = (agt.indexOf("opera") != -1);
  this.opera2  = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1);
  this.opera3  = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1);
  this.opera4  = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1);
  this.opera5  = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1);
  this.opera5up= (this.opera && !this.opera2 && !this.opera3 && !this.opera4);
 
  this.webtv   = (agt.indexOf("webtv") != -1);

  this.aoltv   = ((agt.indexOf("navio") != -1) ||
                 (agt.indexOf("navio_aoltv") != -1));

  this.hotjava = (agt.indexOf("hotjava") != -1);
  this.hotjava3 = (this.hotjava && (this.major == 3));
  this.hotjava3up = (this.hotjava && (this.major >= 3));

 }

var sth_browser = new sth_Browser();

function sth_changeProp(objName,theProp,theValue) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}

function sth_getProp(objName,theProp) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    return eval("obj."+theProp);
  }
}

function sth_displayNone()
{
 var a=sth_displayNone.arguments;
 for(var i=0;i<a.length;i++) {
 	sth_changeProp(a[i],'style.display','none');
 }
}
function sth_displayBlock()
{
 var a=sth_displayBlock.arguments;
 for(var i=0;i<a.length;i++) {
 	sth_changeProp(a[i],'style.display','block');
 }
}
function sth_isDisplayed(objName)
{
  var obj = MM_findObj(objName);
  if (obj) {
   if (obj.display) {
      if (obj.display == 'none')
      	return false;
      else
      	return true;
   }
   else if (obj.style) {
      if (obj.style.display == 'none')
      	return false;
      else
      	return true;
   }
 }
 return false;
}

function sth_switchDisplay(objVName, objCName, objCProp, objCPropVis, objCPropHid)
{
  if (sth_isDisplayed(objVName)) {
  	  sth_displayNone(objVName);
	  sth_changeProp(objCName,objCProp,objCPropHid);
  }
  else {
  	  sth_displayBlock(objVName);
	  sth_changeProp(objCName,objCProp,objCPropVis);
  }
}
function sth_setDisplay(visib, objVName, objCName, objCProp, objCPropVis, objCPropHid)
{
  if (visib) {
  	  sth_displayBlock(objVName);
	  sth_changeProp(objCName,objCProp,objCPropVis);
  }
  else {
  	  sth_displayNone(objVName);
	  sth_changeProp(objCName,objCProp,objCPropHid);
  }
}

function sth_hide()
{
 var a=sth_hide.arguments;
 for(var i=0;i<a.length;i++) {
 	sth_changeProp(a[i],'style.visibility','hidden');
 }
}
function sth_show()
{
 var a=sth_show.arguments;
 for(var i=0;i<a.length;i++) {
 	sth_changeProp(a[i],'style.visibility','visible');
 }
}
function sth_isVisible(objName)
{
  var obj = MM_findObj(objName);
  if (obj) {
   if (obj.visibility) {
      if (obj.visibility == 'hidden')
      	return false;
      else
      	return true;
   }
   else if (obj.style) {
      if (obj.style.visibility == 'hidden')
      	return false;
      else
      	return true;
   }
 }
 return false;
}

function sth_popUp(strUrl, strWidth, strHeight, dbg, strName)
{
	var strTop = (screen.height - strHeight) / 2;
	var strLeft = (screen.width - strWidth) / 2;
	MM_openBrWindow(strUrl,strName,'scrollbars,width='+strWidth+',height='+strHeight+',left='+strLeft+',top='+strTop+((dbg==1)?',status=yes':''));
}

function sth_switchVisibility(objVName, objCName, objCProp, objCPropVis, objCPropHid)
{
  if (sth_isVisible(objVName)) {
  	  sth_hide(objVName);
	  sth_changeProp(objCName,objCProp,objCPropHid);
  }
  else {
  	  sth_show(objVName);
	  sth_changeProp(objCName,objCProp,objCPropVis);
  }
}
function sth_setVisibility(visib, objVName, objCName, objCProp, objCPropVis, objCPropHid)
{
  if (visib) {
  	  sth_show(objVName);
	  sth_changeProp(objCName,objCProp,objCPropVis);
  }
  else {
  	  sth_hide(objVName);
	  sth_changeProp(objCName,objCProp,objCPropHid);
  }
}
