function initContato(form) {
	
	var elements;

	$('#' + form).map(function() { elements = this.elements; });

	for ( var i = 0; i < elements.length; i++) {
		$(elements[i]).map(
			function() {
				this.initvalue = this.value;
				if ((this.type == 'text' || this.type == 'textarea')
					&& this.alt != 'telefone') {
						this.title = this.value;
						$(this).focus(function() {
							if (this.value == this.initvalue) {
								this.value = '';
							}	
					});
					
					 $(this).blur(function() 
					 { 
						 if(this.alt != 'telefone')
						 {
							 if (this.value == '') {
								 this.value = this.initvalue; 
							 }
						 }
					 });
				}
		});
	}

	$('input[name*=telefone]').each(function() {
		$(this).focus(function() {
			$(this).bind('keydown', function() {
				
				if(!this.masked)
				{
					this.value = '';
					$(this).mask('(99)9999-9999');
					this.masked = true;					
				}
			});
		});

	});
	
	$('#' + form).submit(function ()
	{
		for(var i=0; i < this.elements.length; i++)
		{
			var obj = this.elements[i];

			if($(obj).attr('type') != 'submit' && $(obj).attr('type') != 'radio') {
				if(obj.initvalue == obj.value)
				{
					obj.value = '';
				}
			}
		}		
	});

	$('#' + form).validate( {
		rules : {
			nome : 'required',
			email : {
				email : true,
				required : true
			},
			endereco : 'required',			
			mensagem : 'required'
		},
		
		messages : {
			nome: 'Preencha o campo nome',
			email: 'Preencha corretamente seu e-mail',
			endereco: 'Preencha o campo endereço',			
			mensagem: 'Preencha o camop mensagem'
		}	
	});
}


function initAssine(form) {
	
	var elements;

	$('#' + form).map(function() { elements = this.elements; });

	for ( var i = 0; i < elements.length; i++) {
		$(elements[i]).map(
			function() {
				this.initvalue = this.value;
				if ((this.type == 'text' || this.type == 'textarea')
					&& this.alt != 'telefone') {
						this.title = this.value;
						$(this).focus(function() {
							if (this.value == this.initvalue) {
								this.value = '';
							}	
					});
					
					 $(this).blur(function() 
					 { 
						 if(this.alt != 'telefone')
						 {
							 if (this.value == '') {
								 this.value = this.initvalue; 
							 }
						 }
					 });
				}
		});
	}

	$('input[name*=telefone]').each(function() {
		$(this).focus(function() {
			$(this).bind('keydown', function() {
				
				if(!this.masked)
				{
					this.value = '';
					$(this).mask('(99)9999-9999');
					this.masked = true;					
				}
			});
		});

	});
	
	$('#' + form).submit(function ()
	{
		for(var i=0; i < this.elements.length; i++)
		{
			var obj = this.elements[i];
			if($(obj).attr('type') != 'submit') {
				if(obj.initvalue == obj.value)
				{
					obj.value = '';
				}
			}
		}		
	});

	$('#' + form).validate( {
		rules : {
			nome : 'required',
			email : {
				email : true,
				required : true
			},
			endereco : 'required',
			telefone : 'required',
			mensagem : 'required'
		},
		
		messages : {
			nome: 'Preencha o campo nome',
			email: 'Preencha corretamente seu e-mail',
			endereco: 'Preencha o campo endereço',
			telefone: 'Preencha o campo telefone',			
			mensagem: 'Preencha o camop mensagem'
		}	
	});
}
