/* ------------------------------------------------------------
 * PROJECT        : Dare County Boat Builders Foundation
 * FILENAME       : dcbbf_common.js
 * ------------------------------------------------------------
 * DATE CREATED   : 24 Nov 2008
 * LAST UPDATED   : 24 Nov 2008
 * ------------------------------------------------------------
 * AUTHOR(S)      : Kevin Scholl    (http://www.ksscholl.com/)
 *                : Aaron Kuzemchak (http://www.kuzemchak.net)
 * ------------------------------------------------------------
 * NOTE(S)        : 
 * ------------------------------------------------------------ */

/* ------------------------------------------------------------
 * DISPLAY SCREEN ID
 * ------------------------------------------------------------ */

function fileName() { // extracts the current filename and returns it as a string
	var fileName = location.pathname.substring(location.pathname.lastIndexOf("/") + 1);
	return(fileName);
	}

/* ------------------------------------------------------------
 * POPUP WINDOW: GLOBAL VARIABLE(S)
 * ------------------------------------------------------------ */

var POPWIN  = null;

/* ------------------------------------------------------------
 * POPUP WINDOW: CLOSE EXISTING POPUP WINDOW
 * ------------------------------------------------------------ */

function closePopWin(theWin) {
  if ((theWin != null) && (theWin.closed != true))
  	theWin.close();
	}

/* ------------------------------------------------------------
 * POPUP WINDOW: DISPLAY POPUP WINDOW
 * ------------------------------------------------------------ */

function popWindow(loc,winame,w,h,m,t) {

  closePopWin(POPWIN);	// closes an existing popup window if user opens 
                				// new window before closing existing window
	
	if (!(w)) var winW = screen.width - 100; 
	else      var winW = w + 20;
	if (!(h)) var winH = screen.height - 100; 
	else      var winH = h + 20;
	
	var menu           = (m ? m : "no");
	var tool           = (t ? t : "no");
	
	var params  = "width=" + winW + ",height=" + winH + ",status=yes,toolbar=" + tool + ",directories=no,scrollbars=yes,resizable=yes,menubar=" + menu + ",location=no,top=50,left=50,screeny=50,screenx=50";

	POPWIN = window.open(loc,winame,params);
	POPWIN.focus;
	}