﻿/***************************/
//@Author: Adrian "yEnS" Mato Gondelle & Ivan Guardado Castro
//@website: www.yensdesign.com
//@email: yensamg@gmail.com
//@license: Feel free to use it, but keep this credits please!					
/***************************/

$(document).ready(function(){
	//global vars
	var inputUser = $("#sName");
	var inputMessage = $("#sMessage");
	//check if all fields are filled
	function checkForm(){
		if(inputUser.attr("value") && inputMessage.attr("value"))
			return true;
		else
			return false;
	}
	//on submit event
	$("#shoutForm").submit(function(){
		if(checkForm()){
			var nick = inputUser.attr("value");
			var message = inputMessage.attr("value");
			//we deactivate submit button while sending
			$(".sButton").attr({ disabled:true, value:"Sending..." });
			$(".sButton").blur();
			//send the post to shoutbox.php
			

		}
		else{
			jAlert('', '');
			return false;
		}
		//we prevent the refresh of the page after submitting the form
		//return false;
	});
});
