/* 

Author: 			CH1
Author URI: 		http://www.ch1.fr/

Description:		CH1 - Oxford

*/


/* Suckerfish - 						http://htmldog.com/articles/suckerfish/dropdowns/ 

sfHover = function() {
	var sfEls = document.getElementById("navigation").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
*/

/* Swap moteur de recherche
________________________________________________ */
 
function swap( F, R ){
var vD = F.defaultValue;
if ( F.value == ( R ? '' : vD ) ) F.value = ( R ? vD : '' );
}

/* Cadres ronds et PNG FIX________________________________________________ */
DD_roundies.addRule('.round, #menu', '6px',true);
DD_roundies.addRule('.cadre_petit h3.insTitle-img,.cadre_moyen h3.insTitle-img,.cadre_flash2 h3.insTitle-img, .cadre_basic h3.insTitle-img', '6px 6px 0px 0px',true);
DD_roundies.addRule('#zoom_produit, a#lien_contact', '0px 0px 6px 6px',true);
DD_belatedPNG.fix('#logo,#recherche,.cadre_flash2 img, #cadre_pub img, .btn_retour');




/* JQUERY
________________________________________________ */
	
$(document).ready(function()	{
/* Galerie photo fiche */
	$('ul#galerie_produit li').eq(0).addClass('active');
	$('ul#galerie_produit li').append('<span class="tooltip"></span>');
	$('ul#galerie_produit li').hover(
		function(){	$(this).children('span.tooltip').fadeIn("fast")},
		function(){	$(this).children('span.tooltip').fadeOut("fast");}
	);
	$('ul#galerie_produit').galleria(
	{
			history   : true, // activates the history object for bookmarking, back-button etc.
			clickNext : true, // helper for making the image clickable
			insert    : '#main_image', // the containing selector for our main image
			onImage   : function(image,caption,thumb) { // let's add some image effects for demonstration purposes
				
				// fade in the image & caption
				if(! ($.browser.mozilla && navigator.appVersion.indexOf("Win")!=-1) ) { // FF/Win fades large images terribly slow
					image.css('display','none').fadeIn(1000);
				}
				
				// fetch the thumbnail container
				var _li = thumb.parents('li');
				
				// fade out inactive thumbnail
				_li.siblings().children('img.selected').fadeTo(500,0.3);
				
				// fade in active thumbnail
				thumb.fadeTo('fast',1).addClass('selected');
				
				// add a title for the clickable image
				image.attr('title','Suivante');
			},
			onThumb : function(thumb) { // thumbnail effects goes here
				
				// fetch the thumbnail container
				var _li = thumb.parents('li');
				
				// if thumbnail is active, fade all the way.
				var _fadeTo = _li.is('.active') ? '1' : '0.3';
				
				// fade in the thumbnail when finnished loading
				thumb.css({display:'none',opacity:_fadeTo}).fadeIn(1500);
				
				// hover effects
				thumb.hover(
					function() { thumb.fadeTo('fast',1); },
					function() { _li.not('.active').children('img').fadeTo('fast',0.3).css('cursor','pointer');; } // don't fade out if the parent is active
				)
			}
		}
	); 
	
	
/* accordeon */

$('#accordeon .accordeon_cache').hide();
$('#accordeon li').hover(
		function(){	$(this).css('cursor','pointer').addClass('TabHover')},
		function(){	$(this).removeClass('TabHover');}
	);

$('#accordeon>li').click(function() {
		if ($(this).hasClass('TabOpen')) {
			$(this).children('.accordeon_cache').slideUp('');
			$(this).removeClass('TabOpen');
				}
			else {
				$('#accordeon li .accordeon_cache').slideUp('');
				$('#accordeon li').removeClass('TabOpen');
				$(this).children('.accordeon_cache').slideDown('');
				$(this).addClass('TabOpen');
		}
});

/* cursor pointer sur gallerie photo fiche */

$('.galleria li').hover(function(){	$(this).css('cursor','pointer')});






});/* fin jquery */	

 



