var ejs_context_x = 0;
var ejs_context_y = 0;

var ejs_context_elemt = new Array;
ejs_context_elemt[0] = "Charger le code complet|piphook_loadCode(theRecipe)";
ejs_context_elemt[1] = "Charger le code réduit|piphook_loadShortCode(theRecipe)";
ejs_context_elemt[2] = "Ajouter au code existant|piphook_appendCode(theRecipe)";
//ejs_context_elemt[3] = "Insérer dans le code existant|piphook_insertCode(theRecipe)";
//ejs_context_elemt[4] = "Charger le code complet dans une nouvelle fenêtre|toto()";
//ejs_context_elemt[5] = "Charger le code réduit dans une nouvelle fenêtre|toto()";

function ejs_context_position(e) {
	ejs_context_x = (navigator.appName.substring(0,3) == "Net") ? e.clientX : event.clientX;
	ejs_context_y = (navigator.appName.substring(0,3) == "Net") ? e.clientY : event.clientY;

	/*
	ejs_context_x = (navigator.appName.substring(0,3) == "Net") ? e.pageX : event.x+document.body.scrollLeft;
	ejs_context_y = (navigator.appName.substring(0,3) == "Net") ? e.pageY : event.y+document.body.scrollTop;
	*/
}

function ejs_context_open() {
	document.getElementById("ejs_context_box").style.top = ejs_context_y + 'px';
	document.getElementById("ejs_context_box").style.left = ejs_context_x  + 'px';
	document.getElementById("ejs_context_ombre").style.top = ejs_context_y + 2 + 'px';
	document.getElementById("ejs_context_ombre").style.left = ejs_context_x + 2 + 'px';
	document.getElementById("ejs_context_box").style.visibility = "visible";
	document.getElementById("ejs_context_ombre").style.visibility = "visible";
	return(false);
}

function ejs_context_close() {
	if (document.getElementById) {
		document.getElementById("ejs_context_box").style.top = 0;
		document.getElementById("ejs_context_box").style.left = 0;
		document.getElementById("ejs_context_ombre").style.top = 0;
		document.getElementById("ejs_context_ombre").style.left = 0;
		document.getElementById("ejs_context_box").style.visibility = "hidden";
		document.getElementById("ejs_context_ombre").style.visibility = "hidden";
	}
}

function ejs_context_hl(mode, element) {
	if(mode == 1) {
		element.style.background = '#316AC5';
		element.style.color = '#ffffff';
	} else {
		element.style.background ='#ffffff';
		element.style.color = '#0066AA';
	}
}

if (navigator.appName.substring(0,3) == "Net") {
	document.captureEvents(Event.MOUSEMOVE);
}

function buildRightMenu() {
	ejs_context_ombre_txt = '';
	for(a=0;a<ejs_context_elemt.length;a++)	{
		if(ejs_context_elemt[a].indexOf("|") > 0) {
			splited = new Array;
			splited = ejs_context_elemt[a].split("|");
			document.write('<div class="ejs_context_menuitems" onClick="'+splited[1]+'" onMouseOver="ejs_context_hl(1, this)" onMouseOut="ejs_context_hl(0, this)">'+splited[0]+'</div>');
			ejs_context_ombre_txt += '<div class="ejs_context_menuitems">'+splited[0]+'</div>';
		} else {
			document.write('<div class="ejs_context_menuitems" onClick="'+splited[1]+'" onMouseOver="ejs_context_hl(1, this)" onMouseOut="ejs_context_hl(0, this)"><hr width="195" size="1" color="9D9DA1" /></div>');
			ejs_context_ombre_txt += '<div class="ejs_context_menuitems"><hr width="195" size="1" color="9D9DA1" /></div>';
		}
	}
	document.write('</div><div id="ejs_context_ombre" class="ejs_context_ombre">'+ejs_context_ombre_txt+'</div>');
}
