﻿function flipWhoAmI()
{
	if (eval("document.getElementById('GridViewWhoAmI')"))
	{
	    available_width=document.body.clientWidth;		
		available_width = available_width - 760;
		xoffset = parseInt(available_width / 2,10);
		obj = document.getElementById('GridViewWhoAmI')
	    obj.style.left = (xoffset + 19) + "px"
		curStyle = obj.style.display;
		if (curStyle == "block")
			obj.style.display = "none";
		else
			obj.style.display = "block";
	}
}




//Menu Code Copyright 2001 by Harold Blackorby/SCORE Interactive
//Updated 2005 for CSS compliance by Harold Blackorby/Hughes
//May not be reused without permission or copyright

var doc = 'document.getElementById("';
var sty = '").style';
var htm = "";
var allready;
var prevMenu = "";
var numMenus = -1;
var aryMenu = new Array();
var bgcolor = "#FFFFFF"; //not used here
var rollcolor = "#e5eace";

function showMenu(e,menurowID,obj,moveIt)
{
	if (allready)
	{
	    menu = "menu" + menurowID;			
		pmenu = menu.substring(4,5);
		
		x = aryMenu[pmenu-1][2];
		y = aryMenu[pmenu-1][3];
			
		var posx = 0;
		var posy = 0;
		posy = y;

        //find the left margin in the centered page design
	    available_width=document.body.clientWidth;		
		available_width = available_width - 760;
		xoffset = parseInt(available_width / 2,10);
		
		//find coordinates of mouseover event to use
		if (!e) var e = window.event;
		if (e.pageX || e.pageY)
		{
			posx = e.pageX-5;
			posy = e.pageY-5;
		}
		else if (e.clientX || e.clientY)
		{
			posx = e.clientX + document.body.scrollLeft-5;
			posy = e.clientY + document.body.scrollTop-5;
		}
		
		posy = (168 + (24 * (menurowID-1)));
		if (menurowID == 4) posy += 17;
		if (menurowID == 5) posy += 34;
		if (menurowID > 5) posy += 51;

		hideMenu();
		if (x == "" || x == null)
			x = 0;
		if (y == "" || y == null)
			y = 0;
		if (document.getElementById(menu))
		{
			myLyr = document.getElementById(menu).style;
			if (moveIt == 1) {
				myLyr.top = posy + "px";
				myLyr.left = (x+xoffset) + "px";
			}
			myLyr.visibility = "visible";
		}

	}
}

function hideMenu()
{
	if (allready) {
    	j = 0;
		while (j <= numMenus)
		{
			myLyr = eval(doc + aryMenu[j][1] + sty);
			myLyr.visibility = "hidden";
			j++;
		}
	}
	return true;
}

function changeColor(menu)
{
	if (allready) {
		menu = menu.id;
		myLyr = eval(doc + menu + sty);
		myLyr.background = rollcolor;
		myLyr.fontWeight = "bold";
	}
}

function changeColorBack(menu)
{
	if (allready) {
		menu = menu.id;
		pmenu = menu.substring(4,5);
		curBGcolor = aryMenu[pmenu-1][5];
		myLyr = eval(doc + menu + sty);
		myLyr.backgroundColor = curBGcolor;
		myLyr.fontWeight = "normal";
	}
}

function writeMenus()
{
	j = 0;
	while (j <= numMenus)
	{
		document.write("<div name='" + aryMenu[j][1] + "' id='" + aryMenu[j][1] + "' class='menu' onmouseover=\"showMenu(event,'" + aryMenu[j][4] + "',this,0)\" onmouseout=\"hideMenu();\">");
		document.write("<table cellpadding='0' style='background-color: " + aryMenu[j][5] + "' cellspacing='0' border='0' class='mainmenu'>");
		k = 6;
		while (k <= (aryMenu[j].length-1))
		{
			menuName = aryMenu[j][1] + "s";
			menuName += k.toString();
			document.write("<td id='" + menuName + "' name='" + menuName + "'");
			document.write("onmouseover='changeColor(this);' onmouseout='changeColorBack(this);'><div class='textWhite'><a");
			strhref = new String(aryMenu[j][k+2]);
			splithref = strhref.split(":new:");
			aryMenu[j][k+2] = splithref[0];
			if (strhref.indexOf(":new:") > 0)
			{
				document.write(" HREF='" + aryMenu[j][k+2] + "' target='_blank'");
			}
			else
			{
				document.write(" HREF='" + aryMenu[j][k+2] + "'");
			}
			//document.write(" href='" + aryMenu[j][k+2] + "'");
			//curHref = new String(aryMenu[j][k+2]);
			//if (curHref.indexOf('http') > -1 )
			//	document.write(" target='_blank'");			
			document.write(" style='color: #727471'>" + aryMenu[j][k] + "</a></div></td></tr>");
			k = k + 3;
		}
		document.write("</table>");
		document.write("</div>");
		j++
	}
}

function makeMenu()
{
	numMenus += 1;
	numItems = arguments.length;
	aryMenu[numMenus] = new Array(numItems-1);
	aryMenu[numMenus][0] = arguments[0]
	aryMenu[numMenus][1] = "menu" + arguments[0]
	j = 2;
	while (j <= arguments.length)
	{		
		aryMenu[numMenus][j] = arguments[j-1];
		j++;
	}
}

function startup() {
	allready = true }
	
	
	
// 12/28/06 - The following function was added to present the appropriate .gif file (either "UP" or "DOWN" arrow)
// First - loop through all of the entries to set the image to "Plus" and the display to "none";
// Then  - for the selected item (ID), change the image to "UP" and set the style property to show the Image and/or Caption.

var NewsCount = 0;
var FirstImage = "";
var aryNews = new Array(NewsCount);
function addNews(ID,ImagePath)
{
    if (NewsCount == 0)
        FirstImage = ImagePath;
	aryNews[NewsCount] = ID;
	++NewsCount;
}
function flipNews(ID,isFirefox,ImagePath)
{
	//alert(NewsCount + "\n" + aryNews);
	//alert(ID);

	var j = 0;
	//loop through all news stories (skipping the chosen one), and close them all
	while (j < NewsCount)
	{
		if (aryNews[j] != ID)
		{
			if (eval("document.getElementById('pgmdesc" + aryNews[j] + "')"))
			{
				document.getElementById('pgmbutton' + aryNews[j]).src = "graphics/Design/btnPlus.gif";
				document.getElementById('pgmdesc' + aryNews[j]).style.display = "none";
			}
		}
		j++;
	}
	

	curImg = document.getElementById('pgmbutton' + ID).src;
	if (curImg.indexOf('btnPlus.gif') > 0) //open the current item
	{
		document.getElementById('pgmbutton' + ID).src = "graphics/Design/btnMinus.gif";
			
		//document.getElementById('pgmdesc' + ID).style.visibility = "visible";
		if (isFirefox == "True")
		{
			document.getElementById('pgmdesc' + ID).style.display = "table-cell";	
		}
		else
		{	
			document.getElementById('pgmdesc' + ID).style.display = "block";
		}
		document.getElementById('ImageNews').src = ImagePath;
	}
	else //close the current item then
	{
		document.getElementById('pgmbutton' + ID).src = "graphics/Design/btnPlus.gif";
		document.getElementById('pgmdesc' + ID).style.display = "none";
		//document.getElementById('pgmdesc' + ID).style.visibility = "hidden";		
	}
}

function flipLink(ID)
{
	if (eval("document.getElementById('if" + ID + "')"))
	{
		curStyle = document.getElementById('if' + ID).style.display;
		if (curStyle == "block")
			document.getElementById('if' + ID).style.display = "none";
		else
			document.getElementById('if' + ID).style.display = "block";
	}
}

function openfirst(isFirefox)
{
var ID = aryNews[0];
if (eval("document.getElementById('pgmbutton" + ID + "')"))
{
	curImg = document.getElementById('pgmbutton' + ID).src;
	if (curImg.indexOf('btnPlus.gif') > 0)	
	{
	    document.getElementById('ImageNews').src = FirstImage;
		document.getElementById('pgmbutton' + ID).src = "graphics/design/btnMinus.gif";
		if (isFirefox == "True")
		{
			document.getElementById('pgmdesc' + ID).style.display = "table-cell";	
		}
		else
		{	
			document.getElementById('pgmdesc' + ID).style.display = "block";
		}
	}
	else
	{
		document.getElementById('pgmbutton' + ID).src = "graphics/design/btnPlus.gif";
		document.getElementById('pgmdesc' + ID).style.display = "none";	
	}
}
}