﻿// JScript File
function LoadDisplayInformation()
{    
    try
    {
        var eDiv = document.getElementById('divPageAttributes');
        eDiv.style.width=screen.availWidth-100;
        eDiv.style.height=screen.availHeight-120;
    }
    catch(ex)
    {
      alert(ex);
    }
    return true;
}



function NaviagatePages(eurl)
{    
 
    if(eurl.length>0)
    {
        if(eurl.toLowerCase().indexOf('login')>=0)
        {
            if(document.getElementById('mobilenumber')!=null)
            {
                var eNo=document.getElementById('mobilenumber').value;
                if (eNo.toLowerCase()=='login')
                {
                    alert("Please Enter Valid Number");
                    return false;
                }

                if(!IsValidNumber(document.getElementById('mobilenumber').value))
                {
                    alert("Please Enter Valid Mobile Number");
                    return false;
                }
                eurl="Login.aspx?type=login&no="+document.getElementById('mobilenumber').value;
            }
            else
                eurl="Login.aspx?type=login";
                location.href= eurl;
            }
            else if(eurl.toLowerCase().indexOf('searchresults')>=0)
            {
                if(document.getElementById('searchtextbox')!=null)
                {
                    var eNo=document.getElementById('searchtextbox').value;
                    if (eNo.toLowerCase()=='search')
                    {
                        alert("Please Enter Valid Search text");
                        return false;
                    }
                    else if(eNo.length<=3)
                    {
                        alert("Search text should be greater than 3 characters");
                        return false;
                    }

                    eurl='default.aspx?pageid=searchresults&searchtext='+eNo;

                }
                else   
                {
                    alert("Please Enter Valid Search text")                ;
                    return false;
                }
                    location.href= eurl;
            }
            else if(eurl.toLowerCase().indexOf('genresearch')>=0)
            {
                if(document.getElementById('txtGenre')!=null)
                {
                    var eNo=document.getElementById('txtGenre').value;
                    if (eNo.length<=3)
                    {
                    alert("Search Text Should be greater than 3 Characters");
                    return false;
                    }

                   eurl='default.aspx?pageid=searchresults&searchtype=genresearch&cattype=g&searchtext='+eNo;                    
                }
                else
                {
                    alert("Please Enter Valid Search text")                ;
                    return false;
                }
                 location.href= eurl;
            }
            else if(eurl.toLowerCase().indexOf('publishersearch')>=0)
            {
                if(document.getElementById('txtPulisher')!=null)
                {
                    var eNo=document.getElementById('txtPulisher').value;
                        if (eNo.length<=3)
                        {
                        alert("Search Text Should be greater than 3 Characters");
                        return false;
                        }

                    eurl='default.aspx?pageid=searchresults&searchtype=publishersearch&cattype=g&searchtext='+eNo;                    
                }
                else
                {
                    alert("Please Enter Valid Search text")                ;
                    return false;
                }
                location.href= eurl;
           }
          else if(eurl.toLowerCase().indexOf('pricesearch')>=0)
          {
                if(document.getElementById('txtPrice')!=null)
                {
                   var eNo=document.getElementById('txtPrice').value;

                    if (eNo.length<2)
                    {
                        alert("Search Text Should not be  Empty");
                        return false;
                    }

                eurl='default.aspx?pageid=searchresults&searchtype=pricesearch&cattype=g&searchtext='+eNo;                    
           }
           else
           {
                alert("Please Enter Valid Search text");
                return false
           }
           location.href= eurl;
         }
         else
             location.href= eurl;

    }
}
//old for Menu Navigation
function OLDOnNavigateMenus(divInline,divIds)
{                

var eids = divIds.split(',');
var esel_style='';
var esel_css='';
var enew_style='';
var enew_css='';

    for(var i=0;i<eids.length;i++)
    {
        if(eids[i].length>3)
        {
            var ediv = document.getElementById('div_'+eids[i]);
                if(ediv!=null)        
                {
                    if(document.getElementById(eids[i]).style.display=='block')
                    {             

                      esel_style=ediv.getAttribute("style",true);
                      esel_css=ediv.getAttribute("refclass",true);
                    }
                    else
                    {                                
                      enew_style=ediv.getAttribute("style",true);
                      enew_css=ediv.getAttribute("refclass",true);
                    }
                }
                     
        } 
        for(var i=0;i<eids.length;i++)
        {
            if(eids[i].length>3)
            {

            var ediv = document.getElementById(eids[i]);
                if(ediv!=null)
                {                                
                ediv.style.display='none';

                }    
            }
        }       

        for(var i=0;i<eids.length;i++)
        {
            if(eids[i].length>3)
            {                   
                 var ediv = document.getElementById('div_'+eids[i]);  
                if(ediv!=null)
                {                                                                        
                ediv.setAttribute("style",enew_style,true);                         
                ediv.setAttribute("class",enew_css,true);     
                ediv.setAttribute("refclass",enew_css,true);                                                                
                }
            }
        } 

        var divsel= document.getElementById('div_'+divInline);
        if(divsel!=null)
        {         
            divsel.setAttribute("style",esel_style,true);                         
            divsel.setAttribute("class",esel_css,true);   
            divsel.setAttribute("refclass",esel_css,true);  
        }   
        var divDis= document.getElementById(divInline);
        if(divDis!=null)
        {         
            divDis.style.display='block';
        }      
        var hidItm = document.getElementById('hidDivItems');
        if(hidItm!=null)
        {
           
        hidItm.value = divInline ;  
        }
    }  
}


function OnNavigateMenus(divInline,divIds)
{                

    var eids = divIds.split(',');
    var esel_style='';
    var esel_css='';
    var enew_style='';
    var enew_css='';
    var ePrevStyle='';
    for(var i=0;i<eids.length;i++)
    {
        if(eids[i].length>3)
        {
         var ediv = document.getElementById('div_'+eids[i]);
            if(ediv!=null)        
            {
                if(document.getElementById(eids[i]).style.display=='block')
                {             
                    ePrevStyle=ediv;
                    esel_style=ediv.getAttribute("style",true);
                    esel_css=ediv.getAttribute("refclass",true);
                }
                else
                {                                
                    enew_style=ediv.getAttribute("style",true);
                    enew_css=ediv.getAttribute("refclass",true);
                }
            }
        }         
    } 
    for(var i=0;i<eids.length;i++)
    {
        if(eids[i].length>3)
        {          
          $("#"+eids[i]).hide();
        }
    }                   
     
    if(ePrevStyle!=null)
    {

        ePrevStyle.setAttribute("style",enew_style,true);                         
        ePrevStyle.setAttribute("class",enew_css,true);     
        ePrevStyle.setAttribute("className",enew_css,true);     
        ePrevStyle.setAttribute("refclass",enew_css,true);    
    }    
    var divsel= document.getElementById('div_'+divInline);
    if(divsel!=null)
    {         
        divsel.setAttribute("style",esel_style,true);                         
        divsel.setAttribute("class",esel_css,true);   
        divsel.setAttribute("className",esel_css,true);   
        divsel.setAttribute("refclass",esel_css,true);  
    }  

    $("#"+divInline).fadeIn();    
    var hidItm = document.getElementById('hidDivItems');
    if(hidItm!=null)
    {
         hidItm.value = divInline ;  
    }
 
}    

function OnMenuOver(did)
{
    if(document.getElementById(did)!=null)
    {
        document.getElementById(did).style.display='inline';
    }
}

function OnMenuOut(did)
{
    if(document.getElementById(did)!=null)
    {
     document.getElementById(did).style.display='none';
    }
}

function OnSearchCommand(tid,e)
{

    var code=e.keyCode? e.keyCode : e.charCode;
    if(code==13)
    {                

         var etext=document.getElementById(tid);
        if(etext!=null && etext.value.length>2)
        {
             var etexttype=etext.getAttribute('ref',true);
            if(etexttype!=null)
            {
                 var cattype= getParameter('cattype');
                if(cattype==null || cattype=="null")
                cattype='s';
                 var eURL='';
                switch(etexttype.toLowerCase())
                {
                    case 'search':
                        eURL='default.aspx?pageid=searchresults&searchtext='+etext.value;
                        //alert("Under Construction");
                        location.href= eURL;
                    break;
                    case 'login':
                        if(!IsValidNumber(etext.value))
                        {
                            alert("Please Enter Valid Mobile Number");
                            return false;
                        }
                        eURL="Login.aspx?type=login&no="+etext.value;
                        location.href= eURL;
                    break;
                }
            }
        }
        else
        {
            alert("Please Enter Valid Value");
        }
    }
}
function onClickTextBox(tid)
{
        var etext=document.getElementById(tid);
        if(etext!=null && etext.value.length>2)
        {
            var etexttype=etext.getAttribute('ref',true);
            if(etexttype!=null)
            {
                var cattype= getParameter('cattype');
                if(cattype==null || cattype=="null")
                cattype='s';
                var eURL='';
                switch(etexttype.toLowerCase())
                {
                    case 'search':
                        eURL='default.aspx?pageid=searchresults&searchtext='+etext.value;        
                        location.href= eURL;
                    break;
                    case 'login':
                        if(!IsValidNumber(etext.value))
                        {
                            alert("Please Enter Valid Mobile Number");
                            return false;
                        }
                        if(etext.value.length>7)
                        {
                            eURL="Login.aspx?type=login&no="+etext.value;
                            location.href= eURL;
                        }
                    break;
                }
            }
        }
}

function getParameter ( parameterName )
{         
    try
    {
        parameterName=parameterName.toLowerCase();

        var queryString = window.top.location.search.substring(1);
        queryString=queryString.toLowerCase();
        var parameterName = parameterName + "=";
        if ( queryString.length > 0 )
        {           
            begin = queryString.indexOf ( parameterName );            
            if ( begin != -1 )
            {            
                begin += parameterName.length;            
                end = queryString.indexOf ( "&" , begin );
                if ( end == -1 )
                {
                    end = queryString.length
                }        
                     return unescape( queryString.substring ( begin, end ) );
            }        
             return "null";
        }
    }
    catch(e)
    {
    }
    return '';
} 


function ToggleDiv(evt)
{

    var brtype=navigator.appName
    var divInner=null;
    var isvalid=1;
    divInner = document.getElementById(evt);       
    isvalid=0;
    var disValue=divInner.style.display;    
    if(navigator.userAgent.indexOf('Firefox')>=0 && disValue=='none')
    disValue='inline-block';     
    switch(disValue)
    {
        case "none":
            divInner.style.display = 'inline';			    
        break;
        case "inline":	
             divInner.style.display = 'none';

        break;
        case "inline-block":
              divInner.style.display = '-moz-inline-box';
        break;
        default:
             divInner.style.display = 'none';                
        break;

    }  
}


var Svalues="White,,images/Musicheading.gif,,arial,1,White,#2b2b2b,,,,1,150,,1,gray,5,24,0.5,,2,000000,,,,";			
var TipId="tipplayer";
var FiltersEnabled = 1; 

function stmPre(HdrVal,BodyVal)
{

}	

function initTips()
			{
				mig_clay()
			}		
			// [for IE5.5+] if your not going to use transitions or filters in any of the tips set this to zero.			
			
			function stmPreview(HdrVal,BodyVal)
			{
				stm("&nbsp;" + "MTN",BodyVal,Svalues.split(','));
			}		

function onSelectDropDownChanged(eDropID,eDynamic)
{
    try
    {

        if(eDropID!='')
        {   
           var eDropDown = document.getElementById(eDropID);
            if(eDropDown!=null && eDynamic=="true")
            {
                var eNavURL = eDropDown.value;
                if(eNavURL!='')
                {

                location.href= eNavURL;
                }
            }

        }
    }
    catch(e)
    {
    }
}
function IsValidNumber(eValue)
{
    try
    {

        var eva= parseInt(eValue);			        
        if(eva>=0)			        
            return true;
   }
   catch(e)
   {
         alert(e);
   }
    return false;
}

function SendValidFlashParameter(eid)
{

    var RParma='';
    var varparms=eid;


    if(varparms=='' || varparms=='null')
    {

        if(location.href.toLowerCase().indexOf("myphone.aspx")>=0)
        {

        return 'myphone';                
        }
        else  if(location.href.toLowerCase().indexOf("login.aspx")>=0)
        {
        return 'home';                
        }
        else
        return 'home';                
    }

    if(varparms!='')
    {

        if(varparms=="tartcont" )
        {
          RParma= "artistlisting";
        }
        else     if(varparms=="artistcontentpage" )
        {
            RParma= "artistlisting";
        }
        else if(varparms=="topcallertunez" )
        {
              RParma= "musichome";
        }
        else if(varparms=="subcategories"  || varparms=="genredetails")
        {
              RParma= "categories";                       
        }                       
        else if(varparms=="sportshome" || varparms=="soccernews")
        {
               RParma= "sportshome";
        }
        else if(varparms=="fifahome" ||varparms=="fifanews" ||varparms=="fifatop"  || varparms=="pslhome"|| varparms=="pslnews" || varparms=="eplhome" || varparms=="eplnews" || varparms=="soccerpremierleague")
        {
              RParma= "soccerhome";
        }
        else if(varparms=="wwwresults" || varparms=="wwwnews")
        {
              RParma= "wwehome";
        }
        else if(varparms=="wwwresults" || varparms=="wwwnews")
        {
              RParma= "wwehome";
        }
        else if(varparms=="gamedetails"  )
        {
               RParma= "gamehome";
        }
        else if(  varparms=="gamelisting")
        {
              RParma= "gamecategorieslisted";
        }
        else if(varparms=="articlepageint" || varparms=="articlesports" || varparms=="articletechno")
        {
            var fedtype=getParameter("feedtype"); 
            if(fedtype=="intnews"  || fedtype=="intnews_new")
              RParma= "localinternational";	
            else if(fedtype=="sanews")
              RParma= "localnews";
            else if(fedtype=="sportsnews")
              RParma= "sportsnews";
            else if(fedtype=="finance")
              RParma= "financenews";
            else if(fedtype=="motoring")
               RParma= "motoring";
            else if(fedtype=="technology")
              RParma= "technologynews";
            else
             RParma= "newsinfo";
        }
        else if(varparms=="wallpaperscnt" || varparms=="wallpaperssubcat")
        {
         RParma= "lifestylehome";
        }
        else if(varparms=="smsupdates"  )
        {
         RParma= "lifestylehome";
        }                          
    }

    return RParma; 
}



function MakeMenuHidden(eType)
{

}
function onRightClickPage()
{
    return false;
}
function createXMLHttpRequest()
{
    if (window.XMLHttpRequest)
    {
         return new XMLHttpRequest();
    }
    else if (window.ActiveXObject)
    {
        var msxmls = new Array(
        'Msxml2.XMLHTTP',
        'Microsoft.XMLHTTP');
        for (var i = 0; i < msxmls.length; i++) 
        {
            try
            {
            return new ActiveXObject(msxmls[i]);
            } catch (e)
            {}
        }
    }
    throw new Error("Could not instantiate XMLHttpRequest");
}



function LoadXML(url) 
{              
}

function SendValidTypeParameters(eid)
{                
    var RParma='';
    var varparms=eid;
    if(varparms!='')
    {       
 			if(varparms=="lifehome" )
             {
             RParma= "lifestylehome";
             }
			else if(varparms=="enthome" )
             {
             RParma= "entertainmenthome";
             }
			else if(varparms=="varing" )
             {
             RParma= "musichome";
			 }
			else if(varparms=="mhm_loaded" )
             {
             RParma= "musichome";
             }
			else if(varparms=="tfifa" )
             {
             RParma= "sportshome";
             }
    }
    if(RParma=='')
        RParma=eid;
    return RParma; 
}





function onMenuHover(itemid,vtype)
{
    var pItem = document.getElementById("pdiv_"+itemid);  
    var dItem = document.getElementById("divmn_"+itemid);  
    
     if(activemenuId!=itemid) 
     {
         if(pItem!=null )
         {
             if(vtype=='1')        
             {
                pItem.style.display='block';           
                if(dItem!=null)
                {
                    try
                    { 
                        dItem.style.paddingTop+=5;
                        dItem.style.paddingLeft+=5;
                    }
                    catch(e)
                    {
                    }
                }
             }
            else
            {
                pItem.style.display='none';        
                if(dItem!=null)
                {
                    try
                    {    
                    dItem.style.paddingTop-=5;
                    dItem.style.paddingLeft-=5;
                    }
                    catch(e)
                    {
                    }
                }
               
            }
        }
     }     
}





var activemenuId='';
function onMenuNaivationActivation(itemid,idList,vClr)
{

    var pItem = document.getElementById("pdiv_"+itemid);
    var imagItem = document.getElementById("divmn_"+itemid);
    var divItem =document.getElementById("div_"+itemid)
    activemenuId=itemid;
 
    var arridList=idList.split(',');
    for(var i=0;i<arridList.length;i++)
    {
    
        var Imgtemp = document.getElementById("divmn_"+arridList[i]);
        var DIVtemp = document.getElementById("div_"+arridList[i]);
 
            if(Imgtemp!=null)
            {
                var iact= Imgtemp.getAttribute('refactive',true);
                var iInact =Imgtemp.getAttribute('refinactive',true);
                Imgtemp.setAttribute('class',iInact,true);
                Imgtemp.setAttribute('className',iInact,true);
            }
            if(DIVtemp!=null)
            {
                DIVtemp.style.display='none';
            }
            if(pItem!=null)
            {
              pItem.style.display='none';
            }
            onItemHover(arridList[i],vClr,'2');
 
    }
    if(imagItem!=null && divItem!=null)
    {
        var iact= imagItem.getAttribute('refactive',true);
        imagItem.setAttribute('class',iact,true);
         imagItem.setAttribute('className',iact,true);
        divItem.style.display='block';
        pItem.style.display='block';
        onItemHover(itemid,vClr,'1');

    }
}
function onItemHover(itemid,vclr,vtype)
{    

    if( $(".liImages li a")!=null)
    {
        etemp=$(".liImages li a");  
      if(vtype=='1')
      {
            etemp.mouseover(function()
                {
                   etemp.css("background-image", "url(images/icons/navbackround/bg-"+vclr+".png)");               
                }
            ); 
            etemp.mouseout(function()
                {               
                   etemp.css("background", "");
                }
            ); 
       } 
       else
       {
         etemp.mouseover(function()
                {
                   etemp.css("background", "");               
                }
            ); 
            etemp.mouseout(function()
                {               
                   etemp.css("background", "");
                }
            ); 
       }
    }
}


 
function onMenuNavigationHome(eURl)
{
   location.href=eURl+"&hlt="+GetTicksValues();
}
function getParameterByURL ( parameterName,eURL )
{         
    try
    {
        parameterName=parameterName.toLowerCase();

        var queryString = '';
        if(eURL.indexOf('?')>0)
            queryString=queryString.substring(eURL.indexOf('?'));
        
        queryString=queryString.toLowerCase();
        var parameterName = parameterName + "=";
        if ( queryString.length > 0 )
        {           
            begin = queryString.indexOf ( parameterName );            
            if ( begin != -1 )
            {            
                begin += parameterName.length;            
                end = queryString.indexOf ( "&" , begin );
                if ( end == -1 )
                {
                    end = queryString.length
                }        
                     return unescape( queryString.substring ( begin, end ) );
            }        
             return "null";
        }
    }
    catch(e)
    {
    }
    return '';
} 

 function GetTicksValues()
{
    var currentTime = new Date();           
    return  currentTime.getUTCHours() +""+currentTime.getUTCSeconds()+""+currentTime.getUTCMinutes()+""+currentTime.getUTCDate();
}



   function GetWidthDetails()
   {
   
        var viewportwidth;
        var viewportheight;

        // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight

        if (typeof window.innerWidth != 'undefined')
        {
        viewportwidth = window.innerWidth;
        viewportheight = window.innerHeight;
        
        if(document.documentElement.scrollTop!=null)
        viewportheight=viewportheight+document.documentElement.scrollTop;
        }

        // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
        else
        {
            if(document.getElementsByTagName('body')[0].clientWidth!=null && document.getElementsByTagName('body')[0].clientHeight!=null)
            {
                  viewportwidth = document.getElementsByTagName('body')[0].clientWidth;
                  viewportheight = document.getElementsByTagName('body')[0].clientHeight;
            }
            else if (typeof document.documentElement != 'undefined'
            && typeof document.documentElement.clientWidth !=
            'undefined' && document.documentElement.clientWidth != 0)
            {
                viewportwidth = document.documentElement.clientWidth;
                viewportheight = document.documentElement.clientHeight;
            }
            
        }
            
           if(navigator.appName=='Netscape')
           {    
                 
           }
        
        return viewportwidth+"~"+viewportheight;
   }
   
   
function DetectPageLoad() {

    //        var ScookieVal =Get_Cookie('validrequestmtn');     
    //          var vurl=location.href;     
    //        if((ScookieVal!=null && ScookieVal.length>0) || vurl.indexOf("vReq")>0)
    //        {
    //            if(vurl.indexOf("?")<0)
    //            {
    //               vurl=vurl+"?vReq="+GetTicksValues();
    //               location.href=vurl;
    //            }
    //        }
    //        else
    //        {
    //            Set_Cookie("validrequestmtn","true");
    //                 
    //           if(vurl.indexOf("?")>0)
    //                vurl=vurl+"&vReq="+GetTicksValues();
    //            else
    //                vurl=vurl+"?vReq="+GetTicksValues();           
    //            location.href=vurl;
    //        }


    GetPageSession();


}

function Delete_Cookie() {
    document.cookie = null;
}

function Get_Cookie(check_name) {
    var a_all_cookies = document.cookie.split(';');
    var a_temp_cookie = '';
    var cookie_name = '';
    var cookie_value = '';
    var b_cookie_found = false; // set boolean t/f default f

    for (i = 0; i < a_all_cookies.length; i++) {
        a_temp_cookie = a_all_cookies[i].split('=');
        cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');


        if (cookie_name == check_name) {
            b_cookie_found = true;

            if (a_temp_cookie.length > 1) {
                cookie_value = unescape(a_temp_cookie[1]);
            }

            return cookie_value;
            break;
        }
        a_temp_cookie = null;
        cookie_name = '';
    }
    if (!b_cookie_found) {
        return null;
    }
}

function Set_Cookie(name, value) {
    document.cookie = name + "=" + value;

}

function getDistictURL(eURL) {
    if (eURL.indexOf("?") > 0) {
        eURL = eURL + "&vID=" + GetTicksValues();
    }
    else {
        eURL = eURL + "?vID=" + GetTicksValues();
    }
    location.href = eURL;
}

function updateObjectIframe(divID, sURL) {

    document.getElementById(divID).innerHTML = "<object id=\"ID_" + divID + "\" name=\"" + divID + "_Name\" type=\"text/html\" data=\"" + sURL + "\"><\/object>";
}

function LoadDIVHeightWidth(divID) {
    var eDetails = GetWidthDetails().split('~');
    if (eDetails.length > 1) {
        var ewidth = eDetails[0];
        var eHeight = eDetails[1];

        document.getElementById(divID).style.width = ewidth;
        document.getElementById(divID).style.height = eHeight;

    }
}

function LoadLanguages() {


    var vLanguge = '';

    var hidLan = document.getElementById('hidUserLanguate');
    if (hidLan != null) vLanguge = hidLan.value;
    if (vLanguge.length == 0 && document.cookie.indexOf("languages=") >= 0) {
        var vData = document.cookie.substring(document.cookie.indexOf("languages=") + 10, document.cookie.length);
        if (vData.length > 0 && vData.indexOf(';') > 0) vData = vData.substring(0, vData.indexOf(';'));
        var vLan = document.getElementById('secLanguages');
        vLanguge = vData;
    }

    if (getParameter('lan').length > 1 && vLanguge.length == 0) {
        vLanguge = getParameter('lan');
    }
    var vDivLang = document.getElementById('divLang');
    var isFirst = 0;
    if (vDivLang != null) {
        for (var i = 0; i < vDivLang.getElementsByTagName('input').length; i++) {
            var vRdio = vDivLang.getElementsByTagName('input')[i];

            if (vRdio.value == vLanguge) {
                vRdio.checked = "checked";
                var vAncID = vRdio.id.replace('rdio', 'anc');
                if (document.getElementById(vAncID) != null) {
                    document.getElementById(vAncID).href = getNavigateLanguages(vRdio.value);
                }
                document.getElementById(vAncID).style.display = 'none';
                vRdio.style.display = 'none';
            }
            else {

                var vAncID = vRdio.id.replace('rdio', 'anc');
                if (document.getElementById(vAncID) != null) {
                    document.getElementById(vAncID).setAttribute('href', getNavigateLanguages(vRdio.value));

                }
                //                              if(isFirst==1)
                //                              {
                //                                  document.getElementById(vAncID).style.display='none';
                //                                  vRdio.style.display='none';
                //                              }
                //                                    isFirst=1;         
            }
        }
    }

}

function setLanguageCookie(vlang) {
    document.cookie = "languages=" + vlang + ";";
    return true;
}

function LoadDivLanguages() {
    document.getElementById('divLang').style.display = "inline";
    return false;
}

function onNavigateLanguage(vid) {

    var vLan = document.getElementById(vid);

    var url = location.href;
    if (url.indexOf('?') < 0) {
        url = url + "?lan=" + vLan.value;
    }
    else {
        var vPrm = getParameter('lan');
        if (vPrm.length > 0 && vPrm != null) {
            url = url.replace("lan=" + vPrm, "lan=" + vLan.value);
        }
        else {
            url = url + "&lan=" + vLan.value;
        }
    }
    document.cookie = "languages=" + vLan.value + ";";
    location.href = url;
    return true;
}

function getNavigateLanguages(vLan) {

    var url = location.href;
    if (url.indexOf('?') < 0) {
        url = url + "?lan=" + vLan + "&refresh=true";
    }
    else {
        var vPrm = getParameter('lan');
        if (vPrm.length > 0 && vPrm != null) {
            url = url.replace("lan=" + vPrm, "lan=" + vLan);
        }
        else {
            var vPrmRef = getParameter('refresh');
            if (vPrmRef.length > 0) {
                url = url + "&lan=" + vLan
            }
            else url = url + "&lan=" + vLan + "&refresh=true";
        }
    }
    //           location.href=url;
    return url;
}


function createXMLHttpRequest() {
    if (window.XMLHttpRequest) {
        return new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        var msxmls = new Array('Msxml2.XMLHTTP', 'Microsoft.XMLHTTP');
        for (var i = 0; i < msxmls.length; i++) {
            try {
                return new ActiveXObject(msxmls[i]);
            } catch (e) {}
        }
    }
    throw new Error("Could not instantiate XMLHttpRequest");
}

function getLanguageText(vValue, vID) {

    if (vValue == '') return;
    var vLan = getParameter('lan');
    var url = 'ParseText.ashx';
    if (vLan.length > 1) url = 'ParseText.ashx?lan=' + vLan;

    var xmlHttp = createXMLHttpRequest();


    xmlHttp.open("POST", url, true);
    xmlHttp.setRequestHeader("headertext", vValue, false);

    xmlHttp.onreadystatechange = function () {
        if (xmlHttp.readyState == 4) {
            if (vID != null) {
                if (xmlHttp.status == 200) vID.innerHTML = xmlHttp.responseText;
            }
        }
    }
    xmlHttp.send(null);


}
var vLastPageloadTime;

function LogPageRequests() {

    try {
        if (vLastPageloadTime == null) {
            vLastPageloadTime = '';
        }
        var url = 'ParseText.ashx?req=logreq';
        var xmlHttp = createXMLHttpRequest();
        xmlHttp.open("POST", url, true);
        xmlHttp.setRequestHeader("requestinqueue", location.href, false);
        xmlHttp.setRequestHeader("lastloadtime", vLastPageloadTime, false);
        xmlHttp.onreadystatechange = function () {
            if (xmlHttp.readyState == 4) {
                if (xmlHttp.status == 200) {}
            }
        }
        xmlHttp.send(null);
    }
    catch (e) {}
}

function GetPageSession() {

    try {
        var url = 'ParseText.ashx?req=session&reqidvar' + GetTicksValues();
        var xmlHttp = createXMLHttpRequest();
        xmlHttp.open("GET", url, false);
        var hidVal = '';
        if (document.getElementById('hidSessionvalue') != null) hidVal = document.getElementById('hidSessionvalue').value;
        xmlHttp.setRequestHeader("requrl", location.href, false);
        xmlHttp.setRequestHeader("hiddenvalue", hidVal, false);
        xmlHttp.send(null);
        var vResp = xmlHttp.responseText;
        if (vResp.length > 1) {
            var vurl = location.href;
            if (vurl.indexOf('?') > 0) {
                vurl = vurl + "&vReq=" + GetTicksValues();
            }
            else {
                vurl = vurl + "?vReq=" + GetTicksValues();
            }
            var vCoo = Get_Cookie("validrequestmtn");
            if (vCoo != "true") {
                Set_Cookie("validrequestmtn", "true");
                location.href = vurl;
            }
        }
    }
    catch (e) {}
}
var dwnClick = 1;

function downloadcontent(imgID) {

    try {
        if (dwnClick == '1') {
            dwnClick = '0';
            if (document.getElementById(imgID) != null) {
                document.getElementById(imgID).setAttribute('disabled', 'disabled', true);
            }
            if (document.getElementById('div_error_download_response') == null) {
                alert("Processiog");
            }
            else {
                document.getElementById('div_error_download_response').innerHTML = "Processing..";
            }
            var url = 'ParseText.ashx?req=download&reqidvar' + GetTicksValues();
            var xmlHttp = createXMLHttpRequest();
            xmlHttp.open("GET", url, false);
            xmlHttp.setRequestHeader("requrl", location.href, false);
            xmlHttp.send(null);
            var vResp = xmlHttp.responseText;
            if (vResp.length > 0) {
                if (document.getElementById('div_error_download_response') == null) {
                    alert(vResp);
                }
                else {
                    document.getElementById('div_error_download_response').innerHTML = vResp;
                }
            }
        }
    }
    catch (e) {}
}



/* MTN TRACE*/

function CheckMTNTrace()
{
        var TraceURl = "MTNTrace.ashx?tms="+GetTicksValues();

         $.ajax({
                type:"GET",
                async: false,
                cache: false,
                url:TraceURl,
                
                success:function(resp)
                        {
                        
                           if(resp.indexOf('.aspx')>=0)
                           {
                           
                            location.href=resp;
                            return;
                           }
                        }                        
            });
    
}


///MTN FootBall

function ProcessMyFootBallTeams()
{
    try
    {
    var vIds='';
        $('#mtnfootballteams tr td input').each(function(e){
                
            if($(this).attr('type')=="checkbox"  && $(this).is(':checked') )
            {       
                vIds+=$(this).attr('value')+",";
            }
        });
        
        ///alert(vIds); List Of Contentid selected.
        if(vIds.length==0)
        {
            alert("Please Select the Content");
            return false;
        }
        else
        {
           var url = 'default.aspx?pageid=footballgoback&selcid='+vIds+'&ftype=selectteams';
            location.href=url;
            //// redirect to 
        }
        
    }
    catch(e){

    }
    return false;
}

function ProcessMyFootBallFullPack()
{

    try
    {
        var vIds='';            

        var doc = document.getElementById('footballPack');        
        if(doc!=null)
        {       
            var ids = doc.getElementsByTagName('input');      
   
            if(ids!=null && ids.length>0)
            {            

                for(var j=0;j<ids.length;j++)
                {                 
                    var att= ids[j].getAttribute('type');                    
                    if(att!=null && att=='checkbox')
                    {

                            if(ids[j].checked)
                            {                            
                              vIds+= ids[j].getAttribute('value')+",";
                            }                                        
                    }
                }
            }            
        }        
        if(vIds.length==0)
        {
            alert("Please Select the Content");
            return false;
        }
        else
        {
           var url = 'default.aspx?pageid=footballmanagefullfootball&selcid='+vIds+'&ftype=selectfullpack';
            location.href=url;         
        }
        
    }
    catch(e){

    }
    return false;
}

function ProcessMyFootBallLeague()
{
    try
    {
    var vIds='';
        $('#mtnfootballleague tr td input').each(function(e){
                
            if($(this).attr('type')=="checkbox"  && $(this).is(':checked') )
            {       
                vIds+=$(this).attr('value')+",";
            }
        });
        
        ///alert(vIds); List Of Contentid selected.
        if(vIds.length==0)
        {
            alert("Please Select the Content");
            return false;
        }
        else
        {
            var url = 'default.aspx?pageid=footballgoback&selcid='+vIds+'&ftype=selectleague';
            location.href=url;
            //// redirect to 
        }
        
    }
    catch(e){

    }
    return false;
}
function ProcessMyFootBallTornament()
{
    try
    {
    var vIds='';
        $('#mtnfootballtornament tr td input').each(function(e){
                
            if($(this).attr('type')=="checkbox"  && $(this).is(':checked') )
            {       
                vIds+=$(this).attr('value')+",";
            }
        });
        
 
        if(vIds.length==0)
        {
            alert("Please Select the Content");
            return false;
        }
        else
        {
            var url = 'default.aspx?pageid=footballgoback&selcid='+vIds+'&ftype=selecttornament';
            location.href=url;
 
        }
        
    }
    catch(e){

    }
    return false;
}


function BindFootBallTeams()
{
    var Cid = getParameter('selcid');
    var mnu=getParameter('ftype')
    var rmnu=getParameter('refftype')
    
    if(Cid!='' )
    {
         $.ajax({
                type:"GET",
                async: false,
                cache: false,
                url:"MTNFOOTBALL.ashx?req="+mnu+"&cid="+Cid+"&reftype="+rmnu,
                success:function(resp)
                        {
                            if(resp!='')
                            {   
                                if(resp=="ERROR")
                                {                                   
                                     $('#Footballteams').html("Please login to subscribe the selected content.");
                                }
                                else                   
                                  $('#Footballteams').html(resp);
                            }                            
                        }                        
            });
    }
}
function BindMyServices()
{
    
 
       var Cid = getParameter('selcid');
     
         $.ajax({
                type:"GET",
                async: false,
                cache: false,
                url:"MTNFOOTBALL.ashx?req=footballmyservices",
                success:function(resp)
                        {
                            if(resp!='')
                            {   
                                if(resp=="ERROR")
                                {
                                    alert("Please Login");
                                     $('#Footballteams').html("Please login to subscribe the selected content.");
                                }
                                else                   
                                  $('#Footballteams').html(resp);
                            }                            
                        }                        
            });
    
}
function BindFullfootBallMyServices()
{
    
 
       var Cid = getParameter('selcid');
     
         $.ajax({
                type:"GET",
                async: false,
                cache: false,
                url:"MTNFOOTBALL.ashx?req=footballmyservices&cid="+Cid,
                success:function(resp)
                        {
                            if(resp!='')
                            {   
                                if(resp=="ERROR")
                                {
                                    alert("Please Login");
                                     $('#Footballteams').html("Please login to subscribe the selected content.");
                                }
                                else                   
                                  $('#Footballteams').html(resp);
                            }                            
                        }                        
            });
    
}

function unsubscribe(id)
{

var rmnu=getParameter('refftype')
  $.ajax({
                type:"GET",
                async: false,
                cache: false,
                url:"MTNFOOTBALL.ashx?cid="+id+"&req=unsubscribe",
                success:function(resp)
                        {
                            if(resp!='')
                            {   
                                if(resp=="ERROR")
                                {
                                    
           $('#Footballteams').html("Please login to subscribe the selected content.");
                                }
                                else                   
                                  $('#Footballteams').html(resp);
                            }                            
                        }                        
            });
    
}

function BindFootBallContent()
{
    var Cid = getParameter('selcid');
    var mnu=getParameter('ftype')
    
    if(Cid!='' )
    {
         $.ajax({
                type:"GET",
                async: false,
                cache: false,
                url:"MTNFOOTBALL.ashx?req="+mnu+"&cid="+Cid,
                success:function(resp)
                        {
                         
                            if(resp!='')
                            {
                                  $('#FootballLeague').html(resp);
                            }                            
                        }                        
            });
    }
}

function BindFootBallTornament()
{
    var Cid = getParameter('selcid');
    var mnu=getParameter('ftype')
    
    if(Cid!='' )
    {
         $.ajax({
                type:"GET",
                async: false,
                cache: false,
                url:"MTNFOOTBALL.ashx?req="+mnu+"&cid="+Cid,
                success:function(resp)
                        {
                            if(resp!='')
                            {
                                if(resp=="ERROR")
                                   $('#Footballteams').html("Please login to subscribe the selected content.");
                                else
                                  $('#FootballTornament').html(resp);
                            }                            
                        }                        
            });
    }
}

function BindFootBallLeages()
{
    var Cid = getParameter('selcid');
    
    if(Cid!='' )
    {
         $.ajax({
                type:"GET",
                async: false,
                cache: false,
                url:"MTNFOOTBALL.ashx?req=selectteams&cid="+Cid,
                success:function(resp)
                        {
                            if(resp!='')
                            {
                                  $('#FootballLeague').html(resp);
                            }                            
                        }                        
            });
    }
}

function CancelSelected()
{

var mnu=getParameter('ftype')

    if(mnu=="selectteams")
    {
        location.href='default.aspx?pageid=footballpackage';
    }
    else     if(mnu=="selectleague")
    {
        location.href='default.aspx?pageid=footballleague';
    }
    else     if(mnu=="selecttornament")
    {
        location.href='default.aspx?pageid=footballtournament';
    }
    else     if(mnu=="selectfullpack")
    {
        location.href='default.aspx?pageid=footballfullpack';
    }
    
}

function SubmitGetRespons()
{
    var Cid = getParameter('selcid');
    var mnu=getParameter('ftype')
    var hrf= "default.aspx?pageid=footballcongrates&ftype=subscribe&refftype="+mnu+"&selcid="+Cid;
    location.href=hrf;
    
}
function CheckIsFullPackage()
{
  
     
         $.ajax({
                type:"GET",
                async: false,
                cache: false,
                url:"MTNFOOTBALL.ashx?req=isfullfootballuser",
                success:function(resp)
                        {
        
                           if(resp=="ERROR")
                           $('#fullpackid').html("Please login to subscribe the selected content.");
                           else if(resp=='Y')
                           {
                                  location.href="default.aspx?pageid=footballfullpack"
                           }                            
                        }                        
            });
    
    
}

function GetFullFootBallServiceID()
{
  $.ajax({
                type:"GET",
                async: false,
                cache: false,
                url:"MTNFOOTBALL.ashx?req=getservices",
                success:function(resp)
                        {

                           if(resp=="ERROR")
                           alert("Please login to subscribe the selected content.");
                           else if(resp.length>0)
                           {
                                  var vIdList = resp.split(',');
                                  for(i=0;i<vIdList.length;i++)
                                  { 
                                    if(vIdList[i].length>0)
                                    {
                                        if($('#'+vIdList[i]).length>=0)
                                        {
                                            $('#'+vIdList[i]).attr('checked', true);
                                        }
                                    }
                                  }
                           }                            
                        }                        
            });
}

function ManageFullFootBall(Subscribe,unsubscribe)
{

    $.ajax({
                type:"GET",
                async: false,
                cache: false,
                url:"MTNFOOTBALL.ashx?req=managefullfootball&sub="+Subscribe+"&unsub="+unsubscribe,
                success:function(resp)
                        {
        
                           if(resp=="ERROR")
                           alert("Please login to subscribe the selected content.");
                           else if(resp.length>0)
                           {
                                   $('#Footballteams').html(resp);
                           }                            
                        }                        
            });
}



function isUserLogin(url)
{
   $.ajax({
                type:"GET",
                async: false,
                cache: false,
                url:"parseText.ashx?req=islogin",
                success:function(resp)
                        {
        
                           if(resp=="")
                           alert("Please login to subscribe the selected content.");
                           else if(resp.length>0)
                           {
                              location.href=url;
                           }                            
                        }                        
            });
            return false;
}

function ViewSummary()
{
  
         $.ajax({
                type:"GET",
                async: false,
                cache: false,
                url:"MTNFOOTBALL.ashx?req=isViewSummary",
                success:function(resp)
                        {       
                          if(resp.length>0)
                           {
                                   $('#Footballteams').html(resp);
                           }                             
                        }                        
            });
}

