function popup(theurl,larghezza,altezza,tipo){

var winl = (screen.width-200)/ 2;
var wint = (screen.height-360)/ 2;

			var parametri;
			var largezza;
			var altezza;
			parametri="addressbar=no,menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,width=" + larghezza + ",height=" + altezza +",top=" +wint+ ",left= "+winl+"";
			popWindow=window.open(theurl,'popup',parametri,tipo);
			
}


function slideshow(theurl,larghezza,altezza, selected){
			var parametri;
			var largezza;
			var altezza;
			
			var winlm = (screen.width - 600) / 2;
			var wintm = (screen.height - 480) / 2;
			
			parametri='toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=yes,top='+wintm+',left='+winlm+',width='+ larghezza + ',height=' + altezza;
			popWindow=window.open(theurl,'popup',parametri);
			window.selezione=selected;
}


function check(){
	if (document.controlla.search.value.length < 4){
		alert('Attenzione! per effettuare la ricerca è necessario inserire almeno 4 caratteri');
		return false;
	}
	else {
			document.controlla.submit();
			return true;
	}
}	


function popvideo(quale,url){
// per i popup large
	var winl = (screen.width - 670) / 2;
	var wint = (screen.height - 560) / 2;

// per i popups small
	var winls = (screen.width - 322) / 2;
	var wints = (screen.height - 320) / 2;
	
// per i popups medium
	var winlm = (screen.width - 500) / 2;
	var wintm = (screen.height - 500) / 2;
	
// per i popups personalizzati
    var win_width = (screen.width - 320) / 2;
	var win_height = (screen.height - 280) / 2;
	
	// per i popups personalizzati
    var win_width_eureka = (screen.width - 379) / 2;
	var win_height_eureka = (screen.height - 600) / 2;
	
	// per popup Classifica racconti
    var win_width_class = (screen.width - 800) / 2;
	var win_height_class = (screen.height - 500) / 2;
	
	// per popup Social Network
    var win_width_net = (screen.width - 250) / 2;
	var win_height_net = (screen.height - 400) / 2;
	
	// per popup Project
    var win_width_pro = (screen.width - 600) / 2;
	var win_height_pro = (screen.height - 450) / 2;
	
	// per popup Project2
    var win_width_pro2 = (screen.width - 390) / 2;
	var win_height_pro2 = (screen.height - 600) / 2;
	
// CARTOLINE LARGHEZZA 600
	var cart1w = (screen.width - 400) / 2;
	var cart1h = (screen.height - 600) / 2;
	
// CARTOLINE LARGHEZZA 400
	var cart2w = (screen.width - 600) / 2;
	var cart2h = (screen.height - 400) / 2;
	
// MR FRAME 600x402
	var frame1w = (screen.width - 600) / 2;
	var frame1h = (screen.height - 402) / 2;
	
// MR FRAME 600x800
	var frame2w = (screen.width - 600) / 2;
	var frame2h = (screen.height - 800) / 2;
	
// MR FRAME 600x450
	var frame3w = (screen.width - 600) / 2;
	var frame3h = (screen.height - 450) / 2;
		
	//url = '/redir.aspx?url=' + escape(url);
	//url = '/redir.aspx?url=' + url;

	switch (quale){
		
		case "TGItaBN":
			window.open(url,'TGItaBN','width=670,height=560,scrollbars=no,resizable=no,status=no,top='+wint+',left='+winl+'');
		break;
		
		case "TGItaBL":
			window.open(url,'TGItaBL','width=500,height=500,scrollbars=no,resizable=no,status=no,top='+wintm+',left='+winlm+'');
		break;
		
		case "Eureka":
			window.open(url,'Eureka','width=379,height=600,scrollbars=no,resizable=no,status=no,top='+win_height_eureka+',left='+win_width_eureka+'');
		break;
		
		case "Classifica":
			window.open(url,'Classifica','width=800,height=500,scrollbars=no,resizable=no,status=no,top='+win_height_class+',left='+win_width_class+'');
		break;
		
		case "Network":
			window.open(url,'Network','width=250,height=400,scrollbars=no,resizable=no,status=no,top='+win_height_net+',left='+win_width_net+'');
		break;
		
		case "Project":
			window.open(url,'Project','width=600,height=450,scrollbars=no,resizable=no,status=no,top='+win_height_pro+',left='+win_width_pro+'');
		break;
		
		case "Project2":
			window.open(url,'Project2','width=390,height=600,scrollbars=yes,resizable=no,status=no,top='+win_height_pro2+',left='+win_width_pro2+'');
		break;
		
		case "TGEuBN":
			window.open(url,'TGEuBN','width=322,height=500,scrollbars=no,resizable=no,status=no,top='+wint+',left='+winlm+'');
		break;
		
		case "TGEuBL":
			window.open(url,'TGEuBL','width=640,height=520,scrollbars=no,resizable=no,status=no,top='+wint+',left='+winlm+'');
		break;
		
		case "TGWEItaBN":
			window.open(url,'TGWEItaBN','width=320,height=280,scrollbars=no,resizable=no,status=no,top='+win_height+',left='+win_width+'');
		break;		

		case "TGWEItaBL":
			window.open(url,'TGWEItaBL','width=640,height=520,scrollbars=no,resizable=no,status=no,top='+wint+',left='+winlm+'');
		break;		
		
		case "TGWEEuBN":
			window.open(url,'TGWEEuBN','width=320,height=280,scrollbars=no,resizable=no,status=no,top='+wints+',left='+winls+'');
		break;				
		
		case "TGWEEuBL":
			window.open(url,'TGWEEuBL','width=640,height=520,scrollbars=no,resizable=no,status=no,top='+wint+',left='+winlm+'');
		break;						
		
		case "Prev_Ita":
			window.open(url,'Prev_Ita','width=770,height=550,scrollbars=no,resizable=no,status=no,top='+wint+',left='+winl+'');
		break;
		
		case "Prev_Eur":
			window.open(url,'Prev_Eur','width=770,height=550,scrollbars=no,resizable=no,status=no,top='+wint+',left='+winl+'');
		break;										
		
		case "Prev_Mon":
			window.open(url,'Prev_Mon','width=770,height=550,scrollbars=no,resizable=no,status=no,top='+wint+',left='+winl+'');
		break;												
		
		case "Loc_Tur":
			window.open(url,'Loc_Tur','width=770,height=550,scrollbars=no,resizable=no,status=no,top='+wint+',left='+winl+'');
		break;		
		
		case "CARTOver":
			window.open(url,'CARTOver','width=400,height=600,scrollbars=no,resizable=no,status=no,top='+cart1h+',left='+cart1w+'');
		break;
		
		case "CARTOor":
			window.open(url,'CARTOor','width=600,height=400,scrollbars=no,resizable=no,status=no,top='+cart2h+',left='+cart2w+'');
		break;
		
		case "Mrframe1":
			window.open(url,'Mrframe1','width=600,height=402,scrollbars=no,resizable=no,status=no,top='+frame1h+',left='+frame1w+'');
		break;
		
		case "Mrframe2":
			window.open(url,'Mrframe2','width=600,height=800,scrollbars=no,resizable=no,status=no,top='+frame2h+',left='+frame2w+'');
		break;
		
		case "Mrframe3":
			window.open(url,'Mrframe3','width=600,height=450,scrollbars=no,resizable=no,status=no,top='+frame3h+',left='+frame3w+'');
		break;
	}

}

