// JavaScript Document

//shadowbox
Shadowbox.init({
    handleOversize: "drag",
    modal: true
});

// abamenu1
function moveAbre(idDiv){
$(document).ready(function(){
   	$("#"+idDiv).stop().animate({top:0, height:56}, "normal");
	//$("#"+idDiv).stop().animate({height:56}, "normal");
	/*$("#"+idDiv+"1").stop().animate({top:8}, "normal");*/
})};
function moveFecha(idDiv){
$(document).ready(function(){
   	$("#"+idDiv).stop().animate({top:56, height:0}, "fast");
	//$("#"+idDiv).stop().animate({height:0}, "fast");
	/*$("#"+idDiv+"1").stop().animate({top:0}, "normal");*/
})};

//banner grande
$(document).ready(function() {
// redefine Cycle's updateActivePagerLink function 
	$.fn.cycle.updateActivePagerLink = function(pager, currSlideIndex) { 
		$(pager).find('li').removeClass('activeLI') 
			.filter('li:eq('+currSlideIndex+')').addClass('activeLI'); 
	}; 
	$('.espbanner').after('<div id="nav">').cycle({ 
		fx:     'fade', 
		speed:  'slow', 
		timeout: 5000, 
		pager:  '#nav',
		//sync: true,
		pagerAnchorBuilder: function(idx, slide) { 
        return '<li><a href="#"><img src="images/transparente.png" width="0" height="0" border="0" /></a></li>'; 
    	} 
	});
});
// banner pequeno
$(document).ready(function() {
	$('.espbannerNov').cycle({ 
		fx:     'fade', 
		speed:  'slow', 
		timeout: 7500, 
		sync: true
	});
});

// aba login
function moveAbreL(idDiv){
$(document).ready(function(){
	//$("#"+idDiv).stop().animate({top:-25}, "fast");
	$("#"+idDiv).stop().animate({backgroundPosition:'4px -1px'}, "normal");
	/*$("#"+idDiv+"1").stop().animate({top:8}, "normal");*/
})};
function moveFechaL(idDiv){
$(document).ready(function(){
	//$("#"+idDiv).stop().animate({top:0}, "fast");
	$("#"+idDiv).stop().animate({backgroundPosition:'4px -5px'}, "normal");
	/*$("#"+idDiv+"1").stop().animate({top:0}, "normal");*/
})};


var aberto=0;
function moveAbreLogin(idDiv){

	if(aberto==0){
		$(document).ready(function(){
			$("#"+idDiv).animate({top:0, height:50 }, 800);
		});
		aberto = 1;
	}else{
		$(document).ready(function(){
			$("#"+idDiv).stop().animate({top:-50, height:0}, 800);
		});
		aberto = 0;
	}
};


var aberto=0;
function moveAbremid(idDiv){

	if(aberto==0){
		$(document).ready(function(){
			$("#"+idDiv).animate({width:'460' }, 800, function(){$("div.icones").css({display:'block'});});
		});
		aberto = 1;
	}else{
		$(document).ready(function(){
			$("#"+idDiv).stop().animate({width:'150'}, 800, function(){$("div.icones").css({display:'none'});});
		});
		aberto = 0;
	}
};

$(document).ready(function(){
  $('a[href*=#]').click(function() {
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
    && location.hostname == this.hostname) {
      var $target = $(this.hash);
      $target = $target.length && $target
      || $('[name=' + this.hash.slice(1) +']');
      if ($target.length) {
        var targetOffset = $target.offset().top;
        $('html,body')
        .animate({scrollTop: targetOffset}, 1000);
       return false;
      }
    }
  });
});



//some e aparece menu
function toggle(id) {
	var ele = document.getElementById("texto" + id);
	var text = document.getElementById("displayText" + id);
	if(ele.style.display == "block") {
    	$(document).ready(function(){
			$(ele).css({display :'none' }, 800);
		});	
			//ele.style.display = "none";
		text.innerHTML = "+";
  	}
	else {
		ele.style.display = "block";
		text.innerHTML = "- ";
	}
} 



