﻿// JScript File
/* <![CDATA[ */
function AdjustColumnsHeight()
{
if (window.document.getElementById('contentBox') != null)
{
var contentBox = window.document.getElementById('contentBox');
var hContentBox = contentBox.offsetHeight;
} else {
var hContentBox = 0;
}

if(window.document.getElementById('contentLeft') != null)
{
var contentLeft = window.document.getElementById('contentLeft');
var contentRight = window.document.getElementById('contentRight');
var hContentLeft = contentLeft.offsetHeight;
var hContentRight = contentRight.offsetHeight;
var maxHeight = Math.max(hContentLeft, hContentRight+8);
maxHeight = maxHeight+hContentBox;
} else {
maxHeight = hContentBox;
}
window.document.getElementById('content').style.height = maxHeight + 16 + 'px';
window.document.getElementById('navigation').style.top = maxHeight + 'px';
window.document.getElementById('footer').style.top = maxHeight + 'px';
}

window.onload = function()
{
// launch adjust columns height function in general.js
AdjustColumnsHeight();
window.document.getElementById('ctl00_pnlImageUrlPopup').style.top = 0 + 'Px';

}

/*
the getElementsByClassName function I pilfered from this guy. It's
a useful function that'll return any/all tags with a specific css class.
Written by Jonathan Snook, http://www.snook.ca/jonathan
Add-ons by Robert Nyman, http://www.robertnyman.com
*/
function getElementsByClassName(oElm, strTagName, strClassName)
{
// first it gets all of the specified tags
var arrElements = (strTagName == "*" && document.all) ? document.all : oElm.getElementsByTagName(strTagName);
// then it sets up an array that'll hold the results
var arrReturnElements = new Array();
// some regex stuff you don't need to worry about
strClassName = strClassName.replace(/\-/g, "\\-");
var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
var oElement;
// now it iterates through the elements it grabbed above
for(var i=0; i<arrElements.length; i++)
{
oElement = arrElements[i];
// if the class matches what we're looking for it ads to the results array
if(oRegExp.test(oElement.className))
{
arrReturnElements.push(oElement);
}
}
// then it kicks the results back to us
return (arrReturnElements)
}

/* ]]> */

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=600,left = 200,top = 200');");
}
function popUpMovie(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=780,height=580,left = 170,top = 72');");
}

// show/hide the share article div
function showTagger(obj)
{
var el = window.document.getElementById(obj);
if(el != "")
{
if (el.style.display == "none")
{
el.style.display = "block";
} else {
el.style.display = "none";
}
} AdjustColumnsHeight();
}


function toggle(index)
{
divs = getElementsByClassName(document, "div", "tabs");
for(var i=0; i<divs.length; i++)
{ 
document.getElementById("tab" + i + "").style.display = 'none';
}
document.getElementById("tab" + index + "").style.display = 'block';
AdjustColumnsHeight();
}
        
function GetImage(ImageUrl, ret){

var currentImgId = ImageUrl;
$get('popImage').innerHTML = ImageUrl;  
var setimg = new Array();

function preloading(){
for (x=0; x<preloading.arguments.length; x++){
setimg[x] = new Image();
setimg[x].src = preloading.arguments[x];
setimg[x].alt = preloading.arguments[x];
//window.document.getElementById('ctl00_pnlImageUrlPopup').style.top = 0;
//window.document.getElementById('ctl00_upImagePopup').style.top = 0;
}
}
preloading(ImageUrl);

if (ret == false)
{
window.document.getElementById('popImage').innerHTML = "<img src=\"Images/"+ setimg[0].alt +"\" alt=\""+ setimg[0].alt + "\" />";
} else {
window.document.getElementById('popImage').innerHTML = "<img src=\"Images/"+ setimg[0].alt +"\" alt=\""+ setimg[0].alt + "\" />";
}
ShowImageUrlPopup();
}

function ShowImageUrlPopup()
{
$find(
"openImageUrl").show();
}
function HideImageUrlPopup()
{
$find(
"openImageUrl").hide();
}

var state = 'hidden';
function showhide(layer_ref) {
if (state == 'visible') {
state = 'hidden';
}
else {
state = 'visible';
}
if (document.all) { //IS IE 4 or 5 (or 6 beta)
eval( "document.all." + layer_ref + ".style.visibility = state");
}
if (document.layers) { //IS NETSCAPE 4 or below
document.layers[layer_ref].visibility = state;
}
if (document.getElementById && !document.all) {
maxwell_smart = document.getElementById(layer_ref);
maxwell_smart.style.visibility = state;
}
}