﻿/*************************************************
#flash --> Javascript
**************************************************/


function OpenOeuvre (nom) {

  url="oeuvre.php?fichier="+nom;

	var oeuvre=window.open(url,"Oeuvre","scrollbars=yes,resizable=no,toolbar=no,status=no,menubar=no,location=no,directories=no,width=720,height=420");

	window.onerror = null;

	var v_X = (parseInt (screen.width,'px') - 720) / 2;

	var v_Y = (parseInt (screen.height,'px') - 420) / 2;

	oeuvre.moveTo (v_X,v_Y);

	oeuvre.focus();

}


function gotoQuestions()
{

	document.getElementById("FlashID2").gotoQuestions();
//document.getElementById("FlashID2").gotoIndemnites();	

}

function gotoContact()
{
	document.getElementById("FlashID2").gotoContact(); 
}

function gotoHonoraire()
{

	document.getElementById("FlashID2").gotoHonoraire();
//document.getElementById("FlashID2").gotoIndemnites();	

}


function gotoLexique()
{

	document.getElementById("FlashID2").gotoLexique();
//document.getElementById("FlashID2").gotoIndemnites();	

}

function gotoDroits()
{

	document.getElementById("FlashID2").gotoDroits();
//document.getElementById("FlashID2").gotoIndemnites();	

}

function gotoLiens()
{

	document.getElementById("FlashID2").gotoLiens();
//document.getElementById("FlashID2").gotoIndemnites();	

}

function changeIndemnite()
{

	document.getElementById("FlashID2").gotoIndemnisations();
//document.getElementById("FlashID2").gotoIndemnites();	

}
function changePresentation()
{

	document.getElementById("FlashID2").gotoPresentation();
//document.getElementById("FlashID2").gotoIndemnites();	

}

function appel_1() {

	document.getElementById("FlashID").echo_1();
	exemple(1);

}
function appel_2() {
	
	document.getElementById("FlashID").echo_2();
	exemple(2);
}
function appel_3() {

	document.getElementById("FlashID").echo_3();
	exemple(3);
}
function appel_4() {
	
	document.getElementById("FlashID").echo_4();
	exemple(4);
}
function appel_5() {
	
	document.getElementById("FlashID").echo_5();
	exemple(5);
}
function appel_6() {
	
	document.getElementById("FlashID").echo_6();
	exemple(6);
}
function appel_7() {
	
	document.getElementById("FlashID").echo_7();
	exemple(7);
}
function appel_8() {
	
	document.getElementById("FlashID").echo_8();
	exemple(8);
}
function appel_9() {
	
	document.getElementById("FlashID").echo_9();
	exemple(9);
}

function exemple(myint) {

	document.body.style.cursor = 'wait';

	
    if (myint == 1) {
    changePresentation();
        loadWholePage("presentation0.php");
       

    }
    if (myint == 2) {

changePresentation();
        loadWholePage("presentation0.php");

    }
    if (myint == 3)
	{gotoDroits();
   loadWholePage("droits.php");
    
	}if (myint == 4)
	{
		changeIndemnite();
      loadWholePage("indemnisations.php");
	
	}
	if (myint == 5)
	{
      loadWholePage("honoraires.php");
	gotoHonoraire();
	}
	if (myint == 6)
	{
		gotoLexique();
      loadWholePage("lexique.php");
	
	}
	if (myint == 7)
       {
		gotoLiens();
	   loadWholePage("liens.php");
	   }
	   
	   
	   
    if (myint == 8)
	{
      loadWholePage("questions.php");
	gotoQuestions();
	}
	if (myint == 9)
	{
 loadWholePage("contact.php");
	gotoContact();
	}
	document.body.style.cursor = 'Default';
}



function getCorps(content)
{
test=content.toLowerCase();
var x=test.indexOf("<div id=\"corps\"");

if(x==-1) return "";

x=test.indexOf(">",x);
if(x==-1) return "";

var y=test.lastIndexOf("</corps>");
if(y==-1) y=test.lastIndexOf("</html>");
if(y==-1) y=content.length;

return content.slice(x+1,y);

}

function createXHR()
{
		
try{return new XMLHttpRequest();} catch(e){}
}


function loadHTML(url,fun,storage,param)
{

var xhr=createXHR();

xhr.onreadystatechange=function()
	{
if(xhr.readyState==4)
	{
		{
	storage.innerHTML = getCorps(xhr.responseText);
fun(storage,param);
		}
	}
	};
xhr.open("GET",url,true);
xhr.send(null);
}

function loadWholePage(url)
{

var y=document.getElementById("corps");

var x=document.getElementById("corps");


loadHTML(url,processHTML,x,y);
}


function processHTML(temp,target)
{
target.innerHTML=temp.innerHTML;	
}

 
 
