function GoogleMapsAPI() {

}


function CreateGraph(divid,datafile) {
	var myChart = new FusionCharts("inc/flash/FCF_Column3D.swf", "ChartId", "450", "350");
	myChart.setDataURL(datafile);
	myChart.render(divid);
}


/* -------------- AJAX PART -------------- */
function LoadPage(div,page)
{
	if(texte = file(div,page))
	{
		document.getElementById(div).innerHTML = texte;
		if (page==graphpage1) {
			pagetitle=window.document.title;
			CreateGraph('ca','inc/xml/GetDatas.php?datatype=graph_ca');
			//CreateGraph('effectif','inc/xml/GetDatas.php?datatype=graph_effectif');
			//CreateGraph('effectif','inc/xml/graph_effectif.xml');
			window.document.title=pagetitle;
		}
		texte="";
	}
}

function file(div,page)
{
	if(window.XMLHttpRequest) // FIREFOX
		xhr_object = new XMLHttpRequest(); 
	else if(window.ActiveXObject) // IE
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else
		return(false);

	xhr_object.open("GET", page, false);
	xhr_object.send(null);
	//if(xhr_object.readyState == 4) return(xhr_object.responseText);
	
		if(xhr_object.readyState == 0) { document.getElementById(div).innerHTML = '<img src="inc/img/loader.gif"><br>Not initialised...'; }
		if(xhr_object.readyState == 1) { document.getElementById(div).innerHTML = '<img src="inc/img/loader.gif"><br>Connection established! Please wait...'; }
		if(xhr_object.readyState == 2) { document.getElementById(div).innerHTML = '<img src="inc/img/loader.gif"><br>Request received...'; }
		if(xhr_object.readyState == 3) { document.getElementById(div).innerHTML = '<img src="inc/img/loader.gif"><br>Receiving response...'; }
		if(xhr_object.readyState == 4)
		{
			if(xhr_object.status == 200)
			{
				//document.getElementById(div).innerHTML = 'Request finished successfully !';
				//document.getElementById(div).style.display = 'none' ;
				//return true;
				return(xhr_object.responseText);
			}
			else
			{
				document.getElementById(div).innerHTML = 'Error => HTTP ' + xhr_object.status + '\nPlease reload this page';
			}
		}
	
	else return(false);
}
/* -------------- AJAX PART -------------- */


function ShowBox(boxid,type){
	LoadPage('contenttext',type + '_show.php?id=' + boxid);
	SetStats('inc/php/analyticstracking_' + type + '.php?id=' + boxid);
	Effect.SlideDown('hideall', {duration: 0.4 });
}

function HideBox(){
	Effect.SlideUp('hideall', {duration: 0.4 });
	//document.getElementById('hideall').style.display = "none";
}

/* -------- SCROLLING BOX -------- */
/************************************************************************************************************
	(C) www.dhtmlgoodies.com, November 2005
	
	This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.	
	
	Terms of use:
	You are free to use this script as long as the copyright message is kept intact. However, you may not
	redistribute, sell or repost it without our permission.
	
	Thank you!
	
	www.dhtmlgoodies.com
	Alf Magne Kalleland
	
	************************************************************************************************************/
		
	var slideTimeBetweenSteps = 30;	// General speed variable (Lower = faster)
	
	
	var scrollingContainer = false;
	var scrollingContent = false;
	var containerHeight;
	var contentHeight;	
	
	var contentObjects = new Array();
	var originalslideSpeed = false;
	function slideContent(containerId)
	{
		var topPos = contentObjects[containerId]['objRef'].style.top.replace(/[^\-0-9]/g,'');
		topPos = topPos - contentObjects[containerId]['slideSpeed'];
		if(topPos/1 + contentObjects[containerId]['contentHeight']/1<0)topPos = contentObjects[containerId]['containerHeight'];
		contentObjects[containerId]['objRef'].style.top = topPos + 'px';
		setTimeout('slideContent("' + containerId + '")',slideTimeBetweenSteps);
		
	}
	
	function stopSliding()
	{
		var containerId = this.id;
		contentObjects[containerId]['slideSpeed'] = 0;	
	}
	
	function restartSliding()
	{
		var containerId = this.id;
		contentObjects[containerId]['slideSpeed'] = contentObjects[containerId]['originalSpeed'];
		
	}
	function initSlidingContent(containerId,slideSpeed)
	{
		scrollingContainer = document.getElementById(containerId);
		scrollingContent = scrollingContainer.getElementsByTagName('DIV')[0];
		
		scrollingContainer.style.position = 'relative';
		scrollingContainer.style.overflow = 'hidden';
		scrollingContent.style.position = 'relative';
		
		scrollingContainer.onmouseover = stopSliding;
		scrollingContainer.onmouseout = restartSliding;
		
		originalslideSpeed = slideSpeed;
		
		scrollingContent.style.top = '0px';
		
		contentObjects[containerId] = new Array();
		contentObjects[containerId]['objRef'] = scrollingContent;
		contentObjects[containerId]['contentHeight'] = scrollingContent.offsetHeight;
		contentObjects[containerId]['containerHeight'] = scrollingContainer.clientHeight;
		contentObjects[containerId]['slideSpeed'] = slideSpeed;
		contentObjects[containerId]['originalSpeed'] = slideSpeed;
		
		slideContent(containerId);
		
	}
/* -------- SCROLLING BOX -------- */

function ChangeBG(ImageName) {
document.getElementById('TDContainer').style.backgroundImage="url("+ImageName+")";
}

function RestoreBG() {
//document.getElementById('TDContainer').style.backgroundImage="url(inc/img/expertises/fond-tablo.gif)";
document.getElementById('TDContainer').style.backgroundImage="";
}

