﻿// JScript File
    <!-- Hide from old browsers
    i = 3 // Number of banners that you have
    var values = new Array("images/banner2.jpg", "images/Banner2_2008.jpg", "images/Banner3_2008.jpg");
    
    var images = new Array();
    
    function randombanner()
    {
        //Create an array of images for specified image names
        for(var x=0; x < i; x++)
        {
            var img1 = new Image();
            img1.src = values[x];
            images[x] = img1;
        }
        var randomnumber = Math.random();
        i = Math.round( (i - 1) * randomnumber);
        //document.banner.src = eval("banner" + i + ".src");
        document.banner.src = images[i].src;
    }
    
    function startTime()
    {
        var time= new Date();
        hours= time.getHours();
        mins= time.getMinutes();
        secs= time.getSeconds();
        closeTime=hours*3600+mins*60+secs;
        closeTime+=4; //when banner needs to be changed   
        Timer();
    }

    function Timer()
    {
    var time= new Date();
    hours= time.getHours();
    mins= time.getMinutes();
    secs= time.getSeconds();
    curTime=hours*3600+mins*60+secs
    //alert('Current Time: ' + curTime + ' CloseTime: ' + closeTime);
    
    if (curTime>=closeTime)
    {
        if (i < 2)
        {
            i++;
            document.banner.src = images[i].src;
        }
        else
        {
            i = 0;
            document.banner.src = images[i].src;
        }
    //Change Close Time each time image is rolled over. This sets the close time for the next image    
    startTime();
   
   }
    else{
        window.setTimeout("Timer()",1000)}
        }


// -->

/*
activateActiveX
---------------
Purpose:  Dynamically replace any elements that will be affected by the new security feature in IE6/IE7 that requires a user to click certain types of elements to activate them before use.

Usage:  Include this file in the <head></head> section of your html document using the following...
	<script language="JScript" type="text/jscript" src="activateActiveX_onload.js"></script>


Since this script is in response to a software patent lawsuit, I feel it necessary to state the following...	

License:
activateActiveX is Copyright (C) 2006 Jason Baker (therippa AT gmail.com). It is available as open source code from:
http://therippa.blogspot.com

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details http://www.gnu.org/licenses/gpl.html
*/

//window.onload =function () 
function FixFlashMenu()
{
	//Determine browser, we only need this for Internet Explorer
	if (navigator.appName == "Microsoft Internet Explorer") 
	{
		
		//Array of elements to be replaced
		var arrElements = new Array(3);
		arrElements[0] = "object";
		arrElements[1] = "embed";
		arrElements[2] = "applet";
	
		
		//Loop over element types
		for (n = 0; n < arrElements.length; n++) 
		{
		
			//set object for brevity
			replaceObj = document.getElementsByTagName(arrElements[n]);
			
			//loop over element objects returned
			for (i = 0; i < replaceObj.length; i++ ) 
			{
			
				//set parent object for brevity
				parentObj = replaceObj[i].parentNode;
				
				//grab the html inside of the element before removing it from the DOM
				newHTML = parentObj.innerHTML;
				
				//remove element from the DOM
				parentObj.removeChild(replaceObj[i]);
				
				//stick the element right back in, but as a new object
				parentObj.innerHTML = newHTML;
			
			}
		}
	}
}

var mediaPopupWindow = null;

function mediaPopup(mediaLink, mediaStreamSize)
{
	var LeftPosition, width, height, TopPosition = 0;
	
	//=== These could be made as arguements ===
	var position  = 'center';
	var isInFocus = true;
	var mypage    = "/applications/mediaPlayer/mediaPlayer.asp";
	var myname    = "mediaPopup";
	
	//=== ensure we have a media stream size of LOW, MEDIUM or HIGH ===
	mediaStreamSize = mediaStreamSize.replace(/^\s+/,'').replace(/\s+$/,'');
	if(mediaStreamSize.length == 0) { mediaStreamSize = "low"; }
	
	switch (mediaStreamSize)
	{
		case "high":   width = 375; height = 465; break;
		case "medium": width = 330; height = 390; break;
		default:       width = 330; height = 330; break;

		//case "high":   width = 315; height = 420; break;
		//case "medium": width = 266; height = 381; break;
		//default:       width = 230; height = 339; break;

	}
	
	switch(position)
	{
		case 'random':
			 LeftPosition = (screen.width)  ? Math.floor(Math.random() * (screen.width - width)) : 100;
			 TopPosition  = (screen.height) ? Math.floor(Math.random() * ((screen.height - height) - 75)) : 100;
			 break;
		case 'center':
			 LeftPosition = (screen.width) ? (screen.width - width)/2 : 100;
			 TopPosition  = (screen.height) ? (screen.height - height)/2 : 100;
			 break;
		default:
		     LeftPosition = 100; 
			 TopPosition  = 100;
			 break; 
	}
	
	var settings = 'width=' + width + ',height=' + height + ',top=' + TopPosition + ',left=' + LeftPosition + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=yes';
	mediaPopupWindow = window.open('', myname, settings);
	if(isInFocus == true) { mediaPopupWindow.focus(); }
	mediaPopupWindow.location = mypage + "?media=" + escape(mediaLink) + "&size=" + mediaStreamSize;
}