//defaults value
var DEF_RURL = document.location;
var DEF_ERRURL = document.location;
var DEF_SITECODE = 'CO';
var DEF_SUBSCRIBE_SCRIPT = 'http://du.ilsole24ore.com/DU/iniziaRegistrazione.aspx';
var DEF_LOGIN_SCRIPT = 'http://du.ilsole24ore.com/du/authfiles/logincentrale.aspx';
var DEF_LOGOFF_SCRIPT = 'http://du.ilsole24ore.com/du/authfiles/logoff.aspx';
var DEF_USERPROFILE_SCRIPT = 'http://du.ilsole24ore.com/DU/Areautente/profiloutente.aspx';
var isAuthenticated = false;
var friendlyName = null;
var isPremium = -1;
var PopupAuthenticationTimeout=60000; //milliseconds
var IMG_CANALI = "http://www.services.ilsole24ore.com/testata/img_canali_800/"; 



var bg = new Array();
bg[0] = IMG_CANALI + "nav_top800_1_borsa_on.gif";
bg[1] = IMG_CANALI + "nav_top800_2_esperto_on.gif";
bg[2] = IMG_CANALI + "nav_top800_3_banchedati_on.gif";
bg[3] = IMG_CANALI + "nav_top800_4_mobile_on.gif";
bg[4] = IMG_CANALI + "nav_top800_5_shopping_on.gif";
bg[5] = IMG_CANALI + "nav_top800_6_casa_on.gif";
bg[6] = IMG_CANALI + "nav_top800_7_job.gif";
bg[7] = IMG_CANALI + "nav_top800_8_radio_on.gif";
bg[8] = IMG_CANALI + "nav_top800_9_viaggi_on.gif";
bg[9] = IMG_CANALI + "nav_top800_10_formazione_on.gif";
bg[10] = IMG_CANALI + "nav_top800_11_professionisti_on.gif";
bg[11] = IMG_CANALI + "nav_top800_12_periodici_on.gif";
       
// Modified from Bill Dortch's Cookie Functions (hidaho.com) 
// (found in JavaScript Bible)
function setCookie(name,value,days,path,domain,secure) {
  var expires, date;
  if (typeof days == "number") {
    date = new Date();
    date.setTime( date.getTime() + (days*24*60*60*1000) );
		expires = date.toGMTString();
  }
  document.cookie = name + "=" + escape(value) +
    ((expires) ? "; expires=" + expires : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

// Modified from Jesse Chisholm or Scott Andrew Lepera ?
// (found at both www.dansteinman.com/dynapi/ and www.scottandrew.com/junkyard/js/)
function getCookie(name) {
  var nameq = name + "=";
  var c_ar = document.cookie.split(';');
  for (var i=0; i<c_ar.length; i++) {
    var c = c_ar[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameq) == 0) return unescape( c.substring(nameq.length, c.length) );
  }
  return null;
}

// from Bill Dortch's Cookie Functions (hidaho.com) 
function deleteCookie(name,path,domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

function setCookieRitorno() {
	if (getCookie("URLRIT") == null) {
		setCookie("URLRIT",document.location,180,"/");
	}
	return true;
}

function deleteCookieRitorno() {
	if (getCookie("URLRIT") != null) {
		deleteCookie("URLRIT");
	}
	return true;
}


function draw_testata_old(){
	DataOra = doClock("W0","%20","D1","%20","M0","%20","Y0","%20ore%20","H0","%3A","N0");
	
	document.write("<style>.testata800_data {font-family: Arial, Helvetica, sans-serif;font-size: 10px;color: #7d7d7d;	line-height:10px;}.nebo11 {color: #000000;font-family: arial,Helvetica,sans-serif;");
	document.write("font-size: 11px;font-weight: bold;line-height:12px;}.redbo11 {color: #FF0E0E;font-family: arial,Helvetica,sans-serif;font-size: 11px;font-weight: bold;}.bluaviobo11{ color: #1C6C93;font-family: arial,Helvetica,sans-serif;font-size: 11px;font-weight: bold;}.neno11 {color: #000000;font-family: arial,Helvetica,sans-serif;font-size: 11px;line-height:12px;text-decoration:none;}.grino10{color: #7D7D7D;font-family: arial,Helvetica,sans-serif;font-size: 10px;}.grino11 {color: #7D7D7D;font-family: arial,Helvetica,sans-serif;font-size: 11px;}.premiumtito {font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #FFFFFF;	font-weight: bold;");
	document.write("padding-left:8px;}a.neno11:link; a.neno11:visited; a.neno11:active {color: #000000;font-family: arial,Helvetica,sans-serif;font-size: 11px;line-height:12px;text-decoration:none;}a.neno11:hover {color: #000000;font-family: arial,Helvetica,sans-serif;font-size: 11px;	line-height:12px;text-decoration:underline;}</style>");
	
	
	document.write("<table id='TESTATA' width='768' height='83' border='0' cellpadding='0' cellspacing='0'>");
	document.write("<tr><td bgcolor='#FBE0C3' width='768' height='5'><img src='http://www.ilsole24ore.com/img/pix.gif' width='768' height='5' /></td></tr>");
	document.write("<tr><td bgcolor='#FBE0C3' width='768' height='76' background='http://www.ilsole24ore.com/img/back.gif'>");
	document.write("<table id='RIGA_CAMBIA' width='768' height='76' border='0' cellpadding='0' cellspacing='0'>");
	document.write("<tr>");
	document.write("<td height='51' colspan='2'><a href='http://www.ilsole24ore.com'><img src='http://www.ilsole24ore.com/img/logo24ore_bucato.gif' alt='Il Sole 24 ORE' width='263' height='51' border='0' /></a></td>");
	document.write("<td width='505' height='76' rowspan='3' valign='top'>");
	document.write("<table width='505' height='76' border='0' cellspacing='0' cellpadding='0'>");
	document.write("<tr valign='top'><td align='left' id='PROMO'><!-- inserire box BOX_PROMO --></td>");
	document.write("<td align='right' style='padding-right:6px;' id='registation'><!-- inserire box LOGIN --></td>");
	document.write("</tr>");
	document.write("</table></td></tr>	<tr>");
	document.write("<td width='57' height='15'><img src='http://www.ilsole24ore.com/img/pix.gif' width='57' height='15' /></td>");
	document.write("<td width='206' class='testata800_data' id='data'><!-- Inserire qui la data --></td></tr>");
	document.write("<tr><td height='10' colspan='2'><img src='http://www.ilsole24ore.com/img/pix.gif' width='263' height='10' /></td></tr>");
	document.write("</table>");
	document.write("</td></tr>");
	document.write("<tr><td bgcolor='#FFFFFF' width='768' height='2' id='PULSANTIERA'><img src='http://www.ilsole24ore.com/img/pix.gif' width='768' height='2' /></td></tr>");
	document.write("</table>");
}

function draw_testata(){
	DataOra = doClock("W0","%20","D1","%20","M0","%20","Y0","%20ore%20","H0","%3A","N0");
	
	document.write("<style>.testata800_data {font-family: Arial, Helvetica, sans-serif;font-size: 10px;color: #7d7d7d;line-height:10px;}");
	document.write(".nebo11 {color: #000000;font-family: arial,Helvetica,sans-serif;font-size: 11px;font-weight: bold;line-height:12px;}");
	document.write(".redbo11 {color: #FF0E0E;font-family: arial,Helvetica,sans-serif;font-size: 11px;font-weight: bold;}");
	document.write(".bluaviobo11{color: #1C6C93;font-family: arial,Helvetica,sans-serif;font-size: 11px;font-weight: bold;}");
	document.write(".neno11{color: #000000;font-family: arial,Helvetica,sans-serif;font-size: 11px;line-height:12px;text-decoration:none;}");
	document.write(".grino10{color: #7D7D7D;font-family: arial,Helvetica,sans-serif;font-size: 10px;}");
	document.write(".grino11{color: #7D7D7D;font-family: arial,Helvetica,sans-serif;font-size: 11px;}");
	document.write(".premiumtito{font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #FFFFFF;font-weight: bold;padding-left:8px;}");
	document.write("a.neno11:link; a.neno11:visited; a.neno11:active{color: #000000;font-family: arial,Helvetica,sans-serif;font-size: 11px;line-height:12px;text-decoration:none;}");
	document.write("a.neno11:hover{color: #000000;font-family: arial,Helvetica,sans-serif;font-size: 11px;line-height:12px;text-decoration:underline;}");
	document.write(".testoWhite{font-family: arial,Helvetica,sans-serif;font-size: 13px;color: #FFFFFF;font-weight: normal;	padding: 2px 10px 2px 10px;}");
	document.write(".inputHome{font-size: 12px;width:185px;color:#046C9F;font-weight:normal;padding:1px 5px 1px 5px;}");
	document.write(".boxtestatap_rosso12 {font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #EF290F;}");
  document.write("a.boxtestatap_rosso12:link,  a.boxtestatap_rosso12:visited, a.boxtestatap_rosso12:active {font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #EF290F;text-decoration:none;}");
  document.write("a.boxtestatap_rosso12:hover{font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #EF290F;text-decoration:underline;}</style>");

	document.write("<table id='TESTATA' width='768' height='143' border='0' cellpadding='0' cellspacing='0'>");
	document.write("<tr><td bgcolor='#FBE0C3' width='768' height='5'><img src='http://www.ilsole24ore.com/img/pix.gif' width='768' height='5' /></td></tr>");
	document.write("<tr><td bgcolor='#FBE0C3' width='768' height='76' background='http://www.services.ilsole24ore.com/testata/testata/back2.gif'>");
	document.write("<table id='RIGA_CAMBIA' width='768' height='76' border='0' cellpadding='0' cellspacing='0'>");
	document.write("<tr>");
	document.write('<td><!--tabella con logo e data--><table cellpadding="0" cellspacing="0" border="0" height="105"><tr><td height="12" colspan="2"><img src="http://www.ilsole24ore.com/img/pix.gif" width="263" height="12" /></td></tr><tr><td colspan="2" valign="top" style="padding-left:20px;"><a href="http://www.ilsole24ore.com"><img src="http://www.services.ilsole24ore.com/testata/testata/logo24ore_bucato2.gif" alt="Il Sole 24 ORE" width="235" height="47" border="0" /></a></td></tr><tr><td height="10" colspan="2"><img src="http://www.ilsole24ore.com/img/pix.gif" width="263" height="10" /></td></tr><tr><td width="57" height="15"><img src="http://www.ilsole24ore.com/img/pix.gif" width="57" height="15" /></td><td width="206" class="testata800_data" id="data"></td></tr><tr><td height="10" colspan="2"><img src="http://www.ilsole24ore.com/img/pix.gif" width="263" height="10" /></td></tr></table><!--fine tabella con logo e data--></td>');
	document.write('<td width="505" height="105" valign="top">');
	document.write("<table width='505' height='105' border='0' cellspacing='0' cellpadding='0'>");
	document.write("<tr valign='top'><td align='left' id='PROMO'><!-- inserire box BOX_PROMO --></td>");
	document.write("<td align='right' style='padding-right:6px;' id='registation'><!-- inserire box LOGIN --></td>");
	document.write("</tr>");
	document.write('<tr><td align="right" colspan="2" id="drawSearchBox"></td></tr>');
	document.write("</table></td></tr></table>");
	document.write("</td></tr>");
	document.write('<tr><td bgcolor="#FBE0C3" width="768" height="2"><img src="http://www.ilsole24ore.com/img/pix.gif" width="768" height="2" /></td></tr>');
	document.write("<tr><td bgcolor='#FFFFFF' width='768' height='29' id='PULSANTIERA'></td></tr>");
	document.write("</table>");
}

function draw_data()
{
	var drawdata = document.getElementById("data");
	if (drawdata==null)
		return false;
	drawdata.innerHTML = DataOra;
}

function draw_search_box()
{	
	var drawdata = document.getElementById("drawSearchBox");
	if (drawdata==null)
		return false;

	drawdata.innerHTML = "<form style='margin:0px;' name='ricerca24' action='http://www.ricerca24.ilsole24ore.com/fc' method='get'><table cellpadding='0' cellspacing='0' border='0' height='29' width='505' bgcolor='#ABA49E'><tr><td class='testoWhite'>Cerca</td><td><input name='keyWords' type='text' class='inputHome' style='height:19px;width:200px;'/></td><td class='testoWhite'>in</td><td id='searchList'></td><td style='padding:0 10px 0 10px;'><input type='image' src='http://www.services.ilsole24ore.com/testata/testata/freccia2.gif' border='0' name='vai' alt='' style='height:19px;width:15px;background-color: #ABA49E;'/></td></tr></table><input type='hidden' name='cmd' value='static'/><input type='hidden' name='chId' value='30'/><input type='hidden' name='path' value='/search/search_engine.jsp'/></form>";
}

function draw_searchbox_options(channel)
{
	var drawdata = document.getElementById("searchList");
	if (drawdata==null)
		return false;

	var content='';var tutte='';var info='';var borsa='';var casa='';var radio='';var esperto='';var archivio='';
	var SEL=' selected';

	if(channel == "BO")
		borsa=SEL;
	else if(channel == "ES")
		esperto=SEL;
	else if(channel == "CA")
		casa=SEL;
	else if(channel == "RA")
		radio=SEL;
	else
		tutte=SEL;
	
	content += "<select class='inputHome' name='channelsId'><option value='informazione|borsa|47|33|30|32|43|40|35'" + tutte;
	content += ">Tutte le fonti</option><option value='informazione'" + info;
	content += ">Informazione online</option><option value='borsa'" + borsa;
	content += ">Borsa online</option><option value='47'" + casa;
	content += ">Casa 24</option><option value='40'" + radio;
	content += ">Radio 24</option><option value='33'" + esperto;
	content += ">L\'Esperto risponde</option><option value='30|32|43|35'" + archivio;
	content += ">Contenuti d\'archivio</option></select>";

	drawdata.innerHTML = content;
	return true;
}

function draw_testata_ticker(){
	DataOra = doClock("W0","%20","D1","%20","M0","%20","Y0","%20ore%20","H0","%3A","N0");
	
	document.write("<style>.testata800_data {font-family: Arial, Helvetica, sans-serif;font-size: 10px;color: #7d7d7d;line-height:10px;}");
	document.write(".nebo11 {color: #000000;font-family: arial,Helvetica,sans-serif;font-size: 11px;font-weight: bold;line-height:12px;}");
	document.write(".redbo11 {color: #FF0E0E;font-family: arial,Helvetica,sans-serif;font-size: 11px;font-weight: bold;}");
	document.write(".bluaviobo11{color: #1C6C93;font-family: arial,Helvetica,sans-serif;font-size: 11px;font-weight: bold;}");
	document.write(".neno11{color: #000000;font-family: arial,Helvetica,sans-serif;font-size: 11px;line-height:12px;text-decoration:none;}");
	document.write(".grino10{color: #7D7D7D;font-family: arial,Helvetica,sans-serif;font-size: 10px;}");
	document.write(".grino11{color: #7D7D7D;font-family: arial,Helvetica,sans-serif;font-size: 11px;}");
	document.write(".premiumtito{font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #FFFFFF;font-weight: bold;padding-left:8px;}");
	document.write("a.neno11:link; a.neno11:visited; a.neno11:active{color: #000000;font-family: arial,Helvetica,sans-serif;font-size: 11px;line-height:12px;text-decoration:none;}");
	document.write("a.neno11:hover{color: #000000;font-family: arial,Helvetica,sans-serif;font-size: 11px;line-height:12px;text-decoration:underline;}");
	document.write(".testoWhite{font-family: arial,Helvetica,sans-serif;font-size: 13px;color: #FFFFFF;font-weight: normal;	padding: 2px 10px 2px 10px;}");
	document.write(".inputHome{font-size: 12px;width:185px;color:#046C9F;font-weight:normal;padding:1px 5px 1px 5px;}");
	document.write(".boxtestatap_rosso12 {font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #EF290F;}");
  document.write("a.boxtestatap_rosso12:link,  a.boxtestatap_rosso12:visited, a.boxtestatap_rosso12:active {font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #EF290F;text-decoration:none;}");
  document.write("a.boxtestatap_rosso12:hover{font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #EF290F;text-decoration:underline;}</style>");

	document.write("<table id='TESTATA' width='768' height='114' border='0' cellpadding='0' cellspacing='0'>");
	document.write("<tr><td bgcolor='#FBE0C3' width='768' height='5'><img src='http://www.ilsole24ore.com/img/pix.gif' width='768' height='5' /></td></tr>");
	document.write("<tr><td bgcolor='#FBE0C3' width='768' height='105' background='http://www.services.ilsole24ore.com/testata/testata/back2.gif'>");
	document.write("<table id='RIGA_CAMBIA' width='768' height='105' border='0' cellpadding='0' cellspacing='0'>");
	document.write("<tr>");
	document.write('<td><!--tabella con logo e data--><table cellpadding="0" cellspacing="0" border="0" height="105"><tr><td height="12" colspan="2"><img src="http://www.ilsole24ore.com/img/pix.gif" width="263" height="12" /></td></tr><tr><td colspan="2" valign="top" style="padding-left:20px;"><a href="http://www.ilsole24ore.com"><img src="http://www.services.ilsole24ore.com/testata/testata/logo24ore_bucato2.gif" alt="Il Sole 24 ORE" width="235" height="47" border="0" /></a></td></tr><tr><td height="10" colspan="2"><img src="http://www.ilsole24ore.com/img/pix.gif" width="263" height="10" /></td></tr><tr><td width="57" height="15"><img src="http://www.ilsole24ore.com/img/pix.gif" width="57" height="15" /></td><td width="206" class="testata800_data" id="data"></td></tr><tr><td height="10" colspan="2"><img src="http://www.ilsole24ore.com/img/pix.gif" width="263" height="10" /></td></tr></table><!--fine tabella con logo e data--></td>');
	document.write('<td width="505" height="105" valign="top">');
	document.write("<table width='505' height='105' border='0' cellspacing='0' cellpadding='0'>");
	document.write("<tr valign='top'><td align='left' id='PROMO'><!-- inserire box BOX_PROMO --></td>");
	document.write("<td align='right' style='padding-right:6px;' id='registation'><!-- inserire box LOGIN --></td>");
	document.write("</tr>");
	document.write('<tr><td align="right" colspan="2" id="drawSearchBox"></td></tr>');
	document.write("</table></td></tr></table>");
	document.write("</td></tr>");
	document.write('<tr><td bgcolor="#FBE0C3" width="768" height="2"><img src="http://www.ilsole24ore.com/img/pix.gif" width="768" height="2" /></td></tr>');
	document.write("</table>");
}

function draw_testata_ticker_old(){
	DataOra = doClock("W0","%20","D1","%20","M0","%20","Y0","%20ore%20","H0","%3A","N0");
	
	document.write("<style>.testata800_data {font-family: Arial, Helvetica, sans-serif;font-size: 10px;color: #7d7d7d;	line-height:10px;}.nebo11 {color: #000000;font-family: arial,Helvetica,sans-serif;");
	document.write("font-size: 11px;font-weight: bold;line-height:12px;}.redbo11 {color: #FF0E0E;font-family: arial,Helvetica,sans-serif;font-size: 11px;font-weight: bold;}.bluaviobo11{ color: #1C6C93;font-family: arial,Helvetica,sans-serif;font-size: 11px;font-weight: bold;}.neno11 {color: #000000;font-family: arial,Helvetica,sans-serif;font-size: 11px;line-height:12px;text-decoration:none;}.grino10{color: #7D7D7D;font-family: arial,Helvetica,sans-serif;font-size: 10px;}.grino11 {color: #7D7D7D;font-family: arial,Helvetica,sans-serif;font-size: 11px;}.premiumtito {font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #FFFFFF;	font-weight: bold;");
	document.write("padding-left:8px;}a.neno11:link; a.neno11:visited; a.neno11:active {color: #000000;font-family: arial,Helvetica,sans-serif;font-size: 11px;line-height:12px;text-decoration:none;}a.neno11:hover {color: #000000;font-family: arial,Helvetica,sans-serif;font-size: 11px;	line-height:12px;text-decoration:underline;}");
	document.write(".boxtestatap_rosso12 {font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #EF290F;}");
document.write("a.boxtestatap_rosso12:link,  a.boxtestatap_rosso12:visited, a.boxtestatap_rosso12:active {font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #EF290F;text-decoration:none;}");
document.write("a.boxtestatap_rosso12:hover{font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #EF290F;text-decoration:underline;}</style>");
	
	
	document.write("<table id='TESTATA' width='768' height='83' border='0' cellpadding='0' cellspacing='0'>");
	document.write("<tr><td bgcolor='#FBE0C3' width='768' height='5'><img src='http://www.ilsole24ore.com/img/pix.gif' width='768' height='5' /></td></tr>");
	document.write("<tr><td bgcolor='#FBE0C3' width='768' height='76' background='http://www.ilsole24ore.com/img/back.gif'>");
	document.write("<table id='RIGA_CAMBIA' width='768' height='76' border='0' cellpadding='0' cellspacing='0'>");
	document.write("<tr>");
	document.write("<td height='51' colspan='2'><a href='http://www.ilsole24ore.com'><img src='http://www.ilsole24ore.com/img/logo24ore_bucato.gif' alt='Il Sole 24 ORE' width='263' height='51' border='0' /></a></td>");
	document.write("<td width='505' height='76' rowspan='3' valign='top'>");
	document.write("<table width='505' height='76' border='0' cellspacing='0' cellpadding='0'>");
	document.write("<tr valign='top'><td align='left' id='PROMO'><!-- inserire box BOX_PROMO --></td>");
	document.write("<td align='right' style='padding-right:6px;' id='registation'><!-- inserire box LOGIN --></td>");
	document.write("</tr>");
	document.write("</table></td></tr>	<tr>");
	document.write("<td width='57' height='15'><img src='http://www.ilsole24ore.com/img/pix.gif' width='57' height='15' /></td>");
	document.write("<td width='206' class='testata800_data' id='data'><!-- Inserire qui la data --></td></tr>");
	document.write("<tr><td height='10' colspan='2'><img src='http://www.ilsole24ore.com/img/pix.gif' width='263' height='10' /></td></tr>");
	document.write("</table>");
	document.write("</td></tr>");
	document.write("<tr><td  width='768' height='2' ><img src='http://www.ilsole24ore.com/img/pix.gif' width='768' height='2' /></td></tr>");
	document.write("</table>");
}

	
function drow_pulsantiera(){
	
	
	var content = '';
	var puls = document.getElementById("PULSANTIERA");
	if (puls==null)
		return false;
		
	content += '<table id="BOX_BOTTONI" width="768" height="29" border="0" cellpadding="0" cellspacing="0">';
	content += '<tr><td width="768" height="29">';
	content += '<a href="http://www.24oreborsaonline.ilsole24ore.com/"><img id = "borsa" src="' + IMG_CANALI + 'nav_top800_1_borsa.gif" alt="Borsa Online" border="0" /></a><a href="http://www.espertorisponde.ilsole24ore.com/"><img id = "esperto" src="' + IMG_CANALI + 'nav_top800_2_esperto.gif" alt="Esperto Risponde" border="0" /></a><a href="http://www.banchedati.ilsole24ore.com/"><img id = "banchedati" src="' + IMG_CANALI + 'nav_top800_3_banchedati.gif" alt="Banche Dati" border="0" /></a><a href="http://www.mobile.ilsole24ore.com/"><img id = "mobile" src="' + IMG_CANALI + 'nav_top800_4_mobile.gif" alt="Mobile" border="0" /></a><a href="http://www.shopping24.ilsole24ore.com/"><img id = "shopping" src="' + IMG_CANALI + 'nav_top800_5_shopping.gif" alt="Shopping24" border="0" /></a><a href="http://www.casa24.ilsole24ore.com/"><img id = "casa" src="' + IMG_CANALI + 'nav_top800_6_casa.gif" alt="Casa24" border="0" /></a><a href="http://job24.ilsole24ore.com/"><img id = "job24" src="' + IMG_CANALI + 'nav_top800_7_job.gif" alt="Job24" border="0" /></a><a href="http://www.radio24.ilsole24ore.com/"><img id = "radio" src="' + IMG_CANALI + 'nav_top800_8_radio.gif" alt="Radio24" border="0" /></a><a href="http://www.viaggi24.ilsole24ore.com/"><img id = "viaggi" src="' + IMG_CANALI + 'nav_top800_9_viaggi.gif" alt="Viaggi24" border="0" /></a><a href="http://www.formazione.ilsole24ore.com/"><img id = "formazione" src="' + IMG_CANALI + 'nav_top800_10_formazione.gif" alt="Formazione" border="0" /></a><a href="http://www.professionisti24.ilsole24ore.com/"><img id = "professionisti" src="' + IMG_CANALI + 'nav_top800_11_professionisti.gif" alt="Professionisti e P.A." border="0" /></a><a href="http://redir.ilsole24ore.com/redir.asp?id=10"><img id = "periodici" src="' + IMG_CANALI + 'nav_top800_12_periodici.gif" alt="Periodici" border="0" /></a>';
	content += '</td></tr>';
	content += '</table>';
	
	puls.innerHTML = content;
	 
	return true;
	
	}
	
function drow_pulsantiera_ticker(){
	
	document.write("<table border='0' cellpadding='0' cellspacing='0' ><tr><td bgcolor='#FFFFFF' width='768' height='2' id='PULSANTIERA'><img src='http://www.ilsole24ore.com/img/pix.gif' width='768' height='2' /></td></tr></table>");
	
	drow_pulsantiera();
	}	
	
function authenticated_user(){
	var content = '';
	var loginForm = document.getElementById("registation");
	if (loginForm==null)
		return false;
	
	content += '<table id="LOGIN" width="185" height="71" border="0" cellpadding="0" cellspacing="0">';
	content += '<tr><td rowspan="4" bgcolor="#0298d3"> <img src="http://www.ilsole24ore.com/img/pix.gif" width="10" height="20" alt="" /></td>';
	content += '<td rowspan="4"> <img src="http://www.ilsole24ore.com/img/pix.gif" width="2" height="20" alt="" /></td>';
	content += '<td height="17" colspan="4" align="right" background="http://www.ilsole24ore.com/img/box_testata_prem_05.gif"><A  id="lnkLogoff" href="" border="0"><img src="http://www.ilsole24ore.com/img/esci2.gif" alt="Esci" width="42" height="17" border="0" /></a></td>';
	content += '</tr>';
	content += '<tr><td colspan="4" align="left"><img src="http://www.ilsole24ore.com/img/pix.gif" width="50" height="1" alt="" /></td></tr>';
	content += '<tr><td rowspan="2"> <img src="http://www.ilsole24ore.com/img/pix.gif" width="6" height="20" alt="" /></td>';
	content += '<td width="175" colspan="3" align="left" class="nebo11"><span class="bluaviobo11">Benvenuto</span><br /><SPAN id="spnFriendlyName" ></SPAN></td></tr>';
	content += '<tr>';
	content += '<td width="69" height="27" align="left" valign="top" class="nebo11"><span class="bluaviobo11">Profilo:</span><br />Registrato</td>';
	content += '<td align="center" valign="top" background="http://www.ilsole24ore.com/img/box_testata_prem_09.gif" width="1"><img src="http://www.ilsole24ore.com/img/pix.gif" width="1" height="100%" alt="" /> </td>';
	content += '<td width="100" height="27" align="left" valign="middle" class="neno11"><A  id="lnkUserProfile" href=""><img src="http://www.ilsole24ore.com/img/frecciatestata2.gif" width="22" height="10" border="0" align="absmiddle" />Il tuo profilo</a> <br />';
	content += '<a href="http://serviziattivi.ilsole24ore.com" class="neno11"><img src="http://www.ilsole24ore.com/img/frecciatestata2.gif" width="22" height="10" border="0" align="absmiddle" />Servizi Attivi</a></td>';
	content += '</tr></table>';
	
	loginForm.innerHTML = content;
	
	return true;
	}	



function drow_promo_premium(){
	var content = '';
	var promo = document.getElementById("PROMO");
	if (promo==null)
		return false;
		
	content += '<table id="BOX_PROMO" width="300" height="70" border="0" cellpadding="0" cellspacing="0">';
	content += '<tr bgcolor="#EA2C1C"><td colspan="4">';
	content += '<table width="100%"  border="0" cellspacing="0" cellpadding="0"><tr><td align="left"><span class="premiumtito">Accedi ai servizi in abbonamento </span></td><td align="right">&nbsp;</td></tr></table>';
	content += '</td></tr>';
	content += '<tr><td colspan="4"> <img src="http://www.ilsole24ore.com/img/pix.gif" width="301" height="3" /></td></tr>';
	content += '<tr><td> <img src="http://www.ilsole24ore.com/img/prembox_07.gif" width="21" height="15" /></td>';
	content += '<td width="138" height="12" align="left" class="neno11"><a href="http://www.ilsole24ore.com/" class="neno11">Articoli esclusivi</a></td>';
	content += '<td> <img src="http://www.ilsole24ore.com/img/prembox_09.gif" width="16" height="15" /></td>';
	content += '<td width="138" height="12" align="left" class="neno11"><a href="http://www.ilsole24ore.com/fc?cmd=art&codid=22.0.1272368697" class="neno11">Speciali e dossier</a></td>';
	content += '</tr>';
	content += '<tr>';
	content += '<td> <img src="http://www.ilsole24ore.com/img/prembox_07.gif" width="21" height="15" /></td>';
	content += '<td width="138" height="12" align="left" class="neno11"><a href="http://www.banchedati.ilsole24ore.com/enter.do?product=BIG" class="neno11">Archivio del Sole24ORE</a></td>';
	content += '<td> <img src="http://www.ilsole24ore.com/img/prembox_09.gif" width="16" height="15" /></td>';
	content += '<td width="138" height="12" align="left" class="neno11"><a href="http://www.espertorisponde.ilsole24ore.com/fc?cmd=art&codid=20.0.792552346" class="neno11">Quesiti Esperto Risponde</a></td>';
	content += '</tr>';
	content += '<tr>';
	content += '<td> <img src="http://www.ilsole24ore.com/img/prembox_07.gif" width="21" height="15" /></td>';
	content += '<td width="138" height="12" align="left" class="neno11"><a href="http://www.24oreborsaonline.ilsole24ore.com/" class="neno11">Quotazioni e News</a></td>';
	content += '<td> <img src="http://www.ilsole24ore.com/img/prembox_09.gif" width="16" height="15" /></td>';
	content += '<td width="138" height="12" align="left" class="neno11"><a href="http://premium.ilsole24ore.com/fc?cmd=sez&chId=49&sezId=10680" class="neno11">Offerte su Shopping24!</a> </td>';
	content += '</tr>';
	content += '<tr>';
	content += '<td colspan="4" width="301" height="2"> <img src="http://www.ilsole24ore.com/img/pix.gif" width="301" height="5" /></td></tr></table>';
	
	promo.innerHTML = content;
	 
	return true;
	}

function drow_promo(){
	
	var content = '';
	var promo = document.getElementById("PROMO");
	if (promo==null)
		return false;
	
	/*content += '<table id="BOX_PROMO" width="300" height="71" border="0" cellpadding="0" cellspacing="0">';
	content += '<tr><td><a href="http://premium.ilsole24ore.com" alt=""><img src="http://www.ilsole24ore.com/img/box_premium_01.gif" width="300" height="17" border="0"/></a></td></tr>';
	content += '<tr><td><img src="http://www.ilsole24ore.com/img/box_premium_02.gif" width="300" height="53" border="0" usemap="#MapMapMap" /></td></tr>';
	content += '<tr><td bgcolor="#EC2021" width="300" height="1"> <img src="http://www.ilsole24ore.com/img/pix.gif" width="300" height="1" /></td></tr>';
	content += '</table>';
	content += '<map name="MapMapMap" id="Map22">';
	content += '<area shape="rect" coords="180,5,297,27" href="http://premium.ilsole24ore.com/fc?cmd=sez&chId=49&sezId=10610" alt="Prova Gratuita" />';
	content += '<area shape="rect" coords="180,29,297,48" href="http://premium.ilsole24ore.com/fc?cmd=sez&chId=49&sezId=10601" alt="Attiva Online" />';
	content += '</map>';*/
     
  
	content += '<table width="301" height="71" border="0" cellpadding="0" cellspacing="0" bgcolor="#ee3928" id="BOX_TESTATA_BASSA">';
	content += '<tr><td colspan="4"><a href="http://premium.ilsole24ore.com/"><img src="http://www.ilsole24ore.com/img/box_testata_800_1.gif" border="0" width="301" height="19" alt="emium24 Il sole 24 ORE" /></a></td></tr>';
	content += '<tr><td width="2"><img src="http://www.ilsole24ore.com/img/pix.gif" width="2" height="49" alt="" /></td><td width="118" bgcolor="#FFFFFF">';
	
	content += '<table id="INTERNA" width="109" height="41" border="0" cellpadding="0" cellspacing="0"><tr><td><img src="http://www.ilsole24ore.com/img/box_testata_bassa_int_01.gif" width="109" height="1" alt="" /></td></tr>';
	content += '<tr><td height="19" align="right" nowrap="nowrap" class="boxtestatap_rosso12"><a href="http://www.shopping24.ilsole24ore.com/sh3/catalog/ProductI.jsp?PRODID=PREM02" class="boxtestatap_rosso12">Abbonati subito</a><img src="http://www.ilsole24ore.com/img/box_testata_bassa_freccia.gif" alt="-" width="18" height="9" align="absmiddle" /></td></tr>';
	
	content += '<tr><td><img src="http://www.ilsole24ore.com/img/box_testata_bassa_int_01.gif" width="109" height="1" alt="" /></td></tr>';
	
	content += '<tr><td height="19" align="right" nowrap="nowrap" class="boxtestatap_rosso12"><a href="http://premium.ilsole24ore.com/fc?cmd=sez&chId=49&sezId=10670" class="boxtestatap_rosso12">Scopri il servizio</a><img src="http://www.ilsole24ore.com/img/box_testata_bassa_freccia.gif" alt="-" width="18" height="9" align="absmiddle" /></td></tr>';
	
	content += '<tr><td><img src="http://www.ilsole24ore.com/img/box_testata_bassa_int_01.gif" width="109" height="1" alt="" /></td></tr></table></td>';
	content += '<td><a href="http://premium.ilsole24ore.com/fc?cmd=sez&chId=49&sezId=11653"><img src="http://www.ilsole24ore.com/img/box_testata_800.gif" alt="Novit&agrave;! Ora anche in versione Finanza" width="178" height="49" border="0" /></a></td>';
	content += '<td width="3"><img src="http://www.ilsole24ore.com/img/box_testata_bassa_05.gif" width="3" height="49" alt="" /></td></tr>';
	content += '<tr><td colspan="4"><img src="http://www.ilsole24ore.com/img/box_testata_bassa_06.gif" width="301" height="3" alt="" /></td></tr></table>';

	
	promo.innerHTML = content;
	 
	return true;
	}





function authenticated_user_premium(){
	
	var content = '';
	var loginForm = document.getElementById("registation");
	if (loginForm==null)
		return false;
	
	content += '<table id="LOGIN" width="185" height="71" border="0" cellpadding="0" cellspacing="0">';
	content += '<tr><td width="10" rowspan="4" bgcolor="#EA2C1C"> <img src="http://www.ilsole24ore.com/img/pix.gif" width="10" height="20" alt="" /></td>';
	content += '<td width="2" rowspan="4"> <img src="http://www.ilsole24ore.com/img/pix.gif" width="2" height="20" alt="" /></td>';
	content += '<td colspan="4" background="http://www.ilsole24ore.com/img/box_testata_prem_03.gif" height="17" align="right"><A  id="lnkLogoff" href="" border="0"><img src="http://www.ilsole24ore.com/img/esci.gif" alt="Esci" width="42" height="17" border="0" /></a></td>';
	content += '</tr>';
	content += '<tr><td colspan="4" align="left"> <img src="http://www.ilsole24ore.com/img/pix.gif" width="50" height="1" alt="" /></td></tr>';
	content += '<tr><td width="6" rowspan="2"> <img src="http://www.ilsole24ore.com/img/pix.gif" width="6" height="20" alt="" /></td>';
	content += '<td colspan="3" align="left" class="nebo11"><span class="redbo11">Benvenuto</span><br /><SPAN id="spnFriendlyName" ></SPAN></td></tr>';
	content += '<tr><td width="69" height="27" align="left" valign="top" class="nebo11"><span class="redbo11">Profilo:</span><br />Premium</td>';
	content += '<td align="center" valign="top" background="http://www.ilsole24ore.com/img/box_testata_prem_09.gif" width="1"><img src="http://www.ilsole24ore.com/img/pix.gif" width="1" height="100%" alt="" /> </td>';
	content += '<td width="100" height="27" align="left" valign="middle" class="neno11"><A  id="lnkUserProfile" href=""><img src="http://www.ilsole24ore.com/img/frecciatestata.gif" width="22" height="10" border="0" align="absmiddle" />Il tuo profilo</a> <br />';
	content += '<a href="http://serviziattivi.ilsole24ore.com" class="neno11"><img src="http://www.ilsole24ore.com/img/frecciatestata.gif" width="22" height="10" border="0" align="absmiddle" />Servizi Attivi</a></td>';
	content += '</tr></table>';
	
	loginForm.innerHTML = content;
	
	return true;
	
	}

function auth_form(){
	
	var browserName=navigator.appName;
	

	
		
	var content = '';
	var loginForm = document.getElementById("registation");
	if (loginForm==null)
		return false;
		
	if (browserName=="Netscape"){
		content += '<FORM action="" method="post" name="authUser" onsubmit="setCookieRitorno()">';
		content += '<INPUT value="" name="URL" type="hidden"/>';
		content += '<INPUT value="BYPOST" name="realSubmit" type="hidden"/>';
		content += '<INPUT type="hidden" name="RURL" value=""/>';
		content += '<INPUT type="hidden" name="ERRURL" value=""/>';
		content += '<INPUT type="hidden" name="SC" value=""/>';
		
		}
	
		
	content += '<table id="LOGIN" width="185" height="66" border="0" cellpadding="0" cellspacing="0"> ';
	 if (browserName=="Microsoft Internet Explorer")
	 {
	 
	content += '<FORM action="" method="post" name="authUser" onsubmit="setCookieRitorno()">';
	content += '<INPUT value="" name="URL" type="hidden"/>';
	content += '<INPUT value="BYPOST" name="realSubmit" type="hidden"/>';
	content += '<INPUT type="hidden" name="RURL" value=""/>';
	content += '<INPUT type="hidden" name="ERRURL" value=""/>';
	content += '<INPUT type="hidden" name="SC" value=""/>';
	}
	content += '<tr><td height="12" align="left" class="grino11"><strong>Username</strong></td> ';
	content += '<td align="center"></td><td align="left"></td></tr> ';
	content += '<tr><td align="left"><input type="text" name="txtUsername" class="grino10" style="width:70px;" value="" tabindex="1"/></td> ';
	content += '<td align="center"></td><td align="left"><a  target="_top" class="login" id="lnkSubscribe" href=""><img src="http://www.ilsole24ore.com/img/tit_registrati2.gif" width="61" height="21" border="0" alt="" align="middle" /></a></td> ';
	content += '</tr> ';
	content += '<tr><td height="12" align="left" class="grino11"><strong>Password</strong></td> ';
	content += '<td align="center"></td><td align="left"></td></tr> ';
	content += '<tr><td align="left"><input type="password" name="txtPassword" class="grino10" style="width:70px;" value="" tabindex="2"/></td> ';
	content += '<td align="left" width="21" height="21"><input type="image" src="http://www.ilsole24ore.com/img/arr_top_n2.gif" alt="" width="21" height="21" hspace="0" border="0" align="absmiddle" style="width:21px;height:21px;background-color: #FBE0C3;" tabindex="3"/></td> ';
	content += '<td align="left"><a  target="_top" class="login" href="http:\/\/redir.ilsole24ore.com\/redir.asp?id=11"><img src="http://www.ilsole24ore.com/img/tit_vantaggi2.gif" width="61" height="21" border="0" alt="" align="middle" /></a></td> ';
	
	if (browserName=="Netscape"){
	content += '</tr></table> ';
	content += '</FORM>';
	
	}
	 if ((navigator.appVersion.indexOf("MSIE 5")!=-1) && (browserName=="Microsoft Internet Explorer"))
	 {
	 content += '</tr> ';
	content += '</FORM></table>';
	}
	loginForm.innerHTML = content;
	  return true;
	
	}
	
	

function disegna_testata(){
	if (this.ShowSearchForm)
	{
		draw_testata();
		draw_search_box();
		draw_searchbox_options(this.Canale);
	}
	else
		draw_testata_old();

	draw_data();
	
	if (this.Pulsantiera)drow_pulsantiera();
	
	if (this.Promo)  drow_promo();
	

	if (isPremium == "1"){
		
		if (isAuthenticated && this.ShowWellcomeMessage){
			if( authenticated_user_premium()){
				document.getElementById("spnFriendlyName").innerHTML = friendlyName.length<=20?friendlyName:friendlyName.substring(0,17) + "...";
				document.getElementById("lnkLogoff").href = this.LogoutUrl + "?RURL=" + escape(this.LoginRURL);
				document.getElementById("lnkUserProfile").href = this.UserProfileUrl + "?SiteCode=" + this.SiteCode + "&RURL=" + escape(this.LoginRURL);
			}
		}
		drow_promo_premium();
	}else{
	
		if (isAuthenticated && this.ShowWellcomeMessage){
			if( authenticated_user()){
				document.getElementById("spnFriendlyName").innerHTML = friendlyName.length<=20?friendlyName:friendlyName.substring(0,17) + "...";
				document.getElementById("lnkLogoff").href = this.LogoutUrl + "?RURL=" + escape(this.LoginRURL);
				document.getElementById("lnkUserProfile").href = this.UserProfileUrl + "?SiteCode=" + this.SiteCode + "&RURL=" + escape(this.LoginRURL);
			}
		}
		
		
	}
	
	if (!isAuthenticated && this.ShowLoginForm){
		if (auth_form())
		{		
			var f = document.forms["authUser"];
			if (getCookie("URLRIT") != null) {	
			        if (document.location.href.indexOf("index") < 0) 
			        	f.elements["RURL"].value = getCookie("URLRIT");
			        else
			        	f.elements["RURL"].value = this.LoginRURL;       	
			        }
			else
				f.elements["RURL"].value = this.LoginRURL;       
			f.elements["ERRURL"].value = this.ERRURL;
			f.elements["SC"].value = this.SiteCode;
			f.action = this.LoginUrl;
			
			document.getElementById("lnkSubscribe").href = this.SubscribeUrl + "?SiteCode=" + this.SiteCode + "&RURL=" + escape(this.SubscribeRURL) + "&ERRURL=" + escape(this.ERRURL);
			
			if (this.CheckIfAuthenticated && f!=undefined)
				setTimeout(CheckPopupAuthentication,PopupAuthenticationTimeout);
		}
		
	}
	
	
		
	if(this.Canale != null || this.Canale != "")
		changebackground(this.Canale);
		
}


function disegna_testata_ticker(){
	if (this.ShowSearchForm)
	{
		draw_testata_ticker();
		draw_search_box();
		draw_searchbox_options(this.Canale);
	}
	else
		draw_testata_ticker_old();

	draw_data();
}	

function disegna_pulsantiera_ticker(){
	
	if (this.Pulsantiera)drow_pulsantiera_ticker();
	if (this.Promo)  drow_promo();
	
	if (isPremium == "1"){
		
		if (isAuthenticated && this.ShowWellcomeMessage){
			if( authenticated_user_premium()){
				document.getElementById("spnFriendlyName").innerHTML = friendlyName.length<=20?friendlyName:friendlyName.substring(0,17) + "...";
				document.getElementById("lnkLogoff").href = this.LogoutUrl + "?RURL=" + escape(this.LoginRURL);
				document.getElementById("lnkUserProfile").href = this.UserProfileUrl + "?SiteCode=" + this.SiteCode + "&RURL=" + escape(this.LoginRURL);
			}
		}
		drow_promo_premium();
	}else{
	
		if (isAuthenticated && this.ShowWellcomeMessage){
			if(authenticated_user()){
				document.getElementById("spnFriendlyName").innerHTML = friendlyName.length<=20?friendlyName:friendlyName.substring(0,17) + "...";
				document.getElementById("lnkLogoff").href = this.LogoutUrl + "?RURL=" + escape(this.LoginRURL);
				document.getElementById("lnkUserProfile").href = this.UserProfileUrl + "?SiteCode=" + this.SiteCode + "&RURL=" + escape(this.LoginRURL);
			}
		}
		
		
	}
	
	if (!isAuthenticated && this.ShowLoginForm){
		if (auth_form())
		{		
			var f = document.forms["authUser"];
			if (getCookie("URLRIT") != null) {	
			        if (document.location.href.indexOf("index") < 0) 
			        	f.elements["RURL"].value = getCookie("URLRIT");
			        else
			        	f.elements["RURL"].value = this.LoginRURL;       	
			        }
			else
				f.elements["RURL"].value = this.LoginRURL;       
			f.elements["ERRURL"].value = this.ERRURL;
			f.elements["SC"].value = this.SiteCode;
			f.action = this.LoginUrl;
			
			document.getElementById("lnkSubscribe").href = this.SubscribeUrl + "?SiteCode=" + this.SiteCode + "&RURL=" + escape(this.SubscribeRURL) + "&ERRURL=" + escape(this.ERRURL);
			
			if (this.CheckIfAuthenticated && f!=undefined)
				setTimeout(CheckPopupAuthentication,PopupAuthenticationTimeout);
		}
		
	}
	
	
	if(this.Canale != null || this.Canale != "")
		changebackground(this.Canale);
	
	}
	
function changebackground(channelDescription){
	

	
	if(channelDescription == "BO")
		document.getElementById("borsa").src =  bg[0] ;
	if(channelDescription == "ES")
		document.getElementById("esperto").src =  bg[1] ;
	if(channelDescription == "BD")
		document.getElementById("banchedati").src = bg[2] ;
	if(channelDescription == "MB")
		document.getElementById("mobile").src = bg[3] ;
	if(channelDescription == "SH")
		document.getElementById("shopping").src = bg[4];
	if(channelDescription == "CA")
		document.getElementById("casa").src = bg[5] ;
	if(channelDescription == "JO")
		document.getElementById("job24").src =  bg[6] ;	
	if(channelDescription == "RA")
		document.getElementById("radio").src =  bg[7];
	if(channelDescription == "VI")
		document.getElementById("viaggi").src =  bg[8] ;
	if(channelDescription == "FO")
		document.getElementById("formazione").src =  bg[9] ;
	if(channelDescription == "PF")
		document.getElementById("professionisti").src = bg[10];
	if(channelDescription == "PR")
		document.getElementById("periodici").src = bg[11] ;
	
	//alert(document.getElementById("esperto").style.background)
	
	}




//Object __PageHeader definition
function __PageHeader(){
	this.ShowLoginForm = false;			//Mostra il form per il login
	this.ShowWellcomeMessage = true;	//Mostra il saluto con il nome utente
	this.ShowSearchForm = true;			//Mostra la maschera di ricerca
	
	this.LoginRURL = DEF_RURL;			//pagina di ritorno dal login
	this.ERRURL = DEF_ERRURL;			//ERRURL per form di login e registrazione
	this.SiteCode = DEF_SITECODE;
	this.LoginUrl = DEF_LOGIN_SCRIPT;	//action del form di login
	this.SubscribeUrl = DEF_SUBSCRIBE_SCRIPT;	//url di avvio registrazione
	this.SubscribeRURL = DEF_RURL;				//url di ritorno dalla registrazione (es. secondo livello)
	this.LogoutUrl = DEF_LOGOFF_SCRIPT;			//url di ritorno dal logout
	this.UserProfileUrl = DEF_USERPROFILE_SCRIPT;	//url del link il mio profilo
	this.Channel = null;	         //canale da "accendere" nella pulsantiera
	this.CheckIfAuthenticated = false;		//flag per l'avvio del timer per il controllo se autenticato
	this.Pulsantiera = false;
	this.Promo = false;
	this.PromoPremium = false;
	this.DrawHeader = disegna_testata;
	this.DrawHeaderEasy = disegna_testata;
	this.DrawHeaderBassa1= disegna_testata_ticker;
	this.DrawPulsantieraBassa2= disegna_pulsantiera_ticker;
	
	this.listaCanali = false;

	this.TestataBassa = true;
	this.Sfumata = true;
	this.Pulsantieraeasy = false;
	
	GetUserStatus();
}


function draw_piede_websystem(homepage){
	document.write("<table width='768' border='0' cellspacing='0' cellpadding='0'>");
	document.write("<tr><td colspan='2'><img src='http:\/\/www.ilsole24ore.com\/img\/pix.gif' width='1' height='2' alt='' border='0'></td></tr>");
	document.write("<tr>");
	document.write("<td class='copy' align='center' bgColor='#ffedcc' height='20' colspan='2'>&nbsp;<b>IL SOLE 24 ORE - &copy; Tutti i diritti riservati</b></td>");
	document.write("</tr>");
	document.write("<tr>");
	document.write("<td height='20' width='50%' class='txtpiede'><a href='#' onClick='setHomePage(\"" + homepage + "\")' class='txtpiede'>Fai di questa pagina la tua homepage</a></td>");
	document.write("<td height='20' class ='txtpiede' align='right' style='padding-right:3px;'><a href='http://websystem.ilsole24ore.com' target='_blank' class='linkpiede'>Per la pubblicità su questo sito </a>");
	document.write("</td></tr></table>");
}


function draw_space(){
	document.write("<TABLE WIDTH='768' BORDER='0' CELLSPACING='0' CELLPADDING='0'>");
	document.write("<TR><TD><img src='http:\/\/www.ilsole24ore.com\/img\/pix.gif' width='1' height='20' alt='' border='0'></TD></TR>");
	document.write("</TABLE>");
	}

function draw_servizi(){
	document.write("<TABLE WIDTH='768' BORDER='0' CELLSPACING='0' CELLPADDING='0'>");
	//document.write("<TR><TD><img src='http:\/\/www.ilsole24ore.com\/img\/pix.gif' width='1' height='20' alt='' border='0'></TD></TR>");
	document.write("<TR><TD colspan=5 bgColor='#ffedcc'><img src='http:\/\/www.ilsole24ore.com\/img\/pix.gif' width='1' height='5' alt='' border='0'></TD></TR><TR>");
	document.write("<TD align=center><a class='menudx' href='http://redir.ilsole24ore.com/redir.asp?id=7'>Chi Siamo</a></TD>");
	document.write("<TD align=center><a class='menudx' href='http://redir.ilsole24ore.com/redir.asp?id=8'>Area abbonati</a></TD>");
	document.write("<TD align=center><a class='menudx' href='http://newsletters.ilsole24ore.com'>Newsletter</a></TD>");
	document.write("<TD align=center><a class='menudx' href='http://redir.ilsole24ore.com/redir.asp?id=6'>Contattaci</a></TD>");
	document.write("<TD align=center><a class='menudx' href='http://redir.ilsole24ore.com/redir.asp?id=5'>Tutti i servizi</a></TD>");
	document.write("</TR></TABLE>");
}
//disegna il piede
function disegna_piede(){
	/*
	esempio di utilizzo
	
	var piede = new __PageFooter();
	piede.HomePage =location.pathname;
	piede.tipoPiedeNew = true;
	piede.DrawFooter();
	*/
	/*if(this.Servizi){
		draw_space();
		draw_servizi();
	}
	else {
		draw_space();
	}
	
	draw_piede_websystem(this.HomePage);*/
	
	document.write("<style type='text/css'><!-- A.foot:visited  { text-decoration: none} A.foot:link  { text-decoration: none} A.foot:active  {text-decoration: none} A.foot:hover   {  text-decoration: none} //--> </style> ");
	
	if ((navigator.userAgent.indexOf("Firefox")!=-1))
	 {
	    document.write("<style>#footer800 {font-family: Arial, Helvetica, sans-serif;float:left;margin-top: 10px;margin-bottom: 5px;margin-right: auto;margin-left: 0px;text-align: left;padding-left: 10px;padding-right: 10px;padding-top: 4px;width: 748px;height: 20px;background-image: url(http://www.ilsole24ore.com/img/bg_footer.jpg);color:#ffffff;font-size:11px;}</style>");
	 }
	else {
	    document.write("<style>#footer800 {font-family: Arial, Helvetica, sans-serif;float:left;margin-top: 10px;margin-bottom: 5px;margin-right: auto;margin-left: 0px;text-align: left;padding-left: 10px;padding-right: 10px;padding-top: 4px;width: 768px;height: 20px;background-image: url(http://www.ilsole24ore.com/img/bg_footer.jpg);color:#ffffff;font-size:11px;}</style>");	
	  }
	document.write("<div id='footer800'>");
	if(this.Servizi){
		document.write("<div style='width:65%; text-align:left;float:left;'><a class='foot' href='http:\/\/www.ilsole24ore.com\/fc?cmd=sez&chId=30&sezId=10907'><font face='Arial, Helvetica, sans-serif' color='#ffffff'>Chi siamo</font></a> | <a class='foot' href='http:\/\/newsletters.ilsole24ore.com\/'><font face='Arial, Helvetica, sans-serif' color='#ffffff'>Newsletter</font></a> | <a class='foot' href='http:\/\/www.ilsole24ore.com\/fc?cmd=sez&sezId=11039&chId=30&back=0'><font face='Arial, Helvetica, sans-serif' color='#ffffff'>Contattaci</font></a> | <a class='foot' href='http:\/\/www.ilsole24ore.com\/fc?cmd=sez&sezId=9202&chId=30&back=0'><font face='Arial, Helvetica, sans-serif' color='#ffffff'>Tutti i servizi</font></a> | <a class='foot' href='http:\/\/www.ilsole24ore.com\/fc?cmd=sez&chId=30&sezId=11043'><font face='Arial, Helvetica, sans-serif' color='#ffffff'>Redazione Online</font></a> | <a class='foot' href='http:\/\/annunci.ilsole24ore.com\/'><font face='Arial, Helvetica, sans-serif' color='#ffffff'>Annunci economici</font></a> | <a class='foot' href='http:\/\/www.ricerca24.ilsole24ore.com\/indiceAlfab\/a\/a-index.html'><font face='Arial, Helvetica, sans-serif' color='#ffffff'>A-Z</font></a></div>");
		document.write("<div style='width:35%; text-align:right;float:left;'>&copy; Copyright Il Sole 24 Ore - Tutti i diritti sono riservati</div>");
	}
	else {
		document.write("<div style='width:40%; text-align:right;float:right;'>&copy; Copyright Il Sole 24 Ore - Tutti i diritti sono riservati</div>");
	}
	document.write("</div>");


	document.write("<div style='font-family: Arial, Helvetica, sans-serif; font-size: 11px; color: #004B80;  width: 768px; text-align:left; float:left;  margin: 0px;'>");
		
	document.write("<div style='width:50%; text-align:left;float:left; padding-left: 10px;'>");
  
  document.write("<style type='text/css'><!-- a.hp_wrap:visited  {color: #004B80; text-decoration: none} a.hp_wrap:link  {color: #004B80; text-decoration: none} a.hp_wrap:active  {color: #004B80; text-decoration: none} a.hp_wrap:hover { color: #004B80; text-decoration: underline} //--> </style> ");
	document.write("<a class='hp_wrap' href='#' onClick='setHomePage(location.href)'><font face='Arial, Helvetica, sans-serif' color='#004B80'>Fai di questa pagina la tua homepage</font></a></div>");
	
	
	if ((navigator.userAgent.indexOf("Firefox")!=-1))
	 {
	    document.write("<div style='width:50%; text-align:right;float:right; padding-right: 10px;margin-top: -13px;margin-bottom: 10px;'>");
	 }
	else {
	    document.write("<div style='width:50%; text-align:right;float:right; padding-right: 10px;'>");
	  }	
	
	document.write("P.I.00777910159</div>");
	
	document.write("</div>");
}

//Object __PageFooter  definition
function __PageFooter(){
	this.HomePage=null;
	this.Servizi=false;
	this.DrawFooter= disegna_piede;
	}

/*
Recupera le informazioni dell'utente stabilendo se si tratta di una connessione anonima o no
*/
function GetUserStatus(){
	var allCookies = document.cookie;	//all cookies
	var soleAuthStart = allCookies.indexOf("SoleAuth");
	
	if (soleAuthStart>=0){
		var soleAuth = allCookies.substring(soleAuthStart,allCookies.indexOf(";", soleAuthStart));
		if (soleAuth!="SoleAuth=") {
			isAuthenticated = true;
			SetFriendlyName();	
		}
	}
}

function SetFriendlyName(){
	var allCookies = document.cookie;	//all cookies
	var soleUserStart = allCookies.indexOf("SoleUser="); //Start of SoleUser
	 var ispremiumIdx;
	
	if (soleUserStart>0){	//SoleUser present
		var soleUser;	
		if (allCookies.indexOf(";", soleUserStart)>=0)
			soleUser = allCookies.substring(soleUserStart,allCookies.indexOf(";",soleUserStart)); //SoleUser content
		else
			soleUser = allCookies.substring(soleUserStart);
		
		var aSoleUser = soleUser.substring(soleUser.indexOf("=")+1).split(','); 
		
		for (i=0; i<aSoleUser.length; i++)
		{
			if (aSoleUser[i].toLowerCase().indexOf('friendlyname=')>=0){
				isAuthenticated = true;
				ispremiumIdx = aSoleUser[i].toLowerCase().indexOf('&ispremium=');
		    if (ispremiumIdx == -1)
		        ispremiumIdx = aSoleUser[i].length;
		    else 
		    	isPremium = aSoleUser[i].substring(ispremiumIdx+11);    
				friendlyName = aSoleUser[i].substring(aSoleUser[i].indexOf('=')+1,ispremiumIdx);
				break;
			}
		}
	}	
	else{
		isAuthenticated = false;
		friendlyName = null;
		isPremium = -1;
	}
		
}

//Controllo periodico se autenticato
function CheckPopupAuthentication(){
	var allCookies = document.cookie;	//all cookies
	var soleAuthStart = allCookies.indexOf("SoleAuth="); //Start of SoleAuth
	
	if (soleAuthStart>0){	//SoleAuth present
		var soleAuth = allCookies.substring(soleAuthStart,allCookies.indexOf(";",soleAuthStart));
		
		var aSoleAuth = soleAuth.split('=')
		if (aSoleAuth[1].length>0){	//SoleAuth valid
			document.location.reload();
			return;
		}
	}
	
	// riattivo il check		
	setTimeout(CheckPopupAuthentication,PopupAuthenticationTimeout);	
}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           