﻿// 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;
        }
    }
}

 var vTopCount=0;
function OnNavigateMenus(divInline, divIds) {

/* Normal Javascript for TABS
//    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;
//    }
*/

///Changed With Jquey
    
    hidePlayer();
    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 = $('#div_' + eids[i]);
            if ($('#div_' + eids[i]) != null) {
                if (document.getElementById(eids[i]).style.display == 'block') {
                    ePrevStyle = $('#div_' + eids[i]);
                    esel_style = $('#div_' + eids[i]).attr("style");
                    esel_css = $('#div_' + eids[i]).attr("refclass");
                }
                else {
                    enew_style = $('#div_' + eids[i]).attr("style");
                    enew_css = $('#div_' + eids[i]).attr("refclass");
                }
            }
        }
    } 
    if(ePrevStyle.attr("id").replace("div_","")==divInline)
    {    
        return false;
    }
    for (var i = 0; i < eids.length; i++) {
        if (eids[i].length > 3 ) {
            $("#" + eids[i]).hide(100);
        }
    }

    if (ePrevStyle != null) {

        ePrevStyle.attr("style", enew_style);
        ePrevStyle.attr("class", enew_css);
        ePrevStyle.attr("className", enew_css);
        ePrevStyle.attr("refclass", enew_css);
    }
    var divsel = $('#div_' + divInline);
    if (divsel != null) {
        divsel.attr("style", esel_style);
        divsel.attr("class", esel_css);
        divsel.attr("className", esel_css);
        divsel.attr("refclass", esel_css);
    }

    $("#" + divInline).show(1000);
    var hidItm = $('#hidDivItems');
    if (hidItm != null) {
        hidItm.value = divInline;
    }
   
//    var pos=$("#" + eids[0]).position();    
//    $(window).scrollTop(pos.top)

    
}

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 "";
        }
    }
    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 ValNumeric(sValue) 
		{
		var keyChar = String.fromCharCode(event.keyCode); 

			if (keyChar == "1" || keyChar == "2" || keyChar == "3" || keyChar == "4" || keyChar == "5" || keyChar == "6" || keyChar == "7" || keyChar == "8" || keyChar == "9" || keyChar == "0" || event.keyCode==8 || event.keyCode==46) 
			{               			
				return true;
			}
			else
			{		
				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) {}
}

function LoadIframeDetails(ifrmeid,weburl)
{
    if(document.getElementById(ifrmeid)!=null && weburl!='')
    {
        var ifrm=document.getElementById(ifrmeid);        
        ifrm.setAttribute('src',weburl,true);
    }
}









////Uganda
var popupInitialHeight = 'auto';
var popupDistanceFromTop = 40;
var currentScrollPosition = null; 
$(document).ready(function(){

      var sCattype=getParameter("cattype");
       if(sCattype.toLowerCase()=="rb" &&  $('#ctl00_ContentPlaceHolder1_imgMusic_Buy').length>0)
        {  
        
           
            $('#ctl00_ContentPlaceHolder1_imgMusic_Buy').bind("click",function(e){                      
               return CheckUGDRBTUSER_STATUS($(this),e);        
            });
        }
});



function CheckUGDRBTUSER_STATUS(btnID,evt)
{
    try
    {
        
        var sCattype=getParameter("cattype")        
        if(sCattype.toLowerCase()=="rb")
        {   
             if($("#divPopupRBT").length==0)
            {
                $('body').prepend("<div id ='divPopupRBT'></div>");
            }
            
            if( $("#divPopupRBT").html().length>50)
            {
                return true;
            }
    
            $.ajax({
                type:"GET",
                async: false,
                cache: false,
                url:"ParseText.ashx?req=ugandarbt",
                success:function(resp)
                        {
                            $("#divPopupRBT").html(resp);
                        }                        
            });
           
            if($("#divPopupRBT").html().length<10)
            {
                return true;
            }
            else
            {          
                
                $("#divOverLayBody").show(1000);
                
                if($('body').height()>$(window).height())
                {
                    $("#divOverLayBody").css("height", $('body').height());
                }
                else
                {
                    $("#divOverLayBody").css("height", $(window).height());
                }
              
                $("#divOverLayBody").css("width",$("body").width());     
                   
                $("#divPopupRBT").hide();                                          
                $("#divPopupRBT").show(1000);      
                $("#divPopupRBT").css("z-index","100001");
                $("#divPopupRBT").css("top",evt.pageY/2);
                $("#divPopupRBT").css("left",evt.pageX/2+140);                  
                $("#btnOnCancelRBT").bind("click",function(ec){
                      $("#divPopupRBT").hide(200,function(){
                        $("#divPopupRBT").html(" ");
                     });         
                     $("#divOverLayBody").hide(100);          
                });
                $("#btnOnClickRBT").bind("click",function(ec){                    
                     $('#ctl00_ContentPlaceHolder1_imgMusic_Buy').click();                         
                });
                $("#divCloseHidden").bind("click",function(ec){
                     $("#divPopupRBT").hide(200,function(){
                        $("#divPopupRBT").html(" ");
                     });                     
                     $("#divOverLayBody").hide(100);
                     
                });           
                inteval= setInterval("ResizeOverLay('divOverLayBody')", 5000);
                return false;
            }
        }
    }
    catch(e)
    {
        alert("Error While Processing Request::"+e);
    }
    return false;
}  
function ResizeOverLay(divOve)
{
    try
    {
    //divOverLayBody
    
        if($('body').height()>$(window).height())
        {
            if($('body').height()> $("#"+divOve).height())
            {            
                $("#"+divOve).css("height", $('body').height());
            }
        }
        else
        {
            if($(window).height()> $("#"+divOve).height())
            {   
                $("#"+divOve).css("height", $(window).height());
            }
        }    
    }
    catch(ex)
    {
    
    }
}



/* DSTV*/

function subscribe()
{
 
 
 
 var VGender;
 var VDob;
 var VLocation;
 var VDstvSub;
 var VRace;
 
 if($('#ddlgender').length>=0)
    VGender=$('#ddlgender').val();
 if($('#ddldob')!=null)
    VDob= $('#ddldob').val();   
 if($('#ddlloc').length>=0)
    VLocation= $('#ddlloc').val();
 if($('#ddldstvsub').length>=0)
    VDstvSub= $('#ddldstvsub').val();
 if($('#ddlrace')!=null)
    VRace= $('#ddlrace').val();
    
               
 location.href='mobiletv.aspx?pageid=dstv8&gender='+VGender+'&dob='+VDob+'&location='+VLocation+'&dstvsub='+VDstvSub+'&race='+VRace+'&from=dstv8';    
}



function validatemobiletv()
{
 
     var check10 = 0;
     var check40 = 0;
     
     if($('#chk10').length >=0 && $('#chk10').is(':checked')==true)
     {
        check10 =1;
     }
     if($('#chk10').length>=0  && $('#chk40').is(':checked')==true)
     {
        check40 =1;
     }  
     if($('#chkterms').length>=0 )
     {
         if($('#chkterms').is(':checked')==false)
         {
            alert('Please select Terms & Conditions.');
            return false;
         }
     }
        
    if(check10==1 && check40 ==1)
    {
        alert('Please select only one checkbox');
        return false;
    }
    else if(check10==0 && check40 ==0)
    {
        alert('Please select atleast one checkbox');
        return false;
    }
    else
    {
          location.href='mobiletv.aspx?pageid=dstv7&appid=reg&chk10='+check10+'&chk40='+check40+'&from=dstv7';    
            return true;
    }
}


function DropDownselection(dropcontrolid,val)
{
  try
  {
  
  
  if(document.getElementById(dropcontrolid)!=null)
  {
   for(var i=0; i<=document.getElementById(dropcontrolid).options.length; i++)
   {
      if(document.getElementById(dropcontrolid).options[i] != null && document.getElementById(dropcontrolid).options[i].text == val)
      {
        document.getElementById(dropcontrolid).options[i].selected = true; 
        break;
      }
   } 
   }
  }
   catch(e)
   {
    alert(e.message);
   }
 }

function DropDownNaviation(ddlid)
{
  try
  {
  
    if(document.getElementById(ddlid)!=null)
    location.href=document.getElementById(ddlid).value;
   }
   catch(e)
   {
    alert(e.message);
   }
}

function SetDropDownValue(ddlID)
{
    try
    {
        var vAppid = getParameter("appid");
        var vtit=getParameter("tit");
        
        var $dd =$("#"+ddlID);
        if( $("#"+ddlID).length>=0 && vAppid.length>0)
        {
             var $options = $('option', $dd);          
            $options.each(function(){                  
                if($(this).text().toLowerCase()== vAppid.toLowerCase())
                {
                    $(this).attr("selected","selected");
                    return;
                }
                else if($(this).text().toLowerCase()== vtit.toLowerCase())
                {
                     $(this).attr("selected","selected");
                 return;
                }
    
            
            });

        }
    }
    catch(e){
    alert(e);
    }
}

function ManagePopupDiv(divId,action)
{
    if($("#"+divId).length>=0)
    {
        $(".divPopDSTV").hide(1000);
        if(action=='1')
        {
            $("#"+divId).show(1000);
        }
        else
        {
             $("#"+divId).hide(1000);
        }
    }
}
/* DSTV*/

function PushSMSMsg(msgTag,divPushResp)
{
    if(msgTag!='' && divPushResp!='')
    {
         $.ajax({
                type:"GET",
                async: false,
                cache: false,
                url:"ProcessReq.ashx?req=pushmsg&msg="+msgTag,
                success:function(resp)
                        {
                        
                            $("#"+divPushResp).html(resp);
                        }                        
            });
    }
}




/* MTN TRACE*/

function CheckMTNTrace()
{
        var TraceURl = "MTNTrace.ashx?tms="+GetTicksValues();

         $.ajax({
                type:"GET",
                async: true,
                cache: false,
                url:TraceURl,
                
                success:function(resp)
                        {

                           if(resp.indexOf('.aspx')>=0)
                           {
                           
                            location.href=resp;
                            return;
                           }
                        }                        
            });
    
}

$(document).ready(function(){
    try
    {
    $('a').each(function(){
//       $(this).bind("onMouseOver",function(e){
//            window.status='';
//            return true;
//       });
//       $(this).bind("onmouseenter",function(e){
//            window.status='';
//            return true;
//       });       
        $(this).attr("onMouseover","JavaScript:window.status=''; return true");
        $(this).attr("onMouseEnter","JavaScript:window.status=''; return true");
       
    });
    }
    catch(ex)
    {
        alert(ex)
    }
});

 
$(document).ready(function(){
    try
    {
    $('a').each(function(){
 
        try
        {
        var inner =$(this).html();
        var vHref= $(this).attr('href');
        if($(this).attr('href').toLowerCase().indexOf('download.aspx')>=0)
        {
            var cattype= getParameterByURL('cattype',vHref);
            var vValidCattypes="i,a,fs,fd,g,t,s,u,r,x,sub,v,rb,mm,"  
           var mode= getParameterByURL('mode',vHref);  
              
             if(cattype=="sub" && mode=="unsub" )
             {
                   $(this).css('cursor','pointer');  
             } 
             else if( mode=="unsubconfirm" )
             {
             $(this).css('cursor','pointer');  
             } 
            else if(vValidCattypes.indexOf(cattype+",")>=0)
            {              
                $(this).css('cursor','pointer');                
                $(this).removeAttr('href');
                
                $(this).attr('althref',vHref.toLowerCase().replace("download.aspx?","DownloadContent.aspx?"));                         
                
                $(this).click(function(){    
                                          
                    OpenDivPopUpFrame($(this).attr('althref'));
                });
            }
            else if(cattype=="rb"){
               
               }
            else{
               $(this).removeAttr('href');
               }
        }
        }
        catch(exp)
        {
        }
       
    });
    }
    catch(ex)
    {
        alert(ex)
    }
});

function getParameterByURL(parameterName,url) {
    try {
        parameterName = parameterName.toLowerCase();

        var queryString = url;
        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 "";
        }
    }
    catch (e) {}
    return '';
}
function LoginUser()
{
    var mobnO = $('#txtMobileNo').val();
    var pin= $('#txtPassword').val();
    if(mobnO=='' || pin=='')
    {
    alert("Invalid cellnumber and password");
    return false;
    }
    if(mobnO!='' && mobnO!='')
    {
         $.ajax({
                type:"GET",
                async: false,
                cache: false,
                url:"LoginUser.ashx?req=loginUser&mobileno="+mobnO+"&PIN="+pin,
                success:function(resp)
                        {
                            if(resp.toLowerCase()=="success")
                            {
                                var href=location.href;
                                location.href=href;
                            }
                            else
                            {
                                if(resp=='')
                                    resp="Invalid Login and Password";
                                alert(resp);
                            }
                        }                        
            });
    }
}



var winheight=   $(window).height();
function OpenDivPopUpFrame(url)
{

    url=parseurl(url);
 var vFrame = "<div class='jqoverlaypopup' id='divoverlaypopup'>    </div>    <div id='divPopUpforDownload' class='jqlightboxpopup'>";    
 vFrame += "<iframe  src='"+url+"'  border='0'  width='360px' height='380px' frameborder='0' ></iframe></div>";    
  
   $('body').prepend(vFrame)   
    ResizeOverLay('divoverlaypopup');
     inteval= setInterval("ResizeOverLay('divoverlaypopup')", 5000);
    window.scrollTo(1,1);     
     var win = winheight/3;
     
   
    $(window).scroll(function(){
                 
         var win = winheight/3;
     
         var currentPos = distanceToTop()+win ;                
         if(currentPos>(win+50))         
         {
            $('.jqlightboxpopup').animate({"top":(currentPos)+'px'},50);
         }
         
        
    });

         
}
function parseurl(url) {
    try {
        var newurl='';
        var specialchar = "*'"
        for (var i = 0; i < url.length; i++) {
            var val = url[i];
            for (j = 0; j < specialchar.length; j++) {
                if (specialchar[j] == url[i])
                    val = '';
            }
            newurl += val;

        }        
        if (newurl.length > 10)
        {
            return newurl;
         }
    }
    catch (e) { }
    return url;
}
function closediv(vtype)
{
    
    if($('.jqoverlaypopup').length>0)
    {
    $('.jqoverlaypopup').css('display','none');
    }
    else
    {
        if($('.jqoverlaypopup',window.parent.document).length>0)
        {
        $('.jqoverlaypopup',window.parent.document).css('display','none')
        }
    }
    if($('.jqlightboxpopup').length>0)
    {
    $('.jqlightboxpopup').css('display','none');
    }     
    else
    {
        if($('.jqlightboxpopup',window.parent.document).length>0)
        {
        $('.jqlightboxpopup',window.parent.document).css('display','none')
        }
    }
}

 
function distanceToTop() {
	// IE does not support pageYOffset property so use scrollTop instead
	if($.browser.msie) 
		return document.documentElement.scrollTop; 
	else
		return pageYOffset;
}
function hidePlayer()
{

    $("#hoverplayer").css("display","none");
    $("#hoverplayer").css("height",10);
}





// 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='';
        $('#footballPack tr td table tr td input').each(function(e){
                
            if($(this).attr('type')=="checkbox"  && $(this).is(':checked') )
            {       
                vIds+=$(this).attr('value')+",";
            }
        });        
         $('#footballPack tr td table tr td input').each(function(e){
                
            if($(this).attr('type')=="radio"  && $(this).is(':checked') )
            {       
                vIds+=$(this).attr('name')+",";
            }
        });
        ///alert(vIds); List Of Contentid selected.
        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;
            //// redirect to 
        }
        
    }
    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($('#CHK_'+vIdList[i]).length>=0)
                                        {
                                            $('#CHK_'+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;
}
