/**
 *
 * $Author: olivier.bolender $
 * $Revision: 3 $
 * $HeadURL: svn://localhost:3690/PR2008120202/trunk/data/javascript/data.js $
 *
 **/

/*
1 : Produit
2 : Panier
*/


/* Hack IE pour la fonction indexOf */
	if(!Array.indexOf){
	    Array.prototype.indexOf = function(obj){
	        for(var i=0; i<this.length; i++){
	            if(this[i]==obj){
	                return i;
	            }
	        }
	        return -1;
	    }
	}



jQuery(function( $ ){
	/**
	 * Demo binding and preparation, no need to read this part
	 */
		//borrowed from jQuery easing plugin
		//http://gsgd.co.uk/sandbox/jquery.easing.php
		$.easing.elasout = function(x, t, b, c, d) {
			var s=1.70158;var p=0;var a=c;
			if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
			if (a < Math.abs(c)) { a=c; var s=p/4; }
			else var s = p/(2*Math.PI) * Math.asin (c/a);
			return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
		};
		$('a.back').click(function(){
			$(this).parents('div.pane').scrollTo( 0, 800, { queue:true } );
			$(this).parents('div.section').find('span.message').text( this.title );
			return false;
		});
		//just for the example, to stop the click on the links.
		$('ul.links').click(function(e){
			e.preventDefault();
			var link = e.target;
			link.blur();
			if( link.title )
				$(this).parent().find('span.message').text(link.title);
		});
	



});


$(document).ready(function(){

	overlay_show();
	$("#bottom").fadeTo(0, 0.5);

	$("#retour").mouseover(function() {
		$(this).animate({'left':'-=10px'}, 'fast');
	});
	$("#retour").mouseout(function() {
		$(this).animate({'left':'+=10px'}, 'fast');
	});

	$("#suite").mouseover(function() {
		$(this).animate({'left':'+=10px'}, 'fast');
	});
	$("#suite").mouseout(function() {
		$(this).animate({'left':'-=10px'}, 'fast');
	});

	$("#bottom_overlay").mouseover(function() {
		$("#bottom").animate({'bottom':'+=30px'}, 'fast');
	});
	$("#bottom_overlay").mouseout(function() {
		$("#bottom").animate({'bottom':'-=30px'}, 'fast');
	});

})

function GotoURL(value) {
	$("#overlay").show().fadeTo('normal', 1, function() {
		location.href = value;
	});
}

function overlay_show(opacity) {
	opacity = opacity || 1;
	$("#overlay").show().fadeTo('fast', opacity);
	return true;
	};

function overlay_hide() {
	$("#overlay").fadeTo('slow', 0, function(){
			$(this).hide();
			});
	return true;
	};

































$(document).ready(function(){

 $.fn.wait = function(time, type) {
        time = time || 1000;
        type = type || "fx";
        return this.queue(type, function() {
            var self = this;
            setTimeout(function() {
                $(self).dequeue();
            }, time);
        });
    };

	// Initialise l'overlay
	$("#overlay").fadeTo(0,0);

	/*$(document).click(function () {
		//overlay_show(0.8);
		$.scrollTo( '#scroll_2', 800, {easing:'elasout'} );
	});*/


	$("#box").click(function(){
		//alert('ok');
		$(".box_inline").animate( {'top':'-80px'}, {easing:'elasout'}, 100 );
	});
});




function overlay_show(opacity) {
	opacity = opacity || 1;
	$("#overlay").show().fadeTo('fast', opacity);
	return true;
	};

function overlay_hide() {
	$("#overlay").fadeTo('slow', 0, function(){
			$(this).hide();
			});
	return true;
	};