/*
	Standards Compliant Rollover Script
	Author : Daniel Nolan
	http://www.bleedingego.co.uk/webdev.php
*/

/* With this cool script, you simply give an image the 'imgover' class and then create an image of the same name but with the word 'Highlight'
added before the extension as in 'Button.gif' and 'ButtonHighlight.gif'. */

function initRollovers() {
	if (!document.getElementById) return
	
	var aPreLoad = new Array();
	var sTempSrc;
	var aImages = document.getElementsByTagName('img');
	
	for (var i = 0; i < aImages.length; i++) {		
		if (aImages[i].className == 'imgover') {
			var src = aImages[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, 'Highlight'+ftype);

			aImages[i].setAttribute('hsrc', hsrc);
			
			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;
			
			aImages[i].onmouseover = function() {
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}	
			
			aImages[i].onmouseout = function() {
				if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('Highlight'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
			}
		}
	}
}

// Preload images


function preloadImages(imageURLs) {
	preload_image_object = new Image();
    var i = 0;
	
    // set image url

	for (i=0; i < imageURLs.length; i++)
		preload_image_object.src = imageURLs[i];
}

// HTML gallery

/***********************************************
* Advanced Gallery script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice must stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
	
function getGalleryElementbyClass(classname) {
	partscollect=new Array()
	var inc=0
	var alltags=document.all? document.all.tags("DIV") : document.getElementsByTagName("*")
	for (i=0; i<alltags.length; i++) {
		if (alltags[i].className==classname)
			partscollect[inc++]=alltags[i]
	}
}
	
function contractall() {
	var inc=0
	while (partscollect[inc]) {
		partscollect[inc].style.display="none"
		inc++
	}
}
	
function expandone() {
	var selectedDivObj=partscollect[selectedDiv]
	contractall()
	selectedDivObj.style.display="block"
	if (document.gallerycontrol)
		temp.options[selectedDiv].selected=true
	selectedDiv=(selectedDiv<totalDivs-1)? selectedDiv+1 : 0
	if (displaymode=="auto")
		autocontrolvar=setTimeout("expandone()",tickspeed)
}
	
function populatemenu() {
	temp=document.gallerycontrol.menu
	for (m=temp.options.length-1;m>0;m--)
		temp.options[m]=null
	for (i=0;i<totalDivs;i++) {
		var thesubject=partscollect[i].getAttribute("subject")
		thesubject=(thesubject=="" || thesubject==null)? "HTML Content "+(i+1) : thesubject
		temp.options[i]=new Option(thesubject,"")
	}
	temp.options[0].selected=true
}
	
function manualcontrol(menuobj) {
	if (displaymode=="manual") {
		selectedDiv=menuobj
		expandone()
	}
}
	
function preparemode(themode) {
	displaymode=themode
	if (typeof autocontrolvar!="undefined")
		clearTimeout(autocontrolvar)
	if (themode=="auto") {
		document.gallerycontrol.menu.disabled=true
		autocontrolvar=setTimeout("expandone()",tickspeed)
	}
	else
		document.gallerycontrol.menu.disabled=false
}
	
function startgallery() {
	if (document.getElementById("controldiv")) //if it exists
		document.getElementById("controldiv").style.display="block"
	getGalleryElementbyClass("gallerycontent")
	totalDivs=partscollect.length;
	if (document.gallerycontrol) {
		populatemenu()
		if (document.gallerycontrol.mode) {
			for (i=0; i<document.gallerycontrol.mode.length; i++) {
				if (document.gallerycontrol.mode[i].checked)
					displaymode=document.gallerycontrol.mode[i].value
			}
		}
	}
	if (displaymode=="auto" && document.gallerycontrol)
		document.gallerycontrol.menu.disabled=true
	expandone()
}
	
// footer

function writeFooter() {
	document.write('<p class="footerText">With the exception of information, photos and logos belonging to other parties and used with permission, all content on this website is Copyright &copy; 2004, 2010 Adrian Cho.  All rights reserved.<br>All trademarks and logos are the property of their respective owners.  Please see our <a href="TermsOfUse.html" class="footerText">Terms of Use</a>, <a href="Privacy.html" class="footerText">Privacy Policy</a> and information <a href="AboutThisWebsite.html" class="footerText">About This Website</a>.</p>');
}

// -------------------------------------------------------------------
// Ajax XML Ticker (txt file source)
// Author: Dynamic Drive (http://www.dynamicdrive.com)
// -------------------------------------------------------------------

////////////No need to edit beyond here//////////////

function createAjaxObj() {
	var httprequest=false
	if (window.XMLHttpRequest) { // if Mozilla, Safari etc
		httprequest=new XMLHttpRequest()
		if (httprequest.overrideMimeType)
			httprequest.overrideMimeType('text/xml')
	}
	else if (window.ActiveXObject) { // if IE
		try {
			httprequest=new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) {
			try {
				httprequest=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e) {}
		}
	}
	return httprequest
}

// -------------------------------------------------------------------
// Main Ajax Ticker Object function
// -------------------------------------------------------------------

function ajax_ticker(xmlTickerFile, theTickerID, theDelay) {
	this.xmlfile=xmlTickerFile
	this.tickerid=theTickerID
	this.divclass=".someclass"
	this.delay=theDelay
	this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over ticker (and pause it if it is)
	this.pointer=0
//	this.opacitystring=(typeof "fade" !="undefined")? "width: 100%; filter:progid:DXImageTransform.Microsoft.alpha(opacity=100); -moz-opacity: 1" : ""
	this.opacitystring=""	// disabled fade as not working properly on all platforms
	
	if (this.opacitystring!="") this.delay+=500 //add 1/2 sec to account for fade effect, if enabled
	this.opacitysetting=0.2 //Opacity value when reset. Internal use.
	this.messages=[] //Arrays to hold each message of ticker
	this.ajaxobj=createAjaxObj()
	document.write('<div id="'+this.tickerid+'" class="'+this.divclass+'"><div style="'+this.opacitystring+'"></div></div>')
	this.getXMLfile()
}

// -------------------------------------------------------------------
// getXMLfile()- Use Ajax to fetch xml file (txt)
// -------------------------------------------------------------------

ajax_ticker.prototype.getXMLfile=function() {
	if (this.ajaxobj) {
		var instanceOfTicker=this
		var url=this.xmlfile+"?bustcache="+new Date().getTime()
		this.ajaxobj.onreadystatechange=function(){instanceOfTicker.initialize()}
		this.ajaxobj.open('GET', url, true)
		this.ajaxobj.send(null)
	}
}

// -------------------------------------------------------------------
// initialize()- Initialize ticker method.
// -Gets contents of xml file and parse it using JavaScript DOM methods 
// -------------------------------------------------------------------

ajax_ticker.prototype.initialize=function(){ 
	if (this.ajaxobj.readyState == 4) { //if request of file completed
		if (this.ajaxobj.status==200 || window.location.href.indexOf("http")==-1) { //if request was successful
			this.contentdiv=document.getElementById(this.tickerid).firstChild //div of inner content that holds the messages
			var xmldata=this.ajaxobj.responseText
			this.contentdiv.style.display="none"
			this.contentdiv.innerHTML=xmldata
			if (this.contentdiv.getElementsByTagName("div").length==0) { //if no messages were found
				this.contentdiv.innerHTML=""
				return
			}
			var instanceOfTicker=this
			document.getElementById(this.tickerid).onmouseover=function(){instanceOfTicker.mouseoverBol=1}
			document.getElementById(this.tickerid).onmouseout=function(){instanceOfTicker.mouseoverBol=0}
			if (window.attachEvent) //Clean up loose references in IE
				window.attachEvent("onunload", function(){instanceOfTicker.contentdiv=instanceOfTicker.ajaxobj=null})
			//Cycle through XML object and store each message inside array
			for (var i=0; i<this.contentdiv.getElementsByTagName("div").length; i++) {
				if (this.contentdiv.getElementsByTagName("div")[i].className=="message")
					this.messages[this.messages.length]=this.contentdiv.getElementsByTagName("div")[i].innerHTML
			}
			this.contentdiv.innerHTML=""
			this.contentdiv.style.display="block"

			// set to start on random message		

			this.pointer = Math.round((this.messages.length-1) *Math.random())
			
			this.rotatemsg()
		}
	}
}

// -------------------------------------------------------------------
// rotatemsg()- Rotate through ticker messages and displays them
// -------------------------------------------------------------------

ajax_ticker.prototype.rotatemsg=function() {
	var instanceOfTicker=this
	if (this.mouseoverBol==1) //if mouse is currently over ticker, do nothing (pause it)
		setTimeout(function(){instanceOfTicker.rotatemsg()}, 100)
	else { //else, construct item, show and rotate it!
		this.fadetransition("reset") //FADE EFFECT- RESET OPACITY
		this.contentdiv.innerHTML=this.messages[this.pointer]
		this.fadetimer1=setInterval(function(){instanceOfTicker.fadetransition('up', 'fadetimer1')}, 100) //FADE EFFECT- PLAY IT
		this.pointer=(this.pointer<this.messages.length-1)? this.pointer+1 : 0
		setTimeout(function(){instanceOfTicker.rotatemsg()}, this.delay) //update container periodically
	}
}

// -------------------------------------------------------------------
// fadetransition()- cross browser fade method for IE5.5+ and Mozilla/Firefox
// -------------------------------------------------------------------

ajax_ticker.prototype.fadetransition=function(fadetype, timerid) {
	var contentdiv=this.contentdiv
	if (fadetype=="reset")
		this.opacitysetting=0.2
	if (contentdiv.filters && contentdiv.filters[0]) {
		if (typeof contentdiv.filters[0].opacity=="number") //IE6+
			contentdiv.filters[0].opacity=this.opacitysetting*100
		else //IE 5.5
		contentdiv.style.filter="alpha(opacity="+this.opacitysetting*100+")"
	}
	else if (typeof contentdiv.style.MozOpacity!="undefined" && this.opacitystring!="") {
		contentdiv.style.MozOpacity=this.opacitysetting
	}
	else
		this.opacitysetting=1
	if (fadetype=="up")
		this.opacitysetting+=0.1
	if (fadetype=="up" && this.opacitysetting>=1)
		clearInterval(this[timerid])
}

/***********************************************
* Ultimate Fade-In Slideshow (v1.5): © Dynamic Drive (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
	 
function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, displayorder) {
	this.pausecheck=pause
	this.mouseovercheck=0
	this.delay=delay
	this.degree=10 //initial opacity degree (10%)
	this.curimageindex=0
	this.nextimageindex=1
	fadearray[fadearray.length]=this
	this.slideshowid=fadearray.length-1
	this.canvasbase="canvas"+this.slideshowid
	this.curcanvas=this.canvasbase+"_0"
	if (typeof displayorder!="undefined")
	theimages.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter) :)
	this.theimages=theimages
	this.imageborder=parseInt(borderwidth)
	this.postimages=new Array() //preload images
	for (p=0;p<theimages.length;p++) {
		this.postimages[p]=new Image()
		this.postimages[p].src=theimages[p][0]
	}
 
	var fadewidth=fadewidth+this.imageborder*2
	var fadeheight=fadeheight+this.imageborder*2
 
	if (iebrowser&&dom||dom) //if IE5+ or modern browsers (ie: Firefox)
		document.write('<div id="master'+this.slideshowid+'" style="position:relative;width:'+fadewidth+'px;height:'+fadeheight+'px;overflow:hidden;"><div id="'+this.canvasbase+'_0" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);-moz-opacity:10;-khtml-opacity:10;background-color:'+fadebgcolor+'"></div><div id="'+this.canvasbase+'_1" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);-moz-opacity:10;background-color:'+fadebgcolor+'"></div></div>')
	else
		document.write('<div><img name="defaultslide'+this.slideshowid+'" src="'+this.postimages[0].src+'"></div>')
 
	if (iebrowser&&dom||dom) //if IE5+ or modern browsers such as Firefox
		this.startit()
	else {
		this.curimageindex++
		setInterval("fadearray["+this.slideshowid+"].rotateimage()", this.delay)
	}
}

function fadepic(obj) {
	if (obj.degree<100){
		obj.degree+=10
		if (obj.tempobj.filters&&obj.tempobj.filters[0]) {
			if (typeof obj.tempobj.filters[0].opacity=="number") //if IE6+
				obj.tempobj.filters[0].opacity=obj.degree
			else //else if IE5.5-
				obj.tempobj.style.filter="alpha(opacity="+obj.degree+")"
		}
		else 
			if (obj.tempobj.style.MozOpacity)
				obj.tempobj.style.MozOpacity=obj.degree/101
			else
				if (obj.tempobj.style.KhtmlOpacity)
					obj.tempobj.style.KhtmlOpacity=obj.degree/100
		}
	else {
		clearInterval(fadeclear[obj.slideshowid])
		obj.nextcanvas=(obj.curcanvas==obj.canvasbase+"_0")? obj.canvasbase+"_0" : obj.canvasbase+"_1"
		obj.tempobj=iebrowser? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas)
		obj.populateslide(obj.tempobj, obj.nextimageindex)
		obj.nextimageindex=(obj.nextimageindex<obj.postimages.length-1)? obj.nextimageindex+1 : 0
		setTimeout("fadearray["+obj.slideshowid+"].rotateimage()", obj.delay)
	}
}
 
fadeshow.prototype.populateslide=function(picobj, picindex) {
	var slideHTML=""
	if (this.theimages[picindex][1]!="") //if associated link exists for image
		slideHTML='<a href="'+this.theimages[picindex][1]+'" target="'+this.theimages[picindex][2]+'">'
	slideHTML+='<img src="'+this.postimages[picindex].src+'" border="'+this.imageborder+'px">'
	if (this.theimages[picindex][1]!="") //if associated link exists for image
		slideHTML+='</a>'
	picobj.innerHTML=slideHTML
}
 
fadeshow.prototype.rotateimage=function() {
	if (this.pausecheck==1) //if pause onMouseover enabled, cache object
		var cacheobj=this
	if (this.mouseovercheck==1)
		setTimeout(function(){cacheobj.rotateimage()}, 100)
	else
		if (iebrowser&&dom||dom) {
			this.resetit()
			var crossobj=this.tempobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
			crossobj.style.zIndex++
			fadeclear[this.slideshowid]=setInterval("fadepic(fadearray["+this.slideshowid+"])",50)
			this.curcanvas=(this.curcanvas==this.canvasbase+"_0")? this.canvasbase+"_1" : this.canvasbase+"_0"
		}
		else {
			var ns4imgobj=document.images['defaultslide'+this.slideshowid]
			ns4imgobj.src=this.postimages[this.curimageindex].src
		}
	this.curimageindex=(this.curimageindex<this.postimages.length-1)? this.curimageindex+1 : 0
}
 
fadeshow.prototype.resetit=function() {
	this.degree=10
	var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
	if (crossobj.filters&&crossobj.filters[0]) {
		if (typeof crossobj.filters[0].opacity=="number") //if IE6+
			crossobj.filters(0).opacity=this.degree
		else //else if IE5.5-
			crossobj.style.filter="alpha(opacity="+this.degree+")"
	}
	else
		if (crossobj.style.MozOpacity)
			crossobj.style.MozOpacity=this.degree/101
		else
			if (crossobj.style.KhtmlOpacity)
				crossobj.style.KhtmlOpacity=obj.degree/100
}
 
 
fadeshow.prototype.startit=function() {
	var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
	this.populateslide(crossobj, this.curimageindex)
	if (this.pausecheck==1) { //IF SLIDESHOW SHOULD PAUSE ONMOUSEOVER
		var cacheobj=this
		var crossobjcontainer=iebrowser? iebrowser["master"+this.slideshowid] : document.getElementById("master"+this.slideshowid)
		crossobjcontainer.onmouseover=function(){cacheobj.mouseovercheck=1}
		crossobjcontainer.onmouseout=function(){cacheobj.mouseovercheck=0}
	}
	this.rotateimage()
}

function popupAudioPlayer() {
	window.open('AudioPlayer.html', 'wimpyMP3player','width=278,height=243')
}									

function popupVideoPlayer() {
	window.open('VideoPlayer.html', 'wimpyVideoplayer','width=983,height=526')
}									

function popupYouTube() {
	window.open('http://www.youtube.com/user/impressionsinjazz', 'youtube')
}									

function popupPhotoViewer() {
	window.open('http://photos.impressionsinjazz.ca', 'photos')
}									

function daysRemaining(day, month, year, status) {
	/* status values
		1 - Tickets on sale (concert)
		2 - Reserve a place on guest list (listening party */

	var target=new Date(year, month -1, day)
  	today=new Date()
  	if (today.getMonth() == month && today.getDate() > day)
	  	target.setFullYear(target.getFullYear())
  	var millisecondsInOneDay = 1000 * 60 * 60 * 24
  	var write = (Math.ceil((target.getTime()-today.getTime())/(millisecondsInOneDay)))
  	if (write == 0)
  		document.write('This event will be held today!')
	else
		if (write == 1)
	  		document.write('1 day until this event')
		else
		  	if (write >= 0)
				document.write(write + ' days until this event')
				
	if (status == 1)
		document.write('<br>Get your tickets now!')
	else
		if (status == 2)
			document.write('<br>Reserve your seat now!')		
}

function hide(nr)
{
	if (document.layers)
		document.layers[nr].visibility = 'hide';
	else if (document.all)
		document.all[nr].style.visibility = 'hidden';
	else if (document.getElementById)
		document.getElementById(nr).style.visibility = 'hidden';
}

function show(nr)
{
	if (document.layers)
		document.layers[nr].visibility = 'show';
	else if (document.all)
		document.all[nr].style.visibility = 'visible';
	else if (document.getElementById)
		document.getElementById(nr).style.visibility = 'visible';
}

/***********************************************
* Switch Content script- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use. Last updated April 2nd, 2005.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

/* Hacked by Adrian Cho to add force expandcontent to never collapse previous and added separate function (expandcontentcollapseprevious) to always do it */

var enablepersist="off" //Enable saving state of content structure using session cookies? (on/off)

var contractsymbol='- ' //HTML for contract symbol. For image, use: <img src="whatever.gif">
var expandsymbol='+ ' //HTML for expand symbol.

if (document.getElementById){
document.write('<style type="text/css">')
document.write('.switchcontent{display:none; margin: 0;}')
document.write('</style>')
}

function getElementbyClass(rootobj, classname){
var temparray=new Array()
var inc=0
var rootlength=rootobj.length
for (i=0; i<rootlength; i++){
if (rootobj[i].className==classname)
temparray[inc++]=rootobj[i]
}
return temparray
}

function sweeptoggle(ec){
var thestate=(ec=="expand")? "block" : "none"
var inc=0
while (ccollect[inc]){
ccollect[inc].style.display=thestate
inc++
}
revivestatus()
}


function contractcontent(omit){
var inc=0
while (ccollect[inc]){
if (ccollect[inc].id!=omit)
ccollect[inc].style.display="none"
inc++
}
}

function expandcontent(curobj, cid){
var spantags=curobj.getElementsByTagName("SPAN")
var showstateobj=getElementbyClass(spantags, "showstate")
if (ccollect.length>0){
document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none"
if (showstateobj.length>0){ //if "showstate" span exists in header
showstateobj[0].innerHTML=(document.getElementById(cid).style.display=="block")? contractsymbol : expandsymbol
}
}
}

function expandcontentcollapseprevious(curobj, cid){
var spantags=curobj.getElementsByTagName("SPAN")
var showstateobj=getElementbyClass(spantags, "showstate")
if (ccollect.length>0){
contractcontent(cid)
document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none"
if (showstateobj.length>0){ //if "showstate" span exists in header
revivestatus()
}
}
}

function revivecontent(){
contractcontent("omitnothing")
selectedItem=getselectedItem()
selectedComponents=selectedItem.split("|")
for (i=0; i<selectedComponents.length-1; i++)
document.getElementById(selectedComponents[i]).style.display="block"
}

function revivestatus(){
var inc=0
while (statecollect[inc]){
if (ccollect[inc].style.display=="block")
statecollect[inc].innerHTML=contractsymbol
else
statecollect[inc].innerHTML=expandsymbol
inc++
}
}

function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function getselectedItem(){
if (get_cookie(window.location.pathname) != ""){
selectedItem=get_cookie(window.location.pathname)
return selectedItem
}
else
return ""
}

function saveswitchstate(){
var inc=0, selectedItem=""
while (ccollect[inc]){
if (ccollect[inc].style.display=="block")
selectedItem+=ccollect[inc].id+"|"
inc++
}

document.cookie=window.location.pathname+"="+selectedItem
}

function do_onload(){
uniqueidn=window.location.pathname+"firsttimeload"
var alltags=document.all? document.all : document.getElementsByTagName("*")
ccollect=getElementbyClass(alltags, "switchcontent")
statecollect=getElementbyClass(alltags, "showstate")
if (enablepersist=="on" && ccollect.length>0){
document.cookie=(get_cookie(uniqueidn)=="")? uniqueidn+"=1" : uniqueidn+"=0" 
firsttimeload=(get_cookie(uniqueidn)==1)? 1 : 0 //check if this is 1st page load
if (!firsttimeload)
revivecontent()
}
if (ccollect.length>0 && statecollect.length>0)
revivestatus()
}

if (window.addEventListener)
window.addEventListener("load", do_onload, false)
else if (window.attachEvent)
window.attachEvent("onload", do_onload)
else if (document.getElementById)
window.onload=do_onload

if (enablepersist=="on" && document.getElementById)
window.onunload=saveswitchstate

// Get width of menu based on the text for the longest menuitem.

function menuWidth(s) {
	if (document.getElementById) {
		var rulerSpan = document.getElementById('ruler');
      	rulerSpan.innerHTML = s;
	  	return (rulerSpan.offsetWidth);
  	} else
		return (s.length * 15);	// hack in case we get to this point
}

// Bookmark site Works for IE and Firefox
function bookmarksite(title, url) {
	if (document.all)
		window.external.AddFavorite(url, title);
	else if (window.sidebar)
		window.sidebar.addPanel(title, url, "")
}

// Rollover for Wimpy player buttons

var rollOverArr=new Array();
function setrollover(OverImgSrc,pageImageName) {
	if (! document.images)return;
	if (pageImageName == null)
	    pageImageName = document.images[document.images.length-1].name;
	rollOverArr[pageImageName]=new Object;
	rollOverArr[pageImageName].overImg = new Image;
	rollOverArr[pageImageName].overImg.src=OverImgSrc;
}

function rollover(pageImageName) {
	if (! document.images)return;
	if (! rollOverArr[pageImageName])return;
	if (! rollOverArr[pageImageName].outImg) {
	    rollOverArr[pageImageName].outImg = new Image;
	    rollOverArr[pageImageName].outImg.src = document.images[pageImageName].src;
	}
	document.images[pageImageName].src=rollOverArr[pageImageName].overImg.src;
}

function rollout(pageImageName) {
	if (! document.images)return;
	if (! rollOverArr[pageImageName])return;
	document.images[pageImageName].src=rollOverArr[pageImageName].outImg.src;
}

// Stuff for tabs and menu highlighting

// Make cell highlightable by changing style to "CURRENTSTYLE-highlight" when mouse is over the cell.  Obviously the stylesheet must declare this style.
function ConvertCellToLink(cell, link, makeElementHighlightable) {
	/* This is used because the "AUDIO" button uses onclick event to launch the audio player.  For the <td> containing the link, we just want to use
	the same onclick event, NOT the link.  If we want to open a new window as if using _blank target then the link should be javascript with window.open(URL). */

	if (link == "javascript:;") {
		cell.onclick = link.onclick;
		link.onclick = null;
	}
	else
		if (link.target == "_blank")
			cell.onclick = new Function("window.open('" + link + "')");
		else
			cell.onclick = new Function("document.location.href='" + link + "'");

	if (makeElementHighlightable) {
		cell.onmouseover = new Function("this.className='" + cell.className + "-highlight';this.style.cursor='pointer'");
		cell.onmouseout = new Function("this.className='" + cell.className + "'");
	}
	else
		cell.onmouseover = new Function("this.style.cursor='pointer'");	
}

function ConvertDivToLinks(xDivId) {
	var div = document.getElementById(xDivId);
	var links = div.getElementsByTagName('a');
	if (links.length == 1) {
		ConvertCellToLink(div, links [0], true);
	}
}

function ConvertTabsToLinks(xTableId) {
	var rows = document.getElementById(xTableId).getElementsByTagName('tr');
	var row = document.getElementById(xTableId).getElementsByTagName('tr')[rows.length - 1];
	var cells = row.getElementsByTagName('td');
	
	
	for (i = 0; i < cells.length; i++) {
		var links = cells [i].getElementsByTagName('a');
		if (links.length == 1) {
			ConvertCellToLink(cells [i], links [0], true);
		}
	}
}

function ConvertAllCellsToSameLink(xTableId) {
	var rows = document.getElementById(xTableId).getElementsByTagName('tr');
	
	for (i = 0; i < rows.length; i++) {
		var links = rows [i].getElementsByTagName('a');
		if (links.length == 1) {
			ConvertCellToLink(rows [i], links [0], true);
		}
	}
}

function MakeCellsLinkable(xTableId) {
	var rows = document.getElementById(xTableId).getElementsByTagName('tr');
	
	for (i = 0; i < rows.length; i++) {
		cells = rows [i].getElementsByTagName('td');
		for (j = 0; j < cells.length; j++) {
			var links = cells [j].getElementsByTagName('a');
			if (links.length == 1) {
				ConvertCellToLink(cells [j], links [0], true);
			}
		}
	}
}


