// JavaScript Document
$(document).ready(function () {

var $panels = $('#conteudo .scrollContainer > div');
var $container = $('#conteudo .scrollContainer');
var horizontal = true;
if (horizontal) {
  $panels.css({
    'float' : 'left',
    'position' : 'relative' 
  });
  $container.css('width', $panels[0].offsetWidth * $panels.length);
}
var $scroll = $('#conteudo .scroll').css('overflow', 'hidden');
$scroll.height($('#home').height() + 45);
function selectNav() {
  $(this)
    .parents('ul:first')
      .find('a')
        .removeClass('ativo')
      .end()
    .end()
    .addClass('ativo');
}
$('#menuTopo').find('a').click(selectNav);
function trigger(data) {
  var el = $('#menuTopo').find('a[href$="' + data.id + '"]').get(0);
  selectNav.call(el);
}
if (window.location.hash) {
  trigger({ id : window.location.hash.substr(1) });
} else {
  $('#menuTopo a:first').click();
}
var offset = parseInt((horizontal ? $container.css('paddingTop') : $container.css('paddingLeft')) || 0) * -1;
var scrollOptions = {
  target: $scroll, 
  items: $panels,
  navigation: '#menuTopo a',
  axis: 'x',
  onAfter: trigger,
  offset: offset,
  duration: 500,
  onBefore: function( e, elem, $pane, $items, pos ){
			$pane.height($(elem).height() + 45);
		}
  
};
$('#conteudo').serialScroll(scrollOptions);
$.localScroll(scrollOptions);
scrollOptions.duration = 1;
$.localScroll.hash(scrollOptions);
});

$(document).ready(function() {
   $('a').filter(function() {
   return this.hostname && this.hostname !== location.hostname;
  }).attr('target','_blank');
});

$(document).ready(function(){
$("body").css("overflow-y","scroll");						   
$(".fadeImg").fadeTo("slow", 0.3); 
$(".fadeImg").hover(function(){
$(this).fadeTo("slow", 1.0); 
},function(){
$(this).fadeTo("slow", 0.3); 
});
});

jQuery(function( $ ){
	var $panels = $('#full div.carteiraCliente');
	$('#full').css('width', $panels[0].offsetWidth * $panels.length);
	
	$('#screen').serialScroll({
		target:'#sections',
		items:'div.carteiraCliente', 
		prev:'img.prev',
		next:'img.next',
		navigation:'#navigation li a',
		axis:'x',
		duration:500,
		force:true, 
		onBefore: function( e, elem, $pane, $items, pos ){
			$pane.height($(elem).height() + 10);
			$('#conteudo .scroll').height($(elem).height() + 120);
		}
	});
});

$('#dialog').ready(function() {	

		var id = '#dialog';
	
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
	
		$('#mask').css({'width':maskWidth,'height':maskHeight});

		$('#mask').fadeIn(1000);	
		$('#mask').fadeTo("slow",0.8);	
	
		var winH = $(window).height();
		var winW = $(window).width();
              
		$(id).css('top',  winH/2-$(id).height()/2);
		$(id).css('left', winW/2-$(id).width()/2);
	
		$(id).fadeIn(2000); 
	
		
	$('.window .close').click(function (e) {
		e.preventDefault();
		
		$('#mask').hide();
		$('.window').hide();
	});		
	
	$('#mask').click(function () {
		$(this).hide();
		$('.window').hide();
	});			
	
});


