//  Tri Synergy, Inc. | common.js
//  Kevin Scholl      | kscholl@comcast.net
//  Last Update       | 15 Sep 2004

// ------------------------------------------------//
// GLOBAL VARIABLE(S)
// ------------------------------------------------//

var CURR_SUBNAV = '';
var POPWIN  = null;

// ----------------------------------------------------------------------
// SET CURRENT NAV STATE
// ----------------------------------------------------------------------

function setCurrNav(whichNav) {
	var newClass = "curr";
	var currNav = document.getElementById(whichNav);
	currNav.className = newClass;
	}

// ------------------------------------------------//
// SHOW SPECIFIED SIDE SUBNAV
// ------------------------------------------------//

function showSubNav(whichSub) {
	if (CURR_SUBNAV != '') {
		eval('document.getElementById("' + CURR_SUBNAV + '").style.display = "none"');
		}		
	eval('document.getElementById("' + whichSub + '").style.display = "block"');
	CURR_SUBNAV = whichSub;
	}

// ----------------------------------------------------------------------
// DISPLAY LINKED POPUP WINDOW
// ----------------------------------------------------------------------

function newWindow(loc,x,y) {

  closePopWin();	// closes an existing popup window if user opens 
                	// new window before closing existing window
	
	var screenW = x + 20;
	var screenH = y + 20;
	var params  = "width=" + screenW + ",height=" + screenH + ",top=50,left=50,screeny=50,screenx=50,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes"

	POPWIN = window.open(loc,"TSI",params);
	POPWIN.focus;
	}
	
// ----------------------------------------------------------------------
// DISPLAY PHOTO
// ----------------------------------------------------------------------

function viewImage(whichPhoto,x,y) {

  closePopWin(); 	// closes an existing popup window if user opens 
        					// new window before closing existing window
	
	var screenW = x + 50;
	var screenH = y + 50;
	var params  = "width=" + screenW + ",height=" + screenH + ",status=yes,toolbar=no,directories=no,scrollbars=no,resizable=yes,menubar=no,location=no,top=50,left=50,screeny=50,screenx=50"

	POPWIN = window.open("","TSI",params);

  POPWIN.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
  POPWIN.document.write('<html xmlns="http://www.w3.org/1999/xhtml">');
	POPWIN.document.write('<head><title>CSAT</title></head>');
  POPWIN.document.write('<body style="background-color: #F0F0F0;">');
  POPWIN.document.write('<div style="margin: auto; border: 1px solid #CCC; padding: 10px; background-color: #FFF; text-align: center;">');
  POPWIN.document.write('<a href="javascript:window.close();"><img src="' + whichPhoto + '" style="border: 0; width: ' + x + ' height: ' + y + ';" alt="Click to Close" title="Click to Close"></a>');
  POPWIN.document.write('</div>');
  POPWIN.document.write('</body>');
  POPWIN.document.write('</html>');
	
	POPWIN.document.close();
  }

// ----------------------------------------------------------------------
// CLOSE EXISTING CHILD WINDOW
// ----------------------------------------------------------------------

function closePopWin() {
  if ((POPWIN != null) && (POPWIN.closed != true))
  	POPWIN.close();
	}

// ----------------------------------------------------------------------
// WRITE CURRENT DATE
// ----------------------------------------------------------------------

function writeDate() {

  var now      = new Date;
  var modDay   = new Array ("sunday","monday","tuesday","wednesday","thursday","friday","saturday");
  var modMonth = new Array ("january","february","march","april","may","june","july","august","september","october","november","december");
	
  document.write(modDay[now.getDay()] + ", " + now.getDate() + " " + modMonth[now.getMonth()] + " " + now.getFullYear());
  }
