﻿//window.onload += (function() {  });
var maxslidewidthdx = 60;
var actualslidewidthdx = 0;
function firstGoCh() {
    /*var eleo = document.getElementById('tvchannelsout');
    eleo.style.width = "1px";*/
    setTimeout("openSlideDx()", 400);
    setTimeout("pulseText('vptext')", 3000);
}

function openSlideDx() {
    var ele = document.getElementById('tvchannelsout');
    ele.style.paddingRight = "45px";
    ele.style.marginRight = "59px";
    setTimeout("openSlideCh()", 100);
}
function openSlideCh() {
    var eleo = document.getElementById('tvchannelsout');
    var ele = document.getElementById('tvchannelscroll');
    var elec = document.getElementById('tvchannels');
    var eleh = document.getElementById('tvchannelsh2');
    if (ele == null) return false;
    var inc = maxslidewidthdx / 10;
    inc = inc + actualslidewidthdx;
    actualslidewidthdx = inc;
    if (actualslidewidthdx >= maxslidewidthdx) {
        fullSlideDx();
        return false;
    }
    ele.style.width = actualslidewidthdx + "px";
    eleo.style.marginRight = (maxslidewidthdx - actualslidewidthdx) + "px";
    eleo.style.width = actualslidewidthdx + "px";
    elec.style.width = actualslidewidthdx + "px";
    setTimeout("openSlideCh()", 100);
}
function fullSlideDx() {
    var eleo = document.getElementById('tvchannelsout');
    var ele = document.getElementById('tvchannelscroll');
    var elec = document.getElementById('tvchannels');
    var eleh = document.getElementById('tvchannelsh2');
    ele.style.width = maxslidewidthdx + "px";
    eleo.style.width = maxslidewidthdx + "px";
    eleo.style.marginRight = "0px";
    eleo.style.paddingRight = "45px";
    elec.style.width = maxslidewidthdx + "px";
    eleh.style.visibility = "visible";
    $('#tvtableChan').fadeOut("1", function() { $('#tvtableChan').fadeIn("slow"); });
    //ele.style.overflow = "auto";
}
function fullSlideDxEdit() {
    var eleo = document.getElementById('tvchannelsout');
    var ele = document.getElementById('tvchannelscroll');
    var elec = document.getElementById('tvchannels');
    var eleh = document.getElementById('tvchannelsh2');
    var elet = document.getElementById('tvtableChan');
    ele.style.width = (2 * maxslidewidthdx) + "px";
    eleo.style.width = (2 * maxslidewidthdx) + "px";
    eleo.style.marginRight = "0px";
    eleo.style.paddingRight = "45px";
    elec.style.width = (2 * maxslidewidthdx) + "px";
    eleh.style.visibility = "visible";
    elet.style.display = "block";
    //ele.style.overflow = "none";
}
function pulseText(tid) {
    var ele = document.getElementById(tid);
    if (ele == null) return false;
    setTimeout("firstPulseText('" + tid + "')", 500);
    setTimeout("normalText('" + tid + "')", 800);
    setTimeout("secondPulseText('" + tid + "')", 1500);
    setTimeout("normalText('" + tid + "')", 1900);
    setTimeout("pulseText('" + tid + "')", 7000);
}
function normalText(tid) {
    var ele = document.getElementById(tid);
    if (ele == null) return false;
    ele.style.marginLeft = '0px';
    ele.style.marginTop = '0px';
    ele.style.fontSize = '12px';
    ele.style.fontWeigth = 'none';
    //alert('normalText' + tid);
}
function firstPulseText(tid) {
    var ele = document.getElementById(tid);
    if (ele == null) return false;
    ele.style.marginLeft = '0px';
    ele.style.marginTop = '-4px';
    ele.style.fontSize = '18px';
    ele.style.fontWeigth = 'bold';
    //alert('firstPulseText' + tid);
}
function secondPulseText(tid) {
    var ele = document.getElementById(tid);
    if (ele == null) return false;
    ele.style.marginLeft = '0px';
    ele.style.marginTop = '-4px';
    ele.style.fontSize = '18px';
    ele.style.fontWeigth = 'bold';
    //alert('secondPulseText' + tid);
}
var oldlid = null;
function setVideo(lid, vpid, app, tmid) {
    var slch = document.getElementById(vpid);
    if (document.getElementById(oldlid) != null) {
        var temp = document.getElementById(oldlid).parentNode;
        temp.className = temp.className.replace(' tdselected','');
    }
    oldlid = lid.id;
    if (lid.parentNode != null) {
        lid.parentNode.className += ' tdselected';
    }
    var burl = "";
    if (tmid != null) if (tmid != 'undefined') burl = "/DesktopModules/TroyDesign_TV/pages/banner.aspx?TMID=" + tmid;
	var temp = '<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" height="100%" width="100%" style="outline:none;">';
	temp += '<param name="source" value="' + app + '">';
	temp += '<param name="onerror" value="onSilverlightError">';
	temp += '<param name="background" value="#0a0a0a">';
	temp += '<param name="windowless" value="true">';
	temp += '<param name="minRuntimeVersion" value="2.0.31005.0">';
	temp += '<param name="autoUpgrade" value="true">';
	temp += '<param name="initparams" value="videoPath=' + lid.href + ',pathbanner=';
	if (burl != "") temp += burl;
	temp += ',auto=true"><center style="color: transparent;"><a>Se vuoi visualizzare il video installa Microsoft Silverlight</a></center><a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"><img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Installa Microsoft Silverlight" style="border-style: none;"></a>';
	temp += '</object>';
	slch.innerHTML = temp;
	return false;
}

