    
    function ShowHideOtherEducationalLevel()
    {
        var list = document.getElementById(drpEducationalLevel);
        var otherTextBox = document.getElementById(txtOtherEducationalLevel);
        var validateOtherTextBox = document.getElementById(revValidEducationalLevel);
        if(list[list.selectedIndex].value == Resources_Literals_Other)
        {
            otherTextBox.style.display = "block";
            ValidatorEnable(validateOtherTextBox, true);
        }
        else
        {
            otherTextBox.style.display = "none";
            ValidatorEnable(validateOtherTextBox, false);
        }
    }
    
    function ShowIndividualServices()
    {
        var WaselSpecialRadio = document.getElementById(rdWaselSpecial);
        var ServicesDiv = document.getElementById(divIndividualSrvices);
        
        if( ServicesDiv.style.display != "block")
        {
            if(WaselSpecialRadio.checked)
            {
                ServicesDiv.style.display = "block";
            
                var TotalPrice = document.getElementById(lblIndividualTotalPrice);
                TotalPrice.innerHTML = "0";
            }
            CalculateIndividualServicesPrice();
        }
        
    }
    
    
    function HideIndividualServices()
    {
        var WaselFreeRadio = document.getElementById(rdWaselFree);
        var ServicesDiv = document.getElementById(divIndividualSrvices);
        
        if(WaselFreeRadio.checked)
        {
            ServicesDiv.style.display = "none";
            
            var TotalPrice = document.getElementById(lblIndividualTotalPrice);
            TotalPrice.innerHTML = Resources_Literals_Free;
        }
    }
    
    function SwitchHouseBuildingOptions()
    {
        var HouseRadio = document.getElementById(rdHouse);
        var BuildingRadio = document.getElementById(rdBuilding);
        
        var BuildingPnl = document.getElementById(pnlBuilding);
        var HousePnl = document.getElementById(pnlHouse);
        var validateFloorNo = document.getElementById(cmpvFloorNo);
        var typeHeader = document.getElementById(lblHouseTypeHeader);
        
        if(HouseRadio.checked)
        {
            HousePnl.style.display = "block";
            BuildingPnl.style.display = "none";
            ValidatorEnable(validateFloorNo, false);
            typeHeader.i
            nnerHTML = Resources_Literals_House;
        }
        
        if(BuildingRadio.checked)
        {
            HousePnl.style.display = "none";
            BuildingPnl.style.display = "block";
            ValidatorEnable(validateFloorNo, true);
            typeHeader.innerHTML = Resources_Literals_Building; 
        }
    }
    
    function ShowCitizensHideForeiners()
    {
        var CitizensRadio = document.getElementById(rdCitizens);
        var CitizensDiv = document.getElementById(divCitizens);
        var ForeignersDiv = document.getElementById(divForeigners);

        var CardType = document.getElementById(drpCardType);
        var CardNo = document.getElementById(txtCardNo);
        var CardIssueAt = document.getElementById(txtCardIssueAt);
        
        if(CitizensRadio.checked)
        {
            EnableDisableCitizensValidators(true);
            EnableDisableForeignersValidators(false);
            
            CitizensDiv.style.display = "block";
            ForeignersDiv.style.display = "none";
            
            CardType.selectedIndex = 0;
            CardNo.value = "";
            CardIssueAt.value = "";
            
            LinkDev.WebMonkey.CalendarControl.SelectDate(calNationalIDIssueDate, '');
            LinkDev.WebMonkey.CalendarControl.SelectDate(calNationalIDExpiryDate, '');
        }
    }
    
    function HideCitizensShowForeigners()
    {
        var ForeignersRadio = document.getElementById(rdForeigners);
        var CitizensDiv = document.getElementById(divCitizens);
        var ForeignersDiv = document.getElementById(divForeigners);
        
        var NationalIDNo = document.getElementById(txtNationalIDNo);
        var NationalIDIssueAt = document.getElementById(txtNationalIDIssueAt);

        if(ForeignersRadio.checked)
        {
            EnableDisableCitizensValidators(false);
            EnableDisableForeignersValidators(true);
            
            CitizensDiv.style.display = "none";
            ForeignersDiv.style.display = "block";
            
            NationalIDNo.value = "";
            NationalIDIssueAt.value = "";
            
            LinkDev.WebMonkey.CalendarControl.SelectDate(calCardIssueDate, "");
            LinkDev.WebMonkey.CalendarControl.SelectDate(calCardExpiryDate, "");
        }
    }
    
    function EnableDisableCitizensValidators(Enable)
    {
        var NationalIDNo = document.getElementById(rfvNationalIDNo);
        var NationalIDIssueDate = document.getElementById(cmpvNationalIDIssueDate);
        var NationalIDIssueDateBeforeToday = document.getElementById(cmpvNationalIDIssueDateBeforeToday);
        var NationalIDExpiryDate = document.getElementById(cmpvNationalIDExpiryDate);
        var ValidNationalIDNo = document.getElementById(revValidNationalIDNo);
        var ValidNationalIDIssueAt = document.getElementById(revValidNationalIDIssueAt);
        
        ValidatorEnable(NationalIDNo, Enable);
        ValidatorEnable(NationalIDIssueDate, Enable);
        ValidatorEnable(NationalIDIssueDateBeforeToday, Enable);
        ValidatorEnable(NationalIDExpiryDate, Enable);
        ValidatorEnable(ValidNationalIDNo, Enable);
        ValidatorEnable(ValidNationalIDIssueAt, Enable);
    }    
    
    function EnableDisableForeignersValidators(Enable)
    {
        var CardType = document.getElementById(cmpvCardType);
        var CardNo = document.getElementById(rfvCardNo);
        var CardIssueDate = document.getElementById(cmpvCardIssueDate);
        var CardIssueDateBeforeToday = document.getElementById(cmpvCardIssueDateBeforeToday);
        var CardExpiryDate = document.getElementById(cmpvCardExpiryDate);
        var ValidCardNo = document.getElementById(revValidCardNo);
        var ValidCardIssueAt = document.getElementById(revValidCardIssueAt);
        
        ValidatorEnable(CardType, Enable);
        ValidatorEnable(CardNo, Enable);
        ValidatorEnable(CardIssueDate, Enable);
        ValidatorEnable(CardIssueDateBeforeToday, Enable);
        ValidatorEnable(CardExpiryDate, Enable);
        ValidatorEnable(ValidCardNo, Enable);
        ValidatorEnable(ValidCardIssueAt, Enable);
    }
    
    function CalculateIndividualServicesPrice()
    {
        var services = document.getElementById(grdIndividualServices).rows;
        var chkService;
        var i;
        var servicePrice;
        var price = 0;
        
        for(i=0; i<services.length; i++)
        {
            chkService = services[i].cells[0].getElementsByTagName("input");
            if(chkService[0].checked == true)
            {   
                servicePrice = services[i].cells[1].getElementsByTagName("span");
                price = price + parseInt(servicePrice[0].innerHTML);
            }
        }
  
        var TotalPrice = document.getElementById(lblIndividualTotalPrice);
        TotalPrice.innerHTML = price;
        
//        indServices.style.display = "block";
//         commServices.style.display = "none";
        
            

        
    }
    
    function RemoveCommercialServicesRadiobtnCheck(checkedRow)
    {
        var services = document.getElementById(grdCommercialServices).rows;
        var rdService;
        var i;
//        checkedRow = checkedRow + 1;
        for(i=0; i<services.length; i++)
        {
            if(i == checkedRow)
            {
                continue;
            }
            rdService = services[i].cells[0].getElementsByTagName("input");
            if(rdService[0].checked == true)
            {
                rdService[0].checked = false;
            }
        }
    }
    
    function OpenSaudiLocator(Path)
    {
        window.open(Path);
    }
    
    function ValidBuildingNumber()
    {
        var BuildingNumber = document.getElementById(txtBuildingNumber);
        
        if(isNaN(BuildingNumber.value))
        {
            BuildingNumber.focus();
        }
    }
    
    function ShowHideRequiredServices()
    {
        var rdIndividuals = document.getElementById(rdWaselIndividuals);
        var indServices = document.getElementById(tblIndServices);
        var commServices = document.getElementById(tblCommServices);
        
        if(rdIndividuals.checked)
        {
            indServices.style.display = "block";
            commServices.style.display = "none";
        }
        else
        {
            indServices.style.display = "none";
            commServices.style.display = "block";
        }
        //ShowIndividualServices();
        
    }
    
    function GetIndividualAdditionalFields()
    {
        var gridRows = document.getElementById(grdIndividualServices).rows;
        var AdditionalFields = document.getElementById(indAdditionalFields);
        var i;
        var j;
        var k;
        var addList;
        var addListNames;
        var chkService;
        var testText = "";
        for(i=1;i<gridRows.length;i++)
        { 
            testText = testText + i;                        
            
            chkService = gridRows[i].cells[0].getElementsByTagName("input");
            if(chkService[0].checked == true)
            {
                testText = testText + ",true";
            }
            else
            {
               testText = testText + ",false"; 
            }
            
            addListNames = gridRows[i].cells[1].getElementsByTagName("span");            
            addList = gridRows[i].cells[1].getElementsByTagName("input");
            for(j = 0,k = 0 ; j < addList.length - 1 && k < addListNames.length; j = j + 2, k++)
            {
                testText = testText + "," + addListNames[k].innerHTML;   
                testText = testText + "," + addList[j].value;
                testText = testText + "," + addList[j+1].value;
            }
            
            testText = testText + ";";
        }
        AdditionalFields.value = testText;
    }
