/*
=========================================================
=========================================================
Javascript Document 
Powered by Dynamic Site Design - ken@dynamicsitedesign.com
=========================================================
=========================================================*/
function showMore(id) {
	document.getElementById(id).style.visibility='visible';
	document.getElementById(id).style.display='block';
	if (typeof document.body.style.maxHeight != "undefined") {
			// IE 7, mozilla, safari, opera 9
			} else {
			// IE6, older browsers
			hideSelects();
			}
}
function hideMore(id) {
	document.getElementById(id).style.visibility='hidden';
	document.getElementById(id).style.display='none';
	if (typeof document.body.style.maxHeight != "undefined") {
			// IE 7, mozilla, safari, opera 9
			} else {
			// IE6, older browsers
			showSelects();
			}
}
function showDiv(id) {
	if(document.getElementById(id)){
		document.getElementById(id).style.visibility='visible';
		document.getElementById(id).style.display='block';
	}
}
function hideDiv(id) {
	if(document.getElementById(id)){
		document.getElementById(id).style.visibility='hidden';
		document.getElementById(id).style.display='none';
	}
}
function toggleDiv(id) {
	if (document.getElementById(id).style.visibility !='visible'){
	document.getElementById(id).style.visibility='visible';
	document.getElementById(id).style.display='block';
	}
	else {
	document.getElementById(id).style.visibility='hidden';
	document.getElementById(id).style.display='none';
	}
}
function expandSection(sec_id,plus_img,minus_img){
	document.getElementById(sec_id).style.display="block";
	hideDiv(plus_img);showDiv(minus_img);
}
function collapseSection(sec_id,minus_img,plus_img){
	document.getElementById(sec_id).style.display="none";
	hideDiv(minus_img);showDiv(plus_img);
}
function expandActivities() {
	document.getElementById('activityDiv').style.display="block"
	hideDiv('plus2');showDiv('minus2');
}

function collapseActivities() {
	document.getElementById('activityDiv').style.display="none";
	hideDiv('minus2');showDiv('plus2');
}

function expandContacts() {
	document.getElementById('extMembersList').style.display="block"
	hideDiv('plus3');showDiv('minus3');
}

function collapseProgressDiv() {
	document.getElementById('inProgressDiv').style.display="none";
	hideDiv('minus4');showDiv('plus4');
}

function expandProgressDiv() {
	document.getElementById('inProgressDiv').style.display="block"
	hideDiv('plus4');showDiv('minus4');
}

function collapseContacts() {
	document.getElementById('extMembersList').style.display="none";
	hideDiv('minus3');showDiv('plus3');
}

function expandSettings() {
	document.getElementById('settingsList').style.display="block"
	hideDiv('plus');showDiv('minus');
}

function collapseSettings() {
	document.getElementById('settingsList').style.display="none";
	hideDiv('minus');showDiv('plus');
}

function expandNotification() {
	document.getElementById('NotificationList').style.height="auto"
	hideDiv('plus');showDiv('minus');
}

function collapseNotification() {
	document.getElementById('NotificationList').style.height="75px"
	hideDiv('minus');showDiv('plus');
}

function expandHistory() {
	document.getElementById('historyList').style.display="block"
	hideDiv('plus2');showDiv('minus2');
}

function collapseHistory() {
	document.getElementById('historyList').style.display="none"
	hideDiv('minus2');showDiv('plus2');
}

function expandBookmarks() {
	document.getElementById('bookmarkList').style.height="auto"
	hideDiv('plus3');showDiv('minus3');
}

function collapseBookmarks() {
	document.getElementById('bookmarkList').style.height="75px"
	hideDiv('minus3');showDiv('plus3');
}

function expandSearch() {
var _search = document.getElementById('advSearch');
var expandSearchIMG = document.getElementById('advSearchExpand');
var colapseSearchIMG = document.getElementById('advSearchColapse');

	_search.style.visibility='visible';
	_search.style.display='block';
	colapseSearchIMG.style.visibility='visible';
	colapseSearchIMG.style.display='block';
	expandSearchIMG.style.visibility='hidden';
	expandSearchIMG.style.display='none';

}
function colapseSearch() {
var _search = document.getElementById('advSearch');
var expandSearchIMG = document.getElementById('advSearchExpand');
var colapseSearchIMG = document.getElementById('advSearchColapse');

	_search.style.visibility='hidden';
	_search.style.display='none';
	colapseSearchIMG.style.visibility='hidden';
	colapseSearchIMG.style.display='none';
	expandSearchIMG.style.visibility='visible';
	expandSearchIMG.style.display='block';

}

function expandProjectSearch() {
var _projectSearch = document.getElementById('advProjectSearch');
var expandSearchIMG2 = document.getElementById('advProjectSearchExpand');
var colapseSearchIMG2 = document.getElementById('advProjectSearchColapse');

	_projectSearch.style.visibility='visible';
	_projectSearch.style.display='block';
	colapseSearchIMG2.style.visibility='visible';
	colapseSearchIMG2.style.display='block';
	expandSearchIMG2.style.visibility='hidden';
	expandSearchIMG2.style.display='none';

}
function colapseProjectSearch() {
var _projectSearch = document.getElementById('advProjectSearch');
var expandSearchIMG2 = document.getElementById('advProjectSearchExpand');
var colapseSearchIMG2 = document.getElementById('advProjectSearchColapse');

	_projectSearch.style.visibility='hidden';
	_projectSearch.style.display='none';
	colapseSearchIMG2.style.visibility='hidden';
	colapseSearchIMG2.style.display='none';
	expandSearchIMG2.style.visibility='visible';
	expandSearchIMG2.style.display='block';

}

function expandDiscussionSearch() {
var _discSearch = document.getElementById('advDiscussionSearch');
var expandSearchIMG3 = document.getElementById('advDiscussionSearchExpand');
var colapseSearchIMG3 = document.getElementById('advDiscussionSearchColapse');

	_discSearch.style.visibility='visible';
	_discSearch.style.display='block';
	colapseSearchIMG3.style.visibility='visible';
	colapseSearchIMG3.style.display='block';
	expandSearchIMG3.style.visibility='hidden';
	expandSearchIMG3.style.display='none';

}
function colapseDiscussionSearch() {
var _discSearch = document.getElementById('advDiscussionSearch');
var expandSearchIMG3 = document.getElementById('advDiscussionSearchExpand');
var colapseSearchIMG3 = document.getElementById('advDiscussionSearchColapse');

	_discSearch.style.visibility='hidden';
	_discSearch.style.display='none';
	colapseSearchIMG3.style.visibility='hidden';
	colapseSearchIMG3.style.display='none';
	expandSearchIMG3.style.visibility='visible';
	expandSearchIMG3.style.display='block';

}

// Begin checkbox functions 
function checkUncheckAll(theElement) {
     var theForm = theElement.form, z = 0;
	 for(z=0; z<theForm.length;z++){
      	if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall'){
	  	theForm[z].checked = theElement.checked;
	  	}
	}
}
// End checkbox functions 

//start function to change image rollovers//
var imgRootDir = getEcsRoot(); 
// alert(imgRootDir);
if (document.images) {

	arw01 = new Image
	arw01_ro = new Image
	arw01.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/page_arrowL.png"
	arw01_ro.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/page_arrowL_hover.png"
	
	arw02 = new Image
	arw02_ro = new Image
	arw02.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/page_arrowR.png"
	arw02_ro.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/page_arrowR_hover.png"

	arw03 = new Image
	arw03_ro = new Image
	arw03.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/page_arrowL.png"
	arw03_ro.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/page_arrowL_hover.png"
	
	arw04 = new Image
	arw04_ro = new Image
	arw04.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/page_arrowR.png"
	arw04_ro.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/page_arrowR_hover.png"
	
	plus = new Image
	plus_ro = new Image
	plus.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/plus_v2.gif"
	plus_ro.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/plus_v2_hover.gif"
	
	minus = new Image
	minus_ro = new Image
	minus.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/minus_v2.gif"
	minus_ro.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/minus_v2_hover.gif"
	
	plus2 = new Image
	plus2_ro = new Image
	plus2.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/plus_v2.gif"
	plus2_ro.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/plus_v2_hover.gif"
	
	minus2 = new Image
	minus2_ro = new Image
	minus2.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/minus_v2.gif"
	minus2_ro.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/minus_v2_hover.gif"
	
	plus3 = new Image
	plus3_ro = new Image
	plus3.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/plus_v2.gif"
	plus3_ro.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/plus_v2_hover.gif"
	
	minus3 = new Image
	minus3_ro = new Image
	minus3.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/minus_v2.gif"
	minus3_ro.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/minus_v2_hover.gif"
	
	plus4 = new Image
	plus4_ro = new Image
	plus4.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/plus_v2.gif"
	plus4_ro.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/plus_v2_hover.gif"
	
	minus4 = new Image
	minus4_ro = new Image
	minus4.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/minus_v2.gif"
	minus4_ro.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/minus_v2_hover.gif"
	
	plus5 = new Image
	plus5_ro = new Image
	plus5.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/plus_v2.gif"
	plus5_ro.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/plus_v2_hover.gif"
	
	minus5 = new Image
	minus5_ro = new Image
	minus5.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/minus_v2.gif"
	minus5_ro.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/minus_v2_hover.gif"
	
	plus6 = new Image
	plus6_ro = new Image
	plus6.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/plus_v2.gif"
	plus6_ro.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/plus_v2_hover.gif"
	
	minus6 = new Image
	minus6_ro = new Image
	minus6.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/minus_v2.gif"
	minus6_ro.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/minus_v2_hover.gif"
	
	plus7 = new Image
	plus7_ro = new Image
	plus7.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/plus_v2.gif"
	plus7_ro.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/plus_v2_hover.gif"
	
	minus7 = new Image
	minus7_ro = new Image
	minus7.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/minus_v2.gif"
	minus7_ro.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/minus_v2_hover.gif"
	
	plus8 = new Image
	plus8_ro = new Image
	plus8.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/plus_v2.gif"
	plus8_ro.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/plus_v2_hover.gif"
	
	minus8 = new Image
	minus8_ro = new Image
	minus8.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/minus_v2.gif"
	minus8_ro.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/minus_v2_hover.gif"
	
	plus9 = new Image
	plus9_ro = new Image
	plus9.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/plus_v2.gif"
	plus9_ro.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/plus_v2_hover.gif"
	
	minus9 = new Image
	minus9_ro = new Image
	minus9.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/minus_v2.gif"
	minus9_ro.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/minus_v2_hover.gif"
	
	expand = new Image
	expand_ro = new Image
	expand.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/plus_v1.gif"
	expand_ro.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/plus_v1_hover.gif"
	
	collapse = new Image
	collapse_ro = new Image
	collapse.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/minus_v1.gif"
	collapse_ro.src = imgRootDir + "/themes/sematree_ECS_v1/images/buttons/minus_v1_hover.gif"
	
	
}

function ImgSwap(imgName,newImg) {
	if (document.images) {
		document[imgName].src= eval(newImg + ".src")
	}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

//end function to change image rollovers//
function checkReplyFields() {
	if (document.getElementById('message').value == "") {
		document.getElementById('serverMsg').style.display = "block";
		document.getElementById('errorMsg').style.display = "block";
		
		labels = document.getElementsByTagName('label')
		 for (i in labels) {
			if (document.getElementById('message').value == ""){
				if ( /message/.test(labels[i].htmlFor) ) {  // test if 'for' attribute value equals message
				labels[i].style.color= "crimson";
				}
			}
		}
		return false;
	}
	else {document.forms[0].submit();}
}

function checkFields() {
	if (document.getElementById('subject').value == "" || document.getElementById('message').value == "" ) {
		document.getElementById('serverMsg').style.display = "block";
		document.getElementById('errorMsg').style.display = "block";
		
		labels = document.getElementsByTagName('label')
		 for (i in labels) {
			if (document.getElementById('subject').value == ""){
				if ( /subject/.test(labels[i].htmlFor) ) { // test if 'for' attribute value equals subject
				labels[i].style.color= "crimson";
				}
			}
			else {
				if ( /subject/.test(labels[i].htmlFor) ) { // test if 'for' attribute value equals subject
				labels[i].style.color= "#669900";
				}
			}
			if (document.getElementById('message').value == ""){
				if ( /message/.test(labels[i].htmlFor) ) {  // test if 'for' attribute value equals message
				labels[i].style.color= "crimson";
				}
			}
			else {
				if ( /subject/.test(labels[i].htmlFor) ) { // test if 'for' attribute value equals subject
				labels[i].style.color= "#669900";
				}
			}
		}
		return false;
	}
	else {document.forms[0].submit();}
}

function checkSelect (count) {
	count = 0;
	for(x=0; x<document.forms['formList'].checkbox.length; x++){
		if(document.forms['formList'].checkbox[x].checked==true){
		count++
		}
	}
	
	if(count==0){
		// alert("You must choose at least 1");
		document.getElementById('serverMsg').style.display = "block";
		document.getElementById('alertMsg').style.display = "block";
		if (document.getElementById('bubbleDiv')) { hideBubble('bubbleDiv'); }
	}
	// else if(count>3){
	//	alert("You can only choose upto 3");
	//}
	else {
		// alert("ok")
		document.getElementById('serverMsg').style.display = "none";
	}
}

function checkSelectReply (count) {
	count = 0;
	for(x=0; x<document.forms['formList'].checkbox.length; x++){
		if(document.forms['formList'].checkbox[x].checked==true){
		count++
		}
	}
	
	if(count==0){
		// alert("You must choose at least 1");
		document.getElementById('serverMsg').style.display = "block";
		document.getElementById('alertMsg').style.display = "block";
		if (document.getElementById('bubbleDiv')) { hideBubble('bubbleDiv'); }
	}
	else if(count>1){
		alert("You can only reply to 1 record at a time.");
	}
	else {
		// alert("ok")
		document.getElementById('serverMsg').style.display = "none";
		document.location = "../experts/experts-view-post-reply.html";
	}
}

function setNav(id) {
temp=document.getElementById("context_navigation");
  for(var i=1; i<=temp.getElementsByTagName("li").length; i++) {

	document.getElementById("nav" + i).className='';
	}
	document.getElementById(id).className='active';


}

function setActionsTab(id) {
temp=document.getElementById("actions_module_navigation");
  for(var i=1; i<=temp.getElementsByTagName("li").length; i++) {

	document.getElementById("actions_tab" + i).className='';
	}
	document.getElementById(id).className='selected_tab';


}
function setTab(id) {
temp=document.getElementById("module_navigation");
  for(var i=1; i<=temp.getElementsByTagName("li").length; i++) {

	document.getElementById("tab" + i).className='';
	}
	document.getElementById(id).className='selected_tab';


}
function setTeamTab(id) {
teamtemp=document.getElementById("team_module_navigation");
  for(var i=1; i<=teamtemp.getElementsByTagName("li").length; i++) {

	document.getElementById("teamtab" + i).className='';
	}
	document.getElementById(id).className='selected_tab';


}
function CSRemoveIEbox(){
if (document.images&&navigator.userAgent.indexOf("MSIE")!=-1){
	for(i=0;i<document.links.length;i++){
		target=eval("document.links[i]")
		target.onfocus=blurHandler
		}
	}
}

function blurHandler(){
obj=window.event.srcElement
if(obj.tagName == "A"||obj.tagName=="AREA") obj.blur()
}
// basic browser detection needed
var brwsr_userAgent = navigator.userAgent.toLowerCase();
var isSafari = brwsr_userAgent.indexOf('safari') != -1 ? 1 : 0; // Safari
var isIE_MacOSX = brwsr_userAgent.indexOf("msie 5.2") != -1 && brwsr_userAgent.indexOf('mac_powerpc') != -1;
var isIE_Mac = !isIE_MacOSX && brwsr_userAgent.indexOf("msie") != -1 && brwsr_userAgent.indexOf('mac') != -1;
var isNS = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) >= 4);
var xPos,yPos;

// Begin Common Functions
function getMarkerLeft(selObj) {
	var controller = this.document.getElementById(selObj);
    var iLeft = 0;
	while(controller.tagName != "BODY") {
        iLeft += controller.offsetLeft;
        controller = controller.offsetParent; 
    }
	return iLeft;
};
function getMarkerTop(selObj) {
	var controller = this.document.getElementById(selObj);
    var iTop = 0;
	while(controller.tagName != "BODY") {
        iTop += controller.offsetTop;
        controller = controller.offsetParent; 
    }
	return iTop;
};



// Begin dropnav Functions

function posMenu(selObj,id) {
	if(!isSafari && isNS || isIE_MacOSX || isIE_Mac ){//for Netscape and IE MACs
		document.getElementById(id).style.top =(this.getMarkerTop(selObj) + 29) + "px"; // used to adjust height offset of popup
		document.getElementById(id).style.left = (this.getMarkerLeft(selObj) + 0) + "px"; // used to adjust left offset of popup
	}
	else if(isSafari) { // for Safari MAX OSX
		document.getElementById(id).style.top = (this.getMarkerTop(selObj) + 29) + "px"; // used to adjust height offset of popup
		document.getElementById(id).style.left = (this.getMarkerLeft(selObj)  + 0) + "px"; // used to adjust left offset of popup
	}
	else { // all other EI versions on PC
		xPos = xPos;
		xPos = eval(document.getElementById(selObj)).offsetLeft;
		tempEl = eval(document.getElementById(selObj)).offsetParent;
		while (tempEl != null) {
			xPos += tempEl.offsetLeft;
			tempEl = tempEl.offsetParent;
		}
		yPos = yPos;
		yPos = eval(document.getElementById(selObj)).offsetTop;
		tempEl = eval(document.getElementById(selObj)).offsetParent;
		while (tempEl != null) {
			yPos += tempEl.offsetTop;
			tempEl = tempEl.offsetParent;
		}
		xPos = xPos - 0;
		document.getElementById(id).style.top = yPos + 29; // used to adjust height offset of popup
		document.getElementById(id).style.left = xPos  + 0; // used to adjust left offset of popup
	}
};
function posCollabMenu(selObj,id) {
	if(!isSafari && isNS || isIE_MacOSX || isIE_Mac ){//for Netscape and IE MACs
		document.getElementById(id).style.top =(this.getMarkerTop(selObj) + 21) + "px"; // used to adjust height offset of popup
		document.getElementById(id).style.left = (this.getMarkerLeft(selObj) - 16) + "px"; // used to adjust left offset of popup
	}
	else if(isSafari) { // for Safari MAX OSX
		document.getElementById(id).style.top = (this.getMarkerTop(selObj) + 21) + "px"; // used to adjust height offset of popup
		document.getElementById(id).style.left = (this.getMarkerLeft(selObj)  - 16) + "px"; // used to adjust left offset of popup
	}
	else { // all other EI versions on PC
		xPos = xPos;
		xPos = eval(document.getElementById(selObj)).offsetLeft;
		tempEl = eval(document.getElementById(selObj)).offsetParent;
		while (tempEl != null) {
			xPos += tempEl.offsetLeft;
			tempEl = tempEl.offsetParent;
		}
		yPos = yPos;
		yPos = eval(document.getElementById(selObj)).offsetTop;
		tempEl = eval(document.getElementById(selObj)).offsetParent;
		while (tempEl != null) {
			yPos += tempEl.offsetTop;
			tempEl = tempEl.offsetParent;
		}
		xPos = xPos - 0;
		document.getElementById(id).style.top = yPos + 21; // used to adjust height offset of popup
		document.getElementById(id).style.left = xPos  - 16; // used to adjust left offset of popup
	}
};
function posSlideMenu(selObj,id) {
	if(!isSafari && isNS || isIE_MacOSX || isIE_Mac ){//for Netscape and IE MACs
		document.getElementById(id).style.top =(this.getMarkerTop(selObj) + 230) + "px"; // used to adjust height offset of popup
		document.getElementById(id).style.left = (this.getMarkerLeft(selObj) - 1) + "px"; // used to adjust left offset of popup
	}
	else if(isSafari) { // for Safari MAX OSX
		document.getElementById(id).style.top = (this.getMarkerTop(selObj) + 230) + "px"; // used to adjust height offset of popup
		document.getElementById(id).style.left = (this.getMarkerLeft(selObj)  - 1) + "px"; // used to adjust left offset of popup
	}
	else { // all other EI versions on PC
		xPos = xPos;
		xPos = eval(document.getElementById(selObj)).offsetLeft;
		tempEl = eval(document.getElementById(selObj)).offsetParent;
		while (tempEl != null) {
			xPos += tempEl.offsetLeft;
			tempEl = tempEl.offsetParent;
		}
		yPos = yPos;
		yPos = eval(document.getElementById(selObj)).offsetTop;
		tempEl = eval(document.getElementById(selObj)).offsetParent;
		while (tempEl != null) {
			yPos += tempEl.offsetTop;
			tempEl = tempEl.offsetParent;
		}
		xPos = xPos - 0;
		document.getElementById(id).style.top = yPos + 230; // used to adjust height offset of popup
		document.getElementById(id).style.left = xPos  - 1; // used to adjust left offset of popup
	}
};

function showNav(){
	document.getElementById('helpMenu').style.visibility='visible';
	document.getElementById('helpMenu').style.display='block';
	
	if (typeof document.body.style.maxHeight != "undefined") {
		// IE 7, mozilla, safari, opera 9
	} else {
		// IE6, older browsers
		hideSelects();  // hides any select objects that were hidden
	}

};
function hideNav(id) {
	document.getElementById(id).style.visibility='hidden';
	document.getElementById(id).style.display='none';

	if (typeof document.body.style.maxHeight != "undefined") {
		// IE 7, mozilla, safari, opera 9
	} else {
		// IE6, older browsers
		showSelects();  // replaces any select objects that were hidden
	}

};

function showMenu(id) {
	// posNav(selObj,id); // position infobubble  pop up layer
	document.getElementById(id).style.visibility='visible';
	document.getElementById(id).style.display='block';
	
	if (typeof document.body.style.maxHeight != "undefined") {
		// IE 7, mozilla, safari, opera 9
		
	} else {
		// IE6, older browsers
		hideSelects();  // hides any select objects that were hidden
	}

};

function hideMenu(id) {
	document.getElementById(id).style.visibility='hidden';
	document.getElementById(id).style.display='none';

	if (typeof document.body.style.maxHeight != "undefined") {
		// IE 7, mozilla, safari, opera 9
	} else {
		// IE6, older browsers
		showSelects();  // replaces any select objects that were hidden
	}

};
function displayFields() {
	var searchSelect = document.getElementById('searchSelect');
	
	if (searchSelect.options.selectedIndex == "0") {
		hideDiv('project_searchFields');
		hideDiv('experts_searchFields');
		hideDiv('discussion_searchFields');
	}
	else if (searchSelect.options.selectedIndex == "1") {
		hideDiv('experts_searchFields');
		showDiv('project_searchFields');
		hideDiv('discussion_searchFields');
	}
	else if (searchSelect.options.selectedIndex == "2") {
		hideDiv('project_searchFields');
		showDiv('experts_searchFields');
		hideDiv('discussion_searchFields');
	}
	else if (searchSelect.options.selectedIndex == "3") {
		hideDiv('project_searchFields');
		hideDiv('experts_searchFields');
		showDiv('discussion_searchFields');
	}
};
function initAction () {
	var init_action = document.getElementById('init_action');
	
	if (init_action.options.selectedIndex == "0") {
		return;
	}
	if (init_action.options.selectedIndex == "1") {
		action ('../inc/projects/add_note_form.inc', '');
	}
	
	if (init_action.options.selectedIndex == "2") {
		action ('../inc/projects/add_interaction_form.inc', '');
	}
}

function display_dash_search_fields() {
	var dash_searchSelect = document.getElementById('dash_searchSelect');
	
	if (dash_searchSelect.options.selectedIndex == "0") {
		hideDiv('program_searchFields');
		hideDiv('directory_searchFields');
		hideDiv('tests_searchFields');
	}
	else if (dash_searchSelect.options.selectedIndex == "1") {
		showDiv('program_searchFields');
		hideDiv('directory_searchFields');
		hideDiv('tests_searchFields');
	}
	else if (dash_searchSelect.options.selectedIndex == "2") {
		hideDiv('program_searchFields');
		showDiv('directory_searchFields');
		hideDiv('tests_searchFields');
	}
	else if (dash_searchSelect.options.selectedIndex == "3") {
		hideDiv('program_searchFields');
		hideDiv('directory_searchFields');
		showDiv('tests_searchFields');
	}
};

function displayList() {
	document.getElementById('quickLinksDiv').innerHTML='<img src="../images/spinner2.gif" style="margin: 10px 65px;" />'
	
	var quickSelect = document.getElementById('quickSelect');
	if (quickSelect.options.selectedIndex == "0") {
		document.getElementById('quickLinksDiv').innerHTML='';
	}
	else if (quickSelect.options.selectedIndex == "1") {
		mtimer = setTimeout("doAjax( '../inc/modules/notificationDiv.inc', '', 'displayQuicklinks', 'GET', '0')", 2000);
	}
	else if (quickSelect.options.selectedIndex == "2") {
		mtimer = setTimeout("doAjax( '../inc/modules/bookmarkDiv.inc', '', 'displayQuicklinks', 'GET', '0')", 2000);
	}
	else if (quickSelect.options.selectedIndex == "3") {
		mtimer = setTimeout("doAjax( '../inc/modules/historyDiv.inc', '', 'displayQuicklinks', 'GET', '0')", 2000);
	}

};

function startInterval () { 
	int = setInterval("slideTabs()", 100); 
}
function stopInterval() {
	clearInterval(int);
};
function slideTabs(){
var tabs = document.getElementById('conTab');
	tabLeft = tabs.style.marginLeft
	units = 10;
var tabLeftStr,newStr

	if (tabLeft == ''){
		tabs.style.marginLeft = (tabLeft - units) + "px";
		//alert("empty");
	}
	 else {
	 	if(tabLeft.substring(3,4)  =='p'){
				tabLeftStr = tabLeft.substring(1,3);
				newStr = (tabLeftStr*1) + units
				tabs.style.marginLeft = "-" + newStr + "px";
				//alert(newStr );
		}
		if(tabLeft.substring(4,5)  =='p') {
			if (tabLeft.substring(1,4)<=120) {
				tabLeftStr = tabLeft.substring(1,4);
				newStr = (tabLeftStr*1) + units
				tabs.style.marginLeft = "-" + newStr + "px";
				//alert(newStr );
			}
			else {
				return false;
			}
		}
	}
	
};
function changeSettings() {
	document.getElementById('prefsDiv').innerHTML='<img src="../images/spinner2.gif" style="margin: 10px 65px;" />';
	mtimer = setTimeout("doAjax( '../inc/mtc/prefs_form_module.inc', '', 'displayPrefs', 'GET', '0')", 2000);
	

};
function confirmSettings() {
	document.getElementById('prefsDiv').innerHTML='<img src="../images/spinner2.gif" style="margin: 10px 65px;" />';
	mtimer = setTimeout("doAjax( '../inc/mtc/prefsList.inc', '', 'displayPrefs', 'GET', '0')", 2000);
	

};
function change_Settings(url) {
	document.getElementById('prefsDiv').innerHTML='<img src="../images/spinner2.gif" style="margin: 10px 65px;" />';
	mtimer = setTimeout("doAjax( '" + url + "', '', 'displayPrefs', 'GET', '0')", 2000);
	

};
function confirm_Settings(url) {
	document.getElementById('prefsDiv').innerHTML='<img src="../images/spinner2.gif" style="margin: 10px 65px;" />';
	mtimer = setTimeout("doAjax( '" + url + "', '', 'displayPrefs', 'GET', '0')", 2000);
	

};
function change_com_Settings(url) {
	document.getElementById('comDiv').innerHTML='<img src="../images/spinner2.gif" style="margin: 10px 65px;" />';
	mtimer = setTimeout("doAjax( '" + url + "', '', 'displayCom', 'GET', '0')", 2000);
	

};
function confirm_com_Settings(url) {
	document.getElementById('comDiv').innerHTML='<img src="../images/spinner2.gif" style="margin: 10px 65px;" />';
	mtimer = setTimeout("doAjax( '" + url + "', '', 'displayCom', 'GET', '0')", 2000);
	

};
function rateIT(img_name){
	if(document.images){
	star_off = new Image(13,14);
	star_off.src = '../images/rating_greyStar.gif';
	star_on = new Image(13,14);
	star_on.src = '../images/rating_goldStar.gif';
		if (img_name == 'star1'){
			document['star1'].src = star_on.src;
			document['star2'].src = star_off.src;
			document['star3'].src = star_off.src;
			document['star4'].src = star_off.src;
			document['star5'].src = star_off.src;
		}
		else if (img_name == 'star2'){
			document['star1'].src = star_on.src;
			document['star2'].src = star_on.src;
			document['star3'].src = star_off.src;
			document['star4'].src = star_off.src;
			document['star5'].src = star_off.src;
		}
		else if (img_name == 'star3'){
			document['star1'].src = star_on.src;
			document['star2'].src = star_on.src;
			document['star3'].src = star_on.src;
			document['star4'].src = star_off.src;
			document['star5'].src = star_off.src;
		}
		else if (img_name == 'star4'){
			document['star1'].src = star_on.src;
			document['star2'].src = star_on.src;
			document['star3'].src = star_on.src;
			document['star4'].src = star_on.src;
			document['star5'].src = star_off.src;
		}
		else if (img_name == 'star5'){
			document['star1'].src = star_on.src;
			document['star2'].src = star_on.src;
			document['star3'].src = star_on.src;
			document['star4'].src = star_on.src;
			document['star5'].src = star_on.src;
		}
	}
}
function transferValue (what, where) {
parent.document.getElementById(where).innerHTML = what
}
function transferSelectedIndex (what, where) {
parent.document.getElementById(where).innerHTML = what
}


// writeCookie("myCookie", "my name", 24);
// Stores the string "my name" in the cookie "myCookie" which expires after 24 hours.
// The hours parameter is optional; if hours is left out, the cookie value expires at the end of the visitor's browser session.
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 + "; path=/";
}
// Example:
// alert( readCookie("myCookie") );

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;
}

function text_only () {
var navbar = document.getElementById('tabmenu');
var navbar_text = navbar.getElementsByTagName("font");
var navbar_icons = navbar.getElementsByTagName("img");

	for (var i=0; i<navbar_text.length; i++) {
		if (navbar_text[i]) {
			navbar_text[i].style.display = 'none';
		}
	}
	for (var i=0; i<navbar_icons.length; i++) {
		if (navbar_icons[i]) {
			navbar_icons[i].style.display = 'inline';
			navbar_icons[i].style.margin = '0px';
		}
	}
	writeCookie('navprefs', 'text_only', 144);
	if (document.getElementById('collab_menu')) {posCollabMenu('collab_item', 'collab_menu');}
}

function icon_only () {
var navbar = document.getElementById('tabmenu');
var navbar_text = navbar.getElementsByTagName("font");
var navbar_icons = navbar.getElementsByTagName("img");

	for (var i=0; i<navbar_icons.length; i++) {
		if (navbar_icons[i]) {
			navbar_icons[i].style.display = 'none';
		}
	}
	for (var i=0; i<navbar_text.length; i++) {
		if (navbar_text[i]) {
			navbar_text[i].style.display = 'inline';
		}
	}
	writeCookie('navprefs', 'icon_only', 144);
	if (document.getElementById('collab_menu')) {posCollabMenu('collab_item', 'collab_menu');}
}


function text_icon () {
var navbar = document.getElementById('tabmenu');
var navbar_text = navbar.getElementsByTagName("font");
var navbar_icons = navbar.getElementsByTagName("img");

	for (var i=0; i<navbar_icons.length; i++) {
		if (navbar_icons[i]) {
			navbar_icons[i].style.display = 'inline';
			navbar_icons[i].style.marginTop = '-2px';
			navbar_icons[i].style.marginRight = '5px';
		}
	}
	for (var i=0; i<navbar_text.length; i++) {
		if (navbar_text[i]) {
			navbar_text[i].style.display = 'inline';
		}
	}
	writeCookie('navprefs', 'text_icon', 144);
	if (document.getElementById('collab_menu')) {posCollabMenu('collab_item', 'collab_menu');}
}
function getNavPrefs() {
var navCookie = readCookie('navprefs')
	if (document.getElementById('tabmenu')) {
		if (navCookie == 'text_only') { text_only(); }
		if (navCookie == 'icon_only') { icon_only(); }
		if (navCookie == 'text_icon') { text_icon(); }
		if (navCookie == '' || navCookie == null) { text_icon(); }
	}
}

/**
 * Rate something 
 */
function rateIT(img_name){
	if(document.images){
	star_off = new Image(13,14);
	star_off.src = '../images/rating_greyStar.gif';
	star_on = new Image(13,14);
	star_on.src = '../images/rating_goldStar.gif';
		if (img_name == 'star1'){
			document['star1'].src = star_on.src;
			document['star2'].src = star_off.src;
			document['star3'].src = star_off.src;
			document['star4'].src = star_off.src;
			document['star5'].src = star_off.src;
		}
		else if (img_name == 'star2'){
			document['star1'].src = star_on.src;
			document['star2'].src = star_on.src;
			document['star3'].src = star_off.src;
			document['star4'].src = star_off.src;
			document['star5'].src = star_off.src;
		}
		else if (img_name == 'star3'){
			document['star1'].src = star_on.src;
			document['star2'].src = star_on.src;
			document['star3'].src = star_on.src;
			document['star4'].src = star_off.src;
			document['star5'].src = star_off.src;
		}
		else if (img_name == 'star4'){
			document['star1'].src = star_on.src;
			document['star2'].src = star_on.src;
			document['star3'].src = star_on.src;
			document['star4'].src = star_on.src;
			document['star5'].src = star_off.src;
		}
		else if (img_name == 'star5'){
			document['star1'].src = star_on.src;
			document['star2'].src = star_on.src;
			document['star3'].src = star_on.src;
			document['star4'].src = star_on.src;
			document['star5'].src = star_on.src;
		}
	}
}


/* Admin Table of Contents Scripts   */

function selectTOCsection (sectTitle, displaySection) {
	var sectDivs = document.getElementById('toc_sections')
	var sections = sectDivs.getElementsByTagName('div')
	var tabText = document.getElementById('dynamic_tab')
	var selObj = document.getElementById('menu2')
	
	if (selObj.options[selObj.selectedIndex].value != '#'){
			for (i=0;i<sections.length;i++){sections[i].style.display='none'};
			hideDiv('tocDIV');
			showDiv(displaySection);
			showDiv('dynamic_item');
			tabText.innerHTML=sectTitle;
			setNav('nav2');
	} 
	else {
			displayTOC();
	}
	
}
function gotoTOCsection () {
	var sectTitle = readCookie("sect_Title");
	var displaySection = readCookie("display_Section");
	var opt = readCookie("option_index");
	
	if (sectTitle !=""){
		displayTOCsection(sectTitle, displaySection, opt);
	}
	else {
		displayTOC();
	}
}
// sectTitle = Contextual Tab Text
// displaySection = Div to display
// opt = TOC drop down [selectedIndex]
function displayTOCsection (sectTitle, displaySection, opt) {
	var sectDivs = document.getElementById('toc_sections')
	var sections = sectDivs.getElementsByTagName('div')
	var tabText = document.getElementById('dynamic_tab')
	var selObj = document.getElementById('menu2')
	
	for (i=0;i<sections.length;i++){sections[i].style.display='none'};
	hideDiv('tocDIV');
	showDiv(displaySection);
	showDiv('dynamic_item');
	setNav('nav2');
	tabText.innerHTML=sectTitle;
	selObj.options[opt].selected = 'true';
	writeCookie("sect_Title", sectTitle, 24);
	writeCookie("display_Section", displaySection, 24);
	writeCookie("option_index", opt, 24);
}
function displayTOC(){
	var sectDivs = document.getElementById('toc_sections')
	var sections = sectDivs.getElementsByTagName('div')
	var tabText = document.getElementById('dynamic_tab')
	var selObj = document.getElementById('menu2')

	for (i=0;i<sections.length;i++){sections[i].style.display='none'};
	hideDiv('dynamic_item');
	tabText.innerHTML='';
	showDiv('tocDIV');
	setNav('nav1');
	selObj.options[0].selected = 'true'
}

function setHistoryPanel(which) {
writeCookie('historyPanel', which, 144);
}


function getHistoryPanel() {
var historyPanelCookie = readCookie('historyPanel')
	if(document.getElementById('historyList')) {
		if (historyPanelCookie == 'close') {
			collapseHistory();
		} 
		else if (historyPanelCookie == 'open') {
			expandHistory();
		}
	}
}

 function getSelectedOptionValue(selectBox) {
      var val = null;
      for (var i = 0; i < selectBox.options.length; i++) {
        if (selectBox.options[i].selected == true) {
         val =  selectBox.options[i].value;
        }
      }
      return val;
     }
     /**
      * makes a url request of the form 
      *  thisUrl?ajaxOp=xxx + urlArgs + &oid=getOid() & varName=selectedOptionValue 
      * selectBox - the form element for select
      * divName - the id to update
      * ajaxOp
      * urlArgs 
      * 
      */
     function doAjaxForSelect(selectBox, divName, ajaxOp, urlArgs, varName)  {
      var selVal = getSelectedOptionValue(selectBox);   
             
      var cargs = urlArgs + "&" + varName + "=" + selVal;
      //alert('in update states :' + cargs );
      var callb = "__" + divName;
      var url = "" + document.location;
      var idx = url.indexOf("?") ;
      if (idx != -1) {
       url = url.substring(0, idx);
      }
      var aargs = 'ajaxOp=' + ajaxOp + '&' + cargs + "&oid=" + getOid();
      //alert('in update states :' + aargs  + " url " + url);
      
      doAjax( url, aargs, callb, 'GET', '0');
     }