﻿
function showPassword ()
{
	document.getElementById( "objPasswordLabel" ).style.display = "none";
	document.getElementById( "objPasswordSpan" ).style.display = "block";
	document.getElementById( "objPassword" ).style.display = "block";
	document.getElementById( "objPassword" ).focus();
}

function initPassword()
{
    if(document.getElementById( "objPassword" ))
	{
        document.getElementById( "objPasswordLabel" ).style.display = "block";
	    document.getElementById( "objPassword" ).style.display = "none";
        document.getElementById( "objPasswordSpan" ).style.display = "none";
    }
}

function showLogin ()
{
    loginfield=document.getElementById( "objLogin" );
    if(loginfield.value=="Логин")
        loginfield.value = "";
}

function createXMLHttp() {

    if (window.ActiveXObject) {
      var aVersions = [ "MSXML2.XMLHttp.5.0",
        "MSXML2.XMLHttp.4.0","MSXML2.XMLHttp.3.0",
        "MSXML2.XMLHttp","Microsoft.XMLHttp"
      ];

      for (var i = 0; i < aVersions.length; i++) {
        try {
            var oXmlHttp = new ActiveXObject(aVersions[i]);			
            return oXmlHttp;
        } catch (oError) {
            //Do nothing
        }
      }
    }else if (typeof XMLHttpRequest != "undefined") {
        return new XMLHttpRequest();
    }
    throw new Error("XMLHttp object could be created.");
}
  

function btnRefresh_onclick() {	
	GetPage();    

}

function OpenMediaPlayerPVR(nID)
{
	window.open('/pvr_streamAPI.asp?id=' + nID + '&PHONENO=' + document.getElementById("PHONENO").value + '&PWD=' + document.getElementById("PWD").value + '&POSTBACKURL=player.asp&PID=' + document.getElementById("PID").value + '&AID=' + document.getElementById("AID").value+', "PVR", "height=400,width=400,status=no,toolbar=no,menubar=no"');
}

function openWin(url,width,height)
    {
        newWin = window.open(url, "", "width="+ width +",height="+ height +",toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes");
        newWin.focus();
    }

function inputMod(obj) 
{ 
 if (!obj.hlptext) obj.hlptext=obj.value 
 obj.value=(obj.hlptext==obj.value)?'':(obj.value=='')?obj.hlptext:obj.value 
}

function GetPage()
{
	var xmlHTTP = createXMLHttp();
	xmlHTTP.open("GET", "<%=sSource%>", false) ;
	xmlHTTP.setRequestHeader("Content-Type", "text/html; charset=utf-8" ) ;

	xmlHTTP.send("");
	document.getElementById("pvr_epg").innerHTML = xmlHTTP.responseText;

}

function openMediaTest( idName, id, sid, bIsTest )
{           
    var w;
    if(bIsTest)
        w = window.open('/player_tv_v3.aspx?sid=' + sid + '&idName=' + idName + '&id=' + id, 'player', "left=0,top=0,height=500,width=510,status=no,toolbar=no,menubar=no,location=no,resizable=no");
    else
        w = window.open('/player_tv.aspx?sid=' + sid + '&idName=' + idName + '&id=' + id, 'player', "left=0,top=0,height=536,width=1045,status=no,toolbar=no,menubar=no,location=no,resizable=no");
    w.focus();
}

function openMedia( idName, id,sid )
{
  var w;
  // very OLD 
  //window.open('player_tv.asp?sid='+sid+'&idName='+idName+'&id='+id,'player', "height=200,width=10,status=no,toolbar=no,menubar=no,location=no,resizable=yes");
  // OLD
  if(idName == "movie")
    //w = window.open('/player_tv.aspx?sid=' + sid + '&idName=' + idName + '&id=' + id, 'player', "left=0,top=0,height=536,width=1045,status=no,toolbar=no,menubar=no,location=no,resizable=no");
    w = window.open('/player_vod_v3.aspx?sid=' + sid + '&idName=movie&id=' + id, 'player', "left=0,top=0,height=500,width=510,status=no,toolbar=no,menubar=no,location=no,resizable=no");
  else // NEW
    w = window.open('/player_tv_v3.aspx?sid=' + sid + '&idName=' + idName + '&id=' + id, 'player', "left=0,top=0,height=500,width=510,status=no,toolbar=no,menubar=no,location=no,resizable=no");
  w.focus();
}

function openMediaVOD( idName, id,sid )
{
	window.open('/player_tvVOD.asp?sid='+sid+'&idName='+idName+'&id='+id,'player', "height=200,width=10,status=no,toolbar=no,menubar=no,location=no,resizable=yes");
}

function openInfo( id )
{
	window.open('/etv/etv_info.asp?id='+id, "info", "height=400,width=500,status=no,toolbar=no,menubar=no");
}
function openEtvPlayer( id )
{
	window.open('/etv/etv_player.asp?id='+id, "player", "height=500,width=650,status=no,toolbar=no,menubar=no");
}