var arrWindows = new Array('');

function openPopup(strURL, intAncho, intAlto, bolShowBorders, bolScroll, strName){

	/*if (arrWindows.length == 1)
		openPopupWindow(strURL, intAncho, intAlto, bolShowBorders, bolScroll, strName, false);
	else{
		bolPopupFound = false;
		for (i = 1; i < arrWindows.length; i++){
			if (!arrWindows[i].closed){
				if (arrWindows[i].name == strName){
					arrWindows[i].focus();
					bolPopupFound = true;
					break;
				}
			}
		}
		if (!bolPopupFound)*/
			openPopupWindow(strURL, intAncho, intAlto, bolShowBorders, bolScroll, strName, false);
	/*}*/
}

function openPopupWindow(strURL, intAncho, intAlto, bolShowBorders, bolScroll, strName, intIndex){
	strProperties = 'left=' + (screen.availWidth - intAncho) / 2 + ',top=' + (screen.availHeight - intAlto) / 2 + ',width=' + intAncho + ',height=' + intAlto + ',menubar=no,resizable=no,status=no';
	strProperties += (bolScroll) ? ',scrollbars=yes' : ',scrollbars=no';
	strProperties += (bolShowBorders) ? ',fullscreen=yes' : '';
	intWindow = (intIndex) ? intIndex : arrWindows.length;
	arrWindows[intWindow] = window.open(strURL, strName, strProperties);
	if (bolShowBorders){
		self.focus();
		setTimeout("arrWindows[" + intWindow + "].resizeTo(" + intAncho + "," + intAlto + ")", 50);
		setTimeout("arrWindows[" + intWindow + "].moveTo(" + (window.screen.width - intAncho) / 2 + ", " + (window.screen.height - intAlto) / 2 + ")", 50);
	}
	setTimeout("arrWindows[" + intWindow + "].focus()", 50);
}
