﻿    
    function EnableDivisionWithValue(Selft, DivisionID)
    {   
             //alert('EnableDivisionWithValue');
             if(Selft){
             
                if(Selft.selectedIndex > 0){
                
                   return;
                }
             }
             var Str = "EnableDropdownWithValue('" + DivisionID + "', new Array(\'1\', \'BARISHAL\', \'2\', \'CHITTAGONG\', \'3\', \'DHAKA\', \'4\', \'KHULNA\', \'5\', \'RAJSHAHI\', \'6\', \'SYLHET\'));";
             //alert(Str);
             setTimeout(Str, 100);
    }
    
    function EnableDropdownWithValue(ID, Values)
    {
             //alert('E');
             //alert(Values);
             var DDList = document.getElementById(ID);
             if(DDList){
             
                var NewOption = document.createElement('option');
                NewOption.value = '';
                NewOption.text = '.:Select:.';
                DDList.options.add(NewOption);
                for(var i = 0; i < Values.length; i+=2){
                
                    NewOption = document.createElement('option');
                    NewOption.value = Values[i];
                    NewOption.text = Values[i + 1];
                    DDList.options.add(NewOption);
                }
                DDList.selectedIndex = 0;
                DDList.disabled = false;
             }
    }

    function LoadReport(Report, Controls)
    {
             if(Report){
             
                var i = 0;
                var Params = '';
                switch(Report){
                
                       case "InstituteWise2":
                             
                             //alert(Controls);
                             var Division = document.getElementById(Controls[0]);
                             var District  = document.getElementById(Controls[1]);
                             var InstituteGroup  = document.getElementById(Controls[2]);
                             var Institute  = document.getElementById(Controls[3]);
                             if(Division && Division.selectedIndex > 0){
                                 
                                Params = '&Division=' + Division.options[Division.selectedIndex].value;
                                Params += '&ValueDiv=' + Division.options[Division.selectedIndex].text;
                             }
                             
                             if(District && District.selectedIndex > 0){
                                 
                                Params += '&District=' + District.options[District.selectedIndex].value;
                                Params += '&ValueDis=' + District.options[District.selectedIndex].text;
                                
                             }
                             
                             if(InstituteGroup && InstituteGroup.selectedIndex > 0){
                                 
                                Params += '&InstituteGroup=' + InstituteGroup.options[InstituteGroup.selectedIndex].value;
                                Params += '&ValueGroup=' + InstituteGroup.options[InstituteGroup.selectedIndex].text;
                             }
                             
                             if(Institute && Institute.selectedIndex > 0){
                                 
                                Params += '&Institute=' + Institute.options[Institute.selectedIndex].value;
                                Params += '&ValueIns=' + Institute.options[Institute.selectedIndex].text;
                             }
                              else{
                             
                                  alert('Please select Institute');
                                  return false;
                             }
                             break;
                             
                        case "DesWiseDisc":
                             
                             //alert(Controls);
                             var Designation = document.getElementById(Controls[0]);
                             var Discipline  = document.getElementById(Controls[1]);
                             //alert(Designation);
                             //alert(Discipline);
                             if(Designation && Designation.selectedIndex > 0){
                                 
                                Params = '&Designation=' + Designation.options[Designation.selectedIndex].value;
                                Params += '&TitleValue=' + Designation.options[Designation.selectedIndex].text;
                             }
                             else{
                             
                                  alert('Please select Designation');
                                  return false;
                             }
                             
                             if(Discipline && Discipline.selectedIndex > 0){
                                 
                                Params += '&Discipline=' + Discipline.options[Discipline.selectedIndex].value;
                                Params += '&Value=' + Discipline.options[Discipline.selectedIndex].text;
                                Params += '&Title=Discipline';
                             }
                             break;
                             
                         case "DesWiseDiv":
                             
                             //alert(Controls);
                             var Designation = document.getElementById(Controls[0]);
                             var Division  = document.getElementById(Controls[1]);
                             //alert(Designation);
                             //alert(Division);
                             if(Designation && Designation.selectedIndex > 0){
                                 
                                Params = '&Designation=' + Designation.options[Designation.selectedIndex].value;
                                Params += '&TitleValue=' + Designation.options[Designation.selectedIndex].text;
                             }
                             else{
                             
                                  alert('Please select Designation');
                                  return false;
                             }
                             
                             if(Division && Division.selectedIndex > 0){
                                 
                                Params += '&Division=' + Division.options[Division.selectedIndex].value;
                                Params += '&Value=' + Division.options[Division.selectedIndex].text;
                                Params += '&Title=Division';
                             }
                             else{
                             
                                  alert('Please select Division');
                                  return false;
                             }
                             break;
                        
                        case "DesWiseDis":
                             
                             //alert(Controls);
                             var Designation = document.getElementById(Controls[0]);
                             var District  = document.getElementById(Controls[1]);
                             //alert(Designation);
                             //alert(Division);
                             if(Designation && Designation.selectedIndex > 0){
                                 
                                Params = '&Designation=' + Designation.options[Designation.selectedIndex].value;
                                Params += '&TitleValue=' + Designation.options[Designation.selectedIndex].text;
                             }
                             else{
                             
                                  alert('Please select Designation');
                                  return false;
                             }
                             
                             if(District && District.selectedIndex > 0){
                                 
                                Params += '&District=' + District.options[District.selectedIndex].value;
                                Params += '&Value=' + District.options[District.selectedIndex].text;
                                Params += '&Title=District';
                             }
                             else{
                             
                                  alert('Please select District');
                                  return false;
                             }
                             break;
                             
                          case "DesWiseInsCat":
                             
                             //alert(Controls);
                             var Designation = document.getElementById(Controls[0]);
                             var Category  = document.getElementById(Controls[1]);
                             //alert(Designation);
                             //alert(Division);
                             if(Designation && Designation.selectedIndex > 0){
                                 
                                Params = '&Designation=' + Designation.options[Designation.selectedIndex].value;
                                Params += '&TitleValue=' + Designation.options[Designation.selectedIndex].text;
                             }
                             else{
                             
                                  alert('Please select Designation');
                                  return false;
                             }
                             
                             if(Category && Category.selectedIndex > 0){
                                 
                                Params += '&Category=' + Category.options[Category.selectedIndex].value;
                                Params += '&Value=' + Category.options[Category.selectedIndex].text;
                                Params += '&Title=District';
                             }
                             else{
                             
                                  alert('Please select Institute group Name');
                                  return false;
                             }
                             break;
                             
                           case "DesWiseIns":
                             
                             //alert(Controls);
                             var Designation = document.getElementById(Controls[0]);
                             var Institute  = document.getElementById(Controls[1]);
                             //alert(Designation);
                             //alert(Division);
                             if(Designation && Designation.selectedIndex > 0){
                                 
                                Params = '&Designation=' + Designation.options[Designation.selectedIndex].value;
                                Params += '&TitleValue=' + Designation.options[Designation.selectedIndex].text;
                             }
                             else{
                             
                                  alert('Please select Designation');
                                  return false;
                             }
                             
                             if(Institute && Institute.selectedIndex > 0){
                                 
                                Params += '&Institute=' + Institute.options[Institute.selectedIndex].value;
                                Params += '&Value=' + Institute.options[Institute.selectedIndex].text;
                                Params += '&Title=District';
                             }
                             else{
                             
                                  alert('Please select Institute Name');
                                  return false;
                             }
                             break;
                             
                          case "DesWise":
                             
                             //alert(Controls);
                             var Designation = document.getElementById(Controls[0]);
                             
                             //alert(Designation);
                             //alert(Division);
                             if(Designation && Designation.selectedIndex > 0){
                                 
                                Params += '&Designation=' + Designation.options[Designation.selectedIndex].value;
                                Params += '&Value=' + Designation.options[Designation.selectedIndex].text;
                             }
                             else{
                             
                                  alert('Please select Designation');
                                  return false;
                             }
                             break;
                             
                          case "ProCatWise":
                             
                             //alert(Controls);
                             var Category = document.getElementById(Controls[0]);
                             
                         
                             if(Category && Category.selectedIndex > 0){
                                 
                                Params = '&Category=' + Category.options[Category.selectedIndex].value;
                                Params += '&Value=' + Category.options[Category.selectedIndex].text;
                                Params += '&Title=Professional Category';
                                Params += '&Header=Professional Category wise report';
                             }
                             else{
                             
                                  alert('Please select Professional Category');
                                  return false;
                             }
                            
                             break; 
                             
                        case "ProSubCatWise":
                             
                             //alert(Controls);
                            
                             var SubCategory = document.getElementById(Controls[0]);
                             
                         
                             if(SubCategory && SubCategory.selectedIndex > 0){
                                 
                                Params = '&SubCategory=' + SubCategory.options[SubCategory.selectedIndex].value;
                                Params += '&Value=' + SubCategory.options[SubCategory.selectedIndex].text;
                                Params += '&Title=Professional Sub Category';
                                Params += '&Header=Professional Sub Category wise report';
                             }
                             else{
                             
                                  alert('Please select Professional Sub Category');
                                  return false;
                             }
                            
                             break; 
                             
                        case "DivisionWise":
                             
                             //alert(Controls);
                            
                             var Division = document.getElementById(Controls[0]);
                             
                         
                             if(Division && Division.selectedIndex > 0){
                                 
                                Params = '&Division=' + Division.options[Division.selectedIndex].value;
                                Params += '&Value=' + Division.options[Division.selectedIndex].text;
                                Params += '&Title=Division';
                                Params += '&Header=Division wise report (Permanent Address Division)';
                             }
                             else{
                             
                                  alert('Please select Division(Permanent Address Division)');
                                  return false;
                             }
                            
                             break; 
                             
                        case "DistrictWise":
                             
                             //alert(Controls);
                            
                             var District = document.getElementById(Controls[0]);
                             
                         
                             if(District && District.selectedIndex > 0){
                                 
                                Params = '&District=' + District.options[District.selectedIndex].value;
                                Params += '&Value=' + District.options[District.selectedIndex].text;
                                Params += '&Title=District';
                                Params += '&Header=District wise report (Permanent Address District)';
                             }
                             else{
                             
                                  alert('Please select District (Permanent Address District)');
                                  return false;
                             }
                            
                             break;
                             
                        case "HighestEducationWise":
                             
                             //alert(Controls);
                            
                             var HQ = document.getElementById(Controls[0]);
                             
                         
                             if(HQ && HQ.selectedIndex > 0){
                                 
                                Params = '&HQ=' + HQ.options[HQ.selectedIndex].value;
                                Params += '&Value=' + HQ.options[HQ.selectedIndex].text;
                                Params += '&Title=Highest Qualification';
                                Params += '&Header=Highest Qualification wise report';
                             }
                             else{
                             
                                  alert('Please select Highest Qualification');
                                  return false;
                             }
                            
                             break;
                             
                             
                          case "ActualLevelWise":
                             
                             //alert(Controls);
                            
                             var ActualLevel = document.getElementById(Controls[0]);
                             
                         
                             if(ActualLevel && ActualLevel.selectedIndex > 0){
                                 
                                Params = '&ActualLevel=' + ActualLevel.options[ActualLevel.selectedIndex].value;
                                Params += '&Value=' + ActualLevel.options[ActualLevel.selectedIndex].text;
                                Params += '&Title=Actual Education Level';
                                Params += '&Header=Actual Education Level wise report';
                             }
                             else{
                             
                                  alert('Please select Actual Education Level');
                                  return false;
                             }
                            
                             break;
                             
                           case "YearInfo":
                             
                             //alert(Controls);
                            
                             var YearInfo = document.getElementById(Controls[0]);
                             
                         
                             if(YearInfo && YearInfo.selectedIndex > 0){
                                 
                                Params = '&YearInfo=' + YearInfo.options[YearInfo.selectedIndex].value;
                                Params += '&Value=' + YearInfo.options[YearInfo.selectedIndex].text;
                                Params += '&Title=Year';
                                Params += '&Header=Leave Information';
                             }
                             else{
                             
                                  alert('Please select Year');
                                  return false;
                             }
                            
                             break;
                             
                           case "DeputationYearInfo":
                             
                             //alert(Controls);
                            
                             var YearInfo = document.getElementById(Controls[0]);
                             
                         
                             if(YearInfo && YearInfo.selectedIndex > 0){
                                 
                                Params = '&YearInfo=' + YearInfo.options[YearInfo.selectedIndex].value;
                                Params += '&Value=' + YearInfo.options[YearInfo.selectedIndex].text;
                                Params += '&Title=Year';
                                Params += '&Header=Deputation Information';
                             }
                             else{
                             
                                  alert('Please select Year');
                                  return false;
                             }
                            
                             break;
                              
                           case "LienYearInfo":
                             
                             //alert(Controls);
                            
                             var YearInfo = document.getElementById(Controls[0]);
                             
                         
                             if(YearInfo && YearInfo.selectedIndex > 0){
                                 
                                Params = '&YearInfo=' + YearInfo.options[YearInfo.selectedIndex].value;
                                Params += '&Value=' + YearInfo.options[YearInfo.selectedIndex].text;
                                Params += '&Title=Year';
                                Params += '&Header=Lien Information';
                             }
                             else{
                             
                                  alert('Please select Year');
                                  return false;
                             }
                            
                             break;
                             
                          case "BCSInfo":
                             
                             //alert(Controls);
                            
                             var BCSInfo = document.getElementById(Controls[0]);
                             
                         
                             if(BCSInfo && BCSInfo.selectedIndex > 0){
                                 
                                Params = '&BCSInfo=' + BCSInfo.options[BCSInfo.selectedIndex].value;
                                Params += '&Value=' + BCSInfo.options[BCSInfo.selectedIndex].text;
                                Params += '&Title=BCS Batch No';
                                Params += '&Header=Report with BCS Information';
                             }
                             else{
                             
                                  alert('Please select BCS Batch No');
                                  return false;
                             }
                            
                             break;
                             
                           case "SalaryInfo":
                             
                             //alert(Controls);
                            
                             var SalaryInfo = document.getElementById(Controls[0]);
                             
                         
                             if(SalaryInfo && SalaryInfo.selectedIndex > 0){
                                 
                                Params = '&SalaryInfo=' + SalaryInfo.options[SalaryInfo.selectedIndex].value;
                                Params += '&Value=' + SalaryInfo.options[SalaryInfo.selectedIndex].text;
                                Params += '&Title=Pay Scale No';
                                Params += '&Header=Report with Salary Information';
                             }
                             else{
                             
                                  alert('Please select Pay Scale No');
                                  return false;
                             }
                            
                             break;
                             
                           case "TrainingInfo":
                             
                             //alert(Controls);
                             var Type = document.getElementById(Controls[0]);
                             var Year = document.getElementById(Controls[1]);
                             if(Type && Type.selectedIndex > 0){
                                 
                                Params = '&Type=' + Type.options[Type.selectedIndex].value;
                                Params += '&Value=' + Type.options[Type.selectedIndex].text;
                                Params += '&Title=Training Type';
                                Params += '&Header=Report with Training Information';
                             }
                             else{
                             
                                  alert('Please select Training Type');
                                  return false;
                             }
                             
                             if(Year && Year.selectedIndex > 0){
                                 
                                Params += '&Year=' + Year.options[Year.selectedIndex].value;
                                Params += '&Value2=' + Year.options[Year.selectedIndex].text;
                                Params += '&Title2=Year';
                             }
                             break;
                          
                         case "RegistrationInfo":
                             
                             //alert(Controls);
                             var Year = document.getElementById(Controls[0]);
                             if(Year && Year.selectedIndex > 0){
                                 
                                Params += '&Year=' + Year.options[Year.selectedIndex].value;
                                Params += '&Value=' + Year.options[Year.selectedIndex].text;
                                Params += '&Title=Year';
                                Params += '&Header=Report with Training Information';
                             }
                             else{
                             
                                  alert('Please select Year');
                                  return false;
                             }
                             break;
                             
                         case "ConfirmationInfo":
                             
                             //alert(Controls);
                             var Year = document.getElementById(Controls[0]);
                             if(Year && Year.selectedIndex > 0){
                                 
                                Params += '&Year=' + Year.options[Year.selectedIndex].value;
                                Params += '&Value=' + Year.options[Year.selectedIndex].text;
                                Params += '&Title=Year';
                                }
                             else{
                             
                                  alert('Please select Year');
                                  return false;
                             }
                             break;
                             
                             
                        case "EducationLevelWise":
                             
                             //alert(Controls);
                            
                             var EducationLevel = document.getElementById(Controls[0]);
                             
                         
                             if(EducationLevel && EducationLevel.selectedIndex > 0){
                                 
                                Params = '&EducationLevel=' + EducationLevel.options[EducationLevel.selectedIndex].value;
                                Params += '&Value=' + EducationLevel.options[EducationLevel.selectedIndex].text;
                                Params += '&Title=Education Level';
                                Params += '&Header=Education Level wise report';
                             }
                             else{
                             
                                  alert('Please selec Education Level');
                                  return false;
                             }
                            
                             break;
                             
                           case "PromotionInfo":
                             
                             //alert(Controls);
                             var Designation = document.getElementById(Controls[0]);
                             var Discipline  = document.getElementById(Controls[1]);
                             //alert(Designation);
                             //alert(Discipline);
                             if(Designation && Designation.selectedIndex > 0){
                                 
                                Params = '&Designation=' + Designation.options[Designation.selectedIndex].value;
                                Params += '&ValueDes=' + Designation.options[Designation.selectedIndex].text;
                             }
                             else{
                             
                                  alert('Please select Designation');
                                  return false;
                             }
                             
                             if(Discipline && Discipline.selectedIndex > 0){
                                 
                                Params += '&Discipline=' + Discipline.options[Discipline.selectedIndex].value;
                                Params += '&ValueDis=' + Discipline.options[Discipline.selectedIndex].text;
                                Params += '&Title=Discipline';
                             }
                             else{
                             
                                  alert('Please select Discipline');
                                  return false;
                             }
                             break;
                             
                          case "DurationWiseOfficers":
                             
                             //alert(Controls);
                             var Division = document.getElementById(Controls[0]);
                             var District  = document.getElementById(Controls[1]);
                             var InstituteGroup  = document.getElementById(Controls[2]);
                             var Institute  = document.getElementById(Controls[3]);
                             if(Division && Division.selectedIndex > 0){
                                 
                                Params = '&Division=' + Division.options[Division.selectedIndex].value;
                                Params += '&ValueDiv=' + Division.options[Division.selectedIndex].text;
                             }
                             
                             if(District && District.selectedIndex > 0){
                                 
                                Params += '&District=' + District.options[District.selectedIndex].value;
                                Params += '&ValueDis=' + District.options[District.selectedIndex].text;
                                
                             }
                             
                             if(InstituteGroup && InstituteGroup.selectedIndex > 0){
                                 
                                Params += '&InstituteGroup=' + InstituteGroup.options[InstituteGroup.selectedIndex].value;
                                Params += '&ValueGroup=' + InstituteGroup.options[InstituteGroup.selectedIndex].text;
                             }
                             
                             if(Institute && Institute.selectedIndex > 0){
                                 
                                Params += '&Institute=' + Institute.options[Institute.selectedIndex].value;
                                Params += '&ValueIns=' + Institute.options[Institute.selectedIndex].text;
                             }
                              else{
                             
                                  alert('Please select Institute');
                                  return false;
                             }
                             break;
                             
                          case "DurationWisePersonal":
                             
                             //alert(Controls);
                             var Division = document.getElementById(Controls[0]);
                             var District  = document.getElementById(Controls[1]);
                             var InstituteGroup  = document.getElementById(Controls[2]);
                             var Institute  = document.getElementById(Controls[3]);
                             var Duration  = document.getElementById(Controls[4]);
                             if(Division && Division.selectedIndex > 0){
                                 
                                Params += '&Division=' + Division.options[Division.selectedIndex].value;
                                Params += '&ValueDiv=' + Division.options[Division.selectedIndex].text;
                             }
                             
                             if(District && District.selectedIndex > 0){
                                 
                                Params += '&District=' + District.options[District.selectedIndex].value;
                                Params += '&ValueDis=' + District.options[District.selectedIndex].text;
                                
                             }
                             
                             if(InstituteGroup && InstituteGroup.selectedIndex > 0){
                                 
                                Params += '&InstituteGroup=' + InstituteGroup.options[InstituteGroup.selectedIndex].value;
                                Params += '&ValueGroup=' + InstituteGroup.options[InstituteGroup.selectedIndex].text;
                             }
                             
                             if(Institute && Institute.selectedIndex > 0){
                                 
                                Params += '&Institute=' + Institute.options[Institute.selectedIndex].value;
                                Params += '&ValueIns=' + Institute.options[Institute.selectedIndex].text;
                             }
                            else{
                             
                                  alert('Please select Institute');
                                  return false;
                             }
                             
                             if(Duration && Duration.Text != ""){
                                  
                                Params += '&Duration=' + Duration.value; //Institute.options[Institute.selectedIndex].value;
                                
                             }
                              else{
                             
                                  alert('Please select Duration');
                                  return false;
                             }
                             break;
                          
                          
                          
                             
                }
              
                LoadPopup(Report, '../../../Admin/Reports/CrystalReportLoader.aspx?R=' + Report + Params, screen.width, screen.height, '0px', '0px');
               
                
                return true;
             }
    }
    
    function LoadPopup(WindowName, Url, width, height, top, left)
    {
             if(!width){
             
                width = "680px";
             }
             if(!height){
             
                height = "380px";
             }
             if(!top){
             
                top = "380px";
             }
             if(!left){
             
                left = "380px";
             }
             var PopupWindow = window.open(Url, WindowName, 'width=' + width + ',height=' + height + ',top=' + top + ',left=' + left + ',alwaysRaised=yes,dependent=yes,status=no,resizable=yes,toolbar=no,location=no,menubar=no,scrollbars=yes'); 
    }