function popupcentree(page,largeur,hauteur,options) {
	var top=(screen.height-hauteur)/2;  
	var left=(screen.width-largeur)/2;  
	window.open(page,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options); 
}

//ValidBox
var destVb;
var destVbtype;
var destVbdet;

function showValidbox(texte,urldest,type,idtype,dettype){
	$('valid_box_txt').set('text',texte)
	bg_appear();
	var timeoutbox = vb_appear.delay(800);
	if (type === undefined){	
		type = "n";
	}
	if (idtype === undefined){	
		idtype = 0;
	}
	if (dettype === undefined){	
		dettype = 0;
	}
	destVbtype=type;
	if(destVbtype == 'js'){
		destVb=idtype;
		destVbdet=dettype;
	} else {
		destVb=urldest;
	}
}

function closeValidBox(result){
	
	if (result === undefined){
		result = "cancel";
		var timeoutbox = bg_close.delay(500);
	} else if (result == 'ok') {
		var timeouturl = gotoUrlVb.delay(500);
	}
	vb_close();

}

function gotoUrlVb(){
	if(destVbtype == 'n'){
		window.location = destVb;
	}
	if(destVbtype == 'js'){
		if(destVb == 1){
			sub_form(destVbdet);
		}
	}	
}

function closeValidbox(){
	bg_close();
}

function bg_appear(){
	$('overallbg').setStyles({
			'width':'100%',
			'height':'100%',
			'opacity':'0'
	});
	$('overallbg').fade('in');
}

function bg_close(){
	$('overallbg').fade('out');
	var timeoutbox = bg_close2.delay(400);
}
function bg_close2(){
	$('overallbg').setStyles({
			'width':'0',
			'height':'0',
			'opacity':'0'
	});
}

function vb_appear(){
	$('valid_box').tween('height', [0, 140]);
}

function vb_close(){
	$('valid_box').tween('height', [140, 0]);
}

//Okbox

function showOkbox(texte){
	$('ok_box_txt').set('text',texte)
	okbox_set();
	okbox_appear();
	var timeoutokbox2 = okbox_disappear.delay(2500);
	var timeoutokbox3 = okbox_unset.delay(3500);
}

function okbox_set(){
	$('infobg').setStyles({
		'width':'100%',
		'height':'160px',
		'opacity':'0'
	});
	$('ok_box').setStyle('height',110);
}
function okbox_appear(){
	$('infobg').fade('in');
}
function okbox_disappear(){
	$('infobg').fade('out');
}
function okbox_unset(){
	$('infobg').setStyles({
		'width':'100%',
		'height':'0px',
		'opacity':'0'
	});
	$('ok_box').setStyle('height',0);
}

function sub_form(formname){
	$(formname).submit();
}


