var navDivs = new Array("ranking", "gender", "international", "industry", "diversity", "health", "age");
		
	function setIdProperty( id, property, value ) {
		var styleObject = document.getElementById( id );
		if (styleObject != null) {
			styleObject = styleObject.style;
			styleObject[ property ] = value;
			}
		}
 function activateTab(i) {
  closeAllExcept(i);
  document.getElementById( i ).style.display='block';
  document.getElementById( i + "_parent" ).className='active';
  }
 function deactivateTab(i) {
  document.getElementById( i ).style.display='none';
  document.getElementById( i + "_parent" ).className='';
  }
 function switchDiv(divName) {
  activateTab(divName);
  }
 
 function closeAllExcept(divName) {
  for (i = 0; i < navDivs.length; i++) {
   if (navDivs[i] != divName) {
    deactivateTab(navDivs[i]);
    }
   }
  }		
	

function popitup(url) {
	newwindow=window.open(url,'name','height=200,width=150');
	if (window.focus) {newwindow.focus()}
	return false;
}

function firstWindow() {
ElementWindow = window.open('http://wfnetwork.bc.edu/static/how_to_cite.htm',
'Cite','width=550,height=700')}


function switchImage(imgName, imgSrc)
{
  if (document.images)
  {
    if (imgSrc != "none")
    {
      document.images[imgName].src = imgSrc;
    }
  }
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function ChangeArrow(w){
	Obj=MM_findObj(w);
	if(Obj.style.backgroundImage.indexOf('over')==-1)
	{
		Obj.style.backgroundImage="url(img/arrow-1-over.png)";
	}else{
		Obj.style.backgroundImage="url(img/arrow-1.png)";
	}
}

function mmLoadMenus() {
  if (window.mm_menu_1027114752_0) return;
  window.mm_menu_1027114752_0 = new Menu("root",150,22,"Verdana, Arial, Helvetica, sans-serif",10,"#000000","#ffffff","#e6e6e6","#000000","left","middle",6,0,1000,0,0,false,true,true,0,true,true);
  mm_menu_1027114752_0.addMenuItem("About&nbsp;Us","location='template.php?name=about'");
  mm_menu_1027114752_0.addMenuItem("Our&nbsp;Resources","location='template.php?name=resources'");
  mm_menu_1027114752_0.addMenuItem("Project&nbsp;Team","location='template.php?name=team'");
  mm_menu_1027114752_0.addMenuItem("Advisory&nbsp;Committee","location='template.php?name=advisory'");
  mm_menu_1027114752_0.addMenuItem("Partners","location='template.php?name=partners'");
  mm_menu_1027114752_0.addMenuItem("News & Announcements","location='template.php?name=newsannounce'");
  mm_menu_1027114752_0.addMenuItem("Contact&nbsp;Us","location='template.php?name=contact'");
   mm_menu_1027114752_0.fontWeight="bold";
   mm_menu_1027114752_0.hideOnMouseOut=true;
   mm_menu_1027114752_0.menuBorder=1;
   mm_menu_1027114752_0.menuLiteBgColor='#c68f29';
   mm_menu_1027114752_0.menuBorderBgColor='#c68f29';
   mm_menu_1027114752_0.bgColor='#000000';

  mm_menu_1027114752_0.writeMenus();
} // mmLoadMenus()

function ScreenInfo(){
	this.w=screen.width;
	this.h=screen.height;
}

scrinfo = new ScreenInfo();

// required function ScreenInfo()
function	popUp(URLStr, width, height)
{
	wp = new ScreenInfo();
	leftPos = (wp.w - width)/2;
	topPos = (wp.h - height)/2;
	var popUpWin=0;
	  if(popUpWin)
	  {
	    if(!popUpWin.closed) popUpWin.close();
	  }
	popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbars=auto,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+leftPos+', top='+topPos+',screenX='+leftPos+',screenY='+topPos+'');
}

function	pdfpopUp(URLStr)
{
	var width = 430;
	var height = 450;
	
	wp = new ScreenInfo();
	leftPos = (wp.w - width)/2;
	topPos = (wp.h - height)/2;
	var popUpWin=0;
	  if(popUpWin)
	  {
	    if(!popUpWin.closed) popUpWin.close();
	  }
	popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+leftPos+', top='+topPos+',screenX='+leftPos+',screenY='+topPos+'');
}


function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		brmenu1_statistics_over = newImage("img/brmenu1-statistics-over.png");
		brmenu1_def__over = newImage("img/brmenu1-def--over.png");
		brmenu1_overview__over = newImage("img/brmenu1-overview--over.png");
		brmenu1_family__over = newImage("img/brmenu1-family--over.png");
		brmenu1_written_over = newImage("img/brmenu1-written-over.png");
		brmenu1_work_over = newImage("img/brmenu1-work-over.png");
		brmenu1_insight_over = newImage("img/brmenu1-insight-over.png");
		brmenu1_video_over = newImage("img/brmenu1-video-over.png");
		brmenu1_reading_over = newImage("img/brmenu1-reading-over.png");
		brmenu1_links_over = newImage("img/brmenu1-links-over.png");
		preloadFlag = true;
	}
}

function selectTopic(add) {

	if (!add) {
		add = '';
	} else {
		add = '&area=' + add;
	}
	topicId = document.getElementById('selTopics').value;
	
	if (topicId != 0) {
		document.location.href= 'topic.php?id=' + topicId + add;
	}
}

function search() {	
	if (document.search.search_text.value != '') {

		document.search.submit();
	}
}

function regular_search() {
	
	if (document.search.search_text.value != '') {

		document.search.submit();
	}
}

function stat_search() {
	
	if (document.stat_search.search_text.value != '') {

		document.stat_search.submit();
	}
}

function showStates() {
	
	val = document.getElementById('selScope').value;
	
	if (val == 'State') {

		document.getElementById('spState').style.display = 'inline';
		document.getElementById('spMap').style.display = 'inline';
		document.getElementById('spNote').style.display = 'inline';
	} else {

		document.getElementById('spState').style.display = 'none';
		document.getElementById('spMap').style.display = 'none';
		document.getElementById('spNote').style.display = 'none';
	}
}

function stateChange(frm) {
	frm.find.click();
}

function check() {
	form = document.forms[0];
	reEmail = /^.+\@.+\..+$/;
		
	if (emptyInput(form.elements[0])) 
		return alertInput (form.elements[0], "Please specify the User Name");
	if (emptyInput(form.elements[1])) 
		return alertInput (form.elements[1], "Please specify the Password");
	if (!emptyInput(form.elements[0]) && form.elements[2].value=="grantee" && !reEmail.test(form.elements[0].value))
		return alertInput(form.elements[0], "The email should serve as a User Name for Grantee section.");

	return true;
}

function checks() {
	
	form = document.login;
	reEmail = /^.+\@.+\..+$/;

	if (emptyInput(form.elements[0])) 
		return alertInput (form.elements[0], "Please specify the Email.");
	if (emptyInput(form.elements[1])) 
		return alertInput (form.elements[1], "Please specify the Password.");
	if (!emptyInput(form.elements[0]) && !reEmail.test(form.elements[0].value))
		return alertInput(form.elements[0], "The email should serve as a Login.");
	
	return true;
}

function checksend() {
	
	form = document.login;
	reEmail = /^.+\@.+\..+$/;

	if (emptyInput(form.elements[0])) 
		return alertInput (form.elements[0], "Please specify the Email.");
	if (!emptyInput(form.elements[0]) && !reEmail.test(form.elements[0].value))
		return alertInput(form.elements[0], "Please specify correct Email.");
	
	return true;
}

function generate() {
	var chars = new Array (1,2,3,4,5,6,7,8,9,'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','F','J','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
	var passw = "";
	var min_random = 0;
	var max_random = chars.length;
	var range = max_random - min_random;
	for(i=0;i<7;i++) {
		passw += chars[Math.floor(Math.random()*range) + min_random];
	}
	document.main.elements[1].value=passw;
	document.main.elements[2].value=passw;
}

function check_sendmail() {
	
	form = document.forms[0];
		
	if ((emptyInput(form.elements[1]) || emptyInput(form.elements[2])) && form.elements[7].checked) 
		return alertInput (form.elements[1], "Please specify the Password and confirmation");

	return true;
}

function openSelect(name)
{
	var w = 1024, h = 768;

	var popW = 300, popH = 150;
	var leftPos = (w/2)-(popW/2), topPos = (h/2)-(popH/2);
	
	new_win = window.open(name + ".php", name, "resizable=1,scrollbars=1,width=" + popW + ",height="+popH+",top="+topPos+",left="+leftPos);
	new_win.focus();
}

function openWin(name, id)
{
//	alert("grantee_" + name + ".php?id=" + id);
	new_win = window.open("grantee_" + name + ".php?id=" + id, name, "height=640,width=550,status=yes,toolbar=no,menubar=yes,location=no,scrollbars=yes");
	new_win.focus();
	return false;
}


function checkpass() {
	form = document.forms[0];
		
	if (emptyInput(form.elements[0])) 
		return alertInput (form.elements[0], "Please enter the new password.");
	if (emptyInput(form.elements[1])) 
		return alertInput (form.elements[1], "Please re-enter the new password");
	if (!isEqual(form.elements[0].value, form.elements[1].value))
		return alertInput(form.elements[0], "The password and confirmation you entered do not match.");

	return true;
}

function checkempty() {
	form = document.forms[0];
	for (i=0; i<form.length; i++) {
		if ((form.elements[i].type=="text" || form.elements[i].type=="textarea" || form.elements[i].type=="file") && !emptyInput(form.elements[i])) {
			return true;
		}
	}
	return alertInput(form.elements[0], "The form is empty.");
}

function ShowHide(who, what){
	Obj = document.getElementById(who);

	var browser     = '';
	var version     = '';
	
	// BROWSER?
	if (browser == ''){
		
	if (navigator.appName.indexOf('Microsoft') != -1)
		browser = 'IE'
	else if (navigator.appName.indexOf('Netscape') != -1)
		browser = 'FF'
	else if(navigator.userAgent.indexOf('Opera') != -1)
		browser = 'OPERA'
	else browser = 'IE';
	}
	
	if (version == ''){
		version= navigator.appVersion;
		paren = version.indexOf('(');
		whole_version = navigator.appVersion.substring(0,paren-1);
		version = parseInt(whole_version);
	}
	
	if(browser == 'IE' && version >= 4){
		Prop = "block";
	}else{
		Prop = "table-row";
	}

	if(what){
		Obj.style.display = Prop;
	}else{
		Obj.style.display = "none";
	}
		
}	

var DescriptionArray = new Array(
	"Choose this category to see all Statistics we have selected relevant to the topic you have chosen. The Network gathers and archives quality statistics about working families, the workforce, workplace policies and programs, and the implementation of public policies that affect working families.",
	"Choose this category to see all Definitions we have selected relevant to the topic you have chosen. The Network maintains a Work-Family Glossary of terms that was prepared to clarify and/or define specific terms related to work-family issues.",
	"Choose this category to see all Overviews & Briefs we have located relevant to the topic you have chosen. Overviews & Briefs are short and, in most cases, are available in a digital format.",
	"Choose this category to see all Work-Family Leaders we have identified who have expertise relevant to the topic you have chosen. Our directory of work-family leaders is comprised of individuals who have made contributions to the Network over the years and have identified themselves as experts in one or more work-family topics.",
	"Choose this category to see all Written Interviews we have located relevant to the topic you have chosen.  Many of these interviews have been conducted for the Network News, the monthly newsletter published by the Sloan Work and Family Research Network.",
	"Choose this category to see all Work-Family Bills we have identified relevant to the topic you have chosen.",
	"Choose this category to see all Insights from Sloan-Sponsored Studies we have selected relevant to the topic you have chosen. These research findings and insights are results of investigations sponsored by the Alfred P. Sloan Foundation.",
	"Choose this category to see links to all Videos/Audios we have identified relevant to the topic you have chosen.",
	"Choose this category to see all Suggested Readings we have selected for people interested in reading articles and books relevant to the topic you have selected.  Please consult the Network's Literature Database for a comprehensive list of work-family publications about the topic.",
	"Choose this category to see all Links to other websites with information about the topic you have chosen.",
	"Please roll your mouse pointer over the categories above to see a brief description.",
	"Choose this category to see all Resources for Teaching (which we call \"Training\" on topic pages assembled for workplace practice) we have compiled relevant to the topic you have chosen. This section includes ideas for classes and workshops about work-family issues.",
	"Choose this category to see all Resources for Training (which we call \"Teaching\" on topic pages assembled for research/teaching and state policy) we have compiled relevant to the topic you have chosen. This section includes ideas for classes and workshops about work-family issues."
);

function TopicsDescr(i) {
			
		Obj = document.getElementById("topicsdescr");
		
		t = document.createTextNode(DescriptionArray[i]);
		ot=Obj.firstChild;
		Obj.replaceChild(t, ot);
		
}

 function showHide(obj) {
   var div = document.getElementById(obj);
   if (div.style.display == 'none') {
     div.style.display = '';
   }
   else {
     div.style.display = 'none';
   }
 }
