//<![CDATA[
$(document).ready(function() {
$("#contact").overlay(); // enable jQuery overlay on an anchor
$('#divMsg').overlay(); //{target: '#divMsg' }
//$('#divMsg').overlay();
    $("#tooltip-trigger-one").tooltip({ effect: 'slide' }); // enable jQuery tooltip on .tooltip div immediately after trigger id
    $("#tooltip-trigger-two").tooltip({ effect: 'slide' }); // enable jQuery tooltip on .tooltip div immediately after trigger id
    $("#tooltip-trigger-three").tooltip({ effect: 'slide' }); // enable jQuery tooltip on .tooltip div immediately after trigger id
    $("#tooltip-trigger-four").tooltip({ effect: 'slide' }); // enable jQuery tooltip on .tooltip div immediately after trigger id
    //<!-- input values on forms -->
    $('input:text, textarea').focus(function() {
        if ($(this).val() == $(this).attr('defaultValue')) {
            $(this).val('');
        }
    });

    $('input:text, textarea').blur(function() {
        if ($(this).val() == '') {
            $(this).val($(this).attr('defaultValue'));
        }
    });

    $.post('http://www.nieto.com/twitter/GetNietoTeamTweets.ashx', function(data) {
        $('#twitter-container').html('<div id="twittList" class="twittList">' + data + '</div>');
    });
});
//]]>

function PostMessage() {
    //http://localhost:4117/
    //http://www.nietogateway.info/Email/EmailNietoLLC.ashx
    $('#divSubMsg').html('');
    $.post('http://www.nieto.com/Email/EmailNietoLLC.ashx', { msg: $('#txtMessage').val(), name: $('#txtName').val(), email: $('#txtEmail').val(), phone: $('#txtPhone').val() }, function(data) {
        $('#txtMessage').val('');
        $('#txtName').val('First and Last Name');
        $('#txtEmail').val('Email');
        $('#txtPhone').val('Phone');
        $("#contact").overlay().close();
        if (data.split(' : ')[0] == 'Error') {
            $('#divSubMsg').html('<strong>We apologize we could not process your message</strong>, but you can <strong>call 713.301.4913</strong> and ask for an account executive Monday through Friday, 8:00 am - 5:00 pm Central Time.  If you prefer email,  please send us a message at <strong>nieto@nieto.com</strong>.');
            //alert('Sorry we could not process your message, but you can call 713.301.4913 and ask for an account executive Monday through Friday, 8:00 am - 5:00 pm Central Time.  If you prefer email,  please send us a message at nieto@nieto.com.');
        } else {
            $('#divSubMsg').html('<strong>Thank you for contacting Nieto LLC!</strong>.  Your message has been sent.');
            //alert('Your message has been sent.  Thank you!');
        }
        //$('#divMsg').overlay({ load: true, target: '#divMsg' });
        $('#divMsg').overlay().load();
    });
}

function OpenContactForm() {
    $('#contact').overlay().load();
}
