
$(document).ready(function() {
	/**
	 * Dar foco no primeiro campo
	 */
	//$("input[type='text']:first", document.forms[0]).focus(); // primitive type					   
});


/**  
 * @method validate(form)
 * @param  void
 * @return void
 * @desc   função customizada   
 */
function retirarCaracteresInvalidos(obj)
{	
	$('#' + obj.id).val( obj.value.replace(/[^a-z0-9_]/gi," ") );
}	


/**  
 * @method retornoAjax(retorno)
 * @param  void
 * @return void
 * @desc   função customizada   
 */
function retornoAjax(retorno)
{
	//alert(retorno);	
}



/**  
 * @method requestAjax(url, method, parametros)
 * @param  string url
 * @param  string method
 * @return void
 * @desc   função customizada   
 */
function requestAjax(url, method, parametros)
{
	if(method == '')
		method = "";
	
	$.ajax({
		type: method,
	   	url:  url,
	   	data: parametros,
	   	success: function(retorno) {	
			retorno = retorno.replace(/^\s+|\s+$/g,"");
			retornoAjax(retorno);			
		 }
	});
}	



/**  
 * @method requestAjaxSemRetorno(url, method)
 * @param  string url
 * @param  string method
 * @return void
 * @desc   função customizada   
 */
function requestAjaxSemRetorno(url, method)
{
	if(method == '')
		method = "";
	
	$.ajax({
		type: method,
	   	url:  url,
	   	data: '',
	   	success: function(retorno) {		 	   
			retorno = retorno.replace(/^\s+|\s+$/g,"");		
		}
	});
}	