var timeoutBanner = false;
$(function() {
	
	var addthis_config =
	{
		pubid: 'ra-4e1c892967d41a9c',
		services_exclude: 'twitter',
		ui_508_compliant: true

	}
	var addthis_share =
	{
	   templates: {
		   twitter: 'Conheça o Escola Via Net Visite nosso hotesite http://hotsite.escolavianet.com.br (from @escolavianet)'

	   }
	}
	
	//  Get the parameter value after the # symbol
    var urlhash=document.URL.split('#')[1];
    if(urlhash == undefined){
    	urlhash = '';
    }
    
    if(urlhash == 'banner-index'){
    	$('#header #nav li').removeClass('active-nav');
    	$('img.seta-nav').appendTo('#header #nav li#bannerindex');
		$('#bannerindex').addClass('active-nav');
		
		$( 'html, body' ).animate({ scrollTop : $('#banner-index').offset().top }, 'slow');
    }
    
    if(urlhash == 'quemsomosindex'){
    	$('#header #nav li').removeClass('active-nav');
    	$('img.seta-nav').appendTo('#header #nav li#perfil-evn');
		$('#perfil-evn').addClass('active-nav');
		
		jQuery(window).load(function() {
		
		$( 'html, body' ).animate({ scrollTop : $('#quem-somos-index').offset().top }, 'slow');
		
		});
    }
    
    if(urlhash == 'contatoindex'){
    	$('#header #nav li').removeClass('active-nav');
    	$('img.seta-nav').appendTo('#header #nav li#contato');
		$('#contato').addClass('active-nav');
		
		jQuery(window).load(function() {

		$( 'html, body' ).animate({ scrollTop : $('#contato-index').offset().top }, 'slow');
		
		});

		
    }
    

	$('#header #nav li').click(function(){
		$('#header #nav li').removeClass('active-nav');
		$('img.seta-nav').appendTo(this);
		$(this).addClass('active-nav');
		
		var $id = $(this).find('a').attr('href');
		
	    $( 'html, body' ).animate({ scrollTop : $( $id ).offset().top }, 'slow');
	    return false;
	});
	
	
	$('#box-banner-index').cycle({ 
	    fx:     'scrollRight'
	});
	
	$("ul.tabs").tabs("div.panes > div", {effect: 'fade'});
	//$("ul.tabs").tabs("div.panes > div");
	
	 $('.depoimento-quem2').cycle({
			fx: 'fade',
			speed:    400, 
		    timeout:  10000,
		    cleartypeNoBg:true,
		    cssBefore: 'depoimento-quem'
		});
	
	$('ul.tabs li').click(function(){
		$('img.seta-tabs').appendTo(this);
	});
	
	$('a[rel=external]').click(function() {
		window.open($(this).attr('href'));
		return false;
	});
	
	
	
});
