﻿var checkflag = "false";
    function select_deselectAll()
    {
      if (chk_Array_IDs != null)
       {
     
          if (checkflag == "false")
          {
           for (i=0;i<chk_Array_IDs.length;i++)
             {
                var ref_chk = document.getElementById(chk_Array_IDs[i]);
                if (ref_chk != null)
                   ref_chk.checked = true;
                   rowAppearanceOnDeleteMode('row' + i);
             }
             checkflag = "true";
              return "غیر انتخاب";
          }
          else
          {
             for (i=0;i<chk_Array_IDs.length;i++)
             {
                var ref_chk = document.getElementById(chk_Array_IDs[i]);
                if (ref_chk != null)
                   ref_chk.checked = false;
                   rowAppearanceOnDeleteMode('row' + i);
             }
             checkflag = "false";
             return "انتخاب همه";
          }
       }
    }
    ////////////////////////////////////////////// 
	function confirmDelete()
	{
	   var xCounter = 0;
	   if (chk_Array_IDs != null)
	   {
          for (i=0;i<chk_Array_IDs.length;i++)
          {
             var ref_chk = document.getElementById(chk_Array_IDs[i]);
             if (ref_chk != null)
                if (ref_chk.checked == true)
                   ++xCounter;
          }
          if (xCounter == 0)
          {
             alert("!هیچ رکوردی انتخاب نشده است");
             return false;
          }
          else
          {
              var ret_confirm = confirm("آیا مطمئن به حذف " +xCounter+ " رکورد انتخابی هستید؟");
              if (ret_confirm == true)
              {
                 checkclick = "true";
                 return true;
              }
              else
                 return false;
          }
       }
    }
	    //////////////////////////////////////////////
	    function RecordSelected()
	{
		   if (chk_Array_IDs != null)
	   {
          for (i=0;i<chk_Array_IDs.length;i++)
          {
             var ref_chk = document.getElementById(chk_Array_IDs[i]);
             if (ref_chk != null)
              { 
                if (ref_chk.checked == true)
                    return true;
              }
           }
           alert("!هیچ رکوردی انتخاب نشده است");
           return false;
       }
    }
	    //////////////////////////////////////////////
	  	function rowAppearanceOnDeleteMode(rowID)
	  	{
	 	  	  if (document.getElementById(rowID)!=null)
	  	  {
	  	  var color = document.getElementById(rowID).style.backgroundColor;
	  	   var ref_check = document.getElementById(rowID).getElementsByTagName("input").item(0);
	  	   if (ref_check.checked)
	  	   {
	  	     document.getElementById(rowID).style.backgroundColor = '#f1e8eb'; 
             document.getElementById(rowID).style.fontStyle = 'italic'; 
           }
           else
           {
              if ((rowID.substr(3)% 2 )==0)
                 document.getElementById(rowID).style.backgroundColor ='#EEF2EE';
              else
                document.getElementById(rowID).style.backgroundColor ='White';
                document.getElementById(rowID).style.fontStyle = 'normal';
           }
	  	 }
	  	}
        //////////////////////////////////////////////
        function rowOver(rowID)
        {
               document.getElementById(rowID).style.backgroundColor = '#f1e8eb';
        }
        //////////////////////////////////////////////
        function rowOut(rowID)
        {
           var ref_check = document.getElementById(rowID).getElementsByTagName("input").item(0);
           if (!ref_check.checked)
            if ((rowID.substr(3)% 2 )==0)
              document.getElementById(rowID).style.backgroundColor='#EEF2EE';
            else
              document.getElementById(rowID).style.backgroundColor='White';
              
        }
           function rowOver2(rowID)
        {
            //  document.getElementById(rowID).style.ForegroundColor  = 'Maroon';
               document.getElementById(rowID).style.backgroundColor = '#f1e8eb';
                 
        }
          function rowOut2(rowID)
        {
             var ref_check = document.getElementById(rowID).getElementsByTagName("input").item(0);
           if ((rowID.substr(3)% 2 )==0)
              document.getElementById(rowID).style.backgroundColor='#EEF2EE';
            else
              document.getElementById(rowID).style.backgroundColor='White';
              
        }
        //////////////////////////////////////////////
        function numRows(editMode)
        {
           var intNumRows = document.getElementById("GridView1").getElementsByTagName("tr");
           // Rows which doesen't included: HeaderRow, Dynamic Row in Header Row
           if (editMode == "yes")
              return intNumRows.length - 2;
           else if (editMode == "no")
           // Rows which doesen't included: HeaderRow, FooterRow, Dynamic Row in Header Row
              return intNumRows.length - 3;
         }
   function rowOver3(rowID)
        {
              document.getElementById(rowID).style.ForegroundColor  = 'Maroon';
               document.getElementById(rowID).style.backgroundColor = '#dcdcdc';
        }
          function rowOut3(rowID)
        {
              document.getElementById(rowID).style.backgroundColor='';  
               document.getElementById(rowID).style.ForegroundColor  = 'White';
                         }
 
         function rowOver4(rowID)
        {
              document.getElementById(rowID).style.ForegroundColor  = 'Maroon';
               document.getElementById(rowID).style.backgroundColor = '#dcdcdc';
        }
          function rowOut4(rowID)
        {
              document.getElementById(rowID).style.backgroundColor='';  
               document.getElementById(rowID).style.ForegroundColor  = 'White';
          }
         function rowOver5(rowID)
        {
              document.getElementById(rowID).style.ForegroundColor  = 'Maroon';
               document.getElementById(rowID).style.backgroundColor = '#dcdcdc';
        }
          function rowOut5(rowID)
        {
              document.getElementById(rowID).style.backgroundColor='';  
               document.getElementById(rowID).style.ForegroundColor  = 'White';
        }