﻿// JScript File

var CodeHtmlAltroDi = "Funzione ancora da implementare<br>quando metterò ajax";
var CodeHtmlVideoCorr = "";
var CodeHtmlInsComment = "";
var AltroDiAperto = true;
var VideoCorrAperto = true;

function AltroDi()
{  
  if(!AltroDiAperto)
  {
    document.getElementById("imgAltroDi").src = "img/ico_ot.png";
    AltroDiAperto = true;
    document.getElementById("txAltroDiContent").innerHTML = CodeHtmlAltroDi;
  }
  else
  {
    document.getElementById("imgAltroDi").src = "img/ico_otc.png";
    AltroDiAperto = false;
    document.getElementById("txAltroDiContent").innerHTML = "";
  }
  
}

function VideoCorr()
{
  if(!VideoCorrAperto)
  {
    document.getElementById("imgVideoCorr").src = "img/ico_ot.png";
    VideoCorrAperto = true;
    document.getElementById("spVideoCorr").innerHTML = CodeHtmlVideoCorr;
  }
  else
  {
    document.getElementById("imgVideoCorr").src = "img/ico_otc.png";
    VideoCorrAperto = false;
    document.getElementById("spVideoCorr").innerHTML = "";
  }
}

function InsComm()
{	
    document.getElementById("inscomm").style.display = 'block';
}

function SaveComm()
{
    var Text = document.getElementById("txCommentIns").value;    
    //document.getElementById("inscomm").style.display = 'none';
    document.getElementById("attesagif").innerHTML = "<img src=\"img/loadAjax.gif\">";    
    document.getElementById("attesagif").style.display='block';
    PlayVideo.SalvaCommento(Text, SalvaCommento_CallBack);    
    
}

function SalvaCommento_CallBack(Ris)
{
    if(Ris!=null && Ris.value!=null && typeof (Ris.value) == "object")
    {
        document.getElementById("areacomm").innerHTML = Ris.value.areacomm;
        document.getElementById("txNumCommenti").innerHTML = Ris.value.txnumcommenti;
        document.getElementById("txTitleComm").innerHTML = Ris.value.txtitlecomm;    
        document.getElementById("attesagif").innerHTML = "";     
        document.getElementById("attesagif").style.display='none';
        document.getElementById("txCommentIns").value = "";     
    }
}

function AddFavorites( id )
{
    PlayVideo.AddFavorites( id, func_callback );    
}

function func_callback(Ris)
{
    if(Ris!=null && Ris.value !=null)
    {
        document.getElementById("spFavorites").innerHTML = Ris.value;
    }
}

