/* ------------------------------------------------------------
 * PROJECT        : Shoshin Technologies, Inc.
 * FILENAME       : common.js
 * ------------------------------------------------------------
 * DATE CREATED   : 26 Feb 2007
 * LAST UPDATED   : 26 Feb 2007
 * ------------------------------------------------------------
 * AUTHOR(S)      : Kevin Scholl (http://www.ksscholl.com/)
 * ------------------------------------------------------------ */

/* ------------------------------------------------------------
 * GLOBAL VARIABLE(S)
 * ------------------------------------------------------------ */
 
var NUM_MSTHD_IMGS = 5; // change as necessary
var RAN_NUM        = 2; // default masthead image
var RAN_IMG        = null;

var POPWIN = null;

/* ------------------------------------------------------------
 * POPUP WINDOW: CLOSE EXISTING POPUP WINDOW
 * ------------------------------------------------------------ */

function closePopWin(wndw) {
  if ((wndw != null) && (wndw.closed != true))
  	wndw.close();
	}

/* ------------------------------------------------------------
 * POPUP WINDOW: DISPLAY POPUP WINDOW
 * ------------------------------------------------------------ */

function popWindow(loc,w,h) {

  closePopWin(POPWIN);	// closes an existing popup window if user opens 
                				// new window before closing existing window
	
	if (!(w)) var winW = screen.width - 110; 
		else var winW = w;
	if (!(h)) var winH = screen.height - 160; 
		else var winH = h;
		
	var params  = "width=" + winW + ",height=" + winH + ",status=yes,toolbar=no,directories=no,scrollbars=yes,resizable=yes,menubar=no,location=no,top=50,left=50,screeny=50,screenx=50";

	POPWIN = window.open(loc,"Shoshin",params);
	POPWIN.focus;
	}

/* =================================================== *
 * DISPLAY LARGE PHOTO
 * =================================================== */

function viewPhoto(whichPhoto,w,h) {

  closePopWin(POPWIN); 	// closes an existing popup window if user opens
	                      // new window before closing existing window

	if (!(w)) var picW = 360; 
		else var picW = w;
	if (!(h)) var picH = 270; 
		else var picH = h;

	var params  = "width=" + picW + ",height=" + picH + ",status=no,toolbar=no,directories=no,scrollbars=no,resizable=yes,menubar=no,location=no,top=50,left=50,screeny=50,screenx=50"

	POPWIN = window.open("","Shoshin",params);

  POPWIN.document.writeln('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
  POPWIN.document.writeln('<html xmlns="http://www.w3.org/1999/xhtml">');
	POPWIN.document.writeln('<head><title>Shoshin Technologies, Inc. // Map</title></head>');
  POPWIN.document.writeln('<body style="margin: 0; background-color: #FFF; padding: 0;">');
  POPWIN.document.writeln('  <div style="margin: 0; border: 0; padding: 0; background: transparent;">');
  POPWIN.document.writeln('    <a href="javascript:window.close();"><img src="' + whichPhoto + '" style="border: 0; width: ' + picW + 'px; height: ' + picH + 'px;" alt="Click to Close" title="Click to Close"></a>');
  POPWIN.document.writeln('  </div>');
  POPWIN.document.writeln('</body>');
  POPWIN.document.writeln('</html>');

	POPWIN.document.close();
  }
