// by Pau@YellowPencil.com and Scot@YellowPencil.com
// feel free to delete all comments except for the above credit

function setTall() {
	if (document.getElementById) {

		// the divs array contains references to each column's div element.  
		// Replace 'left' 'center' with your own.  
		// Or remove the last one entirely if you've got 2 columns.  Or add another if you've got 4!
		var divs = new Array(document.getElementById('leftnav'), document.getElementById('content'));

		// Let's determine the maximum height out of all columns specified
		var maxHeight = 0;
		for (var i = 0; i < divs.length; i++) {
      if (divs[i]) {
			  if (divs[i].offsetHeight > maxHeight) maxHeight = divs[i].offsetHeight;
      }
		}
		// Let's set all columns to that maximum height
		for (var i = 0; i < divs.length; i++) {
      if (divs[i]) {
			divs[i].style.height = maxHeight + 'px';

			// Now, if the browser's in standards-compliant mode, the height property
			// sets the height excluding padding, so we figure the padding out by subtracting the
			// old maxHeight from the new offsetHeight, and compensate!  So it works in Safari AND in IE 5.x
			if (divs[i].offsetHeight > maxHeight) {
				divs[i].style.height = (maxHeight - (divs[i].offsetHeight - maxHeight)) + 'px';
			}
      }
		}

	}
}


window.onload = function() {

	setTall();
	/* Replace startList below if loadHover is used
	if(typeof(loadHover)=="function") {
		loadHover();
	}
	*/

	if(typeof(window.startList)=="function") {
		startList();
	}
}

window.onresize = function() {
	setTall();
}

var menuHover = true;

var infowin = null;

function newPopWin(url,w,h)
{
  infowin = window.open("","","toolbar=yes,location=yes,scrollbars=yes,resizable=yes,top=20,left=20,width=" + w + ",height=" + h);
  if (infowin != null)
  {
    infowin.location.href = url;
// is the window.focus method supported by this verison of javascript
// if so, then do it.
    if (window.focus)
    {
       infowin.focus();
    }
  }
// return true;
}

function closePopWin()
{
  if (infowin != null && infowin.open) infowin.close();
// return true;
}                                           



/* NH: Temporary solution until sfir.js errors resolved */
function no_error()
{ return true; }
//window.onerror=no_error;

/* SS: Support functions for hybrid left nav */

function get_absolute_link(relative_link)
{
	var new_link = left_nav_url + relative_link;
	
	var link_elements = relative_link.split("/");
	var up_count = 0;
	
	for (var i = 0; i < link_elements.length; i++)
	{
		if (link_elements[i] == "..")
		{
			up_count++;
		}
	}
	
	if (up_count > 0)
	{
		full_link_elements = left_nav_url.split("/");
		
		for (var i = 0; i <= up_count; i++)
		{
			full_link_elements.pop();
		}
		
		new_link = full_link_elements.join("/") + "/" + link_elements[link_elements.length - 1];
	}

	return new_link;
}

function write_absolute_anchor(relative_link, label)
{
	var new_link = get_absolute_link(relative_link);
	document.writeln("<a href='../" + new_link + "'>" + label + "</a>");			
}




//Huong's script to rotate images and text for the front page of Aging & Facts

var theTexts = new Array();
theTexts [0] = 'A 2008 analysis of a study of couples and careers "reveals that one in two older workers (those aged 50 and above) have a dependent child in the household and one in five of these workers have an adult child in the household." (fig.3, p.3)';
theTexts [1] = 'According to a 2004 analysis, workers 45 years or older represent 26% of the workforce but 35% of the long-term unemployed. (fig. 3, p. 5)';
theTexts [2] = 'According to a 2006 Bureau of Labor Statistics report, reemployment rates for displaced workers who had been at their previous job for over three years were 75% for workers 25-54, 61% for workers 55-64, and 25% for workers who were 65 and older. (fig. 2, p. 3)';
theTexts [3] = 'According to 2007 Bureau of Labor Statistics data, "during the last half of the 20th century, the labor fource participation rates of people aged 55 and older dropped.  However, beginning in the mid 1990s, there was a "turning of the tide, " and these rates started to rise, particularly among women." (Fig. 1, p. 1)';
theTexts [4] = 'According to a 2008 analysis of CPS data, the proportions of older workers who work part-time compared to full-time increases with age for both men and women.  In 2008, 34.7% of employed women worked part-time, compared to 18.9% of men.  By ages 65-69, the proportions of employed women and men who work part-time increases to 44.7% and 27.8% respectively. (Tables 3 & 4)';
theTexts [5] = 'According to a 2008 BLS report, "sixty-one percent of private industry emplyees had access to paid retirement benefits, compared with 89 percent of State and local government employees.  Eighty-six percent of government employees participated in a retirement plan, significantly greater than the approximately half of private industry workers." (p. 1 and Table 1)';
theTexts [6] = 'According to a 2008 survey of recent retirees, "while a majority (54 percent) was either extremely, very, or somewhat satisfied with their job at the time they made their decision to retire, a sizable minority (46 percent) indicate they were not too or not at all satisfied." (p. 4)';
theTexts [7] = 'According to a 2008 BLS report, "among all workers there has been a decrease in the percentage covered by defined benefit ("payout") plans and an increase in the percentage covered by defined contribution ("pay in") plans. "  In 2007, 43% of workers were covered by defined contribution plans, compared to 35% in 1992-93.  In 2007, 20% of workers were covered by defined benefit plans compared to 32% in 1992-93.';
theTexts [8] = 'According to a 2008 BLS report, "between 1977 and 2007, employment of workers 65 and over increased 101 percent, compared to a much smaller increase of 59 percent for total employment (16 and over).  The number of employed men 65 and over rose 75 percent, but employment of women 65 and older increased by nearly twice as much, climbing 147 percent.  While the number of employed people age 75 and over is relative small (0.8 percent of the employed in 2007), this group had the most dramatic gain, increasing 172 percent between 1977 and 2007."';
theTexts [9] = 'According to a 2008 BLS report, "the nunmber of workers between the ages of 75 and 74 and those aged 75 and up are predicted to soar by more than 80 percent.  By 2016, workers age 65 and over are expected to account for 6.1 percent of the total labor force, up sharply from their 2006 share of 3.6 percent."';
var theImages = new Array();

theImages [0]=  'http://agingandwork.bc.edu/images/stats_figures/IB/IB14_figure3_300w.jpg';
theImages [1] = 'http://agingandwork.bc.edu/images/stats_figures/IB/IB16_figure3_300w2.jpg';
theImages [2] = 'http://agingandwork.bc.edu/images/stats_figures/IB/IB16_figure2_300w.jpg';
theImages [3] = 'http://agingandwork.bc.edu/images/stats_figures/IB/IB13_figure1_300w.jpg';
theImages [4] = 'http://agingandwork.bc.edu/images/stats_figures/independent_facts/2008_10_17_2008_men_employment_300w.gif';
theImages [5] = 'http://agingandwork.bc.edu/images/stats_figures/independent_facts/2008_09_30_retirement_benefits_300w.gif';
theImages [6] = 'http://agingandwork.bc.edu/images/stats_figures/independent_facts/2008_10_17_2008_job_satisfaction_300w.gif';
theImages [7] = 'http://agingandwork.bc.edu/images/stats_figures/independent_facts/2008_09_25_define_contribution_300w.gif';
theImages [8] = 'http://agingandwork.bc.edu/images/stats_figures/independent_facts/2008_09_25_employment_increase_300w.gif'
theImages [9] = 'http://agingandwork.bc.edu/images/stats_figures/independent_facts/2008_09_25_change_labor_force_300w.gif';


//theImages [0]=  '/content/dam/files/research_sites/agingandwork/jpg/stat_figures/IB/IB14_figure3_300w.jpg';
//theImages [1] = '/content/dam/files/research_sites/agingandwork/jpg/stat_figures/IB/IB16_figure3_300w2.jpg';
//theImages [2] = '/content/dam/files/research_sites/agingandwork/jpg/stat_figures/IB/IB16_figure2_300w.jpg';
//theImages [3] = '/content/dam/files/research_sites/agingandwork/jpg/stat_figures/IB/IB13_figure1_300w.jpg';
//theImages [4] = '/content/dam/files/research_sites/agingandwork/gif/stat_figures/independent_facts/2008_10_17_2008_men_employment_300w.gif';
//theImages [5] = '/content/dam/files/research_sites/agingandwork/gif/stat_figures/independent_facts/2008_09_30_retirement_benefits_300w.gif';
//theImages [6] = '/content/dam/files/research_sites/agingandwork/gif/stat_figures/independent_facts/2008_10_17_2008_job_satisfaction_300w.gif';
//theImages [7] = '/content/dam/files/research_sites/agingandwork/gif/stat_figures/independent_facts/2008_09_25_define_contribution_300w.gif';
//theImages [8] = '/content/dam/files/research_sites/agingandwork/gif/stat_figures/independent_facts/2008_09_25_employment_increase_300w.gif'
//theImages [9] = '/content/dam/files/research_sites/agingandwork/gif/stat_figures/independent_facts/2008_09_25_change_labor_force_300w.gif';


var j=0;
var p=theImages.length;
var preBuffer = new Array();
for(i=0;i<p;i++){
preBuffer[i] = new Image();
preBuffer[i].src=theImages[i];
}
var whichImage = Math.round(Math.random()*(p-1));
function loadImage(){
document.write('<table><tr><td align="left" valign="top"><img src="'+theImages[whichImage]+'"></td><td align="left" valign="top">');
document.write(theTexts[whichImage]);
document.write('</td></tr></table>');
}


//document.write('<img src="'+theImages[whichImage]+'">');
//document.write(theTexts[whichImage]);
//}

//script for strategy council fade in slide show


      
/***********************************************
* Ultimate Fade-In Slideshow (v1.51): © 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.
***********************************************/
 
var fadeAgeWSimages=new Array()
//SET IMAGE PATHS. Extend or contract array as needed
fadeAgeWSimages[0]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/beyond_ws1.jpg", "", ""] 
fadeAgeWSimages[1]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/beyond_ws2.jpg", "", ""]
fadeAgeWSimages[2]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/beyond_ws3.jpg", "", ""] 
fadeAgeWSimages[3]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/beyond_ws4.jpg", "", ""] 
fadeAgeWSimages[4]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/beyond_ws5.jpg", "", ""]
fadeAgeWSimages[5]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/beyond_ws6.jpg", "", ""]
fadeAgeWSimages[6]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/beyond_ws7.jpg", "", ""]
fadeAgeWSimages[7]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/beyond_ws7.jpg", "", ""]
fadeAgeWSimages[8]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/beyond_ws7.jpg", "", ""]
fadeAgeWSimages[9]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/beyond_ws7.jpg", "", ""]
fadeAgeWSimages[10]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/beyond_ws7.jpg", "", ""]

var fadeSCimages=new Array()
//SET IMAGE PATHS. Extend or contract array as needed
fadeSCimages[0]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/1F-1.jpg", "", ""] 
fadeSCimages[1]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/1F-2.jpg", "", ""]
fadeSCimages[2]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/1F-3.jpg", "", ""] 
 
 var fadeQEimages=new Array()
//SET IMAGE PATHS. Extend or contract array as needed
fadeQEimages[0]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/1B_0.jpg", "", ""] 
fadeQEimages[1]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/1B_1.jpg", "", ""] 
fadeQEimages[2]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/1B_2.jpg", "", ""] 
fadeQEimages[3]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/1B_3.jpg", "", ""] 
fadeQEimages[4]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/1B_4.jpg", "", ""] 
fadeQEimages[5]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/1B_5.jpg", "", ""] 
fadeQEimages[6]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/1B_6.jpg", "", ""] 
fadeQEimages[7]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/1B_7.jpg", "", ""] 
fadeQEimages[8]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/1B_8.jpg", "", ""] 
fadeQEimages[9]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/1B_9.jpg", "", ""] 
fadeQEimages[10]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/1B_10.jpg", "", ""]
 
 var fadeFactsimages=new Array()
 //var r = Math.ceil(Math.random() * 4);
//SET IMAGE PATHS. Extend or contract array as needed
fadeFactsimages[0]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/Facts&Lit_1_1.jpg", "http://capricorn.bc.edu/agingandwork/database/search/facts", ""] 
fadeFactsimages[1]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/Facts&Lit_2_1.jpg", "http://capricorn.bc.edu/agingandwork/database/search/facts", ""] 
fadeFactsimages[2]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/Facts&Lit_3_1.jpg", "http://capricorn.bc.edu/agingandwork/database/search/facts", ""] 
fadeFactsimages[3]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/Facts&Lit_4_1.jpg", "http://capricorn.bc.edu/agingandwork/database/search/facts", ""] 
fadeFactsimages[4]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/Facts&Lit_5_1.jpg", "http://capricorn.bc.edu/agingandwork/database/search/facts", ""] 
fadeFactsimages[5]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/Facts&Lit_6_1.jpg", "http://capricorn.bc.edu/agingandwork/database/search/facts", ""] 
fadeFactsimages[6]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/Facts&Lit_7_1.jpg", "http://capricorn.bc.edu/agingandwork/database/search/facts", ""] 



//FACTS IMAGE TESTING >>>
var fade_Facts=new Array()
 //var r = Math.ceil(Math.random() * 4);
//SET IMAGE PATHS. Extend or contract array as needed
fade_Facts[0]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/facts_Agencies.jpg", "http://capricorn.bc.edu/agingandwork/database/search/facts", ""] 
fade_Facts[1]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/facts_Effectiveness.jpg", "http://capricorn.bc.edu/agingandwork/database/search/facts", ""] 
fade_Facts[2]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/facts_generations.jpg", "http://capricorn.bc.edu/agingandwork/database/search/facts", ""] 
fade_Facts[3]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/facts_WorkOptions.jpg", "http://capricorn.bc.edu/agingandwork/database/search/facts", ""] 








var fadeHomeimages=new Array()
 //var r = Math.ceil(Math.random() * 4);
//SET IMAGE PATHS. Extend or contract array as needed
fadeHomeimages[0]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/got_1.jpg", "/research/agingandwork/projects/genTalent.html", ""] 
fadeHomeimages[1]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/got_2.jpg", "/research/agingandwork/projects/genTalent.html", ""] 
fadeHomeimages[2]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/got_3.jpg", "/research/agingandwork/projects/genTalent.html", ""] 
fadeHomeimages[3]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/got_4.jpg", "/research/agingandwork/projects/genTalent.html", ""] 
fadeHomeimages[4]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/tm_1.jpg", "/research/agingandwork/projects/talentMgmt.html", ""] 
fadeHomeimages[5]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/tm_2.jpg", "/research/agingandwork/projects/talentMgmt.html", ""] 
fadeHomeimages[6]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/tm_3.jpg", "/research/agingandwork/projects/talentMgmt.html", ""] 
fadeHomeimages[7]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/cc_1.jpg", "/research/agingandwork/projects/contextStudies.html", ""]
fadeHomeimages[8]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/cc_2.jpg", "/research/agingandwork/projects/contextStudies.html", ""]
fadeHomeimages[9]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/cc_3.jpg", "/research/agingandwork/projects/contextStudies.html", ""]

var fadeHomeGOT=new Array()
 //var r = Math.ceil(Math.random() * 4);
//SET IMAGE PATHS. Extend or contract array as needed
fadeHomeGOT[0]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/home_GOT1.jpg", "/research/agingandwork/projects/genTalent.html", ""] 
fadeHomeGOT[1]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/home_GOT2.jpg", "/research/agingandwork/projects/genTalent.html", ""] 
fadeHomeGOT[2]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/home_GOT3.jpg", "/research/agingandwork/projects/genTalent.html", ""] 
fadeHomeGOT[3]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/home_GOT4.jpg", "/research/agingandwork/projects/genTalent.html", ""] 
fadeHomeGOT[4]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/home_GOT5.jpg", "/research/agingandwork/projects/genTalent.html", ""] 
fadeHomeGOT[5]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/home_GOT6.jpg", "/research/agingandwork/projects/genTalent.html", ""]

var fadeHomeEAWA=new Array()
 //var r = Math.ceil(Math.random() * 4);
//SET IMAGE PATHS. Extend or contract array as needed
fadeHomeEAWA[0]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/home_pg_EAWA_JustDoIt_1.jpg", "/research/agingandwork/archive_pubs/EAWA_JustDoIt.html", ""] 
fadeHomeEAWA[1]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/home_pg_EAWA_JustDoIt_2.jpg", "/research/agingandwork/archive_pubs/EAWA_JustDoIt.html", ""] 

var fadeHomeTM=new Array()
 //var r = Math.ceil(Math.random() * 4);
//SET IMAGE PATHS. Extend or contract array as needed
fadeHomeTM[0]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/TM_00_home.jpg", "/research/agingandwork/projects/talentMgmt.html", ""] 
fadeHomeTM[1]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/TM_01_home.jpg", "/research/agingandwork/archive_pubs/TM_pressureWorkforce.html", ""] 
fadeHomeTM[2]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/TM_02_home.jpg", "/research/agingandwork/archive_pubs/TM_HealthCare.html", ""] 
fadeHomeTM[3]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/TM_03_home.jpg", "/research/agingandwork/archive_pubs/TM_retail.html", ""] 
fadeHomeTM[4]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/TM_04_home.jpg", "/research/agingandwork/archive_pubs/TM_accommodation.html", ""] 
fadeHomeTM[5]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/TM_05_home.jpg", "/research/agingandwork/archive_pubs/TM_construction.html", ""]
fadeHomeTM[6]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/TM_06_home.jpg", "/research/agingandwork/archive_pubs/TM_ProSciTech.html", ""] 
fadeHomeTM[7]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/TM_07_home.jpg", "/research/agingandwork/archive_pubs/TM_Finance.html", ""]
fadeHomeTM[8]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/TM_08_home.jpg", "/research/agingandwork/archive_pubs/TM_Wholesale.html", ""]
fadeHomeTM[9]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/TM_09_home.jpg", "/research/agingandwork/archive_pubs/TM_Transportation.html", ""]
fadeHomeTM[10]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/home_work&families.jpg", "/research/agingandwork/all_feeds/2010/2010-10-06.html", ""]
fadeHomeTM[11]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/home_newUnemployed.jpg", "/research/agingandwork/all_feeds/2010/2010-11-16.html", ""]




var fadeTM=new Array()
 //var r = Math.ceil(Math.random() * 4);
//SET IMAGE PATHS. Extend or contract array as needed
fadeTM[0]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/TM_00.jpg", "/research/agingandwork/projects/talentMgmt.html", ""] 
fadeTM[1]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/TM_01.jpg", "/research/agingandwork/archive_pubs/TM_pressureWorkforce.html", ""] 
fadeTM[2]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/TM_02.jpg", "/research/agingandwork/archive_pubs/TM_HealthCare.html", ""] 
fadeTM[3]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/TM_03.jpg", "/research/agingandwork/archive_pubs/TM_retail.html", ""] 
fadeTM[4]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/TM_04.jpg", "/research/agingandwork/archive_pubs/TM_accommodation.html", ""] 
fadeTM[5]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/TM_05.jpg", "/research/agingandwork/archive_pubs/TM_construction.html", ""]
fadeTM[6]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/TM_06.jpg", "/research/agingandwork/archive_pubs/TM_ProSciTech.html", ""] 
fadeTM[7]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/TM_07.jpg", "/research/agingandwork/archive_pubs/TM_Finance.html", ""]
fadeTM[8]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/TM_08.jpg", "/research/agingandwork/archive_pubs/TM_Wholesale.html", ""]
fadeTM[9]= ["/content/dam/files/research_sites/agingandwork/jpg/elements/TM_09.jpg", "/research/agingandwork/archive_pubs/TM_Transportation.html", ""]
var fadebgcolor="white"

var fadearray=new Array() //array to cache fadeshow instances
var fadeclear=new Array() //array to cache corresponding clearinterval pointers
 
var dom=(document.getElementById) //modern dom browsers
var iebrowser=document.all
 
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);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;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);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div></div>')
else
document.write('<img name="defaultslide'+this.slideshowid+'" src="'+this.postimages[0].src+'">')
 
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 if (obj.tempobj.style.opacity&&!obj.tempobj.filters)
obj.tempobj.style.opacity=obj.degree/101
}
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=this.degree/100
else if (crossobj.style.opacity&&!crossobj.filters)
crossobj.style.opacity=this.degree/101
}
 
 
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()
}
// script for floating box in EE
Xoffset=-60;
Yoffset= 20;

var old,win,iex=(document.all),yyy=-1000;

var ns4=document.layers
var ns6=document.getElementById&&!document.all
var ie4=document.all

if (ns4)
win=document.pop
else if (ns6)
win=document.getElementById("pop").style
else if (ie4)
win=document.all.pop.style
if(ns4)document.captureEvents(Event.MOUSEMOVE);
else{
win.visibility="visible"
win.display="none"
}
document.onmousemove=get_mouse;

function popup(msg,bg){
var content="<TABLE  WIDTH=550 BORDER=1 BORDERCOLOR=black CELLPADDING=2 CELLSPACING=0 "+
"BGCOLOR="+bg+"><TD><FONT COLOR=white SIZE=2>"+msg+"</FONT></TD></TABLE>";
yyy=Yoffset;
 if(ns4){win.document.write(content);win.document.close();win.visibility="visible"}
 if(ns6){document.getElementById("pop").innerHTML=content;win.display=''}
 if(ie4){document.all("pop").innerHTML=content;win.display=''}
}

function get_mouse(e){
var x=(ns4||ns6)?e.pageX:event.x+document.body.scrollLeft;
win.left=x+Xoffset;
var y=(ns4||ns6)?e.pageY:event.y+document.body.scrollTop;
win.top=y+yyy;
}

function kill(){
yyy=-1000;
if(ns4){win.visibility="hidden";}
else if (ns6||ie4)
win.display="none"
}


//embeded video
function getElementsByClass (searchClass) {
  // This function returns an array of all HTML objects with the
  // specified className.  Tag is optional   
  var returnArray = [];
  var els = document.getElementsByTagName('*');
  var pattern = new RegExp('(^|\\s)'+searchClass+'(\\s|$)');
  for (var i = 0; i < els.length; i++) {
    if ( pattern.test(els[i].className) ) { returnArray.push(els[i]); }
  }
  return returnArray;
}

//popup video clips
function popVideo(vid, darken) {
  // This function accepts a division ID (vid), either a string or the actual
  // object itself.   vid is mandatory.   darken is optional, if it's true
  // the page will be greyed out under the video.
  var videos = getElementsByClass('video');     // Get all the videos on the page.
  var isplaying=null;
  for(i=0; i<videos.length; i++) {              // Loop through all the videos
    if (videos[i].style.display=='block') {     // This video is playing 
      isplaying=videos[i].id;                   // remember its name
      var tmp=videos[i].innerHTML;              // Get the division contents
      videos[i].innerHTML='';                   // destroy the contents
      videos[i].style.display='none';           // Terminate the video.
      videos[i].innerHTML=tmp;                  // rebuild the contents.
    }
  }
  // This handles the darkening of the background while a video is playing.
  // First we see if the dark layer exists.
  var dark=document.getElementById('darkenScreenObject');
  if (!dark) {
    // The dark layer doesn't exist, it's never been created.  So we'll
    // create it here and apply some basic styles.
    var tbody = document.getElementsByTagName("body")[0];
    var tnode = document.createElement('div');          // Create the layer.
        tnode.style.backgroundColor='rgb(0, 0, 0)';     // Make it black.
        tnode.style.opacity='0.7';                      // Set the opacity (firefox/Opera)
        tnode.style.MozOpacity='0.70';                  // Firefox 1.5
        tnode.style.filter='alpha(opacity=70)';         // IE.
        tnode.style.zIndex='1';                         // Zindex of 50 so it "floats"
        tnode.style.position='absolute';                // Position absolutely
        tnode.style.top='0px';                          // In the top
        tnode.style.left='0px';                         // Left corner of the page
        tnode.style.overflow='hidden';                  // Try to avoid making scroll bars            
        tnode.style.display='none';                     // Start out Hidden
        tnode.id='darkenScreenObject';                  // Name it so we can find it later
    tbody.appendChild(tnode);                           // Add it to the web page
    dark=document.getElementById('darkenScreenObject'); // Get the object.
  }
  dark.style.display='none';
  if ((isplaying==vid)||(/^close$/i.test(vid))) { return false; }
  if (typeof(vid)=="string") { vid=document.getElementById(vid); }
  if (vid&&typeof(vid)=="object") {
    if (darken) {
      // Calculate the page width and height 
      if( window.innerHeight && window.scrollMaxY )  { 
        var pageWidth = window.innerWidth + window.scrollMaxX;
        var pageHeight = window.innerHeight + window.scrollMaxY;
      } else if( document.body.scrollHeight > document.body.offsetHeight ) {
        var pageWidth = document.body.scrollWidth;
        var pageHeight = document.body.scrollHeight;
      } else { 
        var pageWidth = document.body.offsetWidth + document.body.offsetLeft; 
        var pageHeight = document.body.offsetHeight + document.body.offsetTop; 
      }
      //set the shader to cover the entire page and make it visible. 
      dark.style.width= pageWidth+'px';
      dark.style.height= pageHeight+'px';
      dark.style.display='block';                                
    }
    // Make the video visible and set the zindex so its on top of everything else
    vid.style.zIndex='100';    
    vid.style.display='block';
    var scrollTop = 0;
    if (document.documentElement && document.documentElement.scrollTop)
      scrollTop = document.documentElement.scrollTop;
    else if (document.body)
      scrollTop = document.body.scrollTop;

    // set the starting x and y position of the video
    vid.style.top=scrollTop+Math.floor((document.documentElement.clientHeight/2)-(vid.offsetHeight/2))+'px';
    vid.style.left=Math.floor((document.documentElement.clientWidth/2)-(vid.offsetWidth/2))+'px';
  }
  return false;
}




