var menuURL = unescape(parent.contents.document.location.href);
if (menuURL.lastIndexOf("?section=") > 0) {
	var sectionStart = menuURL.lastIndexOf("?section=") + 9;
	if (menuURL.lastIndexOf("&subsection=") > 0) {
		var sectionEnd = menuURL.lastIndexOf("&subsection=");
		var subSectionStart = menuURL.lastIndexOf("&subsection=") + 12;
		if (menuURL.lastIndexOf("&subsubsection=") > 0) {
			var subSectionEnd = menuURL.lastIndexOf("&subsubsection=");
			var subSubSectionStart = menuURL.lastIndexOf("&subsubsection=") + 15;
			var subSubSectionEnd = menuURL.length;
			var subsubsection = menuURL.substring(subSubSectionStart, subSubSectionEnd);
		} else {
			var subSectionEnd = menuURL.length;
		}
		var subsection = menuURL.substring(subSectionStart, subSectionEnd);
	} else {
		var sectionEnd = menuURL.length;
	}
	var section = menuURL.substring(sectionStart, sectionEnd);
}
var URL = unescape(location.href);
if (URL.lastIndexOf("sbda/") > 0) {
	var fileStart = URL.lastIndexOf("sbda/") + 5;
	var fileEnd = URL.length;
	var file = URL.substring(fileStart,fileEnd);
}

var newHref = "/sbda/menuupdate.php";
if (section)
var newHref = newHref + "?section=" + section;
if (subsection)
var newHref = newHref + "&subsection=" + subsection;
if (subsubsection)
var newHref = newHref + "&subsubsection=" + subsubsection;
if (file && section)
var newHref = newHref + "&file=" + file;
else if (file && !section)
var newHref = newHref + "?file=" + file;


parent.contents.document.location.replace(newHref);


function OpenEwWindow(passafile,passanome)
{
EwWindows=window.open(passafile,passanome,"width=500,height=400,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes"),EwWindows.focus(passanome)
}


function OpenEwHelpWindow(passafile)
{
EwHelpWindows=window.open(passafile,"EwHelpWindows","width=500,height=400,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes"),EwHelpWindows.focus("EwHelpWindows")
}


function OpenEwNewWindow(passafile)
{
EwNewWindows=window.open(passafile,"EwNewWindows","width=500,height=400,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes"),EwNewWindows.focus("EwNewWindows")
}

function OpenTesiWindow(passafile)
{
TesiWindows=window.open(passafile,"TesiWindows","width=self.screen.width,height=self.screen.height,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes"),TesiWindows.focus("TesiWindows")
}

function veri_lista_ew() {
var num =0;
  for (var i = 0; i < document.lista.elements.length; i++) {

    if((document.lista.elements[i].name.indexOf ('EW') != (-1)) &&
       (document.lista.elements[i].checked))
      {
      num++;
      }
  }
    
 if (num == 0 || num> 20) {
    alert ("Selezionare da 1 a 20 elementi");
    return false;
    }
 else
    return true;
   
 }


