﻿// JScript File
browser_version = parseInt(navigator.appVersion);
browser_type = navigator.appName;


function ActivateSTB()
{    
    document.getElementById('displayDiv').innerHTML =""
    document.getElementById('displayDiv').innerHTML ="<div id='ProgressDiv' align=center><br/><br/><br/><br/><br/><img src='Images/SIBgImages/loaderQA.gif'  alt='Processing...Please wait...' /></div>";
    var params = 'Action=ACTIVATE';
    var myAsync = new Ajax.Request('STBValidate.ashx',{method: 'post',postBody: params,onSuccess: showActivateStatus,onFailure: showErrorMessage}); 
}

function RefreshPage()
{    

    var params = 'Action=REFRESH';
    var myAsync = new Ajax.Request('STBValidate.ashx',{method: 'post',postBody: params,onSuccess: showActivateStatus,onFailure: showErrorMessage}); 
}


function showChannelSchedule(originalRequest)
{

  if (originalRequest.responseText!="")
  {
  //alert(originalRequest.responseText);
    if(originalRequest.responseText.indexOf('</div>')>-1)
    {
    document.getElementById('txtActivationCode').value="";
    document.getElementById('txtZipCode').value="";
    document.getElementById('divError').innerHTML="";
    document.getElementById('displayDiv').innerHTML ="";
    document.getElementById('displayDiv').innerHTML=originalRequest.responseText;
    }
    else
    {
    document.getElementById('SAStep2').style.display="block";
    document.getElementById('ProgressDiv').style.display="none";
    errorDiv();
    document.getElementById('divError').style.display="block";
    document.getElementById('divError').innerHTML="";
    document.getElementById('divError').innerHTML="<strong>"+originalRequest.responseText+"</strong>";
    //alert(originalRequest.responseText);
    }
    
  }
}

function errorDiv()
{
    if (browser_type == "Netscape" && (browser_version >= 4)) 
	{
	document.getElementById('divNoti').style.top = "65px";
	document.getElementById('divNoti').style.height="23px";
	document.getElementById('divNoti').style.position="relative";
	document.getElementById('imgNoti').style.position="absolute";
	 document.getElementById('divNoti').style.display="block";
	 document.getElementById('divActInfo').className="ActInfoMZ";
	
	
	}
	else
	{
	 document.getElementById('divNoti').style.display="block";
	}


}

function showErrorMessage(originalRequest)
{
    //alert(originalRequest.responseText);
   
}

var rdbCheck;
function ContinueSTB()
{
       if(rdbCheck=="true")
       {
        if(document.getElementById('rdb3').checked)
        {
        document.getElementById('displayDiv').innerHTML =""
        document.getElementById('displayDiv').innerHTML ="<div id='ProgressDiv' align=center><br/><br/><br/><br/><br/><img src='Images/SIBgImages/loaderQA.gif'  alt='Processing...Please wait...' /></div>";
        var params = 'Action=REACTIVATE';
        var myAsync = new Ajax.Request('STBValidate.ashx',{method: 'post',postBody: params,onSuccess: showActivateStatus,onFailure: showErrorMessage}); 

        }
        else
        {
        callAssistantDIV();
        
        }
        }
        else
        {
        alert("Please choose one of the options to help us troubleshoot the problem.");
        }

}
	
function setActVal(obj)
{
        //alert(obj);
        rdbCheck="true";
        if(obj=='rdb1')
        {
        document.getElementById('rdb1').checked=true;
        document.getElementById('rdb2').checked=false;
        document.getElementById('rdb3').checked=false;
        }
        if(obj=='rdb2')
        {
        document.getElementById('rdb2').checked=true;
        document.getElementById('rdb1').checked=false;
        document.getElementById('rdb3').checked=false;
        }
        if(obj=='rdb3')
        {
        document.getElementById('rdb3').checked=true;
        document.getElementById('rdb2').checked=false;
        document.getElementById('rdb1').checked=false;
        }

        }
        
        
        
function showDivPopup(DivTitle,DivId)
{
    
	//hideDropDown();
	document.getElementById('EmptyDiv').style.height =document.body.scrollHeight;
	document.getElementById('EmptyDiv').style.display = "block";
	DivY=(document.body.clientHeight)/2-118;
	DivX=(document.body.clientWidth)/2-120;
	if(DivId=='Activation' || DivId=='SelfActivation') 
	{
	if (browser_type == "Microsoft Internet Explorer" && (browser_version >= 4)) {
	document.getElementById('DivPopUp').style.left = DivX-100;
	}
	else
	{
	document.getElementById('DivPopUp').style.left = DivX-100+'px';
	}
	}
	else if(DivId == 'ChannelDesc') 
	document.getElementById('DivPopUp').style.left = DivX-100;
	else
	document.getElementById('DivPopUp').style.left = DivX;
	
	if(DivId == 'ChannelDesc') 
	document.getElementById('DivPopUp').style.top = topval;
	else
	{
	if (browser_type == "Microsoft Internet Explorer" && (browser_version >= 4)) 
	{
	document.getElementById('DivPopUp').style.top = DivY-50;
	
	}
	else
	{
	document.getElementById('DivPopUp').style.top = DivY-50+'px'
	}
	
	}
	setDivPopUpWidth(DivId);
	document.getElementById('DivPopUp').style.display = "block";
	if(DivId=='SelfActivation') {
	if (browser_type == "Microsoft Internet Explorer" && (browser_version >= 4)) 
	{
	document.getElementById('EmptyDiv').className='EmptyDivAct';
	document.getElementById('DivPopUp').className='DVRPopUp';
	
	}
	else
	{
	
	document.getElementById('EmptyDiv').style.height=document.body.clientHeight+'px';//"1030px";
	document.getElementById('EmptyDiv').style.display="block";
	document.getElementById('EmptyDiv').className='EmptyDivAct';
//	document.getElementById('DivPopUp').style.left="283.5px"; 
//	document.getElementById('DivPopUp').style.top="167.5px";
//	document.getElementById('DivPopUp').style.width="475px";
//	document.getElementById('DivPopUp').style.display="block";
	document.getElementById('DivPopUp').className='DVRPopUp';
	}
	
	document.getElementById('DivPopUp').innerHTML = '<div class="DVRPopUpT"><div class="DVRPopUpTL">'+DivTitle+'</div><div class="DVRPopUpTR"><div class="DVRClose" title="Close" onClick="hideDivPopUp();"></div></div></div><div class="DVRPopUpM" id="DivPopUpM"></div><div class="DVRPopUpB"></div>';
	if(DivId=='Activation')
	document.getElementById('DivPopUpM').className='DVRPopUpM';
	else
	document.getElementById('DivPopUpM').className='DVRPopUpMSA';
	}
	else if(DivId == 'ChannelDesc') {
	document.getElementById('EmptyDiv').className='EmptyDiv';
	document.getElementById('DivPopUp').className='DVRPopUp';
	document.getElementById('DivPopUp').innerHTML = '<div class="DVRPopUpT"><div class="DVRPopUpTL">'+DivTitle+' <span class="DVRPopUpTxt">(2008)</span></div><div class="DVRPopUpTR"><div class="WinPopout" title="Pop Out"></div><div class="DVRClose" title="Close" onClick="hideDivPopUp();"></div></div></div><div class="DVRPopUpMCD"><div class="CDDiv" id="DivPopUpM"></div></div><div class="DVRPopUpB"></div>';
	}
	else {
	document.getElementById('EmptyDiv').className='EmptyDiv';
	document.getElementById('DivPopUp').className='DivPopUp';
	document.getElementById('DivPopUp').innerHTML = '<div class="DivPopUpT"><div class="DivPopUpTL">'+DivTitle+'</div><div class="DivPopUpTR"><div class="DivPopClose" title="Close" onClick="hideDivPopUp();"></div></div></div><div class="DivPopUpM" id="DivPopUpM"></div><div class="DivPopUpB"></div>';
	}
	if (DivId == 'SelfActivation')
	{
//	if (document.getElementById('hdnStatus').value=='SUCCESS')
//    {
//        var params = 'Action=SUCCESS';
//        var myAsync = new Ajax.Request('STBValidate.ashx',{method: 'post',postBody: params,onSuccess: showSuccessStatus,onFailure: showErrorMessage}); 
//    }
	document.getElementById('DivPopUpM').innerHTML="";
	document.getElementById('DivPopUpM').innerHTML=document.getElementById('SAStep7').innerHTML;
	
	
	}
}
	
	function showSuccessStatus(originalRequest)
	{
	document.getElementById('DivPopUpM').innerHTML=originalRequest.responseText;
	
	}
	function setDivPopUpWidth(DivId)
	{
		if(DivId=='ARChannel' || DivId == "STBAct")
		document.getElementById('DivPopUp').style.width='500px';
		else if(DivId=='Favorite')
		document.getElementById('DivPopUp').style.width='345px';
		else if(DivId=='PCHelp')
		document.getElementById('DivPopUp').style.width='300px';
		else if(DivId=='Locate')
		document.getElementById('DivPopUp').style.width='280px';
		else if(DivId=='Activation' || DivId=='SelfActivation')
		document.getElementById('DivPopUp').style.width='475px';
		else if(DivId=='ChannelDesc')
		document.getElementById('DivPopUp').style.width='650px';
		else	
		document.getElementById('DivPopUp').style.width='240px';
}
function hideDivPopUp()
{
document.getElementById('EmptyDiv').style.display = "none";
document.getElementById('DivPopUp').style.display = "none";
}

browser_version = parseInt(navigator.appVersion);
browser_type = navigator.appName;
xpos = null;
ypos = null
if (!document.all) {
	document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove = MousePosition;
function MousePosition(evt){
 try{
	if (document.all) {
	    
		xpos = window.event.x + document.body.scrollLeft;
		ypos = window.event.y + document.body.scrollTop;
		
	}
	else{
		xpos = evt.pageX-30;
		ypos = evt.pageY-98;
	}
	}
	catch(ex){}
}
function showPops(PopupId){
	
	var MaxX = document.body.clientWidth;
	var DivWidth = document.getElementById(PopupId).clientWidth;
	if((xpos + DivWidth)>MaxX){
		xpos = MaxX - DivWidth-20;
		if(!document.all){
			xpos=xpos-35;
		}
	}

	if (browser_type == "Netscape" && (browser_version >= 4)) 
	{
		if (PopupId=='SkipPopup') {
		document.getElementById(PopupId).style.left= screen.width/2+232;
		document.getElementById(PopupId).style.top=ypos + 80 + 'px';
		}
	}
	else
	{
		if (PopupId=='SkipPopup') {
		document.getElementById(PopupId).style.left= screen.width/2+230;
		document.getElementById(PopupId).style.top=ypos - 28 + 'px';
		}
	}
	document.getElementById(PopupId).style.visibility='visible';
	//Effect.BlindDown(PopupId,{duration:0.6});return false;
}


function closeSkipPops(PopDivName){
	document.getElementById(PopDivName).style.visibility='hidden';
}
