$(document).ready(function() {

    /*
    if(!$.browser.msie){
    $('select').selectbox();
    }
    */

    jQuery(function($){
        $("#dob").mask("99/99/9999");
    });


    jQuery(function($){
        if( $("#meeting_date")){
            $("#meeting_date").mask("99/99/9999");
        }
    });


    /* Long term application */

    $('#length-of-stay').change(function(){
        var val = $(this).val();
        $('#length-of-stay-note').hide();
        if(val == 'less_than_3_months'){
            $('#length-of-stay-note').show();
        }
    });

    $('#status').change(function(){
        var status = $(this).val();
        var location = $('#location').val();

        $('#barbican-note').hide();
        $('#errol-street-note').hide();

        if(status == 'Other'){
            if(location == 'barbican'){
                $('#barbican-note').show();
            }
            if(location == 'errol_street'){
                $('#errol-street-note').show();
            }
        }

        /* to make emploer name madatory on fly based on status*/
        if(status == 'Other' || status == 'Visitor'){
            $('.mand').hide();
            $('#employer_name').val(' ');
            $('#employer_address1').val(' ');
        }else{
            $('.mand').show();
            $('#employer_name').val('');
            $('#employer_address1').val('');
        }
    });

    $('#location').change(function(){
        var status = $('#status').val();
        var location = $('#location').val();

        $('#barbican-note').hide();
        $('#errol-street-note').hide();

        if(status == 'Other'){
            if(location == 'barbican'){
                $('#barbican-note').show();
            }
            if(location == 'errol_street'){
                $('#errol-street-note').show();
            }
        }
    });

    $('#requirements').change(function(){
        var val = $(this).val();
        if( val == 'Yes' ){
            $('#special-requirements-details').show();
        }else{
            $('#special-requirements-details').hide();
        }
    });



});
