var nom="v.scesa";
var nom2="job";
var nom3="contact";
var at="@";
var heb="instinct-maker";
var ext=".com"
var complet=nom+at+heb+ext;
var complet2=nom2+at+heb+ext;
var complet3=nom3+at+heb+ext;


var langue_site="en";


var tab_menu_enfr = new Array();
tab_menu_enfr["menu_princ1_en"]="Company";
tab_menu_enfr["menu_princ1_fr"]="Présentation";
tab_menu_enfr["menu_princ2_en"]="Technologies";
tab_menu_enfr["menu_princ2_fr"]="Technologies";
tab_menu_enfr["menu_princ3_en"]="Solutions";
tab_menu_enfr["menu_princ3_fr"]="Solutions";
tab_menu_enfr["menu_princ4_en"]="News";
tab_menu_enfr["menu_princ4_fr"]="News";
tab_menu_enfr["menu_princ5_en"]="Career";
tab_menu_enfr["menu_princ5_fr"]="Carrière";
tab_menu_enfr["menu_princ6_en"]="Contact";
tab_menu_enfr["menu_princ6_fr"]="Contact";

tab_menu_enfr["sous_menu1_1_en"]="About us";
tab_menu_enfr["sous_menu1_1_fr"]="Qui sommes-nous ?";
tab_menu_enfr["sous_menu1_2_en"]="Our team";
tab_menu_enfr["sous_menu1_2_fr"]="L'équipe";
tab_menu_enfr["sous_menu1_3_en"]="Our partners";
tab_menu_enfr["sous_menu1_3_fr"]="Partenaires";
tab_menu_enfr["sous_menu1_4_en"]="Our office";
tab_menu_enfr["sous_menu1_4_fr"]="Localisation";

tab_menu_enfr["sous_menu2_1_en"]="Instinct Behavior Engine";
tab_menu_enfr["sous_menu2_1_fr"]="IBE";
tab_menu_enfr["sous_menu2_2_en"]="Instinct Building tools";
tab_menu_enfr["sous_menu2_2_fr"]="IBT";
tab_menu_enfr["sous_menu2_3_en"]="White paper and video";
tab_menu_enfr["sous_menu2_3_fr"]="Presse et vidéo";

tab_menu_enfr["sous_menu3_1_en"]="Custom Engine";
tab_menu_enfr["sous_menu3_1_fr"]="Moteur";
tab_menu_enfr["sous_menu3_2_en"]="IBT Software";
tab_menu_enfr["sous_menu3_2_fr"]="Logiciels";
tab_menu_enfr["sous_menu3_3_en"]="Behaviors libraries";
tab_menu_enfr["sous_menu3_3_fr"]="Librairies";
tab_menu_enfr["sous_menu3_4_en"]="References";
tab_menu_enfr["sous_menu3_4_fr"]="Références";


var tab_menu = new Array("menu_princ1","menu_princ2","menu_princ3","menu_princ4","menu_princ5","menu_princ6","sous_menu1_1","sous_menu1_2","sous_menu1_3","sous_menu1_4","sous_menu2_1","sous_menu2_2","sous_menu2_3","sous_menu3_1","sous_menu3_2","sous_menu3_3","sous_menu3_4");

function onchangelangue(lang)
{
	if (encours==0)
	{
		if (glob_nom!="")
		{
			if (ancien_sous_menu!="")
		  		nom_fen=glob_nom+"_"+ancien_sous_menu+"_contenu_";
		  	else
				nom_fen=glob_nom+"_contenu_";
		
			document.getElementById(nom_fen+langue_site).style.visibility="hidden";
			langue_site=lang;
			document.getElementById(nom_fen+langue_site).style.visibility="visible";
	
	 	}
	 	else
			langue_site=lang;
	
		for (i=1;i<tab_menu.length;i++)
			document.getElementById(tab_menu[i]).innerHTML=tab_menu_enfr[tab_menu[i]+"_"+langue_site];
 	}
}


function ecrire_mail(adresse,nom)
{
	document.write ('<a href="mailto:'+adresse+'">'+nom+'</a>');
}

function ecrire_iframe()
{
	document.write ('</iframe>');
}


var tab_pos = new Array(23);
for (i=0; i<23; i++)
{
	tab_pos[i] = new Array(2);
}
var tab_vit = new Array(23);

var tab_pos2 = new Array(6);
for (i=0; i<6; i++)
{
	tab_pos2[i] = new Array(2);
}
var tab_vit2 = new Array(6);



var hauteur_page=parseFloat(document.body.clientHeight);
var largeur_page=parseFloat(document.body.clientWidth);
var hauteur_tab=0;
var largeur_tab=0;

//on centre sur la page
function centrer_tableau()
{
	hauteur_tab=parseFloat(document.getElementById('theboss').offsetHeight);
	var top_tab=(hauteur_page/2)-(hauteur_tab/2);

	largeur_tab=parseFloat(document.getElementById('theboss').offsetWidth);
	var left_tab=(largeur_page/2)-(largeur_tab/2);

	if (top_tab<0)
		top_boss="0";
	else
		top_boss=top_tab;
		
	document.getElementById('theboss').style.top=top_boss+"px";
	document.getElementById('theboss').style.left=left_tab+"px";


	document.getElementById('copyright_k-u').style.top=(hauteur_tab-13)+"px";
	document.getElementById('copyright_k-u').style.left=(largeur_tab-document.getElementById('copyright_k-u').offsetWidth)+"px";
	document.getElementById('copyright_k-u').style.visibility="visible";

	
	for (i=0; i<23; i++)
	{
		tab_pos[i][0]=document.getElementById("ptitcarre"+(i+1)).offsetTop;
		tab_pos[i][1]=document.getElementById("ptitcarre"+(i+1)).offsetLeft;
		
		tab_vit[i]=Math.random()*19+1;
 	}
 	for (i=0; i<6; i++)
	{
		tab_pos2[i][0]=document.getElementById("carre"+(i+1)).offsetTop;
		tab_pos2[i][1]=document.getElementById("carre"+(i+1)).offsetLeft;
		
		tab_vit2[i]=Math.random()*19+1;
 	}
}

function degrade()
{
	document.getElementById('fond').style.height=hauteur_page+"px";
	document.getElementById('fond').style.width=largeur_page+"px";

	var ctx = document.getElementById('fond').getContext('2d');

	var chiffre_degrade=parseInt(hauteur_page*30/100);
//alert (chiffre_degrade);
	// Création des dégradés
	var lingrad = ctx.createLinearGradient(0, 0, 0, chiffre_degrade);
	lingrad.addColorStop(0, '#FFFFFF');
	lingrad.addColorStop(0.5, '#D9D9D9#FFFFFF');
	//lingrad.addColorStop(0.5, '#26C000');
	//lingrad.addColorStop(1, '#fff');


	// assignation des dégradés aux styles de remplissage et de pinceau
	ctx.fillStyle = lingrad;
	ctx.strokeStyle = lingrad;

	// dessin des formes
	ctx.fillRect(0,0,largeur_page,hauteur_page*2);
	//ctx.strokeRect(50,50,50,50);
}

var top_logo;
function place_menu(sous_menu,left_logo)
{
	hauteur_tab=parseFloat(document.getElementById('theboss').offsetHeight);
	//document.getElementById("logo").style.left=left_logo+"px";

	top_logo=hauteur_tab-(document.getElementById('logo').offsetHeight+document.getElementById('menu').offsetHeight)-2;
	//top_menu=document.getElementById('menu').offsetHeight-document.getElementById('menu').offsetHeight;
	top_menu=document.getElementById('menu').offsetHeight;

	if (sous_menu!=0)
	{
		top_logo-=document.getElementById(sous_menu).offsetHeight;

		if (document.getElementById(sous_menu).style.visibility=="hidden" || document.getElementById(sous_menu).style.visibility=="")
		{
			document.getElementById(sous_menu).style.top=top_menu;
			document.getElementById(sous_menu).style.visibility="visible";

			bouge_menu(sous_menu,left_logo,1);
  		}
  		else
  		{
			clearInterval(timer_carre);
  			bouge_menu("",left_logo,0);
    		}
		//document.getElementById(sous_menu).style.top="0px";
		//document.getElementById(sous_menu).style.visibility="visible";
	}
	else
	{
		document.getElementById('logo').style.top=top_logo+"px";
		if (left_logo!=0)
			bouge_menu("",left_logo,1);
	}
	document.getElementById('menu').style.top=top_menu+"px";
}

var glob_increm_menu=0;
var glob_nom_menu=0;
var glob_depart_menu=0;
var glob_arrivee_menu=0;
var glob_arrivee2_menu=0;
var moving_menu=0;
var y_menu=0;
var y_1_menu=0;
var y_2_menu=0;
var y_tab_menu=new Array(300);
var x_menu=0;
var x_1_menu=0;
var x_2_menu=0;
var x_tab_menu=new Array(300);
var temps_menu=0;
var glob_nom_menu="";
var encours_menu=0;

function bouge_menu(sous_menu,left_logo,ptitcarre)
{
	if (ptitcarre==0)
		clearInterval(moving_menu);

	glob_nom_menu=sous_menu;

	encours_menu=1;

	glob_depart_menu=parseFloat(document.getElementById("menu").offsetHeight);
	glob_depart2_menu=parseFloat(document.getElementById("logo").offsetLeft);
	glob_arrivee_menu=0;
	glob_arrivee2_menu=left_logo;
	glob_increm_menu=0;
	y_2_menu=glob_depart_menu;
	y_1_menu=glob_depart_menu;
	y_menu=glob_depart_menu;
	x_2_menu=glob_depart2_menu;
	x_1_menu=glob_depart2_menu;
	x_menu=glob_depart2_menu;
	temps_menu=0;

	rempli_tableau_menu();
	moving_menu = setInterval("slideMenu_menu("+ptitcarre+")", 5);

}
//tableau contenant les valeurs de deplacement
function rempli_tableau_menu()
{
	amort = 0.9;
	puls =0.3;
	deltaT = 0.4;

	for (m=0;m<60;m++)
	{
		y_2_menu = y_1_menu;
		y_1_menu = y_menu;
		x_2_menu = x_1_menu;
		x_1_menu = x_menu;
		inter1=2 * amort / (puls * deltaT);
		inter2=	1 / (puls * puls * deltaT * deltaT);

		y_menu = (glob_arrivee_menu  + (inter1 + 2*inter2) * y_1_menu - inter2 * y_2_menu) / (1 + inter2 + inter1);
		x_menu = (glob_arrivee2_menu  + (inter1 + 2*inter2) * x_1_menu - inter2 * x_2_menu) / (1 + inter2 + inter1);

		y_tab_menu[m]=Math.floor(y_menu);
		x_tab_menu[m]=Math.floor(x_menu);
	}
}

//faire bouger la fenetre
function slideMenu_menu(ptitcarre)
{
	if ( Math.floor(y_tab_menu[temps_menu])==Math.floor(glob_arrivee_menu) && Math.floor(x_tab_menu[temps_menu])==Math.floor(glob_arrivee2_menu))
		glob_increm_menu=60;

	if (temps_menu>=60)
		temps_menu=60-1;

	if (glob_nom_menu!="" && Math.floor(y_tab_menu[temps_menu])>=0)
	{
		document.getElementById(glob_nom_menu).style.top=Math.floor(y_tab_menu[temps_menu])+"px";
  		document.getElementById("logo").style.top=(top_logo+Math.floor(y_tab_menu[temps_menu]))+"px";
 	}

	document.getElementById("logo").style.left=Math.floor(x_tab_menu[temps_menu])+"px";

 	temps_menu=temps_menu+1;

	glob_increm_menu++;

	if (glob_increm_menu>60)
	{
		clearInterval(moving_menu);
		encours_menu=0;

		if (ptitcarre==0)
			timer_carre=setInterval("carre_bouge()",100);
	}
}





var glob_increm=0;
var glob_nom=0;
var glob_depart=0;
var glob_depart2=0;
var glob_arrivee=0;
var glob_arrivee2=0;
var moving=0;
var y=0;
var y_1=0;
var y_2=0;
var y_tab=new Array(300);
var temps=0;

var taille_petit_carre=20;
var encours=0;

var nom_sousmenu="";

function aff_fen (nom_fen)
{
	clearInterval(moving);
	clearInterval(timer_carre);

	glob_nom="carre"+nom_fen;
	if (nom_fen==0)
		nom_fen="";

	encours=1;
	if (nom_fen!="")
	{
		if (ancien_sous_menu!="")
			nom_sousmenu=glob_nom+"_"+ancien_sous_menu+"_contenu_"+langue_site;
		else
			nom_sousmenu=glob_nom+"_contenu_"+langue_site;

  		if (ancien_sous_menu2!="")
  			nom_sousmenu2=glob_nom+"_"+ancien_sous_menu2+"_contenu_"+langue_site;
  		else
		  	nom_sousmenu2=glob_nom+"_contenu_"+langue_site;


		if (glob_arrivee==taille_petit_carre)
		{
			document.getElementById(nom_sousmenu2).style.visibility="hidden";
			document.getElementById(glob_nom).style.overflow="hidden";
  		}

		document.getElementById(glob_nom).style.top=tab_pos2[nom_fen-1][0];
		document.getElementById(glob_nom).style.left=tab_pos2[nom_fen-1][1];

		glob_depart=parseFloat(document.getElementById(glob_nom).offsetWidth);
		glob_depart2=parseFloat(document.getElementById(glob_nom+"_contenu").offsetHeight);
		top_menu=glob_arrivee;
		glob_increm=0;
		y_2=glob_depart;
		y_1=glob_depart;
		y=glob_depart;
		temps=0;
		
		rempli_tableau();
		moving = setInterval("slideMenu()", 5);
 	}
 	else
 	{
 		glob_arrivee=parseFloat(tab_taillefen_large["carre"+ancien_menu]);
		glob_arrivee2=parseFloat(tab_taillefen_haut["carre"+ancien_menu]);
		//glob_arrivee=parseFloat(500);
		//glob_arrivee2=parseFloat(300);
		aff_fen (ancien_menu);
  	}
}


//tableau contenant les valeurs de deplacement
function rempli_tableau()
{
	amort = 0.9;
	puls =0.3;
	deltaT = 0.4;


	for (m=0;m<300;m++)
	{
		y_2 = y_1;
		y_1 = y;
		inter1=2 * amort / (puls * deltaT);
		inter2=	1 / (puls * puls * deltaT * deltaT);

		y = (glob_arrivee  + (inter1 + 2*inter2) * y_1 - inter2 * y_2) / (1 + inter2 + inter1);

		y_tab[m]=Math.floor(y);
	}
}

//faire bouger la fenetre
function slideMenu()
{
	if (y_tab[temps]==glob_arrivee)
		glob_increm=300;

	if (temps>=300)
		temps=300-1;


	document.getElementById(glob_nom).style.width=Math.floor(y_tab[temps])+"px";
	if (Math.floor(y_tab[temps]-10)-15>0)
 		document.getElementById(glob_nom+"_contenu").style.width=(Math.floor(y_tab[temps]-10)-15)+"px";

	 //document.getElementById(glob_nom).style.height=Math.floor(y_tab[temps])*tab_taillefen_haut[glob_nom]/tab_taillefen_large[glob_nom]+"px";
 	//document.getElementById(glob_nom+"_contenu").style.height=Math.floor(y_tab[temps])*tab_taillefen_haut[glob_nom]/tab_taillefen_large[glob_nom]+"px";

	if (glob_arrivee!=taille_petit_carre)
	{
		document.getElementById(glob_nom).style.height=Math.floor(y_tab[temps]/glob_arrivee*glob_arrivee2)+"px";
		document.getElementById(glob_nom+"_contenu").style.height=Math.floor(y_tab[temps]/glob_arrivee*glob_arrivee2)+"px";
 	}
	else
	{
		document.getElementById(glob_nom).style.height=Math.floor((y_tab[temps])/glob_depart*glob_depart2)+"px";
		document.getElementById(glob_nom+"_contenu").style.height=Math.floor((y_tab[temps])/glob_depart*glob_depart2)+"px";
 	}
 	if (document.getElementById(glob_nom).offsetHeight<taille_petit_carre)
 		document.getElementById(glob_nom).style.height=taille_petit_carre;

 	temps=temps+1;

	glob_increm++;

	if (glob_increm>300)
	{
		clearInterval(moving);
		encours=0;

		document.getElementById(glob_nom).scrollTop="0px";

		if (glob_arrivee!=taille_petit_carre)
		{
			document.getElementById("carre"+ancien_menu).style.zIndex=4;
			if (document.getElementById(nom_sousmenu).offsetHeight>document.getElementById(glob_nom).offsetHeight)
				document.getElementById(glob_nom).style.overflow='auto';

			document.getElementById(nom_sousmenu).style.visibility="visible";

			timer_carre=setInterval("carre_bouge()",100);
  		}
		else //if (glob_nom!="carre"+ancien_menu)
		{
			glob_arrivee=parseFloat(tab_taillefen_large["carre"+ancien_menu]);
			glob_arrivee2=parseFloat(tab_taillefen_haut["carre"+ancien_menu]);
			//glob_arrivee=parseFloat(500);
			//glob_arrivee2=parseFloat(300);

			document.getElementById(glob_nom).style.zIndex=3;
			if (ancien_menu!=0)
			{
				document.getElementById("carre"+ancien_menu).style.zIndex=4;
				aff_fen (ancien_menu);
   			}
   			else
			{
				timer_carre=setInterval("carre_bouge()",100);
				glob_nom="";
   			}
		}
	}
}




var tab_taillefen_large = new Array();
tab_taillefen_large["carre1"]="500";
tab_taillefen_large["carre2"]="700";
tab_taillefen_large["carre3"]="550";
tab_taillefen_large["carre4"]="500";
tab_taillefen_large["carre5"]="500";
tab_taillefen_large["carre6"]="500";

var tab_taillefen_haut = new Array();
tab_taillefen_haut["carre1"]="310";
tab_taillefen_haut["carre2"]="400";
tab_taillefen_haut["carre3"]="310";
tab_taillefen_haut["carre4"]="500";
tab_taillefen_haut["carre5"]="300";
tab_taillefen_haut["carre6"]="510";


ancien_menu="";
ancien_sous_menu="";
ancien_sous_menu2="";
function aff_menu(menu1, menu2, sous_menu,cod_stat)
{
	if ((encours==0 && encours_menu==0) && (ancien_menu!="" || menu1!=0))
	{
		clic.location.href="clic.php?nom_clic="+cod_stat+"&site=&txt_id_cpt="+document.forms['url'].txt_id_cpt.value;
		
		onchangevideo("");

		for (i=1;i<=3;i++)
		{
			if (menu2!="sous_menu"+i)
				document.getElementById("sous_menu"+i).style.visibility="hidden";
  		}
		
		width_logo=55;

		if (menu2!="")
		{
			left_logo=(document.getElementById(sous_menu).offsetLeft+document.getElementById(menu2).offsetLeft)+((document.getElementById(sous_menu).offsetWidth/2)-(width_logo/2));
			place_menu(menu2,left_logo);
  		}
  		else
  		{
  			if (menu1!=0)
  				left_logo=(document.getElementById("menu_princ"+menu1).offsetLeft+document.getElementById("menu").offsetLeft)+((document.getElementById("menu_princ"+menu1).offsetWidth/2)-(width_logo/2));
			else
				left_logo=450;
			place_menu(0,left_logo);
    		}

		if (ancien_menu!="" && ancien_menu!=0)
			document.getElementById("menu_princ"+ancien_menu).style.color="white";
			//document.getElementById("menu_princ"+ancien_menu).style.textDecoration="none";
			//document.getElementById("menu_princ"+ancien_menu).style.fontWeight="normal";
		if (menu1!=0)
			document.getElementById("menu_princ"+menu1).style.color="#FC171B";
			//document.getElementById("menu_princ"+menu1).style.textDecoration="underline";
			//document.getElementById("menu_princ"+menu1).style.fontWeight="bold";


		if (ancien_sous_menu!="")
			document.getElementById(ancien_sous_menu).style.color="white";
			//document.getElementById(ancien_sous_menu).style.textDecoration="none";
			//document.getElementById(ancien_sous_menu).style.fontWeight="normal";
		if (sous_menu!="")
			//document.getElementById(sous_menu).style.textDecoration="underline";
			document.getElementById(sous_menu).style.color="#FC171B";
			//document.getElementById(sous_menu).style.fontWeight="bold";

	
		ancien_menu2=ancien_menu;
		ancien_menu=menu1;
		ancien_sous_menu2=ancien_sous_menu;
		ancien_sous_menu=sous_menu;


		if (menu1!=ancien_menu2 && (ancien_menu2!="" || menu1!=0))
		{
			glob_arrivee=parseFloat(20);
			glob_arrivee2=parseFloat(20);
			aff_fen (ancien_menu2);
	 	}
	 	else
	 	{
	 		document.getElementById(glob_nom).scrollTop="0px";


	 		if (document.getElementById(glob_nom+"_"+ancien_sous_menu+"_contenu_"+langue_site).offsetHeight>document.getElementById(glob_nom).offsetHeight)
				document.getElementById(glob_nom).style.overflow='auto';
			else
				document.getElementById(glob_nom).style.overflow="hidden";
			
			document.getElementById(glob_nom+"_"+ancien_sous_menu2+"_contenu_"+langue_site).style.visibility="hidden";
			document.getElementById(glob_nom+"_"+ancien_sous_menu+"_contenu_"+langue_site).style.visibility="visible";
			if (glob_nom+"_"+ancien_sous_menu+"_contenu_"+langue_site=="carre2_sous_menu2_3_contenu_en")
				document.getElementById('player').style.visibility="visible";
			else
				document.getElementById('player').style.visibility="hidden";
	  	}
   	}
}

position_x=0;
position_y=0;
osci_temps=0;
function carre_bouge()
{
	document.onmousemove = position;
	rayon=100;


	osci_temps++;
	for (i=0;i<tab_pos.length;i++)
	{
		//document.getElementById("ptitcarre"+(i+1)).style.top=tab_pos[i][0]+10*Math.sin(0.01*osci_temps*tab_vit[i]);
		//document.getElementById("ptitcarre"+(i+1)).style.left=tab_pos[i][1]+10*Math.sin(0.01*osci_temps*2.1*tab_vit[i]);

		diff_x=position_x-tab_pos[i][1];
		diff_y=position_y-tab_pos[i][0];
		if (diff_x>0 && diff_y>=0)
			angle=Math.atan(diff_y/diff_x);
		if (diff_x>0 && diff_y<0)
			angle=-(Math.atan(-diff_y/diff_x));
		if (diff_x<0 && diff_y>=0)
			angle=Math.PI-Math.atan(diff_y/-diff_x);
		if (diff_x<0 && diff_y<0)
			angle=-Math.PI+Math.atan(-diff_y/-diff_x);

		dist=Math.sqrt(diff_x*diff_x+diff_y*diff_y);
		
		if (dist<=rayon)
		{
			centre_x=tab_pos[i][1]-(rayon-dist)*Math.cos(angle);
			centre_y=tab_pos[i][0]-(rayon-dist)*Math.sin(angle);
  		}
  		else
  		{
			centre_x=tab_pos[i][1];
			centre_y=tab_pos[i][0];
    		}
		
		if (centre_y+10*Math.sin(0.01*osci_temps*tab_vit[i])>=0)
			document.getElementById("ptitcarre"+(i+1)).style.top=centre_y+10*Math.sin(0.01*osci_temps*tab_vit[i])+"px";
		else
			document.getElementById("ptitcarre"+(i+1)).style.top="0px";
			
		if (centre_x+10*Math.sin(0.01*osci_temps*2.1*tab_vit[i])>=0)
			document.getElementById("ptitcarre"+(i+1)).style.left=centre_x+10*Math.sin(0.01*osci_temps*2.1*tab_vit[i])+"px";
 		else
			document.getElementById("ptitcarre"+(i+1)).style.left="0px";
	}
 	for (i=0;i<6;i++)
 	{
 		if (glob_nom!="carre"+(i+1))
 		{
			//document.getElementById("carre"+(i+1)).style.top=tab_pos2[i][0]+10*Math.sin(0.01*osci_temps*tab_vit2[i]);
			//document.getElementById("carre"+(i+1)).style.left=tab_pos2[i][1]+10*Math.sin(0.01*osci_temps*2.1*tab_vit2[i]);

			diff_x=position_x-tab_pos2[i][1];
			diff_y=position_y-tab_pos2[i][0];
			if (diff_x>0 && diff_y>=0)
				angle=Math.atan(diff_y/diff_x);
			if (diff_x>0 && diff_y<0)
				angle=-(Math.atan(-diff_y/diff_x));
			if (diff_x<0 && diff_y>=0)
				angle=Math.PI-Math.atan(diff_y/-diff_x);
			if (diff_x<0 && diff_y<0)
				angle=-Math.PI+Math.atan(-diff_y/-diff_x);
	
			dist=Math.sqrt(diff_x*diff_x+diff_y*diff_y);
			
			if (dist<=rayon)
			{
				centre_x=tab_pos2[i][1]-(rayon-dist)*Math.cos(angle);
				centre_y=tab_pos2[i][0]-(rayon-dist)*Math.sin(angle);
	  		}
	  		else
	  		{
				centre_x=tab_pos2[i][1];
				centre_y=tab_pos2[i][0];
	    		}
	    		
			if (centre_y+10*Math.sin(0.01*osci_temps*tab_vit2[i])>=0)
			    	document.getElementById("carre"+(i+1)).style.top=centre_y+10*Math.sin(0.01*osci_temps*tab_vit2[i])+"px";
			else
				document.getElementById("carre"+(i+1)).style.top="0px";
			
			if (centre_x+10*Math.sin(0.01*osci_temps*2.1*tab_vit2[i])>=0)
				document.getElementById("carre"+(i+1)).style.left=centre_x+10*Math.sin(0.01*osci_temps*2.1*tab_vit2[i])+"px";
			else
				document.getElementById("carre"+(i+1)).style.left="0px";
		}
	}





}


//position souris
function position(p)
{
    position_x = (navigator.appName.substring(0,3) == "Net") ? (p.pageX-document.getElementById("theboss").offsetLeft) : (event.x+document.body.scrollLeft-document.getElementById("theboss").offsetLeft);
    position_y = (navigator.appName.substring(0,3) == "Net") ? (p.pageY-document.getElementById("theboss").offsetTop) : (event.y+document.body.scrollTop-document.getElementById("theboss").offsetTop);
}

if(navigator.appName.substring(0,3) == "Net")
    document.captureEvents(Event.MOUSEMOVE);
    
    
    
    
    
//mauvais caractere
/************************************************************************************************/
/************************************************************************************************/
function caractere_bouh(car)
{
	var bouh=new Array();
	bouh=["'",'"',"\'",'\"',"é","è","ê","ë","ç","à","ù","ï","î","\n"];
	
	var bouh2=new Array();
	//bouh2=[" "," "," "," ","&eacute;","&egrave;","&ecirc;","&euml;","&ccedil;","&agrave;","&ugrave;","&iuml;","&icirc;","<br />"];
	bouh2=[" "," "," "," ","e","e","e","e","c","a","u","i","i","<br>"];
	
	car2="";
	while (car!=car2)
	{
		if (car2!="")
			car=car2;
		car3=car;
		for (var i=0;i<14;i++)
		{
			car3=car3.replace(bouh[i],bouh2[i]);
		}
		car2=car3;
	}
	return(car2);
}
/************************************************************************************************/
/************************************************************************************************/

function mail()
{
	prenom2=caractere_bouh(document.form_mail.txt_prenom.value);
	nom2=caractere_bouh(document.form_mail.txt_nom.value);
	societe2=caractere_bouh(document.form_mail.txt_comp.value);
	tel2=caractere_bouh(document.form_mail.txt_tel.value);
	adr_mail2=caractere_bouh(document.form_mail.txt_mail.value);
	message2=caractere_bouh(document.form_mail.txt_message.value);
	other2=caractere_bouh(document.form_mail.txt_other.value);
	
	if (document.form_mail.objet1.checked==true)
		objet1=document.form_mail.objet1.value;
	else
		objet1="";
	if (document.form_mail.objet2.checked==true)
		objet2=document.form_mail.objet2.value;
	else
		objet2="";
	if (document.form_mail.objet3.checked==true)
		objet3=document.form_mail.objet3.value;
	else
		objet3="";

	fen_mail.location.href='mail.php?action=1&prenom2='+prenom2+'&nom2='+nom2+'&societe2='+societe2+'&tel2='+tel2+'&adr_mail2='+adr_mail2+'&message2='+message2+'&other2='+other2+'&objet1='+objet1+'&objet2='+objet2+'&objet3='+objet3;
}
/************************************************************************************************/
/************************************************************************************************/



//video
//***************************************************************
function sendEvent(typ,prm) 
{ 
	thisMovie("mpl").sendEvent(typ,prm); 
}
	
function loadFile(obj)
{ 
	thisMovie("mpl").loadFile(obj);
}

function thisMovie(movieName) 
{
	if(navigator.appName.indexOf("Microsoft") != -1) 
		return window[movieName];
	else
		return document[movieName];
}
//***************************************************************

var tab_video = new Array();
tab_video["house"]="<b>House simulation</b> :<br><br>";
tab_video["house"]+="This video shows the learned behaviors for a house simulation scenario.<br>";
tab_video["house"]+="The only order given to the character is a single sentence: 'bring back a soda to the other character'.<br><br>";
tab_video["house"]+="-> The behaviors are dynamically computed facing the events: for example, the character didn't know<br>";
tab_video["house"]+="that the door was closed before being in front of it.<br><br>";
tab_video["house"]+="-> The learning brings unexpected credible behaviors: the character has learned to change<br>";
tab_video["house"]+="its carrying hand for opening the oven door for example.<br><br>";
tab_video["house"]+="-> The character chooses the behavior from its own motivations: he chooses to eat the food<br>";
tab_video["house"]+="before bringing back the soda, because this represents a priority task.<br>";

tab_video["onlineLearning"]="<b>Online learning</b> :<br><br>";
tab_video["onlineLearning"]+="This video shows the online learning of a behavior in real time.<br>";
tab_video["onlineLearning"]+="In this scenario, the character needs to put the different objects through the holes in the wall.<br><br>";
tab_video["onlineLearning"]+="-> At the beginning, he didn't know what the best positions are.<br>";
tab_video["onlineLearning"]+="-> He progressively learns to change the orientation and the height of each object.<br>";
tab_video["onlineLearning"]+="-> He finally succeed at every time.<br><br>";
tab_video["onlineLearning"]+="-> The complete learning is carried out in only one minute.";

tab_video["imitation"]="<b>Player imitation</b> :<br><br>";
tab_video["imitation"]+="This video illustrates the imitation process on a simple 'flee / attack' scenario in a RTS environment.<br>";
tab_video["imitation"]+="The autonomous unit has to learn how to attack red spheres while fleeing dangerous red cubes.<br><br>";
tab_video["imitation"]+="- During the first part, the human tutor controls the unit and executes the desired behavior twice.<br>";
tab_video["imitation"]+="In the same time, the  imitation process creates, deletes and merges the rules extracted<br>";
tab_video["imitation"]+="from human tutor observation.<br>";
tab_video["imitation"]+="- During the second part, the unit is autonomous and uses the imitated rules to choose its actions.<br><br>";
tab_video["imitation"]+="-> This learning needs only few examples to create credible human like behaviors<br>";
tab_video["imitation"]+="-> The same process can be applied on more complex scenarios and behaviors<br>";

tab_video["tramway"]="<b>Tramway simulation (fullscreen recommended)</b> :<br><br>";
tab_video["tramway"]+="Autonomous characters and behaviors scheduling in a tramway simulation.<br>";

tab_video["discussion"]="<b>Group Discussion (fullscreen recommended)</b><br><br>";
tab_video["discussion"]+="";

tab_video["herons"]="<b>Emotions & Herons (fullscreen recommended)</b><br><br>";
tab_video["herons"]+="Little birds interact with the player. Their emotions are the basis of their decision making process.<br>";
tab_video["herons"]+="They get interested in some objects when the player moves it. But they flee when they feel scared.";

tab_video["unity"]="<b>Integration of I-Be engine into Unity 3.0 (fullscreen recommended)</b><br><br>";
tab_video["unity"]+="This video goes behind the scene of Herons demonstration.<br>";
tab_video["unity"]+="It gives an example of how I-Be behaviors can be shaped in the Unity editor.<br>";
tab_video["unity"]+="The I-Be engine is integrated into a plugin for the Unity 3.0 editor.";


function onchangevideo(nom_video)
{
	if (nom_video!="")
	{
		document.getElementById("player").style.visibility="visible";
		loadFile({file:nom_video+'.flv',title:'',link:'',id:'12345',image:''});
		sendEvent('playpause','');

		document.getElementById("video_txt").innerHTML=tab_video[nom_video];
 	}
 	else
 	{
		document.getElementById("player").style.visibility="hidden";
		document.getElementById("video_txt").innerHTML="";
  	}
}


