// JavaScript Document

function open_message_box(param) {
	w = 500 ;
	h = 50 ;
	var str = new String(param) ;
	var tab = str.split(new RegExp("[?&=]")) ;
	for (i=0; i < tab.length; i++) {
		switch(tab[i]) {
			case "mb_title":	h += 15 ;	break ;
			case "mb_ok":		h += 12 ;	break ;
			case "mb_close":	h += 12 ;	break ;
			case "mb_i1":		h += 30 ;	break ;
			case "mb_i2":		h += 30 ;	break ;
			case "mb_i3":		h += 30 ;	break ;
		}
	}
	
	win = window.open("mod/disp/message.box.php?" + param, "message_box", "left=" + (screen.availWidth-w)/2 + ", top=" + (screen.availHeight-h)/2 + ", width=" + w + ", height=" + h + ", status=0, resizable=0, dependent=1") ;
	win.focus() ;
}

function open_download(param) {
	
	w = 500 ;
	h = 180 ;
	win = window.open("download.php?f=" + param, "download", "left=" + (screen.availWidth-w)/2 + ", top=" + (screen.availHeight-h)/2 + ", width=" + w + ", height=" + h + ", status=0, resizable=0, dependent=1") ;
	win.focus() ;
	
}

function confirm_editor_cancel(location) {
	
	if (! confirm("Vous perdrez toutes vos modifications.\n\nVoulez-vous continuer ?"))
		return ;
		
	document.location = location ;
	
}

var posx = 0 ;
var posy = 0 ;
function on_mouve_move(e) {
	
	if (!e) var e = window.event ;
	if (e.pageX || e.pageY) {
		posx = e.pageX ;
		posy = e.pageY ;
	} else if (e.clientX || e.clientY) {
		posx = e.clientX + document.documentElement.scrollLeft ;
		posy = e.clientY + document.documentElement.scrollTop ;
	}	
		
}

var time_out = null ;
function on_mouse_over_div(div) {	
	if (time_out != null)
		clearTimeout(time_out) ;
	time_out = setTimeout("opacity_div('" + div + "')", 700) ;
}

function opacity_div(div) {
	time_out = null ;
	var obj = document.getElementById(div) ;
	obj.style.display = 'block' ;
	obj.style.marginLeft = '-' + (obj.clientWidth + 10) + 'px' ;
	on_mouse_move_div(div) ;
}

function on_mouse_out_div(div) {
	if (time_out != null)
		clearTimeout(time_out) ;
	var obj = document.getElementById(div) ;
	obj.style.display = 'none' ;
	obj.style.left = '-5000px' ;
}

function on_mouse_move_div(div) {	
	var obj = document.getElementById(div) ;
	if (obj.style.display == 'block') {
		obj.style.left = posx + 'px' ;
		obj.style.top = posy + 'px' ;
	}
}

