﻿// JScript File
    function MM_openBrWindow(theURL,winName,features)
    { 
        tempURL=theURL;
        tempURL=tempURL+"&maid=4&subid=17&pageno=0";
        theURL=tempURL;
        winid=window.open(theURL,winName,features,"left=20,top=15,width=300,height=200");
        if (!winid.opener) winid.opener = self;
    }
    function CheckAllDataGridCheckBoxes(aspCheckBoxID, checkVal)
    {
        re = new RegExp(aspCheckBoxID)  //generated control name starts with a colon
        for(i = 0; i < document.forms[0].elements.length; i++)
        {
            elm = document.forms[0].elements[i]
            if (elm.type == 'checkbox')
            {
                if (re.test(elm.name))
                {
                    elm.checked = checkVal
                }
            }
        }
    }
    function CheckAllDataGridCheckBoxeswithbeading(aspCheckBoxID, aspCheckBoxBeadingID, checkVal)
    {
        re = new RegExp(aspCheckBoxID)  //generated control name starts with a colon
        re1 = new RegExp(aspCheckBoxBeadingID)
        for(i = 0; i < document.forms[0].elements.length; i++)
        {
            elm = document.forms[0].elements[i]
            if (elm.type == 'checkbox')
            {
                if (re.test(elm.name))
                {
                    elm.checked = checkVal
                }
                if(re1.test(elm.name))
                {
                    if(elm.disabled==false)
                    {
                        elm.checked = checkVal;
                        //alert(elm.name);
                    }
                }
            }
        }
    }
    function CheckAllDataInterGridCheckBoxeswithbeading(aspCheckBoxID, noofcheckbokes)
    {
        re = new RegExp('chkAdd')
        re1 = new RegExp('chkAllItems')
        checkall=0;
        chkboxctr=0;
        chkall=false;
        chkVal=0
        for(i = 0; i < document.forms[0].elements.length; i++)
        {
            elm = document.forms[0].elements[i]
            if (elm.id == aspCheckBoxID && elm.type == 'checkbox')
            {
                //alert(i+"="+elm.id);
                chkall=true;
                if(elm.checked==true)
                {
                    chkVal=1;
                }
                else
                {
                    chkVal=0;
                }
            }
            else if(elm.type == 'checkbox' && re.test(elm.name) && chkall==true)
            {
                //alert(i+"=ha"+elm.id);
                elm.checked=chkVal;
                elm1=document.forms[0].elements[i+2];
                if(elm1.disabled==false)
                {
                    elm1.checked=chkVal;
                }
            }
            else if(elm.type == 'checkbox' && elm.id != aspCheckBoxID && re1.test(elm.name))
            {
                chkall=false;
            }
        }
    }    
    function beadingchk(aspCheckBoxID, aspCheckBoxBeadingID)
    {
        re1 = new RegExp(aspCheckBoxBeadingID)
        for(i = 0; i < document.forms[0].elements.length; i++)
        {
            elm = document.forms[0].elements[i]
            if (elm.type == 'checkbox' && elm.id == aspCheckBoxID)
            {
                elm1=document.forms[0].elements[i+2];
                //alert(elm1.id);
                if(elm1.disabled==false)
                {
                    if(elm.checked==true)
                    {
                        elm1.checked=1;
                    }
                    else
                    {
                        elm1.checked=0;
                    }
                }
            }
        }
    }
    
    function haha(somthing)
    {
        alert(something);
    }
    

