// javascript handler for the player
	function thisMovie(movieName) {
	    if(navigator.appName.indexOf("Microsoft") != -1) {
			return window[movieName];
		} else {
			return document[movieName];
		}
	};

	function StartVideo(){
		var ap = new Fx.Style($('video'), 'right', {duration:1000});
		ap.addEvent('onComplete', function(){
			sendEvent('playpause');
		});
		ap.start('-600px', '0');
		$('btntv').style.visibility = 'hidden';
	}
	
	function ExitVideo(){
		var ap2 = new Fx.Style($('video'), 'right', {duration:1000});
		ap2.addEvent('onComplete', function(){	
			$('btntv').style.visibility = 'visible';
		});
		ap2.start('0', '-600px');
		
	}
function getUpdate(typ,pr1,pr2,pid) {
		//if(typ == "state" && pr1==0) { ExitVideo(); }
		if(typ == "time" && Math.round(pr1) > (7*60+3) ) { 
			sendEvent('stop');
			ExitVideo(); 
		}
	};
function sendEvent(typ,prm) { thisMovie("mpl").sendEvent(typ,prm); };



/**
 * gestion rollover
 */
var ac;
function accordioninit(){ 
	var trig = $$('#menu_left li.atStartTog');
	var box = $$('#menu_left ul.atStartEl'); 
	ac = new Accordion(	trig, 
							box, 
							{ 
								onActive: function(toggler, element){ 
								}, 
								onBackground: function(toggler, element){ 
								},
								onComplete: function(toggler, element){
									var winHeight = 0;
									var footHeight = $('footer').getSize();						
									if (window.ie){
										if (document.documentElement && document.compatMode && document.compatMode != "BackCompat"){
										   winHeight = document.documentElement.scrollHeight;//;
										   //old fashion - pb in IE on menu scroll $('footer').setStyle('bottom', 0);	
										}else{
										   winHeight = document.body.scrollHeight;
										}
										//$('footer').setStyle('top', winHeight - footHeight['size']['y']); //a voir
										$('footer').setStyle('bottom', 0); 
									}else{
										$('footer').setStyle('bottom', 0); 
									}
								}
							}, $('menu_left')); 
							
	/*rewriting "display" method here		
	 * add option index = -1 hide all
	 */		
	ac.display.prototype = function(index){
		if(index>=0){
			index = ($type(index) == 'element') ? this.elements.indexOf(index) : index;
			if ((this.timer && this.options.wait) || (index === this.previous && !this.options.alwaysHide)) return this;
			this.previous = index;
			var obj = {};
			this.elements.each(function(el, i){
				obj[i] = {};
				var hide = (i != index) || (this.options.alwaysHide && (el.offsetHeight > 0));
				this.fireEvent(hide ? 'onBackground' : 'onActive', [this.togglers[i], el]);
				for (var fx in this.effects) obj[i][fx] = hide ? 0 : el[this.effects[fx]];
			}, this);
		}else{
			var obj = {};
			this.elements.each(function(el, i){
				obj[i] = {};
				var hide = true;
				this.fireEvent(hide ? 'onBackground' : 'onActive', [this.togglers[i], el]);
				for (var fx in this.effects) obj[i][fx] = hide ? 0 : el[this.effects[fx]];
			}, this);
		}
		return this.start(obj);
	}
	
	trig.each(
		function(el, i){
			trig[ i ].addEvent('mouseover', 
								function(){ ac.display( i );});
		}
	)
}


var i=0;
function invertFadeA(el) {
	var dis = new Fx.Style(el[i], 'opacity', {duration:1500});
	dis.start(1, 0);
	i++;
	if (i == el.length) i = 0;
	var app = new Fx.Style(el[i], 'opacity', {duration:1500});
	app.start(0, 1);
}
function startFades() {
	setInterval('invertFadeA( $$("#boxleftone div.faded") )',4000);
}
function menu(){
	var menuline = $ES("li", 'ulmenu_left');
	menuline.each(
		function(el, i){
			var	line = new Fx.Styles(menuline[i], {duration:500, transition: Fx.Transitions.Sine.easeInOut});
			line.start({
				'opacity': [0, 1],
				'margin-top': [-100, 0]
			});
		});

	var logo = new Fx.Style("logo", 'opacity', {duration:1500});
	logo.start(0, 1);
}


/*GMAP*/
// === A function to create the marker and set up the event window ===
var gmarkers = [];
var i=0;

function createMarker(point,name,html) {
	var marker = new GMarker(point);
	GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml(html);
  	});
  	gmarkers[i] = marker;
  	i++;
  	return marker;
}

function theclick(i) {
        GEvent.trigger(gmarkers[i], "click");
      }


function Validate(form){
	var fields = $ES('.req');
	var returnObject = {isEmpty:false, champName:''}; 
	fields.each(
		function(el, i){
			if(!el.value){
				if(this.isEmpty == false) this.champName = el.name;
				this.isEmpty = true;	
			}
		}, returnObject	
	);
	if(returnObject.isEmpty == true){
		alert("The field " + returnObject.champName + " is required");
		return false;
	}else{
		return true;
	}
}
	  
function screens(page){
var nav = new Object();
nav.version = parseInt(navigator.appVersion);
nav.EstNetscape = false;
nav.EstMSIE = false;
if (navigator.appName.indexOf("Netscape") !=-1) {nav.EstNetscape = true};
if (navigator.appName.indexOf("Microsoft") !=-1) {nav.EstMSIE = true};
if (nav.EstMSIE) {popup=window.open(page,"","left=640,top=120,height=176,width=143,scrollbars=no")}
if (nav.EstNetscape) {popup=window.open(page,"","screenX=600,screenY=120,height=176,width=143,scrollbars=no")}
}

	  




