var Principal = Class.create();
Object.extend(Principal,{

	Geral:
	{
		enviarForm:function(url, form, target)
		{
			var parametros = Form.serialize(form);			

			new Ajax.Updater(
				{success:target}, 			
				url,				 					
				{
					onLoadding: $(target).innerHTML = 'ENVIANDO FORMULÁRIO...',
					method:'post',
					postBody:parametros,
					evalScripts: true
				}
			);
		},
		
		excluir:function(url, objeto)
		{			
			if(confirm('DESEJA REALMENTE EXCLUIR?'))
			{				
				
				if (objeto)
				{
					Element.remove(objeto);
				}
				
				new Ajax.Updater(
					{success:''},
					url,
					{					
						evalScripts: true
					}
				);
			}
		},
				
		carregarUrl:function(url, target, carregando)
		{						
			if(typeof carregando == 'undefined')
			{
				 carregando = 'CARREGANDO...';
			}
			else
			{	 
				carregando = carregando;				
			}
			
			retornarHtml = function(target)
			{				
				if(typeof target == 'undefined')
				{
					
				}
				else
				{
					$(target).innerHTML = carregando;
				}
			}
			
			new Ajax.Updater(
				{success: target}, 			
				url, 					
				{
					onLoading:retornarHtml(target),
					evalScripts: true			
				}
			);
		},
		
	    popUp:function(pagina,w,h,scroll){
	    	var t = (screen.height/2)-(h/2);
	    	var l = (screen.width/2)-(w/2);
	
	            window.open(pagina,'','top=' +t+ ',left=' +l+ ',width=' +w+ ',height=' +h+ ',scrollbars=' + scroll );
	    }
	}
});
