﻿var pramTitle = "PRAM | ";
var navMenuId = "zz1_TopNavigationMenu";
var searchId = "ctl00_SearchBox";
var searchInputId = searchId + "_S83C543AE_InputKeywords";
var searchButtonId = searchId + "_S83C543AE_go";
var searchPrompt = "Search";
var slideshowHomePath = "/Style Library/pram/slideshow_home/slideshow.swf";
var slideshowGalleryPath = "/Style Library/pram/slideshow_gallery/slideshow.swf";

function initializeTitle()
{
	if (document.title.indexOf(pramTitle) != 0)
		document.title = pramTitle + document.title;
}

function initializeMenu()
{
	var element = document.getElementById(navMenuId);
	var tdElements = element.getElementsByTagName("td");
	
	for (var i = 0, j = tdElements.length; i < j; i++)
		if (tdElements[i].innerHTML.length == 0)
			tdElements[i].style.display = "none";
}

function initializeSearch()
{
	initializeSearchPrompt();
	modifySearchAction();
}

function initializeSearchPrompt()
{
	var element = document.getElementById(searchInputId);
	element.onblur = resetSearchPrompt;
	element.onfocus = clearSearchPrompt;
	element.onblur();
}

function resetSearchPrompt()
{
	if (this.value.length == 0)
		this.value = searchPrompt;
}

function clearSearchPrompt()
{
	if (this.value == searchPrompt)
		this.value = "";
}

function modifySearchAction()
{
	var element = document.getElementById(searchButtonId);
	element.onclick = executeSearchAction;
}

function executeSearchAction()
{
	var element = document.getElementById(searchInputId);

	if (element.value == searchPrompt)
		return false;
}

function initializeSlideShowHome()
{
	var so = new SWFObject(slideshowHomePath, "slideshow_home", "796", "300", "7", "#fff");
	so.addParam("base", ".");
	so.addParam("wmode", "opaque");
	so.write("slideshow_home");
}

function initializeSlideShowGallery()
{
	var so = new SWFObject(slideshowGalleryPath, "slideshow_gallery", "728", "400", "7", "#fff");
	so.addParam("base", ".");
	so.addParam("wmode", "opaque");
	so.write("slideshow_gallery");
}

function showHelp()
{
	return TopHelpButtonClick("NavBarHelpHome");
}

if (window.ActiveXObject) window.ie = window[window.XMLHttpRequest ? 'ie7' : 'ie6'] = true;
if (window.ie6) try {document.execCommand("BackgroundImageCache", false, true);} catch(e){};