function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function readCookie(name)
{
  var cookieValue = "";
  var search = name + "=";
  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;
      cookieValue = unescape(document.cookie.substring(offset, end))
    }
  }
  return cookieValue;
}

// Example:
// writeCookie("myCookie", "my name", 24);
// Stores the string "my name" in the cookie "myCookie" which expires after 24 hours.

function writeCookie(name, value, hours)
{
  var expire = "";
  if(hours != null)
  {
    expire = new Date((new Date()).getTime() + hours * 3600000);
    expire = "; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + escape(value) + expire;
}

function getRandomImg(){

	var imagesarr = new Array( 
	"001.jpg", 
	"002.jpg"); 

	kk ='';
	
	if(readCookie('centeraw_random_image')==''){
		var my_img = Math.floor(Math.random() * imagesarr.length) ;
		document.getElementById("content").style.backgroundImage="url(../images/backgrounds/" + imagesarr[my_img] + ")";				
		writeCookie("centeraw_random_image", imagesarr[my_img], 24);
	}else{
		kk = readCookie('centeraw_random_image');
		while(kk==readCookie('centeraw_random_image')){
			var my_img = Math.floor(Math.random() * imagesarr.length) ;			
			kk = imagesarr[my_img];
		}
		writeCookie("centeraw_random_image", kk, 24);
		document.getElementById("content").style.backgroundImage="url(../images/backgrounds/" + kk + ")";				

		
	}
}

function search() {
	
	if (document.search.search_text.value != '') {

		document.search.submit();
	}
}



function stat_search() {
	
	if (document.stat_search.search_text.value != '') {

		document.stat_search.submit();
	}
}






 
var fadeimages=new Array()
//SET IMAGE PATHS. Extend or contract array as needed
fadeimages[0]=["images/scroll1.gif", "", ""] //plain image syntax
fadeimages[1]=["images/scroll2.gif", "", ""] //image with link syntax
fadeimages[2]=["images/scroll3.gif", "", ""] //image with link and target syntax
 
var fadeimages2=new Array() //2nd array set example. Remove or add more sets as needed.
//SET IMAGE PATHS. Extend or contract array as needed
fadeimages2[0]=["images/graph1.gif", "state_sponsors.html", ""] //plain image syntax
fadeimages2[1]=["images/graph2.gif", "state_sponsors.html", ""] //image with link syntax
fadeimages2[2]=["images/graph3.gif", "state_sponsors.html", ""] //image with link and target syntax
fadeimages2[3]=["images/graph4.gif", "state_sponsors.html", ""] //image with link and target syntax
fadeimages2[4]=["images/graph5.gif", "state_sponsors.html", ""] //image with link and target syntax
fadeimages2[5]=["images/graph7.gif", "state_sponsors.html", ""] //image with link and target syntax
fadeimages2[6]=["images/graph8.gif", "state_sponsors.html", ""] //image with link and target syntax
 
var fadebgcolor="white"

////NO need to edit beyond here/////////////
 
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('<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 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()
}

//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 promortions 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]=  'images/stats_figures/IB/IB14_figure3_300w.jpg';
theImages [1] = 'images/stats_figures/IB/IB16_figure3_300w.jpg';
theImages [2] = 'images/stats_figures/IB/IB16_figure2_300w.jpg';
theImages [3] = 'images/stats_figures/IB/IB13_figure1_350w.jpg';
theImages [4] = 'images/stats_figures/independent_facts/2008-10-17_2008_men_employment_325w.gif';
theImages [5] = 'images/stats_figures/independent_facts/2008-09-30_retirement_benefits_350w.gif';
theImages [6] = 'images/stats_figures/independent_facts/2008-10-17_2008_job_satisfaction_350w.gif';
theImages [7] = 'images/stats_figures/independent_facts/2008-09-25_defined_contribution_325w.gif';
theImages [8] = 'images/stats_figures/independent_facts/2008-09-25_employment_increase_350w.gif';
theImages [9] = 'images/stats_figures/independent_facts/2008-09-25_change_labor_force_350w.gif';
*/

theImages [0]=  'images/stats_figures/IB/IB14_figure3_300w.jpg';
theImages [1] = 'images/stats_figures/IB/IB16_figure3_300w2.jpg';
theImages [2] = 'images/stats_figures/IB/IB16_figure2_300w.jpg';
theImages [3] = 'images/stats_figures/IB/IB13_figure1_300w.jpg';
theImages [4] = 'images/stats_figures/independent_facts/2008_10_17_2008_men_employment_300w.gif';
theImages [5] = 'images/stats_figures/independent_facts/2008_09_30_retirement_benefits_300w.gif';
theImages [6] = 'images/stats_figures/independent_facts/2008_10_17_2008_job_satisfaction_300w.gif';
theImages [7] = 'images/stats_figures/independent_facts/2008_09_25_define_contribution_300w.gif';
theImages [8] = 'images/stats_figures/independent_facts/2008_09_25_employment_increase_300w.gif';
theImages [9] = 'images/stats_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('<img width="65%" style="margin-right: 10px;float:left" src="'+theImages[whichImage]+'">');

document.write('<table width=100%><tr><td width="300" align="left" valign="top"><img src="'+theImages[whichImage]+'"></td><td align="left" valign="top">');
document.write(theTexts[whichImage]);
document.write('</td></tr></table>');
}

//function collage menu
function run_cawmenu() {
document.write('hello there!');
//document.write('<div id="cawmenu">');
//document.write('<ul id="nav">');

//document.write('<li id="agingCollage"><a href="http://webwork.bc.edu:8082/research/agingandwork/">AGING & WORK HOME</a>');
//document.write('</li>');
//document.write('<li id="contact"><a href="http://webwork.bc.edu:8082/research/agingandwork/">CONTACT US</a>');
//document.write('</li>');
//document.write('</ul>');
//document.write('</div>');
}


