function initPromo(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[alt*=telefone]').each(function() {
		$(this).focus(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.initvalue == obj.value)
			{
				obj.value = '';
			}
		}	
	});
	

	$('#' + form).validate( {
		rules : {
			nome : 'required',
			email : {
				email : true,
				required : true
			},
			rg : 'required',
			cidade: 'required',
			estado: 'required'
		},
		messages : {
			nome:'Preencher com o nome corretamente',
			email:'Preencher com o e-mail corretamente',
			rg : 'Preencher com o rg corretamente',
			cidade : 'Preencher com a cidade corretamente',
			estado : 'Preencher com o estado corretamente'
		}
	});
}
function openImage (tg,obj)
{
	$('#'+tg).attr('src',$(obj).attr('href'));
	$('#'+tg).ready(function () {
		setTimeout(function () {$('#'+tg).fadeTo('fast',1)}, 1000);
	});		
	$('#'+tg).fadeTo('fast',0.6);
	
	return false;
}
$(document).ready(function(){ 
    //$(document).pngFix(); 
}); 
