/***
* fonctions de base
* version 1.4	12/2011
*/


$(document).ready( function() { 

//	$('#imgCubeLim').imagecube({speed: 4000, pause: 5000, imagePath: 'ui/js/' });

//	$('table#TableIndex h1').jdtr();
//	$('#Extra div p').jdtr();

	$('table#TableIndex h1').css('font-size','20px').css('text-shadow','4px 4px 4px #AAAAAA');
	$('#Extra div p').css('font-weight','normal').css('font-size','14px');
	$('#MenuP a').css('font-size','14px');

	var policeTitre = 'Permanent Marker';

	$('table#TableIndex h1').css('font-family',policeTitre);
	$('#Extra div p').css('font-family',policeTitre);
	$('#MenuP a').css('font-family',policeTitre);
	$('#MenuNav a').css('font-family',policeTitre);

/*
$("a[rel^='prettyPhoto[Zodiac]']").prettyPhoto({opacity: 0.7, theme:'light_rounded'});
*/

$("a[rel^='prettyPhoto']").prettyPhoto({opacity: 0.7, theme:'dark_rounded'});

function getBaseURL () {	// retourne url compléte d'une page
	var result = "";

	if ( document.baseURI === undefined ) {
		var baseTags = document.getElementsByTagName ("base");
		if ( baseTags.length > 0 ) {
			result = baseTags[0].href;	// ie
		} else {
			result = window.location.href;
		}
	} else {
		result = document.baseURI;
	}
	return result;

}

function getPage ( full ) {
	if ( full === undefined ) full=getBaseURL();
	var termes = full.split("\.php");
	var result = "";

	result = termes [ 0 ];
	termes = result.split("/");
	result = termes[ termes.length -1 ];
	return result;
}
/* appel ouverture prettyPhoto si necéssaire */

// DEV
$('.slideCycleContainer').each( function(index){
	var elementReference = $(this);
	
	$(this).find('br').remove();
	$(this).append('<var></var>').children().show();
	$(this).children('button:eq(0)').attr('id','cycle_clicPrev'+index);
	$(this).children('button:eq(1)').attr('id','cycle_clicNext'+index);
	$(this).children('div:eq(0)').attr('id','cycle_slideCycle'+index);

	$(this).children('#cycle_slideCycle'+index).cycle({
		prev: '#cycle_clicPrev'+index,
		next: '#cycle_clicNext'+index,
		timeout: 0,
		before: cycleOnBefore
	});

	function cycleOnBefore() { 
//		var gauche=($('.slideCycleContainer').width()-this.width)/2;
		var gauche=(elementReference.width()-this.width)/2;

		var hauteur=this.height;
		$(this)	//img
			.css('left',gauche )
			.parent().height(hauteur)	// slideCycle
			.parent().height(hauteur+20)	// Container
			.children('var').html(this.alt);	//
	}; 

});

$('.hoverOpac').each( function(index){
	$(this).children('img.HG').fadeTo(0,1).siblings().fadeTo(0,0.5);
	$(this).children('img').hover(function(){$(this).fadeTo(0,1).siblings().fadeTo(0,0.5);},function(){$(this).fadeTo(0,0.5).siblings('img.HG').fadeTo(0,1);} );
/*
	$(this).children('img').eq(0).fadeTo(0,0.5).hover(function(){$(this).fadeTo(0,1).siblings().fadeTo(0,0.5);},function(){$(this).fadeTo(0,0.5);} );
	$(this).children('img').eq(1).fadeTo(0,1).hover(function(){$(this).fadeTo(0,1).siblings().fadeTo(0,0.5);},function(){$(this).fadeTo(0,0.5);} );
	$(this).children('img').eq(2).fadeTo(0,0.5).hover(function(){$(this).fadeTo(0,1).siblings().fadeTo(0,0.5);},function(){$(this).fadeTo(0,0.5);} );
*/
});


});


