/*
	Copyright © 2006, JFG Networks, All rights reserved
*/

function cd_position(p){
	position_x = (navigator.appName.indexOf("Netscape")!=-1 )? p.pageX : event.clientX+document.documentElement.scrollLeft;
	position_y = (navigator.appName.indexOf("Netscape")!=-1) ? p.pageY : document.documentElement.scrollTop+event.clientY;
}

function cd_Om()
{
  var menu = document.getElementById("menuClicDroit");
    menu.style.position = 'absolute';
    menu.style.left = position_x+"px";
    menu.style.top = position_y+"px";
	  menu.style.visibility = "visible";
  //console.log(menu.innerLeft);
	return(false);
}

function cd_Fm()
{
	document.getElementById("menuClicDroit").style.visibility = "hidden";
}

function cd_addFav()
{
	if (document.all){
		window.external.AddFavorite(location.href, document.title);
	}else{
		alert("");
	}
}

function cd_recommander(){
	window.open("recommander.php","recommander","width=800,height=600,scrollbars=yes,status=no,resizable=yes");
}

function cd_Om2(btn)
{
	if (navigator.appVersion.indexOf("MSIE") != -1 && event.button == 2)
	{
		cd_Om();
		return false;
	}
	else if ( (navigator.appName.indexOf("Netscape")!=-1 ) && btn.which == 3)
	{
		cd_Om();
		return false;
	}
}

//if(navigator.appName.indexOf("Netscape")!= -1) document.captureEvents(Event.MOUSEMOVE);

document.onmousemove = cd_position;
document.onmousedown = cd_Om2;
document.oncontextmenu = cd_Om;
document.onclick = cd_Fm;

// NEW WINDOW
/*
	Copyright Â© 2006, JFG Networks, All rights reserved
*/
window.onload = function() {
	var elmts = document.body.getElementsByTagName('*');
	for (var i = 0; elmts[i]; i++) {
		var className = elmts[i].getAttribute('class')?elmts[i].getAttribute('class'):elmts[i].getAttribute('className');
		
		if(typeof(className) == 'string'){
			var classNames = className.split(' ');
			for (var j = 0; classNames[j]; j++) {
				

				if (classNames[j] == 'newWindow') {
					elmts[i].onclick = function() {
						window.open(this);
						return false;
					}
				}

				if (classNames[j] == 'closeWindow') {
					elmts[i].onclick = function() {
						window.close();
					}
				}
				
			}
		}
	}
}
