$(document).ready(
    function (){
        $('.item-desc ul li:last-child').css({'margin-right':'0px','float':'right'});
    }
);



$(document).ready(function(){

	  var options = { 

	  	target: "#error-all",
	  	dataType: "json",
	    beforeSubmit: showRequest, 
	    success: showResponse, 
	    timeout: 3000
	  };

	  $('#frmc').submit(function() { 
	    $(this).ajaxSubmit(options); 

	    return false;
	  }); 

	});


	function showRequest(formData, jqForm, options) { 
        $(".error").hide();
        $(".error-all").hide();
        $(".successful").hide();
        var hasError = false;

        var nameVal = $("#name").val();
        if(nameVal == '') {
            $("#name").after('<span class="error">Please enter your Name.</span>');
            $("#name").css({'margin-bottom':'0px'});
            hasError = true;
        }
        
        var emailaddressVal = $("#email").val();
        if(emailaddressVal == '') {
            $("#email").after('<span class="error">Please enter your email address.</span>');
            $("#email").css({'margin-bottom':'0px'});
            hasError = true;
        }
        
        var subjectVal = $("#subject").val();
        if(subjectVal == '') {
            $("#subject").after('<span class="error">Please enter Subject.</span>');
            $("#subject").css({'margin-bottom':'0px'});
            hasError = true;
        }

        if(hasError == true) { 
        	
        	$(".error-all").show();
        	return false; 
        	
        }
        
        return true;
	} 
	 

	function showResponse(responseText, statusText)  {
		
		if(statusText != 'success'){
			
			$(".error-all").text("Failed to send data");
			return false;
		}
		
		if(!responseText.success)
		{
			$(".error-all").show();
			return false;
		}

		
		$(".successful").show();
		$('#frmc').clearForm();
		
		
	}



