document.addEvent('domready', function() { 
	
	resizeDivWidth('flash',  document.body.clientWidth);
	
	var thePath = SWFAddress.getPathNames(); //get&split url
	if(thePath == "contact"){
		outpandDiv();
		loadcontact();
	}else if(thePath == "a-propos"){
		outpandDiv();
		loadabout();
	}


});

/*
function tweenDiv(elem, prop, value)
{
	$(elem).tween(prop, value);
}
*/

function resizeDivWidth(elem, value){
	$(elem).setStyle('width', value);
}

function resizeSideBar(){

	if($('flash').getStyle('width').toInt() >160){
		
		resizeDivWidth('flash',  window.outerWidth);
	}
}

function getLangue(){
	var myStr=new String(location.pathname);
	en = myStr.search('/en/');
	if(en == -1){
		langue = "fr";
	}else{
		langue = "en";
	}
	return langue;
}


function loadabout(){

	langue = getLangue();
	if(langue == "fr"){
		request('index.php?page=a-propos');
	}else{
		request('index.php?page=about');
	}
}
function loadcontact(){

	langue = getLangue();
	if(langue == "fr"){
		request('index.php?page=contact');
	}else{
		request('index.php?page=contactus');
	}
}
function switchLanguage(){
	langue = getLangue();
	if(langue == "fr"){
		window.location = "en/";
	}else{
		window.location = "fr/";
	}
}
function request(link){

	var request = new Request.HTML({
		url: link,
		onSuccess: function(html) {
			$('content').setStyle('visibility','visible');
			$('content').erase('text');
			$('content').adopt(html);
		}
	}).get();
}


