/* jQuery */ 

$(document).ready(function() {
	
	// Slider
	
	$('a.panel').click(function () {
		$('a.panel').removeClass('selected');
		$(this).addClass('selected');
		current = $(this);
		$('#wrapper').scrollTo($(this).attr('href'),  1600, {queue:true} );		
		return false;
	});
  
	// lightbox
	
	$(document).ready(function() {
		$("a.img_home").attr('rel', 'home').fancybox();
		$(".web a").attr('rel', 'web').fancybox();
		$(".logo a").attr('rel', 'logotype').fancybox();
		$(".print a").attr('rel', 'print').fancybox();
	});

  //twitter
  
	$(function(){
		$("#tweets").tweet({
        	avatar_size: 32,
        	count: 1,
        	username: ["ptitdoss"],
        	loading_text: "recherche le dernier tweet...",
        	refresh_interval: 60
		});
	});	
    
     // Accordion Projet
    
    lastBlock = $("#p1");
    maxWidth = 400;
    minWidth = 100;	

    $("#element ul li .p_element").hover(
      function(){
        $(lastBlock).animate({width: minWidth+"px"}, { queue:false, duration:400 });
	$(this).animate({width: maxWidth+"px"}, { queue:false, duration:400});
	lastBlock = this;
      }
    );
	
	// NivoSlider
	
	 $('#slider').nivoSlider({
        effect: 'fade', // Specify sets like: 'fold,fade,sliceDown'
        slices: 4, // For slice animations
        animSpeed: 500, // Slide transition speed
        pauseTime: 4000, // How long each slide will show
        directionNav: false, // Next & Prev navigation
    });
	
});

// Fin Jquery
 
function resizePanel() {
 
	width = $(window).width();
	height = $(window).height();
 
	mask_width = width * $('.item').length;
		
	$('#debug').html(width  + ' ' + height + ' ' + mask_width);
		
	$('#wrapper, .item').css({width: width, height: height});
	$('#mask').css({width: mask_width, height: height});
	$('#wrapper').scrollTo($('a.selected').attr('href'), 0);
		
}

/* Google Analytics */ 

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-2929375-6']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
  
/* Google Maps API */ 
 
function init() {
	var myLatlng = new google.maps.LatLng(45.43845,4.378819);
	
	var myOptions = {
	  zoom: 15,
	  center: myLatlng,
	  mapTypeId: google.maps.MapTypeId.ROADMAP
	};
	
	var map = new google.maps.Map(document.getElementById("Maps"),myOptions);
	var contentString = '<div id="content">'+
	'<div id="siteNotice">'+
	'</div>'+
	'<h2 id="firstHeading" class="firstHeading">Jean David DOS SANTOS</h2>'+
	'<div id="bodyContent">'+
	'<p><b>Adresse :</b> 59 rue A. Briand & de la paix, 42000 ST ETIENNE</p>'+
	'<p><b>Téléphone :</b> 0610626589</p>'+
	'</div>';

	var infowindow = new google.maps.InfoWindow({
		content: contentString
	});

	var marker = new google.maps.Marker({
		position: myLatlng,
		map: map,
		title:"Uluru (Ayers Rock)"
	});

	google.maps.event.addListener(marker, 'click', function() {
	  infowindow.open(map,marker);
	});
  }
