var id_clicked = null;
$(document).ready(function(){
	/*
	$("nav div").mouseover(function(){
		id = this.id.substring(5);
		if(id != id_clicked)
			$(this).css('background-image', 'url(images/menu_hover_' + id + '.jpg)')
	});
	
	$("nav div").click(function(){
		id = this.id.substring(5);
		if(id_clicked != null){
			$("#menu_" + id_clicked).css('background-image', 'url(images/menu_' + id_clicked + '.jpg)');
		}
		id_clicked = id;
		$(this).css('background-image', 'url(images/menu_click_' + id + '.jpg)')
	});
	
	$("nav div").mouseout(function(){
		id = this.id.substring(5);
		
		if(id_clicked != id)
			$(this).css('background-image', 'url(images/menu_' + id + '.jpg)');
		else
			$(this).css('background-image', 'url(images/menu_click_' + id + '.jpg)');
	});
	*/
});

function load(href, target){
	if(target == "" || target == null)
		target = "div_corpo";

	$.ajax({
		type: "GET",
		url: href,
		beforeSend: function(){
			img = document.createElement('img');
			img.src = "images/ajax-loader.gif";
			c = document.createElement('div');
			c.className = 'ajax-loader';
			c.appendChild(img);
			$("#"+target).html("");
			$("#"+target).append(c);
		},
		success: function(response){
			$("#"+target).hide();
			$("#"+target).html(response);
			$("#"+target).fadeIn();
		},
		error: function(XMLHttpRequest, textStatus, errorThrown){
		}
	});
}

var cod = 3847;
var pemail = "eci@business.org.br";

function registrar(){
	var nome = new String(document.FormOrca.nome.value);
	var telefone = new String(document.FormOrca.telefone.value);
	var email = new String(document.FormOrca.email.value);
	var assunto = new String(document.FormOrca.assunto.value);
	var descritivo = new String(document.FormOrca.descritivo.value);
	if(nome == "" || email == "" || assunto == "" || descritivo == ""){
		alert("Campos nao estao preenchidos corretamente!");
		return;
	}
	
	$.ajax({
		type: "POST",
		url: "/business/paginas/empresas/EnviaOrca.asp?cod="+cod+"&email="+pemail,
		data: $("#FormOrca").serialize(),
		beforeSend: function(){
			img = document.createElement('img');
			img.src = "images/ajax-loader.gif";
			c = document.createElement('div');
			c.className = 'ajax-loader';
			c.appendChild(img);
			$("#div_corpo").html("");
			$("#div_corpo").append(c);
		},
		success: function(response){
			$("#div_corpo").html(response);
		}
	});
}