﻿// JScript File

    var menu_title = 'none';

    function IsCheckBoxChecked(id, tableid)
    {
        var checkboxid ;
        var checkbox ;
        //if(!checkbox)
        //    return;
        var hiddenField; 
        if(tableid == "0")
        {
            checkboxid = "ctl00_PageBody_"+id;
            checkbox = document.getElementById(checkboxid);
            hiddenField = document.getElementById("ctl00_PageBody_CheckHiddenField");
        }
        else if(tableid == "1")
        {
            checkboxid = "ctl00_PageBody_annotation"+id;
            checkbox = document.getElementById(checkboxid);
            hiddenField = document.getElementById("ctl00_PageBody_AnnotationCheckHiddenField");
            if(document.title == "OffLineItemDisplay")
                setTextBox(checkbox,id);   
        }
        else 
            return;
            
        if(!hiddenField)
            return;
        var newstring = "";
        var checkstring = hiddenField.value+"";

        if(checkbox.checked)       
        {
            if(checkstring.length == 0)
                newstring = id+"";
            else
            {
                var checkstringarray = checkstring.split(",");
                var flag = -1;
                for(var i=0;i<checkstringarray.length;i++)
                {
                     if(checkstringarray[i] == id)
                     {
                        flag = i;
                        break;
                     }
                      //newstring = newstring + ","+ checkstringarray[i];
                }
                if(flag == -1)
                    newstring = checkstring + "," + id;
                else
                    newstring = checkstring;
                    
            }
//                newstring = checkstring + "," + id;
        }
        else
        {
            if(checkstring.length>0)
            {
                var checkstringarray = checkstring.split(",");
                for(var i=0;i<checkstringarray.length;i++)
                {
                     if(checkstringarray[i] == id)
                         continue;
                     else
                     {
                        if(newstring.length == 0)
                            newstring = checkstringarray[i];
                        else
                            newstring = newstring + "," + checkstringarray[i];
                     }
                }
            }
        }
        hiddenField.value = newstring;
    }
    
    function setTextBox(checkbox,id)
    {
       var table = document.getElementById("ctl00_PageBody_AnnotationTable");
       if(table == null)
            return;
       if(checkbox.checked)
       {      
            document.getElementById("ctl00_PageBody_ClassTextBox").value = table.rows[id].cells[2].innerHTML;
            var content = table.rows[id].cells[3].id;
            var contentarray = content.split("+");
            document.getElementById("ctl00_PageBody_ContentTextBox").value = contentarray[0].substring(15,contentarray[0].length);     
       }
       else
       {
            document.getElementById("ctl00_PageBody_ClassTextBox").value = "";
            document.getElementById("ctl00_PageBody_ContentTextBox").value = "";     
       } 
    } 
    
    function setMenuColor(){
        var menu = document.title;
        if (menu_title == "Home")
        {
           var myMenuTable = document.getElementById("menuTable");
           myMenuTable.rows[0].cells[0].style.backgroundColor="#EDECEC"; 
        
        
        }
        else if (menu_title == "Our Services")
        {
           var myMenuTable = document.getElementById("menuTable");
           myMenuTable.rows[0].cells[1].style.backgroundColor="#EDECEC"; 
        
        }
        else if (menu_title == "Client Login")
        {
           var myMenuTable = document.getElementById("menuTable");
           myMenuTable.rows[0].cells[2].style.backgroundColor="#EDECEC"; 
        
        }
        else if (menu_title == "Facts")
        {
           var myMenuTable = document.getElementById("menuTable");
           myMenuTable.rows[0].cells[3].style.backgroundColor="#EDECEC"; 
        
        }
        else if (menu_title == "Pharmaceutical Care")
        {
           var myMenuTable = document.getElementById("menuTable");
           myMenuTable.rows[0].cells[4].style.backgroundColor="#EDECEC"; 
        
        }
        else if (menu_title == "About Us")
        {
           var myMenuTable = document.getElementById("menuTable");
           myMenuTable.rows[0].cells[5].style.backgroundColor="#EDECEC"; 
        
        }
        else if (menu_title == "Contact Us")
        {
           var myMenuTable = document.getElementById("menuTable");
           myMenuTable.rows[0].cells[6].style.backgroundColor="#EDECEC"; 
        
        }
    
    }

