﻿function confirmSubmit11() {
    var found_it;
    for (var i = 1; i < document.forms(0).length; i++) {
        if (document.forms(0).elements[i].id) {
            if (document.forms(0).elements[i].id.indexOf("rdbtnsel") != -1) {
                if (document.forms(0).elements[i].checked) {// Set the flag if any radio button is checked
                    found_it = true;
                    break;
                }
            }
        }
    }
    if (!found_it) {
        alert("Select atleast one Option.");
        return false;
    }
    else {
        return true;
    }

}


function valid(id) {

    alert("You can cast only single Vote");
    return false;

}

function ForShowHide(id, status) {
    if (status == "minimise") {
        document.getElementById(id).style.display = "none";
    }
    if (status == "maximise") {
        document.getElementById(id).style.display = "block";
    }
    //alert(id);
    //alert(status);
}


function callDeleteWidget(temp) {
    var id = temp;
    //alert("index page alert");
    //alert(id);
    CallServerWidget(id, "");
}


function ReceiveServerDataWidget(rValue) {
    //alert(rValue);
    //document.getElementById("ResultsSpan").innerHTML = rValue;

}


function open_win(url_add) {
    window.open(url_add, "FantasyCricket", "height=670px,width=1000px,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,modal=yes");
}


/////////////////////////////////////////////////////////////////
/////  EDIT THE FOLLOWING VARIABLE VALUES  //////////////////////
/////////////////////////////////////////////////////////////////

// set the list selector
var setSelector1 = "#column1";

// set the cookie name
//var setCookieName = "listOrder";
// set the cookie expiry time (days):
//var setCookieExpiry = 7;

/////////////////////////////////////////////////////////////////
/////  YOU PROBABLY WON'T NEED TO EDIT BELOW  ///////////////////
/////////////////////////////////////////////////////////////////

// function that writes the list order to a cookie
function getOrder1() {
    // save custom order to cookie
    //$.cookie(setCookieName, $(setSelector).sortable("toArray"), { expires: setCookieExpiry, path: "/" });
    document.getElementById("ctl00_mainarea_txt_sort").value = $(setSelector1).sortable("toArray");
    //alert($(setSelector).sortable("toArray"));
    //alert("getorder called")
}


// function that restores the list order from a cookie
function restoreOrder1() {
    var list = $(setSelector1);
    if (list == null) return
    //alert(list);
    // fetch the cookie value (saved order)
    //var cookie = $.cookie(setCookieName);
    var cookie = document.getElementById("ctl00_mainarea_txt_sort").value
    //if (!cookie) return;

    // make array from saved order
    var IDs = cookie.split(",");
    //var IDs =  document.getElementById("txt_sr").value
    //alert("IDs=" + IDs);
    // fetch current order
    var items = list.sortable("toArray");

    // make array from current order
    var rebuild = new Array();
    for (var v = 0, len = items.length; v < len; v++) {
        rebuild[items[v]] = items[v];
    }

    for (var i = 0, n = IDs.length; i < n; i++) {

        // item id from saved order
        var itemID = IDs[i];

        if (itemID in rebuild) {

            // select item id from current order
            var item = rebuild[itemID];

            // select the item according to current order
            var child = $("div.ui-sortable").children("#" + item);

            // select the item according to the saved order
            var savedOrd = $("div.ui-sortable").children("#" + itemID);
            //alert("savedOrd=" + savedOrd);
            // remove all the items
            child.remove();

            // add the items in turn according to saved order
            // we need to filter here since the "ui-sortable"
            // class is applied to all ul elements and we
            // only want the very first!  You can modify this
            // to support multiple lists - not tested!
            $("div.ui-sortable").filter(":first").append(savedOrd);
            //$("div.ui-sortable").filter(":second").append(savedOrd);
        }
    }
}



// code executed when the document loads
$(function() {
    // here, we allow the user to sort the items
    $(setSelector1).sortable({
        axis: "y",
        cursor: "move",
        update: function() { document.getElementById("ctl00_mainarea_txt_sort").value; }
    });

    // here, we reload the saved order
    restoreOrder1();
});



/////////////////////////////////////////////////////////////////
/////  EDIT THE FOLLOWING VARIABLE VALUES  //////////////////////
/////////////////////////////////////////////////////////////////

// set the list selector
var setSelector2 = "#column2";

// set the cookie name
//var setCookieName = "listOrder";
// set the cookie expiry time (days):
//var setCookieExpiry = 7;

/////////////////////////////////////////////////////////////////
/////  YOU PROBABLY WON'T NEED TO EDIT BELOW  ///////////////////
/////////////////////////////////////////////////////////////////

// function that writes the list order to a cookie
function getOrder2() {
    // save custom order to cookie
    //$.cookie(setCookieName, $(setSelector).sortable("toArray"), { expires: setCookieExpiry, path: "/" });
    document.getElementById("ctl00_mainarea_txt_sort2").value = $(setSelector2).sortable("toArray");
    //alert($(setSelector).sortable("toArray"));
    //alert("getorder called")
}


// function that restores the list order from a cookie
function restoreOrder2() {
    var list2 = $(setSelector2);
    if (list2 == null) return
    //alert(list);
    // fetch the cookie value (saved order)
    //var cookie = $.cookie(setCookieName);
    var cookie2 = document.getElementById("ctl00_mainarea_txt_sort2").value
    //if (!cookie) return;

    // make array from saved order
    var IDs2 = cookie2.split(",");
    //var IDs =  document.getElementById("txt_sr").value
    //alert("IDs2=" + IDs2);
    // fetch current order
    var items2 = list2.sortable("toArray");

    // make array from current order
    var rebuild2 = new Array();
    for (var v2 = 0, len = items2.length; v2 < len; v2++) {
        rebuild2[items2[v2]] = items2[v2];
    }

    for (var i2 = 0, n2 = IDs2.length; i2 < n2; i2++) {

        // item id from saved order
        var itemID2 = IDs2[i2];

        if (itemID2 in rebuild2) {

            // select item id from current order
            var item2 = rebuild2[itemID2];

            // select the item according to current order
            var child2 = $("div.ui-sortable2").children("#" + item2);

            // select the item according to the saved order
            var savedOrd2 = $("div.ui-sortable2").children("#" + itemID2);
            //alert("savedOrd=" + savedOrd);
            // remove all the items
            child2.remove();

            // add the items in turn according to saved order
            // we need to filter here since the "ui-sortable"
            // class is applied to all ul elements and we
            // only want the very first!  You can modify this
            // to support multiple lists - not tested!
            $("div.ui-sortable2").filter(":first").append(savedOrd2);
        }
    }
}



// code executed when the document loads
$(function() {
    // here, we allow the user to sort the items
    $(setSelector2).sortable({
        axis: "y",
        cursor: "move",
        update: function() { document.getElementById("ctl00_mainarea_txt_sort2").value; }
    });

    // here, we reload the saved order
    restoreOrder2();
});



/////////////////////////////////////////////////////////////////
/////  EDIT THE FOLLOWING VARIABLE VALUES  //////////////////////
/////////////////////////////////////////////////////////////////

// set the list selector
var setSelector3 = "#column3";
var items3;

// set the cookie name
//var setCookieName = "listOrder";
// set the cookie expiry time (days):
//var setCookieExpiry = 7;

/////////////////////////////////////////////////////////////////
/////  YOU PROBABLY WON'T NEED TO EDIT BELOW  ///////////////////
/////////////////////////////////////////////////////////////////

// function that writes the list order to a cookie
function getOrder3() {
    // save custom order to cookie
    //$.cookie(setCookieName, $(setSelector).sortable("toArray"), { expires: setCookieExpiry, path: "/" });
    document.getElementById("ctl00_mainarea_txt_sort3").value = $(setSelector3).sortable("toArray");
    //alert($(setSelector).sortable("toArray"));
    //alert("getorder called")
}


// function that restores the list order from a cookie
function restoreOrder3() {
    var list3 = $(setSelector3);
    if (list3 == null) return
    //alert(list);
    // fetch the cookie value (saved order)
    //var cookie = $.cookie(setCookieName);
    var cookie3 = document.getElementById("ctl00_mainarea_txt_sort3").value
    //if (!cookie) return;

    // make array from saved order
    var IDs3 = cookie3.split(",");
    //var IDs =  document.getElementById("txt_sr").value
    //alert("IDs3=" + IDs3);
    // fetch current order
    items3 = list3.sortable("toArray");
    //alert(items3);
    // make array from current order
    var rebuild3 = new Array();
    for (var v3 = 0, len = items3.length; v3 < len; v3++) {
        rebuild3[items3[v3]] = items3[v3];
    }

    for (var i3 = 0, n3 = IDs3.length; i3 < n3; i3++) {

        // item id from saved order
        var itemID3 = IDs3[i3];

        if (itemID3 in rebuild3) {

            // select item id from current order
            var item3 = rebuild3[itemID3];

            // select the item according to current order
            var child3 = $("div.ui-sortable3").children("#" + item3);

            // select the item according to the saved order
            var savedOrd3 = $("div.ui-sortable3").children("#" + itemID3);
            //alert("savedOrd=" + savedOrd);
            // remove all the items
            child3.remove();

            // add the items in turn according to saved order
            // we need to filter here since the "ui-sortable"
            // class is applied to all ul elements and we
            // only want the very first!  You can modify this
            // to support multiple lists - not tested!
            $("div.ui-sortable3").filter(":first").append(savedOrd3);
        }
    }
}



// code executed when the document loads
$(function() {
    // here, we allow the user to sort the items

    //alert(items3);
    $('#column3').sortable(items3);
    $(setSelector3).sortable({
        axis: "y",
        cursor: "move",
        update: function() { alert("hii"); document.getElementById("ctl00_mainarea_txt_sort3").value; }
    });

    // here, we reload the saved order
    restoreOrder3();
});

