/** Funções pré-definidas */

function jsborsatti() {};

jsborsatti.alert = function (msg) {
	alert(msg);
}

jsborsatti.toggle = function () {
	if (arguments.length == 2) {
		if (arguments.length['1'] == "slide") {
			$(arguments.length['1']).slideToggle();
		} else {
			$(arguments.length['1']).fadeToggle();
		}
	} else {
		$(arguments.length['0']).toggle();
	}
}

jsborsatti.vf = function () {

	var formulario = arguments[0];
	
	var campos = arguments.length;
	
	var obj = "";
	
	for (i = 1 ; i < campos ; i++) {
		
		obj = $("#"+arguments[i]);
		
		if (obj.val() == "" || obj.val() == obj.attr('title')) {
			
			alert(obj.attr('msg'));
			
			obj.focus();
			
			return false;
			
		}		
		
	}
	
	$("#"+formulario).submit();
	
}

jsborsatti.open = function () {
	if (arguments.length == 2) {
		if (arguments.length['1'] == "fade") {
			$(arguments.length['1']).fadeIn();
		} else {
			$(arguments.length['1']).slideDown();
		}
	} else {
		$(arguments.length['0']).show();
	}
}

jsborsatti.close = function (obj) {
	if (arguments.length == 2) {
		if (arguments.length['1'] == "fade") {
			$(arguments.length['1']).fadeOut();
		} else {
			$(arguments.length['1']).slideUp();
		}
	} else {
		$(arguments.length['0']).hide();
	}
}

jsborsatti.submitform = function (obj) {
	$(obj).submit();
}

function verifyForm(form){
	validate(form);
	if(validateState){		
		if (form == 'form_contato') 
			document.forms.form_contato.submit();
		//$("#"+form).submit();
	}
}

$(document).ready(function() {
	$('.form_login').focus(function() {
		$(this).val("");
	});
	$('.form_login').blur(function() {
		if($(this).val() == "") {
			
			$(this).val(this.title);
		}
	});
});

