// *************************************************** 
// Popup Window
// *************************************************** 

// Create variable to hold window object
var TheWindow = null

// Open Window Function
function OpenWindow(TheURL,TheTop,TheLeft,TheHeight,TheWidth,ScrollYesNo,ResizeYesNo,LocationYesNo,StatusYesNo,ToolbarYesNo,MenubarYesNo)
{
// If window is open, close it before reopening it
// if (TheWindow != "" && document.getElementById)
if (TheWindow != null && !TheWindow.closed)
{TheWindow.close()}

// Set unique name for new window
now = new Date()
WinName = now.getMilliseconds()

// If the top position of the window is not specified, center it vertically on the screen
if (TheTop == "")
{WinTop = screen.height/2 - (TheHeight/2)}
else
{WinTop = TheTop}

// If the left position of the window is not specified, center it horizontally on the screen
if (TheLeft == "")
{WinLeft = screen.width/2 - (TheWidth/2)}
else
{WinLeft = TheLeft}

// Create open window statement and place window object in variable
TheWindow = eval("window.open('" + TheURL + "','" + WinName + "','top=" + WinTop + ",left=" + WinLeft + ",width=" + TheWidth + ",height=" + TheHeight + ",scrollbars=" + ScrollYesNo + ",resizable=" + ResizeYesNo + ",location=" + LocationYesNo + ",status=" + StatusYesNo + ",toolbar=" + ToolbarYesNo + ",menubar=" + MenubarYesNo + "')")
}



// *************************************************** 
// Select Box Navigation
// *************************************************** 

function LoadPage(FormInfo)
{
// If option was null, reset select box
if (FormInfo.options[FormInfo.selectedIndex].value == "")
{FormInfo.selectedIndex = 0}

// If option was not null
else
{
// Break up option value into array
WindowArray = FormInfo.options[FormInfo.selectedIndex].value.split(",")

// Set unique name for new window
now = new Date()
WinName = now.getMilliseconds()

// If link is to be opened in new window
if (WindowArray.length > 2)
{
// Set variables based on array
TheURL = WindowArray[0]
TheTop = WindowArray[1]
TheLeft = WindowArray[2]
TheHeight = WindowArray[3]
TheWidth = WindowArray[4]
ScrollYesNo = WindowArray[5]
ResizeYesNo = WindowArray[6]
LocationYesNo = WindowArray[7]
StatusYesNo = WindowArray[8]
ToolbarYesNo = WindowArray[9]
MenubarYesNo = WindowArray[10]

// Reset select box
FormInfo.selectedIndex = 0

// If window is open, close it before reopening it
// if (TheWindow != "")
if (TheWindow != null && !TheWindow.closed)
{TheWindow.close()}

// If the top position of the window is not specified, center it vertically on the screen
if (TheTop == "")
{WinTop = screen.height/2 - (TheHeight/2)}
else
{WinTop = TheTop}

// If the left position of the window is not specified, center it horizontally on the screen
if (TheLeft == "")
{WinLeft = screen.width/2 - (TheWidth/2)}
else
{WinLeft = TheLeft}

// Take focus off select box
window.focus()

// Create open window statement and place window object in variable
TheWindow = eval("window.open('" + TheURL + "','newWin','top=" + WinTop + ",left=" + WinLeft + ",width=" + TheWidth + ",height=" + TheHeight + ",scrollbars=" + ScrollYesNo + ",resizable=" + ResizeYesNo + ",location=" + LocationYesNo + ",status=" + StatusYesNo + ",toolbar=" + ToolbarYesNo + ",menubar=" + MenubarYesNo + "')")
}

// If link is to be opened in current window
else 
{
// Set target of link
target = WindowArray[1]

// Target link to 'top'
if (target == "top")
{top.parent.location.href = WindowArray[0]}
// Target link to 'self'
else if (target == "self")
{self.location.href = WindowArray[0]}
// Target link to named frame
else
{parent.frames[target].location.href = WindowArray[0]
FormInfo.selectedIndex=0
parent.frames[target].focus()}
}

}

}