$(document).ready(function() {
	
	/*TEMPORARY - ENGLISH: COMING SOON*/
	/*$("#nav-lang").click(function(e){
		e.preventDefault();
		alert("Coming Soon");
	});*/
	
	/* Roll hover images */
	var preload = new Array();
	$('img.roll').each(function (i) {
		//let's preload
		var img = new Image();
		img.src = this.src.replace(/([_-])off([._-])/, '$2on$2');
		preload.push(img);
		$(this).hover(
			function () { // over
				$(this).attr('src',this.src.replace(/([_-])off([._-])/, '$1on$2'));
			},
			function () { // out
				$(this).attr('src',this.src.replace(/([_-])on([._-])/, '$1off$2'));
			}
		);
	});
	/*
	vieille facon de faire
	
	$('.id.one').hover(function(e) {
		var $over = $('.over', this);
		$over.stop().animate({top:26}, 600, 'easeOutQuart');
		$('b.phone', this).css('backgroundColor', '#cf171d');
	},function(e) {
		var $over = $('.over', this);
		$over.stop().animate({top:-300}, 800, 'easeOutQuart');
		$('b.phone', this).css('backgroundColor', '#595959');
	});
	
	$('.id.two').hover(function(e) {
		var $over = $('.over', this);
		var $span = $('span', $over).css('opacity', 0);
		
		$over.stop().animate({top:26}, 600, 'easeOutQuart');
		$span.stop().delay(600).animate({opacity:1}, 600, 'easeOutQuart');
	},function(e) {
		var $over = $('.over', this);
		var $span = $('span', $over);
		
		$span.stop().animate({opacity:0}, 600, 'easeOutQuart');
		$over.stop().delay(600).animate({top:-300}, 800, 'easeOutQuart');
	});*/
	
	$('.id').each(function(){
		
		var bloc = $('<b class="phone red" style="background:#cf171d;z-index:70;"/>').css('opacity', 0);
		
		$('b.phone', this).css('zIndex', '60');
		$(this).prepend(bloc);
		
	});
	$('.id').hover(function(e) {
		var $over = $('.over', this);
		var $bloc = $('b.phone.red', this);
		
		$over.stop().animate({top:26}, 600, 'easeOutQuart');
		$bloc.stop().animate({opacity:1}, 400, 'easeOutQuart');
	},function(e) {
		var $over = $('.over', this);
		var $bloc = $('b.phone.red', this);
		
		$over.stop().animate({top:-190}, 600, 'easeOutQuart');
		$bloc.stop().animate({opacity:0}, 900, 'easeOutQuart');
		
	});
	
	/* jquery scroll pane*/
	//$(function()
	//{
	$('.scroll-pane').jScrollPane();
	//});
	
	
	/* <!-- start smooth scroll -- */
	// http://www.zachstronaut.com/posts/2009/01/18/jquery-smooth-scroll-bugs.html
	var scrollElement = 'html, body';
	$('html, body').each(function () {
	var initScrollTop = $(this).attr('scrollTop');
	$(this).attr('scrollTop', initScrollTop + 1);
	if ($(this).attr('scrollTop') == initScrollTop + 1) {
		scrollElement = this.nodeName.toLowerCase();
		$(this).attr('scrollTop', initScrollTop);
		return false;
	}
	
		// Smooth scrolling for internal links
	$("a[href^='#']").click(function(event) {
		event.preventDefault();
		var $this = $(this),
		target = this.hash,
		$target = $(target);
		
		$(scrollElement).stop().animate({
			'scrollTop': $target.offset().top
			}, 500, 'swing', function() {
				window.location.hash = target;
			});
		});
	});
	/* -- end smooth scroll --> */
});
