﻿
//<!--
//Generic Javascript Functions File

//Hides and shows text in the div tags when user clicks on a link
var ActiveDiv = "";
var ActiveTab = "";


function showActive(div)
{
  // turn off div
  if (ActiveDiv != ""){document.getElementById(ActiveDiv).style.display = "none";}
  // turn off tab
  if (ActiveTab != ""){document.getElementById(ActiveTab).className='inactiveTab';}
  // set new Active variables
  ActiveDiv = div;
  ActiveTab = "tab" + div;
  // turn on Active div
  document.getElementById(ActiveDiv).style.display = "block";
  // turn on Active tab
  document.getElementById(ActiveTab).className='activeTab';
}


// Treeview Control funtion to select first child node on the menu
function TreeView1_onNodeSelect(sender, eventArgs)
{
  //reference the node
  var objNode=eventArgs.get_node();

  //is this a parent? False = Child so just select it
  if(objNode.ChildIndices.length>>0)
  {
    objNode=objNode.Nodes(0);
    sender.SelectNodeById(objNode.ID);
  }
}


function openWindow(SourceURL, intWidth, intHeight)
{
	var NewWin=parent.window;
	NewWin   // Set some defaults
	
  width=intWidth;
  height=intHeight;
	url = SourceURL;

	//if a window is already open then close it 
	//then open a new one with URL passed from link above
	if (NewWin && NewWin!=null && NewWin!="" && NewWin!=parent.window)
	{
		NewWin.close()
		NewWin=window.open(url,"Sample","resizable=yes,status=no,scrollbars=yes,width=" + width + ",height=" + height);
	}
	//if a window has not been open then open one with URL passed from link above
	else
	{
		NewWin=window.open(url,"Sample","resizable=yes,status=no,scrollbars=yes,width=" + width + ",height=" + height);
		NewWin.focus();
	}
}


function openFloorPlan(SourceURL, WinWidth, WinHeight)
{
	var NewWin=parent.window;
  
  width=WinWidth;
  height=WinHeight;
	url = SourceURL;

	//if a window is already open then close it 
	//then open a new one with URL passed from link above
	if (NewWin && NewWin!=null && NewWin!=""&& NewWin!=parent.window)
	{
		NewWin.close()
		NewWin=window.open(url,"Map","resizable=yes,status=no,scrollbars=yes,width=" + width + ",height=" + height);
	}
	//if a window has not been open then open one with URL passed from link above
	else
	{
		NewWin=window.open(url,"Map","resizable=no,status=no,scrollbars=no,width=" + width + ",height=" + height);
		NewWin.focus();
	}
}


function verify() {
  var itemsSelected = 0;
  for (var i=1; i<21; i++) {
    if (document.frmSurvey.elements[i].checked) {
      itemsSelected++;
    }
  }
  if (itemsSelected == 5) {
    document.forms[0].submit();
  } else {
    alert("Please select an answer for each item.");
    return (false);
  }
}

function makeRound()
{
  if(!NiftyCheck())
    return;
  Rounded("div#tabs li","top","transparent","#f6e6f0","border #990033");
}


function setTabParameter(whichTab)
{
  document.forms["frmGallery"].tabName.value = whichTab;
  document.forms["frmGallery"].photoName.value = "none";
  document.forms["frmGallery"].submit();
}


function setPhotoParameter(whichPhoto)
{
  document.forms["frmGallery"].photoName.value = whichPhoto;
  document.forms["frmGallery"].submit();
}
//-->