//** Javascript functions for Fieldhouse.com info pages
	//	02/18/2011	R. Schroeder	Copied from shop1 Javascript in page
	//	01/24/2012	R. Schroeder	Added function to expand search section on map



//** IMAGE LOADING **
	//Pre-loads menu background images from fhstore.com
if (document.images) {

  pic1= new Image(); 
  pic1.src="https://fhstore.com/Shopping/images/over.png"; 

  pic2= new Image(); 
  pic2.src="https://fhstore.com/Shopping/images/active.png"; 
}


//** LOADING ICON - EXIT **
	//Shows loading icon on exiting page when link is clicked
function LeavingPage() {

	rowLoading = document.getElementById('tblrowLoading');

	if(rowLoading != null)
	{
		rowLoading.style.display = '';
	}

	rowContent = document.getElementById('tblrowContent');

	if(rowContent != null)
	{
		rowContent.style.display = 'none';
	}
}


//** DISPLAY MAIN PAGE CONTENT **
	//Fires when page is done loading - displays main content
function load() {

	var rowLoading = document.getElementById('tblrowLoading');

	if(rowLoading != null)
	{
		rowLoading.style.display = 'none';
	}

	rowContent = document.getElementById('tblrowContent');

	if(rowContent != null)
	{
		rowContent.style.display = '';
	}
}

//** SELECT ALL **
	//Highlights all text in text box
function SelectAll(id)
	{
		document.getElementById(id).focus();
		document.getElementById(id).select();
	}

//** SET FOCUS **
	//Sets focus on load on the store search box
function setFocus()
{
	 document.getElementById("storeSearch").focus();
	 document.getElementById("storeSearch").select();
}
		

	
//** DISPLAY MORE **
	//Displays additional content on "more"
function showMoreChildOrgs() {

	var rowObj = document.getElementById('lblChildOrgs2');

	if(rowObj != null)
	{
		rowObj.style.display = '';          //Show complete list
	}

	var rowObj = document.getElementById('lblChildOrgs');

	if(rowObj != null)
	{
		rowObj.style.display = 'none';      //hide short list
	}

	rowObj = document.getElementById('lnkShowMoreChildOrgs');

	if(rowObj != null)
	{
		rowObj.style.display = 'none';      //Hide show more link
	}                
}


//** CATEGORY DROP-DOWNS **
	//Displays drop-down menus below super cat menu

var timeout	= 500;
var closetimer	= 0;
var ddmenuitem	= 0;

// open hidden layer
function MenuOpen(id, color) {	

	// cancel close timer
	CancelCloseTime();

	// close old layer
	if(ddmenuitem)
	{
		ddmenuitem.style.width = '0px';
		ddmenuitem.style.visibility = 'hidden';
	}

	// get new layer and show it
	ddmenuitem = document.getElementById(id);

	if(ddmenuitem)              //Might not exist due to having only one Category
	{
		ddmenuitem.style.width = '200px';
		ddmenuitem.style.visibility = 'visible';

		var categories = document.getElementById("tblCategories");      //Hides left-hand Category list ************ DISABLED FOR INFO PAGES *******************
		if(categories) categories.style.visibility = 'visible';
	}
}

// close showed layer
function MenuClose() {

	if(ddmenuitem)
	{
		ddmenuitem.style.width = '1px';
		ddmenuitem.style.visibility = 'hidden';
	}

	var categories = document.getElementById("tblCategories");
	if(categories) categories.style.visibility = 'visible';
}

// go close timer
function MenuCloseTime() {

	closetimer = window.setTimeout(MenuClose, timeout);
}



// cancel close timer
function CancelCloseTime() {

	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

// close layer when click-out
document.onclick = MenuClose;          

// Function : 	submitForm - Submits to Shopping_Home - Use this for possible future org name validation

function submitForm() {
	document.SearchForm.submit();
}


// Function: Show hide signup page tips
function showTipBox(id) {
	document.getElementById(id).style.display = "block";
}
function hideTipBox(id) {
	document.getElementById(id).style.display = "none";
}

function toggle_visibility(id) {
   var e = document.getElementById(id);
   if(e.style.display == 'block')
	  e.style.display = 'none';
   else
	  e.style.display = 'block';
}

