﻿        
function ShowDetail(evnt,title)
{
	var w = 300, h = 200;

	        if (document.all) 
	        {
	           /* the following is only available after onLoad */
	           w = document.body.clientWidth;
	           h = document.body.clientHeight;
	        }
	        else if (document.layers) 
	        {
	           w = window.innerWidth;
	           h = window.innerHeight;
	        }

	        var popW = 400, popH = 450;
	        var leftPos = (w-popW)/2, topPos = (h-popH)/2;

	        if (evnt!="")
	        {
		        window.open('detail.aspx?e='+evnt+'&t='+title,'',config='scrollbars=yes,width=' + popW + ',height='+popH+',top='+topPos+',left='+leftPos);

	        }
	        else
	        {
		        window.open('search.aspx','',config='scrollbars=yes,width=' + popW + ',height='+popH+',top='+topPos+',left='+leftPos);
	        }
        }

        function ShowChannelDetail(ch,name)
        {
	        var w = 300, h = 200;

	        if (document.all) 
	        {
	           /* the following is only available after onLoad */
	           w = document.body.clientWidth;
	           h = document.body.clientHeight;
	        }
	        else if (document.layers) 
	        {
	           w = window.innerWidth;
	           h = window.innerHeight;
	        }

	        var popW = 550, popH = 450;
	        var leftPos = (w-popW)/2, topPos = (h-popH)/2;

	        if (ch!="")
	        {
		        window.open('detailch.aspx?c='+ch+'&n='+name,'',config='scrollbars=yes,width=' + popW + ',height='+popH+',top='+topPos+',left='+leftPos);
	        }
	        else
	        {
		        window.open('search.aspx','',config='scrollbars=yes,width=' + popW + ',height='+popH+',top='+topPos+',left='+leftPos);
	        }
        }

        function ShowTrailer(p,t)
        {
	        var w = 300, h = 200;

	        if (document.all) 
	        {
	           /* the following is only available after onLoad */
	           w = document.body.clientWidth;
	           h = document.body.clientHeight;
	        }
	        else if (document.layers) 
	        {
	           w = window.innerWidth;
	           h = window.innerHeight;
	        }

	        var popW = 360, popH = 280;
	        var leftPos = (w-popW)/2, topPos = (h-popH)/2;
	        window.open('trailer.aspx?p='+p+'&t='+t,'',config='scrollbars=yes,width=' + popW + ',height='+popH+',top='+topPos+',left='+leftPos);

        }

      
        var requestURL = "programContent.aspx";       
        var channel="99999";
        var appendlink = "";        
        var obj;
        
        function show_data(strName,airtitle,vc,el) 
        {         
            
            var ct;
            if ($F('HiddenLoginStatus')=="0")
                ct=0;
            else 
                ct=1;                
                
            if (channel==vc && obj==el)
            {
                Effect.SlideUp($(channel + "1"));
                $(channel).innerHTML = "";                
                obj.parentNode.style.backgroundColor ="white"; 
                channel="99999";                               
            }
            else
            {  
                if(channel!="99999")
                    obj.parentNode.style.backgroundColor ="white";
                el.parentNode.style.backgroundColor ="#f5f5f5";
                obj=el;
                $(channel).innerHTML = "";
                channel=vc;                
                if (strName.length > 0)
                {                   
                    var par='e=' + strName + '&t=' + airtitle + '&v=' + vc + '&c=' + ct;                                        
                    var ajaxRequest = new Ajax.Request(requestURL,{method:'get',parameters:par,onComplete:function(oRes){
                        $(channel).innerHTML = oRes.responseText;
                        Effect.SlideDown($(channel + "1"));  
                    }
                    });                   
                } 
            }
       } 

        function update_data() 
        {
            //$(div1).innerHTML ='';
            par='e=0&t=0&v=0&c=2';                                        
            var ajaxUpdate = new Ajax.Updater('div1',requestURL,{method:'get',parameters:par});
            
       }
       
 
 //added by Rao
 
 function changeTab(id)
    {
     	
        var tab;
     	var div;     	
    
	for (var i=1; i<2; i++)
     	{
		tab="tab" + i;
		div="div" + i;
		

		if(id==i)  
		{
			if($(div).style.display=='')
			{
			    $(tab).className="tab_selected";
			    $(div).style.display='';			    	
			}
			else
			{
			    $(tab).className="tab";	
			    $(div).style.display='';			    				    
			}					
		}
		else
		{			
			$(tab).className="tab";
			$(div).style.display='';						
		}
		

	}

     }     
     


function logpopup()
{     
     var leftPos=(window.screen.width/2) - (450 + 10);
     var topPos=(window.screen.height/2) - (200 + 50);
     window.open('GuideLogin.aspx','',config='scrollbars=no,width=450,height=200,toolbar=no,resizable=no,location=no,status=no,menubar=no,left=' + leftPos + ',top=' + topPos);
}
     
  
  function RecordToDB()
  { 
    
    var par='css=' + $F('HiddenCSS') + '&camc=' + $F('camList') + '&ea=' + $F('HiddenEAddress');
    par=par + '&vc=' + channel + '&st=' + $F('HiddenSdate') + '&et=' + $F('HiddenEdate') + '&tm=' + $F('HiddenTmsid') + '&pr=' + getRadioValue('recPriority');
    par=par + '&tit=' + $F('HiddenTitle') + '&dvr=' + getSelectText('camList');
       
    var ajaxRequest = new Ajax.Request('RecordDVR.aspx',{method:'get',parameters:par,onComplete:function(oRes)
    {
        if(200==oRes.status)
        {            
            if(oRes.responseText!="False")
            {                
               $('div1').innerHTML=oRes.responseText;                                      
            } 
        }
    }
    });   
    
  }  
  
  // return the value of the selected Radio button
  function getRadioValue(idOrName) 
  {        
  var value = null;        
  var element = document.getElementById(idOrName);        
  var radioGroupName = null;                  
  // if null, then the id must be the radio group name        
  if (element == null) 
  {                
  radioGroupName = idOrName;        
  } 
  else 
  {                
  radioGroupName = element.name;             
  }        
  if (radioGroupName == null) 
  {                
  return null;        
  }        
  var radios = document.getElementsByTagName('input');        
  for (var i=0; i<radios.length; i++) 
  {                
  var input = radios[ i ];                    
  if (input.type == 'radio' && input.name == radioGroupName && input.checked) 
  {                                                  
  value = input.value;                        
  break;                
  }        
  }        
  return value;
  }
     
  
  function GuideLogin()
  {
    var par='ea=' + encodeURI($F('txtemailadd')) + '&pw=' + encodeURI($F('txtpwd'));
    
    var ajaxRequest = new Ajax.Request('GuideLogin.aspx',{method:'get',parameters:par,onComplete:function(oRes)
    {
        if(200==oRes.status)
        {
            if(oRes.responseText=="True")
            {               
               Modalbox.hide();
               update_data();
               $('HiddenLoginStatus').value=1;
            }
            else
            {              
              $(loginReq).style.display='';
              document.getElementById('txtpwd').value="";               
            } 
        }
    }
    });
    
  }  
  
  function getSelectText(idOrName) 
  {   
  var value = null;  
  var s = document.getElementById(idOrName);
  for(var i=0; i<s.options.length; i++){
    if(s.options[i].selected){
        value=s.options[i].text; 
        break;
    }
    }
  return value;  
}

//imagelading effect

function startLoading() {
    loaded = false;
    window.setTimeout('showLoadingImage()', 1000);
  }

  function showLoadingImage() {
    var el = document.getElementById("loading_box");
    if (el && !loaded) {
        el.innerHTML = '<img src="images/loading.gif">';
        new Effect.Appear('loading_box');
    }
  }

 function stopLoading() {
    Element.hide('loading_box');
    loaded = true;
  }

Ajax.Responders.register({
    onCreate : startLoading,
    onComplete : stopLoading
  });
  
  function CheckLogin(titleString)
{
   Modalbox.show('Login.aspx', {title:titleString, width: 500});   
}

function hi(msgstr)
{
 alert(msgstr); 
}

  



	


