/*
'*****************************************************************************
'	Agestis - Content Management System - http://www.agestis.com
'	by ARICIA http://www.aricia.fr
'*****************************************************************************
'			Version:	20100122.1010
'			coder:	Damien
'*****************************************************************************

'	Diverses fonctions javascript
'*****************************************************************************
*/


var aElementCache = null;		// 


var Agestis = {
	_Version				: '1.1'
	, ElementCache			: null
	, RequireCSS : function( sCssSource ){
		var isLoaded = false;
		jQuery("link").each( function(){
			var re = new RegExp( sCssSource.replace("\.","\\.") + '$');
			if( this.href.match( re ) ){
				isLoaded = true;
			};
		});
		if( !isLoaded ) {
			document.write('<link rel="stylesheet" href="'+ sCssSource +'" type="text/css" media="screen" />');
		};
	}

	, Require : function( sScriptSource ){
		var isLoaded = false;
		jQuery("script").each( function(){
			var re = new RegExp( sScriptSource.replace("\.","\\.") + '$');
			if( this.src.match( re ) ){
				isLoaded = true;
			};
		});
		if( !isLoaded ) {
			document.write('<script type="text/javascript" src="'+ sScriptSource +'"><\/script>');
		};		}
	, Init : function(){
		}

};

Agestis.Init();


function CalculeLargeurIntitule( mVars , iDefaultWidth){
	// utilise le framework jQuery

	var sIntitulesTemp = "";
	var sExtraStyles = {
		'fontWeight': ( (FontBold!=0) ? 'bold':''),
		'fontStyle': ( (FontItalic!=0) ? 'italic':'' ),
		'fontFamily' : FontFamily ,
		'fontSize' : FontSize +"pt"
	};

	if( aElementCache==null ){
		aElementCache = jQuery("#Agestis_ElementCache");
	};
	aElementCache.html("").css( sExtraStyles );

	if( jQuery.isArray( mVars ) ){
		jQuery.each(  mVars, function(index, value) { 
			sIntitulesTemp += value + "<br />";
		});
	}else{
		sIntitulesTemp = mVars;
	};
	aElementCache.html( sIntitulesTemp );

	var iWidth = ( aElementCache.width() + LeftPaddng*2 )
	iWidth = ( iWidth < iDefaultWidth ) ? iDefaultWidth : iWidth ;
	return  iWidth;
};


var largeurcell;
var largeurecran;
var el_AgestisMenuWidthFitTo = 'GUI_Header';


if( !window.jQuery === undefined ){
	jQuery(document).ready(function(){
		//console.log( "JQuery document ready" );
	});
};
