﻿

//==================================Common Validations===========================================================
function ConfirmOnCancel(link) {
    if (confirm('Do you really want to exit from this page?')) {
        window.location = link;
        return false;
    }
    else {
        return false;
    }
}

function HideOnDelete(DeleteCheckBoxID, MainPanelID, PageContentRadEditorID, ExcerptRadEditorID, PostDateRadDatePickerID) {
    var DeleteCheckBox = document.getElementById(DeleteCheckBoxID);
    var MainPanel = document.getElementById(MainPanelID);
    var PageContentRadEditor = $find(PageContentRadEditorID);
    var ExcerptRadEditor;
    if (ExcerptRadEditorID != null) {
        ExcerptRadEditor = $find(ExcerptRadEditorID);
    }

    var toggle = null;
    if (DeleteCheckBox.checked) {
        MainPanel.disabled = true;
        toggle = true;
    }
    else {
        MainPanel.disabled = false;
        toggle = false;
    }
    toggle = !toggle;
    PageContentRadEditor.enableEditing(toggle);
    PageContentRadEditor.set_editable(toggle);
    if (ExcerptRadEditor != null) {
        ExcerptRadEditor.enableEditing(toggle);
        ExcerptRadEditor.set_editable(toggle);
    }
    if (PostDateRadDatePickerID != null) {
        var PostDateRadDatePicker = $find(PostDateRadDatePickerID);
        if (DeleteCheckBox.checked) {
            PostDateRadDatePicker.set_enabled(false);
        }
        else {
            PostDateRadDatePicker.set_enabled(true);
        }
    }
}

function ShowImage(DropDownListID, ImageID, HyperLinkID, PageName) {
    var DropDownList = document.getElementById(DropDownListID);
    var Image = document.getElementById(ImageID);

    if (DropDownList.selectedIndex != 0) {
        Image.style.display = 'block';
        Image.src = '../../images/' + PageName + '/' + DropDownList.options[DropDownList.selectedIndex].text;
        if (HyperLinkID != 'null') {
            var HyperLink = document.getElementById(HyperLinkID);
            HyperLink.href = '../../images/' + PageName + '/' + DropDownList.options[DropDownList.selectedIndex].text;
            HyperLink.innerHTML = '../../images/' + PageName + '/' + DropDownList.options[DropDownList.selectedIndex].text;
        }
    }
    else {
        Image.src = '';
        Image.style.display = 'none';
        if (HyperLinkID != 'null') {
            var HyperLink = document.getElementById(HyperLinkID);
            HyperLink.href = '';
            HyperLink.innerHTML = '';
        }
    }
}
//==================================End Of Common Functions===========================================================

//============================================Project Page Validations================================================
function ProjectPageShowHideOnLoad(DeleteCheckBoxID, MarketDropDownListID, SubMarketDropDownListID, FeaturedCheckBoxID, OverviewCheckBoxID, HomeCheckBoxID, RequiredLTLabelID, LTImageID, LargeThumbnailDropDownListID, RequiredMTLabelID, MTImageID, MediumThumbnailDropDownListID, RequiredSTLabelID, STImageID, SmallThumbnailDropDownListID, PrimaryImageID, Secondary1ImageID, Secondary2ImageID, PrimaryImageDropDownListID, Secondary1ImageDropDownListID, Secondary2ImageDropDownListID, ProjectID, PrimaryImageHyperLinkID, SecondaryImage1HyperLinkID, SecondaryImage2HyperLinkID) {

    var DeleteCheckBox = document.getElementById(DeleteCheckBoxID);
    var MarketDropDownList = document.getElementById(MarketDropDownListID);
    var SubMarketDropDownList = document.getElementById(SubMarketDropDownListID);
    var PrimaryImage = document.getElementById(PrimaryImageID);
    var Secondary1Image = document.getElementById(Secondary1ImageID);
    var Secondary2Image = document.getElementById(Secondary2ImageID);
    var PrimaryImageDropDownList = document.getElementById(PrimaryImageDropDownListID);
    var Secondary1ImageDropDownList = document.getElementById(Secondary1ImageDropDownListID);
    var Secondary2ImageDropDownList = document.getElementById(Secondary2ImageDropDownListID);
    var PrimaryImageHyperLink = document.getElementById(PrimaryImageHyperLinkID);
    var SecondaryImage1HyperLink = document.getElementById(SecondaryImage1HyperLinkID);
    var SecondaryImage2HyperLink = document.getElementById(SecondaryImage2HyperLinkID);

    if (ProjectID == '')
        DeleteCheckBox.disabled = true;
    else
        DeleteCheckBox.disabled = false;

    if (MarketDropDownList.selectedIndex == 0)
        SubMarketDropDownList.disabled = true;
    else
        SubMarketDropDownList.disabled = false;
    FeaturedShowHide(FeaturedCheckBoxID, OverviewCheckBoxID, HomeCheckBoxID, RequiredLTLabelID, LTImageID, LargeThumbnailDropDownListID, RequiredMTLabelID, MTImageID, MediumThumbnailDropDownListID, RequiredSTLabelID, STImageID, SmallThumbnailDropDownListID);
    if (PrimaryImageDropDownList.selectedIndex == 0) {
        PrimaryImage.src = '';
        PrimaryImage.style.display = 'none';
        PrimaryImageHyperLink.href = '';
        PrimaryImageHyperLink.innerHTML = '';
    }
    else {
        PrimaryImage.style.display = 'block';
        PrimaryImage.src = '../../images/work/' + PrimaryImageDropDownList.options[PrimaryImageDropDownList.selectedIndex].text;
        PrimaryImageHyperLink.href = '../../images/work/' + PrimaryImageDropDownList.options[PrimaryImageDropDownList.selectedIndex].text;
        PrimaryImageHyperLink.innerHTML = '../../images/work/' + PrimaryImageDropDownList.options[PrimaryImageDropDownList.selectedIndex].text;
    }
    if (Secondary1ImageDropDownList.selectedIndex == 0) {
        Secondary1Image.src = '';
        Secondary1Image.style.display = 'none';
        SecondaryImage1HyperLink.href = '';
        SecondaryImage1HyperLink.innerHTML = '';
    }
    else {
        Secondary1Image.style.display = 'block';
        Secondary1Image.src = '../../images/work/' + Secondary1ImageDropDownList.options[Secondary1ImageDropDownList.selectedIndex].text;
        SecondaryImage1HyperLink.href = '../../images/work/' + Secondary1ImageDropDownList.options[Secondary1ImageDropDownList.selectedIndex].text;
        SecondaryImage1HyperLink.innerHTML = '../../images/work/' + Secondary1ImageDropDownList.options[Secondary1ImageDropDownList.selectedIndex].text;
    }

    if (Secondary2ImageDropDownList.selectedIndex == 0) {
        Secondary2Image.src = '';
        Secondary2Image.style.display = 'none';
        SecondaryImage2HyperLink.href = '';
        SecondaryImage2HyperLink.innerHTML = '';
    }
    else {
        Secondary2Image.style.display = 'block';
        Secondary2Image.src = '../../images/work/' + Secondary2ImageDropDownList.options[Secondary2ImageDropDownList.selectedIndex].text;
        SecondaryImage2HyperLink.href = '../../images/work/' + Secondary2ImageDropDownList.options[Secondary2ImageDropDownList.selectedIndex].text;
        SecondaryImage2HyperLink.innerHTML = '../../images/work/' + Secondary2ImageDropDownList.options[Secondary2ImageDropDownList.selectedIndex].text;
    }
}

function FeaturedShowHide(FeaturedCheckBoxID, OverviewCheckBoxID, HomeCheckBoxID, RequiredLTLabelID, LTImageID, LargeThumbnailDropDownListID, RequiredMTLabelID, MTImageID, MediumThumbnailDropDownListID, RequiredSTLabelID, STImageID, SmallThumbnailDropDownListID) {

    var FeaturedCheckBox = document.getElementById(FeaturedCheckBoxID);
    var OverviewCheckBox = document.getElementById(OverviewCheckBoxID);
    var HomeCheckBox = document.getElementById(HomeCheckBoxID);

    var RequiredLTLabel = document.getElementById(RequiredLTLabelID);
    var LTImage = document.getElementById(LTImageID);
    var LargeThumbnailDropDownList = document.getElementById(LargeThumbnailDropDownListID);

    var RequiredMTLabel = document.getElementById(RequiredMTLabelID);
    var MTImage = document.getElementById(MTImageID);
    var MediumThumbnailDropDownList = document.getElementById(MediumThumbnailDropDownListID);

    var RequiredSTLabel = document.getElementById(RequiredSTLabelID);
    var STImage = document.getElementById(STImageID);
    var SmallThumbnailDropDownList = document.getElementById(SmallThumbnailDropDownListID);

    if (FeaturedCheckBox.checked) {
        OverviewCheckBox.disabled = false;
        HomeCheckBox.disabled = false;

        RequiredLTLabel.style.display = 'block';
        LargeThumbnailDropDownList.disabled = false;
        if (LargeThumbnailDropDownList.selectedIndex != 0) {
            LTImage.style.display = 'block';
            LTImage.src = '../../images/work/' + LargeThumbnailDropDownList.options[LargeThumbnailDropDownList.selectedIndex].text;
        }
        else {
            LTImage.style.display = 'none';
        }

        RequiredMTLabel.style.display = 'block';
        MediumThumbnailDropDownList.disabled = false;
        if (MediumThumbnailDropDownList.selectedIndex != 0) {
            MTImage.style.display = 'block';
            MTImage.src = '../../images/work/' + MediumThumbnailDropDownList.options[MediumThumbnailDropDownList.selectedIndex].text;
        }
        else {
            MTImage.style.display = 'none';
        }

        RequiredSTLabel.style.display = 'block';
        SmallThumbnailDropDownList.disabled = false;
        if (SmallThumbnailDropDownList.selectedIndex != 0) {
            STImage.style.display = 'block';
            STImage.src = '../../images/work/' + SmallThumbnailDropDownList.options[SmallThumbnailDropDownList.selectedIndex].text;
        }
        else {
            STImage.style.display = 'none';
        }
    }
    else {
        OverviewCheckBox.checked = false;
        HomeCheckBox.checked = false;

        OverviewCheckBox.disabled = true;
        HomeCheckBox.disabled = true;

        //LargeThumbnailDropDownList.selectedIndex = 0;
        //MediumThumbnailDropDownList.selectedIndex = 0;
        //SmallThumbnailDropDownList.selectedIndex = 0;
        //LTImage.src = '';
        //MTImage.src = '';
        //STImage.src = '';

        RequiredLTLabel.style.display = 'none';
        LTImage.style.display = 'none';
        //LargeThumbnailDropDownList.disabled = true;

        RequiredMTLabel.style.display = 'none';
        MTImage.style.display = 'none';
        //MediumThumbnailDropDownList.disabled = true;

        RequiredSTLabel.style.display = 'none';
        STImage.style.display = 'none';
        //SmallThumbnailDropDownList.disabled = true;
    }
}

function BindSubMarket(MarketDropDownListID, SubMarketDropDownListID) {
    var MarketDropDownList = document.getElementById(MarketDropDownListID);
    var SubMarketDropDownList = document.getElementById(SubMarketDropDownListID);

    if (MarketDropDownList.selectedIndex != 0) {
        var opt;
        SubMarketDropDownList.disabled = false;
        SubMarketDropDownList.options.length = 0;
        opt = new Option('Please Select...', 'Please Select...');
        SubMarketDropDownList.options.add(opt);

        if (MarketDropDownList.selectedIndex == 1) {
            opt = new Option('Movable Bridges', 'Movable Bridges');
            SubMarketDropDownList.options.add(opt);
            opt = new Option('Fixed Bridges', 'Fixed Bridges');
            SubMarketDropDownList.options.add(opt);

            opt = new Option('Rail & Transit', 'Rail & Transit');
            SubMarketDropDownList.options.add(opt);

            opt = new Option('Highways', 'Highways');
            SubMarketDropDownList.options.add(opt);

            opt = new Option('Tunnels', 'Tunnels');
            SubMarketDropDownList.options.add(opt);
        }
        else if (MarketDropDownList.selectedIndex == 2) {
            opt = new Option('Sports', 'Sports');
            SubMarketDropDownList.options.add(opt);

            opt = new Option('Rides & Attractions', 'Rides & Attractions');
            SubMarketDropDownList.options.add(opt);
        }
        else if (MarketDropDownList.selectedIndex == 3) {
            opt = new Option('Crane Systems', 'Crane Systems');
            SubMarketDropDownList.options.add(opt);

            opt = new Option('Container Handling', 'Container Handling');
            SubMarketDropDownList.options.add(opt);
        }
        else if (MarketDropDownList.selectedIndex == 4) {
            opt = new Option('Facilities/Structures', 'Facilities/Structures');
            SubMarketDropDownList.options.add(opt);

            opt = new Option('Security Infrastructure', 'Security Infrastructure');
            SubMarketDropDownList.options.add(opt);
        }
    }
    else {
        SubMarketDropDownList.options.length = 0;
        opt = new Option('Please Select...', 'Please Select...');
        SubMarketDropDownList.options.add(opt);
        SubMarketDropDownList.disabled = true;
    }
}

function ProjectPageValidateOnSubmit(DeleteCheckBoxID, ProjectTitleTextBoxID, MarketDropDownListID, SubMarketDropDownListID, FeaturedCheckBoxID, LargeThumbnailDropDownListID, MediumThumbnailDropDownListID, SmallThumbnailDropDownListID, PrimaryImageDropDownListID, DescriptionTextBoxID, ServicesListBoxID) {
    var DeleteCheckBox = document.getElementById(DeleteCheckBoxID);
    var ProjectTitleTextBox = document.getElementById(ProjectTitleTextBoxID);
    var MarketDropDownList = document.getElementById(MarketDropDownListID);
    var SubMarketDropDownList = document.getElementById(SubMarketDropDownListID);
    var FeaturedCheckBox = document.getElementById(FeaturedCheckBoxID);
    var LargeThumbnailDropDownList = document.getElementById(LargeThumbnailDropDownListID);
    var MediumThumbnailDropDownList = document.getElementById(MediumThumbnailDropDownListID);
    var SmallThumbnailDropDownList = document.getElementById(SmallThumbnailDropDownListID);
    var PrimaryImageDropDownList = document.getElementById(PrimaryImageDropDownListID);
    var DescriptionTextBox = document.getElementById(DescriptionTextBoxID);
    var ServicesListBox = document.getElementById(ServicesListBoxID);
    var msg = 'Please fill all the mandatory fields!';

    if (DeleteCheckBox.checked) {
        return confirm('Do you really want to delete this project?');
    }
    else {
        if (ProjectTitleTextBox.value.trim() == '') {
            alert(msg);
            ProjectTitleTextBox.value = '';
            ProjectTitleTextBox.focus();
            return false;
        }
        if (DescriptionTextBox.value.trim() == '') {
            alert(msg);
            DescriptionTextBox.value = '';
            DescriptionTextBox.focus();
            return false;
        }
        if (MarketDropDownList.selectedIndex == 0) {
            alert(msg);
            MarketDropDownList.focus();
            return false;
        }
        if (SubMarketDropDownList.selectedIndex == 0) {
            alert(msg);
            SubMarketDropDownList.focus();
            return false;
        }
//        if (ServicesListBox.selectedIndex < 0) {
//            alert(msg);
//            ServicesListBox.focus();
//            return false;
//        }
        if (FeaturedCheckBox.checked) {
            if (LargeThumbnailDropDownList.selectedIndex == 0) {
                alert(msg);
                LargeThumbnailDropDownList.focus();
                return false;
            }
            if (MediumThumbnailDropDownList.selectedIndex == 0) {
                alert(msg);
                MediumThumbnailDropDownList.focus();
                return false;
            }
            if (SmallThumbnailDropDownList.selectedIndex == 0) {
                alert(msg);
                SmallThumbnailDropDownList.focus();
                return false;
            }
        }
        if (PrimaryImageDropDownList.selectedIndex == 0) {
            alert(msg);
            PrimaryImageDropDownList.focus();
            return false;
        }
        return true;
    }
}

function getSubMarket(SubMarketDropDownListID, SubMarketHiddenFieldID) {
    var SubMarketDropDownList = document.getElementById(SubMarketDropDownListID);
    var SubMarketHiddenField = document.getElementById(SubMarketHiddenFieldID);

    if (SubMarketDropDownList.selectedIndex > 0) {
        SubMarketHiddenField.value = SubMarketDropDownList.options[SubMarketDropDownList.selectedIndex].value;
    }
}
//============================================End of Project Page Validations================================================

//============================================News Page Validations================================================
function NewsPageShowHideOnLoad(DeleteCheckBoxID, PrimaryImageID, ThumbnailImageID, PrimaryImageDropDownListID, ThumbnailDropDownListID, NewsID, PrimaryHyperlinkID, ThumbnailHyperLinkID) {

    var DeleteCheckBox = document.getElementById(DeleteCheckBoxID);
    var PrimaryImage = document.getElementById(PrimaryImageID);
    var ThumbnailImage = document.getElementById(ThumbnailImageID);
    var PrimaryImageDropDownList = document.getElementById(PrimaryImageDropDownListID);
    var ThumbnailDropDownList = document.getElementById(ThumbnailDropDownListID);
    var PrimaryHyperlink = document.getElementById(PrimaryHyperlinkID);
    var ThumbnailHyperLink = document.getElementById(ThumbnailHyperLinkID);

    if (NewsID == '')
        DeleteCheckBox.disabled = true;
    else
        DeleteCheckBox.disabled = false;

    if (PrimaryImageDropDownList.selectedIndex == 0) {
        PrimaryImage.src = '';
        PrimaryImage.style.display = 'none';
        PrimaryHyperlink.href = '';
        PrimaryHyperlink.innerHTML = '';
    }
    else {
        PrimaryImage.style.display = 'block';
        PrimaryImage.src = '../../images/news/' + PrimaryImageDropDownList.options[PrimaryImageDropDownList.selectedIndex].text;
        PrimaryHyperlink.href = '../../images/news/' + PrimaryImageDropDownList.options[PrimaryImageDropDownList.selectedIndex].text;
        PrimaryHyperlink.innerHTML = '../../images/news/' + PrimaryImageDropDownList.options[PrimaryImageDropDownList.selectedIndex].text;
    }

    if (ThumbnailDropDownList.selectedIndex == 0) {
        ThumbnailImage.src = '';
        ThumbnailImage.style.display = 'none';
        ThumbnailHyperLink.href = '';
        ThumbnailHyperLink.innerHTML = '';
    }
    else {
        ThumbnailImage.style.display = 'block';
        ThumbnailImage.src = '../../images/news/' + ThumbnailDropDownList.options[ThumbnailDropDownList.selectedIndex].text;
        ThumbnailHyperLink.href = '../../images/news/' + ThumbnailDropDownList.options[ThumbnailDropDownList.selectedIndex].text;
        ThumbnailHyperLink.innerHTML = '../../images/news/' + ThumbnailDropDownList.options[ThumbnailDropDownList.selectedIndex].text;
    }

}
function NewsPageValidateOnSubmit(DeleteCheckBoxID, NewsTitleTextBoxID, NewsSubTitleTextBoxID, PostDateRadDatePickerID) {
    var DeleteCheckBox = document.getElementById(DeleteCheckBoxID);
    var NewsTitleTextBox = document.getElementById(NewsTitleTextBoxID);
    var NewsSubTitleTextBox = document.getElementById(NewsSubTitleTextBoxID);
    var PostDateRadDatePicker = $find(PostDateRadDatePickerID);
    var msg = 'Please fill all the mandatory fields!';

    if (DeleteCheckBox.checked) {
        return confirm('Do you really want to delete this News?');
    }
    else {
        if (NewsTitleTextBox.value.trim() == '') {
            alert(msg);
            NewsTitleTextBox.value = '';
            NewsTitleTextBox.focus();
            return false;
        }
//        if (NewsSubTitleTextBox.value.trim() == '') {
//            alert(msg);
//            NewsSubTitleTextBox.value = '';
//            NewsSubTitleTextBox.focus();
//            return false;
//        }
        if (PostDateRadDatePicker.get_selectedDate() == null) {
            alert(msg);
            PostDateRadDatePicker._dateInput.focus()
            return false;
        }

        return true;
    }
}
//============================================End of News Page Validations================================================

//=============================================Validation for file manager section========================================

//function EnableDisableNewFolderTextbox(DestinationDropDownListID, NewFolderTextBoxID) {
//    var DestinationDropDownList = document.getElementById(DestinationDropDownListID);
//    var NewFolderTextBox = document.getElementById(NewFolderTextBoxID);
//    if (DestinationDropDownList.selectedIndex != 0) {
//        NewFolderTextBox.value = '';
//        NewFolderTextBox.disabled = true;
//    }
//    else {
//        NewFolderTextBox.disabled = false;
//    }
//}

function RadioButtonOnClick(FileRadioButtonID, FileRadUploadID, DestinationDropDownListID, InnerFolderDropDownListID) {
    var FileRadioButton = document.getElementById(FileRadioButtonID);
    var DestinationDropDownList = document.getElementById(DestinationDropDownListID);
    var InnerFolderDropDownList = document.getElementById(InnerFolderDropDownListID);

    var upload = getRadUpload(FileRadUploadID);
    if (FileRadioButton.checked) {
        upload.Enabled = true;
        upload._fileInput.disabled = false;
        if (DestinationDropDownList.selectedIndex != 0)
            InnerFolderDropDownList.disabled = false;
        else
            InnerFolderDropDownList.disabled = true;
    }
    else {
        InnerFolderDropDownList.disabled = true;
        upload.Enabled = false;
        upload.clearFileInputAt(0);
        upload._fileInput.disabled = true;
    }
}

function ValidateOnSubmit(DestinationDropDownListID, FileRadioButtonID, FileRadUploadID, NewFolderTextBoxID, InnerFolderDropDownListID) {
    var DestinationDropDownList = document.getElementById(DestinationDropDownListID);
    var FileRadioButton = document.getElementById(FileRadioButtonID);
    var NewFolderTextBox = document.getElementById(NewFolderTextBoxID);
    var InnerFolderDropDownList = document.getElementById(InnerFolderDropDownListID);
    var upload = getRadUpload(FileRadUploadID);

    if (FileRadioButton.checked) {
        if (DestinationDropDownList.selectedIndex == 0) {
            alert('Please select destination folder to upload the file !');
            DestinationDropDownList.focus();
            return false;
        }
        else {
            var inputs = upload.getFileInputs();
            for (var i = 0; i < inputs.length; i++) {
                if (inputs[i].value == "") {
                    alert("Please select file to upload !");
                    return false;
                }
                if (!upload.isExtensionValid(inputs[i].value)) {
                    alert("Invalid Extension !");
                    return false;
                }
            }
        }
        var path = DestinationDropDownList.options[DestinationDropDownList.selectedIndex].value;
        if (NewFolderTextBox.value.trim() != '')
            path = path + "/" + NewFolderTextBox.value.trim();
        else if (InnerFolderDropDownList.selectedIndex != 0)
            path = path + "/" + InnerFolderDropDownList.options[InnerFolderDropDownList.selectedIndex].text;
        if (!confirm("You are going to upload file at the path: " + path + ". Do you really want to upload the file at the mentioned path !"))
            return false;
    }
    else {
        if (DestinationDropDownList.selectedIndex == 0) {
            alert('Please select destination folder to create the new folder !');
            DestinationDropDownList.focus();
            return false;
        }
        if (NewFolderTextBox.value.trim() == '') {
            alert("Please enter folder name to create !");
            NewFolderTextBox.value = '';
            NewFolderTextBox.focus();
            return false;
        }
        var path = DestinationDropDownList.options[DestinationDropDownList.selectedIndex].value;
        if (!confirm("You are going to create folder under '" + path + "' folder . Do you really want to create the folder under selected folder !"))
            return false;
    }

    return true;
}
function DeleteRadioButtonOnClick(FileDelRadioButtonID, SelectFileDropDownListID, SelectFolderDropDownListID) {
    var FileDelRadioButton = document.getElementById(FileDelRadioButtonID);
    var SelectFileDropDownList = document.getElementById(SelectFileDropDownListID);
    var SelectFolderDropDownList = document.getElementById(SelectFolderDropDownListID);
    SelectFileDropDownList.selectedIndex = 0;
    SelectFolderDropDownList.selectedIndex = 0;
    if (FileDelRadioButton.checked) {
        SelectFileDropDownList.disabled = false;
        SelectFolderDropDownList.disabled = true;
    }
    else {
        SelectFileDropDownList.disabled = true;
        SelectFolderDropDownList.disabled = false;
    }
}
function ValidateOnDelete(FileDelRadioButtonID, SelectFileDropDownListID, SelectFolderDropDownListID) {
    var FileDelRadioButton = document.getElementById(FileDelRadioButtonID);
    var SelectFileDropDownList = document.getElementById(SelectFileDropDownListID);
    var SelectFolderDropDownList = document.getElementById(SelectFolderDropDownListID);

    if (FileDelRadioButton.checked) {
        if (SelectFileDropDownList.selectedIndex == 0) {
            alert("Please select File to delete !");
            return false;
        }
        if (!confirm("File you have selected may be in use . Do you still want to delete this file ?"))
            return false;
    }
    else {
        if (SelectFolderDropDownList.selectedIndex == 0) {
            alert("Please select Folder to delete !");
            return false;
        }
        if (!confirm("Folder you have selected may contains files which are currently in use . Do you still want to delete this folder ?"))
            return false;
    }
    return true;
}

//=============================================End of Validation for file manager section=================================

function validateRadUpload(source, e) {
    e.IsValid = false;
    var upload = document.getElementById(source.parentNode.getElementsByTagName('input')[0].id);
    var inputs = upload.value;
    if (inputs != "") {
        var ext = inputs.substring(inputs.lastIndexOf('.') + 1);
        if (ext == "pdf" || ext == "doc" || ext == "docx") {
            e.IsValid = true;
        }
    }
}

