$(function(){

});

function directions(orientation) {

    switch (orientation) {

        case 'from':
            targetDiv = 'directionsDivFrom';
            $('#directions_from').show();
            $('#directions_to').hide();
            break;

        case  'to':
            targetDiv = 'directionsDivTo';
            $('#directions_to').show();
            $('#directions_from').hide();
            break;
            
    }

    // clear route
    $('#' + targetDiv).html('');
    directionsDisplay.setPanel(document.getElementById(targetDiv));
}

function prep_field(field_name) {

    switch (field_name)
    {

        case 'searchBoxName':
        {
            $('#searchBoxType').val('Business Type');
            break;
        }

        case 'searchBoxType':
        {
            $('#searchBoxName').val('Business Name');
            break;
        }

        
    }

}


function contact_val(f) {

    var msg = '';

    if (f.name.value.length == 0) {
        msg += ' - Name is required\n';
    }

    if (f.telephone.value.length == 0) {
        msg += ' - Telephone is required\n';
    }

    if (f.email.value.length == 0) {
        msg += ' - E-mail is required\n';
    }

    if (msg != '') {
        msg = 'Please note:\n' + msg;
        alert(msg);
        return false;
    }

}
