var POSITION_SOURIS_X=0;
var POSITION_SOURIS_Y=0;

function getMouseXY(e) {
	if(typeof(e.clientX)=='number' && typeof(e.clientY)=='number')
	{
		POSITION_SOURIS_X = e.clientX + document.body.scrollLeft;
		POSITION_SOURIS_Y = e.clientY + document.body.scrollTop;
	}
	else
	{
		POSITION_SOURIS_X = e.x + document.body.scrollLeft;
		POSITION_SOURIS_Y = e.y + document.body.scrollTop;
	}	
}

//***************************
function au_dessus()
{
window.focus()
}

//***************************
function aleatoire()
{
return Math.floor(Math.random()* 100000000)+1;
}

//***************************
function remplacer_espaces(url_param)
{
url_param = url_param.replace(/ /g,"-") ;
return(url_param) ;
}

//***************************
function fenetre_ouvrir(src,name,w,h)
{
var new_window, param;

param = "height=" + h + ",width=" + w + ",resizable=yes,scrollbars,menubar=no,toolbar=no";
new_window=window.open(src, name, param);
//new_window.focus();
return new_window ;
}

//***************************
function fenetre_fermer()
{
self.close();
}

//***************************
function ouvrir_new(id_new)
{
var fenetre, url;
url = "../news/news.asp?id_new=" + id_new
fenetre = fenetre_ouvrir(url, "NEW", 518, 240) ;
return ;
}

//***************************
function ouvrir_realisation(id_realisation)
{
var fenetre, url;
url = "../realisations/realisations.asp?id_realisation=" + id_realisation
fenetre = fenetre_ouvrir(url, "REALISATION", 518, 240) ;
return ;
}

//***************************
function ouvrir_solution(url)
{
var fenetre;
fenetre = fenetre_ouvrir(url, "SOLUTION", 567, 480) ;
return ;
}

//***************************
function ouvrir_categorie_realisation(id_categorie)
{
var fenetre, url;
url = "../realisations/realisations.asp?id_categorie=" + id_categorie
fenetre = fenetre_ouvrir(url, "REALISATION", 518, 230) ;
return ;
}

//***************************
function placer_antislash_devant_apostrophes(chaine)
{
var reg = new RegExp("'","gi");

chaine = chaine.replace(reg, "\\\'");	
return(chaine);
}

//***************************
function imprimer()
{
if (window.print)
	window.print();
else 
	{
    var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
	document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
//    WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    
    WebBrowser1.ExecWB(6, 1);
	WebBrowser1.outerHTML = "";  
	return;
  }
return;
}

//***************************
function afficher_imprimer()
{
var html;

html = "<a href='javascript:imprimer();'>" ;
html += "<img src='../images/icones/icone_imprimer_petit.gif' border='0' alt='Imprimer'>" ;
html += "</a>" ;

document.write(html) ;
return;
}

//***********************
function ouvrir_formulaire_renseignement(param_contact)
{
var fenetre, url, x;
x = 468 ;

if (param_contact == 'Demande adhésion')
	{url = "../formulaires/formulaire_adhesion.asp" ;
	x = 518 ;}
if (param_contact == 'Fiche navette')
	{url = "../formulaires/formulaire_fiche_navette.asp" ;
	x = 518 ;}
if (param_contact == 'Service formation')
	{url = "../formulaires/formulaire_unite_formation.asp" ;}
if (param_contact == 'Service adhérent' || param_contact == 'Service adhérents')
	{url = "../formulaires/formulaire_renseignement.asp?param_contact=adherent" ;}
if (param_contact == 'Service documentation')
	{url = "../formulaires/formulaire_renseignement.asp?param_contact=documentation" ;}
if (param_contact == 'Service province')
	{url = "../formulaires/formulaire_renseignement.asp?param_contact=province" ;}

	
fenetre = fenetre_ouvrir(url, "CONTACT", x, 600) ;
return ;
}

//***********************

function ouvrir_plans_acces(localite)
{
var url = "../plans_acces/plan_acces_" + localite + ".asp" ;
window.open(url, "planacces", "toolbar=no, location=no, directories=no, status=yes, scrollbars=yes, resizable=no, copyhistory=no, width=665, height=584, left=50, top=50");
}


//***********************
function image_bandeau(no_image_affichee)
{
/*
2 = TIC et capital humain
3 = Communication interactive
4 = Ingénierie multimédia
6 = Conseil
7 = Création
8 = Studio
*/
	var no_image, nom_image_1, nom_image_2 ;
	switch (rubrique)
	{
			case 2 :
				no_image = 1 ;
				break ;
			case 3 :
				no_image = 2 ;
				break ;
			case 4 :
				no_image = 3 ;
				break ;
			case 6 :
				no_image = 4 ;
				break ;
			case 7 :
				no_image = 5 ;
				break ;
			case 8 :
				no_image = 6 ;
				break ;
			default :
				no_image = 1 ;
				break ;
	}
nom_image_1 = '<img src="../images/img_commun/bandeau_haut_visuel'+ no_image +'.jpg" >'
nom_image_2 = '<img src="../images/img_commun/bandeau_haut_visuel'+ no_image +'_2.gif" >'
if (no_image_affichee ==1 )
	document.write(nom_image_1) ;
if (no_image_affichee ==2 )
	document.write(nom_image_2) ;		
return ;
	
}

//***********************
function page_onload()
{
layer_init_plateforme();
initialiser_menu_haut();

return;
}

//***********************
function page_onresize()
{
reposition_menu_gauche();
reposition_menu_haut();
window.refresh;
return;
}

//***********************
function lien_ct(ref_codetravail)
{
/*
ref_codetravail = ref_codetravail.replace(/ /g,"$") ;
location.replace ("../code_travail/code_travail.asp?ref_codetravail="+ ref_codetravail + "#" + ref_codetravail) ;
location.replace ( lien ) ;
*/

var lien_debut = "http://www.legifrance.gouv.fr/WAspad/UnArticleDeCode?code=CTRAVAI"  ;
var lien_fin = ".rcv&art="  ;
var code_ref = ref_codetravail.substring(0,1)  ;
ref_codetravail = ref_codetravail.replace(/. /g,"")  ;
var lien = lien_debut + code_ref + lien_fin + ref_codetravail  ;
//alert(lien) ;

var fenetre;
fenetre = fenetre_ouvrir(lien, "LOI", 800, 600) ;
return ;

}

//***********************
function au_dessus()
{
window.focus()
}
