// JS Document

function checkClient()
{
    if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))){
   		return true;
    }else{
    	return false;
    }
}

function noFlash()
{
	swfobject.embedSWF("./swf/no-flash.swf", "no-flash", "1", "1", "9.0.0", "expressInstall.swf",{menu:"false", wmode:"transparent", allowscriptaccess:"always"}, {id:"detectFlash",name:"detectFlash"});
	
	$("#no-flash").load("./pages/no-flash.php");
	
	$("#no-flash").animate({ 
		opacity: 0.8
		}, 1500 );
}

function detectFlash(version) 
{
	tab = version.split(" ");
	num = tab[1].split(",");
	
	if (Number(num[0]) >= 9) {
	
		$("#no-flash").css("display","none");
		
	} else {
	
		var div = '<div id="no-flash"></div>'
		$("#no-flash").remove();
		$(".start").before(div);
		$("#no-flash").load("./pages/no-flash.php");
		$("#no-flash").animate({ 
	        opacity: 0.8
	     }, 1500 );
	}
}

function initStartPage() {

	$('.site').load("./pages/start.php");

} 

function initSitePage() {

	$('body').css("overflow","visible");
	$('body').css("backgroundImage","url(./img/fond.jpg)");
	$('body').css("backgroundColor","#666666");
	
	$('.site').load("./pages/site.php",{limit: 25}, function(){
	
		initElements();
	
	});

}


function goSite()
{

	$.scrollTo( '.site', 100);
    
    initSitePage();
    
}

function initLightBox() 
{
	$('.diaporama a').lightBox({
		imageBtnClose: './img/lightbox/close.png',
		imageLoading: './img/lightbox/loading.gif',
		imageBtnPrev: './img/lightbox/prev.gif',
		imageBtnNext: './img/lightbox/next.gif',
		imageBlank: './img/lightbox/blank.gif',
		containerBorderSize: 20,
		txtImage: 'Image',
		txtOf: 'sur'
	});
}

function diapo(id) 
{
	
	$.ajax({
		type: "POST",
		url: "./php/fonctions.php",
		data: "action=getImages&dir="+id,
		success: function(html){
			
			$(".diaporama").html(html);
			initLightBox();
			$(".diaporama a").eq(0).click();
			
		}
	});
	
}


function getBlocks() 
{
	
	$.ajax({
		type: "POST",
		url: "./php/fonctions.php",
		data: "action=getBlocks",
		success: function(html){
			
			$(".works").html(html);
			
		}
	});

}

function getDiv(type) 
{
	$("."+type).load("./inc/"+type+".inc.php");
}


function getDocumentSize()
{
    return new Array((document.documentElement && document.documentElement.scrollWidth) ? document.documentElement.scrollWidth : (document.body.scrollWidth > document.body.offsetWidth) ? document.body.scrollWidth : document.body.offsetWidth,(document.documentElement && document.documentElement.scrollHeight) ? document.documentElement.scrollHeight : (document.body.scrollHeight > document.body.offsetHeight) ? document.body.scrollHeight : document.body.offsetHeight);
}

function overEnter()
{

	$("#entrez").attr("src","./img/entrez_over.gif");
}

function outEnter()
{

	$("#entrez").attr("src","./img/entrez.gif");
}

function pngIE6init() {
	
	if (DD_belatedPNG) {
	
		DD_belatedPNG.fix('.bloc');
		DD_belatedPNG.fix('.bloc_mentions');
		DD_belatedPNG.fix('.titre_print');
		DD_belatedPNG.fix('.titre_logo');
		DD_belatedPNG.fix('.titre_web');
		DD_belatedPNG.fix('.titre_illus');
		DD_belatedPNG.fix('.titre_mentions');
		DD_belatedPNG.fix('.infos');
		DD_belatedPNG.fix('#histo');
		DD_belatedPNG.fix('.subBloc');
		DD_belatedPNG.fix('.subBlocInfos');
		DD_belatedPNG.fix('.crayons');
		DD_belatedPNG.fix('#imgHeader');
	
	}
	
}
