// ############################################################
// <SCRIPT>
// Javascript Library for FlexWeb 3
// ID-3 Technologies inc. 2006
// ############################################################

// ============================================================
// PopupWindow
// ============================================================
function gf_PopUpWindow(URL, WindowName, WindowWidth, WindowHeight) {
	PosX = Math.round(screen.availWidth / 2) - (WindowWidth / 2) 
	PosY = Math.round(screen.availHeight / 2) - (WindowHeight / 2) - 20

	popupwin = window.open(URL,WindowName,"scrollbars=no,resizable=yes,directories=no,menubar=no,screenx=" + PosX + ",screeny=" + PosY + ",left=" + PosX + ",top=" + PosY + ",status=no,titlebar=yes,toolbar=no,height=" + WindowHeight + ",width=" + WindowWidth )
	popupwin.focus();
	return(popupwin);
}

function gf_PopUpModalWindow(URL,WindowWidth, WindowHeight) {	
	sReturnValue = window.showModalDialog(URL,'',"help:no;scroll:no;resizable:yes;center:yes;status:no;dialogHeight:" + WindowHeight + "px;dialogWidth:" + WindowWidth + "px")
	return(sReturnValue);
}

function gf_PopUpWindowExtra(URL, WindowName, WindowWidth, WindowHeight,sExtraAttributes) {
	PosX = Math.round(screen.availWidth / 2) - (WindowWidth / 2) 
	PosY = Math.round(screen.availHeight / 2) - (WindowHeight / 2) - 20

	popupwin = window.open(URL,WindowName,"directories=no,menubar=no,screenx=" + PosX + ",screeny=" + PosY + ",left=" + PosX + ",top=" + PosY + ",status=no,titlebar=yes,toolbar=no,height=" + WindowHeight + ",width=" + WindowWidth + "," + sExtraAttributes)
	popupwin.focus();
	return(popupwin);
}


// ############################################################
// Edition Forms
// ############################################################
function gf_openPrint(sPK, FOUGUID){
	gf_PopUpWindowExtra("./projet_imprime.asp?PK=" + sPK + "&FOUGUID=" + FOUGUID, "PrintWnd", 750, 400, "resizable=yes,scrollbars=yes");
}
// ############################################################
//  
// ############################################################
function formatCurrency(num) {
	num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num)) num = "0";
	sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	cents = num%100;
	num = Math.floor(num/100).toString();
	if(cents<10) cents = "0" + cents;
		
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
		num = num.substring(0,num.length-(4*i+3))+''+ num.substring(num.length-(4*i+3));
		
	return (((sign)?'':'-') + num + '.' + cents + '');
}


// ############################################################
// Fonctions pour RAPPORTS
// ############################################################

