var showIn = false;
function ajax_texte(e,id) {
	if(showIn==true) {
		return hideOverInfo(e,id);
	}
	showIn = true;
	$.get($(e).attr('href')+',1',
  function(data){
  	$('#txt_ajax > .in').html(data);
	  $('#txt_ajax').animate({ 
	  	height:$('#full_main').innerHeight()-$('#hline').innerHeight()-$('#bline').innerHeight(),
	    opacity: 0.99
	  }, 1000 , function() {$('#txt_ajax > .in').fadeIn('fast');$('#full_main').append('<a href="javascript:void(0)" onclick="hideOverInfo()" id="closeinfo"><img src="/img/static/close.gif" alt="close" title="close"></a>');$('#closeinfo').slideDown('slow');});
  });
  return false;
}

/*function showOverInfo(id) {
	if(showIn[id]!=undefined) {
		hideOverInfo(id);
		return
	}
	for (tid in showIn){
    hideOverInfo(tid);
	}

	showIn[id] = id;
  $(id).animate({ 
  	height:490,
    opacity: 0.99
  }, 1000 , function() {$(id+' > .in').fadeIn('fast');});
}*/
function hideOverInfo(e,id) {
	showIn = false;
  $('#txt_ajax > .in').fadeOut('fast',function() {
  		$('#txt_ajax').animate({ 
  		height:0,
    	opacity: 0
 		},1000);
 		$('#closeinfo').slideUp('slow',function() {
 			$(this).remove();
 			if(e!=null && id!=null)
 				ajax_texte(e,id);
 		});
  });
  return false;
}
function Random(X) {
    return Math.floor(X * (Math.random() % 1));
}
function Deal(N) {
    var J, K, Q = new Array(N);
    for (J = 0; J < N; J++) {
        K = Random(J + 1);
        Q[J] = Q[K];
        Q[K] = J;
    }
    return Q;
}
function ross(M, N) {
    var aSet = [], bSet = [], j;
    if (M > N) {
        M = N;
    }
    while (M > 0) {
        j = Random(N) + 1;
        if (!aSet[j]) {
            bSet[--M] = aSet[j] = j;
        }
    }
    return bSet;
}

function RanSpan(MinV, MaxV) {
    return MinV + Random(MaxV - MinV + 1);
}

var timer = false;
/*$(window).load(function () {
$('#bline').children().hide();
$('#hline').children().hide();
$('#main > *').bind("mouseover",function(){
	$('#bline').children().fadeIn('fast');
	$('#hline').children().fadeIn('fast');
});
$('#main').bind("mouseenter",function(){
	$('#bline').children().fadeIn('fast');
	$('#hline').children().fadeIn('fast');
}).bind("mouseover",function(){
	$('#bline').children().fadeIn('fast');
	$('#hline').children().fadeIn('fast');
}).bind("mouseleave",function(){ setTimeout(function() {$('#bline').children().fadeOut('fast');$('#hline').children().fadeOut('fast');},300);	});
});*/

function evalValue(selObj){ 
 eval(selObj.options[selObj.selectedIndex].value)
}
var inUse = false;
function next_page(){ 
 if(!inUse) {
 	inUse = true;
	 var urlLoad = nextPage+',1.cfm';
		$.ajax({
		   type: "GET",
		   url: urlLoad,
		   dataType: "script"
		 });
 }
 return false;
}
function prev_page(){ 
 if(!inUse) {
 	inUse = true;
	 var urlLoad = prevPage+',1.cfm';
		$.ajax({
		   type: "GET",
		   url: urlLoad,
		   dataType: "script"
		 });
 }
 return false;
}
var diapoTime =false;
function stopDiapo() {
	inUse = false;
	if(!diapoTime) return;
	if(autoDiapoTime){ clearInterval(autoDiapoTime);autoDiapoTime=false;}
	if(diapoTime.length < 1)return;
	for (i = 0; i < diapoTime.length; i++) {
      clearTimeout(diapoTime[i]);
  }
}
var autoDiapoTime = false;
function autoDiapo() {
	if(!autoDiapoTime) {
		next_page();
		autoDiapoTime=setInterval('next_page()', (2000*iMode)+3000);
	}
}
/*show / hide titre des images*/
var timerhideTitle = new Array();
function showTitle(e,i) {
	if(timerhideTitle[i] != undefined)
		clearTimeout(timerhideTitle[i]);
	$(e).children('.img_title').fadeIn('fast');
}

function hideTitle(e,i) {
	timerhideTitle[i] = setTimeout(function() {
		$(e).children('.img_title').fadeOut('fast');
	}
	,100);
}
/*Animation sur les mots changeants*/
function changeMot(id,mots,iMot,iEndMot) {
	$(id).fadeOut('fast',function(){
		$(this).html(mots[iMot]);
		iMot++;
		if(iMot>iEndMot)iMot=0;
		$(this).fadeIn('fast',function(){ 
			setTimeout(function() {
				changeMot(id,mots,iMot,iEndMot);
			},3000);
		});
	})
}

/*Pop up pour le player mp3*/
var newwindow = '';
function mp3player(url) {
	if (!newwindow.closed && newwindow.location) {
		newwindow.location.href = url;
	}
	else {
		newwindow=window.open(url,"mp3player","menubar=no, status=no, scrollbars=no, menubar=no, width=200, height=20");
		if (!newwindow.opener) newwindow.opener = self;
	}
	if (window.focus) {newwindow.focus()}
	return false;
}
