function addFlash (altezza,larghezza,path,transparent) {
	var my_var = '<object type="application/x-shockwave-flash" data="' + path + '" width="' + larghezza + '" height="' + altezza + '">';
	my_var += '<param name="movie" value="' + path + '" />';
	my_var += '<param name="quality" value="high" />';
	my_var += '<param name="wmode" value="transparent" />';
	// Se transparent = true
	if(transparent==true){
		my_var += '<param name="wmode" value="transparent" />';
	}
	my_var += '</object>';
	document.write(my_var);
}
function drawFlash(swfpath,largh,alt,bgcol,swfid)
{
	if (enableFlash)
	{
		var flashversion = deconcept.SWFObjectUtil.getPlayerVersion();
		if (document.getElementById && flashversion["major"] < 8) {
			document.getElementById(swfid).innerHTML = "<div style='font-size:14px;text-align:center;color:black'>Scarica <a href='http://www.adobe.com/go/getflashplayer' target='_blank'>Shockwave Player</a> per visualizzare quest'area</div>";
		}
		var so = new SWFObject(swfpath, swfid+'flash', largh, alt, "8", bgcol);
		
		for(var i=5; i<arguments.length; i+=2)
			so.addVariable(arguments[i], arguments[i+1]);
		
		
		//<param name=wmode value=transparent>
		
		so.addParam("allowScriptAccess", "always");
		so.addParam("wmode", "transparent");
		so.write(swfid);
	}
}

//Change Log:
//* Updated: July 11th, 07: Fixed bug with persistence not working. Doh.
//* Updated: July 9th, 07: Added session only persistence to tabs (set "enabletabpersistence" var below). Only .js file changed.
//* Updated Nov 8th, 06. Ability to select a tab dynamically, by calling a method (ie: via a link). Only .js file changed.

var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
var loadstatustext="";
var enabletabpersistence=1 //enable tab persistence via session only cookies, so selected tab is remembered (1=yes, 0=no)?

////NO NEED TO EDIT BELOW////////////////////////
var loadedobjects=""
var defaultcontentarray=new Object()
var bustcacheparameter=""

function ajaxpage(url, containerid, targetobj){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, IE7, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
var ullist=targetobj.parentNode.parentNode.getElementsByTagName("td")
for (var i=0; i<ullist.length; i++)
ullist[i].className=""  //deselect all tabs
targetobj.parentNode.className="onlight"  //highlight currently clicked on tab

if (url.indexOf("#default")!=-1){ //if simply show default content within container (verus fetch it via ajax)
document.getElementById(containerid).innerHTML=defaultcontentarray[containerid]
return
}
document.getElementById(containerid).innerHTML=loadstatustext
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
if (bustcachevar) //if bust caching of external page
bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', url+bustcacheparameter, true)
page_request.send(null)
}

function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}

function loadobjs(revattribute){
if (revattribute!=null && revattribute!=""){ //if "rev" attribute is defined (load external .js or .css files)
var objectlist=revattribute.split(/\s*,\s*/) //split the files and store as array
for (var i=0; i<objectlist.length; i++){
var file=objectlist[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" " //Remember this object as being already added to page
}
}
}
}

function expandtab(tabcontentid, tabnumber){ //interface for selecting a tab (plus expand corresponding content)
if (typeof enablePiuLetti != 'undefined' && enablePiuLetti)
{
var thetab=document.getElementById(tabcontentid).getElementsByTagName("a")[tabnumber]
if (thetab.getAttribute("rel")){
ajaxpage(thetab.getAttribute("href"), thetab.getAttribute("rel"), thetab)
loadobjs(thetab.getAttribute("rev"))
}
}
else
{
document.getElementById('click10tab').style.display="none";
}
}

function savedefaultcontent(contentid){// save default ajax tab content
if (typeof defaultcontentarray[contentid]=="undefined") //if default content hasn't already been saved
defaultcontentarray[contentid]=document.getElementById(contentid).innerHTML
}

function startajaxtabs(){
if (typeof enablePiuLetti != 'undefined' && enablePiuLetti)
{
for (var i=0; i<arguments.length; i++){ //loop through passed UL ids
var ulobj=document.getElementById(arguments[i])
var ulist=ulobj.getElementsByTagName("td") //array containing the LI elements within UL
var persisttabindex=(enabletabpersistence==1)? parseInt(getCookie(arguments[i])) : "" //get index of persisted tab (if applicable)
var isvalidpersist=(persisttabindex<ulist.length)? true : false //check if persisted tab index falls within range of defined tabs
for (var x=0; x<ulist.length; x++){ //loop through each LI element
var ulistlink=ulist[x].getElementsByTagName("a")[0]
ulistlink.index=x
if (ulistlink.getAttribute("rel")){
var modifiedurl=ulistlink.getAttribute("href").replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.host+"/")
ulistlink.setAttribute("href", modifiedurl) //replace URL's root domain with dynamic root domain, for ajax security sake
savedefaultcontent(ulistlink.getAttribute("rel")) //save default ajax tab content
ulistlink.onclick=function(){
ajaxpage(this.getAttribute("href"), this.getAttribute("rel"), this)
loadobjs(this.getAttribute("rev"))
saveselectedtabindex(this.parentNode.parentNode.id, this.index)
return false
}
if ((enabletabpersistence==1 && persisttabindex<ulist.length && x==persisttabindex) || (enabletabpersistence==0 && ulist[x].className=="onlight")){
ajaxpage(ulistlink.getAttribute("href"), ulistlink.getAttribute("rel"), ulistlink) //auto load currenly selected tab content
loadobjs(ulistlink.getAttribute("rev")) //auto load any accompanying .js and .css files
}
}
}
}
}
}

////////////Persistence related functions//////////////////////////

function saveselectedtabindex(ulid, index){ //remember currently selected tab (based on order relative to other tabs)
if (enabletabpersistence==1) //if persistence feature turned on
setCookie(ulid, index)
}

function getCookie(Name){ 
var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
if (document.cookie.match(re)) //if cookie found
return document.cookie.match(re)[0].split("=")[1] //return its value
return ""
}

function setCookie(name, value){
document.cookie = name+"="+value //cookie value is domain wide (path=/)
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

//LOADING GENERICO
function loadingOn(idPosElement){
	document.getElementById(idPosElement).innerHTML ="<img src='/img2007/loadingServizi.gif' width='24' height='24' border='0' style='margin-top:50px'/>";
}
// INIZIO box servizi
function activeF1(onOff){
	loadingOn('contenutosvc');
	ajaxcall('contenutosvc', "/swf2007/servizi/pagMeteo.html", 'meteo');
	document.getElementById('contenutosvc').style.backgroundColor = "white";
	document.getElementById('cornicesvc').style.height = "292px";
	if( onOff == 1 ){
	} else {
		document.getElementById('contenutoNewsOut').innerHTML = "";
	}
}

function activeF2(onOff){
	loadingOn('contenutosvc');
	document.getElementById('cornicesvc').style.height = "300px";
	document.getElementById('contenutosvc').style.backgroundColor = "white";
	ajaxcall('contenutosvc', "/swf2007/servizi/serviziSport.html");
	if( onOff == 1 ){
	} else {
		document.getElementById('contenutoNewsOut').innerHTML = "";
	}
}

function activeF3(onOff){
	loadingOn('contenutosvc');
	ajaxcall('contenutosvc', "/swf2007/servizi/trovaLavoro.html", 'lavoro');
	//document.getElementById('contenutosvc').style.backgroundColor = "#455B70";
	document.getElementById('cornicesvc').style.height = "250px";
	if( onOff == 1 ){
		ajaxcall('contenutoNewsOut', "/includes2007/servizi_job24.html");
	} else {
		document.getElementById('contenutoNewsOut').innerHTML = "";
	}
}

function activeF4(onOff){
	loadingOn('contenutosvc');
	ajaxcall('contenutosvc', "/swf2007/servizi/trovaCasa/trovaCasa.html", 'casa');
	document.getElementById('contenutosvc').style.backgroundColor = "white";
	if( onOff == 1 ){
		ajaxcall('contenutoNewsOut', "/includes2007/servizi_casa24.html");
	} else {
		document.getElementById('contenutoNewsOut').innerHTML = "";
	}
}

function activeF5(onOff){
	loadingOn('contenutosvc');
	ajaxcall('contenutosvc', "/swf2007/servizi/cercaMutui/cercamutui.html", 'mutui');
	document.getElementById('contenutosvc').style.backgroundColor = "white";
	if( onOff == 1 ){
	} else {
		document.getElementById('contenutoNewsOut').innerHTML = "";
	}
}

function activeF6(onOff){
	loadingOn('contenutosvc');
	ajaxcall('contenutosvc', "/swf2007/servizi/trovaArte.html", 'arte');
	document.getElementById('contenutosvc').style.backgroundColor = "white";
	if( onOff == 1 ){
		ajaxcall('contenutoNewsOut', "/includes2007/servizi_arte24.html");
	} else {
		document.getElementById('contenutoNewsOut').innerHTML = "";
	}
}


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//     X TROVA ARTE -->	

function loadCategorie(categoria){
	
	if(document.formArte.keyword){
		var keyword = document.formArte.keyword.value;
	}
	switch(categoria.value){
		case 'gallerie':
			
			var normalGallery = "<div class=\"box_maschere_combo\"><div><label for=\"cercaper\">Cerca per:</label><select name=\"categoria\" onchange=\"loadCategorie(this)\" class=\"box_maschere_combo\" width=\"190px\" style=\"width:190px;float:right;\"><option value=\"gallerie\" class=\"noselect\" selected>Gallerie</option><option value=\"aste\">Aste</option><option value=\"mostre\" class=\"noselect\">Mostre</option></select><div id=\"gallerieContent\"></div></div></div><br/><span style='float:left;padding-left:0px;'>Galleria:</span><input type='text' name='galleria' id='galleria' value=''  class=\"box_maschere_parola\" /><br/><br/><span style='float:left;padding-left:25px;'>Citt&agrave;:</span><input type='text' name='citta' id='citta' value='' class=\"box_maschere_parola\" /><br/><br/><div class=\"box_maschere_select\" style=\"float:right;\"><input name=\"invio\" type=\"submit\" value=\"Cerca\" class=\"box_maschere_submitBlu\" /></div>";
			
			document.getElementById('cornicesvc').style.height = "180px";
			document.getElementById('gallerieBaseContent').innerHTML = normalGallery;
			document.formArte.method = "POST";
			document.formArte.action="http://www.artfairs.ilsole24ore.com/espositori.php";
			
			
		break;
		case 'aste':
			var normalGallery = "<div class=\"box_maschere_combo\"><div><label for=\"cercaper\">Cerca per:</label><select name=\"categoria\" onchange=\"loadCategorie(this)\" class=\"box_maschere_combo\" width=\"190px\" style=\"width:190px;float:right;\"><option value=\"gallerie\" class=\"noselect\">Gallerie</option><option value=\"aste\" selected>Aste</option><option value=\"mostre\" class=\"noselect\">Mostre</option></select></div></div><br/><div><span style='float:left;'>Parola chiave:</span><input type=\"text\" name=\"keyword\" value=\"\" class=\"box_maschere_parola2\" style=\"width:190px;float:right;\" ></div><br/><br/><div class=\"box_maschere_select\" style=\"float:right;\"><input name=\"invio\" type=\"submit\" value=\"Cerca\" class=\"box_maschere_submitBlu\" /></div>";
			
			document.getElementById('cornicesvc').style.height = "150px";
			document.getElementById('gallerieBaseContent').innerHTML = "";
			document.getElementById('gallerieBaseContent').innerHTML = normalGallery;
			document.formArte.action="http://www.arteconomy24.ilsole24ore.com/eventi/?keyword="+keyword+"&categoria=mostre";
			
		break;
		case 'mostre':
			var normalGallery = "<div class=\"box_maschere_combo\"><div><label for=\"cercaper\">Cerca per:</label><select name=\"categoria\" onchange=\"loadCategorie(this)\" class=\"box_maschere_combo\" width=\"190px\" style=\"width:190px;float:right;\"><option value=\"gallerie\" class=\"noselect\">Gallerie</option><option value=\"aste\">Aste</option><option value=\"mostre\" class=\"noselect\" selected>Mostre</option></select></div></div><br/><div><span style='float:left;'>Parola chiave:</span><input type=\"text\" name=\"keyword\" value=\"\" class=\"box_maschere_parola2\" style=\"width:190px;float:right;\"></div><br/><br/><div class=\"box_maschere_select\" style=\"float:right;\"><input name=\"invio\" type=\"submit\" value=\"Cerca\" class=\"box_maschere_submitBlu\" /></div>";
			
			document.getElementById('cornicesvc').style.height = "150px";
			document.getElementById('gallerieBaseContent').innerHTML = "";
			document.getElementById('gallerieBaseContent').innerHTML = normalGallery;
			document.formArte.action="http://www.arteconomy24.ilsole24ore.com/eventi/?keyword="+keyword+"&categoria=aste";
		break;
	}
}


//     X END TROVA ASTE -->



// FINE box servizi

// INIZIO CASA24
		function prendiElementoDaId(id_elemento) {
			var elemento;
			if(document.getElementById)
				elemento = document.getElementById(id_elemento);
			else
				elemento = document.all[id_elemento];
			return elemento;
		};

		function assegnaXMLHttpRequest() {
			var
				XHR = null,
				browserUtente = navigator.userAgent.toUpperCase();
			if(typeof(XMLHttpRequest) === "function" || typeof(XMLHttpRequest) === "object")
				XHR = new XMLHttpRequest();
			else if(window.ActiveXObject && browserUtente.indexOf("MSIE 4") < 0) {
				if(browserUtente.indexOf("MSIE 5") < 0)
					XHR = new ActiveXObject("Msxml2.XMLHTTP");
				else
					XHR = new ActiveXObject("Microsoft.XMLHTTP");
			}
			return XHR;
		};

	// oggetto di verifica stato
		var readyState = {
			INATTIVO:	0,
			INIZIALIZZATO:	1,
			RICHIESTA:	2,
			RISPOSTA:	3,
			COMPLETATO:	4
		};

function ajaxcall(tagid,ajaxfile,extraparam)
{
	var forcereload = new Date().valueOf();
	if (ajaxfile.indexOf("?")>0) {
		ajaxfile = ajaxfile + "&forcereload=" + forcereload;
	} else {
		ajaxfile = ajaxfile + "?forcereload=" + forcereload;
	}

  // variabili di funzione
  var
    // assegnazione oggetto XMLHttpRequest
    ajax = assegnaXMLHttpRequest(),
    // assegnazione elemento del documento
    elemento = prendiElementoDaId(tagid),
    // risultato booleano di funzione
    usaLink = true;
  
  // se l'oggetto XMLHttpRequest non e' nullo
  if(ajax) {
    // il link al file non deve essere usato
    usaLink = false;

    // impostazione richiesta asincrona in GET
    // del file specificato
	
    ajax.open("get", ajaxfile, true);
	
    // rimozione dell'header "connection" come "keep alive"
    ajax.setRequestHeader("connection", "close");

    // impostazione controllo e stato della richiesta
    ajax.onreadystatechange = function() {
      
      // verifica dello stato
      if(ajax.readyState === readyState.COMPLETATO) {
        // verifica della risposta da parte del server
        if(ajax.status == 200)
        {
          // operazione avvenuta con successo
          switch (extraparam)
          	{
          		case 'lavoro': 
					document.getElementById('cornicesvc').style.height = "240px";
					document.getElementById('cornicesvc').style.backgroundColor = "#FFFFFF";
					break;
				case 'casa':
					document.getElementById('cornicesvc').style.height = "260px";
					document.getElementById('cornicesvc').style.backgroundColor = "#FFFFFF";
					break;
				case 'mutui':
					document.getElementById('cornicesvc').style.height = "195px";
					document.getElementById('cornicesvc').style.backgroundColor = "#FFFFFF";
					break;
				case 'arte':
					document.getElementById('cornicesvc').style.height = "160px";
					document.getElementById('cornicesvc').style.backgroundColor = "#FFFFFF";
					break;
				case 'meteo':
					document.getElementById('cornicesvc').style.height = "292px";
					document.getElementById('cornicesvc').style.backgroundColor = "#FFFFFF";
					break;
				case 'avvocati':
					document.getElementById('cornicesvc').style.height = "213px";
					document.getElementById('cornicesvc').style.backgroundColor = "#FFFFFF";
					break;
				case 'sport':
					document.getElementById('cornicesvc').style.height = "290px";
					document.getElementById('cornicesvc').style.backgroundColor = "#FFFFFF";
					break;
        	}
          elemento.innerHTML = ajax.responseText;
        }
        else {
          // errore di caricamento
          elemento.innerHTML = "Impossibile effettuare l'operazione richiesta.<br />";
          elemento.innerHTML += "Errore riscontrato: " + ajax.status;
        }
      } 
    }

    // invio richiesta
    ajax.send(null);
  }
   
  return usaLink;
}

function resetElement(tagid,htmlcode)
{
	var elemento = prendiElementoDaId(tagid);
	if (htmlcode == undefined)
		htmlcode = '<select class="box_maschere_select"><option class="noselect">Seleziona</option></select>';
	elemento.innerHTML = htmlcode;
}

function loaddata(inputelement,type)
{
	switch (type)
	{
		case 'comune':
			ajaxcall('eurekasa_comune','/php/boxservizi/casa24/dbaccessCasa.php?type='+type+'&prov='+inputelement.options[inputelement.selectedIndex].value);
			ajaxcall('eurekasa_regione','/php/boxservizi/casa24/dbaccessCasa.php?type=regione&prov='+inputelement.options[inputelement.selectedIndex].value);
			break;
		case 'comune_s':
			ajaxcall('eurekasa_comune','/php/boxservizi/casa24/dbaccessCasa.php?type='+type+'&prov='+inputelement.options[inputelement.selectedIndex].value);
			ajaxcall('eurekasa_regione','/php/boxservizi/casa24/dbaccessCasa.php?type=regione&prov='+inputelement.options[inputelement.selectedIndex].value);
			break;
		case 'prezzo':
			ajaxcall('eurekasa_prezzo','/php/boxservizi/casa24/dbaccessCasa.php?type='+type+'&contratto='+inputelement.value);
			break;
		case 'prezzo_s':
			ajaxcall('eurekasa_prezzo','/php/boxservizi/casa24/dbaccessCasa.php?type='+type+'&contratto='+inputelement.value);
			break;
		case 'tipologia':
			ajaxcall('eurekasa_tipologia','/php/boxservizi/casa24/dbaccessCasa.php?type='+type+'&categoria='+inputelement.value);
			break;
	}
}

// FINE casa24

function caricaUrl(tagid) {
	if (enableCorrelate)
	{
		/* caricamento randomico dei file html */
	  // variabili di funzione
	  var
	    // assegnazione oggetto XMLHttpRequest
	    ajax = assegnaXMLHttpRequest(),
	    // assegnazione elemento del documento
	    elemento = prendiElementoDaId(tagid),
	    // risultato booleano di funzione
	    usaLink = true;
	  
	  // se l'oggetto XMLHttpRequest non e' nullo
	  if(ajax) {
	    // il link al file non deve essere usato
	    usaLink = false;
	
	    // impostazione richiesta asincrona in GET
	    // del file specificato
	    var searchinit = 'cquery___1___';
	    var correlatedstr = '(uuid:(';
	    
	    if (typeof(correlated) != "undefined")
	    {
		    for (i=0; i<correlated.length; i++)
		    {
		    	if (correlatedstr.length > 7)
		    		correlatedstr += ' OR ';
		    	correlatedstr += '("'+correlated[i][0]+'"^'+correlated[i][1]+')';
		    }
		}
	    
		var doquery = true;

		if (correlatedstr == '(uuid:(')
  	    	doquery = false;
  	    
  	    if (doquery)
  	    {	
  	    correlatedstr = searchinit + correlatedstr + '))___1___VOID___2___';
	    
		rExp = /&/g;
		correlatedstr = correlatedstr.replace(rExp,'%26');
		
	    		//prompt('',searchparams);
	    ajax.open("get", "/s24service?profilo=correlatedotcom2_solr&search_query_id=basicquery&xsl_id=correlatedotcom2&keywords=&search_parameters="+correlatedstr+"&order_by=1&page_number=1&page_size=5&max_docs=5&highlight=true&keywords_operator=AND", true);
		
	    // rimozione dell'header "connection" come "keep alive"
	    ajax.setRequestHeader("connection", "close");
	
	    // impostazione controllo e stato della richiesta
	    ajax.onreadystatechange = function() {
	      
	      // verifica dello stato
	      if(ajax.readyState === readyState.COMPLETATO) {
	        // verifica della risposta da parte del server
	        if(ajax.status == 200)
	        {
	          // operazione avvenuta con successo
	          if (ajax.responseText.indexOf('no_news') == -1) {
	          		elemento.innerHTML = ajax.responseText;
          		}
	        }
	        else {
	          // errore di caricamento
	          elemento.innerHTML = "";
	        }
	      } 
	    }
	
	    // invio richiesta
	    ajax.send(null);
		}
	  }
	   
	  return usaLink;
	}
} 

function getMailTo(){
    var serviceUrl="/php/piuletti/artratingsvc.php";
    if (typeof(uuid) == "undefined") uuid = self.location.search.split('uuid=')[1];
    title = escape(document.title);
    DocRulesView = self.location.search.split('DocRulesView=')[1];
    clientUrl = escape(document.URL);
    serviceUrl += "?sent=true&uuid=" + uuid;
    serviceUrl += "&title=" + title;
    serviceUrl += "&DocRulesView=" + DocRulesView;
    serviceUrl += "&channel=com2010";
    serviceUrl += "&url=".concat(clientUrl);

    var scriptTag='<scr'+'ipt type="text/javascript" src="' + serviceUrl + '"><\/scr'+'ipt>';
	
	$j('body').append(scriptTag);
	
	document.location.href="mailto:?body="+escape(document.location)+"&subject="+escape(document.title)+"&";
}

function getMailTo2(){
    var serviceUrl="/php/piuletti/artratingsvc.php";
    if (typeof(uuid) == "undefined") uuid = self.location.search.split('uuid=')[1];
    title = escape(document.title);
    DocRulesView = self.location.search.split('DocRulesView=')[1];
    clientUrl = escape(document.URL);
    serviceUrl += "?sent=true&uuid=" + uuid;
    serviceUrl += "&title=" + title;
    serviceUrl += "&DocRulesView=" + DocRulesView;
    serviceUrl += "&channel=com2010";
    serviceUrl += "&url=".concat(clientUrl);

    var scriptTag='<scr'+'ipt type="text/javascript" src="' + serviceUrl + '"><\/scr'+'ipt>';
	
	$j('body').append(scriptTag);
}

function highlightSection(){
	var sectionElement = document.getElementById(menu_section_idname);
	if (sectionElement)
	{
		sectionElement.className = 'scelto';
		sectionElement.style.classname = 'scelto';
	}
}
function do_popup() {
      window.open('http://websystem.ilsole24ore.com/minisiti/presentazione/Presentazione.html', 'sole24ore', 'toolbar=no, location=no, width=525,height=425 ');
}

function condividi(id) {
	var url;
	var dtitle;
	dtitle = escape(document.title);
	url = escape(document.location);
	wtitle = document.title.substring(0,document.title.indexOf('- Il Sole 24 ORE'));
	wtitle = escape(wtitle.replace(/\s+$/g,''));
	var description;
	var metas = document.getElementsByTagName('meta');
	for (var x=0,y=metas.length; x<y; x++) {
	  if (metas[x].name.toLowerCase() == "description") {
	    description = metas[x];
	  }
	}
	switch(id)
	{
		case "linkedin":
		  url = "http://www.linkedin.com/shareArticle?mini=true&url=" + url + "&title=" + dtitle + "&summary=" + escape(description.content) + "&source=Il Sole 24 ORE";
		  break;  
		case "oknotizie":
		  url = "http://oknotizie.alice.it/post?url=" + url + "&title=" + dtitle;
		  break;  
		case "facebook":
		  url = "http://www.facebook.com/sharer.php?u=" + url;
		  break; 
		case "wikio":
		  url = "http://www.wikio.it/vote?domain=ilsole24ore.com&title=" + wtitle;
		  break;	
		case "delicious":
		  url = "http://del.icio.us/post?v=4&noui&jump=close&url=" + url + "&title=" + dtitle;
		  break;    
		case "digg":
		  url = "http://digg.com/submit?phase=2&url=" + url + "&title=" + dtitle;
		  break;
		case "technorati":
		  url = "http://technorati.com/faves?add=" + url;
		  break;
		case "yahoo":
		  url = "http://us.lrd.yahoo.com/_ylc=X3oDMTFncGlhdWM0BHRtX2RtZWNoA1RleHQgTGluawR0bV9sbmsDVTExMTYyOTQEdG1fbmV0A1lhaG9vIQ--/SIG=1221dv9l6/**http%3A//www.yahoo.com/add%3Furl=http%3A//www.ilsole24ore.com/";
		  //url = "http://myweb.yahoo.com/myresults/bookmarklet?t=" + dtitle + "&u=" + url + "&ei=UTF";
		  break;
	}
	//document.location = url;
	window.open(url, 'tools');
}

function attivasmsmobile(){
	var selectedcode = document.getElementById("smscode").options[document.getElementById("smscode").selectedIndex].value;
	var mobilenum = document.getElementById("mobilenum").value;
	var mobileurl = "http://webbuy.mobile.ilsole24ore.com/attiva/" + selectedcode;
	document.location = mobileurl + '/' + mobilenum;
}
// DAL 17/01/2008
function drawService(paramOpen) {
	drawFlash("/swf2007/servizimenu2.swf","330","54","#ffffff","serviziswf","seltab",paramOpen);
	drawFlashContentTabFirst(paramOpen);
}

function drawFlashContentTabFirst(paramOpen) {
	switch (paramOpen) {
		case "1" :
			activeF1();
			break;
		case "2" :
			activeF2();
			break;
		case "3" :
			activeF3(1);
			break;
		case "4" :
			activeF4(1);
			break;
		case "5" :
			activeF5();
			break;
		case "6" :
			activeF6(1);
			break;
	}
}
// FUNZIONI PER NUOVO BOX SERVIZI

function loadMeteo(){
	loadingOn('contenutosvc');
	ajaxcall('contenutosvc', "/swf2007/servizi/pagMeteo.html");
	document.getElementById('cornicesvc').style.height = "292px";
	document.getElementById('contenutoNewsOut').innerHTML = "";
	serviziACCENDI(document.getElementById('serviziLINK01'));
}

function loadSport(){
	loadingOn('contenutosvc');
	ajaxcall('contenutosvc', "/swf2007/servizi/serviziSport.html");
	document.getElementById('cornicesvc').style.height = "400px";
	document.getElementById('contenutoNewsOut').innerHTML = "";
	serviziACCENDI(document.getElementById('serviziLINK02'));
}

function loadJob(newsOn){
	loadingOn('contenutosvc');
	ajaxcall('contenutosvc', "/swf2007/servizi/trovaLavoro.html");
	document.getElementById('cornicesvc').style.height = "240px";
	if (newsOn) {
		ajaxcall('contenutoNewsOut', "/includes2007/servizi_job24.html");
	} else {
		document.getElementById('contenutoNewsOut').innerHTML = "";
	}
	serviziACCENDI(document.getElementById('serviziLINK07'));
}

function loadAssicurazioni(){
	loadingOn('contenutosvc');
	ajaxcall('contenutosvc', "/swf2007/servizi/trovaAssicurazioni.html");
	document.getElementById('cornicesvc').style.height = "240px";
	document.getElementById('contenutoNewsOut').innerHTML = "";
	serviziACCENDI(document.getElementById('serviziLINK08'));
}

function loadCasa(newsOn){
	loadingOn('contenutosvc');
	ajaxcall('contenutosvc', "/swf2007/servizi/trovaCasa/trovaCasa.html");
	document.getElementById('cornicesvc').style.height = "280px";
	if (newsOn) {
		ajaxcall('contenutoNewsOut', "/includes2007/servizi_casa24.html");
	} else {
		document.getElementById('contenutoNewsOut').innerHTML = "";
	}
	serviziACCENDI(document.getElementById('serviziLINK05'));
}

function loadMutui(){
	loadingOn('contenutosvc');
	ajaxcall('contenutosvc', "/swf2007/servizi/cercaMutui/cercamutui.html");
	document.getElementById('cornicesvc').style.height = "195px";
	document.getElementById('contenutoNewsOut').innerHTML = "";
	serviziACCENDI(document.getElementById('serviziLINK06'));
}

function loadArte(newsOn){
	loadingOn('contenutosvc');
	ajaxcall('contenutosvc', "/swf2007/servizi/trovaArte.html");
	document.getElementById('cornicesvc').style.height = "160px";
	if (newsOn) {
		ajaxcall('contenutoNewsOut', "/includes2007/servizi_arte24.html");
	} else {
		document.getElementById('contenutoNewsOut').innerHTML = "";
	}
	serviziACCENDI(document.getElementById('serviziLINK03'));
}

function loadAvvocati(){
	loadingOn('contenutosvc');
	ajaxcall('contenutosvc', "/swf2007/servizi/trovaAvvocati/trovaAvvocati.html");
	document.getElementById('cornicesvc').style.height = "230px";
	document.getElementById('contenutoNewsOut').innerHTML = "";
	serviziACCENDI(document.getElementById('serviziLINK04'));
}
function displayHourArt(myid,mytime){
	var idartdate = document.getElementById(myid);
	var artdate = new Date(mytime*1000);
	var datenow = new Date();
	
	if ((datenow-artdate)/60000 <= art_diff_minutes && idartdate)
	{
		var artminutes = (artdate.getMinutes() < 10)?'0'+artdate.getMinutes():artdate.getMinutes();
		idartdate.innerHTML=' ORE '+artdate.getHours()+':'+artminutes;
	}
}
function loadServiziTab(){
	    if (typeof(menu_section_idname) != "undefined")
		{
			switch (menu_section_idname)
			{
				case 'home_section': loadCasa(1);break;
				case 'norme_section': loadMutui();break;
				case 'finanza_section':
				case 'italia_section':
				case 'esteri_section':
				case 'tecnologia_section':
				case 'dossier_section':
					loadMeteo();break;
				case 'cultura_section': loadArte(1);break;
				case 'economia_section': loadJob(1);break;
				case 'sport_section': loadSport(); break;
				default: loadCasa(1);
			}
		}
		else
			loadCasa(1);
}
function serviziACCENDI(obj) {
  obj.className='attivo';

document.getElementById("serviziLINK01").className= '';
document.getElementById("serviziLINK02").className= '';
document.getElementById("serviziLINK03").className= '';
document.getElementById("serviziLINK04").className= '';
document.getElementById("serviziLINK05").className= '';
document.getElementById("serviziLINK06").className= '';
document.getElementById("serviziLINK07").className= '';
document.getElementById("serviziLINK08").className= '';

  obj.className='attivo';
}

