//run jQuery in no-conflict mode to prevent incompatibility with another javaScript frameworks that use $ dollar symbol
jQuery.noConflict();



//function that handles ajax contact form, posts the input fields' values to sendEmail.php and catches it's response
function contactForm(){
	
	jQuery('#ajaxResponse').css({ "display": "none" });
    var paraTag = jQuery('#contactForm input#submit').parent('div');
    jQuery(paraTag).children('input').remove();
    jQuery(paraTag).append('<input type="button" name="submit" id="submit" class="fadingButton highlight" value="Trimite" tabindex="4" />');

    jQuery('#contactForm input#submit').click(function() {
        jQuery('#ajaxResponse').append('<div id="loaderIcon2"></div>').show(200);

        var name = jQuery('input#name').val();
        var email = jQuery('input#email').val();
        var comments = jQuery('textarea#message').val(); 

        jQuery.ajax({
            type: 'post',
            url: 'sendEmail.php',
            data: 'name=' + name + '&email=' + email + '&message=' + comments,

            success: function(results) {
				jQuery('#ajaxResponse').hide(200, function(){
					jQuery('#loaderIcon2').remove();
					jQuery('#ajaxResponse').html(results).show(500);
					}					
				);				
            }
        });
    });
};


