function newWindow(mypage,myname,w,h,features) {
  if(screen.width){
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  }else{winl = 0;wint =0;}
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + h + ',';
  settings += 'width=' + w + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += features;
  win = window.open(mypage,myname,settings);
  win.window.focus();
}

// funzione formSearch => verificare come passare variabili 'fisse'
function __setSearch__(chooser){
	
	var choice = chooser.options[chooser.selectedIndex].value;
	self.location.href="http://localhost/eurolites/index.php?evt[index-index_page]"+"&IDvar1="+choice;
}

function setSearch(){
	
	var link = document.search.link;
	var choice1 = document.search.var1;
self.location.href=link.value+"&IDvar1="+choice1.options[choice1.selectedIndex].value;
}

function setSearch2(){
	
	var link = document.search.link;
	var choice1 = document.search.var1;
	var choice2 = document.search.var2;
	self.location.href=link.value+"&IDvar1="+choice1.options[choice1.selectedIndex].value+"&IDvar2="+choice2.options[choice2.selectedIndex].value;
}

function setSearch3(){
	
	var link = document.search.link;
	var choice1 = document.search.var1;
	var choice2 = document.search.var2;
	var choice3 = document.search.var3;
	self.location.href=link.value+"&IDvar1="+choice1.options[choice1.selectedIndex].value+"&IDvar2="+choice2.options[choice2.selectedIndex].value+"&IDvar3="+choice3.options[choice3.selectedIndex].value;
}

function setRefSearch(){
	
	var link = document.rsearch.link;
	var choice1 = document.rsearch.rvar1;
self.location.href=link.value+"&IDrvar1="+choice1.options[choice1.selectedIndex].value;
}

function setRefSearch2(){
	
	var link = document.rsearch.link;
	var choice1 = document.rsearch.rvar1;
	var choice2 = document.rsearch.rvar2;
	self.location.href=link.value+"&IDrvar1="+choice1.options[choice1.selectedIndex].value+"&IDrvar2="+choice2.options[choice2.selectedIndex].value;
}


// aggiornamento select lingua
function jump_language(){
	var sl=document.form_lng.lng;
	self.location.href="index.php?lngId="+sl.options[sl.selectedIndex].value;
}

function externalLinks(){
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
			anchor.target = "_blank";
			if (anchor.title) anchor.title += " (Il link apre una nuova finestra)";
			if (!anchor.title) anchor.title = "Il link apre una nuova finestra";
		}
	}
}
window.onload = externalLinks;