


<!--

/* Todd Frascone, 05-23-2005 */

// begin Common namespace
var Common = {};

Common.CookieFieldSeparator  = ",";
Common.CookieMaxSize         = 4000;          // officially 4K (4,096), but play it safe and go with 4000
Common.CookiePath            = "/publisher";
Common.CookieRecordSeparator = ":";

Common.GetCookie =
	function (name) {
  		// cookies are separated by semicolons
  		var cookies = document.cookie.split("; ");

  		for (var i = 0; i < cookies.length; i++) {

    			var cookie = cookies[i].split("=");
    			if (cookie.length >= 2 && cookie[0] == name) {
					return unescape(cookie[1]);
			}
  		}
		return "";
	};

Common.GetCookieRecordAsString =
	function (cookieName, key) {
	
		var cookieValueStr = new String(Common.GetCookie(cookieName));

		var recordBeginPos = cookieValueStr.indexOf(Common.CookieRecordSeparator + 
		                                            key + 
		                                            Common.CookieFieldSeparator);		                                            	
		if (recordBeginPos == -1) {;
			return new String("");
		} else {				
			var recordEndPos = cookieValueStr.indexOf(Common.CookieRecordSeparator, recordBeginPos + 1);			
			var record       = cookieValueStr.substring(recordBeginPos + 1, recordEndPos);
			return record;
		}
	};
	
Common.GetDomain = 
	function (url) {

		var domain = "";

		var urlStr = new String(url);
		var urlArr = urlStr.split("/");

		if (urlArr.length >= 3) {

			hostDomainPortStr = new String(urlArr[2]); 
			hostDomainPortArr = hostDomainPortStr.split(":");
			hostDomainStr     = new String(hostDomainPortArr[0]);
			hostDomainArr     = hostDomainStr.split(".");
			host              = hostDomainArr[0];

			if ((host != "localhost") && (isNaN(host))) { // localhost & ip address check

				for (var i = 1; i < hostDomainArr.length; i++) {

					domain = domain + hostDomainArr[i];

					if (i < (hostDomainArr.length - 1)) {
						domain = domain +  ".";	
					}
				}			
			}
		}

		return domain;
	};

Common.GetObject =
    function( objOrStr ) { // objOrStr = object or string
        if ( typeof( objOrStr ) == "string" ) {
            return document.getElementById( objOrStr );
        }
        return objOrStr;
    };

Common.GetQueryStringArgValue =

	function (url, argName) {

		var argValue = "";

		var urlStr = new String(url);
		var urlArr = urlStr.split("?");

		if (urlArr.length >= 2) {

			qryStr = new String(urlArr[1]);
			qryArgs = qryStr.split("&");

			for (var i = 0; i < qryArgs.length; i++) {

				argStr = new String(qryArgs[i]);
				argArr = argStr.split("=");

				if ((argArr.length >= 2) && (argArr[0] == argName)) {
					argValue = argArr[1];
				}
			}
		}

		return argValue;
	};
	
Common.HideObject = 
	function ( objId, dispStyle ) { // objId = object or string
	
	    var objToDisp = Common.GetObject( objId );
		var displayValue = ( dispStyle != undefined )? dispStyle : "none";
		
		if ( objToDisp ) {
			objToDisp.style.display = displayValue;		
		}
	};
	
Common.PositionDiv = 
	function ( element, div ) { 
	
        objItem   = element;
        objParent = null;
        var posX  = 0;
        var posY  = 0;

        while (objItem) {
                posX     += objItem.offsetLeft;
                posY     += objItem.offsetTop;
                objItem   = objItem.offsetParent;
        } 
	
        div.style.left = posX + 10;
        div.style.top  = posY + 20;  
	};
	
Common.SetCookie = 
	function (name, value, domain, path, secure, expires) {

		var cookie   = name + "=" + escape(value) +
	  	((expires) ? "; expires=" + expires.toGMTString() : "") +
	   	((path)    ? "; path="    + path                  : "") +
	   	((domain)  ? "; domain="  + domain                : "") +
	   	((secure)  ? "; secure"                           : "");

		document.cookie = cookie;
	};

// Cookie format:
//
//   :record1:record2:...
//
// where a record is defined as:
//
//   key,field1,...,fieldN
//
// If "key" is already present in cookie, then replace current record with "newRecordStr".
//
// If "key" is not present in cookie, append "newRecordStr" to cookie.
//
// If cookie doesn't have enough room for new or updated record,
// then remove sufficient initial records in order to be able to append "newRecordStr" to cookie.
//
Common.SetCookieRecord =
	function (cookieName, key, newRecordStr) {	
					
		var cookieValueStr = new String(Common.GetCookie(cookieName));

		if (cookieValueStr.length == 0) {
			return Common.CookieRecordSeparator + 
			       newRecordStr.valueOf() + 
			       Common.CookieRecordSeparator;
		}

		var newCookieValue = "";

		var recordBeginPos = cookieValueStr.indexOf(Common.CookieRecordSeparator + 
		                                            key + 
		                                            Common.CookieFieldSeparator);
		
		if (recordBeginPos == -1) { // Key doesn't already have record in cookie, 
		                            // append this key's record to cookie
		                            
			newCookieValue = cookieValueStr.valueOf() + 
				             newRecordStr.valueOf() + 
				             Common.CookieRecordSeparator;
				                		                            
		} else {                   // Key already has a record in cookie, 
		                           // remove (skip) old instance and append new instance 
		                           
			var recordEndPos = cookieValueStr.indexOf(Common.CookieRecordSeparator, recordBeginPos + 1);
			
			newCookieValue = cookieValueStr.substr(0, recordBeginPos) +		      	            
		                 	 cookieValueStr.substr(recordEndPos) + 
		                 	 newRecordStr.valueOf() + 
		                 	 Common.CookieRecordSeparator;
		}		

		// Determine if need to drop initial records in cookie to make room for new/updated record
		//
		var newCookieValueStr = new String(newCookieValue);
		var sizeDifference    = newCookieValueStr.length - Common.CookieMaxSize;
		
		if (sizeDifference <= 0) {			
			return newCookieValue;
		} 

		var nextRecordBeginPos = 0;
		while ((nextRecordBeginPos < sizeDifference) && (nextRecordBeginPos != -1)) {
			nextRecordBeginPos  = newCookieValueStr.indexOf(Common.CookieRecordSeparator, nextRecordBeginPos + 1);
		}
				
		if (nextRecordBeginPos != - 1) {
			if ((nextRecordBeginPos + 1) == newCookieValueStr.length) {
				return Common.CookieRecordSeparator + 
			           newRecordStr.valueOf() + 
			           Common.CookieRecordSeparator;
			} else {
				return newCookieValueStr.substr(nextRecordBeginPos).valueOf();
			}					
		} else { // this condition should never occur, but add code just in case it does
			return newCookieValue;
		}	       
	}

Common.ShowObject = 
	function ( objId, dispStyle ) { // objId = object or string
	
	    var objToDisp = Common.GetObject( objId );
	    var displayValue = ( dispStyle != undefined )? dispStyle : "block";
		
		if ( objToDisp ) {
			objToDisp.style.display = displayValue;		
		}
	};

Common.GetYPos = 
	function ( obj ) {	
		var srcObj = Common.GetObject( obj );
		var currObj = srcObj;
		
		var ypos = 0;
		while ( currObj.offsetParent ) {
		    ypos += currObj.offsetTop;
		    currObj = currObj.offsetParent;
		}
		return ypos;
	};

Common.AddEventHndlr =
	function( obj, evtType, evtHndlr ) {
		var srcObj = Common.GetObject( obj );	
		if ( srcObj.attachEvent ) {
			srcObj.attachEvent( evtType, evtHndlr );
		}
		if ( srcObj.addEventListener ) {
			srcObj.addEventListener( evtType, evtHndlr, false );
		}
	};
	
// end Common namespace


// begin Form namespace
var Form = {};

Form.CursorAtEnd =      	
	function ( inputId ) {
	    var inputObj = Common.GetObject( inputId );
	    with ( inputObj ) {
	        focus();	  
	        if ( value.length > 0 && value.charAt( value.length-1 ) != ' ' ) {
	            value += '';
	        }	          
	        value = value;
	    }
   	};
	
// end Form namespace

var GlobalNav = {};

GlobalNav.SignOff = 	
	function (form) {
		form.Action.value = "SignOff";
		form.submit();
	};

GlobalNav.ShowSwooshImg =
	function( linkObj ) {
		linkObj.firstChild.style.visibility = "visible";
	};
	
GlobalNav.HideSwooshImg =
	function( linkObj ) {
		linkObj.firstChild.style.visibility = "hidden";	
	};	

GlobalNav.getHelpArgs = 
	function(width,height,center,menu) {
	xposition=0; yposition=0;
	if ((parseInt(navigator.appVersion) >= 4 ) && (center))
	{
		if (center==1)
		{
			xposition = (screen.width - width) / 2;
			yposition = (screen.height - height) / 2;
		}
	}
	args="width="+width+",height="+height+",toolbar="+menu+",menubar="+menu+",screenx="+ xposition+",screeny="+yposition+",left="+xposition+",top="+yposition+",resizable=1,scrollbars=1,";
	return args;
}

GlobalNav.launchHelp = 
	function(helpFile, showFrame, ver) {
	 var center = 1;

	 args=GlobalNav.getHelpArgs(800,600,center,0);
	 if ((parseInt(navigator.appVersion) >= 4 ) && (center))
	 {
	 	if(window.formhelp && !window.formhelp.closed)
	 	{
	 		formhelp.close();
	 	}
	 }
	 local = ver + "?Action=HelpDisplay&helpFile=" + helpFile; 
	formhelp=window.open(local,"LNPHelp",args);

}
	

// begin LNEvent namespace
//* ToDo Add event mapping for Moz and IE *//
// remove Common.AddEventHndlr

var LNEvent = {};

/* void */
LNEvent.AddEventHndlr =
	function( obj, evtType, evtHndlr ) {
	
	    var srcObj = Common.GetObject( obj );
	    
		if ( srcObj.attachEvent ) { //IE
			srcObj.attachEvent( evtType, evtHndlr );
		}
		if ( srcObj.addEventListener ) { //Moz
			srcObj.addEventListener( evtType, evtHndlr, false );
		}
	};
// end LNEvent namespace

// begin PubList namespace
var PubList = {};

PubList.PubListCookieName = "PubListFrame";

PubList.ShowSelectAll = 0;
PubList.ShowClearAll  = 1;
PubList.HideSelectAll = 2;
			
PubList.SetPubListCookie =
	function (state) {	
		
		if (state == "") {
			return;
		}
		
		var expDate = new Date();
		expDate.setYear(expDate.getFullYear() + 1);
		
		var name    = PubList.PubListCookieName;
		var value   = state;	
		var domain  = Common.GetDomain(window.location);
		var path    = Common.CookiePath;
		var secure  = "";
		var expires = expDate;

		Common.SetCookie(name, value, domain, path, secure, expires);
	};

PubList.ResizeFrame = 
	function () {
		var currState = Common.GetCookie(PubList.PubListCookieName);	
		
		//original state is collapsed, so if nothing is returned, assume that
		if (currState == "expanded" || currState == "" || currState == null) {
			PubList.SetPubListCookie("collapsed");
	 		PubList.BuildFrame("collapsed");
		} else {
			PubList.SetPubListCookie("expanded");
			PubList.BuildFrame("expanded");
		}
		var currentTab = document.frmMain.curSelectedTab.value;
		if (currentTab == "") currentTab = "0";
		parent.findLiveHeight(currentTab);

};

//It would be really nice to actually use this to build the page initially
//instead, there is a hardcoded switch in the page depending on the cookie value
//for both TDs
PubList.BuildFrame = 
	function (newState) {
		var midbckgrnd = getElementById_s("rszTD");
		var sImg = getElementById_s("sImg");
		var imgSrc = sImg.src;

		var lft = getElementById_s("pubIntrfceLeft");
		var lftNav = getElementById_s("pubIntrfceLeftTopNav");
		var mddl = getElementById_s("pubIntrfceMiddle");
		var rght = getElementById_s("pubIntrfceRight");	
		//var resCol = getElementById_s("greybckgrndfldright");		
		var annotationSec = getElementById_s("pubIntrfceRightAnnotationSec");
		
		var curTab = document.frmMain.curSelectedTab.value;	
		
		if(curTab==null || curTab.length==0){
			leftnavigation = getElementById_s("div0");
		}else{
			leftnavigation = getElementById_s("div" + curTab);
		}
		
		
		if(newState == "collapsed"){
			lft.style.width = "33%";
			lft.style.height = "59%";
			lftNav.style.marginRight = "5em";
			mddl.style.marginLeft = "33.5%";
			rght.style.marginLeft = "34.5%";
			rght.style.width = "65.3%";
			rght.style.height = "405px";
			//resCol.style.width= "27.1%";
			annotationSec.style.marginLeft= "34.5%";
			annotationSec.style.width = "65.3%";
			//leftnavigation.style.width = "33%";
			
			midbckgrnd.title="Click to Expand";
			
			imgSrc = imgSrc.replace("Nrrw", "Exp");
			sImg.src = imgSrc;
		}
		else{ //expanded
			lft.style.width = "50%";
			lft.style.height = "59%";
			lftNav.style.marginRight = "10em";
			mddl.style.marginLeft = "50.5%";
			rght.style.marginLeft = "51.5%";
			rght.style.width = "48.3%";
			rght.style.height = "405px";
			//resCol.style.width= "44.1%";
			annotationSec.style.marginLeft= "51.5%";
			annotationSec.style.width = "48.3%";
			//leftnavigation.style.width = "50%";
			
			midbckgrnd.title="Click to Narrow";
			
			imgSrc = imgSrc.replace("Exp", "Nrrw");
			sImg.src = imgSrc;
		}
};

// Only returns visible section of cite list for current tab (docs 11-20, eg),
// not entire cite list (docs 1-55, eg)
//
PubList.getCiteListArrayForCurrentTab = 
	function () {
		var docItem = new Array();

		var currentTab = document.frmMain.curSelectedTab.value;
		if (currentTab == "") currentTab = "0";
	
		var tab    = "pubCiteDiv" + currentTab;
		var frmTab = window.frames[tab].document.getElementById('frmTab');
		
		if (frmTab != null) {
			var len = frmTab.elements.length; 

			for (var i = 0; i < len; i++) {	
	  			try {  
					if (frmTab.elements[i].name != "docItem") continue;
					docItem.push(frmTab.elements[i]);
	  			} 		catch (e) {}
	  		}
		}
		
		return docItem;
};

PubList.findPositionInCiteListArray = 
	function (citeListArray, id) {
		for (var i = 0; i < citeListArray.length; i++) {			
	  		try {
				if (id == citeListArray[i].id) {
					return i;
				}		
	  		} catch (e) {}
		}			
		return -1;
};

PubList.scrollDownToDocInCiteList = 
	function (hrefId, frameId) {
	
		// Determines location of <td> element that contains <href id="..."> document link and scrolls to location of that <td>
		//
		var hrefObj = window.frames[frameId].document.getElementById(hrefId);
		if ((hrefObj != null) && (hrefObj != undefined)) {
			var parentObj = hrefObj.offsetParent; //
			if ((parentObj != null) && (parentObj!= undefined)) {
				try { // just in case below command fails, eat error
					window.frames[frameId].scrollTo(parentObj.offsetLeft, parentObj.offsetTop);		
				} catch (e){}			
			}	
		}
};
		
PubList.okayToDisplayLockToAnnotate = 
	function () {

		var currentTab = document.frmMain.curSelectedTab.value;
				
		if (currentTab == null) return false;
		
		if (currentTab == 0) return false; // New Tab
		if (currentTab == 1) return true;  // Staged Tab
		if (currentTab == 2) return true;  // Published Tab	
		if (currentTab == 3) return false; // Deleted Tab
		
		return false;
}
	
PubList.changeCiteListNavigationRangeDisplay = 
	function (startPos, endPos) {
		var citeListNavRange = getElementById_s("citeListNavigationRange");						
		if (citeListNavRange != null) {		
			citeListNavRange.innerHTML = "<strong>" + startPos + "</strong> to									 <strong>" + endPos + "</strong>";
		}
};
	
PubList.changeCiteListNavigationRange = 
	function () {
				
		var endPos         = 0;
		var startPos       = Number(document.frmMain.startPos.value);
		var size           = Number(document.frmMain.size.value);
		var resultsPerPage = Number(document.frmMain.resultsPerPage.value);

		if (size > 0) {

			if ((startPos + resultsPerPage) > size) {
				endPos = size;
			} else {
				endPos = (startPos + resultsPerPage) - 1;
			}
						
			if (startPos == 1) {
				PubList.changeCiteListNavigationDisabledStatus("true", "prev");
			} else {
				PubList.changeCiteListNavigationDisabledStatus("false", "prev");
			}
			
			if (endPos == size) {
				PubList.changeCiteListNavigationDisabledStatus("true", "next");
			} else {
				PubList.changeCiteListNavigationDisabledStatus("false", "next");
			}
						
		} else {
		
			startPos = 0;
			endPos   = 0; 
			
			PubList.changeCiteListNavigationDisabledStatus("true", "both");
		}

		PubList.changeCiteListNavigationRangeDisplay(startPos, endPos);			
};

PubList.changeCiteListNavigationPreviousIcon =
	function (status) {
		var citeListPrevIcon = getElementById_s("citeListPrevIcon");

		if (citeListPrevIcon != null) {
			if (status == "disabled") { 
				citeListPrevIcon.src = 'images/xx/ButArrowPrvSmllGryd.gif';
			} else {
				citeListPrevIcon.src = 'images/xx/ButArrowPrvSmll.gif';
			}
		}
};

PubList.changeCiteListNavigationNextIcon =
	function (status) {
		var citeListNextIcon = getElementById_s("citeListNextIcon");

		if (citeListNextIcon != null) {
			if (status == "disabled") {
				citeListNextIcon.src = 'images/xx/ButArrowNxtSmllGryd.gif';
			} else {
				citeListNextIcon.src = 'images/xx/ButArrowNxtSmll.gif';;
			}
		}
};

PubList.changeCiteListNavigationIcons =
	function (status, direction) {
	    if ((direction == "prev") || (direction == "both")) {
		   PubList.changeCiteListNavigationPreviousIcon(status);
		}
	    if ((direction == "next") || (direction == "both")) {
		   PubList.changeCiteListNavigationNextIcon(status);
		}
};

PubList.changeCiteListNavigationDisabledStatus =
	function (status, direction) {
	
	    if ((direction == "prev") || (direction == "both")) {
		    document.frmMain.isPrevCiteListNavigationDisabled.value = status;		
	    }	
	    if ((direction == "next") || (direction == "both")) {
		    document.frmMain.isNextCiteListNavigationDisabled.value = status;		
	    }	
	    
		if (status == "true") {
			PubList.changeCiteListNavigationIcons("disabled", direction);
		} else {
			PubList.changeCiteListNavigationIcons("enabled", direction);		
		}
};

PubList.changeDocNavigationRangeDisplay = 
	function (currentDocNum) {
		var docNavRange = getElementById_s("docNavigationRange");	
		if (docNavRange != null) {	
			docNavRange.innerHTML = currentDocNum + " of " + document.frmMain.size.value; 		   
		}
};
			
PubList.changeDocNavigationRange = 
	function () {
		
		var citeListArray = PubList.getCiteListArrayForCurrentTab();		
		var pos           = PubList.findPositionInCiteListArray(citeListArray, document.frmMain.currentDoc.value);
		var size          = Number(document.frmMain.size.value);

		if (size == 0) {
		
			PubList.changeDocNavigationRangeDisplay(0);	
			PubList.changeDocNavigationDisabledStatus("true", "both");
		} else if (pos < 0) { // document no longer present on current section of displayed cite list
		
			PubList.changeDocNavigationRangeDisplay("?");	
			PubList.changeDocNavigationDisabledStatus("true", "both");
			
		} else { // (pos >= 0) 
		
		
			var currentDocNum = Number(document.frmMain.startPos.value) + Number(pos);
			PubList.changeDocNavigationRangeDisplay(currentDocNum);	

			var docLocked = checkForLock("no");
			if (!docLocked) { // only change status if document is NOT locked
					
				if (currentDocNum == 1) {
					PubList.changeDocNavigationDisabledStatus("true", "prev");
				} else {
					PubList.changeDocNavigationDisabledStatus("false", "prev");
				}				
				
				if (currentDocNum == size) {
					PubList.changeDocNavigationDisabledStatus("true", "next");
				} else {
					PubList.changeDocNavigationDisabledStatus("false", "next");
				}
				
			}
		}
};

PubList.changeDocNavigationPreviousIcon =
	function (status) {
		var docPrevIcon = getElementById_s("docPrevIcon");

		if (docPrevIcon != null) {
			if (status == "disabled") {
				docPrevIcon.src = 'images/xx/ButArrowPrvSmllGryd.gif';
			} else {
				docPrevIcon.src = 'images/xx/ButArrowPrvSmll.gif';
			}
		}
};

PubList.changeDocNavigationNextIcon =
	function (status) {
		var docNextIcon = getElementById_s("docNextIcon");

		if (docNextIcon != null) {
			if (status == "disabled") {
				docNextIcon.src = 'images/xx/ButArrowNxtSmllGryd.gif';
			} else {
				docNextIcon.src = 'images/xx/ButArrowNxtSmll.gif';;
			}
		}
};

PubList.changeDocNavigationIcons =
	function (status, direction) {
	    if ((direction == "prev") || (direction == "both")) {
		   PubList.changeDocNavigationPreviousIcon(status);
		}
	    if ((direction == "next") || (direction == "both")) {
		   PubList.changeDocNavigationNextIcon(status);
		}
};

PubList.changeDocNavigationDisabledStatus =
	function (status, direction) {
	
	    if ((direction == "prev") || (direction == "both")) {
		    document.frmMain.isPrevDocNavigationDisabled.value = status;		
	    }	
	    if ((direction == "next") || (direction == "both")) {
		    document.frmMain.isNextDocNavigationDisabled.value = status;		
	    }	
	    
		if (status == "true") {
			PubList.changeDocNavigationIcons("disabled", direction);
		} else {
			PubList.changeDocNavigationIcons("enabled", direction);		
		}
};
			
PubList.changeDocNavigationDisplay = 
	function (visibility) {
	
		var docNavPrev  = getElementById_s("docNavigationPrev");
		var docNavRange = getElementById_s("docNavigationRange");
		var docNavNext  = getElementById_s("docNavigationNext");
						
		if (docNavPrev != null) {
			docNavPrev.style.visibility  = visibility;
		}
		if (docNavRange != null) {
			docNavRange.style.visibility = visibility;
			if (visibility == "visible") PubList.changeDocNavigationRange();			
		}
		if (docNavNext != null) {
			docNavNext.style.visibility  = visibility;
		}
};

PubList.isViewInFullDocumentMode = 
	function () {
	
		var resultFormat = document.getElementById("resultFormat");
		
		if (resultFormat == null) {
			return false;
	 	} else if (resultFormat[resultFormat.selectedIndex].value == 2) { // View option is Full Document 
	 		return true;
	 	} else {
	 		return false;
	 	}	
};

PubList.isViewInListMode = 
	function () {
	
		var resultFormat = document.getElementById("resultFormat");
		
		if (resultFormat == null) {
			return false;
	 	} else if ((resultFormat[resultFormat.selectedIndex].value == 0) ||  // View option is List 
	 	           (resultFormat[resultFormat.selectedIndex].value == 1))    // View optoin is List With Hits
	 	{
	 		return true;
	 	} else {
	 		return false;
	 	}	
};

PubList.isViewInSplitMode = 
	function () {
	
		var resultFormat = document.getElementById("resultFormat");
		
		if (resultFormat == null) {
			return false;
	 	} else if ((resultFormat[resultFormat.selectedIndex].value == 3) ||  // View option is Split
	 	           (resultFormat[resultFormat.selectedIndex].value == 4))    // View optoin is Split With Hits
	 	{
	 		return true;
	 	} else {
	 		return false;
	 	}	
};

PubList.changeInterfaceDisplay = 
	function (dispOption) {

	var rf = document.getElementById("curResultFormat");	
	if (checkForLock("yes")) {
		document.getElementById("resultFormat")[rf.value].selected="true";
		return false;
	}

	var rf = document.getElementById("curResultFormat");
	if (rf.value != "" && rf.value == dispOption) return false;

	rf.value = dispOption;
		
	var expColState = Common.GetCookie(PubList.PubListCookieName);
	var lft = getElementById_s("pubIntrfceLeft");
	var lftNav = getElementById_s("pubIntrfceLeftTopNav");
	var rght = getElementById_s("pubIntrfceRight");
	var mddl = getElementById_s("pubIntrfceMiddle");
	var midbckgrnd = getElementById_s("rszTD");
	var greybckgrndleft = getElementById_s("greybckgrndfldleft");
	var greybckgrndcenter = getElementById_s("greybckgrndfldcenter");
	var greybckgrndrght = getElementById_s("greybckgrndfldright");
	var hitsSec = getElementById_s("hitsDivSec");	
	var annotationSec = getElementById_s("pubIntrfceRightAnnotationSec");
	var docInfoSec  = getElementById_s("docInfoString");
	var docInfoLink  = getElementById_s("linkDocInfoString");
	var lockToAnnotLink = getElementById_s("linkLockToAnnot ");
	var sImg = getElementById_s("sImg");
	var imgSrc = "";
	
	if(sImg!=null){
		imgSrc = sImg.src;
	}

	var fullDoc = getElementById_s("pubDocDiv");
	var frmMain = document.frmMain;
	var leftnavigation;
	var curTab = 0;
	if(frmMain!=null){ 
		curTab = frmMain.curSelectedTab.value;	
	}
	if(curTab==null || curTab.length==0){
		curTab=0;
		leftnavigation = getElementById_s("div0");
	}else{
		leftnavigation = getElementById_s("div" + curTab);
	}

	if (docInfoSec != null) {
		docInfoSec.style.padding = "5px 5px 5px 0";
	}

	for (i = 0; i < 4; i++) {
		if(i!=curTab){
			document.getElementById("unCheckAll" + i).style.display = "none";	
			document.getElementById("unCheckAll" + i).style.visibility = "hidden";	
			document.getElementById("checkAll" + i).style.display = "none";
			document.getElementById("checkAll" + i).style.visibility = "hidden";		
		}
	}

	if (lockToAnnotLink != null) {
		if ((curTab == 1 || curTab==2) && dispOption > 1) {
			lockToAnnotLink .style.display = "inline";					
			if (checkForLock("no")) {
				lockToAnnotLink .style.display = "none";
			}
		} else {
			lockToAnnotLink .style.display = "none";						
		}
	}

	if(dispOption==2){//Full Doc
		document.getElementById("checkAll" + curTab).style.display = "none";
		document.getElementById("unCheckAll" + curTab).style.display = "none";
		document.getElementById('chkFullDoc').style.display = "inline";		
	} else {
		document.getElementById("checkAll" + curTab).style.display = "";
		document.getElementById("unCheckAll" + curTab).style.display = "";
		document.getElementById('chkFullDoc').style.display = "none";	
	}

	PubList.changeCiteListNavigationDisabledStatus("true", "both");

	if (dispOption==0) { //List
	
		document.getElementById("isUpdatingListView").value = "true";
	
		PubList.changeDocNavigationDisplay("hidden");

		if(lft!=null){
			lft.style.width = "99%";
			lft.style.visibility="visible";
		}
		if(lftNav!=null){
			lftNav.style.marginRight = "25em";
		}
		if(mddl!=null){
			mddl.style.visibility="hidden";
		}
		if(rght!=null){
			rght.style.visibility="hidden";
		}
		if(greybckgrndrght!=null){
			greybckgrndrght.style.width = "93.1%";
			greybckgrndrght.style.visibility="visible";			
		}
		if(greybckgrndleft!=null){
			greybckgrndleft.style.visibility="visible";
		}
		if(greybckgrndcenter!=null){
			greybckgrndcenter.style.visibility="visible";
		}
		if(hitsSec!=null){
			hitsSec.style.display = "none";
		}
		if(fullDoc!=null){
			fullDoc.style.visibility = "hidden";
		}
		if(annotationSec!=null){
			annotationSec.style.visibility = "hidden";
		}
		if(leftnavigation!=null){
			leftnavigation.style.visibility="visible";
			//leftnavigation.style.width = "99%";
		}
		if (docInfoLink != null) { 
			docInfoLink.style.visibility = "hidden";
		}		

		reloadCiteList('false');
		
	} else if (dispOption==1) { //List with Hits
		
		document.getElementById("isUpdatingListView").value = "true";
		
		PubList.changeDocNavigationDisplay("hidden");

		if(lft!=null){
			lft.style.width = "99%";
			lft.style.visibility="visible";
		}
		if(lftNav!=null){
			lftNav.style.marginRight = "25em";
		}
		if(mddl!=null){
			mddl.style.visibility="hidden";
		}
		if(rght!=null){
			rght.style.visibility="hidden";
		}
		if(greybckgrndrght!=null){
			greybckgrndrght.style.width = "93.1%";
			greybckgrndrght.style.visibility="visible";
		}
		if(greybckgrndleft!=null){
			greybckgrndleft.style.visibility="visible";
		}
		if(greybckgrndcenter!=null){
			greybckgrndcenter.style.visibility="visible";
		}
		if(hitsSec!=null){
			hitsSec.style.display = "none";
		}
		if(fullDoc!=null){
			fullDoc.style.visibility = "hidden";
		}
		if(annotationSec!=null){
			annotationSec.style.visibility = "hidden";
		}
		if(leftnavigation!=null){
			leftnavigation.style.visibility="visible";
			//leftnavigation.style.width = "99%";
		}
		if (docInfoLink != null) { 
			docInfoLink.style.visibility = "hidden";
		}		
		
		reloadCiteList('true');
		
	} else if (dispOption==2) { //Full Doc

		PubList.changeDocNavigationDisplay("visible");

		var docCount = getElementById_s("PublishedCount" + curTab);

		if(lft!=null){
			lft.style.visibility="hidden";
		}
		if(mddl!=null){
			mddl.style.visibility="hidden";
		}
		if(rght!=null){
			rght.style.visibility="visible";		
			rght.style.width = "99.3%";
			rght.style.marginLeft = "5px";
			rght.style.height = "405px";
		}
		if(greybckgrndrght!=null){
			greybckgrndrght.style.visibility="hidden";
		}
		if(greybckgrndleft!=null){
			greybckgrndleft.style.visibility="hidden";
		}
		if(greybckgrndcenter!=null){
			greybckgrndcenter.style.visibility="hidden";
		}
		if(hitsSec!=null){
			hitsSec.style.display = "inline";
		}
		if(fullDoc!=null){
			fullDoc.style.visibility = "visible";
		}
		if(annotationSec!=null){
			annotationSec.style.visibility = "visible";
			annotationSec.style.marginLeft = "5px";
			annotationSec.style.width = "99.4%";
		}
		if(leftnavigation!=null){
			leftnavigation.style.visibility="hidden";
		}
		if(docInfoSec!=null){
			docInfoSec.style.padding="0 5px 0 0";
		}
		if (docInfoLink != null) { 
			if (curTab == 2) { // only Published tab shows the Document Properties link
				if (document.frmMain.size.value == 0) { // don't show if no docs on Published tab
					docInfoLink.style.visibility = "hidden";
				} else {
					docInfoLink.style.visibility = "visible";
				}
				docInfoLink.style.bottom = "2px";
			}
		}
		if (lockToAnnotLink != null) { 
			if ((curTab == 1) || (curTab == 2)) { // only Staged and Published tabs shows the Lock to Annotate link
				if (document.frmMain.size.value == 0) { // don't show if no docs on Published tab				                     
					lockToAnnotLink.style.visibility = "hidden";
				} else {
					lockToAnnotLink.style.visibility = "visible";
				}
			}
		}	
		
		if (document.frmMain.size.value == 0) document.getElementById("chkFullDoc").checked = false;
			
		// Only ever need to load the cite list when displaying a full document
		// when an editor first goes to the Pub UI page and his default view is Full Document
		//
		if (frmMain.initialAccess.value == "1") {	
			reloadCiteList('false');
		}
				
	} else if(dispOption==3){ //Split
	
		PubList.changeDocNavigationDisplay("hidden");

		if(lft!=null){
			lft.style.visibility="visible";
		}
		if(mddl!=null){
			mddl.style.visibility="visible";
		}
		if(rght!=null){
			rght.style.visibility="visible";
		}
		if(greybckgrndrght!=null){
			greybckgrndrght.style.visibility="visible";
		}
		if(greybckgrndleft!=null){
			greybckgrndleft.style.visibility="visible";
		}
		if(greybckgrndcenter!=null){
			greybckgrndcenter.style.visibility="visible";
		}
		if(annotationSec!=null){
			annotationSec.style.visibility = "hidden";

			document.getElementById("divTB").style.display = "";
			document.getElementById("divTB").className="divTB";
			document.getElementById("toolDivParent").className="toolDivParent";		
			
		}
		if(leftnavigation!=null){
			leftnavigation.style.visibility="visible";
		}
		if(expColState=="collapsed"){
			if(lft!=null){
				lft.style.width = "33%";
			}
			if(lftNav!=null){
				lftNav.style.marginRight = "5em";
			}
			if(mddl!=null){
				mddl.style.marginLeft = "33.5%";
			}
			if(rght!=null){
				rght.style.marginLeft = "34.5%";
				rght.style.marginTop = "0px";
				rght.style.marginBottom = "10px";
				rght.style.marginRight = "10px";
				rght.style.width = "65.3%";
				rght.style.height = "405px";
			}
			if(greybckgrndrght!=null){
				greybckgrndrght.style.width= "27.1%";
			}
			if(annotationSec!=null){
				annotationSec.style.marginLeft= "34.5%";
				annotationSec.style.width = "65.3%";
			}
			if(leftnavigation!=null){
				//leftnavigation.style.width = "33%";
			}
			if(midbckgrnd!=null){
				midbckgrnd.title="Click to Expand";
			}
			
			if(sImg!=null){
				imgSrc = imgSrc.replace("Nrrw", "Exp");
				sImg.src = imgSrc;
			}
		}
		else{ //expanded
			if(lft!=null){
				lft.style.width = "50%";
			}
			if(lftNav!=null){
				lftNav.style.marginRight = "10em";
			}
			if(mddl!=null){
				mddl.style.marginLeft = "50.5%";
			}
			if(rght!=null){
				rght.style.marginLeft = "51.5%";
				rght.style.width = "48.3%";
				rght.style.marginTop = "0px";
				rght.style.marginBottom = "10px";
				rght.style.marginRight = "10px";
				rght.style.height = "405px";
			}
			if(greybckgrndrght!=null){
				greybckgrndrght.style.width= "44.1%";
			}
			if(annotationSec!=null){
				annotationSec.style.marginLeft= "51.5%";
				annotationSec.style.width = "48.3%";
			}
			if(leftnavigation!=null){
				//leftnavigation.style.width = "50%";
			}
		
			if(midbckgrnd!=null){						
				midbckgrnd.title="Click to Narrow";
			}
			
			if(sImg!=null){
				imgSrc = imgSrc.replace("Exp", "Nrrw");
				sImg.src = imgSrc;
			}
		}
		if (checkForLock("no")) {
			document.getElementById('pubIntrfceRight').style.height='34.5%';
			document.getElementById('pubIntrfceRight').style.marginTop="200px";
		}

		reloadCiteList('false');

		if(fullDoc!=null){
			fullDoc.style.visibility="visible";
			fullDoc.src = "lnpWaitMsg.jsp";			
		}
		if(hitsSec!=null){
			hitsSec.style.display = "inline";
		}
		if (docInfoLink != null) { 
			if (curTab == 2) { // only Published tab shows the Document Properties link
				docInfoLink.style.visibility = "visible";
				docInfoLink.style.bottom = "0px";
			}
		}
	} else if(dispOption==4){ //Split with Hits

		PubList.changeDocNavigationDisplay("hidden");

		if(lft!=null){
			lft.style.visibility="visible";
		}		
		if(mddl!=null){
			mddl.style.visibility="visible";
		}
		if(rght!=null){
			rght.style.visibility="visible";
		}
		if(greybckgrndrght!=null){
			greybckgrndrght.style.visibility="visible";
		}
		if(greybckgrndleft!=null){
			greybckgrndleft.style.visibility="visible";
		}
		if(greybckgrndcenter!=null){
			greybckgrndcenter.style.visibility="visible";
		}
		if(annotationSec!=null){
			annotationSec.style.visibility = "hidden"; 
			document.getElementById("divTB").style.display = "";
			document.getElementById("divTB").className="divTB";
			document.getElementById("toolDivParent").className="toolDivParent";		
			
		}
		if(leftnavigation!=null){
			leftnavigation.style.visibility="visible";
		}
	
		if(expColState=="collapsed"){
			if(lft!=null){
				lft.style.width = "33%";
			}
			if(lftNav!=null){
				lftNav.style.marginRight = "5em";
			}	
			if(mddl!=null){
				mddl.style.marginLeft = "33.5%";
			}
			if(rght!=null){
				rght.style.marginLeft = "34.5%";
				rght.style.marginTop = "0px";
				rght.style.marginBottom = "10px";
				rght.style.marginRight = "10px";
				rght.style.width = "65.3%";
				rght.style.height = "405px";				
			}
			if(greybckgrndrght!=null){
				greybckgrndrght.style.width= "27.1%";
			}
			if(annotationSec!=null){
				annotationSec.style.marginLeft= "34.5%";
				annotationSec.style.width = "65.3%";
			}
			if(leftnavigation!=null){
				//leftnavigation.style.width = "33%";
			}
			if(midbckgrnd!=null){
				midbckgrnd.title="Click to Expand";
			}
			if(sImg!=null){
				imgSrc = imgSrc.replace("Nrrw", "Exp");
				sImg.src = imgSrc;
			}
		}
		else{ //expanded
			if(lft!=null){
				lft.style.width = "50%";
			}
			if(lftNav!=null){
				lftNav.style.marginRight = "10em";
			}
			if(mddl!=null){
				mddl.style.marginLeft = "50.5%";
			}
			if(rght!=null){
				rght.style.marginLeft = "51.5%";
				rght.style.marginTop = "0px";
				rght.style.marginBottom = "10px";
				rght.style.marginRight = "10px";
				rght.style.width = "48.3%";
				rght.style.height = "405px";
			}
			if(greybckgrndrght!=null){
				greybckgrndrght.style.width= "44.1%";
			}
			if(annotationSec!=null){
				annotationSec.style.marginLeft= "51.5%";
				annotationSec.style.width = "48.3%";
			}
			if(leftnavigation!=null){
				//leftnavigation.style.width = "50%";
			}
			if(midbckgrnd!=null){			
				midbckgrnd.title="Click to Narrow";
			}
			if(sImg!=null){
				imgSrc = imgSrc.replace("Exp", "Nrrw");
				sImg.src = imgSrc;
			}
		}
		if (checkForLock("no")) {
			document.getElementById('pubIntrfceRight').style.height='34.5%';
			document.getElementById('pubIntrfceRight').style.marginTop="200px";
		}

		reloadCiteList('true');

		if(hitsSec!=null){
			hitsSec.style.display = "inline";
		}
		if(fullDoc!=null){
			fullDoc.style.visibility="visible";
			fullDoc.src = "lnpWaitMsg.jsp"; 
		}
		if (docInfoLink != null) { 
			if (curTab == 2) { // only Published tab shows the Document Properties link
				docInfoLink.style.visibility = "visible";
				docInfoLink.style.bottom = "0px";
			}
		}		
	}
	findLiveHeight(0);
};

function getElementById_s(id){ 
    var obj = null; 
    if(document.getElementById){ 
        /* Prefer the widely supported W3C DOM method, if 
           available:- 
        */ 
        obj = document.getElementById(id); 
    }else if(document.all){ 
        /* Branch to use document.all on document.all only 
           browsers. Requires that IDs are unique to the page 
           and do not coincide with NAME attributes on other 
           elements:- 
        */ 
        obj = document.all[id]; 
    } 
    /* If no appropriate element retrieval mechanism exists on 
       this browser this function always returns null:- 
    */ 
    return obj; 
};


//end PubList namespace

//BEGIN common functions
	function addActivateApply(){
		var f = document.getElementById("frmMain");
		var elem = f.elements; 
		var flength = elem.length; 
		var i = 0; 
	
		for (i=0; i <= flength; i++) {
			
			if (elem[i]){
				if (elem[i].type == "text" || elem[i].type == "textarea") {
					addEvent(elem[i],'keypress',activateApply);
					addEvent(elem[i],'paste',activateApply);
					addEvent(elem[i],'cut',activateApply);
					addEvent(elem[i],'keyup',activateApplyTextArea);
					addEvent(elem[i],'input',activateApply);
				}else if (elem[i].type == "radio") {
					addEvent(elem[i],'click',activateApply);
				}else if (elem[i].type == "checkbox") {
					addEvent(elem[i],'click',activateApply);
				}else if (elem[i].type == "select-one" || elem[i].type == "select-multiple") {
					addEvent(elem[i],'change',activateApply);
				}
			}
		}			
	}

	function addEvent(obj, evType, fn){ 
	 if (obj.addEventListener){ 
	   obj.addEventListener(evType, fn, false); 
	   return true; 
	 } else if (obj.attachEvent){ 
	   var r = obj.attachEvent("on"+evType, fn); 
	   return r; 
	 } else { 
	   return false; 
	 } 
	}

	function activateApply(){
		var applyObj = document.getElementById("applyButton");
		applyObj.src='images/en/ButMainApply.gif';
		applyObj.title='Apply';
		document.getElementById("applyChange").value="true";		
	}
	
	function activateApplyTextArea(){
		if (event.keyCode != 17 && event.keyCode != 67 && event.keyCode != 9){
			var applyObj = document.getElementById("applyButton");
			applyObj.src='images/en/ButMainApply.gif';
			applyObj.title='Apply';
			document.getElementById("applyChange").value="true";
		}
	}
	
	
	
	function deactivateApply(){
		var applyObj = document.getElementById("applyButton");
		applyObj.src='images/en/ButMainApplyGrayed.gif';
		applyObj.title='Apply Inactive';		
		document.getElementById("applyChange").value="";
	}
	
	function doAjaxXml(strURL, strResultFunc, strSubmit){
		if (window.XMLHttpRequest) {
			xmlHttpReq = new XMLHttpRequest();
		} else if (window.ActiveXObject){
			xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
		}	
		var queryParams;
		var requestType;
		var postFlag;
		if (strSubmit == null || strSubmit == '') {//GET 
			queryParams = null;
			requestType = 'GET';
			postFlag = false;
		}else {//POST
			queryParams = strSubmit;
			requestType = 'POST';
			postFlag = true;
		}
		xmlHttpReq.open(requestType, strURL, postFlag);
		
        xmlHttpReq.setRequestHeader('Content-Type', 
		     'application/x-www-form-urlencoded');
        xmlHttpReq.onreadystatechange = function() {
            if (xmlHttpReq.readyState == 4) {
        		//determine if an error occurred
        		xmlDoc = xmlHttpReq.responseXML;
				var errors = xmlDoc.getElementsByTagName('error');
        		if(errors.length > 0){
        			handleAjaxErrors(errors);
        		}
        		else if ((strResultFunc != null) && (xmlHttpReq.responseText != null) && (xmlHttpReq.responseText != "")) {  
                	//no errors, pass response to handler
                	eval(strResultFunc + '(xmlHttpReq);');
        		}
            }
        }
        xmlHttpReq.send(queryParams);			
	}
	function doAjax(strURL, strResultFunc, strSubmit){
		if (window.XMLHttpRequest) {
			xmlHttpReq = new XMLHttpRequest();
		} else if (window.ActiveXObject){
			xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
		}	
		var queryParams;
		var requestType;
		var postFlag;
		if (strSubmit == null || strSubmit == '') {//GET 
			queryParams = null;
			requestType = 'GET';
			postFlag = true;
		}else {//POST
			queryParams = strSubmit;
			requestType = 'POST';
			postFlag = true;
		}
		xmlHttpReq.open(requestType, strURL, postFlag);
		
        xmlHttpReq.setRequestHeader('Content-Type', 
		     'application/x-www-form-urlencoded');
		    
        xmlHttpReq.onreadystatechange = function() {
                if ((xmlHttpReq.readyState == 4) && (strResultFunc != null) && (xmlHttpReq.responseText != null) && (xmlHttpReq.responseText != "")) {                
                        eval(strResultFunc + '(xmlHttpReq.responseText);');
                } 
        }
        xmlHttpReq.send(queryParams);			
	}
	
	function getNodeValue(obj,tag)
	{
		return obj.getElementsByTagName(tag)[0].firstChild.nodeValue;
	}
	
	/*
	 * Chain together any special error handling in this function.  
	*/
	function handleAjaxErrors(errs){
		for (var i=0;i<errs.length;i++)
		{
			var id = getNodeValue(errs[i],'id');
			if (id == 'INVALID_SESSION'){
				var redirTo = getNodeValue(errs[i],'redirect');
				window.location.href = redirTo;
				break;
			}
		}
	}
//END common functions
-->
