
function leapto(obj) {
  var myindex = obj.selectedIndex;
  if (myindex >= 1) {
    //obj.form.action=obj.options[myindex].value;
    //obj.form.submit();
    //OLD//openWindow(obj.options[myindex].value);
    window.open(obj.options[myindex].value, '_blank', 'left=0,top=0,menubar=no,location=no,resizable=yes,scrollbars=no,status=no, width='+screen.width+', height='+screen.height);
  } else {
    obj.selectedIndex = 0;
  }
  return;
}

function openNew(page){
  //Corporate popup
  newWin = window.open(page,'new','resizable=no,scrollbars=yes,status=no,width=500,height=400')
}

function openWindow2(page) {
  //Confidential
  document.location=page;
}

function openWindow3(page) {
  //Art&Web 
  // val="scroll" per scrollbars e "hidden" per no scrollbars
  //document.body.style.overflowY = "scroll" ;
  //document.location = page;
  newWin = window.open(page,'epopup','resizable=no,scrollbars=yes,status=no,width=900,height=620')
}

function openByKey(urlPage) {
  window.opener.location=urlPage;
  window.close();
}

function openWindow_GIGI(page){
  w=950;
  h=550;
  window.open(page,'popup1','scrollbars=no,resizable=no,width='+w+',height='+h+',status=0,location=no,toolbar=no,titlebar=no');
}

function openWindow(l){
	window.open(l,'neww','left=0,top=0,menubar=no,location=yes,titlebar=no,directories=no,resizable=yes,scrollbars=no,status=no, width='+screen.width+', height='+screen.height)
}

function openWindow_orig(page){
  //Minisiti e Stores
  if (page==0 || page=='0' || page=='') {
    //alert('attendere il caricamento della pagina');
    return;
  }
  //w=880;
  //h=530;
  w=950;
  h=550;
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  if (screen.width==800 && screen.height==600) {
    var  settings ='top=0,';
    settings +='left=0,';
    settings +='scrollbars=no,';
    settings +='resizable=no,';
    settings +='maximize=null,';
    settings +='status=yes';
    win=window.open(page,'popup',settings);
    win.moveTo(0,0)
    win.resizeTo(screen.width,screen.height)
    if(parseInt(navigator.appVersion) >= 4){win.window.focus();}  
  } else {
    var settings  ='height='+h+',';
    settings +='width='+w+',';
    settings +='top='+wint+',';
    settings +='left='+winl+',';
    settings +='scrollbars=no,';
    settings +='resizable=no,';
    settings +='status=yes';
    win=window.open(page,'popup',settings);
    if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
  }
}

function openWindowNoStatus(page){
  //Minisiti e Stores
  if (page==0 || page=='0' || page=='') {
    //alert('attendere il caricamento della pagina');
    return;
  }
  //w=880;
  //h=530;
  w=950;
  h=550;
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  if (screen.width==800 && screen.height==600) {
    var  settings ='top=0,';
    settings +='left=0,';
    settings +='scrollbars=no,';
    settings +='resizable=no,';
    settings +='maximize=null,';
    settings +='status=no';
    win=window.open(page,'popup',settings);
    win.moveTo(0,0)
    win.resizeTo(screen.width,screen.height)
    if(parseInt(navigator.appVersion) >= 4){win.window.focus();}  
  } else {
    var settings  ='height='+h+',';
    settings +='width='+w+',';
    settings +='top='+wint+',';
    settings +='left='+winl+',';
    settings +='scrollbars=no,';
    settings +='resizable=no,';
    settings +='status=no';
    win=window.open(page,'popup',settings);
    if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
  }
}

function returnToMain() {
  if (screen.width==800 && screen.height==600) {
    document.location = 'main.asp';
  } else {
    window.opener.document.location = 'main.asp';
    self.close();
  }
}

//aggiunge gli elementi selezionati nella select di id fromsel_n alla select di id tosel_n
function addSel(n){
	var objfrom,objto,i,j,f,newopt;
	objfrom=document.getElementById('fromsel_'+n);
	objto=document.getElementById('tosel_'+n);
	for(i=0;i<objfrom.options.length;i++){
		if (objfrom.options[i].selected){
			f=false;
			for(j=0;j<objto.options.length;j++){
				//alert(objto.options[j].value+' =?= '+objfrom.options[i].value);
				if (objto.options[j].value==objfrom.options[i].value)
					f=true;
			}
			if (!f) {
				newopt=document.createElement("OPTION");
				newopt.text=objfrom.options[i].text;
				newopt.value=objfrom.options[i].value;
				newopt.selected=true;
				//objto.options.add(newopt);
				try {
					objto.add(newopt,null);
				}
				catch(ex) {
					objto.add(newopt);
				}
			}
		}				
	}
}

//aggiunge gli elementi selezionati nella select di id fromsel_n alla select di id tosel_n
function subSel(n){
	var objto,i,toRemove,k;
	toRemove=new Array();
	objto=document.getElementById('tosel_'+n);
	k=0
	for(i=0;i<objto.options.length;i++)
		if (objto.options[i].selected)
			toRemove[k++]=i;
	for(i=k-1;i>=0;i--){
		//objto.options.remove(toRemove[i]);
		objto.remove(toRemove[i]);
	}
	for(i=0;i<objto.options.length;i++)
		objto.options[i].selected=true;
}