window.onload = function() {

	if (navigator.appName == 'Microsoft Internet Explorer') {
		DD_roundies.addRule('#container-right, #container-all', '10px');
		DD_roundies.addRule('.menu, .rounder, .description', '8px');
	}
	
	var fieldBusca = document.getElementById('key');
	
	// Busca
	fieldBusca.onfocus = function() {
		if (this.value == 'Pesquisar no site') { this.value = ''; }
	}

	fieldBusca.onblur = function() {
		if (!this.value) { this.value = 'Pesquisar no site'; }
	}
	
	// Somente para formulário de contato
	if(document.getElementById('form_contato'))
	{
		var fieldNome = document.getElementById('nome');
		var fieldEmail = document.getElementById('email');
		var fieldEmpresa = document.getElementById('empresa');
		var fieldTelefone = document.getElementById('telefone');
		
		// Envio do formulário
		var frm = new FormValidator('form_contato');
		frm.IMAGE = 'imagens/hint/bullet.gif';
		frm.onsubmit = function(validated, campos) {
			
			if (fieldNome.value == '* Nome') {
				frm.markField(fieldNome, frm.IMAGE, 'Campo de preenchimento obrigatório');
				validated = false;
			}
			
			if (fieldEmail.value == '* E-mail') {
				frm.markField(fieldEmail, frm.IMAGE, 'Campo de preenchimento obrigatório');
				validated = false;
			}
			
			if (fieldEmpresa.value == '* Empresa') {
				frm.markField(fieldEmpresa, frm.IMAGE, 'Campo de preenchimento obrigatório');
				validated = false;
			}
	
			if (!validated) {
				alert('Preencha corretamente os campos assinalados em vermelho.');
				return false;
			} else {
				if (fieldTelefone.value == 'Telefone') {
					fieldTelefone.value = '';
				}			
			}
		}
	
		// Nome
		fieldNome.onfocus = function() {
			if (this.value == '* Nome') { this.value = ''; }
		}
	
		fieldNome.onblur = function() {
			if (!this.value) { this.value = '* Nome'; }
		}
	
		// E-mail
		fieldEmail.onfocus = function() {
			if (this.value == '* E-mail') { this.value = ''; }
		}
	
		fieldEmail.onblur = function() {
			if (!this.value) { this.value = '* E-mail'; }
		}
	
		// Empresa
		fieldEmpresa.onfocus = function() {
			if (this.value == '* Empresa') { this.value = ''; }
		}
	
		fieldEmpresa.onblur = function() {
			if (!this.value) { this.value = '* Empresa'; }
		}
	
		// Telefone
		fieldTelefone.onfocus = function() {
			if (this.value == 'Telefone') { this.value = ''; }
		}
	
		fieldTelefone.onblur = function() {
			if (!this.value) { this.value = 'Telefone'; }
		}
	}
}
