if (!navigator.userAgent.match(/Safari/)) {
	document.getElementById("divPubblicita").style.display = "block";
	document.getElementById("divPubblicita").style.height = "30px";

var m3_u = (location.protocol=='https:'?'https://ads.cinemode.it/www/delivery/ajs.php':'http://ads.cinemode.it/www/delivery/ajs.php');
var m3_r = Math.floor(Math.random()*99999999999);
if (!document.MAX_used) document.MAX_used = ',';
document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
document.write ("?zoneid=118&amp;target=_blank");
document.write ('&amp;cb=' + m3_r);
if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);
document.write (document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));
document.write ("&amp;loc=" + escape(window.location));
if (document.referrer) document.write ("&amp;referer=" + escape(document.referrer));
if (document.context) document.write ("&context=" + escape(document.context));
if (document.mmm_fo) document.write ("&amp;mmm_fo=1");
document.write ("'><\/scr"+"ipt>");
document.write ('<a id="btOpenClosePubb" href="javascript:ApriChiudiPubblicita()" class="bottApriPubb">&nbsp;</a>');

  var enlarging = false;
  function addEvent( obj, type, fn ) {
    if ( obj.attachEvent ) {
      obj['e'+type+fn] = fn;
      obj[type+fn] = function(){obj['e'+type+fn]( window.event );}
      obj.attachEvent( 'on'+type, obj[type+fn] );
    } else
      obj.addEventListener( type, fn, false );
  }
  function initPubblicita() {
    var pubdiv = document.getElementById("divPubblicita");
    var bt = document.getElementById("btOpenClosePubb");
    var dx = pubdiv.offsetLeft;
    var b = document.body;

	if (window.divPubblicitaDyn == 1) {
		window.divPubblicitaDyn = 30;
		pubdiv.style.height= "30px";
	}
    
    if (! get_cookie("tix_pubb")) {
      var ora = new Date();
      var scadenza = new Date(ora.getTime()+60000000);
      set_cookie("tix_pubb","non_aprire_banner",scadenza.getFullYear(),scadenza.getMonth(),scadenza.getDate(),scadenza.getHours());
      ApriPubblicita();
      //bt.className = "bottChiudiPubb";
      bt.style.backgroundImage = 'url(http://www.delosnetwork.it/banner/footer/bott_close.gif)';
    }
    
    //addEvent(pubdiv,"mouseover",ApriPubblicita);
    //addEvent(pubdiv,"mouseout",onpubMouseOut);
    
  }
  
  function ApriChiudiPubblicita() {
    var pubdiv = document.getElementById("divPubblicita");
    var pdh = pubdiv.clientHeight+10;
    var bt = document.getElementById("btOpenClosePubb");

    if (pdh < 300) {
		if (window.divPubblicitaDyn > 0) {
			pubdiv.style.height= "300px";
			window.divPubblicitaDyn = 300;
			bt.style.backgroundImage = 'url(http://www.delosnetwork.it/banner/footer/bott_close.gif)';
			return;
		}
     ApriPubblicita();
      //bt.className = "bottChiudiPubb";
      bt.style.backgroundImage = 'url(http://www.delosnetwork.it/banner/footer/bott_close.gif)';
    } else {	
     ChiudiPubblicita();
     // onpubMouseOut();
     // bt.className = "bottApriPubb";
      bt.style.backgroundImage = 'url(http://www.delosnetwork.it/banner/footer/bott_expand.gif)';
    }
  }
  
  function ChiudiPubblicita() {
  	document.getElementById("divPubblicita").style.display = 'none';
  }
  
  function ApriPubblicita() {
    enlarging = true;
    var pubdiv = document.getElementById("divPubblicita");
	var pdh = pubdiv.clientHeight+10;
	pubdiv.style.height= pdh + "px";
	//checkScroll();
	if (pdh < 300) {
	  window.setTimeout(ApriPubblicita,10);
	} else {
	  enlarging = false;
	}
  }
  function onpubMouseOut() {
    if (! enlarging) {
      var pubdiv = document.getElementById("divPubblicita");
      var pdh = pubdiv.clientHeight-10;
      pubdiv.style.height= pdh + "px";
      //checkScroll();
    }
    if (pdh > 30) {
      window.setTimeout(onpubMouseOut,10);
    } else {
      pubdiv.style.height= "30px";
    }
  }
  
  function checkScroll() {
    //alert("scroll" + document.body.scrollTop+","+document.body.scrollHeight);
    var pubdiv = document.getElementById("divPubblicita");
    var b = document.body;
    pubdiv.style.top = "" + (b.clientHeight-pubdiv.clientHeight+b.scrollTop) + "px";
  }
  
  function set_cookie ( name, value, exp_y, exp_m, exp_d, exp_h, path, domain, secure )
  {
    var cookie_string = name + "=" + escape ( value );
  
    if ( exp_y )
    {
      var expires = new Date ( exp_y, exp_m, exp_d,exp_h,59,59);
      cookie_string += "; expires=" + expires.toGMTString();
    }
  
    if ( path )
          cookie_string += "; path=" + escape ( path );
     else cookie_string += "; path=/"
  
    if ( domain )
          cookie_string += "; domain=" + escape ( domain );
    
    if ( secure )
          cookie_string += "; secure";
    
    document.cookie = cookie_string;
  }
  
  function get_cookie ( cookie_name )
  {
    var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );
  
    if ( results )
      return ( unescape ( results[2] ) );
    else
      return null;
  }


  
  addEvent(window,"load",initPubblicita);
  //addEvent(window,"scroll",checkScroll);
}