/* ===================================================== //
//  Cost Savings Systems, LLC   | weathergrid.js         //
//  Author: Kevin Scholl        | kscholl@comcast.net    //
//  Created: 29 Aug 2005        | Updated: 29 Aug 2005   //
// ===================================================== */

// ------------------------------------------------//
// GLOBAL VARIABLE(S)
// ------------------------------------------------//

var CURR_CONTENT = null;
var POPWIN = null;

// ----------------------------------------------------------------------
// Set all submenus default HIDDEN
// ----------------------------------------------------------------------

function clearContent() { // turn the currently tab and block off

	var clearTab = "tab" + CURR_CONTENT;
	var clearContent = "content" + CURR_CONTENT;

	eval('document.getElementById("' + clearTab + '").className = "tabOff"');
	eval('document.getElementById("' + clearContent + '").style.display = "none"');
	}

function showContent(whichContent) { // turn the requested tab and block on

	if (CURR_CONTENT != null) // check for current active content
		clearContent();

	var showTab = "tab" + whichContent;
	var showContent = "content" + whichContent;

	eval('document.getElementById("' + showTab + '").className = "tabOn"');
	eval('document.getElementById("' + showContent + '").style.display = "block"');

	CURR_CONTENT = whichContent; // set current content as active
	}

// ----------------------------------------------------------------------
// CLOSE EXISTING CHILD WINDOW
// ----------------------------------------------------------------------

function closePOPWIN() {
  if ((POPWIN != null) && (POPWIN.closed != true))
  	POPWIN.close();
	}
	
// ----------------------------------------------------------------------
// DISPLAY POPUP WINDOW
// ----------------------------------------------------------------------

var POPWIN = null;

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 + ",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,"WeatherGrid",params);
	POPWIN.focus;
	}
