// Global Variable Declarations
var isLoaded = false;

// Global Functions

// Adds appropriate targets to anchor tags.
function processAnchorTargets()
{
	if (!document.getElementsByTagName) return;

	var anchors = document.getElementsByTagName("a");
	
	for (var i=0; i < anchors.length; i++)
	{
		var anchor = anchors[i];
		
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "popup")
		{
			anchor.target = "_blank";
		}
	}
}

// Submits form[0]
function submitForm()
{
	document.forms[0].submit();
	return true;
}

// Submit Target Form
function submitTargetForm(in_formIndex)
{
	document.forms[in_formIndex].submit();
	return true;
}


// Image Swaps
function imageSwap(in_Name, in_State)
{
	if (!isLoaded)
	{
		return true;
	}
	document.images[in_Name].src = eval(in_Name + "_" + in_State + ".src");
}

  
// Window Openders
function popWindow(in_target, in_WindowParameters)
{
	//windowParameters are very browser dependent.  Be sure to test in all browswers when
	//changing window parameters.

	//For instance for Both IE and Netscape browsers to absolutely position a window properly 2 sets
	// of dimensions should be included example: screenX=0,screenY=0,left=0,top=0
	//To set the height and width of the windows example: width=625,height=400
	//A Good PopupWindow in all browsers with no toolbar, no scrollbar, and not resizable.
	//windowParameters = "scrollbars=no,width=625,height=400";
	
	if ( in_WindowParameters.length == 0 )
	{
		in_WindowParameters = "resizable,dependent,toolbar,scrollbars,location,status,menubar";
	}
	
	popupWin = window.open(in_target,'PopupWindow',in_WindowParameters);
}

// Global Initialization

function blurInputs()
{
	if (!document.getElementsByTagName) return;

	var inputs = document.getElementsByTagName("input");
	
	for (var i=0; i < inputs.length; i++)
	{
		var inp = inputs[i];
		inp.blur();
	}
	
}

function globalInit()
{
    //window.onresize = function () {location.reload(); };
	processAnchorTargets();
	
	
	isLoaded = true;
}
