// JavaScript Document
//***This function must be included for every theme but can be customized to fit the theme
//Some vars are availabe from the existing page scripts
//var theThemeName
//var wwwRoot
//

function initPage() /* required for all hThemes */
{
	try
	{
		initAll();
	}
	catch(e)
	{
	}
}
//***This function must be included for every theme but can be customized to fit the theme
function changePageFinished(thePage)
{
	//Function used to update ree submenus to diplay extra info if logged in//
	try
	{
	}
	catch(e)
	{
	}
}
//***This function must be included for every theme but can be customized to fit the theme
function popUpClosed()
{
	try
	{
		//Function used to update ree submenus to diplay extra info if logged in//
		updateDivElm(wwwRoot+theThemeName+"/blocks/menu_sub_blocks.php", "blockMenus");
	}
	catch(e)
	{
	}
}
/////////////////////////////////////////////////////////////////////
//The scripts below are customized for the hTheme they are used with:
function updateDivElm(AJAXURL, theDivId)
{
	var xhrU = false;
	//AJAX Request//
	//Check for AJAX request type////
	try
	{
		// Firefox, Opera 8.0+, Safari
		xhrU = new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xhrU = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xhrU = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	//////////////////////////////////
	if (xhrU)
	{
		xhrU.onreadystatechange = function()
		{
			if (xhrU.readyState == 4)
			{
				if (xhrU.status == 200)
				{
					if (xhrU.responseText)
					{
						//Updates the div by the id that is sent with the function call
						try
						{
						document.getElementById(theDivId).innerHTML = xhrU.responseText;
						}
						catch(e)
						{
						}
					}
				}
				else
				{
					//ERROR only if in error state
					hideLoader();
					alert("There was a problem with the content request: State = "+xhrU.readyState+", Status = "+xhrU.status+" -- updateDivElm");
					window.location="";
					//window.open(AJAXURL);
				}
			}
			else
			{
				//Not 4
			}
		};
		//Fire function based on request type
		xhrU.open("GET", AJAXURL, true);
		xhrU.send(null);
	}
	else
	{
		//ERROR
		hideLoader();
		alert("Sorry, could not create XMLHttpRequest. -- updateDivElm");
		window.location="";
	}
}


