// JavaScript Document
$(document).ready(function(){

var style = 'easeOutBack';

  //RACK OUTLINE LINKS IE6 E 7
$("a").focus(function(){this.hideFocus=true;})

//RACK HOVER LINKS IE6 E 7
$("a").hover(function(){this.style.cursor = 'pointer';this.style.textDecoration = 'underline';})

//RACK UNDERLINE LINKS IE6 E 7
$("a").mouseout(function(){this.style.textDecoration = 'none';})


$('.canais').animate({'opacity':'0.2'})
$('.box').animate({'opacity':'0.5'});

var at = 1;
var ot = 1;


exibe = function(c)
{
	
	$('.canais').animate({'opacity':'0.2'})
	c = c.split('@');
	for(i=0;i<=c.length;i++)
	{
		$('#'+c[i]).animate({'opacity':'1'})
	}
}

$('.box').click(function(c)
{
	if (at != this.id)
	{
		at = this.id;
		
		$('.box').stop().animate({'opacity':'0.5'});
		$('.box').css({'background':'#f4eefc'});
		$('#'+this.id).stop().animate({'opacity':'1'});
		$('#'+this.id).css({'background':'#CCC'});
	}
	
	$('body,html').animate({scrollTop: '900px'},1000)
})

$('.box').hover(function()
{
	
	$('.box').stop().animate({'opacity':'0.5'});
	$('#'+this.id).stop().animate({'opacity':'1'});
})

$('#box_canais,#container_banner').mouseout(function()
{
	$('.box').stop().animate({'opacity':'0.5'});
	$('#'+at).stop().animate({'opacity':'1'});
})

$('#bt-1').click();

var div = $('#box_mouse').css({ position: 'absolute' });
var r = $('#container-rodape').innerWidth();
$(document).mousemove(function(e){
	
	var x = e.pageX-230
	//alert(x);
	if (x <= 0){x = e.pageX+5}
	div.css({
		top: e.pageY-5,
		left: x
	});
}); 

$('#box_mouse').stop().animate({'opacity':'0'});

$('.canais').hover(function(){
	$('#box_mouse').html("<strong>"+document.getElementById(this.id).name+"</strong><br />"+document.getElementById(this.id).lang);
	$('#box_mouse').stop().animate({'opacity':'1'});
})

$('.canais').mouseout(function(){
	$('#box_mouse').html('');
	$('#box_mouse').stop().animate({'opacity':'0'});
})

//---------------------------------
enviar_ = function()
{
	if (_vazio('nome_r','NOME')) return false;
	if (_vazio('cpf_r','CPF')) return false;
	if (_mail('email_r')) return false;
	if (_mail('email_c')) return false;
	
	if ($('#email_r').val() != $('#email_c').val())
	{
		alert('***Repita corretamente seu e-mail!');
		return false;
	}
	
	if (_vazio('prof','PROFISSAO')) return false;
	if (_vazio('mae','NOME DA MAE')) return false;
	if (_vazio('fone1','TELEFONE 1')) return false;
	if (_vazio('end','ENDERECO')) return false;
	if (_vazio('num','NUMERO')) return false;
	if (_vazio('cep','CEP')) return false;
	if (_vazio('bairro','BAIRRO')) return false;
	if (_vazio('cid','CIDADE')) return false;
	
	if (document.getElementById('ciente').checked == false)
	{
		alert('**ATENÇAO\nVoce deve marcar a opçao:\nEstou ciente de que o preenchimento do cadastro nao garante aprovaçao da venda que está sujeita a condiçoes de atendimento da área...');
		return false;
	}
	
	$.post("includes/_mail.php?e=solicita", $('#fmSol').serialize(),
		function(data){
			alert(data);
		});
}

//---------------------------------
ligar_ = function()
{
	if (_vazio('nome','NOME')) return false;
	if (_vazio('fone','FONE')) return false;
	if (_vazio('hora','HORA')) return false;

	
	$.post("includes/_mail.php?e=liga", $('#fmLiga').serialize(),
		function(data){
			alert(data);
		});
}

//---------------------------------
cont_ = function()
{
	if (_vazio('nome2','NOME')) return false;
	if (_vazio('fone2','FONE')) return false;
	if (_mail('mail')) return false;

	
	$.post("includes/_mail.php?e=contato", $('#fmCon').serialize(),
		function(data){
			alert(data);
		});
}

if (document.getElementById('fmSol')){
var fm = document.getElementById('fmSol');
var elementos = fm.getElementsByTagName('input');

for(var index =0; index < elementos.length; index++)
{elementos[index].tabIndex = index;}

}

})
