<!--
//SLiDIN HTML
var isVideoOpen=false;
var IE = navigator.appName.indexOf("Microsoft") != -1;

function scrollVideo()
{
	//alert('isVideoOpen='+isVideoOpen);
	if(isVideoOpen)
	{
		MM_timelinePlay('CloseTM');
	}else
	{
		MM_timelinePlay('OpenTM');
	}
	isVideoOpen=!isVideoOpen;
	showVideoPlayer(isVideoOpen);
}
function showVideoPlayer(b)
{
	var flashVideoPlayer=IE ? document.getElementById('flashVideoPlayer') : window.document.getElementById('flashVideoPlayer');
	//flashVideoPlayer.style.visibility=b ? "visible" : "hidden";
}
function MM_timelinePlay(tmLnName, myID) { //v1.2
	//alert("tmLnName="+tmLnName+", myID="+myID);
  //Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Macromedia, Inc. All rights reserved.
  var i,j,tmLn,props,keyFrm,sprite,numKeyFr,firstKeyFr,propNum,theObj,firstTime=false;
  //alert("document.MM_Time ? "+document.MM_Time);
  if (document.MM_Time == null) MM_initTimelines(); //if *very* 1st time
  tmLn = document.MM_Time[tmLnName];
  if (myID == null) { myID = ++tmLn.ID; firstTime=true;}//if new call, incr ID
  if (myID == tmLn.ID) { //if Im newest
    setTimeout('MM_timelinePlay("'+tmLnName+'",'+myID+')',tmLn.delay);
    fNew = ++tmLn.curFrame;
    for (i=0; i<tmLn.length; i++) {
      sprite = tmLn[i];
      if (sprite.charAt(0) == 's') {
        if (sprite.obj) {
          numKeyFr = sprite.keyFrames.length; firstKeyFr = sprite.keyFrames[0];
          if (fNew >= firstKeyFr && fNew <= sprite.keyFrames[numKeyFr-1]) {//in range
            keyFrm=1;
            for (j=0; j<sprite.values.length; j++) {
              props = sprite.values[j]; 
              if (numKeyFr != props.length) {
                if (props.prop2 == null) sprite.obj[props.prop] = props[fNew-firstKeyFr];
                else        sprite.obj[props.prop2][props.prop] = props[fNew-firstKeyFr];
              } else {
                while (keyFrm<numKeyFr && fNew>=sprite.keyFrames[keyFrm]) keyFrm++;
                if (firstTime || fNew==sprite.keyFrames[keyFrm-1]) {
                  if (props.prop2 == null) sprite.obj[props.prop] = props[keyFrm-1];
                  else        sprite.obj[props.prop2][props.prop] = props[keyFrm-1];
        } } } } }
      } else if (sprite.charAt(0)=='b' && fNew == sprite.frame) eval(sprite.value);
      if (fNew > tmLn.lastFrame)
	  	{
	  		tmLn.ID = 0;
			/*Dan questo permette a MM_Time di ripetersi*/
			document.MM_Time = null
	  		//alert('stop animation');
		}
  } }
}

//BRIGHTCOVE COMMUNICATION
function callLineup(thislineup)
{
	var scriptTag = document.createElement("script");
	var noCacheIE = '&noCacheIE=' + (new Date()).getTime();
   
	   // Add script object attributes
	   scriptTag.setAttribute("type", "text/javascript");
	   scriptTag.setAttribute("charset", "utf-8");
	   scriptTag.setAttribute("src", "http://services.brightcove.com/services/library?command=find_playlist_by_id&token=9IWUwpDhvnC_KpxDj3F0qJf9RqpCMeph536fJpn88-0.&playlist_id="+thislineup+"&fields=id,name,thumbnailURL,referenceId,videos,shortDescription,length&callback=onLineupLoad" + noCacheIE);//1515821132,1486914616,1515821150,1544345088
	   scriptTag.setAttribute("id", "flashVisoreCall");
	
	var head = document.getElementsByTagName("head").item(0);
	head.appendChild(scriptTag);
}
function onLineupLoad(jsonData)
{
	return thisMovie("videoportal").onLineupLoad(jsonData.videos);	
}
	
function thisMovie(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
	return window[movieName]
	}
	else {
	return document[movieName]
	}
}


function toggleCurtain() {
	
	var openBtn = '<img src="/static/images/sito/btApriSipario.gif" width="135" height="34" alt="Scopri il Sipario" title="Scopri il Sipario" id="img_sipario">';
	var closeBtn = '<img src="/static/images/sito/btChiudiSipario.gif" width="135" height="34" alt="Chiudi il Sipario" title="Chiudi il Sipario" id="img_sipario">';
	
	$("#flashVideoPlayer").slideToggle("normal", function() {
		var newBtn = $("#flashVideoPlayer").css("display") == "none" ? openBtn : closeBtn;
		$("#sipario_btn").html(newBtn);
	});
	
}
function MM_initTimelines() { //v4.0
    //MM_initTimelines() Copyright 1997 Macromedia, Inc. All rights reserved.
    var ns = navigator.appName == "Netscape";
    var ns4 = (ns && parseInt(navigator.appVersion) == 4);
    var ns5 = (ns && parseInt(navigator.appVersion) > 4);
    var macIE5 = (navigator.platform ? (navigator.platform == "MacPPC") : false) && (navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4);
    document.MM_Time = new Array(2);
    document.MM_Time[0] = new Array(0);
    document.MM_Time["OpenTM"] = document.MM_Time[0];
    document.MM_Time[0].MM_Name = "OpenTM";
    document.MM_Time[0].fps = 15;
    document.MM_Time[0].lastFrame = 0;
    document.MM_Time[1] = new Array(0);
    document.MM_Time["CloseTM"] = document.MM_Time[1];
    document.MM_Time[1].MM_Name = "CloseTM";
    document.MM_Time[1].fps = 15;
    document.MM_Time[1].lastFrame = 0;
    for (i=0; i<document.MM_Time.length; i++) {
        document.MM_Time[i].ID = null;
        document.MM_Time[i].curFrame = 0;
        document.MM_Time[i].delay = 1000/document.MM_Time[i].fps;
    }
}

var pause;

function pauseVideo()
{
                /*var pause=true;
                //alert(($('#img_sipario').attr('src')).indexOf('/img/btApriSipario.gif'));
                if(($('#img_sipario').attr('src')).indexOf('/img/btApriSipario.gif')>-1){
                               pause=false;
                }else{
                               pause=true;
                }
                //alert("pv "+pause);*/
                return thisMovie("scrollBridge").pauseVideo(pause);
}

function faTutto(){
	if(($('#img_sipario').attr('src')).indexOf('/static/images/sito/btApriSipario.gif')>-1){
		toggleCurtain();
		pause=false;
		$('#hiddenNielsen').attr('src', 'http://secure-it.imrworldwide.com/cgi-bin/m?ci=sky-it&cg=flash_sipario&si=http%3A//www.sky.it/tg24/sipario/in_diretta/&rnd='+(new Date()).getTime());
		setTimeout('pauseVideo()',800);
	}else{
		pause=true;
		pauseVideo();
		setTimeout('toggleCurtain()',100);
	}											
}
//-->

