if (document.location=="http://www.tg5.it/" || document.location=="http://www.tg5.it" || document.location=="http://www.tg5.it/home.shtml") {
	//  ************************************* ATTIVAZIONE SPLASH PAGE *********************
	
	goSplash(tg5sect_Home); 
	/*       
	// ************************************* ATTIVAZIONE POPUNDER *********************	
	var undcookie = "pundtg5=ok";
	if (document.cookie.indexOf(undcookie) == -1) {
		var exphours  = 0;
		if (exphours > 0) {
			var exp = new Date();
			exp.setTime(exp.getTime() + (exphours*60*60*1000));
			var expstr = "; expires=" + exp.toGMTString();
		} else
	 		var expstr = "";
		document.cookie = undcookie + expstr;
		winpopu = window.open("PopUnder.htm","Tg5PopUnder","width=550,height=550");
		winpopu.blur();
		window.focus();			
	}	        
	// ************************************* POPUNDER *********************	
	*/
	

// ************************************* INIZIO POPUP **************************
/*
var upcookie = "pupuptg5=ok";
if (document.cookie.indexOf(upcookie) == -1) {
	
	var exphours  = 0;
	if (exphours > 0) {
		var exp = new Date();
		exp.setTime(exp.getTime() + (exphours*60*60*1000));
		var expstr = "; expires=" + exp.toGMTString();
	} else
 		var expstr = "";
	document.cookie = upcookie + expstr;
	winpop = window.open("PopUp200x150tg5.htm","Tg5PopUp","width=200,height=150");
}
*/
// ************************************* FINE POPUP *********************

}


/* ======================================================================
FUNCTION: 	

INPUT:		
				
RETURNS:		

DESC:							
====================================================================== */

var browser = "";
var adZone = "";
var contentUnits = null;

//
function getBrowser()
{	
  	if( parseInt(navigator.appVersion) >= 4 )
  	{	
    		if( navigator.appName == "Netscape" )
      			browser = "ns";
    		else if( navigator.appName == "Microsoft Internet Explorer" )
      			browser = "ie";
  	}
}

//
function initAD()
{
	contentUnits = new Array(
		// section|BT-1|BT-2|HB-1|HB-2|HB2|FB
		
		"homepage|42848|42851||||",
		"altre|42848|42851||||42853",
		"servizi|44236|44237||||44238",
		"meteo|44226|44229||||44232",
		"oroscopo|44239|44240||||44241",
		"verissimo|44242|44243||||44244",
		"terra|44245|44246||||44247",
		"dillo|42848|42851||||42853",
//		"dillo|44248|44249||||44250",
		"f1|42848|42851||||42853",
//		"f1|44251|44252||||44253",
		"borsa|||||42855|"
	);
	
	getBrowser();
	adZone = "altre";
}

//
function getContentUnit(section, num)
{
 	for(i=0; i < contentUnits.length; ++i)
 	{
 		var cuList = contentUnits[i].split("|");
 		
 		if( section.toLowerCase() == cuList[0] )
 			return parseInt(cuList[num]);
  	}
 	
 	return 0;	// to be verified! Section not found...
}

//
function ADConnect(section, size, pos)
{
	var sizeID = "";
	var contentUnit = "";
	var geometry = "";
	var tag = "";
	var num = 0;	// BT-1=1, BT-2=2, HB-1=3, HB-2=4, HB2=5, FB=6

	//
  	switch( size.toLowerCase() )
  	{
  		case "fb":
		  	geometry = "WIDTH=468 HEIGHT=60";
		  	sizeID = "1";
		  	num = 6;
  			break;
  		case "hb":
			geometry = "WIDTH=234 HEIGHT=60";
			sizeID = "4";
			num = parseInt(pos) == 1 ? 3 : 4;
  			break;
  		case "hb2":
			geometry = "WIDTH=234 HEIGHT=30";
			sizeID = "163";
			num = 5;
  			break;
  		case "bt":
			geometry = "WIDTH=120 HEIGHT=60";
			sizeID = "12";
			num = parseInt(pos) == 1 ? 1 : 2;
  			break;
  		default:
 			geometry = "WIDTH=120 HEIGHT=60";
			sizeID = "12";
			num = 1; 			
	}
	
	contentUnit = getContentUnit(section, num);        
        

	var rnum = parseInt((Math.random()*(Date.parse(new Date()))));
	
	var tag = "<script language=javascript src='http://adserver.adtech.de/?addyn|2.0|178|"+ contentUnit +"|1|"+ sizeID +"|cookie=no;misc="+ rnum +";target=_blank;loc=100;'></"+"script>";

	// Only for debug!
	// alert(tag);
	
	//
	document.write(tag);

}
