
var hdiff; var iduser2; var ev_id2; var langue2; var str =
"left=0,screenX=0,top=0,screenY=0,toolbar=no,menubar=no,scrollbars=1,location=no";
var str2 =
"left=0,screenX=0,top=0,screenY=0,toolbar=yes,menubar=yes,scrollbars=1,location=no,width=800,height=600,resizable=1";
//var str3 =
"left=0,screenX=0,top=0,screenY=0,toolbar=no,menubar=no,scrollbars=0,location=no,width=425,height=360";
var str3 =
"left=0,screenX=0,top=0,screenY=0,toolbar=yes,menubar=yes,scrollbars=1,location=no";
var url; var uid2 = 0; var a_id2; var cpt=0; var comp_w; var comp_w2;
function show_viewer(l_id)
{
	var lan="";
	switch(l_id)
	{
		case 1:
			lan="fr";
			break;
		case 2:
			lan="en";
			break;
		default:
			lan="fr";
			break;
	}
	window.open("http://www.educexpert.com/demo/viewer/viewer_"+lan+".html","view",str);

}
// Ajustement de la fenêtre
function setWindow () {
/*	var fullScreen = false;
	if (navigator.platform == "Win32") {
		fullScreen = true;
	} else {
		if (screen.availWidth > 1024) {
			var width = 1024;
			var height = 768;
		} else {
			var width = 800;
			var height = 600;
		}
	}
	
	// Positionnement
	if (fullScreen) {
		window.moveTo(-4,-23);
	} else {
		window.moveTo((screen.availWidth/2 - (width/2)),(screen.availHeight/2 - (height/2)));
	}
	// Dimensionnement
	if (navigator.platform == "Win32") {
		if (fullScreen) {
			window.resizeTo(screen.width+9,screen.height+28);
		} else {
			window.resizeTo(width+9,height+28);
		}
	} else { // Mac
		window.resizeTo(width,height);
	}*/
	window.moveTo(0,0);
	window.resizeTo(screen.availWidth,screen.availHeight);
}

setWindow ();

function setLangue() {
	window.document.login.SetVariable("langue_id",langue);
	window.document.login.SetVariable("intro_id",intro_id);
}

// Ouverture de la fenêtre de la documentation (SWF)
function launchPage(url, name) 
{ 
var xls=0;
	if(url.indexOf("_425")>0 || url.indexOf("_426")>0 || url.indexOf("_427")>0 || url.indexOf("_428")>0 || url.indexOf("_429")>0 || url.indexOf("_430")>0 || url.indexOf("_495")>0 || url.indexOf("_556")>0 || url.indexOf("_568")>0
|| url.indexOf("_569")>0 || url.indexOf("_570")>0 || url.indexOf("_571")>0 || url.indexOf("_572")>0 || url.indexOf("_573")>0
|| url.indexOf("_574")>0 || url.indexOf("_575")>0 || url.indexOf("_576")>0 || url.indexOf("_577")>0 || url.indexOf("_582")>0
|| url.indexOf("_584")>0 || url.indexOf("_585")>0 || url.indexOf("_591")>0 || url.indexOf("_592")>0 || url.indexOf("_646")>0 || url.indexOf("_650")>0)
	{	xls=1;	}
	if(xls==1)
	{	
		if(url.indexOf("_425")>0 || url.indexOf("_582")>0)
			window.open(url, name, str3); 
		else
			window.open(url, name, str2); 
	}
	else
	{  	window.open(url, name, str); }
}

// Rapport exemple de formation
function callRapp(choix) {
	url = "/rapports/" + choix + "_" + langue + ".html";
	launch_rapp();
}

// Rapport de formation
function writeRapp(choix, no) 
{
	if(choix=="ind_ac_rep" || choix=="ac_rep" || choix=="evals_rep")
	{
		url = "/eval_rapp/" + choix + ".php?u_id=" + no + "&langue=" + langue;
	}
	else if(choix=="rptlstusrrecon")
	{
		url = "/cgi-php/" + choix + ".php?iduser=" + no + "&langue=" + langue;
	}
	else
	{
		url = "/cgi-bin/" + choix + ".exe?iduser=" + no + "&langue=" + langue;
	}
	launch_rapp();
}

// Rapport de formation Admin
function writeRappAdmin(choix, no, uid) {
	if(choix=="ind_ac_rep_admin_view" || choix=="ac_rep" || choix=="evals_rep_admin_view")
		url = "/eval_rapp/" + choix + ".php?iduser=" + no + "&langue=" + langue + "&uid=" + uid;
	else
		url = "/cgi-bin/" + choix + ".exe?iduser=" + no + "&langue=" + langue + "&uid=" + uid;
	launch_rapp();
}

// Rapport de formation Mentor
function writeRappMentor(choix, no, uid) {
	url = "/cgi-bin/" + choix + ".exe?or_id=" + no + "&langue=" + langue + "&iduser=" + uid;
	launch_rapp();
}

// Rapport d'évaluation
function writeRappEva(choix, rev_id, iduser) {
	url = "/cgi-bin/" + choix + ".exe?ev_id=" + rev_id + "&iduser=" + iduser + "&langue=" + langue;
	launch_rapp();
}

// Rapport d'évaluation
function writeENPQRapp(rev_id) {
	url = "/eval_rapp/enpq_rapp.php?ev_id=" + rev_id + "&langue=" + langue;
	launch_rapp();
}

// Rapport de Bloc-Notes
function writeRappNote(module, uid) {
	url = "/cgi-bin/print_notes.exe?module=" + module + "&uid=" + uid + "&langue_id=" + langue;
	launch_rapp();
}

// Lancement du rapport pleine page (fullscreen)
function launch_rapp() {
	rappType = "_";
	if (navigator.platform != "Win32") {rappType = "Mac_"};
	window.open("docRapp" + rappType + langue +".html", "", str);
}

// Lancement d'un test de lecture rapide
function launch_test(test_no,langue,uid,pathModule) {
	window.open(pathModule + "test/test.php?test_no=" + test_no + "&langue_id=" + langue + "&uid=" + uid + "&pathModule=" + pathModule, "", str);
}


// Délais de fermeture
function breaktime() 
{
	cpt++;
	if(cpt>1)
		window.close();
	else
		setTimeout("breaktime()",200);
}
 
// Fermeture de l'application
function kill() {
	uid2 = 0;
	if (navigator.platform == "Win32") {
   		breaktime();
	} else {
		window.close();
	}
}


function close_ok() {
	if(uid2 > 0) {
		url = "/cgi-bin/fin_cours.exe?langue_id=" + langue + "&uid=" + uid2 + "&a_id=" + a_id2 + "&close=1";
		window.location=url;		
//window.open(url,"","toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0, resizable=0,width=302,height=260,left=" + ((screen.availWidth/2)-151) + ",top=" + ((screen.availHeight/2) -130));
	}
}

function init(uid, a_id) {
	uid2 = uid;
	a_id2 = a_id;
}

function getBrowser() {
	window.document.login.SetVariable("navVer",navigator.appVersion);
}

function appSupport() {
	//window.opener.location="http://www.flamexpert.com/formation/support.html";
	kill();
}

// Mise en mode Fenêtré de l'application (visualisation de la barre de tâche Windows)
function showTaskBar () {
	resizeTo(screen.availWidth-2, screen.availHeight-2);
	moveTo(1, 1);
	resizeTo(screen.availWidth, screen.availHeight);
	moveTo(0, 0);
}

function resizeWin (res) {
	if (res == 1024 && screen.availWidth == 1024) {
		setWindow ();
	} else {
		if (res == 800) {
			if (navigator.platform == "Win32") {
				var width = 809;
				var height = 628;
			} else { // Mac
				var width = 800;
				var height = 600;
			}
		} else {
			if (navigator.platform == "Win32") {
				var width = 1033;
				var height = 796;
		 	} else { // Mac
				var width = 1024;
				var height = 768;
			}
		}
		window.moveTo((screen.availWidth/2 - (width/2)),(screen.availHeight/2 - (height/2)));
		window.resizeTo(width,height);
	}
}

function change_bgcol (col) {

	document.body.className=col;

}
function show_compagnon(p,format)
{
	var feat = "left=0,top=0,status=1,resizable=1,screenY=0,toolbar=0,menubar=0,scrollbars=0,location=0,width="+screen.availWidth*0.75+",height="+screen.availHeight*0.75;
	var feat2 = "left=150,top=150,status=1,resizable=1,screenY=0,toolbar=0,menubar=0,scrollbars=0,location=0,width="+screen.availWidth*0.75+",height="+screen.availHeight*0.75;
	
/*
	if(format=="pdf")
	{
		if(!comp_w2)
			comp_w2=window.open(p,"comp2",feat2);	
		comp_w2.focus();	
	}
	else
	{
		if(!comp_w)
			comp_w=window.open(p,"comp",feat);	
		comp_w.focus();
	}
*/
	w_name="comp_"+Math.floor(Math.random()*1001);
	if(format=="pdf")
	{
		w_comp_p=window.open(p,w_name,feat2);	
		w_comp_p.focus();	
	}
	else
	{
		w_comp_s=window.open(p,w_name,feat);	
		w_comp_s.focus();
	}
}
function show_document(p,format)
{
	var feat = "left=0,top=0,status=1,resizable=1,screenY=0,toolbar=0,menubar=0,scrollbars=0,location=0,width="+screen.availWidth*0.75+",height="+screen.availHeight*0.75;
	var feat2 = "left=150,top=150,status=1,resizable=1,screenY=0,toolbar=0,menubar=0,scrollbars=0,location=0,width="+screen.availWidth*0.75+",height="+screen.availHeight*0.75;
	
	if(format=="pdf")
	{
		comp_w2=window.open(p,"_blank",feat2);	
		comp_w2.focus();	
	}else{
		comp_w=window.open(p,"_blank",feat);	
		comp_w.focus();
	}
}

