(function($){


$.fn.footerContact_function=function(){ 

$('.contactFormData').each(function() {
$(this).focus(function() {
if($(this).val()==$(this).attr('defaultInput')){
$(this).val('');
$(this).css({'color':'#444444'});
$(this).css({'background':'#ffffff'});
$($(this).parent()).css({'background-position':'top'});
}})

$(this).blur(function() {
if($(this).val()==''||$(this).val()==$(this).attr('defaultInput')){
//$(this).css({'background':errorColor});
$(this).val($(this).attr('defaultInput'));
$(this).css({'color':'#ffffff'});
$(this).css({'background':'#c03519'});
$($(this).parent()).css({'background-position':'bottom'});

}});
})

$('#footer_form_sendBtn').click(function(e){								 
var error=0;
$('.contactFormData').each(function() {
if($(this).val()==''||$(this).val()==$(this).attr('defaultInput'))
{$(this).css({'color':'#ffffff'});
$(this).val($(this).attr('defaultInput'));
$(this).css({'background':'#c03519'});
$($(this).parent()).css({'background-position':'bottom'});
error=1;
}
})
if(error==0){
sendMessage_function();
}
else{alert('Please fill in all the form fields');}
})


// SEND MESSAGE
function sendMessage_function(){
var inputData_string='';
var inputs_array = $('.contactFormData');
var i=0;
inputs_array.each(function() {
if(i!=0){inputData_string+='&';}
inputData_string+=this.name+'='+encodeURIComponent($(this).val());
i++;
});
//alert(inputData_string);
$.ajax({
type: "POST",
url: "includes/ajax/contact/sendMessage.php",
data: inputData_string,
dataType: 'html',
success: function(html){
$('#footer_form').html(html);
}})
}












//CLOSE FOOTER CONTACT FUNCTION
}
				
	
// CLOSE FUNCTION
})(jQuery);
		
