/* ===================================================== //
//  CompSolution AT             | common.js              //
//  Author: Kevin Scholl        | kscholl@comcast.net    //
//  Created: 22 Feb 2005        | Updated: 06 Apr 2006   //
// ===================================================== */

/* ===================================================== //
// GLOBAL VARIABLE(S)
// ===================================================== */

var TIMERID = 0;
var POPWIN  = null;

/* ===================================================== //
// SET ALL SUBNAVS DEFAULT HIDDEN
// ===================================================== */

function clearSubNavs() {
	document.getElementById("navProducts").style.display = "none";
	document.getElementById("navSupport").style.display = "none";
	document.getElementById("navAboutUs").style.display = "none";
	}

/* ===================================================== //
// SET SPECIFIED SUBNAV TO VISIBLE
// ===================================================== */

function toggleSubNav(which) {
	clearSubNavs();
	clearTimeout(TIMERID);
	var foo = eval(document.getElementById(which).style);
	foo.display = "block";
	}

/* ===================================================== //
// SET UP TIMER FOR SUBNAV HIDE ONMOUSEOUT
// ===================================================== */

function hideCountdown() {
	TIMERID = setTimeout("clearSubNavs()",1200);
	}

/* ===================================================== //
// DISPLAY POPUP WINDOWS
// ===================================================== */

var POPWIN = null;

function newWindow(loc,x,y) {

  closePopWin();	// closes an existing popup window if user opens 
                	// new window before closing existing window
	
	var winW = x + 20;
	var winH = y + 20;

	var winPosX = (screen.width / 2) - (winW / 2);
	var winPosY = (screen.height / 2) - (winH / 2);

	var params  = "width=" + winW + ",height=" + winH + ",status=yes,toolbar=no,directories=no,scrollbars=yes,resizable=yes,menubar=no";

	POPWIN = window.open(loc,"VNTV",params);
	POPWIN.moveTo(winPosX,winPosY);
	POPWIN.focus;
	}
	
function viewPhoto(whichPhoto,x,y) {

  closePopWin(); 	// closes an existing popup window if user opens 
        					// new window before closing existing window
	
	var winW    = x + 42;
	var winH    = y + 42;

	var winPosX = (screen.width / 2) - (winW / 2);
	var winPosY = (screen.height / 2) - (winH / 2);

var params  = "width=" + winW + ",height=" + winH + ",status=yes,toolbar=no,directories=no,scrollbars=no,resizable=yes,menubar=no,location=no";

	POPWIN = window.open("","VNTV",params);
	POPWIN.moveTo(winPosX,winPosY);

  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>Victory Nissan / Team Vinci</title></head>');
  POPWIN.document.writeln('<body style="margin: 0; background-color: #EEE; padding: 0;">');
  POPWIN.document.writeln('  <div style="margin: 10px; border: 1px solid #CCC; padding: 10px; background-color: #FFF; text-align: center;">');
  POPWIN.document.writeln('    <a href="javascript:window.close();" title="Click to Close"><img src="' + whichPhoto + '" style="border: 0; width: ' + x + 'px; height: ' + y + 'px;" alt="VNTV Photo (click to close)"></a>');
  POPWIN.document.writeln('  </div>');
  POPWIN.document.writeln('</body>');
  POPWIN.document.writeln('</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());
  }