var iframearray = new Array(100);
var iframectr = 0;
var ViewTreeLoaded = false;
var ViewTreeLoaded2 = false;
var popupWin;
var randnum = Math.round((Math.random()*10000)+1);
var ECMNavigators = new Array(100);
var ECMNavigatorctr = 0;
var keywindow = null;
var key2window = null;
var keyloaded = false;
var key2loaded = false;
var settype = 'Y';
var dragObj = new Object();
dragObj.zIndex = 0;
var moveHereCollection = new Array;
var InstCollection = new Array;
var currentPortlet = '';
var ReloadPath = '';
var clonedPortlet = '';
var placeHereObj = '';
var currentObjHeight = '';
var currentPortletObj = '';
var hiddenPortlets = new Array;
var trackdown = -1;
var selectedObj;
var saveselect;
var ff_event;
var authrrn = 0;

xl_AttachEvent(document, "click", xl_FFEventhandler);
xl_AttachEvent(document, "keydown", xl_FFEventhandler);

function xl_FFEventhandler(e)
{ 
	if(!document.ff_event) document.ff_event = null; 
	ff_event = xl_GetEvent(e); 
}

/* Poller functions */ 
function PadDigits(n, totalDigits) 
{ 
	n = n.toString(); 
	var pd = ''; 
	if (totalDigits > n.length) 
	{ 
		for (i=0; i < (totalDigits-n.length); i++) 
		{ 
			pd += '0'; 
		} 
	} 
	return pd + n.toString(); 
} 


function altrows()
{
	for(i = 0; i < rows.length; i++)
	{           
		if(i % 2 == 0)
		{ 
			rows[i].className = "even"; 
		}
		else
		{ 
			rows[i].className = "odd"; 
		}       
	} 
}

function hiderow(action) 
{ 
	var hdone = false;
	var rrn = 0; 
	for (i = 1; i < rows.length; i++) 
	{
		if (rows[i].className == "hilite")  
		{ 	 				  
			for (x= i-1; x > 0; x--) 
			{ 
				if (rows[x].className != "hideme")
				{ 
					hilite(rows[x]);
					rrn = rows[i].rrn; 
					hdone = true;
					break;
				}
			}
			
			if (hdone == false) 
			{ 
				for (x =i+1; x < rows.length; x++)
				{ 
					if (rows[x].className != "hideme")
					{ 
						hilite(rows[x]);
						hdone = true;
						break;
					}
				}
			}
			
			rrn = rows[i].rrn; 
			
			if (action == 'S') 
			{ 
				randnum = (Math.round((Math.random()*9)+1));
				var myurl ="nxupoll.pgm?task=snooze&rrn=" + rrn + "&rand="+randnum; 
				myurl += "&snoozeval="+document.snoozeform.timeval.value; 
				myurl += "&snoozeunit="+document.snoozeform.timeunit.value; 
				mydiv = "not_used";  
				xl_AjaxUpdate(myurl, mydiv); 
			} 
			else if (action == 'D')
			{
				randnum = (Math.round((Math.random()*9)+1));
				var myurl ="nxupoll.pgm?task=dismiss&rrn=" + rrn + "&rand="+randnum; 
				mydiv = "not_used"; 
				xl_AjaxUpdate(myurl, mydiv); 				
				
			} 	
			rows[i].className="hideme"; 
			break; 
		}
	}
	if (hdone == false)  self.close();  
}


function hilite(myrow)
{ 
	if (prevrow && prevrow.className != "hideme")  
		prevrow.className = prevclass;  
	
	actrow = myrow; 
	prevrow = myrow;
	prevclass = xl_GetObj(myrow).className; 
	xl_GetObj(myrow).className = "hilite";
	
	mydiv ="dv" + (myrow.rowIndex -1); 
	xl_GetObj("currem").innerHTML = xl_GetObj(mydiv).innerHTML; 
}

function dismissall() 
{ 
	randnum = (Math.round((Math.random()*9)+1));
	var myurl ="nxupoll.pgm?task=dismissall&rand="+randnum; 
	mydiv = "not_used";  
	xl_AjaxUpdate(myurl, mydiv); 
	self.close();  
}

function ShutdwnReminder() 
{ 
	randnum = (Math.round((Math.random()*9)+1));
	var myurl ="nxupoll.pgm?task=snoozeall&rand="+randnum; 
	mydiv = "not_used";  
	xl_AjaxUpdate(myurl, mydiv); 
}

function SetupReminder() 
{
	if (!document.getElementsByTagName || !document.createTextNode) 
		return;
	
	rows = document.getElementById('remindtable').getElementsByTagName('tbody')[0].getElementsByTagName('tr');
	for (i = 0; i < rows.length; i++) 
	{
		rows[i].onmouseup = function() 
		{
			hilite(this); 
		}
	}
	hilite(rows[rows.length -1]); 
}


/* Group Functions */
function GroupDetVal(mvgrpfail, namefail, addnamefail)
{
	if (mvgrpfail == 'Y')
	{
		xl_GetObj('prntgrp').className = 'error';
		
		if (xl_GetObj('group').value == xl_GetObj('movetogroup').options[xl_GetObj('movetogroup').selectedIndex].value)
			alert('You cannot move a group into itself');
		else
			alert('Error: You cannot move a group into one of its child groups');
	}
	
	if (addnamefail == 'Y')
	{
		xl_GetObj('crtgroup').className = 'error';
		alert('Error: You cannot have duplicate subgroup names.');
	}
	else if (namefail == 'Y')
	{
		xl_GetObj('grpname').className = 'error';
		alert('Error: You cannot have duplicate subgroup names.');
	}
	
}


function moveGroup()
{
	xl_GetObj('applybtn').value = "Apply and Move";
}

function chgManager(rrn, manger)
{
	var randnum = Math.round((Math.random()*10000)+1)
	
	if (manger == false)
		manger = "N";
	else
		manger = "Y";
	
	url = "nxgrpmng.pgm?task=chgmanager&rnd=" + randnum + "&manager=" + manger + "&group=" + document.inpform.group.value + "&rrn=" + rrn;
	var mydiv
	xl_AjaxUpdate(url, mydiv);
}

function clearGroupform()
{
	formfilt.filter1.value = "";
	formfilt.filter4.value = "";
	formfilt.filtera.value = "";
	formfilt.submit();
}


function grouppage(page)
{	
	xl_GetObj('pagedsp1').style.display = "none";
	xl_GetObj('pagedsp2').style.display = "none";
	xl_GetObj('pagedsp3').style.display = "none";
	
	xl_GetObj('pg1').className = "tab";
	xl_GetObj('pg2').className = "tab";
	xl_GetObj('pg3').className = "tab";
	
	if (page == 1)
	{
		xl_GetObj('pagedsp1').style.display = "";
		var grpifr = parent.xl_GetObj('groupifr');
		
		if (document.body.scrollHeight > 500)
			grpifr.height = document.body.scrollHeight + 20;
		
		parent.PageNumber = 1;
		xl_GetObj('pg1').className = "tabsel";
	}	
	else if (page == 2)
	{
		xl_GetObj('dyniframe1').src = 'nxgrpmng.pgm?task=memberlist&group=' + document.inpform.group.value + '&rnd' + Math.round((Math.random()*10000)+1);
		parent.PageNumber = 2;
		xl_GetObj('pg2').className = "tabsel";
	}	
	else if (page == 3)
	{
		xl_GetObj('pagedsp3').style.display = "";
		parent.PageNumber = 3;
		xl_GetObj('pg3').className = "tabsel";
	}
	
	
}

function SizePage(page)
{
	var ifr = xl_GetObj(page);
	var grpifr = parent.xl_GetObj('groupifr');
	
	
	var contentHeight = ifr.contentWindow.document.body.scrollHeight;
	if (contentHeight > 500)
	{
		ifr.height = contentHeight;
		//grpifr.height = contentHeight + 80;
	}
}


function grouplist(task, userno, group) 
{ 
	if (xl_GetObj('content'))
	{
		if ((group == '') || (group == 0))
		{
			xl_GetObj('content').innerHTML = '&nbsp; Use the tree on the left to maintain your Groups...'; 
			return;
		}
		else
			xl_GetObj('content').innerHTML = '';
	}
	
	if (task == 'gotogroup')
	{
		var url = 'nxgrpmng.pgm?group=' + group + "&rand=" +  randnum;
		top.location.href = url;
	}
	else if (task == 'delgroup')
	{
		
		if (group == 1)
		{
			alert('The Everyone Group can not be deleted.');
		}
		else
		{
			if (document.inpform.dltflg.value != 'Y')
			{
				alert('This Group has dependent groups. Delete the dependent groups first, then delete this group.');
			}
			else
			{
				var return_value = confirm('You are about to permanently delete this group and all users owned by this group. Do you wish to continue?');
			}
			
			if ( return_value == true )
			{
				var url = 'nxgrpmng.pgm?task=dltgroup&group=' + group + "&rand=" +  randnum;
				top.location.href = url;
			}
		}
		
	}
	else if (task == 'addgroup')
	{
		var errorflg = val_InpChar('groupname', 'Group Name', xl_GetObj('crtgroup'));
		var errorflg2 = val_InpChar('groupdet', 'Group Description', xl_GetObj('crtgroup1'));
		if ((errorflg != 'Y') && (errorflg2 != 'Y'))
		{
			var url = 'nxgrpmng.pgm?task=addgroup&groupname=' + inpform.groupname.value + '&group=' + inpform.group.value + '&groupdet=' + inpform.groupdet.value + "&rand=" +  randnum;
			location = url;
		}
		
	}
	else if (task == 'chggroup')
	{
		
		var errorflg = val_InpChar('GMGRPD', 'Group Name', xl_GetObj('grpname'));
		var errorflg2 = val_InpChar('GMDET', 'Group Description', xl_GetObj('grpdet'));
		if ((errorflg != 'Y') && (errorflg2 != 'Y'))
		{
			if (inpform.GMCEIL.checked == true)
				inpform.GMCEIL.value = "Y";
			if (inpform.GMCRTUSR.checked == true)
				inpform.GMCRTUSR.value = "Y";
			if (inpform.GMCRTGRP.checked == true)
				inpform.GMCRTGRP.value = "Y";
			if (inpform.GMVISBLE.checked == true)
				inpform.GMVISBLE.value = "Y";
			else
				inpform.GMVISBLE.value = "";
			
			
			var url = 'nxgrpmng.pgm?task=chggroup&group=' + inpform.group.value + "&GMGRPD=" + inpform.GMGRPD.value + "&GMDET=" + inpform.GMDET.value + "&GMCEIL=" + inpform.GMCEIL.value + "&GMCRTGRP=" + inpform.GMCRTGRP.value + "&GMCRTUSR=" + inpform.GMCRTUSR.value + "&GMVISBLE=" + inpform.GMVISBLE.value + "&rand=" +  randnum + "&movetogroup=" + inpform.movetogroup.options[inpform.movetogroup.selectedIndex].value;
			location = url;
		}
		
	}
	else if (task == 'upduser')
	{
		var url = 'nxusrmnt.pgm?task=upd&group='+ inpform.group.value + '&USUNBR=' + userno + "&rand=" +  randnum;
		parent.xl_GetObj('dyniframe1').src = url;
		parent.PageNumber = 2;
		parent.xl_GetObj('pg2').className = "tabsel";
	}
	else if (task == 'rmvgroup')
	{
		var url = 'nxgrpmng.pgm?task=removegroup&group='+ inpform.group.value + '&rmvgroup=' + userno + "&rand=" +  randnum;
		location.href = url;
	}
	else if (task == 'dltuser')
	{
		var return_value = confirm('You are about to permanently delete this user. Do you wish to continue?');
		
		if ( return_value == true )
		{
			var url = 'nxgrpmng.pgm?task=dltuser&group='+ xl_GetObj('group').value + '&USUNBR=' + userno + "&rand=" +  randnum;
			location.href = url;
		}
	}
	else
	{
		var url = 'nxgrpmng.pgm?task=' + task + '&group=' + group + '&usernbr=' + userno + "&rand=" +  randnum;
		
		var linksArray = document.getElementsByTagName("a");
		var j = 0;
		for (var i=0; i < linksArray.length; i++) 
		{
			linksArray[i].className = '';
		}	
		
		var groupid = 'grp' + group;
		if (xl_GetObj(groupid))
			xl_GetObj(groupid).className = 'selected';
		
		xl_GetObj('groupifr').src = url;
	}
}

function postovalue (value) 
{
	var url = 'nxgrpmng.pgm?task=details&group='+ inpform.group.value + "&rand=" +  randnum;
	parent.xl_GetObj('groupifr').src = url;
	parent.inpform.group.options[value].selected = true;
}

/* Start Login Functions */
function setup_todo()
{
	
	oEdit1.btnSpellCheck=true;
	oEdit1.width="100%";
	oEdit1.height="200px";
	oEdit1.btnStyles=true;
	
	oEdit1.REPLACE("taskdesc2");
}


function loadformvars() 
{
	var hdr = xl_GetObj("nx_header"); 
	
	if ((hdr.src == "" ) || (hdr.src.match("/nexuspublic/nothing.htm") != null)) hdr.src = iframetgt;  
	if (hdr.height =="") hdr.height = iframehght; 
	
	xl_AttachEvent(document, "keypress", entsub); 
	xl_AttachEvent(xl_GetObj("nx_crtacct"), "click", newaccount);  
	xl_AttachEvent(xl_GetObj("nx_login"), "click", trylogin);
	
	if ((g_forgotpwd == 'N') || (g_message == '') || ((hinttype == "Q") && (secretquest == '')) || ((hinttype == "H") && (g_hint == '')))
		xl_GetObj("forgotpwd").style.display = 'none';
	else
		xl_AttachEvent(xl_GetObj("nx_pwdhelp"), "click", pwdhelp);
	
	
	lgform = xl_GetObj("loginfm"); 
	lgform.action = lgaction; 
	lgform.method = "post"; 
	lgform.siteno.value = g_sitenbr;
	lgform.task.value = "extlogin"; 
	lgform.user.value = g_user;
	lgform.user.focus();
	
	if (showremind  == "Y") xl_GetObj("nx_remind").style.display = ""; 
	else 	 xl_GetObj("nx_remind").style.display = "none"; 
	
	if (allownewaccs == "Y")
	{ 
		xl_GetObj("nx_newaccts").style.display = ""; 
		xl_GetObj("nx_newaccts2").style.display = ""; 
	}
	else 
	{
		xl_GetObj("nx_newaccts").style.display = "none";
		xl_GetObj("nx_newaccts2").style.display = "none";
	}
	
	if(errclass != "") xl_GetObj("nx_errmsg").className = errclass; 
	xl_GetObj("nx_errmsg").innerHTML = g_message; 
	xl_GetObj("nx_hint").innerHTML =  g_hint; 
	xl_GetObj("nx_sitename").innerHTML = g_sitename; 
	
}


function pwdhelp()
{
	if ( hinttype == "H") 
	{
		if (g_user == '') 
		{
			xl_GetObj("nx_hinter").style.display = "block";
			xl_GetObj("nx_hint").innerHTML = 'Enter a User ID';
		}
		else
		{
			xl_GetObj("nx_hinter").style.display = "block";
		}
	}
	
	
	if (hinttype == "Q")
	{ 
		if (secretquest == '')
		{
			xl_GetObj("nx_hint").innerHTML = 'No secret question defined for this User';
			xl_GetObj("nx_hinter").style.display = "block";
		}
		else
		{
			lgform = xl_GetObj("loginfm"); 
			lgform.forgot.value = "Y"; 	
			lgform.task.value = "reqpwd";
			lgform.submit();  
		}		
	} 
	
	return true; 
}

function trylogin()
{	
	lgform = xl_GetObj("loginfm"); 
	lgform.forgot.value = "N";
	lgform.task.value = "extlogin";
	lgform.submit(); 
}

function newaccount()
{ 
	document.newaccfm.submit();
} 	

function entsub(e) 
{
	var code;	
	if (!e) var e = window.event;
	if (e.keyCode) code = e.keyCode;
	else if (e.which) code = e.which;
	
	if (code == 13) trylogin();
	else  return true;
}
/*** End Login Functions **/


function submitmnu() 
{
	var errorflg = val_InpChar('MFPGNAME', 'Menu Name', xl_GetObj('menuname'),'N');
	if (errorflg != 'Y')
	{
	
		document.inpform.submit();
	}
}

function submitcstmnu() 
{
	var errorflg = val_InpChar('MIITEM', 'Item Name', xl_GetObj('menuname'),'N');
	if (errorflg != 'Y')
	{
		document.inpform.submit();
	}
}

/**Group User Links Functions **/

function fnFrameLoadHandler() 
{ 
	try 
	{ 
		var the_height = this.parent.document.getElementById('dyniframe').contentWindow.document.body.scrollHeight; 
		this.parent.document.getElementById('dyniframe').style.height=the_height; 
	} 
	catch(err) 
	{
		this.parent.document.getElementById('dyniframe').style.height=global_height; 
	}  
} 


function ChgStatusBar(e)
{
	var MyEventObj = xl_GetEventTarg(e);
	var EventObj = MyEventObj; 
	
	if (EventObj.nodeName == "LI") 
	{ 
		var children = EventObj.childNodes; 
		
		for (var i = 0; i < children.length; i++) 
		{
			if (children[i].nodeName == "A") 
			{
				MyEventObj.title = children[i].title; 
				EventObj = children[i];
				break; 
			}
		}
	}
	
	if (EventObj.href) 
	{
		if(document.all)   window.status = EventObj.href + ' (' + EventObj.innerText+ ')'; 
		else    window.status = EventObj.href + ' (' + EventObj.textContent + ')'; 
		
		return true; 
	}
} 

function ClrStatusBar()
{ 
	window.status= ""; 
	return true;
}

function rungulink(link_obj) 
{ 
	var link_url = link_obj.href; 
	var link_target = link_obj.target; 
	
	if ( link_url != "") 
	{	
		if (link_target  == "")
		{ 
			if (parent.frames.insidepageurl) 
			{ 
				parent.xl_GetObj("xx").innerHTML = link_obj.title;
				parent.frames.insidepageurl(link_url); 
				
				var url = link_url.substring(0, 3);
				if (url != "htt")
				{		
					oIframe = this.parent.xl_GetObj('dyniframe');
					oIframe.attachEvent('onload', fnFrameLoadHandler);
				}
				else 
				{
					this.parent.xl_GetObj('dyniframe').style.height = linkHeight; 
				}
				
			}
		}
		
		if (link_target == "_blank")
		{
			newWindow = window.open(link_url, "_blank"); 
		}
		
		if (link_target == "_top")
		{	
			newWindow = window.open(link_url, "_top"); 
		}
	}				
}


function guexpandtree(myid, response)
{ 
	xl_GetObj(myid).innerHTML = response;  
	
	if (parent.adjustIFrameSize) 
		parent.adjustIFrameSize(window, 25);
}  

function guClickHandler(e) 
{
	var EventObj = xl_GetEventTarg(e);
	var ajaxurl;
	
	
	if (EventObj.tagName == "LI")
	{ 
		var children = EventObj.childNodes; 
		for (var i = 0; i < children.length; i++) 
		{
			if (children[i].nodeName == "A") 
			{
				EventObj = children[i];
				break; 
			}
		}
	} 
	
	if (EventObj.tagName == "A")
	{
		if (EventObj.parentNode.className == "nxmnuFldrClosed" || EventObj.parentNode.className=="nxmnuFldr") 
		{
			EventObj.parentNode.className = (EventObj.parentNode.className=='nxmnuFldr') ? "nxmnuFldrClosed" : "nxmnuFldr";
			
			if (EventObj.parentNode.className == "nxmnuFldrClosed")
			{
				
				children = EventObj.parentNode.childNodes; 
				for (var i = 0; i < children.length; i++) 
				{
					if (children[i].nodeName == "UL") 
					{
						var myid = children[i].id;
						break;
					}
				}	
				
				ajaxurl = "NXLNKSTREE.pgm?task=EXPAND&ALPHNODE=" + myid + "&mnumopt=" + mnumopt + "&instance=" + instance; 
				xl_AjaxUpdate(ajaxurl, myid, guexpandtree);
			}
			else
			{	   	 
				if (parent.adjustIFrameSize) 
					parent.adjustIFrameSize(window, 25);
			} 
		}
		else 
		{
			if (savSelObj)
			{
				savSelObj.className = savSelObj.className.substring(0,2) + savSelObj.className.substring(4);
				
				children = savSelObj.childNodes; 
				for (var i = 0; i < children.length; i++) 
				{
					if (children[i].nodeName == "A") 
					{
						children[i].className = '';
						break;
					}
				}	
			}
			
			savSelObj = EventObj.parentNode;
			EventObj.className = 'selected';
			EventObj.parentNode.className = EventObj.parentNode.className.substring(0,2) + 'Op' + EventObj.parentNode.className.substring(2);
			
			rungulink(EventObj); 
		} 
	}	
	
	if (window.event)
		return false;
	else
		e.preventDefault();
}	

function initlinks()
{ 
	xl_AttachEvent(document, "mouseover", ChgStatusBar);
	xl_AttachEvent(document, "mouseout", ClrStatusBar);
	xl_AttachEvent(document, "click", guClickHandler);
	if (parent.adjustIFrameSize) parent.adjustIFrameSize(window, 25);
} 


/*** Start Calendar Functions **/

function xl_FFEventhandler(e)
{ 
	if(!document.ff_event) document.ff_event  = null; 
	
	ff_event = xl_GetEvent(e); 
}

function cal_restore() 
{ 
	xl_GetObj('activedlt').checked = "checked";
	xl_GetObj('activermd').checked = "checked";
}

function calshoworhide(imgname) 
{ 
	var instance = xl_GetObj('instance').value;
	var ifr = xl_GetObj('writestateframe');
	
	
	if (flipper == 'O') 
	{
		
		xl_GetObj('navbar2').style.display  = 'none'; 
		flipper = 'C'; 
		
		
		document.images[imgname].src = '/nexuspublic/images/closebar.gif'; 
		document.images[imgname].alt = "Hide Left Column"; 
		
		var url = 'nxmcal.pgm?task=updatestate&state=C&instance=' + instance + "&rndnum=" + randnum;
		ifr.src = url;
		
		xl_GetObj('navbar2').width = '';
		loadcalendars('C');
		
	}
	else 
	{
		xl_GetObj('navbar2').style.display = ''; 
		flipper = 'O'; 
		
		document.images[imgname].src = '/nexuspublic/images/openbar.gif'; 
		document.images[imgname].alt = "Show Left Column"; 
		
		var url = 'nxmcal.pgm?task=updatestate&state=O&instance=' + instance + "&rndnum=" + randnum;
		ifr.src = url;
		
		xl_GetObj('navbar2').width = '165px';
		loadcalendars('O');
		
	} 
}


function calreverseflipperimg() 
{ 
	if (flipper == 'O') 
	{
		xl_GetObj('colhider').src = '/nexuspublic/images/closebarreverse.gif'; 
	}
	else 
	{ 
		xl_GetObj('colhider').src = '/nexuspublic/images/openbarreverse.gif'; 
	} 
}

function calflipperimg() 
{ 
	if (flipper == 'O') 
	{
		xl_GetObj('colhider').src = '/nexuspublic/images/closebar.gif'; 
	}
	else 
	{ 
		xl_GetObj('colhider').src = '/nexuspublic/images/openbar.gif'; 
	} 
}

function closedaywin()
{
	parent.document.all.daypopup.style.display='none';
}

function closeapptwin()
{
	parent.xl_GetObj('auxinfo').style.display = 'none';
}

function chgPrivate()
{
	if (!document.all.TDSHRU.value != 'P')
	{
		xl_GetObj('sharedevent').innerHTML = "This Event is being shared. Click on the following link to make this a private event: <a onclick='private();'>Private</a>";
		calpagefunc2();
	}
	else
		xl_GetObj('sharedevent').innerHTML = "This Event is Private";
}



function setprivate()
{
	var authFound = 'N';
	var children = xl_GetObj('authframe').contentWindow.xl_GetObj('addedauths').childNodes; 
	for (var i = 0; i < children.length; i++) 
	{
		if ((children[i].nodeName == "DIV") && (children[i].style.display != 'none'))
			authFound = 'Y';
	}
	
	if (authFound != 'Y')
	{
		var children = xl_GetObj('authframe').contentWindow.xl_GetObj('selauth').childNodes; 
		for (var i = 0; i < children.length; i++) 
		{
			if ((children[i].nodeName == "DIV") && (children[i].style.display != 'none') && (children[i].id != 'norecords'))
				authFound = 'Y';
		}
	}
	
	if (authFound == 'Y')
	{
		xl_GetObj('sharedevent').innerHTML = "<span class=\"nolink\">This Event is being shared.</span> <a href='javascript:dltallauth();'>Set as Private</a>"; 
		xl_GetObj('authframe').contentWindow.xl_GetObj('norecords').style.display = 'none';
		document.inpform.TDSHRU.value = '';
	}
	else
	{
		xl_GetObj('sharedevent').innerHTML = "<span class=\"nolink\">This Event is Private.</span>";
		xl_GetObj('authframe').contentWindow.xl_GetObj('norecords').style.display = '';
		document.inpform.TDSHRU.value = 'P';	
	}
}

function calpagefunc1()
{
	xl_GetObj('pagedsp1').style.display = "";
	xl_GetObj('pagedsp2').style.display = "none";
	xl_GetObj('pg1').className = "tabsel";
	xl_GetObj('pg2').className = "tab";
	
	setprivate();
	
	document.inpform.TDDETE.focus();
	
}

function calpagefunc2()
{
	xl_GetObj('pagedsp2').style.display = "";
	xl_GetObj('pagedsp1').style.display = "none";
	xl_GetObj('pg1').className = "tab";
	xl_GetObj('pg2').className = "tabsel";
	//xl_GetObj('TDSHRU').checked = false;
}

function gotodate()
{
	
	var month = xl_GetObj('MONTH').options[xl_GetObj('MONTH').selectedIndex].value;
	var year = xl_GetObj('YEAR').options[xl_GetObj('YEAR').selectedIndex].value;;
	
	var instance = xl_GetObj('instance').value;
	var viewby = xl_GetObj('viewby').options[xl_GetObj('viewby').selectedIndex].value;
	var viewtype = xl_GetObj('viewtype').value;
	
	pagetoload = 'NXMCAL.pgm?task=default&instance='+ instance + '&MONTH=' + month + '&YEAR=' + year + '&DAY=1&viewby=' + viewby + '&viewtype=' + viewtype;
	document.location.href= pagetoload;
}

function usroptions() 
{ 
	var ifr = xl_GetObj('usroptframe');
	var instance = xl_GetObj('instance').value;
	
	var event = xl_event();
	ifr.style.left = (event.clientX - 300) + 'px';
	ifr.style.top =  (event.clientY + 15) + 'px';
	
	var url = 'nxclusr.pgm?task=default&instance=' + instance + "&rndnum=" + randnum;
	
	ifr.src = url;
	ifr.style.zIndex=50;
	
	xl_GetObj('usropt').style.display = "";
}

function closeusroptions()
{
	parent.xl_GetObj('usropt').style.display='none';
}


function loadbar(openclose, imgname) 
{
	if (openclose == "O") 
	{ 
		flipper = 'O'; 
		
		document.images[imgname].src = '/nexuspublic/images/closebar.gif'; 
		document.images[imgname].alt = "Hide Left Column"; 
		xl_GetObj('navbar2').width = '165px';
		
	}
	else 
	{
		flipper = 'C'; 
		
		document.images[imgname].src = '/nexuspublic/images/openbar.gif'; 
		document.images[imgname].alt = "Show Left Column"; 
		xl_GetObj('navbar2').width = '';
	} 
	
	loadcalendars(openclose);
}


function rediplay(framename)
{
	closeapptwin();
	calframe = parent.xl_GetObj(framename);
	
	var thismon = calframe.contentWindow.xl_GetObj('thismon').value;
	var thisyear = calframe.contentWindow.xl_GetObj('thisyear').value;
	var instance = calframe.contentWindow.xl_GetObj('instance').value;
	var viewby = calframe.contentWindow.xl_GetObj('viewby').options[calframe.contentWindow.xl_GetObj('viewby').selectedIndex].value;
	var viewtype = calframe.contentWindow.xl_GetObj('viewtype').value;
	var selectedday = calframe.contentWindow.xl_GetObj('selectedday').value;
	
	pagetoload = 'NXMCAL.pgm?task=default&instance=' + instance + '&MONTH=' + thismon + '&YEAR=' + thisyear + '&DAY=' + selectedday + '&viewby=' + viewby + '&viewtype=' + viewtype + "&rnd=" + randnum;
	calframe.src= pagetoload;
}


function changeappt(apptnbr)
{
	var parentflg = 'N';
	var ifr = parent.xl_GetObj('auxframe');
	
	if (ifr == null)
	{
		ifr = parent.xl_GetObj('apptframe');
		parentflg = 'Y';
	}
	
	var instance = xl_GetObj('instance').value;
	var curtime = xl_GetObj('currenttime').value;
	
	var popupSize = 600;
	
	ifr.style.height = popupSize + 'px';
	ifr.style.width = popupSize + 'px';
	
	
	var framename = parent.xl_GetObj(this.name);
	var event = xl_event();
	var y = xl_FindPosY(framename) + event.clientY;
	var x = xl_FindPosX(framename) + event.clientX;
	
	if ((600 + x) > parent.document.body.scrollWidth)	
	{
		x = (parent.document.body.scrollWidth - 600) - 10;
	}
	
	y = top.frames['block_page'].document.body.scrollTop + 5;
	
	ifr.style.left = x + 'px';
	ifr.style.top = y + 'px';
	
	var url = 'nxwappts.pgm?TASK=BEGINCHG&TDSENU=' + apptnbr + '&instance=' + instance + '&TIMBIT=' + curtime + "&rndnum=" + randnum + "&framename=" + this.name;
	ifr.src = url;
	ifr.style.zIndex=50;
}

function rmvprivate()
{
	//document.all.TDSHRU.checked = "";
}

function addpopup(day,time) 
{ 
	var ifr = parent.xl_GetObj('auxframe');
	var instance = xl_GetObj('instance').value;
	
	var popupSize = 600;
	
	ifr.style.height = popupSize + 'px';
	ifr.style.width = popupSize + 'px';
	
	var framename = parent.xl_GetObj(this.name);
	var event = xl_event();
	
	var y = xl_FindPosY(framename) + event.y + 10;
	var x = xl_FindPosX(framename) + event.x;
	
	if ((600 + x) > parent.document.body.scrollWidth)	
	{
		x = (parent.document.body.scrollWidth - 600) - 10;
	}
	
	y = top.frames['block_page'].document.body.scrollTop + 5;
	
	ifr.style.left = x + 'px';
	ifr.style.top = y + 'px';
	
	if (time == null)
		time = '';
	
	var url = 'nxwappts.pgm?newdate=' + day + '&instance=' + instance + '&newtime=' + time + "&rndnum=" + randnum + "&framename=" + this.name;
	
	ifr.src = url;
	ifr.style.zIndex=50;
}


function addpopup2(day,time) 
{ 
	var ifr = parent.xl_GetObj('apptframe');
	var instance = xl_GetObj('instance').value;
	
	ifr.height = 500;
	ifr.style.left = 15 + 'px';
	ifr.style.top =  15 + 'px';	
	
	if (time == null)
		time = '';
	
	var url = 'nxwappts.pgm?newdate=' + day + '&instance=' + instance + '&newtime=' + time + "&rndnum=" + randnum;
	
	ifr.src = url;
	ifr.style.zIndex=50;
	
	parent.parent.document.all.apptpopup.style.display = "";
	if (parent.parent.adjustIFrameSize) parent.parent.adjustIFrameSize(parent.window);
}

function daypopup(day) 
{ 
	var thismon = xl_GetObj('thismon').value;
	var thisyear = xl_GetObj('thisyear').value;
	var instance = xl_GetObj('instance').value;
	var viewby = xl_GetObj('viewby').options[xl_GetObj('viewby').selectedIndex].value;
	var viewtype = xl_GetObj('viewtype').value;
	
	var ifr = xl_GetObj('dayframe');
	var instance = xl_GetObj('instance').value;
	
	ifr.height = 317;
	ifr.style.left = 15 + 'px';
	ifr.style.top =  15 + 'px';
	
	
	var url = 'NXMCAL.pgm?task=daymode&singleday=Y&instance='+ instance + '&MONTH=' + thismon + '&YEAR=' + thisyear + '&DAY=' + day + '&viewby=' + viewby + '&viewtype=D' + "&rndnum=" + randnum;
	ifr.src = url;
	ifr.style.zIndex=50;
	
	xl_GetObj('daypopup').style.display = "";
	if (parent.adjustIFrameSize) parent.adjustIFrameSize(window);
}


function displayDate(day, month, year, rtnform, rtnbox, datfmt) 
{
	var instance = document.all.instance.value;
	var mypage =  "nxclsl.pgm?TASK=PREDRAW&DAY=" + day + "&MONTH=" + month + "&YEAR=" + year +"&RTNFORM=" + rtnform + "&RTNTEXTBX=" +rtnbox + "&RTNDATFMT=" + datfmt + "&instance=" + instance;
	var ifr = xl_GetObj('usrgrpframe');
	ifr.height = 185;
	ifr.width = 185;
	
	var event = xl_event();
	ifr.style.left = event.x + 'px';
	ifr.style.top =  (event.y + 15) + 'px';
	
	ifr.src = mypage;
	ifr.style.zIndex=50;
	
	usrgrppopup.style.display = "";
}

function dltdisplay(dltallowed) 
{
	if (dltallowed == "Y") 
	{
		xl_GetObj('display2').style.display = "";
	} 
	else 
	{
		xl_GetObj('display2').style.display = "none";
	}
}

function SelectDate(day, month, year, rtnform, rtnbox, datfmt) 
{
	var instance = document.inpform.instance.value;
	var mypage =  "nxclsl.pgm?TASK=PREDRAW&DAY=" + day + "&MONTH=" + month + "&YEAR=" + year +"&RTNFORM=" + rtnform + "&RTNTEXTBX=" +rtnbox + "&RTNDATFMT=" + datfmt  + "&instance=" + instance;
	var ifr = xl_GetObj('usrgrpframe');
	
	var event = xl_event();
	
	ifr.style.left = (event.x + 10) + 'px';
	ifr.style.top =  (event.y - 100) + 'px';
	
	ifr.height = 185;
	ifr.width = 185;
	
	ifr.src = mypage;
	ifr.style.zIndex=50;
	
	xl_GetObj('usrgrppopup').style.display = "";
}

function ResetRBs(chkbox) 
{ 
	if (chkbox.value == "P") 
	{ 
		with (document.inpform) 
		{ 
			for (var i=0; i < length; i++) 
			{ 
				var element = elements[i]; 
				if (element.type == 'radio') 
				{ 
					if (element.value == "N") 
					{
						element.checked  = true; 
					} 
					else 
					{ 
						element.checked = false; 
					}	
				}
			}
		}
	}
}

function setPrivorPub() 
{
	with (document.inpform) 
	{ 
		TDSHRU.value="P"; 
		for (var i=0; i < length; i++) 
		{ 
			var element = elements[i]; 
			if (element.type == 'radio' && element.value != "N") 
			{ 
				TDSHRU.checked = false; 
				break;
			}
		}
	}
}

/**************************************** End Calendar Functions *********************************************/

function navigator_KeyDown() 
{
	if ((ff_event) && (ff_event.keyCode == 27))
	{
		closeMenu();
		
		if (listType != 'V')
		{
			var ifr = parent.parent.xl_GetObj(parent.window.name);
			ifr.parentNode.style.display = 'none';
			return false;
		}
		
		return false;
	}
	else
		return true;
}

function menu_KeyDown() 
{
	if ((ff_event) && (ff_event.keyCode == 13))
	{
		searchdoc();
		return false;
	}
	
	if ((ff_event) && (ff_event.keyCode == 27))
	{
		top.frames['block_page'].closeWindows();
		return false;	
	}
	
	return true;
}

function mpage2_KeyDown() 
{
	if ((ff_event) && (ff_event.keyCode == 27))
	{	
		parent.closeWindows();
		return false;	
	}
	
	return true;
}

function popup_KeyDown() 
{
	if ((ff_event) && (ff_event.keyCode == 27))
	{
		var ifr = parent.xl_GetObj(window.name);
		ifr.parentNode.style.display = 'none';
		return false;
		
	}
	return true;
}


function mpage_KeyDown() 
{
	if ((ff_event) && (ff_event.keyCode == 27))
	{
		closeWindows();	
		return false;
	}
	else
		return true;
}


function closeWindows()
{
	xl_GetObj('favorites').style.display = 'none';
	xl_GetObj('helpdiv').style.display = 'none';
	xl_GetObj('searchwow').style.display = 'none';
	xl_GetObj('menudisplay').style.display = 'none';
	xl_GetObj('submenudisplay').style.display = 'none';
	xl_GetObj('auxinfo').style.display = 'none';
	xl_GetObj('quickadd2').style.display = 'none';
	xl_GetObj('quickadd').style.display = 'none';
}


function sbmpage(ordbyval)
{
	var frm = document.headfrm;
	frm.ordby.value=ordbyval;
	frm.submit();
}				 

function loadmnuauth(rrn)
{
	var framename = 'auxframe';
	var url = 'NXMNUMNT.pgm?task=mnuauth&mnurrn=' + rrn;
	parent.popup(framename ,url,450,600,'float',xl_event(),35,'auxinfo');
	
}

function loadmnuitauth(rrn)
{
	var framename = 'auxframe';
	var url = 'NXMNUMNT.pgm?task=mnuitauth&mnurrn=' + rrn;
	parent.popup(framename ,url,450,600,'float',xl_event(),35,'auxinfo');
}	



/**************************************** Start Admin functions *****************************************/
function sendEmail()
{
	
	var myurl = 'nxmpage.pgm?task=sendemail&docnum=' + parent.xl_GetObj('lnknum').value + "&email=" + inpform.email.value + "&emaildesc=" + inpform.emaildesc.value + "&emailsub=" + inpform.emailsub.value + "&emailcc=" + inpform.emailcc.value + "&rndnum=" + randnum;
	var mydiv;
	
	xl_AjaxUpdate(myurl, mydiv);
	parent.xl_GetObj('auxinfo').style.display = 'none';	
}


function emailECM(e, ecmnode)
{
	framename = 'auxframe';	
	var ifr = xl_GetObj(framename);
	ifr.style.display = '';
	
	// e gives access to the event in all browsers
	if (!e) var e = window.event; 
	
	var url = 'nxmpage.pgm?task=email&docnum=' + ecmnode + "&rndnum=" + randnum;
	popup(framename ,url,300,300,'float',e,20,'auxinfo');
}

function printECM()
{
	
	if (xl_GetObj('ifrmviewdoc').contentWindow.auxprint)
	{
		xl_GetObj('ifrmviewdoc').contentWindow.auxprint();
	}
	else
	{
		frames["ifrmviewdoc"].focus();
		frames["ifrmviewdoc"].print();
	}
}


function editmode(editflag)
{
	if (editflag == 'Y')
	{
		var spanArray = document.getElementsByTagName("span");
		var j = 0;
		for (var i=0; i < spanArray.length; i++) 
		{
			if(spanArray[i].getAttribute("id").substring(0, 8) == "moveHere") 
			{
				moveHereCollection[j] = spanArray[i];
				j++;
			} 
		}
		
		j = 0;
		var divArray = document.getElementsByTagName("div");
		for (var i=0; i < divArray.length; i++) 
		{
			if(divArray[i].getAttribute("id"))
			{
				if (divArray[i].getAttribute("id").substring(0, 5) == "wcdiv") 
				{	
					InstCollection[j] = divArray[i];
					j++;
				} 
			}
		}
	}
}

function dragBegin(event, id) 
{
	if ((event.button != 1) && (event.which != 1))
		return;
	
	try
	{
		xl_GetObj('headerborder').className = "pageHeaderBoundary";
		xl_GetObj('footerborder').className = "pageFooterBoundary";
		xl_GetObj('tdsbmform').className = "pageColumnBoundary";
		xl_GetObj('tdsbmform2').className = "pageColumnBoundary";
		xl_GetObj('column3').className = "pageColumnBoundary";
		xl_GetObj('column4').className = "pageColumnBoundary";
	}
	catch(err)
	{
	}

	document.onselectstart=new Function ("return false");  	
	
	var el;
	var x, y;
	
	document.body.scrollTop = 0;
	
	currentPortlet = id;
	currentPortletObj = xl_GetObj('wc' + currentPortlet);
	
	var pageHeight = xl_GetObj('pagelayout').scrollHeight;
	
	instHide();
	
	var currentContent = xl_GetObj('ifrm' + currentPortlet);
	currentPortletObj.style.position = 'absolute';
	currentPortletObj.style.width = '400px';
	
	xl_GetObj('pagelayout').height = pageHeight;
	
	dragObj.elNode = xl_GetObj(currentPortletObj);
	dragObj.elNode.style.zIndex = 99;
	
	dragObj.elStartLeft = parseInt(dragObj.elNode.style.left, 10);
	dragObj.elStartTop  = parseInt(dragObj.elNode.style.top,  10);
	
	if (isNaN(dragObj.elStartLeft)) dragObj.elStartLeft = 0;
	if (isNaN(dragObj.elStartTop))  dragObj.elStartTop  = 0;
	
	xl_AttachEvent(document, "mousemove", dragMe); 
	xl_AttachEvent(document, "mouseup", dragEnd); 
	
}

function dragMe(e) 
{
	var x, y;
	if (!e) var e = window.event; 
	
	x = e.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
	y = e.clientY + document.documentElement.scrollTop + document.body.scrollTop;
	
	dragObj.elNode.style.left = (dragObj.elStartLeft + x) + "px";
	dragObj.elNode.style.top  = (dragObj.elStartTop  + y) + "px";
	
	showLocation(x,y);
	
	if (placeHereObj.id)
	{
		xl_GetObj(placeHereObj.id).style.display = '';
	}
}


function dragEnd()
{	
	
	document.onclick=reEnable;
	
	try
	{
		xl_GetObj('headerborder').className = "";
		xl_GetObj('footerborder').className = "";
		xl_GetObj('tdsbmform').className = "";
		xl_GetObj('tdsbmform2').className = "";
		xl_GetObj('column3').className = "";
		xl_GetObj('column4').className = "";
	}
	catch(err)
	{
	}
	
	var frameSourceObj = xl_GetObj('ifrm'  + currentPortlet);
	
	currentPortletObj.style.zIndex = 0;
	currentPortletObj.style.position = 'relative';
	currentPortletObj.style.width = '100%';
	
	if ((frameSourceObj) && (ReloadPath != ''))
		frameSourceObj.src = ReloadPath;
	
	xl_DetachEvent(document, "mousemove", dragMe); 
	xl_DetachEvent(document, "mouseup", dragEnd);
	
	if (!placeHereObj)
	{
		currentPortletObj.style.left = dragObj.elStartLeft + 'px';
		currentPortletObj.style.top = dragObj.elStartTop + 'px';
		
		instDisplay();
	}
	else
	{
		placeHereObj.style.display = 'none';
		
		var returns = currentPortletObj.cloneNode(true);
		var colObj = xl_GetObj(placeHereObj.parentNode.id);
		
		colObj.insertBefore(returns, placeHereObj);
		
		returns.style.top = 0 + 'px';
		returns.style.left = 0 + 'px';
		
		//currentPortletObj.removeNode(currentPortletObj);
		//currentPortletObj.removeNode(true);
		currentPortletObj.parentNode.removeChild(currentPortletObj);

		
		instDisplay();
		
		random_num = Math.round((Math.random()*10000)+1);
		var column = colObj.id.substring(3);
		var sequence = 	placeHereObj.id.substring(9);
		var url = 'nxmpage.pgm?task=moveinst&plytrrn='+ currentPortlet + '&column=' + column + '&sequence=' + sequence + '&rand=' + random_num; 
		
		var incby = parseInt(placeHereObj.id.substring(12)) + 1;
		if (incby) 
			placeHereObj.id = placeHereObj.id.substring(0,12) + incby;
		else
			placeHereObj.id = placeHereObj.id.substring(0,11) + 1;
		
		if ((column != 0) && (xl_GetObj(placeHereObj)))
			xl_AjaxUpdate(url);
	}
	
	ReloadPath = '';
	currentPortletObj = '';
	
}

function getdivid()
{
	var x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
	var y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
	
	placeHereObj = '';
	var column = getColumn(x, y);
	
	
	getlocation(column, y);
}

function showLocation(x, y)
{
	var column = getColumn(x, y);
	
	for (var i=0; i < moveHereCollection.length; i++) 
	{
		xl_GetObj(moveHereCollection[i].id).style.display = 'none';
	}
	
	getlocation(column, y);
	
	return placeHereObj;
}


function getlocation(column, y)
{
	var list = xl_GetObj(column.id);
	for(i=0; i < list.childNodes.length; i++)
	{
		if ((list.childNodes.item(i).id) && (list.childNodes.item(i).id.substring(0, 8) == "moveHere"))
		{
			
			list.childNodes.item(i).style.display = '';
			var spaceloc = xl_FindPosY(list.childNodes.item(i));
			list.childNodes.item(i).style.display = 'none';

			if ((y > spaceloc) || (y < xl_FindPosY(xl_GetObj(column.id))))
			{
				var top = spaceloc + 40;  
				var bottom = spaceloc - 40;
				if ((y <= top) && (y >= bottom))
				{
					placeHereObj = xl_GetObj(list.childNodes.item(i).id);
				}
				else
					placeHereObj = '';
			}
		}
	}
}

function instHide()
{	
	var j = 0;
	for (var i=0; i < InstCollection.length; i++) 
	{
		if (xl_GetObj(InstCollection[i].id).style.display == 'block')
		{
			hiddenPortlets[j] = InstCollection[i];
			xl_GetObj(InstCollection[i].id).style.display = 'none';
			j++;
		}
	}
}


function instDisplay()
{	
	var index;
	for (var i=0; i < hiddenPortlets.length; i++) 
	{
		if ((hiddenPortlets[i].id) && (hiddenPortlets[i].getAttribute("id").substring(0, 5) == "wcdiv")) 
			xl_GetObj(hiddenPortlets[i].id).style.display = 'block';
	}
}


function getColumn(x, y)
{
	if ((xl_GetObj('col5')) && (y < (xl_FindPosY(xl_GetObj('col1')))))
	{
		column = xl_GetObj('col5');
	}
	else if ((xl_GetObj('col6')) && (y > (xl_FindPosY(xl_GetObj('col6')))))
	{
		column = xl_GetObj('col6');
	}
	else	
	{
		var curPos = 0;
		column = xl_GetObj('col1');
		
		if ((xl_GetObj('col2')) && (x >= (xl_FindPosX(xl_GetObj('col2')))))
			column = xl_GetObj('col2');	
		
		if ((xl_GetObj('col3')) && (x >= (xl_FindPosX(xl_GetObj('col3')))))
			column = xl_GetObj('col3');
		
		if ((xl_GetObj('col4')) && (x >= (xl_FindPosX(xl_GetObj('col4')))))
			column = xl_GetObj('col4');
	}
	
	
	return column;
}


function disabletext(e)
{
	return false
}

function reEnable()
{
	return true
}


function loaddetails(instrrn, plytrrn, pgrrn, docnum, skinspath, fromPgm)
{
	var url = 'nxmpage.pgm?task=loaddet&pgrrn=' + pgrrn + '&plytrrn=' + plytrrn + '&instrrn=' + instrrn + '&docnum=' + docnum + '&skinspath=' + skinspath + '&fromPgm=' + fromPgm + "&rand=" + randnum;
	
	framename = 'auxframe';
	hideframe(framename); 
	
	if (fromPgm == 'NXINSTMNG')
		parent.popup(framename ,url,100,500,'float',xl_event(),35,'auxinfo');
	else
		popup(framename ,url,100,500,'float',xl_event(),15,'auxinfo');
}

function addpage(pgrrn)
{
	framename = 'auxframe';
	hideframe(framename); 
	var url = 'nxmpage.pgm?task=newpage&pgrrn=' + pgrrn + '&pagetype=' + document.docform.pagetype.value + '&grpusrnbr=' + document.docform.grpusrnbr.value + "&rand=" + randnum;
	popup(framename,url,200,450,'right',xl_event(),15,'auxinfo');		
}

function addpage2(pgrrn)
{
	framename = 'auxframe';
	hideframe(framename); 
	var url = 'nxmpage.pgm?task=newpage&pgrrn=' + pgrrn + '&pagetype=' + parent.document.docform.pagetype.value + '&grpusrnbr=' + parent.document.docform.grpusrnbr.value + "&rand=" + randnum
		parent.popup(framename,url,200,450,'left',xl_event(),35,'auxinfo');	
}


function loadpage(pgrrn)
{
	top.location.href = 'nxmenu.pgm?pgrrn=' + pgrrn;	
}


function loadauthorities(instrrn, fromPgm)
{
	framename = 'auxframe';
	hideframe(framename); 
	
	var url = 'nxinstmng.pgm?task=loadauth&instrrn=' + instrrn + "&rand=" + randnum;
	
	if (fromPgm == 'NXINSTMNG')	
		parent.popup(framename ,url,450,600,'float',xl_event(),35,'auxinfo');
	
	else	
		popup(framename ,url,450,600,'float',xl_event(),10,'auxinfo');
}

function addportlet(plytrrn, pgrrn, docnum, skinspath)
{
	framename = 'auxframe';
	hideframe(framename); 
	var url = 'nxmpage.pgm?task=newportlet&pgrrn=' + pgrrn + '&plytrrn=' + plytrrn + '&docnum=' + docnum + '&skinspath=' + skinspath + "&rand=" + randnum;
	popup(framename ,url,150,400,'left',xl_event(),15,'auxinfo');
}

function pageproperties2(pgrrn)
{
	framename = 'auxframe';
	hideframe(framename); 
	var url = 'nxmpage.pgm?task=pageprop&wrkpages=Y&pgrrn=' + pgrrn + "&rand=" + randnum;
	parent.popup(framename,url,200,300,'float',xl_event(),35,'auxinfo');
}

function pageproperties(pgrrn, docnum, skinspath)
{
	framename = 'auxframe';
	hideframe(framename); 
	
	var url = 'nxmpage.pgm?task=pageprop&pgrrn=' + pgrrn + '&docnum=' + docnum + '&skinspath=' + skinspath + "&rand=" + randnum;
	popup('auxframe',url,200,300,'right',xl_event(),15,'auxinfo');
}


function popup(framename,url,height,width,position,thisevent,topoffset,divname)
{
	var ifr = xl_GetObj(framename);
	
	var thiseventleft = thisevent.clientX;
	
	url = url + '&rand=' + randnum;
	var y = thisevent.clientY + document.documentElement.scrollTop + document.body.scrollTop;
	ifr.style.zIndex = 50;
	ifr.style.top =  (y + topoffset) + 'px';
	ifr.src = url;	
	
	xl_AttachEvent(ifr, "load", function () {ifrloaddone(framename,height,width,position,thiseventleft,topoffset,divname)});

	//xl_AttachEvent(ifr, "load", ifrloaddone(framename,height,width,position,thiseventleft,topoffset,divname));
	//ifr.addEventListener('load', ifrloaddone(framename,height,width,position,thiseventleft,topoffset,divname), false);
}


function ifrloaddone(framename, height, width, position, thiseventleft,topoffset, divname)
{
	var ifr = xl_GetObj(framename);
	if (framename == 'auxframe')
	{
		// RTC 20080721: changes to how this code is reached (called by onload function)
		//  mean we dont need to try to check for readystate
		//try
		//{
		//	//var optifr = document.frames(framename).xl_GetObj('optframe');
		//	var optifr = document.getElementById('auxframe').contentDocument.getElementById('optframe');
		//	if ((optifr) && (optifr.readyState != "complete"))
		//	{
		//		xl_AttachEvent(optifr, "load", function () {setsize(framename, height, width, position, thiseventleft,topoffset, divname);});
		//	} 
		//	else
		//	{
		//		setsize(framename, height, width, position, thiseventleft,topoffset, divname);
		//	}
		//} 
		//catch(err)
		//{
			setsize(framename, height, width, position, thiseventleft,topoffset, divname);
		//}
		//... end RTC 20080721
	}
	else
	{
		setsize(framename, height, width, position, thiseventleft,topoffset, divname);
	}
}

function hideframe(framename) 
{
	if (xl_GetObj(framename))
	{	
		var ifr = xl_GetObj(framename);
		ifr.style.height = 0;
	
		if(ifr) 	
			ifr.style.visibility = 'hidden';
	}
} 

function setsize(framename, height, width, position, thiseventleft,topoffset, divname)
{	
	var ifr = xl_GetObj(framename);
	ifr.style.height = height + 'px';
	ifr.style.width = width + 'px';
	
	if (divname != '')
	{
		xl_GetObj(divname).style.display = '';
		try
		{
			var optifr = frames[framename].xl_GetObj('optframe');
			var height = 0;
			var width = 0;
			
			if (optifr.contentWindow)
			{
				ifr.contentWindow.xl_GetObj('pagedsp1').style.display = 'none';
				ifr.contentWindow.xl_GetObj('pagedsp2').style.display = '';
				height = optifr.contentWindow.document.body.scrollHeight + 20;
				width = optifr.contentWindow.document.body.scrollWidth;
				ifr.contentWindow.xl_GetObj('pagedsp1').style.display = '';
				ifr.contentWindow.xl_GetObj('pagedsp2').style.display = 'none';
			}
	
			if (ifr.contentWindow.document.body.scrollHeight > height)
				ifr.style.height = ifr.contentWindow.document.body.scrollHeight + 5 + 'px';
			else
				ifr.style.height = height + 30 + 'px';
		
			if (ifr.contentWindow.document.body.scrollWidth > width)
				ifr.style.width = ifr.cfshow_ontentWindow.document.body.scrollWidth + 'px';
			else
				ifr.style.width = width + 30 + 'px';
			
		}
		catch(err)
		{
			ifr.style.height = ifr.contentWindow.document.body.scrollHeight + 'px';
			ifr.style.width = ifr.contentWindow.document.body.scrollWidth + 20 + 'px';
		}
	}
	
	
	if (position == 'left')
		ifr.style.left = 25 + 'px';
	else if (position == 'right')
	{
		ifr.style.left = (document.body.offsetWidth - parseInt(ifr.style.width)) - 25 + 'px';	
	}
	else if (position == 'float')
	{
		var x = thiseventleft + document.documentElement.scrollLeft + document.body.scrollLeft;
		if ((parseInt(ifr.style.width) + x) > document.body.offsetWidth)
			ifr.style.left = (x - parseInt(ifr.style.width)) + 'px';
		else
			ifr.style.left = x + 'px';
	}
	
	ifr.style.visibility = '';
	
	if (divname != '')
		xl_GetObj(divname).style.display = '';
	
} 


function portletDetails()
{
	xl_GetObj('pg1').className = "tabsel";
	xl_GetObj('pg2').className = "tab";
	
	xl_GetObj('pagedsp1').style.display = "";
	xl_GetObj('pagedsp2').style.display = "none";
	
	adjustoptions();
}

function portletOptions()
{
	xl_GetObj('pg1').className = "tab";
	xl_GetObj('pg2').className = "tabsel";
	
	xl_GetObj('pagedsp1').style.display = "none";
	xl_GetObj('pagedsp2').style.display = "";
	
	adjustoptions();
}

function adjustoptions()
{
	var ifr = parent.parent.xl_GetObj('auxframe');
	var optifr = xl_GetObj('optframe');
	
	try 
	{
		optifr.style.height = optifr.contentWindow.document.body.scrollHeight + 'px';
		if (optifr.style.height > ifr.style.height)
			ifr.style.height = parseInt(optifr.style.height) + 20 + 'px';
		
		
		optifr.style.width = optifr.contentWindow.document.body.scrollwidth + 'px';
		if (parseInt(optifr.style.width) > parseInt(ifr.style.width))
			ifr.style.width = parseInt(optifr.style.width) + 20 + 'px';
		
	}
	catch(err)
	{
		try
		{
			if (parent.adjustIFrame) parent.adjustIFrame(window);
			if (parent.parent.adjustIFrame) parent.parent.adjustIFrame(parent.window);

		}
		catch(err)
		{
			
		}
	}
}


function groupselect()
{
	
	try 
	{
		xl_GetObj('copypage').style.display = "";
	}
	catch(err)
	{
	}
	
	var returnValue = '';
	if (document.inpform.task.value == 'endaddpage')
		returnValue = getSelectedRadioValue(document.forms[0].pagetype);
	else
		returnValue = document.inpform.pagetype.value;
	
	if (returnValue == 'G')
	{
		xl_GetObj('selGroup').style.display = "";
		if (document.inpform.task.value == 'endaddpage')
		{
			xl_GetObj('pagetype').style.display = "";
			xl_GetObj('pageorder').style.display = "";
		}
	}	
	else if (returnValue == 'U')
	{
		xl_GetObj('selGroup').style.display = "none";
		if (document.inpform.task.value == 'endaddpage')
		{
			xl_GetObj('pagetype').style.display = "";
			xl_GetObj('pageorder').style.display = "";
		}
	}
	else if (returnValue == 'T')
	{
		xl_GetObj('selGroup').style.display = "none";
		xl_GetObj('ECM').style.display = "none";
		if (document.inpform.task.value == 'endaddpage')
		{
			document.inpform.addpagetype.selectedIndex = 0;		
			xl_GetObj('pagetype').style.display = "none";
			document.inpform.wnode2.value = 0;
			xl_GetObj('pageorder').style.display = "none";
		}
	}
}

function end_add(pgrrn, node)
{
	if (node == 0)
		top.location.href = 'nxmenu.pgm?pgrrn=' + pgrrn;
	else
		top.location.href = 'nxmenu.pgm?docnum=' + node;
}

function endPageAdd()
{
	var errorflg = val_InpChar('addname', 'Name', xl_GetObj('check_name'),'N');
	if (errorflg != 'Y')
	{
		document.inpform.submit();
	}
}

function updinst(fromPgm)
{
	var errorflg = val_InpChar('WIWANA', 'Name', xl_GetObj('check_name'),'N');
	var errorflg2 = val_InpChar('WIWADE', 'Description', xl_GetObj('check_description'),'N');
	if ((errorflg != 'Y') && (errorflg2 != 'Y'))
	{
		parent.xl_GetObj('auxinfo').style.display = "none";
		document.inpform.submit();
		
		if (fromPgm == 'NXINSTMNG')
		{
			var ifr = parent.xl_GetObj('instframe');
			ifr.src = 'nxinstmng.pgm';
		}
		else
		{
			if (document.inpform.docnum.value == 0)
				top.location.href = 'nxmenu.pgm?pgrrn=' + document.inpform.pgrrn.value;
			else
				top.location.href = 'nxmenu.pgm?docnum=' + document.inpform.docnum.value;
		}
	}
}

function updprop(wrkpages)
{
	var errorflg = val_InpChar('PMPANA', 'Page Name', xl_GetObj('check_name'),'N');
	if ((parseInt(inpform.PMCOWI.value) + parseInt(inpform.PMCOW1.value) + parseInt(inpform.PMCOW2.value) + parseInt(inpform.PMCOW4.value)) > 100)
	{
		
		column1.className = 'error';
		column2.className = 'error';
		column3.className = 'error';
		column4.className = 'error';
		
		
		alert('Column width\'s exceeds 100%. Enter column width\'s that in total do not exceed 100%.');
		errorflg = 'Y';
	}
	
	
	if (errorflg != 'Y')
	{
		
		parent.auxinfo.style.display = "none";
		inpform.submit();
		
		if (wrkpages == 'Y')
		{
			parent.xl_GetObj('instframe2').src = 'NXPAGES.pgm?pgrrn=' + parent.document.docform.pgrrn.value;
		}
		else
		{
			if (document.inpform.docnum.value == 0)
				top.location.href = 'nxmenu.pgm?pgrrn=' + document.inpform.pgrrn.value;
			else
				top.location.href = 'nxmenu.pgm?docnum=' + document.inpform.docnum.value;
		}
	}
}

function crtportlet()
{
	
	if (document.inpform.instnbr.options[document.inpform.instnbr.selectedIndex].value == 0)
	{
		var errorflg = val_InpChar('newname', 'Name', xl_GetObj('check_name'),'N');
		var errorflg2 = val_InpChar('newdesc', 'Description', xl_GetObj('check_description'),'N');	
	}
	
	if ((errorflg != 'Y') && (errorflg2 != 'Y'))
	{
		
		parent.xl_GetObj('auxinfo').style.display = "none";
		document.inpform.submit();
		
		if (document.inpform.docnum.value == 0)
			top.location.href = 'nxmenu.pgm?pgrrn=' + document.inpform.pgrrn.value;
		else
			top.location.href = 'nxmenu.pgm?docnum=' + document.inpform.docnum.value;
	}
}



function showdet(portlet)
{
	var obj = xl_GetObj(portlet);
	if (obj.style.display == 'none')
		obj.style.display = ''; 
	else 
		obj.style.display = 'none';
}

function reverseflipperimg() 
{ 
	if (flipper == '') 
		xl_GetObj('colhider').src = '/nexuspublic/images/closebarreverse.gif';
	else 
		xl_GetObj('colhider').src = '/nexuspublic/images/openbarreverse.gif';	  
}

function flipperimg() 
{ 
	if (flipper == '')  
		xl_GetObj('colhider').src = '/nexuspublic/images/closebar.gif';
	else 
		xl_GetObj('colhider').src = '/nexuspublic/images/openbar.gif';  
}


function insidepageurl(newurl) 
{
	var t_frame= xl_GetObj("insert"); 
	t_frame.style.display  = ''; 
	xl_GetObj('dyniframe').src= newurl;
}

function fnBuildMsg(iMsg, iBtns)
{
	var msgText = "<span class='alert'><center><br>" + iMsg + "<br><br>";
	
	x = iBtns.search("~!");
	while (x != -1)
	{
		iBtns = iBtns.substr(x+2);
		y = iBtns.search("~!");
		if (y != -1)
		{
			btnName = iBtns.substr(0, y);
			iBtns = iBtns.substr(y);
			x = iBtns.search("~!");
			
			iBtns = iBtns.substr(x+2);
			y = iBtns.search("~!");
			btnAction = iBtns.substr(0, y);
			iBtns = iBtns.substr(y);
			
			msgText = msgText + '<input class=\'msgBtn\' type=\'button\' value=\''+ btnName +'\' onclick="'+ btnAction+'; window.close();"> ';		
		}
		x = iBtns.search("~!");
	}
	return msgText;
}

function removep(instnum, plytrrn, pgrrn, fromPgm, usage, authflg)
{
	random_num = Math.round((Math.random()*10000)+1);
	var url = 'nxmpage.pgm?task=rmvportlet&pgrrn='+ pgrrn + '&plytrrn='+ plytrrn + '&rand=' + random_num; 
	if (fromPgm == 'NXINSTMNG')
	{
		parent.xl_AjaxUpdate(url);
		var ifr = parpage.parent.xl_GetObj('instframe');
		ifr.src = 'nxinstmng.pgm';
	}
	else
	{
		xl_AjaxUpdate(url);
		var currentPortletObj = 'wc' + instnum;
		xl_GetObj(currentPortletObj).style.display = 'none';
	}
}

function deletep(instrrn, pgrrn, usage, fromPgm, plytrrn, instnum)
{
	random_num = Math.round((Math.random()*10000)+1);
	var url = 'nxmpage.pgm?task=delportlet&pgrrn=' + pgrrn + '&instrrn=' + instrrn + '&rand=' + random_num;
	var mydiv = '';
	if (fromPgm == 'NXINSTMNG')
	{
		parent.xl_AjaxUpdate(url, mydiv, delChild);		
		var ifr = parent.xl_GetObj('instframe');
		ifr.src = 'nxinstmng.pgm';
	}
	else if (fromPgm == 'NXMPAGE')
	{
		xl_AjaxUpdate(url, mydiv, delChild);
		top.location.reload(true);
	}
	else
	{
		xl_AjaxUpdate(url, mydiv, delChild);
		
		var currentPortletObj = 'wc' + instnum;
		xl_GetObj(currentPortletObj).style.display = 'none';
	}
}

function removecnf(instnum, plytrrn, pgrrn, fromPgm, usage, authflg, instrrn)
{
	return_value = confirm('Are you sure you would like to Remove this portlet?');
	
	if (((usage > 1) || (authflg != 'Y')) && (return_value == true))
			removep(instnum,plytrrn,pgrrn,fromPgm,usage,authflg);
	else if (return_value == true)
	{
		if ((usage == 1) && (fromPgm == ''))
			return_value = confirm('This Portlet is currently only used on this page. Do you want to delete this Portlet? (There is no recovery from this operation)');
		else
			return_value = confirm('This Portlet is currently used on ' + usage + ' pages. Are you SURE you want to delete this Portlet? (You cannot recover deleted Portlet instances)'); 

		if (return_value == true)
			deletep(instrrn,pgrrn,usage,fromPgm,'',instnum);
		else
			removep(instnum,plytrrn,pgrrn,fromPgm,usage,authflg);
	}	
}

function deleteportlet(instrrn, pgrrn, usage, fromPgm)
{
	
	if ((usage == 1) && (fromPgm == ''))
			return_value = confirm('This Portlet is currently only used on this page. Do you want to delete this Portlet? (There is no recovery from this operation)'); 
	else
			return_value = confirm('This Portlet is currently used on ' + usage + ' pages. Are you SURE you want to delete this Portlet? (There is no recovery from this operation)'); 

	
	if (return_value == true)
		deletep(instrrn,pgrrn,usage,fromPgm,'',instrrn);
}

function delChild(mydiv, url)
{
	xl_AjaxUpdate(url);
	
	if (ifr)	
	{
		var ifr = parent.xl_GetObj('instframe');
		ifr.src = 'nxinstmng.pgm';
	}
}


function hidecolsel()
{
	if (document.inpform.cpypage.options[document.inpform.cpypage.selectedIndex].value == 0)
		addpgcolumn.style.display = "";
	else
		addpgcolumn.style.display = "none";
}

function vldcolno(btnval) 
{
	
	if (document.inpform.PMPACO.value < hicol)
	{ 
		var userinput = confirm('Portlets exist on columns beyond the number of columns for this page. Click OK to adjust the columns automatically, Cancel to cancel.'); 
		if (userinput == true) 
		{ 
			document.inpform.nxtorfin.value= btnval; 
			document.inpform.submit();
		}
		else 
		{ 
			return false; 
		} 
	} 	
	else	
	{
		document.inpform.nxtorfin.value= btnval; 
		document.inpform.submit();
	}
	
}

function selectpgtype()
{
	if (inpform.addpagetype.selectedIndex == 1) 
	{
		ECM.style.display = "";
		copypage.style.display = "none";
		addpgcolumn.style.display = "none";
	}
	else
	{
		ECM.style.display = "none";
		addpgcolumn.style.display = "";
		copypage.style.display = "";
	}
}

function confirmPageDelete(pgrrn, frompgm, type)
{
	var  return_value;
	
	if (type == 'T')
		return_value = confirm('You are about to permanently delete this ECM Template. If you continue all ECM content that references this Template will be effected. Do you wish to continue?');
	else
		return_value = confirm('You are about to permanently delete this Page. Do you wish to continue?');
	
	if ( return_value == true )
	{
		var url = 'nxmpage.pgm?task=delpage&pgrrn=' + pgrrn + "&rand=" + randnum;
		if (frompgm == 'NXMPAGE')
		{
			xl_AjaxUpdate(url);
			top.location.href = 'NXMENU.pgm';
		}
		else
		{
			var mydiv = 'test'; 
			xl_AjaxUpdate(url, mydiv,loadpages);
		}
	} 
}

function loadpages(mydiv, response)
{
	if (parent.document.docform.pgrrn.value == response)
	{
		top.location.href = 'NXMENU.pgm';
	}
	else
	{
		var ifr = parent.xl_GetObj('instframe2');
		ifr.src = 'NXPAGES.pgm';
	}
}

function loadinst()
{
	xl_GetObj('newoptions').style.display = "";
	var random_num = Math.round((Math.random()*10000)+1);
	
	var myurl = 'nxmpage.pgm?task=selinst&classnbr=' + document.inpform.classnbr.options[document.inpform.classnbr.selectedIndex].value + '&rand=' + random_num;
	var mydiv = "instance";
	
	if (document.inpform.classnbr.options[document.inpform.classnbr.selectedIndex].innerHTML == 'ECM Navigator')
		document.inpform.newwconu.selectedIndex = 1;
	
	xl_AjaxUpdate(myurl, mydiv, Receive_inst_Response); 
}

function Receive_inst_Response(mydiv, response)
{
	document.getElementById(mydiv).innerHTML = response; 
	
	if (document.inpform.instnbr.options[document.inpform.instnbr.selectedIndex].value == 0)
		xl_GetObj('newoptions').style.display = "";
	else
		xl_GetObj('newoptions').style.display = "none";
	
	adjustoptions();
}



function instoptions()
{
	if ((document.inpform.instnbr.options[document.inpform.instnbr.selectedIndex].value == 0) && (document.inpform.instnbr.options[document.inpform.instnbr.selectedIndex].innerHTML == '*New Portlet'))
	xl_GetObj('newoptions').style.display = "";
	else
		xl_GetObj('newoptions').style.display = "none";
	
	setseq();
}

function closeauthwin()
{
	xl_GetObj('auxinfo').style.display = 'none';
}

function setserver(optkey, optvalue) 
{ 
	var url = 'nxblkset.pgm?optkey='+ optkey + '&optvalue='+ optvalue + '&rand=' + Math.round((Math.random()*10000)+1); 
	xl_AjaxUpdate(url);
}  

function setseq() 
{
	var column = document.inpform.newwconu.options[document.inpform.newwconu.selectedIndex].value;
	if (column == 5)
		document.inpform.neworder.value = document.inpform.colhdr.value;
	else if (column == 1)
		document.inpform.neworder.value = document.inpform.colseq1.value;
	else if (column == 2)
		document.inpform.neworder.value = document.inpform.colseq2.value;
	else if (column == 3)
		document.inpform.neworder.value = document.inpform.colseq3.value;
	else if (column == 6)
		document.inpform.neworder.value = document.inpform.colseq4.value;
	else if (column == 4)
		document.inpform.neworder.value = document.inpform.colfoot.value;
	
}

function column() 
{
	if (document.inpform.wnode2.value != 0)
	{
		xl_GetObj('pgcolumn').style.display = "none";
		xl_GetObj('ECM').style.display = "";
	}
	else
	{
		
		columndisplay();
		
		if (document.inpform.PMPACO.value == 1) 
		{
			if (document.inpform.PMCOWI.value == 0)	
				document.inpform.PMCOWI.value = 100;
			
			document.inpform.PMCOW1.value = 0;
			document.inpform.PMCOW2.value = 0;
			document.inpform.PMCOW4.value = 0;
		} 
		
		if (document.inpform.PMPACO.value == 2) 
		{
			xl_GetObj('column1').style.display = "";
			xl_GetObj('column2').style.display = "";
			
			if (document.inpform.PMCOWI.value == 0)	
				document.inpform.PMCOWI.value = 25;
			
			if (document.inpform.PMCOW1.value == 0)
				document.inpform.PMCOW1.value = 75;
			
			document.inpform.PMCOW2.value = 0;
			document.inpform.PMCOW4.value = 0;
		} 
		
		if (document.inpform.PMPACO.value == 3) 
		{
			if (document.inpform.PMCOWI.value == 0)	
				document.inpform.PMCOWI.value = 25;		
			
			if (document.inpform.PMCOW1.value == 0)
				document.inpform.PMCOW1.value = 50;
			
			if (document.inpform.PMCOW2.value == 0)
				document.inpform.PMCOW2.value = 25;
			
			document.inpform.PMCOW4.value = 0;
		} 
		
		if (document.inpform.PMPACO.value == 4) 
		{
			
			if (document.inpform.PMCOWI.value == 0)
				document.inpform.PMCOWI.value = 25;
			
			if (document.inpform.PMCOW1.value == 0)
				document.inpform.PMCOW1.value = 25;
			
			if (document.inpform.PMCOW2.value == 0)
				document.inpform.PMCOW2.value = 25;
			
			if (document.inpform.PMCOW4.value == 0)
				document.inpform.PMCOW4.value = 25;
		} 
	}
}

function columndisplay() 
{
	xl_GetObj('column1').style.display = "none";
	xl_GetObj('column2').style.display = "none";
	xl_GetObj('column3').style.display = "none";
	xl_GetObj('column4').style.display = "none";
	
	
	if (document.inpform.PMPACO.value == 1) 
	{
		xl_GetObj('column1').style.display = "";
	} 
	
	if (document.inpform.PMPACO.value == 2) 
	{
		xl_GetObj('column1').style.display = "";
		xl_GetObj('column2').style.display = "";
	} 
	
	if (document.inpform.PMPACO.value == 3) 
	{
		xl_GetObj('column1').style.display = "";
		xl_GetObj('column2').style.display = "";
		xl_GetObj('column3').style.display = "";
	} 
	
	if (document.inpform.PMPACO.value == 4) 
	{
		xl_GetObj('column1').style.display = "";
		xl_GetObj('column2').style.display = "";
		xl_GetObj('column3').style.display = "";
		xl_GetObj('column4').style.display = "";
	} 
}

function edtpage()
{
	xl_GetObj('pg1').className = "tabsel";
	xl_GetObj('pg2').className = "tab";
	xl_GetObj('pg3').className = "tab";
	
	xl_GetObj('pagedsp1').style.display = "";
	xl_GetObj('pagedsp2').style.display = "none";
	xl_GetObj('pagedsp3').style.display = "none";
}

function wrkportlets()
{
	xl_GetObj('pg1').className = "tab";
	xl_GetObj('pg2').className = "tabsel";
	xl_GetObj('pg3').className = "tab";
	
	xl_GetObj('pagedsp1').style.display = "none";
	xl_GetObj('pagedsp2').style.display = "";
	xl_GetObj('pagedsp3').style.display = "none";
}

function wrkpages()
{
	xl_GetObj('pg1').className = "tab";
	xl_GetObj('pg2').className = "tab";
	xl_GetObj('pg3').className = "tabsel";
	
	xl_GetObj('pagedsp1').style.display = "none";
	xl_GetObj('pagedsp2').style.display = "none";
	xl_GetObj('pagedsp3').style.display = "";
}

/**************************************** End Admin Functions *****************************************/

function xl_event() 
{ 
	if (window.event) return window.event; 
	else return ff_event;
	
}	 

/**************************************** Start authority functions *****************************************/


function clearform()
{
	document.formfilt.filter1.value = "";
	
	if (document.formfilt.mrulist.value == 'Y')
		document.formfilt.mrulist.value = '';
	else
		document.formfilt.mrulistvalue = 'Y';
	
	document.formfilt.submit();
}


function handleKeyUp(e, divname) 
{
	e = (!e) ? window.event : e;
	target = (!e.target) ? e.srcElement : e.target;
	
	if (e.type == "keyup") 
	{
		if (e.keyCode == 16 || e.keyCode == 17 || e.keyCode == 18) 
		{
			
		}
		else if (((e.keyCode == 40) || (e.keyCode == 38)) && (xl_GetObj('result_div').style.display != 'none'))
		{
			var children = xl_GetObj('result_div').childNodes;
			
			if (e.keyCode == 38)
			{
				if (trackdown > children.length)
					trackdown = children.length - 1;
				else
					trackdown--;
				
				if (trackdown < 0)
				{
					
					children[0].className = '';
					trackdown = -1;
					xl_GetObj('filter1').value = saveselect;
					return;
				}
			}
			else
			{
				if (trackdown == -1)
					saveselect = xl_GetObj('filter1').value;
				
				trackdown++;
			}
			
			
			if (trackdown >= children.length)
			{
				trackdown--;
			}
			
			for (var i = 0; i < children.length; i++) 
			{
				children[i].className = '';
				if ((children[i].nodeName == "DIV") && (trackdown == i))
				{
					selectedObj = children[i];
				}
			}
			
			selectedObj.className = 'sellink';
			var objtext = selectedObj.id + 'name';
			xl_GetObj('filter1').value = xl_GetObj(objtext).innerHTML;
		}
		else if ((e.keyCode == 13) && (xl_GetObj('result_div').style.display != 'none'))
		{
			var addtype = selectedObj.id.substring(0,1);
			var grpusrnbr = selectedObj.id.substring(1,8);
			var authtype = selectedObj.id.substring(8,18);
			addauth(grpusrnbr, authtype, addtype);
			
			xl_GetObj('result_div').style.display = 'none';
			xl_GetObj('filter1').value = '';
			return false;
		}
		else 
		{
			trackdown = -1;
			if (target.value) 
			{
				Send_AJAX_Request(target);
			} 
			else 
			{
				var resdiv= document.getElementById(divname); 
				resdiv.innerHTML = "";
				resdiv.style.display = "none"; 
			}
		}
	}
}

function clearDiv(divname)
{
	var resdiv= xl_GetObj(divname); 
	resdiv.innerHTML = "";
	resdiv.style.display = "none"; 
}

function Send_AJAX_Request(target) 
{ 
	randnum = Math.round((Math.random()*10000)+1); 
	myurl = "NXAUTHPOP.pgm?task=ajaxresp&rand=" + randnum + "&filter1=" + encodeURIComponent(target.value) + "&authtype=" + document.inpform.authtype.value; 
	mydiv = xl_GetObj('result_div'); 
	xl_AjaxUpdate(myurl, mydiv, authselect_Response); 
} 	

function authselect_Response(mydiv, response)
{
	var inpbox = xl_GetObj('filter1');
	if (response != '')
	{
		mydiv.innerHTML = response; 
		mydiv.style.display = "block"; 
		
		mydiv.style.left= xl_FindPosX(inpbox) + "px";
		mydiv.style.top= xl_FindPosY(inpbox) + 21 + "px";
	}
	else
		mydiv.style.display = 'none';
}


function addauth(grpusrnbr, authtype, addtype, type)
{
	var mydiv
	var url;
	var randnum = Math.round((Math.random()*10000)+1);
	
	if (type == undefined)
		type = '*READ';
	
	if (authtype == "ECM")
	{
		url = "nxauthpop.pgm?task=addauth&addtype=" + addtype + "&grpusrnbr=" + grpusrnbr + "&authlvl=" + type + "&authtype=" + authtype + "&docnum=" + parent.document.inpform.docnum.value  + "&rnd=" + randnum;
	}
	else if (authtype == "PROCDIR")
	{
		url = "nxauthpop.pgm?task=addauth&addtype=" + addtype + "&grpusrnbr=" + grpusrnbr + "&authtype=" + authtype  + "&prtnbr=" + parent.document.inpform.prtnbr.value + "&rnd=" + randnum;
	}
	else if (authtype == "RULE")
	{
		url = "nxauthpop.pgm?task=addauth&addtype=" + addtype + "&grpusrnbr=" + grpusrnbr + "&authtype=" + authtype  + "&rulenum=" + parent.document.inpform.rulenum.value + "&rnd=" + randnum + "&authlvl=" + type;
	}
	else if (authtype == "PORTLET")
	{
		url = "nxauthpop.pgm?task=addauth&addtype=" + addtype + "&grpusrnbr=" + grpusrnbr + "&authtype=" + authtype  + "&instnbr=" + parent.document.inpform.instnbr.value + "&rnd=" + randnum + "&authlvl=" + type;
	}
	else if (authtype == "CAL")
	{
		url = "nxauthpop.pgm?task=addauth&addtype=" + addtype + "&grpusrnbr=" + grpusrnbr + "&authtype=" + authtype  + "&instnbr=" + parent.document.inpform.instnbr.value + "&rnd=" + randnum + "&authlvl=" + type + "&TDSENU=" + parent.document.inpform.TDSENU.value + "&smurf=" + parent.document.inpform.smurf.value;
		xl_AjaxUpdate(url, mydiv, Rcv_AJAX_addCalauth);
		return;
	}
	else if ((authtype == "MENU") || (authtype == "MENUITEM"))
	{
		url = "nxauthpop.pgm?task=addauth&addtype=" + addtype + "&grpusrnbr=" + grpusrnbr + "&authtype=" + authtype  + "&mnurrn=" + parent.document.inpform.mnurrn.value + "&rnd=" + randnum + "&authlvl=*READ";
	}
	else
	{
		url = "nxauthpop.pgm?task=addauth&addtype=" + addtype + "&grpusrnbr=" + grpusrnbr + "&authlvl=" + type + "&authtype=" + authtype  + "&rnd=" + randnum;
	}
	
	
	if (authtype == "PROCDIR")
		xl_AjaxUpdate(url, mydiv, Rcv_AJAX_addprdauth);
	else
		xl_AjaxUpdate(url, mydiv, Rcv_AJAX_addauthority);
}

function Rcv_AJAX_addCalauth(mydiv, response)
{
	if (response == "")
		alert("You are not authorized to this group or user");
	else
	{
		parent.xl_GetObj('addedauths').innerHTML = parent.xl_GetObj('addedauths').innerHTML + response;	
		parent.parent.setprivate();
	}
}

function Rcv_AJAX_addprdauth(mydiv, response)
{
	if (response == "")
		alert("You are not authorized to this group or user");
	else
	{
		parent.xl_GetObj('addedauths').innerHTML = parent.xl_GetObj('addedauths').innerHTML + response;	
	}
}

function Rcv_AJAX_addauthority(mydiv, response)
{
	if (response == "")
		alert("You are not authorized to this group or user");
	else
		parent.xl_GetObj('addedauths').innerHTML = parent.xl_GetObj('addedauths').innerHTML + response;	
	
	if (parent.parent.adjustIFrameSize) parent.parent.adjustIFrameSize(parent.window);
}


function delauth(authtype, rrn, docnum)
{
	var mydiv = rrn;
	var randnum = Math.round((Math.random()*10000)+1);
	
	if (authtype == "ECM")
	{
		url = "nxauthpop.pgm?task=delauth&rrn=" + rrn + "&authtype=" + authtype  + "&rnd=" + randnum + "&docnum=" + docnum;
	}
	else if (authtype == "RULE")
	{
		url = "nxauthpop.pgm?task=delauth&rrn=" + rrn + "&authtype=" + authtype  + "&rnd=" + randnum + "&rulenum=" + docnum;
	}
	else if (authtype == "CAL")
	{
		url = "nxauthpop.pgm?task=delauth&rownbr=" + rrn +"&authtype=" + authtype  + "&rnd=" + randnum + "&smurf=" + parent.document.inpform.smurf.value;
		xl_AjaxUpdate(url, mydiv, Rcv_AJAX_DltCalAuth);
		return;
	}
	else
	{
		url = "nxauthpop.pgm?task=delauth&rrn=" + rrn + "&authtype=" + authtype  + "&rnd=" + randnum;
	}
	
	xl_AjaxUpdate(url, mydiv, Rcv_AJAX_DltAuth);
}

function dltallauth()
{
	var url = "nxauthpop.pgm?task=delauth&authtype=ALLCAL&rnd=" + randnum + "&smurf=" + document.inpform.smurf.value;
	var mydiv;
	xl_AjaxUpdate(url, mydiv, Rcv_AJAX_DltAllAuth);
}

function  Rcv_AJAX_DltAllAuth()
{
	
	var children = xl_GetObj('authframe').contentWindow.xl_GetObj('addedauths').childNodes; 
	for (var i = 0; i < children.length; i++) 
	{
		if (children[i].nodeName == "DIV")
			children[i].style.display = 'none';
	}
	
	var children = xl_GetObj('authframe').contentWindow.xl_GetObj('selauth').childNodes; 
	for (var i = 0; i < children.length; i++) 
	{
		if ((children[i].nodeName == "DIV") && (children[i].id != 'norecords'))
			children[i].style.display = 'none';
	}
	
	setprivate();
}

function chgauth(authtype, rrn, docnum)
{
	if (authrrn != 0)
	{
		setAuthLvl();
	}
	
	var chgid = "chg" + rrn;
	var sltid = "slt" + rrn;
	
	authrrn = rrn;
	
	var authtype = '*' + xl_GetObj(chgid).innerHTML.toUpperCase(); 
	xl_GetObj(chgid).innerHTML = '';
	
	var authlvl = document.inpform;
	j = authlvl.chglevel.length;
	
	for (i=0; i<j; i++)
	{
		if(authlvl.chglevel[i].value == authtype)
		{ 
			authlvl.chglevel[i].checked = true;
			break;
		}
	}
	
	xl_GetObj(sltid).innerHTML = xl_GetObj('chgauthlvl').innerHTML;
	
}

function updauth()
{
	var sltid = "slt" + authrrn;
	var chgid = "chg" + authrrn;
	randnum = Math.round((Math.random()*10000)+1);
	
	var authlvl = document.inpform;
	j= authlvl.chglevel.length;
	
	for (i=0; i<j; i++)
	{
		if(authlvl.chglevel[i].checked) var type = authlvl.chglevel[i].value
	}
	
	if (type != "undefined")
	{
		if (document.inpform.authpgm.value == "RULE")
			url = "nxauthpop.pgm?task=chgauth&rrn=" + authrrn + "&authlvl=" + type + "&authtype=" + document.inpform.authpgm.value + "&rulenum=" + document.inpform.rulenum.value + "&rnd=" + randnum;
		else if (document.inpform.authpgm.value == "ECM")
			url = "nxauthpop.pgm?task=chgauth&rrn=" + authrrn + "&authlvl=" + type + "&authtype=" + document.inpform.authpgm.value + "&docnum=" + document.inpform.docnum.value + "&rnd=" + randnum;
		else if (document.inpform.authpgm.value == "PORTLET")
			url = "nxauthpop.pgm?task=chgauth&rrn=" + authrrn + "&authlvl=" + type + "&authtype=" + document.inpform.authpgm.value + "&instnbr=" + document.inpform.instnbr.value + "&rnd=" + randnum;
		else if (document.inpform.authpgm.value == "CAL")
			url = "nxauthpop.pgm?task=chgauth&rownbr=" + authrrn + "&authlvl=" + type + "&authtype=" + document.inpform.authpgm.value + "&instnbr=" + document.inpform.instnbr.value + "&rnd=" + randnum + "&smurf=" + parent.document.inpform.smurf.value;
		
		var mydiv;
		xl_AjaxUpdate(url, mydiv, Rcv_AJAX_chgAuth);
	}
	else
		authrrn = 0;
}

function chgauthexclude(authtype, rrn, exclude)
{
	var mydiv = rrn;
	var randnum = Math.round((Math.random()*10000)+1);
	
	url = "nxauthpop.pgm?task=chgauth&rrn=" + rrn + "&authtype=" + authtype  + "&rnd=" + randnum + "&exclude=" + exclude;
	var mydiv;
	xl_AjaxUpdate(url, mydiv);
}

function chgauthemail(authtype, rrn, email)
{
	var mydiv = rrn;
	var randnum = Math.round((Math.random()*10000)+1);
	
	url = "nxauthpop.pgm?task=chgauth&rrn=" + rrn + "&authtype=" + authtype  + "&rnd=" + randnum + "&email=" + email;
	var mydiv;
	xl_AjaxUpdate(url, mydiv);
}


function Rcv_AJAX_chgAuth(mydiv, response)
{
	if (response = "Changed")
	{
		setAuthLvl();
	}
}

function setAuthLvl()
{
	var sltid = "slt" + authrrn;
	var chgid = "chg" + authrrn;
	
	var authlvl = document.inpform;
	j= authlvl.chglevel.length;
	
	for (i=0; i<j; i++)
	{
		if(authlvl.chglevel[i].checked) var type = authlvl.chglevel[i].value;
	}
	
	if (type == "*READ")
		type = "Read";
	else if (type == "*WRITE")
		type = "Write";
	else if (type == "*ADMIN")
		type = "Admin";
	
	xl_GetObj(sltid).innerHTML = '';	
	xl_GetObj(chgid).innerHTML = type;
	authrrn = 0;
}


function Rcv_AJAX_DltAuth(mydiv, response)
{
	if (response == "Deleted")
		xl_GetObj(mydiv).style.display = 'none';
	
	if ((document.inpform.authpgm.value != 'PROCDIR') && (parent.adjustIFrameSize)) parent.adjustIFrameSize(window);
}

function Rcv_AJAX_DltCalAuth(mydiv, response)
{
	if (response == "Deleted")
	{
		xl_GetObj(mydiv).style.display = 'none';
		parent.setprivate();
	}
	
	if ((document.inpform.authpgm.value != 'PROCDIR') && (parent.adjustIFrameSize)) parent.adjustIFrameSize(window);
}

function loadControl()
{
	setuptabs();
	loadportlets();
	curformdspmode();
}

function chgblkstate(blocknbr, myurl, ajax, optkey) 
{ 
	var wcdiv = 'wcdiv'+blocknbr; 
	var ifrmid = 'ifrm'+blocknbr; 
	var wcdivobj = xl_GetObj(wcdiv); 
	var wcimg = 'wcimg'+blocknbr; 	
	var newstate =''; 
	myurl = myurl + "&rndnum=" + Math.round((Math.random()*1)+1);
	
	img = xl_GetObj(wcimg);
	
	if ((xl_GetObj(wcdiv).style.display != "none"))
	{
		wcdivobj.style.display = "none";
		img.src = "/nexuspublic/images/expand.gif";
		img.alt = "Expand"; 
		newstate='C';
	} 
	else 
	{
		if (myurl.search('nourl') == -1)
		{ 
			if (ajax == 'Y')
			{
				var mydiv = wcdivobj;
				xl_AjaxUpdate(myurl, mydiv,loadinclude);
			}
			else
			{
				wcdivobj.innerHTML = '<iframe name="'+ ifrmid +'" id="'+ ifrmid +'" src="' + myurl+ '" scrolling=auto height="500" width=100% frameborder=0 style="">No IFRAME support</iframe>';
			}
		}
		else
		{
			loaddocchk();	
		}
		
		wcdivobj.style.display = "block";
		img.src = "/nexuspublic/images/collapse.gif"; 
		img.alt = "Collapse";
		newstate=''; 
	}
	
	setserver(optkey,newstate);	
} 

function chglnkstate(blocknbr) 
{ 
	var wcimg = 'wcimg'+blocknbr; 
	img = xl_GetObj(wcimg);
	x=img.src;
	if (link.style.display == "") 
	{ 
		link.style.display = "none";
		img.src = "/nexuspublic/images/expand.gif";
		img.alt = "Expand"; 
	} 
	else 
	{
		link.style.display = "";
		img.src = "/nexuspublic/images/collapse.gif"; 
		img.alt = "Collapse";
	}
} 

function insidepageurl(newurl) {
	var t_frame= xl_GetObj("insert");  
	t_frame.style.display  = ''; 
	
	t_frame= xl_GetObj("insert2"); 
	t_frame.style.display  = ''; 
	
	xl_GetObj('dyniframe').src= newurl;
}

function loadwcdiv(blocknbr , loadstate, myurl, height, width, autoscroll, wdw, icons, ajax) 
{ 
	var wcdiv = 'wcdiv'+blocknbr; 
	var ifrmid = 'ifrm'+blocknbr; 
	var wcimg = eval('document.wcimg'+blocknbr);
	var wcdivobj = xl_GetObj(wcdiv); 
	
	var randnum = Math.round((Math.random()*10000)+1);
	myurl = myurl + "&rndnum=" + randnum;
	
	if ((wdw != '1') && (wdw != '2'))
	{
		if (icons == 'Y')
		{
			img = eval('document.wcimg'+blocknbr);
			x=img.src;
		}
		
		if (loadstate != 'C') 
		{ 
			if (ajax == 'Y')
			{
				var mydiv = wcdivobj;
				xl_AjaxUpdate(myurl, mydiv,loadinclude);
			}
			else
			{
				wcdivobj.innerHTML = '<iframe name="'+ ifrmid +'" id="'+ ifrmid +'" src="' + myurl + '" scrolling="' + autoscroll + '" height="' + height + '" width="100%" frameborder=0 style="" marginwidth="0" marginheight="0">No IFRAME support</iframe>';
			}
		} 
	}
	else
	{	
		if (wdw == '1')
		{
			var position = 'scrollbars=1,resizable=1,height=' + height + ',width=' + width +',left=015,top=045';
			window.open(myurl, 'open_window', position);
		}
	}
} 

function loadinclude(mydiv, response)
{
	mydiv.innerHTML = response;	
}

function loaddocchk()
{
	var ifr = xl_GetObj('ifrmviewdoc');
	
	// RTC 20080811: This interferes with minimizing and expanding the viewer
	//xl_GetObj('ifrmviewdoc').style.height = '0px';

	/* RTC 20080717: trying to categorize the page DOM type this way is not going to work, removing for now
	// The document types which would be used as a top level frame and do not provide DOM height information 
	// will be handled as exceptions. The default behavior is to attempt to use size using the HTML
	if ((ifr.src.search(/.htm/i) == -1) && (ifr.src.search(/.pgm/i) == -1) && (ifr.src.search(/.gif/i) == -1) && (ifr.src.search(/.jpg/i) == -1) && (ifr.src.search(/.txt/i) == -1))
	{
		setTimeout('setiframesize()', 300);
		
	}
	else
	*/
	if ( (ifr.src.search(/.pdf/i) > -1) 
	  || ( ifr.src.search(/.doc/i) > -1))
		setTimeout('setiframesize()', 300);
	else
		xl_AttachEvent(ifr, "load", setiframesize);
	// ... end RTC 20080717
	
}


function setiframesize()
{
	xl_GetObj('loading').style.display = "none";
	
	try 
	{ 
		var the_height = xl_GetObj('ifrmviewdoc').contentWindow.document.body.scrollHeight + 40; 
		
		if (the_height == 40)
			xl_GetObj('ifrmviewdoc').style.height = dociframeHeight + 'px'; 
		else
			xl_GetObj('ifrmviewdoc').style.height = the_height + 'px';
	} 
	catch(err) 
	{
		xl_GetObj('ifrmviewdoc').style.height = dociframeHeight + 'px'; 
	}  
	
	xl_DetachEvent(xl_GetObj('ifrmviewdoc'), "load", setiframesize);
} 

function showorhide(imgname,optkey,optvalue) 
{ 
	var tdsbmform = xl_GetObj("tdsbmform");
	var tdsbmform2 = xl_GetObj("tdsbmform2");
	
	if (flipper == '') 
	{
		
		Column2Width = tdsbmform2.width;
		tdsbmform2.width = column2 + column1 + '%';
		tdsbmform.style.display  = 'none'; 
		optvalue = 'C'; 
		flipper = 'C';
		
		if (document.images) 
		{ 
			document.images[imgname].src = '/nexuspublic/images/openbar.gif'; 
			document.images[imgname].alt = "Show Left Column"; 
		} 
	}
	else 
	{
		tdsbmform2.width = column2 + '%';
		tdsbmform.style.display = 'inline'; 
		optvalue = '';  
		flipper = '';
		
		if (document.images) 
		{ 
			document.images[imgname].src = '/nexuspublic/images/closebar.gif'; 
			document.images[imgname].alt = "Hide Left Column"; 
		} 

		Reload_Navigators();
	} 
	
	setserver(optkey, optvalue); 
}

function curformdspmode() 
{ 	
	var tdsbmform = xl_GetObj("tdsbmform"); 
	var tdsbmform2 = xl_GetObj("tdsbmform2"); 
	
	displayCorners();
	
	try 
	{
		if (nbrColumn1 != 1)
		{  
			if (flipper == 'C') 
			{ 
				tdsbmform.style.display = 'none';
				Column2Width = tdsbmform2.width;
				tdsbmform2.width = column2 + 1 + column1 + '%';
				xl_GetObj('colhider').src = '/nexuspublic/images/openbar.gif';
			}
			else 
			{
				tdsbmform.style.display = '';
				tdsbmform2.width = column2 + 1 + '%';
				xl_GetObj('colhider').src = '/nexuspublic/images/closebar.gif';
			}
		}
		else	
		{		
			
			tdsbmform.width = column1 + 1 + '%';
		}
		
	}
	catch(err) 
	{
	}
	
	if ((document.docform.lnknum.value != '0000000') && (xl_GetObj('ifrmviewdoc')))
	{
		if (document.docform.docnum.value != '000000000')
		{
			if (reSize == 'Y')
			{
				var activewidth = xl_GetObj('ifrmviewdoc').contentWindow.document.body.scrollWidth - 10;
				
				xl_GetObj('ifrmviewdoc').contentWindow.document.body.innerHTML = "<image src=\"" + ECMDocument + "\" style=\"width:" + activewidth  + "px\">";
			}
			else
			{
				//xl_GetObj('ifrmviewdoc').contentWindow.location.replace(ECMDocument);
				xl_GetObj('ifrmviewdoc').src = ECMDocument;
			}
			
			dociframeHeight = document.body.clientHeight;
			xl_GetObj('ifrmviewdoc').style.height = dociframeHeight + 'px';
		}
		else
		{
			xl_GetObj('ifrmviewdoc').src = 'NXMNGDOC.pgm?task=nodoc';
			xl_GetObj('ifrmviewdoc').style.height = dociframeHeight + 'px';
		}

		loaddocchk();
	}
	else
	{
		loadsearch();
	}	
	
	setTimeout('scroll(0,0);', 200);
	
}

function loadsearch()
{
	if (searchURL != "")
	{ 	
		searchdoc(searchURL);
	} 
}


function loaddocs(docnum)
{
	top.location.href = 'nxmenu.pgm?docnum=' + docnum;	
}

function SetNavOptions()
{
	if (document.inpform.fixedsize.checked == true) 
		document.inpform.navheight.disabled = false;
	else
		document.inpform.navheight.disabled = true;
	
	if (document.inpform.navheight.value == '')
		document.inpform.navheight.value = 500;
}

/**************************************** End authority functions *****************************************/



/****************************************Start ECM Functions *********************************************/

function ecm_restore() 
{ 
	xl_GetObj('listsize').value = "   20";
	xl_GetObj('ORDBYKEY').value = "DMRLNM";
	xl_GetObj('maintrcd').checked = "checked";
	xl_GetObj('advview').checked = "checked";
	xl_GetObj('usersearch').checked = "";
	xl_GetObj('instancesrch').checked = "";
	xl_GetObj('aplyauth').checked = "";
	xl_GetObj('quickadd').value = "";
	xl_GetObj('allowsrch').checked = "checked";
	xl_GetObj('advsearch').checked = "";
	xl_GetObj('useand').value = "";
	xl_GetObj('rstrctkey').value = "";
	xl_GetObj('allowkv').checked = "checked";
	xl_GetObj('addkv').value = "";
	xl_GetObj('rstrcttoinst').value = "";
	xl_GetObj('optkv').checked = "";
	xl_GetObj('searchstr2').value = "";
	xl_GetObj('addsearch').checked = "checked";
	xl_GetObj('optaddsrch').checked = "checked";
	xl_GetObj('appsrchstr').value = "";
	xl_GetObj('addappend').checked = "checked";
	xl_GetObj('optaddapnd').checked = "checked";
}

function addQuickItem()
{
	if ((xl_GetObj('create_in')) && (document.quickform.nodename2.value == ""))
	{
		alert('The Create after location can not be blank. Please use the icon on the right to select a Folder.');
		xl_GetObj('create_in').className = 'error';
		return;
	}
	
	if (document.quickform.title.value == '')
	{
		var z = 0;
		var endpos = 256;
		
		for (var x = 256; x >= 0; x--) 
		{ 
			z = z + 1;
			var y = xl_GetObj('url').value.substring(x,x - 1);
			
			if (((y == '.') || (y == '/')) && (endpos != 256))  
				break;
			
			if (y == '.') 
				endpos = x - 1;       	
		}
		
		
		if (x > 0)
			xl_GetObj('title').value = xl_GetObj('url').value.substring(x,endpos); 
		
	}
	
	if (document.quickform.ECMType.value != "Folder")
	{
		var exttype = getExtension(xl_GetObj('url').value);
		
		if (exttype == "PGM")
			document.quickform.ECMType.value	= exttype;
	}
	
	var errorflg = val_InpChar('title', 'Name', xl_GetObj('doc_name'),'N');
	if (errorflg != 'Y')
	{
		var randnum = Math.round((Math.random()*10000)+1);
		var url ="NXADDECM.pgm?task=addECMcnt&rand="+randnum + "&inFolder=" + document.quickform.infolder.value + "&type=" + document.quickform.ECMType.value + "&ECMtype=" + document.quickform.ECMType.value + "&title=" + document.quickform.title.value + "&wnode2=" + document.quickform.wnode2.value + "&instance=" + document.quickform.instance.value + "&targetmtch=" + document.quickform.targetmtch.options[document.quickform.targetmtch.selectedIndex].value + "&url=" + encodeURIComponent(document.quickform.url.value) + "&favorites=" + document.quickform.favorites.value + "&framename=" + document.quickform.framename.value;
		
		var optvalue = document.quickform.targetmtch.options[document.quickform.targetmtch.selectedIndex].value;
		var optkey = "FAVORITESTARGET";
		setserver(optkey, optvalue);
		
		if (document.quickform.favorites.value == 'Y')
		{
			var ifr = document.all ? top.frames['block_page'].document.all['favframe'] : top.frames['block_page'].document.getElementById('favframe');
			ifr.src = url;
		}
		else
		{
			var ifr = document.all ? top.frames['block_page'].document.all['quickframe'] : top.frames['block_page'].document.getElementById('quickframe');
			ifr.src = url;
		}
	}
} 


function getExtension(url, exttype)
{
	var z = 0;
	var endpos;
	
	z = 0;
	for (var x = 255; x >= 0; x--) 
	{ 
		z = z + 1;
		var y = url.substring(x,x - 1);
		
		if (y == ".") 
		{ 
			break;
		} 
	}
	
	exttype = url.substring(x,z).toUpperCase();
	
	return exttype;
}

function createECMcnt()
{
	if ((xl_GetObj('create_in')) && (document.inpform.nodename2.value == ''))
	{
		alert('The create after location can not be blank. Please use the icon on the right to select a Folder.');
		xl_GetObj('create_in').className = 'error';
		return;
	}
	
	
	var errorflg = val_InpChar('title', 'Name', xl_GetObj('doc_name'),'N');
	if (errorflg != 'Y')
	{
		var randnum = Math.round((Math.random()*10000)+1);
		var optvalue = document.inpform.targetmtch.options[document.inpform.targetmtch.selectedIndex].value;
		var optkey = "FAVORITESTARGET";
		setserver(optkey, optvalue);
		
		if (xl_GetObj('ECMType').value == 'HTML')
		{
			xl_GetObj('loadingfile').style.display = '';		
			xl_GetObj('taskdesc2').value = oEdit1.getHTMLBody();
			xl_GetObj('ECMType').value = "HTML";
			document.inpform.type.value = "html";
			
			if (document.forms.inpform.taskdesc2.value.length <= 50000)
				document.forms.inpform.submit();
			else
				alert('Error: The documented you attempted to add is ' + document.forms.inpform.taskdesc2.value.length + ' characters. The maximum size for documents created in the Nexus ECM is 50,000 characters.');
		}
		else if (xl_GetObj('ECMType').value == 'document')
		{
			if (xl_GetObj('upfile').value == '')
			{
				alert('You must enter a vaild path. Use the Browse button to enter a path.');
				xl_GetObj('pcfile').className = 'error';
				return;
			}
			
			xl_GetObj('loadingfile').style.display = '';
			xl_GetObj('ECMType').value = "document";
			document.inpform.type.value = "document";
			
			document.forms.inpform.submit();
		}
	}
} 

function EndQuickAdd(framename)
{
	parent.xl_GetObj('quickadd2').style.display = 'none';
	parent.xl_GetObj('quickadd').style.display = 'none';
	
	if (framename == 'favframe')
	{
		var randnum = Math.round((Math.random()*10000)+1);
		var url = "NXMNGDOC.PGM?task=viewfavorites&type=V&favorites=Y&rand=" +  randnum;
		parent.xl_GetObj(framename).src = url;
	}	
	else
	{
		parent.Reload_Navigators();
	}
}


function Reload_Navigators()
{
	var t;
	for (t = 0; t < ECMNavigatorctr; t++)
	{
		
		if (xl_GetObj(ECMNavigators[t]))
		{
			var randnum = Math.round((Math.random()*10000)+1);
			var ifr = xl_GetObj(ECMNavigators[t]);
			ifr.src = ifr.src + '&rnd=' + randnum;
		}
	}
	
	// RTC 20080722: If there is an ECM viewer, we need to recalculate its height with the
	// new, smaller width. This only affects firefox.
	var viewer = document.getElementById('ifrmviewdoc');
	if(viewer)
	{
		if(viewer.contentWindow)
		{
			adjustIFrameSize(viewer.contentWindow);
		}			
	}
	// ... end RTC 20080722
}

function openTree3()
{
	if (openIndex >= 0)
	{
		myid = 'mi' + openArray[openIndex];
		if (xl_GetObj(myid) && ((xl_GetObj(myid).innerHTML) || (xl_GetObj(myid).innerHTML == '')))
		{
			var ajaxurl = "NXMNGDOC.pgm" + "?task=EXPAND&ALPHNODE="+ openArray[openIndex] + "&wnode=" + currentNode + "&type="+ listType + "&instance=" + instance + "&rndnum=" + randnum; 
			xl_AjaxUpdate(ajaxurl, myid, openTree2);
		}
		else
		{
			openIndex = openIndex - 1;
			openTree3();
		}
	}
}

function init()
{ 
	xl_DOM = new xl_oDOMFeats(); 
	xl_AttachEvent(document, "click", ClickHandler);
	xl_AttachEvent(document, "mouseover", ChgStatusBar);
	xl_AttachEvent(document, "mouseout", ClrStatusBar);
	
	openTree();
	
	if (listType != 'M')
	{	
		if ((fixedsize == 'Y') || (listType != 'V'))
		{
			var iframeElement = parent.xl_GetObj(window.name);
			xl_GetObj('content').style.height = navheight + 'px';
			
			iframeElement.style.height = navheight + xl_GetObj('topbanner').offsetHeight + 'px'; 
		}
		else if (listType == 'V')
		{
			adjustSize = true;
		}
		
		if (listType == 'V')
			xl_AttachEvent(document, "mousedown", RightClickHandler);
	}
	
	if (adjustSize)
	{	 
		sizeNavigator();
	}
} 

function UpdNavConfig()
{
	var formName = 'inpform';
	var ajaxurl = 'NXMNGDOC.pgm';
	ajaxurl = xl_BuildURLWithFormElements(formName, ajaxurl);
	ajaxurl = ajaxurl + "&rnd=" + Math.round((Math.random()*10000)+1);
	xl_AjaxUpdate(ajaxurl, 'none', Rcv_AJAX_NavUpd);	
} 

function Rcv_AJAX_NavUpd(framename, response)
{
	top.location.reload();
}

function expandFolder(EventObj)
{
	var children = EventObj.childNodes; 
	for (var i = 0; i < children.length; i++) 
	{
		if (children[i].nodeName == "A") 
		{
			EventObj = children[i];
			break; 
		}
	}
	
	if (EventObj.tagName == "A")
	{
		if (EventObj.parentNode.className =="nxFolder" || EventObj.parentNode.className=="nxOpFolder" || EventObj.parentNode.className =="nxFavFolder" || EventObj.parentNode.className=="nxOpFavFolder") 
		{
			if ((EventObj.parentNode.className == "nxFolder") || (EventObj.parentNode.className == "nxFavFolder"))
			{
				children = EventObj.parentNode.childNodes; 
				for (var i = 0; i < children.length; i++) 
				{
					if (children[i].nodeName == "UL") 
					{
						var myid = children[i].id;
						break;
					}
				}	
				
				if (!myid)
				{
					return false;
				}
				
				if (xl_GetObj(myid).innerHTML.length <= 1)
				{	
					ajaxurl = "NXMNGDOC.pgm?task=EXPAND&ALPHNODE="+ myid + "&wnode=" + currentNode + "&urltype=" + urltype + "&favorites=" + favorites + "&type=" + listType + "&instance=" + instance + "&rndnum=" + randnum; 	
					xl_AjaxUpdate(ajaxurl, myid, expandtree); 
				}
			}
			else
			{	   	
				if (adjustSize)
				{	 
					sizeNavigator();
				}
			} 
			
			if (EventObj.parentNode.className == 'nxOpFolder')
				EventObj.parentNode.className = 'nxFolder';
			else if (EventObj.parentNode.className == 'nxFolder')
				EventObj.parentNode.className = 'nxOpFolder';
			else if (EventObj.parentNode.className == 'nxOpFavFolder')
				EventObj.parentNode.className = 'nxFavFolder';
			else if (EventObj.parentNode.className == 'nxFavFolder')
				EventObj.parentNode.className = 'nxOpFavFolder';
		}		
	}
}

function expandtree(myid, response)
{ 
	xl_GetObj(myid).innerHTML = response;  
	
	sizeNavigator();
}  

function loadDocument(EventObj)
{
	if (EventObj.tagName == 'LI')
	{
		children = EventObj.childNodes; 
		for (var i = 0; i < children.length; i++) 
		{
			if (children[i].nodeName == "A") 
			{
				EventObj = children[i];
				break;
			}
		}	
	}
	
	if (listType == "M")
	{
		if (savSelObj)
		{
			if ((savSelObj.className.substring(2,4) == 'Op') && (savSelObj.className != 'nxOpFolder') && (savSelObj.className != 'nxFolder') && (savSelObj.className != 'nxOpFavFolder') && (savSelObj.className != 'nxFavFolder'))
				savSelObj.className = savSelObj.className.substring(0,2) + savSelObj.className.substring(4);
			
			children = savSelObj.childNodes; 
			for (var i = 0; i < children.length; i++) 
			{
				if (children[i].nodeName == "A") 
				{
					children[i].className = '';
					break;
				}
			}	
		}
		
		savSelObj = EventObj.parentNode;
		
		
		if ((EventObj.parentNode.className.substring(2,4) != 'Op') && (EventObj.parentNode.className != 'nxOpFolder') && (EventObj.parentNode.className != 'nxFolder') && (EventObj.parentNode.className != 'nxOpFavFolder') && (EventObj.parentNode.className != 'nxFavFolder'))
			EventObj.parentNode.className = EventObj.parentNode.className.substring(0,2) + 'Op' + EventObj.parentNode.className.substring(2);
	}
	
	if (EventObj.href)
	{
		// remove the selected class from all the link elements
		var spanArray = document.getElementsByTagName("A");
		var j = 0;
		for (var i=0; i < spanArray.length; i++) 
		spanArray[i].className = "";	 	
		
		//load the chosen link into the viewer
		runlink(EventObj); 
		EventObj.className = 'selected';
	}
}

function closeMenu()
{
	
	xl_GetObj('clickmenu').style.display = 'none';
	
	if ((parent.document.getElementById('quickadd2')) && (parent.document.getElementById('quickadd2').style.display == 'none') && (parent.document.getElementById('quickadd').style.display == 'none'))
		clearActive();
}


function clearActive()
{
	
	if (xl_GetObj('adduploads'))
		xl_GetObj('adduploads').src = "/nexuspublic/images/adddocument.gif";
	if (xl_GetObj('addhtmls'))
		xl_GetObj('addhtmls').src = "/nexuspublic/images/addhtml.gif";
		
	xl_GetObj('addfavs').src = "/nexuspublic/images/addlink.gif";
	xl_GetObj('addfolders').src = "/nexuspublic/images/addfolder.gif";
	
	if (activelink.substring(8,9) == 'F')
	{
		var children = xl_GetObj(activelink).childNodes; 
		for (var i = 0; i < children.length; i++) 
		{
			if (children[i].nodeName == "DIV") 
			{
				children[i].className = 'nolink';
				break;
			}
		}
	}
	else
	{	
		if (activelink != '')
		{
			var children = xl_GetObj(activelink).childNodes; 
			for (var i = 0; i < children.length; i++) 
			{
				if (children[i].nodeName == "A") 
				{
					children[i].className = '';
					break;
				}
			}
		}
	}
}


function RightClickHandler(e) 
{
	var rightclick = xl_RightClick(e) 
	if ((rightclick == true ) && (quickadds == 'Y'))
	{
		inFolder = '';
		clearActive();
		
		var EventObj = xl_GetEventTarg(e);
		var viewOnly;
		var MyEvent = xl_GetEvent(e); 		
		var quickadd = parent.xl_GetObj("quickadd"); 
		var quickadd2 = parent.xl_GetObj("quickadd2"); 
		
		quickadd.style.display = 'none';
		quickadd2.style.display = 'none';
		var folder = "N";
		var windowPos;
		
		if (((EventObj.tagName != 'LI') && (EventObj.tagName != 'A') && (EventObj.tagName != 'DIV')) || (EventObj.parentNode.id == 'innerclick'))
		{
			xl_GetObj('clickmenu').style.display = 'none';
			clearActive();
			return false;
		}
		
		if (EventObj.tagName != 'LI')
		{
			node = EventObj.parentNode.id.substring(0,7);
			
			activelink = EventObj.parentNode.id;
			viewOnly = EventObj.parentNode.id.substring(7,8);
			inFolder = EventObj.parentNode.id.substring(8,9);
			
			if (inFolder == 'F')
				EventObj.className = 'nolinkactive';
			else
				EventObj.className = 'active';
		}
		else 
		{
			node = EventObj.id.substring(0,7);
			viewOnly = EventObj.id.substring(7,8);
			activelink = EventObj.id;
			
			var children = EventObj.childNodes; 
			for (var i = 0; i < children.length; i++) 
			{
				if (children[i].nodeName == "A") 
				{
					children[i].className = 'active';
					break;
				}
			}
		}
		
		if (node != '')
		{
			
			var innerclick = xl_GetObj("innerclick"); 
			
			// Favorites folder is specially handled, doesn't allow uploads, editing or deletes
			if ((EventObj.parentNode.className == 'nxFavFolder') 
			|| (EventObj.parentNode.className == 'nxOpFavFolder'))
			{
				innerclick.innerHTML = "<span class=\"disabledselection\">Upload File</span><br><span class=\"disabledselection\">Create Document</span><br><span class=\"disabledselection\">Add Link</span><br><span class=\"disabledselection\">Add Folder</span><br><hr><span class=\"disabledselection\">Delete</span><br><span class=\"disabledselection\">Edit</span>";
			}
			
			// *ADMIN access inside a folder
			else if ((viewOnly == 'A') && (inFolder == 'F'))
			{
				innerclick.innerHTML = "<a class=\"menuselection\" id=\"uploadECM\" href=\"javascript:\">Upload File</a><br><a class=\"menuselection\" id=\"createECM\" href=\"javascript:\">Create Document</a><br><a class=\"menuselection\" id=\"AddLinkECM\" href=\"javascript:\">Add Link</a><br><a class=\"menuselection\" id=\"addFolderECM\" href=\"javascript:\">Add Folder</a><br><hr><span class=\"disabledselection\" id=\"deleteECM\">Delete</span><br><span class=\"disabledselection\" id=\"editECM\">Edit</span>";			
			}
			
			// *ADMIN access outside a folder
			else if (viewOnly == 'A')
			{
				innerclick.innerHTML = "<a class=\"menuselection\" id=\"uploadECM\" href=\"javascript:\">Upload File</a><br><a class=\"menuselection\" id=\"createECM\" href=\"javascript:\">Create Document</a><br><a class=\"menuselection\" id=\"AddLinkECM\" href=\"javascript:\">Add Link</a><br><a class=\"menuselection\" id=\"addFolderECM\" href=\"javascript:\">Add Folder</a><br><hr><a class=\"menuselection\" id=\"deleteECM\" href=\"javascript:\">Delete</a><br><a class=\"menuselection\" id=\"editECM\" href=\"javascript:\">Edit</a>";			
			}
			
			// *WRITE access, don't allow delete option
			else if (viewOnly == 'P')
			{
				//TEH 20080715: *WRITE authority option DELETE should be disabled
				/*
				innerclick.innerHTML = "<span class=\"disabledselection\">Upload File</span><br><span class=\"disabledselection\">Create Document</span><br><span class=\"disabledselection\">Add Link</span><br><span class=\"disabledselection\">Add Folder</span><br><hr><a class=\"menuselection\" id=\"deleteECM\" href=\"javascript:\">Delete</a><br><a class=\"menuselection\" id=\"editECM\" href=\"javascript:\">Edit</a>";	
				*/
				innerclick.innerHTML = "<span class=\"disabledselection\">Upload File</span><br><span class=\"disabledselection\">Create Document</span><br><span class=\"disabledselection\">Add Link</span><br><span class=\"disabledselection\">Add Folder</span><br><hr><span class=\"disabledselection\">Delete</span><br><a class=\"menuselection\" id=\"editECM\" href=\"javascript:\">Edit</a>";			
			}
			
			// *READ access, don't allow any options
			else if (viewOnly == 'V')
			{
				innerclick.innerHTML = "<span class=\"disabledselection\">Upload File</span><br><span class=\"disabledselection\">Create Document</span><br><span class=\"disabledselection\">Add Link</span><br><span class=\"disabledselection\">Add Folder</span><br><hr><span class=\"disabledselection\">Delete</span><br><span class=\"disabledselection\">Edit</span>";
			}
			
			var clickmenu = xl_GetObj('clickmenu');
			clickmenu.style.display = "";
			
			var iframeElement = parent.xl_GetObj(window.name);
			var menuWidth = clickmenu.scrollWidth;
			var windowWidth = content.offsetWidth;
			
			var posx = 0;
			var posy = 0;
			var contentWindow = xl_GetObj('content');
			
			posx = e.clientX + contentWindow.scrollLeft;
			posy = e.clientY + contentWindow.scrollTop;
			
			if ((posx + menuWidth) > (windowWidth))
				x = posx - menuWidth;			
			else
				x = posx;
			
			if (x < 0)
				clickmenu.style.left = 5 + 'px';
			else
				clickmenu.style.left = x + 'px';
			
			var menuHeight = xl_GetObj('clickmenu').offsetHeight;
			var windowHeight = xl_GetObj('content').offsetHeight;
			var headerHeight = xl_GetObj('topbanner').offsetHeight;
			
			if (menuHeight + posy > windowHeight)
			{
				xl_GetObj('clickmenu').style.top = (posy - menuHeight  - headerHeight) + 'px';
				windowPos = (posy - menuHeight - headerHeight);			
			}
			else
			{
				xl_GetObj('clickmenu').style.top = (posy - headerHeight) + 'px';
				windowPos = posy - headerHeight;
			}
			
			var parentNode = EventObj.parentNode;
			if (parentNode.className == "nxFolder" || parentNode.className=="nxOpFolder" || parentNode.className == "nxFavFolder" || parentNode.className=="nxOpFavFolder")
				FolderFlag = "Y";
			else	
				FolderFlag = "N";
		}
		else
		{
			if (clickmenu)	
				xl_GetObj('clickmenu').style.display = "none";
		}	
		
		
		if (windowPos < 0)
		{
			
			var iframeElement = parent.xl_GetObj(window.name);
			xl_GetObj('clickmenu').style.top = (posy - menuHeight  - headerHeight) + 'px';
			xl_GetObj('content').style.height = posy + menuHeight + headerHeight + 10 + 'px';
			iframeElement.style.height = posy + menuHeight + headerHeight + 10 + 'px';
			xl_GetObj('clickmenu').style.top = (posy - headerHeight) + 'px';
		}
	}
}

function xl_ListObjProps(obj, obj_name) {
	var result = "";
	for (var i in obj)
		result += obj_name + "." + i + " = " + obj[i] + "\n";
	return result;
}


function xl_RightClick(e) 
{ 
	
	var rightclick;
	if (!e) var e = window.event;
	if (e.which) rightclick = (e.which == 3);
	else if (e.button) rightclick = (e.button == 2);
	return rightclick; 
}

function sizeNavigator()
{
	var iframeElement = parent.xl_GetObj(window.name);
	
	if (iframeElement != null)
	{
		if (xl_GetObj('content').scrollWidth > iframeElement.scrollWidth)
		{
			xl_GetObj('content').style.height = xl_GetObj('content').scrollHeight + 18 + 'px';
			iframeElement.style.height = document.body.scrollHeight + 'px';
		}
		else 
			iframeElement.style.height = document.body.scrollHeight + 'px';
	}
}

function quickmenu2(type,selnode)
{
	xl_GetObj('clickmenu').style.display = "none";
	var qadd = parent.xl_GetObj('quickadd');
	var quickadd2 = parent.xl_GetObj('quickadd2'); 
	var displayFlag = 'N';
	var displayAddFlag = 'N';
	var url;
	var randnum = Math.round((Math.random()*10000)+1);
	
	var framename = parent.xl_GetObj(this.name);
	var clkmnu = xl_GetObj('clickmenu');
	var y = xl_FindPosY(framename) + xl_FindPosY(clkmnu) + 10;
	var x = xl_FindPosX(framename) + xl_FindPosX(clkmnu);
	
	var widthLoc;
	var heightLoc;
	if (type == "Folder")
	{
		widthLoc = 600;
		heightLoc = 300;
	}	
	else if (type == "document")
	{
		widthLoc = 600;
		heightLoc = 300;
	}	
	else if (type == "addhtml")
	{
		widthLoc = 825;
		heightLoc = 600;
	}
	else if (type == "editECM")
	{
		widthLoc = 825;
		heightLoc = 600;
	}
	
	if ((widthLoc + x) > parent.document.body.scrollWidth)	
	{
		x = (parent.document.body.scrollWidth - widthLoc) - 10;
	}
	
	if ((heightLoc + y) > parent.document.body.scrollHeight)
	{
		y = (parent.document.body.scrollHeight - heightLoc);
		if (y < 5)
			y = 5;
	}
	
	if (type == "Folder")
	{
		
		if ((qadd.style.display == '') && (parent.quickform.ECMType.value == "Folder"))
			qadd.style.display = 'none';
		else
		{
			url ="NXMNGDOC.pgm?task=quickadd2&rand=" + randnum + "&instance=" + instance + "&ECMType=" + type + "&wnode2=" + selnode + "&framename=" + this.name + "&infolder=" + inFolder; 
			displayFlag = 'Y';
		}
		
	}
	else if (type == "document")
	{
		var ifr = parent.xl_GetObj('quickframe');
		if ((quickadd2.style.display == '') && (ifr.contentWindow.xl_GetObj('ECMType').value == "document"))
		{
			quickadd2.style.display = 'none';
		}
		else
		{
			url = "nxmngdoc.pgm?task=quickECMAdd2&ECMType=document&framename=" + this.name + "&instance=" + instance + "&wnode2="+ selnode + "&rndnum=" + randnum+ "&infolder=" + inFolder;
			displayFlag = 'Y';
		}
	}
	else if (type == "addhtml")
	{
		var ifr = parent.xl_GetObj('quickframe');
		if ((quickadd2.style.display == '') && (ifr.contentWindow.xl_GetObj('ECMType').value == "HTML"))
		{
			quickadd2.style.display = 'none';
		}
		else
		{
			url = "nxmngdoc.pgm?task=quickECMAdd2&ECMType=HTML&framename=" + this.name + "&instance=" + instance + "&wnode2=" + selnode + "&rndnum=" + randnum + "&infolder=" + inFolder;
			displayFlag = 'Y';
		}
	}
	else if (type == "Symbolic")
	{
		
		if ((qadd.style.display == '') && (parent.xl_GetObj('ECMType').value == "Symbolic"))
			qadd.style.display = 'none';
		else
		{
			url ="NXMNGDOC.pgm?task=quickadd2&rand=" + randnum + "&instance=" + instance + "&ECMType=" + type + "&wnode2=" + selnode + "&framename=" + this.name + "&infolder=" + inFolder; 
			displayFlag = 'Y';
		}
	}
	else if (type == "editECM")
	{
		
		url = "NXDOCSRCH2.pgm?task=edit&wnode=" + node + "&instance="+ instance + "&framename=" + this.name;
		displayFlag = 'Y';
	}
	
	quickadd2.style.display = 'none';
	if ((displayFlag == 'Y') && ((type == "Folder") || (type == "Symbolic")))
	{
		qadd.style.left = x + 'px';
		qadd.style.top =  y + 'px';
		quickadd2.style.display = 'none';
		
		xl_AjaxUpdate(url, qadd, Rcv_AJAX_quickadd);
	}
	else if ((displayFlag == 'Y') && ((type == "document") || (type == "addhtml") || (type == "editECM")))
	{
		var ifr = parent.xl_GetObj('quickframe');
		ifr.src = url;
		
		ifr.style.left = x + 'px';
		ifr.style.top =  y + 'px';
		quickadd2.style.zIndex=65;
		qadd.style.display = 'none';
	}
}


function ClickHandler(e)
{
	var EventObj = xl_GetEventTarg(e);
	var ajaxurl;
	
	if ((EventObj.tagName != 'LI') && (EventObj.tagName != 'A'))
		return false;
	
	if (EventObj.id == 'editECM')
	{
		quickmenu2('editECM', node);
		return;
	}
	else if (EventObj.id == 'uploadECM')
	{
		quickmenu2('document', node);
		return;
	}
	else if (EventObj.id == 'createECM')
	{
		quickmenu2('addhtml', node);
		return;
	}
	else if (EventObj.id == 'addFolderECM')
	{
		quickmenu2('Folder', node);
		return;
	}
	else if (EventObj.id == 'AddLinkECM')
	{
		quickmenu2('Symbolic', node);
		return;
	}
	else if (EventObj.id == 'deleteECM')
	{
		var linkname ;
		
		var children = xl_GetObj(activelink).childNodes; 
		for (var i = 0; i < children.length; i++) 
		{
			if (children[i].nodeName == "A") 
			{
				linkname = children[i].innerHTML;
				break;
			}
		}
		
		var delflag;
		if (FolderFlag == 'Y')
		{
			var return_value = confirm('You are about to permanently delete folder ' + linkname.toUpperCase() + ' and all of its subfolders. Do you wish to continue?');
			
			if ( return_value == true )
				delflag = 'Y';
		}
		else
		{
			var return_value = confirm('You are about to permanently delete ' + linkname.toUpperCase() + '. Do you wish to continue?');
			
			if ( return_value == true )
				delflag = 'Y';
		}
		
		if (delflag == 'Y')
		{
			var editsrc = "NXADDECM.PGM?task=delnode&instance=" + instance + "&wnode2=" + node;
			var mydiv;
			xl_AjaxUpdate(editsrc, mydiv, Rcv_AJAX_return);
			return;
		}
		else
		{
			clearActive();
			return;
		}
	}
	else
	{
		closeMenu();
	}
	
	if ((listType == "M") || (listType == "V"))
	{
		if (EventObj.tagName == "LI" && (EventObj.className == "nxFolder" || EventObj.className=="nxOpFolder" || EventObj.className == "nxFavFolder" || EventObj.className=="nxOpFavFolder")) 
		{
			expandFolder(EventObj);
		}
		else if (EventObj.parentNode.tagName == "LI")
		{
			loadDocument(EventObj);
			
			if (EventObj.parentNode.className == "nxFolder" || EventObj.parentNode.className == "nxFavFolder")
				expandFolder(EventObj);
		}
		
	}
	else
	{
		if (EventObj.tagName == "LI" && (EventObj.className == "nxFolder" || EventObj.className=="nxOpFolder" || EventObj.className == "nxFavFolder" || EventObj.className=="nxOpFavFolder"))
		{
			expandFolder(EventObj);
		}
		else
		{
			loadDocument(EventObj);
		}
	}
	
	if (window.event)
		return false;
	else
		e.preventDefault();
}	

function Rcv_AJAX_return(mydiv, response)
{
	if (favorites == 'Y')
	{
		var randnum = Math.round((Math.random()*10000)+1);
		var url = "NXMNGDOC.PGM?task=viewfavorites&type=V&favorites=Y&rand=" +  randnum;
		parent.xl_GetObj('favframe').src = url;
	}
	else
		parent.Reload_Navigators();
}

function expandtree(myid, response)
{ 
	xl_GetObj(myid).innerHTML = response; 
	if (adjustSize) 	 
		sizeNavigator();
}  

function Ldplaceafter(myid, response)
{ 
	parent.parent.xl_GetObj('placeafter').innerHTML = response;
}

function runlink(link_obj) 
{ 
	var link_url = link_obj.href; 
	var link_target = link_obj.target;
	
	if (link_url != "") 
	{	
		var strpos = link_url.search('docnum=');
		if (strpos != -1)
		{
			docnum = link_url.substring((strpos + 7)); 
			strpos = docnum.search('&');
			
			if (strpos != -1)
				docnum = docnum.substring(0, strpos); 
		}
		else	
			docnum = 0;
		
		var strpos = link_url.search('wnode=');
		if (strpos > 0)
		{
			currentNode = link_url.substring((strpos + 6));
			strpos = currentNode.search('&');
			currentNode = currentNode.substring(0, strpos); 
		} 
		
		if (listType == 'S')
		{
			if (framename == 'ECMQuickAdd')
			{
				parent.parent.xl_GetObj('nodename2').value = link_obj.innerHTML;
				parent.parent.xl_GetObj('wnode2').value = currentNode;	
				
				top.frames['block_page'].xl_GetObj('auxframe').style.display='none';
				//top.frames['block_page'].document.headfrm.auxframe').style.display='none';
				return;
				
			}
			else if (framename == '')
			{
				parent.parent.document.inpform.wnode.value = currentNode;
				parent.parent.document.inpform.nodename.value = link_obj.innerHTML;
				
				var myid = 'placeafter';
				var ajaxurl = "NXDOCSRCH2.pgm?task=fldrlist&instance=" + instance + "&fromnode=" + currentNode + "&rndnum=" + randnum; 
				xl_AjaxUpdate(ajaxurl, myid, Ldplaceafter); 
				
				parent.parent.xl_GetObj('doctree').style.display = 'none';
			}
		}
		else if (listType == 'M')
		{
			parent.frames["text"].location = link_url;
		}
		else if (listType == 'U')
		{
			if (urltype == "I")
			{
				var strpos = link_url.search(sitepath);
				link_url = link_url.substring(strpos);
				parent.parent.inpImgURL.value = link_url;
				
			}
			else if (urltype == "H")
			{
				var strpos = link_url.search('&docnum=');
				
				var strpos2 = link_url.search('http:');
				if (strpos2 < 0)
					strpos2 = 0;
				else
					strpos2 = strpos2 + 7;
				
				parent.parent.inpURL.value = link_url.substring(strpos2,strpos);
				parent.parent.javaURL.value = 'if (parent.oUtil == undefined){this.href = \'' + sitepath + 'nxmenu.pgm?docnum=' + docnum + '\';}';
				parent.parent.inpTarget.options[0].selected = true;
				parent.parent.inpTargetCustom.value = '_top';
				parent.parent.inpType.options[1].selected = true;
			}
			else if (urltype == "U")
			{
				var strpos2 = link_url.search(sitepath2);
				if (strpos2 < 0)
					strpos2 = 0;
				else
					strpos2 = strpos2;
				
				parent.parent.document.inpform.inpURL.value = link_url.substring(strpos2);
			}
			
			parent.parent.xl_GetObj('doctree').style.display = 'none';
		}
		else if ((listType == "A") || (listType == "F") || (listType == "C") || (listType == 'Z'))
		{	
			if (link_url)
			{
				if (framename == 'ECMQuickLoc')
				{
					parent.parent.document.quickform.nodename2.value = link_obj.innerHTML;
					parent.parent.document.quickform.wnode2.value = docnum;	
					top.frames['block_page'].xl_GetObj('auxframe').style.display='none';
					return;	
				}
				else if (framename == 'ECMQuickLoc2')
				{
					
					var ifr = top.frames['block_page'].xl_GetObj('quickframe');
					ifr.contentWindow.document.inpform.nodename2.value = link_obj.innerHTML;
					ifr.contentWindow.document.inpform.wnode2.value = docnum;
					
					top.frames['block_page'].xl_GetObj('auxframe').style.display='none';
					return;	
				}
				else if (framename == 'ECMQuickAdd')
				{
					if (listType == "A")
					{
						parent.parent.xl_GetObj('url').value = link_url;
					}
					else
					{
						parent.parent.xl_GetObj('nodename2').value = link_obj.innerHTML;
						parent.parent.xl_GetObj('wnode2').value = docnum;
					}
					
					top.frames['block_page'].xl_GetObj('auxframe').style.display='none';
					return;
					
				}
				else if (framename != '')
				{
					var ifr = top.frames['block_page'].xl_GetObj(framename);
					
					if (listType == "A")
					{
						ifr.contentWindow.xl_GetObj('url').value = link_url;
					}
					else
					{
						ifr.contentWindow.document.xl_GetObj('nodename2').value = link_obj.innerHTML;
						ifr.contentWindow.document.xl_GetObj('wnode2').value = docnum;
					}
					
					top.frames['block_page'].xl_GetObj('auxframe').style.display='none';
					return;
				}
				else
				{
					
					parent.parent.document.inpform.wnode2.value = docnum;
					parent.parent.document.inpform.nodename2.value = link_obj.innerHTML;
					if (parent.parent.xl_GetObj('lnsdsc'))
					{
						if (parent.parent.document.inpform.lnsdsc.value == '')	
							parent.parent.document.inpform.lnsdsc.value = link_obj.innerHTML;
						if (parent.parent.document.inpform.lnldsc.value == '')
							parent.parent.document.inpform.lnldsc.value = link_obj.innerHTML;
					}
				}
			}
			else
			{
				parent.parent.document.inpform.wnode2.value = 0;
				parent.parent.document.inpform.nodename2.value = 'Top of Tree';
			}
			
			parent.parent.xl_GetObj('doctree').style.display='none';
		}
		else
		{	
			if (link_target == "_blank")
				window.open(link_url, '_blank');
			else
			{
				var strpos = link_url.search('tmpnbr=');
				var template = link_url.substring((strpos + 7)); 
				strpos = template.search('&');
				
				if (strpos != -1)
					template = template.substring(0, strpos); 
				
				if ((template == parent.document.docform.template.value) && (ReuseTemplate == 'Y') && (parent.document.docform.lnknum.value != docnum))
				{
					parent.document.docform.lnknum.value = docnum;
					
					if (parent.xl_GetObj('edtwindow'))
					{
						if ((link_obj.parentNode.id.substring(7,8) == 'A') || ((link_obj.parentNode.id.substring(7,8) == 'P')))
							parent.xl_GetObj('edtwindow').style.display = '';
						else
							parent.xl_GetObj('edtwindow').style.display = 'none';
					}
				
					top.frames['title'].document.headfrm.docnum.value = docnum;
					top.frames['title'].loadBreadCrumbs();	
					
					var t;
					for (t = 0; t < parent.ECMNavigatorctr; t++)
					{
						
						if (parent.xl_GetObj(parent.ECMNavigators[t]))
						{
							var ifr = parent.xl_GetObj(parent.ECMNavigators[t]);
							ifr.contentWindow.RemovedSelected();
							ifr.contentWindow.selectNode(docnum);
						}
						
					}
					
					var mydiv;
					myurl = "NXMNGDOC.PGM?task=loaddoc&wnode=" + docnum + "&rndnum=" + randnum;
					xl_AjaxUpdate(myurl, mydiv, Rcv_AJAX_LoadDoc);
					
					if (favorites == "Y")
						parent.favorites.style.display = 'none';		
					
				}
				else
				{
					if ((link_url.search('&') > 0) && (link_url.search('\\?') > 0))
						top.location.href = link_url + "&rndnum=" + randnum;
					else
						top.location.href = link_url;
				}
			}
		}
	}		
}

function dymloadurl(url)
{
	var strpos = url.search('tmpnbr=');
	var template = url.substring((strpos + 7)); 
	strpos = template.search('&');
	var randnum = Math.round((Math.random()*10000)+1);
	
	if (strpos != -1)
		template = template.substring(0, strpos); 
	
	strpos = url.search('docnum=');
	var docnum = url.substring((strpos + 7)); 
	strpos = docnum.search('&');
	
	if (strpos != -1)
		docnum = docnum.substring(0, strpos);
	
	strpos = url.search('lnknum=');
	var lnknum = url.substring((strpos + 7)); 
	strpos = lnknum.search('&');
	
	if (strpos != -1)
		lnknum = lnknum.substring(0, strpos);
	
	if ((xl_GetObj('template')) && (template == xl_GetObj('template').value))
	{
		document.docform.lnknum.value = docnum;
		top.frames['title'].xl_GetObj('docnum').value = docnum;
		top.frames['title'].loadBreadCrumbs();	
		
		var t;
		for (t = 0; t < ECMNavigatorctr; t++)
		{
			
			if (xl_GetObj(ECMNavigators[t]))
			{
				var ifr = xl_GetObj(ECMNavigators[t]);
				ifr.contentWindow.RemovedSelected();
				ifr.contentWindow.selectNode(lnknum);
				
			}
		}
		
		var mydiv;
		myurl = "NXMNGDOC.PGM?task=loaddoc&wnode=" + docnum + "&rndnum=" + randnum;		
		xl_AjaxUpdate(myurl, mydiv, Rcv_AJAX_LoadViewDoc);
		
	}
	else
	{
		top.location.href = url + "&rndnum=" + randnum;
	}
}

function selectNode(lnknum)
{
	var currentSelect;
	
	if (xl_GetObj(lnknum + 'V'))
		currentSelect = xl_GetObj(lnknum + 'V');	
	else if (xl_GetObj(lnknum + 'A'))
		currentSelect = xl_GetObj(lnknum + 'A');
	
	if (currentSelect)
	{
		
		var children = currentSelect.childNodes; 
		for (var i = 0; i < children.length; i++) 
		{
			if (children[i].nodeName == "A") 
			{
				children[i].className = 'Selected';
				break;
			}
		}
		
		currentNode = lnknum;
	}
}

function RemovedSelected()
{
	var currentSelected;
	
	currentSelected = xl_GetObj(currentNode + 'V');
	if (currentSelected == null)
		currentSelected = xl_GetObj(currentNode + 'A');
	
	
	if ((currentSelected) && (currentSelected.tagName == 'LI'))
	{
		children = currentSelected.childNodes; 
		for (var i = 0; i < children.length; i++) 
		{
			if (children[i].nodeName == "A") 
			{
				EventObj = children[i];
				break;
			}
		}
		EventObj.className = "";	
	}
}

function Rcv_AJAX_LoadViewDoc(mydiv, response)
{
	docname.innerHTML = '';
	
	var docnbr = response.substring(0, 9);
	var title = response.substring(9, 100);
	var doctype = response.substring(109, 125);
	var resize = response.substring(125, 126);
	var docpath = response.substring(126, 1000);
	var url = response.substring(1126, 5000);
	
	var checkurl = url.toUpperCase();	
	var reload = checkurl.search('NXMENU.PGM');
	if (reload != -1)
	{
		top.location.href = url;
		return; 
	}
	
	document.docform.docnum.value = docnbr;
	document.docform.docpath.value = docpath;
	docname.innerHTML = title;
	loading.style.display = '';

	if ((xl_GetObj('ECMemail')) && ((doctype == "Folder          ") || (doctype == "Symbolic        ")))
		xl_GetObj('ECMemail').style.display = 'none';
	else if (xl_GetObj('ECMemail'))
		xl_GetObj('ECMemail').style.display = '';
	
	if ((xl_GetObj('ECMprint')) && ((doctype == "PDF             ") || (doctype == "pdf             ")))
		xl_GetObj('ECMprint').style.display = 'none';
	else if (xl_GetObj('ECMprint'))
		xl_GetObj('ECMprint').style.display = '';
	
	if (resize == 'Y')	
	{	
		var activewidth = xl_GetObj('ifrmviewdoc').contentWindow.document.body.scrollWidth - 10;	
		xl_GetObj('ifrmviewdoc').contentWindow.document.body.innerHTML = "<image src=\"" + url + "\" style=\"width:" + activewidth  + "px\">";
	}
	else
	{
		if (url.search('&') > 0)
			xl_GetObj('ifrmviewdoc').src = url + "&rnd=" + randnum;
		else
			xl_GetObj('ifrmviewdoc').src = url + "?rnd=" + randnum;
	}
	
	loaddocchk();
}

function Rcv_AJAX_LoadDoc(mydiv, response)
{
	parent.xl_GetObj('docname').innerHTML = '';
	
	var docnbr = response.substring(0, 9);
	var title = response.substring(9, 100);
	var doctype = response.substring(109, 125);
	var resize = response.substring(125, 126);
	var docpath = response.substring(126, 1000);
	var url = response.substring(1126, 5000);
	
	var checkurl = url.toUpperCase();	
	var reload = checkurl.search('NXMENU.PGM');
	if (reload != -1)
	{
		top.location.href = url;
		return; 
	}
	
	parent.document.docform.docnum.value = docnbr;
	parent.document.docform.docpath.value = docpath;
	parent.xl_GetObj('docname').innerHTML = title;
	parent.xl_GetObj('loading').style.display = '';
	
	if ((parent.xl_GetObj('ECMemail')) && ((doctype == "Folder          ") || (doctype == "Symbolic        ")))
	{
		parent.xl_GetObj('ECMemail').style.display = 'none';
	}	
	else if (parent.xl_GetObj('ECMemail'))
		parent.xl_GetObj('ECMemail').style.display = '';
	
	if ((parent.xl_GetObj('ECMprint')) && ((doctype == "PDF             ") || (doctype == "pdf             ")))
		parent.xl_GetObj('ECMprint').style.display = 'none';
	else if (parent.xl_GetObj('ECMprint'))
		parent.xl_GetObj('ECMprint').style.display = '';

	if (resize == 'Y')	
	{	
		var activewidth = parent.xl_GetObj('ifrmviewdoc').contentWindow.document.body.scrollWidth - 10;	
		parent.xl_GetObj('ifrmviewdoc').contentWindow.document.body.innerHTML = "<image src=\"" + url + "\" style=\"width:" + activewidth  + "px\">";
		
		parent.loaddocchk();
	}
	else
	{	
		if (url.search('\\?') > 0)
			parent.xl_GetObj('ifrmviewdoc').src = url + "&rnd=" + randnum;
		else
			parent.xl_GetObj('ifrmviewdoc').src = url + "?rnd=" + randnum;
		
		parent.loaddocchk();
	}
}


function ChgStatusBar(e)
{
	var MyEventObj = xl_GetEventTarg(e);
	var EventObj = MyEventObj; 
	
	if ((EventObj)&&(EventObj.nodeName == "LI"))
	{ 
		var children = EventObj.childNodes; 
		
		for (var i = 0; i < children.length; i++) 
		{
			if (children[i].nodeName == "A") 
			{
				MyEventObj.title = children[i].title; 
				EventObj = children[i];
				break; 
			}
		}
	}
	
	if ((EventObj) && (EventObj.href)) 
	{
		if(document.all)   window.status = EventObj.href + ' (' + EventObj.innerText+ ')'; 
		else    window.status = EventObj.href + ' (' + EventObj.textContent + ')'; 
		
		return true; 
	}
} 

function ClrStatusBar()
{ 
	window.status= ""; 
	return true;
}


function openTree2(myid, response)
{ 
	try 
	{ 
		if (xl_GetObj(myid).parentNode.className != '')
		{
			xl_GetObj(myid).innerHTML = response;
			
			if (xl_GetObj(myid).parentNode.className == "nxFavFolder")
				xl_GetObj(myid).parentNode.className = "nxOpFavFolder";
			else
				xl_GetObj(myid).parentNode.className = "nxOpFolder";
		}
		
		if ((openIndex == 0) && (subfolder == 'Y'))
		{
			var children = xl_GetObj(myid).parentNode.childNodes; 
			for (var i = 0; i < children.length; i++) 
			{
				if (children[i].nodeName == "A") 
				{
					EventObj = children[i];
					break; 
				}
			}
			
			EventObj.className = "selected";
		}
		
		container.scrollTop = scrollto;
	}
	catch(err)
	{ 
	}
	
	openIndex = openIndex - 1;
	openTree3();
	
	if (adjustSize)
	{	 
		sizeNavigator();
	}
}  

function addentry(url)
{
	parent.frames["text"].location = url;
	Show_New_Window = false; 
}


function displayDocuments()
{
	var optvalue = "";
	var optkey = "DISPLAYDOCUMENTS" + instance;
	
	if (xl_GetObj('content').style.display == '')
	{
		viewdocs.src = "/nexuspublic/images/ECMExpand.gif";
		xl_GetObj('content').style.display = 'none';
		optvalue = "N";
		var iframeElement = parent.xl_GetObj(window.name);
		iframeElement.style.height = topbanner.scrollHeight + 'px';
	}
	else
	{
		xl_GetObj('viewdocs').src = "/nexuspublic/images/ECMCollapse.gif";
		xl_GetObj('content').style.display = '';
		optvalue = "Y";
		sizeNavigator();
	}
	
	setserver(optkey, optvalue);
}

function quickaddmenu(framename)
{	
	xl_GetObj(framename).value = framename;
	
	if (xl_GetObj('ECMType').value == "Symbolic")
	{
		xl_GetObj('addname').innerHTML = "Name";
		xl_GetObj('path').style.display = '';
		xl_GetObj('openin').style.display = '';
		
		if (framename == 'favframe')
		{
			if (document.docform.lnknum.value != '0000000')
				xl_GetObj('url').value = 'nxmenu.pgm?docnum=' + document.docform.lnknum.value;
			else 
				xl_GetObj('url').value = 'nxmenu.pgm?pgrrn=' + document.docform.pgrrn.value;
		}
	}
	else if (xl_GetObj('ECMType').value == "Folder")
	{
		xl_GetObj('addname').innerHTML = "Folder Name:";
		xl_GetObj('path').style.display = 'none';
		xl_GetObj('openin').style.display = 'none';
	}
	
	xl_GetObj('quickadd').style.zIndex = 55;
	xl_GetObj('quickadd').style.display = "";
	
	setTimeout('document.quickform.title.focus();', 10);
}

function quickmenu(e, type)
{
	var qadd = parent.xl_GetObj('quickadd');
	var displayFlag = 'N';
	var displayAddFlag = 'N';
	var url;
	var randnum = Math.round((Math.random()*10000)+1);
	
	if (xl_GetObj('adduploads'))
		xl_GetObj('adduploads').src = "/nexuspublic/images/adddocument.gif";
	if (xl_GetObj('addhtmls'))
		xl_GetObj('addhtmls').src = "/nexuspublic/images/addhtml.gif";
	
	xl_GetObj('addfavs').src = "/nexuspublic/images/addlink.gif";
	xl_GetObj('addfolders').src = "/nexuspublic/images/addfolder.gif";
	
	if (type == "Symbolic")
	{
		if ((qadd.style.display == '') && (parent.quickform.ECMType.value == "Symbolic"))
		{
			qadd.style.display = 'none';
		}
		else
		{
			xl_GetObj('addfavs').src = "/nexuspublic/images/addlinksel.gif";
			url ="NXMNGDOC.pgm?task=quickadd&rand=" + randnum + "&instance=" + instance + "&ECMType=" + type + "&wnode=" + currentNode + "&framename=" + this.name + "&favorites=" + favorites; 
			displayFlag = 'Y';
		}
	}
	else if (type == "Folder")
	{
		
		if ((qadd.style.display == '') && (parent.quickform.ECMType.value == "Folder"))
			qadd.style.display = 'none';
		else
		{
			xl_GetObj('addfolders').src = "/nexuspublic/images/addfoldersel.gif";
			url ="NXMNGDOC.pgm?task=quickadd&rand=" + randnum + "&instance=" + instance + "&ECMType=" + type + "&wnode=" + currentNode + "&framename=" + this.name + "&favorites=" + favorites;
			displayFlag = 'Y';
		}
		
	}
	else if (type == "document")
	{
		var ifr = parent.xl_GetObj('quickframe');
		if ((parent.xl_GetObj('quickadd2').style.display == '') && (ifr.contentWindow.xl_GetObj('ECMType').value == "document"))
		{
			parent.xl_GetObj('quickadd2').style.display = 'none';
		}
		else
		{
			xl_GetObj('adduploads').src = "/nexuspublic/images/adddocumentsel.gif";
			url = "nxmngdoc.pgm?task=quickECMAdd&ECMType=document&framename=" + this.name + "&instance=" + instance + "&wnode="+ currentNode + "&rndnum=" + randnum + "&framename=" + this.name + "&favorites=" + favorites;
			displayFlag = 'Y';
		}
	}
	else if (type == "addhtml")
	{
		var ifr = parent.xl_GetObj('quickframe');
		if ((parent.xl_GetObj('quickadd2').style.display == '') && (ifr.contentWindow.xl_GetObj('ECMType').value == "HTML"))
		{
			parent.xl_GetObj('quickadd2').style.display = 'none';
		}
		else
		{
			xl_GetObj('addhtmls').src = "/nexuspublic/images/addhtmlsel.gif";
			url = "nxmngdoc.pgm?task=quickECMAdd&ECMType=HTML&framename=" + this.name + "&instance=" + instance + "&wnode=" + currentNode + "&rndnum=" + randnum + "&framename=" + this.name + "&favorites=" + favorites;
			displayFlag = 'Y';
		}
	}
	
	parent.xl_GetObj('quickadd2').style.display = 'none';
	
	var framename = parent.xl_GetObj(this.name);
	
	var widthLoc;
	
	if ((type == "Folder") || (type == "Symbolic"))
		widthLoc = 600;
	else if (type == "document")
		widthLoc = 600;
	else if (type == "addhtml")
		widthLoc = 900;
	
	if (!e) e = window.event;

	x = xl_FindPosX(framename) + e.x;
	y = xl_FindPosY(framename) + xl_GetObj('topbanner').scrollHeight;
	
	if ((widthLoc + x) > parent.document.body.scrollWidth)	
	{
		x = (x - widthLoc);
		if (x < 0)
			x = 10;
	}
	else
	{
		if ((x > 1) && (x < 45))
			x = 18;	
		else if ((x > 45) && (x < 75))
			x = 45;	
		else if ((x > 75) && (x < 105))
			x = 75;
		else if ((x > 105) && (x < 125))
			x = 105;
	}
	
	if ((displayFlag == 'Y') && ((type == "Symbolic") || (type == "Folder")))
	{
		qadd.style.left = x + 'px';
		qadd.style.top =  y + 'px';
		
		parent.xl_GetObj('quickadd2').style.display = 'none';
		
		xl_AjaxUpdate(url, qadd, Rcv_AJAX_quickadd);
	}
	else if ((displayFlag == 'Y') && ((type == "document") || (type == "addhtml")))
	{
		var framename = 'quickframe';	
		var ifr = parent.xl_GetObj(framename);
		ifr.src = url;
		ifr.style.left = x + 'px';
		ifr.style.top =  y + 'px';
		parent.xl_GetObj('quickadd2').style.zIndex=80;
		qadd.style.display = 'none';
	}
}

function Rcv_AJAX_quickadd(qadd, response)
{
	qadd.innerHTML = response;
	parent.quickaddmenu(this.name);
}

function setupQuickEditor()
{
	
	oEdit1.mode="HTMLBody";
	oEdit1.btnSpellCheck=true;
	oEdit1.height="305";
	oEdit1.width="100%";
	
	oEdit1.features=["FullScreen","Preview","Print","Search","Cut","Copy","Paste","PasteWord","PasteText","|","Undo","Redo","|","ForeColor","BackColor","|","Bookmark","Hyperlink","XHTMLSource","|","Numbering","Bullets","|","Indent","Outdent","BRK","Paragraph","FontName","FontSize","|","LTR","RTL","|","Table","Guidelines","Absolute","|","Characters","Line","Form","RemoveFormat","ClearAll","BRK","Image","Flash","Media","|","StyleAndFormatting","TextFormatting","ListFormatting","BoxFormatting","ParagraphFormatting","CssText","Styles","|","Bold","Italic","Underline","Strikethrough","|","JustifyLeft","JustifyCenter","JustifyRight","JustifyFull", "|", "CustomTag", "|", "SpellCheck"];
	
	
	var header = '<div class="welcome">Welcome Text...<div class="welcome_Description">Welcome description...</div><br></div>';
	
	var columnheadingfloat = '<div class="column"><div class="Banner"><span class="banner_highlight"></span><span class="banner_space"></span>Column Heading</div><div class="Column_Text">Column 1 text...</div></div>';
	var columnheading = '<div class="Banner"><span class="banner_highlight"></span><span class="banner_space"></span>Column Heading</div><div class="Column_Text">Column 1 text...</div>';
	var bullet = '<li><span class="bullet">Bullet text...</span></li>';
	var TextFrame = '<div align="center"><div class="TextFrame"><span class="innerTextFrame">Test text...</span></div></div>';
	var CenteredImage =  '<div class="image" align="center"><img height="100" width="100" align="middle" border="0"></div>';
	var imageundertext = '<div class="image" align="left">Test text...<br><div align="center"><br><img height="100" width="100" align="middle" border="0"></div></div>';
	var imageabovetext = '<div class="image" align="left"><div align="center"><br><img height="100" width="100" align="middle" border="0"></div><br>Test text...</div>';
	var floatimageleft = '<img class="floatleft" height="100" width="100" align="middle" border="0">';
	var floatimageright = '<img class="floatright" height="100" width="100" align="middle" border="0">';
	var Listitems = '<div class="listitems"><span class="banner">List Heading...</span><ul><li>Item 1</li><li>Item 2</li></ul></div>';
	var quotebox = '<div align="center"><div class="quote" align="center">"Quote..."</div></div>';
	var singlecolumn = '<table class="column_table"><tr><td class="column_Single"><div class="column"><div class="Banner"><span class="banner_highlight"></span><span class="banner_space"></span>Column Heading</div><div class="Column_Text">Column text...</div><br><span class="Guide_Text"> More Column Headings...</span></div></td></tr></table>';
	var twocolumn = '<table class="column_table"><tr><td class="column1"><div class="column"><div class="Banner"><span class="banner_highlight"></span><span class="banner_space"></span>Column Heading</div> <div class="Column_Text">Column text...</div><br><span class="Guide_Text"> More Column Headings...</span></div></td><td class="column_space"></td><td class="column2"><div class="column"><div class="Banner"><span class="banner_highlight"></span><span class="banner_space"></span>Column Heading</div><div class="Column_Text">Column text...</div><br><span class="Guide_Text"> More Column Headings... </span></div></td></tr></table>';
	
	
	oEdit1.arrCustomTag=[["Single Column",singlecolumn],["Two Column",twocolumn],["Header",header],["column Header",columnheading],["Floating column Header",columnheadingfloat],["bullet",bullet],["List Items",Listitems],["Quote",quotebox],["Text Frame",TextFrame],["Image Under Text",imageundertext],["Image Above Text",imageabovetext],["Centered Image",CenteredImage],["Float Image Left",floatimageleft],["Float Image Right",floatimageright]];
	
	oEdit1.btnStyles=true;
	oEdit1.initialRefresh=true;
	
	oEdit1.REPLACE("taskdesc2");
	
}


function favoritesSetup(dspfav)
{
	if (dspfav == 'Y')
		xl_GetObj('content').style.display = '';
	else
		xl_GetObj('content').style.display = 'none';
}

function quickfunc(type)
{
	var ifr = parent.xl_GetObj(window.name);
	setTimeout('document.inpform.title.focus();', 10);
	parent.xl_GetObj('quickadd2').style.display = '';
	
	if (type == "HTML")
	{
		xl_GetObj('pcfile').style.display = 'none';
		ifr.style.width = 900 + 'px';	
	}
	else if (type == "document")
	{
		xl_GetObj('pcfile').style.display = '';
		ifr.style.width = 600 + 'px';
	}
	
	ifr.style.height = document.body.scrollHeight + 5 + 'px';
}

function addfile_setup(optaddsrch, optaddapnd)
{
	if (optaddsrch == "Y")
	{	
		xl_GetObj('optbox4').style.display = "";
	}
	
	if (optaddapnd == "Y")
	{	
		xl_GetObj('optbox5').style.display = "";
	}
	
	document.forms[0].srchkeys.enabled="true";
	document.forms[0].addsearch.disabled="true";
	document.forms[0].addappend.disabled="true";
	
	if (document.forms[0].addtype.value == "Folder")
	{
		xl_GetObj('pcfile').style.display = "none";
		xl_GetObj('Symbolic').style.display = "none";
		xl_GetObj('prcdir').style.display = "none";
		xl_GetObj('symlnk').style.display = "none";
		
		if (document.inpform.task.value != 'endadd')
			xl_GetObj('downloadbtn').style.display = "none";
	}
	else if (document.forms[0].addtype.value == "Symbolic")
	{
		xl_GetObj('Symbolic').style.display = "";
		xl_GetObj('pcfile').style.display = "none";
		
		if (document.inpform.task.value != 'endadd')
		{
			xl_GetObj('urlview').style.display = "";
			xl_GetObj('downloadbtn').style.display = "none";
			xl_GetObj('urlview2').style.display = "none";
		}
	}
	else
	{
		xl_GetObj('pcfile').style.display = "";
		xl_GetObj('Symbolic').style.display = "none";
		xl_GetObj('prcdir').style.display = "none";
		xl_GetObj('symlnk').style.display = "none";
	}
	
}

function edit_setup(allowkv, framename)
{
	if ((document.inpform.auxicons.value == "Y") && (document.inpform.objauth.value == "Y")  && (document.forms[0].addtype.value != "Header") && (document.forms[0].addtype.value != "Symbolic"))
	{
		if ((document.inpform.addtype.value != "Folder") && (document.inpform.addtype.value != "Header"))
			xl_GetObj('auxregister').style.display = "";
		xl_GetObj('auxselect').style.display = "";
		
		if ((document.inpform.auxsmurf.value != "") || (document.inpform.srchkeys.value.search('ListObjects') != -1))
			document.inpform.srchkeys.disabled = true;
	}
	
	if ((document.forms[0].addtype.value == "Folder") || (document.forms[0].addtype.value == "Header"))
	{
		xl_GetObj('filetype').style.display = "none";
		xl_GetObj('pcfile').style.display = "none";
		xl_GetObj('Symbolic').style.display = "none";
		xl_GetObj('prcdir').style.display = "none";
		xl_GetObj('symlnk').style.display = "none";
		
		if (document.forms[0].addtype.value == "Folder")
		{
			xl_GetObj('downloadbtn').style.display = "none";
			xl_GetObj('fdermode').style.display = "";
		}
		else
		{
			xl_GetObj('htmledit').style.display = "";
			xl_GetObj('htmldftcnt').style.display = "";
			
		}
		
	}
	else if (document.forms[0].addtype.value == "Symbolic")
	{
		xl_GetObj('filetype').style.display = "";
		xl_GetObj('Symbolic').style.display = "";
		xl_GetObj('fdermode').style.display = "none";
		xl_GetObj('pcfile').style.display = "none";
		
		if (document.inpform.task.value  != 'endadd')
		{
			xl_GetObj('urlview').style.display = "";
			xl_GetObj('downloadbtn').style.display = "none";
			xl_GetObj('urlview2').style.display = "none";
		}
		
		sellink();
	}
	else
	{
		xl_GetObj('filetype').style.display = "";
		xl_GetObj('fdermode').style.display = "none";
		if (document.inpform.htmlflag.value == 'HTML')
		{
			xl_GetObj('pcfile').style.display = "none";
			xl_GetObj('template').style.display = "";
			xl_GetObj('htmledit').style.display = "";
			xl_GetObj('htmldftcnt').style.display = "";
		}
		else
			xl_GetObj('pcfile').style.display = "";
		
		xl_GetObj('Symbolic').style.display = "none";
		xl_GetObj('prcdir').style.display = "none";
		xl_GetObj('symlnk').style.display = "none";
	}
	
	if ((document.forms[0].addtype.value == "Header") || ((document.forms[0].addtype.value == "Symbolic") && (document.inpform.lnktype.selectedIndex == 0)))
	{
		xl_GetObj('template').style.display = "none";
	}
	else
	{
		xl_GetObj('template').style.display = "";
	}	
	
	if ((document.forms[0].addtype.value == "Header") || (document.forms[0].addtype.value == "Symbolic") || ((document.inpform.htmlflag.value != 'HTML') && (document.forms[0].addtype.value != "Folder")))
	{
		xl_GetObj('skins').style.display = "none";
	}
	else
	{
		xl_GetObj('skins').style.display = "";
	}	
	
	if (document.inpform.objauth.value == "Y")
	{
		xl_GetObj('move0').style.display = "";
		xl_GetObj('deletercd').style.display = "";
		xl_GetObj('deletercd2').style.display = "";
		xl_GetObj('hidden2').style.display = "";
	}
	
	if (allowkv == "Y")
	{
		xl_GetObj('allowkv1').style.display = "";
	} 
	else 
	{
		xl_GetObj('allowkv1').style.display = "none";
	}
	
	if (window.name == "quickframe")
	{
		xl_GetObj('closebutton').style.display = ''; 
		var ifr = parent.xl_GetObj(window.name);
		parent.xl_GetObj('quickadd2').style.display = '';
		ifr.style.width = 825 + 'px';	
		ifr.style.height = document.body.scrollHeight + 5 + 'px';
	}
	
	check_type();
}

function auxreg()
{
	if ((document.inpform.auxicons.value == "Y") && (document.inpform.objauth.value == "Y"))
	{
		var ifr = xl_GetObj('keyframe');
		
		ifr.style.left = '30px';
		ifr.style.top =  '30px';
		ifr.style.height = 420 + 'px';
		ifr.style.width = 400 + 'px';
		ifr.style.zIndex=50;
		
		var url = 'http://esdi.excelsystems.com/webtest/MEREGAPP.pgm?docnum=' + document.inpform.DMDCNB.value + '&auxsmurf=' +document.inpform.auxsmurf.value;
		ifr.src = url;
		
		xl_GetObj('keypair').style.display = "";
	}
}





function openkey(instance) 
{ 
	var ifr = xl_GetObj('keyframe');
	var event = xl_event();
	
	ifr.style.left = (event.x - 200) + 'px';
	ifr.style.top =  (event.y + 15) + 'px';
	ifr.height = 210;
	ifr.style.zIndex=50;
	
	if (keyloaded == false)
	{
		var url = 'NXSRCHKEY.pgm?instance=' + instance + "&rand=" +  randnum;
		ifr.src = url;
		keyloaded = true;
	}
	
	xl_GetObj('keypair').style.display = "";
	xl_GetObj('key2pair').style.display = "none";
	parent.adjustIFrameSize(window);
}

function openkey2(instance) 
{ 
	var ifr = xl_GetObj('key2frame');
	var event = xl_event();
	
	ifr.style.left = (event.x - 175) + 'px';
	ifr.style.top =  (event.y + 15) + 'px';
	ifr.height = 210;
	ifr.style.zIndex=50;
	
	if (key2loaded == false)
	{
		var url = 'NXSRCHKEY2.pgm?instance=' + instance + "&rand=" +  randnum;
		ifr.src = url;
		key2loaded = true;
	}
	
	xl_GetObj('key2pair').style.display = "";
	xl_GetObj('keypair').style.display = "none";
	if (parent.adjustIFrameSize) parent.adjustIFrameSize(window);
}

function openkey3(instance) 
{ 
	var ifr = xl_GetObj('keyframe');
	var event = xl_event();
	
	ifr.style.left = event.x + 'px';
	ifr.style.top =  event.y + 'px';
	ifr.height = 210;
	ifr.style.zIndex=50;
	
	if (key2loaded == false)
	{
		var url = 'NXSRCHKEY.pgm?instance=' + instance + "&equal=N" + "&rand=" +  randnum;
		ifr.src = url;
		keyloaded = true;
	}
	
	xl_GetObj('keypair').style.display = "";
	if (parent.adjustIFrameSize) parent.adjustIFrameSize(window);
}


function postoend() 
{ 
	
	document.inpform.srchkeys.value = document.inpform.srchkeys.value + "";
}


function postoend2() 
{ 
	
	document.inpform.srchkeys2.value = document.inpform.srchkeys2.value + "";
}


function massdelete()
{
	
	
	if ((document.inpform.srchkeys.value != '') || (document.inpform.srchkeys2.value != ''))
	{	
		var return_value = confirm('You are about to permanently delete all the ECM entries that match the defined search criteria. Do you wish to continue?');
		
		if ( return_value == true )
		{
			inpform.massdltflg.value='Y';
			inpform.submit();
		}
	}
	else
	{
		alert('You must enter a Search Criteria for the Delete');
	}
}


function optdispdocument(optaddsrch, optaddapnd) 
{ 
	if (optaddsrch == "Y")
	{	
		optbox4.style.display = "";
	}
	
	if (optaddapnd == "Y")
	{	
		optbox5.style.display = "";
	}
}

function stripfilename()
{
	var z = 0;
	var endpos;
	
	for (var x = 1000; x >= 0; x--) 
	{ 
		z = z + 1;
		var y = xl_GetObj('upfile').value.substring(x,x - 1);
		
		if (y == '.') 
			endpos = x - 1;       	
		
		if (y == "\\") 
			break;
	}
	
	
	if ((x > 0) && (xl_GetObj('title').value == '')) 
		xl_GetObj('title').value = xl_GetObj('upfile').value.substring(x,endpos); 
	
	z = 0;
	for (var x = 255; x >= 0; x--) 
	{ 
		z = z + 1;
		var y = xl_GetObj('upfile').value.substring(x,x - 1);
		
		if (y == ".") 
		{ 
			break;
		} 
	}
	
	var exttype = xl_GetObj('upfile').value.substring(x,z).toUpperCase();
	
	if ((exttype == "JPG") || (exttype == "JPEG") || (exttype == "GIF") || (exttype == "BMP") || (exttype == "TIFF") || (exttype == "PNG"))
	{
		xl_GetObj('imgsize').checked = true;
		xl_GetObj('imgsize').style.display = '';
	}
	else
	{
		xl_GetObj('imgsize').style.display = 'none';
		xl_GetObj('imgsize').checked = false;
	}
}

function check_type()
{
	if (xl_GetObj('resize_img'))
	{
		var exttype = document.inpform.wltype.options[document.inpform.wltype.selectedIndex].value.toUpperCase();

		//var exttype = xl_GetObj('wltype').options[xl_GetObj('wltype').selectedIndex].value.toUpperCase();
		if ((exttype == "JPG") || (exttype == "JPEG") || (exttype == "GIF") || (exttype == "BMP") || (exttype == "TIFF") || (exttype == "PNG"))
		{
			xl_GetObj('resize_img').style.display = '';
		}
		else
		{
			xl_GetObj('resize_img').style.display = 'none';
			xl_GetObj('resize_img').checked = false;
		}
	}
}

function addoptdisp() 
{ 	
	document.forms[0].srchkeys.disabled=false;
	document.forms[0].addsearch.disabled=false;
	document.forms[0].addappend.disabled=false;
	
	var z = 0;
	var endpos;
	
	for (var x = 1000; x >= 0; x--) 
	{ 
		z = z + 1;
		var y = xl_GetObj('upfile').value.substring(x,x - 1);
		
		if (y == '.') 
			endpos = x - 1;       	
		
		if (y == "\\") 
			break;
	}
	
	
	if ((xl_GetObj('DMSDSC').value == "") && (x > 0)) 
		xl_GetObj('DMSDSC').value = xl_GetObj('upfile').value.substring(x,endpos); 
	
	if ((xl_GetObj('srchkeys').value == "") && (x > 0)) 
		xl_GetObj('srchkeys').value = xl_GetObj('upfile').value.substring(x,endpos); 
	
	if (settype == 'Y')		
	{
		z = 0;
		for (var x = 255; x >= 0; x--) 
		{ 
			z = z + 1;
			var y = document.inpform.upfile.value.substring(x,x - 1);
			
			if (y == ".") 
			{ 
				break;
			} 
		}
		
		var exttype = document.inpform.upfile.value.substring(x,z);
		
		var selectedindex = 0;
		for (var counter=0; counter < inpform.wltype.length; counter++) 
		{
			if (inpform.wltype.options[counter].value.toUpperCase() == exttype.toUpperCase())
				selectedindex = counter;
		}
		
		if (selectedindex != '')
			inpform.wltype.options[selectedindex].selected = true;
		else
			inpform.wltype.options[0].selected = true;
		
		check_type();
	}
}

function addvalue() 
{
	document.inpform.srchkeys.value = document.inpform.srchkeys.value + " " + document.inpform.kvpairs.value+"=";
}

function showkvp(allowkv)
{
	if (allowkv == "Y")
	{
		xl_GetObj('allowkv2').style.display = "";
	} 
	else 
	{
		xl_GetObj('allowkv2').style.display = "none";
	}
}

function addhtml_setup(allowkv)
{
	if (allowkv == "Y")
	{
		xl_GetObj('allowkv1').style.display = "";
	} 
	else 
	{
		xl_GetObj('allowkv1').style.display = "none";
	}
}

function setstart()
{
	var current_node = "";
	var parent_node = "";
	
	if ((document.inpform.auxicons.value == "Y") && (document.inpform.objauth.value == "Y") && (document.forms[0].addtype.value != "Header") && (document.forms[0].addtype.value != "Symbolic"))
	{
		if ((document.inpform.addtype.value != "Folder") && (document.inpform.addtype.value != "Header"))
			xl_GetObj('auxregister').style.display = "";
		
		xl_GetObj('auxselect').style.display = "";
		
		
		if ((document.inpform.auxsmurf.value != "") || (document.inpform.srchkeys.value.search('ListObjects') != -1))
			document.inpform.srchkeys.disabled = true;
	}
}

function statusMsg()
{
	if (document.inpform.statusmsg.value != '') 
	{
		document.write(document.inpform.statusmsg.value);
		var url = 'NXMNGDOC.pgm?task=menuframe&instance=' + document.inpform.instance.value + '&wnode=' + document.inpform.fromnode.value + '&scrollto=' + parent.frames["tree_frame"].container.scrollTop + "&rand=" +  randnum;
		parent.frames["tree_frame"].location.href = url;
	}
}

function Reload_MaintTree(node)
{
	var url = 'NXMNGDOC.pgm?task=menuframe&wnode=' + node + '&scrollto=' + parent.frames["tree_frame"].container.scrollTop + "&rand=" +  randnum;
	parent.frames["tree_frame"].location.href = url;
}

function sellink()
{
	
	var linktype = document.inpform.lnktype.options[document.inpform.lnktype.selectedIndex].value;
	
	if (document.inpform.lnktype.selectedIndex == 0)
	{
		xl_GetObj('ecmdoc').style.display = "";
		xl_GetObj('url').style.display = "none";
		document.inpform.urldoc.value = "";
		xl_GetObj('template').style.display = "none";
		xl_GetObj('prcdir').style.display = "none";
		
		if (document.inpform.task.value  != 'endadd')
		{
			xl_GetObj('urlview').style.display = "none";
			xl_GetObj('downloadbtn').style.display = "none";
			xl_GetObj('urlview2').style.display = "none";
		}
	}
	else
	{
		xl_GetObj('ecmdoc').style.display = "none";
		xl_GetObj('url').style.display = "";
		if (document.inpform.urldoc.value == "")
			document.inpform.urldoc.value = "http://";
		document.inpform.wnode2.value = 0;
		document.inpform.nodename2.value = "";
		xl_GetObj('template').style.display = "";
	}
	
}


function changecss()
{
	if (document.inpform.htmlflag.value == 'HTML')
	{
		var cssname;
		var sitepath = document.inpform.sitepath.value;
		
		if (document.inpform.WLSKIN.options[document.inpform.WLSKIN.selectedIndex].value == 0)
			cssname = sitepath + 'ECM/DocSkins/ECMDocSkin' + document.inpform.parentskin.value + '.css';
		else	
			cssname = sitepath + 'ECM/DocSkins/ECMDocSkin' + document.inpform.WLSKIN.options[document.inpform.WLSKIN.selectedIndex].value + '.css';
		
		oEdit1.isCssLoaded=false;
		oEdit1.css = cssname;
		oEdit1.arrStyle=[];
		var idStyles=document.getElementById("idStyles"+oEdit1.oName);
		idStyles.innerHTML = '';
		
		document.forms.inpform.taskdesc2.value = oEdit1.getHTMLBody();
		oEdit1.loadHTML(document.forms.inpform.taskdesc2.value);
	}
}

function changedftcnt()
{
	if (inpform.ecmdftcnt.options[inpform.ecmdftcnt.selectedIndex].value != 0)
	{
		var return_value = false;
		if (oEdit1.getHTMLBody() != "")
			return_value = confirm('If you select a new default you will replace the current HTML content. Do you wish to continue?');
		else
			return_value = true;
		
		if ( return_value == true )
		{
			var random_num = Math.round((Math.random()*10000)+1);
			var myurl = "NXDOCSRCH2.pgm?task=getdftcnt&dftcntnbr=" + inpform.ecmdftcnt.options[inpform.ecmdftcnt.selectedIndex].value + '&rndnum=' + random_num + '&instance=' + document.inpform.instance.value + "&rand=" +  randnum; 
			var mydiv = "responsehtml";
		}
		
		xl_AjaxUpdate(myurl, mydiv, Receive_AJAX_Response); 
	}
	
}

function Receive_AJAX_Response(mydiv, response )
{
	oEdit1.loadHTML(response);
	changecss();
}

function submitAddForm() 
{
	
	var errorflg = validate();
	if (errorflg != 'Y')
	{
		document.inpform.srchkeys.disabled = false;
		document.inpform.nodename2.disabled = false;
		
		loadingfile.style.display = "";
		document.forms.inpform.submit();
	}
}


function submitForm() 
{
	var errorflg = validate();
	if (errorflg != 'Y')
	{
		document.inpform.srchkeys.disabled = false;
		document.inpform.nodename2.disabled = false;
		
		if (document.inpform.htmlflag.value == 'HTML')
		{
			
			if (document.inpform.DMTYPE.value == 'Header')
				document.forms.inpform.taskdesc2.value = oEdit1.getHTMLBody();
			else
				document.forms.inpform.taskdesc2.value = oEdit1.getHTML();
			
			if (document.forms.inpform.taskdesc2.value.length <= 50000)
				document.forms.inpform.submit();
			else
				alert('Error: The documented you attempted to add is ' + document.forms.inpform.taskdesc2.value.length + ' characters. The maximum size for documents created in the Nexus ECM is 50,000 characters.');
			
		}
		else
		{
			xl_GetObj('loadingfile').style.display = '';
			xl_GetObj('statusmsg').style.display = 'none';
			document.forms.inpform.submit();
		}
		
		if (document.inpform.framename.value != "")
			parent.xl_GetObj('quickadd2').style.display = 'none';
	}
}

function submitFormDocument() 
{
	var errorflg = validate();
	if (errorflg != 'Y')
	{
		
		// Auxinput
		document.inpform.srchkeys.disabled = false;	
		
		if (document.forms[0].addtype.value == "Header")
			document.forms.inpform.elements.taskdesc2.value = oEdit1.getHTMLBody();
		else
			document.forms.inpform.elements.taskdesc2.value = oEdit1.getHTML();
		document.forms.inpform.submit();
	}
}

function confirm_delete()
{
	var url = 'NXDOCSRCH2.pgm?task=del&instance=' + xl_GetObj('instance').value + '&rrn=' + xl_GetObj('rrn').value + '&wnode=' + xl_GetObj('fromnode').value + "&rnd=" + randnum + '&framename=' + xl_GetObj('framename').value;
	if (document.inpform.DMTYPE.value == 'Folder')
	{
		var return_value = confirm('You are about to permanently delete this folder and all of its subfolders. Do you wish to continue?');
		
		if ( return_value == true )
			document.location = url;
	}
	else
	{
		var return_value = confirm('You are about to permanently delete this object. Do you wish to continue?');
		
		if ( return_value == true )
			document.location = url;
	}
}


function setupEditor()
{
	
	oEdit1.mode="HTMLBody";
	oEdit1.btnSpellCheck=true;
	oEdit1.height="250";
	oEdit1.width="400";
	
	oEdit1.features=["FullScreen","Preview","Print","Search","Cut","Copy","Paste","PasteWord","PasteText","|","Undo","Redo","|","ForeColor","BackColor","|","Bookmark","Hyperlink","XHTMLSource","|","Numbering","Bullets","|","Indent","Outdent","BRK","Paragraph","FontName","FontSize","|","LTR","RTL","|","Table","Guidelines","Absolute","|","Characters","Line","Form","RemoveFormat","ClearAll","BRK","Image","Flash","Media","|","StyleAndFormatting","TextFormatting","ListFormatting","BoxFormatting","ParagraphFormatting","CssText","Styles","|","Bold","Italic","Underline","Strikethrough","|","JustifyLeft","JustifyCenter","JustifyRight","JustifyFull", "|", "CustomTag", "|", "SpellCheck"];
	
	var header = '<div class="welcome">Welcome Text...<div class="welcome_Description">Welcome description...</div><br></div>';
	var columnheadingfloat = '<div class="column"><div class="Banner"><span class="banner_highlight"></span><span class="banner_space"></span>Column Heading</div><div class="Column_Text">Column 1 text...</div></div>';
	var columnheading = '<div class="Banner"><span class="banner_highlight"></span><span class="banner_space"></span>Column Heading</div><div class="Column_Text">Column 1 text...</div>';
	var bullet = '<li><span class="bullet">Bullet text...</span></li>';
	var TextFrame = '<div align="center"><div class="TextFrame"><span class="innerTextFrame">Test text...</span></div></div>';
	var CenteredImage =  '<div class="image" align="center"><img height="100" width="100" align="middle" border="0"></div>';
	var imageundertext = '<div class="image" align="left">Test text...<br><div align="center"><br><img height="100" width="100" align="middle" border="0"></div></div>';	
	var imageabovetext = '<div class="image" align="left"><div align="center"><br><img height="100" width="100" align="middle" border="0"></div><br>Test text...</div>';
	var floatimageleft = '<img class="floatleft" height="100" width="100" align="middle" border="0">';
	var floatimageright = '<img class="floatright" height="100" width="100" align="middle" border="0">';
	var Listitems = '<div class="listitems"><span class="banner">List Heading...</span><ul><li>Item 1</li><li>Item 2</li></ul></div>';
	var quotebox = '<div align="center"><div class="quote" align="center">"Quote..."</div></div>';
	var singlecolumn = '<table class="column_table"><tr><td class="column_Single"><div class="column"><div class="Banner"><span class="banner_highlight"></span><span class="banner_space"></span>Column Heading</div><div class="Column_Text">Column text...</div><br><span class="Guide_Text"> More Column Headings...</span></div></td></tr></table>';
	var twocolumn = '<table class="column_table"><tr><td class="column1"><div class="column"><div class="Banner"><span class="banner_highlight"></span><span class="banner_space"></span>Column Heading</div> <div class="Column_Text">Column text...</div><br><span class="Guide_Text"> More Column Headings...</span></div></td><td class="column_space"></td><td class="column2"><div class="column"><div class="Banner"><span class="banner_highlight"></span><span class="banner_space"></span>Column Heading</div><div class="Column_Text">Column text...</div><br><span class="Guide_Text"> More Column Headings... </span></div></td></tr></table>';
	
	oEdit1.arrCustomTag=[["Single Column",singlecolumn],["Two Column",twocolumn],["Header",header],["column Header",columnheading],["Floating column Header",columnheadingfloat],["bullet",bullet],["List Items",Listitems],["Quote",quotebox],["Text Frame",TextFrame],["Image Under Text",imageundertext],["Image Above Text",imageabovetext],["Centered Image",CenteredImage],["Float Image Left",floatimageleft],["Float Image Right",floatimageright]];
	oEdit1.btnStyles=true;
	oEdit1.initialRefresh=true;
	
	oEdit1.REPLACE("taskdesc2");
}

function validate()
{
	var errorflg = val_InpChar('DMSDSC', 'Name', xl_GetObj('doc_name'),'N');
	var errorflg2 = val_InpChar('dddesc', 'Description', xl_GetObj('doc_description'),'Y');
	if (errorflg2 == 'Y')
	{
		
		errorflg = 'Y';
	}
	
	if (xl_GetObj('purgedate') && ((xl_GetObj('purgedate').value != "*NEVER") && (isDate(xl_GetObj('purgedate').value) == false)))
	{
		alert('The Purge Date entered is invalid. Make sure it is in yyyy-mm-dd format (Eg: 2001-12-25) or *NEVER.');
		doc_purgedate.className = 'error';
		errorflg = 'Y';
	}
	
	
	if (document.inpform.htmlflag.value != 'HTML')
	{
		if ((document.inpform.upfile.value == '') && (document.inpform.addtype.value != 'Symbolic') && (document.inpform.addtype.value != 'Folder') && (document.inpform.DMPCPA.value == ''))
		{
			alert('You must enter a vaild path. Use the Browse button to enter a path.');
			pcfile.className = 'error';
			errorflg = 'Y';
		}
	}
	
	if ((document.inpform.addtype.value == 'Symbolic') && (document.inpform.wnode2.value == 0) && (document.inpform.lnktype.selectedIndex == 0))
	{
		alert('You must select an ECM location for the link.');
		Symbolic.className = 'error';
		errorflg = 'Y';
	}
	
	if ((document.inpform.addtype.value == 'Symbolic') && (document.inpform.lnktype.selectedIndex == 1) && (xl_GetObj('urldoc').value == ''))
	{
		alert('You must enter a URL for the link.');
		Symbolic.className = 'error';
		errorflg = 'Y';
	}
	
	return 	errorflg;
}


/*********** Date validation *************/

var dtCh= "-";
var minYear=0001;
var maxYear=2100;

function isInteger(s){
	var i;
	for (i = 0; i < s.length; i++){   
		// Check that current character is number.
		var c = s.charAt(i);
		if (((c < "0") || (c > "9"))) return false;
	}
	// All characters are numbers.
	return true;
}

function stripCharsInBag(s, bag){
	var i;
	var returnString = "";
	// Search through string's characters one by one.
	// If character is not in bag, append to returnString.
	for (i = 0; i < s.length; i++){   
		var c = s.charAt(i);
		if (bag.indexOf(c) == -1) returnString += c;
	}
	return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
	// EXCEPT for centurial years which are not also divisible by 400.
	return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}

function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
	} 
	return this
}

function isDate(dtStr)
{
	var daysInMonth = DaysArray(12);
	var pos1=dtStr.indexOf(dtCh);
	var pos2=dtStr.indexOf(dtCh,pos1+1);
	
	var strYear=dtStr.substring(0,pos1);
	var strMonth=dtStr.substring(pos1+1,pos2);
	var strDay=dtStr.substring(pos2+1);
	
	strYr=strYear;
	
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
		if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
		}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		return false
	}
	//if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
	//	return false
	//}
	return true
}

/*********** Date validation *************/


/****************************************End ECM Functions *********************************************/



/****************************************Start Distribution Functions *********************************************/

function distdelconfirm()
{
	var url = 'NXDCRULE.pgm?task=del&instance=' + xl_GetObj('instance').value + '&currrn=' + xl_GetObj('currrn').value + "&rnd=" + randnum;
	
	
	var return_value = confirm('You are about to permanently delete this rule. Do you wish to continue?');
	
	// TEST TO SEE IF TRUE|FALSE RETURNED
	if ( return_value == true )
		document.location = url;
}


function distauthaccumflg()
{
	if (inpform.authaccum.checked == true)
	{
		
		folder1.style.display = "none";
		folder3.style.display = "none";
		purge.style.display = "none";
		document.inpform.wnode2.value = '0';
		
	}
	else
	{
		folder1.style.display = "";
		folder3.style.display = "";
		purge.style.display = "";
		if (parent.adjustIFrameSize) parent.adjustIFrameSize(window);
	}
	
}


function distpagefunc1()
{
	pageval = "1";
	distoptdisp();
	xl_GetObj('pg1').className = "tabsel";
	xl_GetObj('pg2').className = "tab";
	
	document.inpform.srchkeys.focus();
	
	if (parent.adjustIFrameSize) parent.adjustIFrameSize(window);
}

function distpagefunc2()
{
	pageval = "2";
	distoptdisp();
	xl_GetObj('pg1').className = "tab";
	xl_GetObj('pg2').className = "tabsel";
	
	
	if (parent.adjustIFrameSize) parent.adjustIFrameSize(window);
}


function distoptdisp() 
{ 
	xl_GetObj('pagedsp1').style.display = "none";
	xl_GetObj('pagedsp2').style.display = "none";
	
	
	if (pageval == "1") 
	{	
		xl_GetObj('pagedsp1').style.display = "";
	} 
	
	if (pageval == "2") 
	{
		xl_GetObj('pagedsp2').style.display = "";
		xl_GetObj('keypair').style.display = "none";
		xl_GetObj('key2pair').style.display = "none";
		
	}
	
	distauthaccumflg();	
}



function submitDistForm()
{
	if ((xl_GetObj('purgedate').value != "*NEVER") && (isDate(xl_GetObj('purgedate').value) == false) && (IsNumeric(xl_GetObj('purgedate').value) == false))
	{
		alert('The Purge Date entered is invalid. Make sure it is in yyyy-mm-dd format (Eg: 2001-12-25), number of days (Eg: 30) or *NEVER.');
		xl_GetObj('purge').className = 'error';
		errorflg = 'Y';
	}
	else
		document.forms.inpform.submit();
}

function IsNumeric(sValue)
{
	var ValidChars = '0123456789';
	var IsNumber=true;
	var Char;
	
	for (i = 0; i < sValue.length && IsNumber == true; i++) 
	{ 
		Char = sValue.charAt(i); 
		if (ValidChars.indexOf(Char) == -1) 
			IsNumber = false;
	}
	
	return IsNumber;
	
}


/****************************************End Distribution Functions *********************************************/

function include() 
{
	if (document.forms[0].incltype.checked) 
	{
		xl_GetObj('url').style.display = "";
		xl_GetObj('ajax').style.display = "";
		xl_GetObj('html').style.display = "none";
		document.forms[0].type.value = "U";
		xl_GetObj('width').style.display = "";
		xl_GetObj('height').style.display = "";	
	} 
	else 
	{
		xl_GetObj('html').style.display = "";
		xl_GetObj('url').style.display = "none";
		xl_GetObj('ajax').style.display = "none";
		document.forms[0].type.value = "";
		xl_GetObj('width').style.display = "none";
		xl_GetObj('height').style.display = "none";		
	}
	
	adjustoptions();
}


function loadBreadCrumbs()
{
	var mydiv;
	var myurl = "nxmenu.pgm?task=breadcrmbs&docnum=" + document.headfrm.docnum.value + "&rndnum=" + randnum;	
	xl_AjaxUpdate(myurl, mydiv, Rcv_AJAX_BreadCrumbs);		
}

function Rcv_AJAX_BreadCrumbs(mydiv, response)
{
	xl_GetObj("breadCrumbs").innerHTML = response;
}

function textonly(string)
{
	var rtnerrors = '';
	string = string.toUpperCase();
	
	for (i=0; i < string.length; i++)
	{
		var chkvalue = string.substring(i,i + 1);
		if (checkCharacters(chkvalue) == 'N')
		{
			rtnerrors = rtnerrors + ' ' + chkvalue;
		}
	}
	
	return rtnerrors;
}

function checkCharacters(chkvalue)
{
	var found = 'N';
	var validCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 !@*$+_?.:()";
	for (y=0; y < validCharacters.length; y++)
	{
		if (chkvalue == validCharacters.substring(y,y + 1))
		{
			found = 'Y';
			return found;
		}
	}
	return found;
}

function val_InpChar(chkobj, title, errorid, allowblnk)
{
	var errorflg = 'N';
	var errortext = '';
	chkobj = xl_GetObj(chkobj);
	
	if ((chkobj.value == '') && (allowblnk != 'Y'))
	{
		errorid.className = 'error';
		errortext = 'The ' + title + ' cannot be blank. Please enter a valid ' + title + '.\r\n';	
	}
	
	var errors = textonly(chkobj.value);
	if (errors != '')
	{
		errorid.className = 'error';
		errortext = 'Error: The ' + title + ' contains invalid characters (' + errors + ').';
	}
	
	
	if (errortext != '')
	{
		alert(errortext);
		errorflg = 'Y';
	}
	
	return 	errorflg;
}

function nxheader(hdrtitle, firstname, lastname, userno) 
{	
	var addmin = "";	
	if (userno == '0000001') 
	{ 
		addmin = "<img align=\"middle\" class=\"cursorhand\" onclick=\"top.location.href = '/nexusadmin/nexadm.pgm?task=default';\" src=\"/nexuspublic/images/admin.gif\" align=\"middle\" alt=\"My Pages\" border=\"0\" height=\"13\" width=\"14\"><a href='/nexusadmin/nexadm.pgm?task=default' target='_top'>Admin Pages</a>";
	}
	
	if (userno == '0') 
	{ 
		rtnhtml ="<div id=\"header\"><div class=\"sign\"></div><div class=\"imgholder\"><div id=\"nx80\"></div><div id=\"nx81\"></div><div id=\"nx83\"></div></div><div class=\"mytitle\">" + hdrtitle + "</div></div>";	
	}
	else
	{	
		rtnhtml = "<div id=\"header\"><div class=\"imgholder\"><div id=\"nx80\"></div><div id=\"nx81\"></div><div id=\"nx83\"></div></div><div class=\"mytitle\">" + hdrtitle +"</div><div class=\"sign\"><div class=\"left\">Welcome "+firstname+" "+lastname+"</div><div class=\"right\">" + addmin + "&nbsp;<img align=\"middle\" class=\"cursorhand\" onclick=\"top.location.href = 'NXMENU.pgm?task=admmnt';\" src=\"/nexuspublic/images/manage.gif\" align=\"middle\" alt=\"Manage Site\" border=\"0\" height=\"13\" width=\"14\"><a href='NXMENU.pgm?task=admmnt' target='_top'>Manage Site</a>&nbsp;<img align=\"middle\" class=\"cursorhand\" onclick=\"top.location.href = 'NXMENU.pgm?task=usrmnt';\" src=\"/nexuspublic/images/settings.gif\" align=\"middle\" alt=\"User Settings\" border=\"0\" height=\"13\" width=\"14\"><a href='NXMENU.pgm?task=usrmnt' target='_top'>Settings</a>&nbsp;<img align=\"middle\" class=\"cursorhand\" onclick=\"top.location.href = 'nxmenu.pgm?adminpage=Y';\" src=\"/nexuspublic/images/mypages.gif\" align=\"middle\" alt=\"My Pages\" border=\"0\" height=\"13\" width=\"14\"><a href='nxmenu.pgm?adminpage=Y' target='_top'>My Pages</a>&nbsp;<a href='http://www.excelsystems.com/nexususerguide.htm' target='_blank'><img align=\"middle\" class=\"cursorhand\" src=\"/nexuspublic/images/questionMark.gif\" align=\"middle\" alt=\"Help\" border=\"0\" height=\"13\" width=\"14\"></a><a href='http://www.excelsystems.com/nexususerguide.htm' target='_blank'>Help</a>&nbsp;<img align=\"middle\" class=\"cursorhand\" onclick=\"top.location.href = 'nxlogin.pgm?task=out';\" src=\"/nexuspublic/images/log-out.gif\" align=\"middle\" alt=\"Log out\" border=\"0\" height=\"13\" width=\"14\"><a href='nxlogin.pgm?task=out' target='_top'>Log out</a></div></div></div>"; 
	}
	
	
	rtnhtml = rtnhtml + "<\/script><script>AJAX_Poller(\"30000\")</script><br><br>"; 	
	document.writeln(rtnhtml);
}


function nxheader2(hdrtitle, firstname, lastname, userno, manage) 
{	
	var addmin = "";
	if (userno == '0000001') 
	{ 
		addmin = "<img align=\"middle\" class=\"cursorhand\" onclick=\"top.location.href = '/nexusadmin/nexadm.pgm?task=default';\" src=\"/nexuspublic/images/admin.gif\" align=\"middle\" alt=\"My Pages\" border=\"0\" height=\"13\" width=\"14\"><a href='/nexusadmin/nexadm.pgm?task=default' target='_top'>Admin Pages</a>";
	}
	
	if (userno == '0') 
	{ 
		rtnhtml="<div id=\"header\"><div class=\"sign\"></div><div class=\"imgholder\"><div id=\"nx80\"></div><div id=\"nx81\"></div><div id=\"nx83\"></div></div><div class=\"mytitle\">" + hdrtitle + "</div></div>";	
	}
	else if ((manage == null) || (manage != 'Y'))
	{	
		rtnhtml = "<div id=\"header\"><div class=\"imgholder\"><div id=\"nx80\"></div><div id=\"nx81\"></div><div id=\"nx83\"></div></div><div class=\"mytitle\">" + hdrtitle +"</div><div class=\"sign\"><div class=\"left\">Welcome "+firstname+" "+lastname+"</div><div class=\"right\">&nbsp;<img align=\"middle\" class=\"cursorhand\" onclick=\"top.location.href = 'NXMENU.pgm?task=usrmnt';\" src=\"/nexuspublic/images/settings.gif\" align=\"middle\" alt=\"User Settings\" border=\"0\" height=\"13\" width=\"14\"><a href='NXMENU.pgm?task=usrmnt' target='_top'>Settings</a>&nbsp;<img align=\"middle\" class=\"cursorhand\" onclick=\"top.location.href = 'nxmenu.pgm?adminpage=Y';\" src=\"/nexuspublic/images/mypages.gif\" align=\"middle\" alt=\"My Pages\" border=\"0\" height=\"13\" width=\"14\"> <a href='nxmenu.pgm?adminpage=Y' target='_top'>My Pages</a>&nbsp;<a href='http://www.excelsystems.com/nexususerguide.htm' target='_blank'><img align=\"middle\" class=\"cursorhand\" src=\"/nexuspublic/images/questionMark.gif\" align=\"middle\" alt=\"Help\" border=\"0\" height=\"13\" width=\"14\"></a><a href='/nexuspublic/manual/nexus2guidepdf.pdf' target='_blank'>Help</a>&nbsp;<img align=\"middle\" class=\"cursorhand\" onclick=\"top.location.href = 'nxlogin.pgm?task=out';\" src=\"/nexuspublic/images/log-out.gif\" align=\"middle\" alt=\"Log out\" border=\"0\" height=\"13\" width=\"14\"><a href='nxlogin.pgm?task=out' target='_top'>Log out</a></div></div></div>"; 
	}
	else if ((manage != null) && (manage == 'Y'))
	{	
		rtnhtml = "<div id=\"header\"><div class=\"imgholder\"><div id=\"nx80\"></div><div id=\"nx81\"></div><div id=\"nx83\"></div>	</div>	<div class=\"mytitle\">" + hdrtitle +"</div><div class=\"sign\"><div class=\"left\">Welcome "+firstname+" "+lastname+"</div><div class=\"right\">" + addmin + "&nbsp;<img align=\"middle\" class=\"cursorhand\" onclick=\"top.location.href = 'NXMENU.pgm?task=admmnt';\" src=\"/nexuspublic/images/manage.gif\" align=\"middle\" alt=\"Manage Site\" border=\"0\" height=\"13\" width=\"14\"><a href='NXMENU.pgm?task=admmnt' target='_top'>Manage Site</a>&nbsp;<img align=\"middle\" class=\"cursorhand\" onclick=\"top.location.href = 'NXMENU.pgm?task=usrmnt';\" src=\"/nexuspublic/images/settings.gif\" align=\"middle\" alt=\"User Settings\" border=\"0\" height=\"13\" width=\"14\"><a href='NXMENU.pgm?task=usrmnt' target='_top'>Settings</a>&nbsp;<img align=\"middle\" class=\"cursorhand\" onclick=\"top.location.href = 'nxmenu.pgm?adminpage=Y';\" src=\"/nexuspublic/images/mypages.gif\" align=\"middle\" alt=\"My Pages\" border=\"0\" height=\"13\" width=\"14\"> <a href='nxmenu.pgm?adminpage=Y' target='_top'>My Pages</a>&nbsp;<a href='http://www.excelsystems.com/nexususerguide.htm' target='_blank'><img align=\"middle\" class=\"cursorhand\" src=\"/nexuspublic/images/questionMark.gif\" align=\"middle\" alt=\"Help\" border=\"0\" height=\"13\" width=\"14\"></a>&nbsp;<a href='http://www.excelsystems.com/nexususerguide.htm' target='_blank'>Help</a>&nbsp;<img align=\"middle\" class=\"cursorhand\" onclick=\"top.location.href = 'nxlogin.pgm?task=out';\" src=\"/nexuspublic/images/log-out.gif\" align=\"middle\" alt=\"Log out\" border=\"0\" height=\"13\" width=\"14\"><a href='nxlogin.pgm?task=out' target='_top'>Log out</a></div></div></div>"; 
	}
	
	
	rtnhtml = rtnhtml + "<\/script><script>AJAX_Poller(\"30000\")</script><br>"; 
	
	document.writeln(rtnhtml);
}

// Open user or group popup window
function openusrgrppopup(type,group,single) 
{ 
	var ifr = xl_GetObj('usrgrpframe');
	ifr.height = 100;
	var event = xl_event();
	
	var y = event.clientY;
	var x = event.clientX;
	
	if ((450 + x) > document.body.scrollWidth)	
	{
		x = (document.body.scrollWidth - 450) - 10;
	}
	
	if ((300 + y) > document.body.scrollHeight)	
	{
		y = (document.body.scrollHeight - 300) - 10;
		
		if (y < 0)
			y = 5;
	}
	
	ifr.style.left = x + 'px';
	ifr.style.top = y + 'px';
	
	var url = 'NXPOPUPS.pgm?type=' + type + "&group=" + group + "&single=" + single + "&rand=" +  randnum;
	ifr.src = url;
	ifr.style.zIndex=50;
	
	xl_GetObj('usrgrppopup').style.display = "";	
}

function checkparentpos(ifr)
{
	try {
		bodyWidth = parent.document.body.offsetWidth;
		bodyHeight = parent.document.body.offsetHeight;
		
		var parifr = parent.xl_GetObj('auxframe');
		var x = parseInt(parifr.style.left) + parseInt(ifr.style.width);
		
		if (x > bodyWidth)
			parifr.style.left = parseInt(parifr.style.left) - (x-bodyWidth) - 50 + 'px';
		
		var y = parseInt(parifr.style.top) + parseInt(ifr.style.height);
		
		if (y > bodyHeight)
			parifr.style.top = parseInt(parifr.style.top) - (y-bodyHeight) - 120 + 'px';
		
		if (parseInt(parifr.style.height) < (parseInt(ifr.style.top) + parseInt(ifr.height) + 30))
			parifr.style.height = (parseInt(ifr.style.top) + parseInt(ifr.height)) + 30 + 'px';
		
		if (parseInt(parifr.style.width) < (parseInt(ifr.style.left) + parseInt(ifr.width) + 20))
			parifr.style.width = (parseInt(ifr.style.left) + parseInt(ifr.width)) + 20 + 'px';
	} catch(err)
	{
		return;
	}
}

// Pause the browser
function pausecomp(Amount)
{
	d = new Date() //today's date
	while (1)
	{
		mill=new Date() // Date Now
		diff = mill-d //difference in milliseconds
		if( diff > Amount ) {break;}
	}
}

// Group mng return selected user from window
function returnuser(user,single,usrnbr,parentrqst)
{
	// Update the last used file 
	var url = 'nxpopups.pgm?task=addlast&usernbr=' + usrnbr + '&group=0' + "&rand=" +  randnum;
	
	if (xl_GetObj('lastframe'))
		xl_GetObj('lastframe').src = url;	
	
	if (parent.document.inpform.nxUserName)
	{
		if (single == "N")
		{
			var len = parent.document.inpform.nxUserName.length;
			var returnvalue = parent.document.inpform.nxUserName.value.substring(len, len - 1);
			if ((returnvalue == ';') || (len == 0) || (len == null))
			{
				parent.document.inpform.nxUserName.value = parent.document.inpform.nxUserName.value + user + ';';
			}
			else
			{
				parent.document.inpform.nxUserName.value = parent.document.inpform.nxUserName.value + ';' + user + ';';
			}
		}
		else
		{
			parent.document.inpform.nxUserName.value = user;
			parent.xl_GetObj('usrgrppopup').style.display='none';
		}
		
		
		if (parentrqst == "")
		{
			parent.document.inpform.nxUserName.focus();
			parent.document.inpform.nxUserName.value = parent.document.inpform.nxUserName.value + "";
		}
		
		
	}
	
	if (parent.document.inpform.srchkeys)
	{
		if (single == "N")
		{
			var len = parent.document.inpform.srchkeys.length;
			var returnvalue = parent.document.inpform.srchkeys.value.substring(len, len - 1);
			if ((returnvalue == ';') || (len == 0) || (len == null))
			{
				parent.document.inpform.srchkeys.value = parent.document.inpform.srchkeys.value + user + ';';
			}
			else
			{
				parent.document.inpform.srchkeys.value = parent.document.inpform.srchkeys.value + ';' + user + ';';
			}			
		}
		else
		{
			
			parent.document.inpform.srchkeys.value = user;
			parent.usrgrppopup.style.display='none';
		}
		
		parent.document.inpform.srchkeys.focus();
		parent.document.inpform.srchkeys.value = parent.document.inpform.srchkeys.value + "";
	}
	
	if (parentrqst != "")
	{
		parent.authframe.document.inpform.nxUserName.value = user;
		parent.usrgrppopup.style.display='none';
		
	}
}

// Group mng return selected group from window
function returngroup(group,groupnbr,type,single,parentrqst)
{
	// Update the last used file 
	var url = 'nxpopups.pgm?task=addlast&group=' + groupnbr + '&usernbr=0' + "&rand=" +  randnum;
	
	if (xl_GetObj('lastframe'))
		xl_GetObj('lastframe').src = url;
	
	if (single == "N")
	{
		var len = parent.document.inpform.nxGroupName.length;
		var returnvalue = parent.document.inpform.nxGroupName.value.substring(len, len - 1);
		if ((returnvalue == ';') || (len == 0) || (len == null))
		{
			parent.document.inpform.nxGroupName.value = parent.document.inpform.nxGroupName.value + group + ';';
			parent.document.inpform.nxGroupNbr.value = parent.document.inpform.nxGroupNbr.value + groupnbr + ';';
		}
		else
		{
			parent.document.inpform.nxGroupName.value = parent.document.inpform.nxGroupName.value + ';' + group + ';';
			parent.document.inpform.nxGroupNbr.value = parent.document.inpform.nxGroupNbr.value + ';' + groupnbr + ';';
		}				
	}
	else
	{
		if (parentrqst != "")
		{
			parent.authframe.document.inpform.nxGroupName.value = group;
			parent.authframe.document.inpform.nxGroupNbr.value = groupnbr;
		}
		else
		{
			parent.document.inpform.nxGroupName.value = group;
			parent.document.inpform.nxGroupNbr.value = groupnbr;
		}	
		parent.xl_GetObj('usrgrppopup').style.display='none';
	}
}

// Close the user and group popup window
function closewin()
{
	parent.xl_GetObj('usrgrppopup').style.display='none';
}

// Close the document selection popup
function closetreewin(type, framename)
{
	if (framename != '')
	{
		top.frames['block_page'].xl_GetObj('auxframe').style.display='none';
		if (parent.xl_GetObj('doctree'))
			parent.xl_GetObj('doctree').style.display='none';
		
	}
	else
	{
		parent.xl_GetObj('doctree').style.display='none';
		parent.xl_GetObj('doctree').src = '';
		
		if (type != 'S')
		{
			parent.adjustoptions();
		}
	}
}



function returnto(task, group)
{
	if (xl_GetObj('group').value != "0000000")
	{
		document.location = document.inpform.rdr.value + '?task=' + task + '&group=' + group;
	}
	else
	{
		document.location = document.inpform.rdr.value;
	}
}

function smisrldisplay(smisrl) 
{
	if (smisrl == "Y") 
	{
		xl_GetObj('display1').style.display = "";
	} 
	else 
	{
		xl_GetObj('display1').style.display = "none";
	}
	
	if (document.inpform.group.value == "0000000")
	{
		xl_GetObj('admheader').style.display = "";
		xl_GetObj('admtable').className = "adminPageBorder";	
	}
	else
	{
		xl_GetObj('pagebody').className = "nomarg";
		xl_GetObj('buttons').className = "form";
	}	
	
	if (document.inpform.siteadmin.value == "Y")
	{
		xl_GetObj('sitemng').style.display = "";
	}
}


// This function check for creation authority for user and group
function chkoptauth(user, group, ceiling, useradd, groupadd, sitemng)
{
	if ((document.inpform.group.value == '0000001') || (document.inpform.group.value == 1))
		xl_GetObj('prntgrp').style.display = 'none';
	else
		xl_GetObj('prntgrp').style.display = '';
	
	if ((sitemng != 'Y') || ((document.inpform.group.value == '0000001') || (document.inpform.group.value == 1)))
	{
		
		if ((useradd != 'Y') || ((document.inpform.group.value == '0000001') || (document.inpform.group.value == 1)))
		{
			document.inpform.GMCRTUSR.disabled=true;
			if ((sitemng != 'Y') && (useradd != 'Y'))
				xl_GetObj('pg3').style.display = 'none';
		}
		
		if ((groupadd != 'Y') || ((document.inpform.group.value == '0000001') || (document.inpform.group.value == 1)))
		{
			document.inpform.GMCRTGRP.disabled=true;
		}
	}
	
	if ((document.inpform.group.value == '0000001') || (document.inpform.group.value == 1))
	{
		document.inpform.GMCEIL.disabled=true;
		xl_GetObj('prntgrp').style.display = 'none';
	}
	
	if (user == 'Y')
	{
		//parent.crtuser.style.display = "";
		document.inpform.GMCRTUSR.checked = "checked";
	}
	else
	{
		//parent.crtuser.style.display = "none";
	}
	
	if ((group == 'Y') || (sitemng == 'Y'))
	{
		xl_GetObj('crtgroup').style.display = "";
		xl_GetObj('crtgroup1').style.display = "";
		if (group == 'Y') 
			document.inpform.GMCRTGRP.checked = "checked";
	}
	else
	{
		xl_GetObj('crtgroup').style.display = "none";
		xl_GetObj('crtgroup1').style.display = "none";
	}
	
	if (ceiling == 'Y')
	{
		document.inpform.GMCEIL.checked = "checked";
	}
}

function adjustIFrameSize (iframeWindow, HeightAdj) 
{	
	if (!HeightAdj)
		HeightAdj = 5;
		
	//if (iframeWindow.document.height) 
	//if ((iframeWindow.document.body.scrollHeight) && (xl_GetObj(iframeWindow.name)))
	//{
		//var iframeElement = xl_GetObj(iframeWindow.name);
	//	iframeElement.style.height = iframeWindow.document.height + 'px';
	//	iframeElement.style.height = iframeWindow.document.body.scrollHeight+ 'px';
		//iframeElement.height = iframeWindow.document.body.scrollHeight + 'px';
	//}
	//else if (document.all) 
	//if (document.all)
	//{
		//var iframeElement = document.all[iframeWindow.name];
		var iframeElement = xl_GetObj(iframeWindow.name);
		
		if (iframeElement)
			if (iframeWindow.document.compatMode && iframeWindow.document.compatMode != 'BackCompat') 
		{
			iframeElement.style.height = iframeWindow.document.documentElement.scrollHeight + HeightAdj + 'px';
		}
		else 
		{
			if(iframeWindow.document.body.scrollHeight == 0)
			{
				iframearray[iframectr] = iframeWindow;		
				iframectr = iframectr + 1;
			}
			else
			{
				iframeElement.style.height = iframeWindow.document.body.scrollHeight + HeightAdj + 'px';
			}
		}
	//}
}

function adjustIFrame (iframeWindow) 
{	
	var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1];
	var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0; //extra height in px to add to iframe in FireFox 1.0+ browsers
	
	if (iframeWindow.document.height) 
	{
		var iframeElement = xl_GetObj(iframeWindow.name);
		var newheight = iframeWindow.document.height + FFextraHeight;
		iframeElement.style.height = newheight + 'px';
		iframeElement.style.width = iframeWindow.document.width + 'px';
	}
	else 
		if (document.all) 
	{
		var iframeElement = document.all[iframeWindow.name];
		
		
		if (iframeElement)
			if (iframeWindow.document.compatMode && iframeWindow.document.compatMode != 'BackCompat') 
		{
			iframeElement.style.height = iframeWindow.document.documentElement.scrollHeight + 'px';
			iframeWindow.document.documentElement.scrollWidth + 'px';
		}
		else 
		{
			if(iframeWindow.document.body.scrollHeight == 0)
			{
				iframearray[iframectr] = iframeWindow;		
				//setTimeout('resizeiframe();', 200);
				iframectr = iframectr + 1;
			}
			else
			{
				iframeElement.style.height = iframeWindow.document.body.scrollHeight + 'px';
				iframeElement.style.width = iframeWindow.document.body.scrollWidth + 'px';
			}
		}
	}
}



//resize the iframes that have a 0 scroll height.
function resizeif()
{
	var t;
	for (t = 0; t < iframectr; t++)
	{
		document.all[iframearray[t].name].style.height = iframearray[t].document.body.scrollHeight + 5 + 'px';
	}
}


// Check for header display 
function checkhdr(usertype)
{
	if ((usertype == "U") || (usertype == "T"))
	{
		admheader.style.display = "";
	}
}

function closeECMEdit()
{
	if (document.inpform.framename.value == '')
	{
		var instance = document.inpform.instance.value;	
		document.location='NXMNGDOC.pgm?task=startpage&instance=' + instance + '&wnode=0';
	}
	else
	{
		var frame = document.inpform.framename.value
		parent.xl_GetObj(frame).contentWindow.clearActive();
		parent.xl_GetObj('quickadd2').style.display = 'none';
	}
}

// Request the document search window
function searchdoc()
{
	var ifr = document.all ? top.frames['block_page'].document.all['ifrsearch'] : top.frames['block_page'].document.getElementById('ifrsearch');
	
	
	top.frames['block_page'].xl_GetObj('searchwow').style.display = "";
	var url = encodeURIComponent(document.searchform.SearchECM.value);
	url = "NXDOCSRCH3.pgm?search=" + url + "&rand=" +  randnum;
	ifr.src = url;
	ifr.style.zIndex=50;
	ifr.style.left = 100 + 'px';
	ifr.style.top =  50 + 'px';
}


function show_Favorites()
{
	var ifr = document.all ? top.frames['block_page'].document.all['favframe'] : top.frames['block_page'].document.getElementById('favframe');
	
	if (top.frames['block_page'].xl_GetObj('favorites').style.display == '')
	{
		top.frames['block_page'].xl_GetObj('favorites').style.display = 'none';
	}
	else
	{
		var randnum = Math.round((Math.random()*10000)+1);
		url = "NXMNGDOC.PGM?task=viewfavorites&type=V&favorites=Y&rand=" +  randnum;
		ifr.src = url;
		ifr.style.zIndex=50;
		
		top.frames['block_page'].xl_GetObj('favorites').style.display = '';
		
		ifr.style.height = 400 + 'px';
		ifr.style.width = 300 + 'px';
		
		ifr.style.top =  top.frames['block_page'].document.body.scrollTop + 'px';
		var x = xl_FindPosX(xl_GetObj('favicon')) + document.documentElement.scrollLeft + document.body.scrollLeft;
		if ((parseInt(ifr.style.width) + x) > document.body.offsetWidth)
			ifr.style.left = (x - parseInt(ifr.style.width)) + 'px';
		else
			ifr.style.left = x + 'px';
	}
}


function showhelp(helpfile)
{ 
	myfile=  "/nexuspublic/help/" + helpfile; 
	window.open (myfile,"NexusHelp","dependent,scrollbars=1,resizable=1,width=650,height=500,top=0,left=0")	
	} 

function showhelp2(helpfile)
{ 
	window.open (helpfile,"NexusHelp","dependent,scrollbars=1,resizable=1,width=650,height=500,top=0,left=0")	
	} 


function opendoctree5() 
{ 
	var ifr = xl_GetObj('treeframe');
	var event = xl_event();
	
	ifr.style.left = (event.clientX - 300) + 'px';
	ifr.style.top =  (event.clientY + 10) + 'px';
	ifr.height = 300;
	ifr.style.zIndex=50;
	
	var url = 'nxpostree.pgm?type=A&wnode=' + document.inpform.wnode2.value + "&rand=" +  randnum;	
	ifr.src = url;
	
	xl_GetObj('doctree').style.visibility = "hidden";
	xl_GetObj('doctree').style.display = "";
	checkparentpos(ifr);
	xl_GetObj('doctree').style.visibility = "";
	adjustoptions();
}


function opendoctree4() 
{ 
	var ifr = xl_GetObj('treeframe');
	var event = xl_event();
	
	ifr.style.left = (event.clientX - 300) + 'px';
	ifr.style.top =  (event.clientY + 10) + 'px';
	ifr.height = 300;
	ifr.style.zIndex=50;
	
	var url = 'nxpostree.pgm?type=F&wnode=' + document.inpform.wnode2.value + "&rand=" +  randnum;	
	ifr.src = url;
	
	xl_GetObj('doctree').style.display = "";

	adjustoptions();
}

function opendoctree3() 
{ 	
	var ifr = xl_GetObj('treeframe');
	var event = xl_event();

	ifr.style.left = (event.clientX - 300) + 'px';
	ifr.style.top =  (event.clientY + 10) + 'px';
	ifr.height = 300;
	ifr.style.zIndex=50;
	
	var url = 'nxpostree.pgm?type=A&wnode=' + document.inpform.wnode2.value + "&rand=" +  randnum;	
	ifr.src = url;
	
	xl_GetObj('doctree').style.display = "";
}

function opendoctree2() 
{ 
	var ifr = xl_GetObj('treeframe');
	var event = xl_event();
	
	ifr.style.left = (event.clientX - 300) + 'px';
	ifr.style.top =  (event.clientY + 10) + 'px';
	ifr.height = 300;
	ifr.style.zIndex=50;
	
	
	var url = 'nxpostree.pgm?type=A&wnode=' + document.inpform.wnode2.value + "&rand=" +  randnum;	
	ifr.src = url;
	
	xl_GetObj('doctree').style.display = "";
	
	if (parent.adjustIFrameSize) parent.adjustIFrameSize(window);
}


function opendoctree() 
{ 
	var ifr = xl_GetObj('treeframe');
	var event = xl_event();
	
	ifr.style.left = (event.clientX - 300) + 'px';
	ifr.style.top =  (event.clientY + 10) + 'px';
	ifr.height = 300;
	ifr.style.zIndex=50;
	
	var url;
	
	try 
	{ 
		url = 'nxpostree.pgm?type=S&wnode=' + document.inpform.fromnode.value + "&rand=" +  randnum + "&instance=" +  document.inpform.instance.value;
	}
	catch(err) 
	{
		url = 'nxpostree.pgm?type=S&wnode=0' + "&rand=" +  randnum + "&instance=" +  document.inpform.instance.value;
	}  
	
	ifr.src = url;
	
	xl_GetObj('doctree').style.display = "";
	if (parent.adjustIFrameSize) parent.adjustIFrameSize(window);
}

function opendoctree6() 
{ 
	var ifr = xl_GetObj('treeframe');
	var event = xl_event();
	
	ifr.style.left = (event.clientX - 300) + 'px';
	ifr.style.top =  (event.clientY + 10) + 'px';
	ifr.height = 300;
	ifr.style.zIndex=50;
	
	var callerWindowObj = dialogArguments;
	var url = callerWindowObj.document.inpform.sitepath.value + 'nxpostree.pgm?type=U&urltype=I' + "&rand=" +  randnum;	
	ifr.src = url;
	
	xl_GetObj('doctree').style.display = "";
}

function opendoctree7() 
{ 
	var ifr = xl_GetObj('treeframe');
	var event = xl_event();
	
	ifr.style.left = (event.clientX - 300) + 'px';
	ifr.style.top =  (event.clientY + 10) + 'px';
	ifr.height = 300;
	ifr.style.zIndex=50;
	
	var callerWindowObj = dialogArguments;
	var url = callerWindowObj.document.inpform.sitepath.value + 'nxpostree.pgm?type=U&urltype=H' + "&rand=" +  randnum;	
	ifr.src = url;
	
	xl_GetObj('doctree').style.display = "";
}

function opendoctree8() 
{ 
	var ifr = xl_GetObj('treeframe');
	var event = xl_event();
	ifr.style.left = (event.clientX - 300) + 'px';
	ifr.style.top =  (event.clientY + 10) + 'px';
	ifr.height = 300;
	ifr.style.zIndex=99;
	
	var url = 'nxpostree.pgm?type=U&urltype=U' + "&rand=" +  randnum;	
	ifr.src = url;
	
	//xl_GetObj('doctree').style.visibility = "hidden";
	xl_GetObj('doctree').style.display = "";
	
	if (parent.adjustIFrameSize) parent.adjustIFrameSize(window);
	checkparentpos(ifr);
	
	//xl_GetObj('doctree').style.visibility = "";
}

function opendoctree10() 
{ 
	framename = 'auxframe';	
	var ifr = xl_GetObj(framename);
	ifr.style.display = '';
	var url = 'nxpostree.pgm?type=A&wnode=' + document.quickform.wnode2.value + "&framename=ECMQuickAdd&rand=" +  randnum;
	popup(framename ,url,300,300,'float',xl_event(),10,'auxinfo');
	ifr.style.zIndex = 99;
}

function opendoctree9() 
{ 
	framename = 'auxframe';	
	var ifr = xl_GetObj(framename);
	ifr.style.display = '';
	var url = "nxpostree.pgm?type=Z&framename=ECMQuickLoc&rand=" +  randnum + "&favorites=" + document.quickform.favorites.value;
	popup(framename ,url,300,300,'float', xl_event(),10,'auxinfo');
	ifr.style.zIndex = 99;
}

function opendoctree11() 
{ 
	framename = 'auxframe';	
	var ifr = parent.xl_GetObj(framename);
	var url = "nxpostree.pgm?type=Z&framename=ECMQuickLoc2&rand=" + randnum + "&favorites=" + document.inpform.favorites.value;
	parent.popup(framename ,url,300,300,'float', xl_event(),10,'auxinfo');
	ifr.style.zIndex = 99;
	ifr.style.display = '';
}

function getSelectedRadioValue(buttonGroup) 
{
	// returns the value of the selected radio button or "" if no button is selected
	var i = getSelectedRadio(buttonGroup);
	if (i == -1) 
	{
		return "";
	} 
	else 
	{
		if (buttonGroup[i]) 
		{ // Make sure the button group is an array (not just one button)
			
			return buttonGroup[i].value;
			
		} 
		else 
		{ // The button group is just the one button, and it is checked
			return buttonGroup.value;
		}
	}
	
} // Ends the "getSelectedRadioValue" function

function getSelectedRadio(buttonGroup) 
{
	// returns the array number of the selected radio button or -1 if no button is selected
	if (buttonGroup[0]) 
	{ // if the button group is an array (one button is not an array)
		for (var i=0; i<buttonGroup.length; i++) 
		{
			if (buttonGroup[i].checked) 
			{
				return i
			}
		}
	} 
	else 
	{
		if (buttonGroup.checked) { return 0; } // if the one button is checked, return zero
	}
	
	// if we get to this point, no radio button is selected
	return -1;
} // Ends the "getSelectedRadio" function


function clearcol() 
{
	document.inpform.PMCOWI.value = 0
	document.inpform.PMCOW1.value = 0
	document.inpform.PMCOW2.value = 0
	document.inpform.PMCOW4.value = 0
}

function selecttype()
{
	if (inpform.pagetype.selectedIndex == 1) 
	{
		wow.style.display = "";
		xl_GetObj('column1').style.display = "none";
		xl_GetObj('column2').style.display = "none";
		xl_GetObj('column3').style.display = "none";
		xl_GetObj('column4').style.display = "none";
		xl_GetObj('nbrcol').style.display = "none";
		document.inpform.nextbtn.value = "Finish";
	}
	else
	{
		xl_GetObj('wow').style.display = "none";
		xl_GetObj('nbrcol').style.display = "";
		document.inpform.wnode2.value = 0;
		document.inpform.nextbtn.value = "Next>>";
		column();
	}
}


// Add/Update user options
function uo_options_display(cu_designp, cu_edtact, cu_instance, cu_links, cu_mylinks, cu_mainp, cu_mpage, cu_passwrd, cu_skins, cu_topfrm, siteadmin, cu_procdir, cu_favorites, cu_favupload) 
{
	
	if ((cu_designp == 'Y') || (siteadmin == 'Y'))
		xl_GetObj('uodesignp').style.display = "";
	if ((cu_edtact == 'Y') || (siteadmin == 'Y'))
		xl_GetObj('uoedtact').style.display = ""; 
	if ((cu_passwrd == 'Y') || (siteadmin == 'Y'))
		xl_GetObj('uopasswrd').style.display = ""; 
	if ((cu_instance == 'Y') || (siteadmin == 'Y'))
		xl_GetObj('uoinstance').style.display = ""; 
	if ((cu_favorites == 'Y') || (siteadmin == 'Y'))
		xl_GetObj('uofavorites').style.display = ""; 
	if ((cu_favupload == 'Y') || (siteadmin == 'Y'))
		xl_GetObj('uofavupload').style.display = ""; 
	
	
	if ((cu_links == 'Y') || (siteadmin == 'Y'))
	{
		xl_GetObj('uolinks').style.display = ""; 
		xl_GetObj('uolinks').style.display = "";
	}
	
	if ((cu_mylinks == 'Y') || (siteadmin == 'Y'))
	{
		xl_GetObj('uomylinks').style.display = ""; 
		xl_GetObj('prefmylinks').style.display = "";
	}
	if ((cu_mainp == 'Y') || (siteadmin == 'Y'))
	{
		xl_GetObj('uomainp').style.display = ""; 
		xl_GetObj('prefmpagestyle').style.display = "";
	}	
	if ((cu_mpage == 'Y') || (siteadmin == 'Y'))
	{
		xl_GetObj('uompage').style.display = "";
		xl_GetObj('prefmainpage').style.display = "";
		
		// Optional display the main page selection options
		if ((document.inpform.USOPPA.options[document.inpform.USOPPA.selectedIndex].value == ' ') || (document.inpform.USOPPA.options[document.inpform.USOPPA.selectedIndex].value == 'Y'))
		{
			xl_GetObj('prefmainpage2').style.display = "";
			xl_GetObj('prefmainpage3').style.display = "none";
		}
		else
		{
			xl_GetObj('prefmainpage2').style.display = "none";
			xl_GetObj('prefmainpage3').style.display = "";
			
			if (document.inpform.usmapa.value == '*DEFAULT')
			{
				document.inpform.usmapa.disabled = true;
				document.inpform.usmapa.disabled = true;
			}
		}
	}
	
	if ((cu_skins == 'Y') || (siteadmin == 'Y'))
	{
		xl_GetObj('uoskins').style.display = ""; 
		xl_GetObj('prefskin').style.display = "";
	}
	if ((cu_topfrm == 'Y') || (siteadmin == 'Y'))
	{
		//uotopfrm.style.display = "";
		xl_GetObj('prefshowtopframe').style.display = ""; 
	}
}

// Options to hide the user modification form options
function modify_options(ou_designp, ou_edtact, ou_instance, ou_links, ou_mylinks, ou_mainp, ou_mpage, ou_passwrd, ou_skins, ou_topfrm, siteadmin) 
{
	
	if ((ou_links == 'Y') || (siteadmin == 'Y'))
	{
		uolinks.style.display = ""; 
	}
	
	if ((ou_mylinks == 'Y') || (siteadmin == 'Y'))
	{
		uomylinks.style.display = "";
	}
	if ((ou_mpage == 'Y') || (siteadmin == 'Y'))
	{
		uompage.style.display = "";
	}
	
	if ((ou_skins == 'Y') || (siteadmin == 'Y'))
	{
		uoskins.style.display = ""; 
	}
	if ((ou_topfrm == 'Y') || (siteadmin == 'Y'))
	{
		uotopfrm.style.display = "";
	}
	if ((ou_mainp == 'Y') || (siteadmin == 'Y'))
	{
		prefmainpage.style.display = "";
		
		// Optional display the main page selection options
		if ((inpform.USOPPA.options[inpform.USOPPA.selectedIndex].value == ' ') || (inpform.USOPPA.options[inpform.USOPPA.selectedIndex].value == 'Y'))
		{
			prefmainpage2.style.display = "";
			prefmainpage3.style.display = "none";
		}
		else
		{
			prefmainpage2.style.display = "none";
			prefmainpage3.style.display = "";
			
			if (document.inpform.usmapa.value == '*DEFAULT')
			{
				document.inpform.usmapa.disabled = true;
				document.inpform.usmapa.disabled = true;
			}
		}
	}
	
}

// Optional display of my Portal Settings menu
function portal_settings(ou_edtact, ou_instance, ou_passwrd, siteadmin, groupmng)
{
	
	if ((ou_edtact == 'Y') || (siteadmin == 'Y'))
		xl_GetObj('edtact').style.display = "";
	
	if ((ou_passwrd == 'Y') || (siteadmin == 'Y'))
		xl_GetObj('passwrd').style.display = "";
	
	
	if ((groupmng == 'Y') || (siteadmin == 'Y'))
		xl_GetObj('group').style.display = "";
}

// Set the edit options off
function set_editopt()
{
	if (!document.inpform.uo_edtact.checked)
	{
		document.inpform.uo_mpage.checked = "";
		document.inpform.uo_skins.checked = "";
		document.inpform.uo_mainp.checked = "";
		document.inpform.uo_topfrm.checked = "";
		document.inpform.uo_links.checked = "";
		document.inpform.uo_mylinks.checked = "";
	}
}


// Allow user to change there settings (NXUSRMNT)
function allow_change()
{
	if (!document.inpform.USALSE.checked)
	{
		document.inpform.uo_edtact.checked = "";
		document.inpform.uo_mpage.checked = "";
		document.inpform.uo_skins.checked = "";
		document.inpform.uo_mainp.checked = "";
		document.inpform.uo_topfrm.checked = "";
		document.inpform.uo_links.checked = "";
		document.inpform.uo_mylinks.checked = "";
		document.inpform.uo_passwrd.checked = "";
		document.inpform.uo_designp.checked = "";
		document.inpform.uo_instance.checked = "";
	}
}


function onLoadGetDOM(e)
{
	xl_DOM = new xl_oDOMFeats();
}

function setupskinEditor()
{
	
	oEdit1.mode="HTMLBody";
	oEdit1.btnSpellCheck=true;
	oEdit1.height="200";
	oEdit1.width="600";
	
	// Allow for custom style sheet
	oEdit1.btnStyles=true;
	oEdit1.initialRefresh=true;
	
	oEdit1.REPLACE("title");
}

function AJAX_Poller(polling_interval) 
{
	randnum = Math.round((Math.random()*10000)+1);
	var myurl ="nxupoll.pgm?task=pollme&rand="+randnum; 
	mydiv = "not_used";  
	
	// Fire request for data and populate div: 
	xl_AjaxUpdate(myurl, mydiv, Rcv_AJAX_Polling); 
	
	var RunScript = 'AJAX_Poller(' + polling_interval + ')';
	window.setTimeout(RunScript, polling_interval)
	} 	

// Called from inside the function xl_AjaxUpdate: 
function Rcv_AJAX_Polling(mydiv, response)
{
	if (response.substring(0, 4) == "CALR") 
	{	
		randnum = Math.round((Math.random()*10000)+1);
		var myurl ="nxupoll.pgm?task=reminders&rand="+randnum; 
		popupWin=window.open(myurl,'open_window','dependent, width=700,height=480, left=15, top=45 resizable=1') 
		}
	
	if (response.substring(4) == "MAIL") 
	{	
		randnum = Math.round((Math.random()*10000)+1);
		var myurl ="nxmsg.pgm?TASK=pollmsg&rand="+randnum; 
		popupWin=window.open(myurl,'open_window','dependent, width=700,height=480, left=15, top=45 resizable=1') 
		}
	
	if (response.substring(4) == "CHAT") 
	{	
		randnum = Math.round((Math.random()*10000)+1);
		var myurl ="nxupoll.pgm?task=chat&rand="+randnum; 
		popupWin=window.open(myurl,'open_window','dependent,width=465,height=268,left=15,top=45') 
		}
}

function dsp_mainpage(display_type)
{
	if (document.inpform.uo_mainp.value == 'Y')
	{
		// Optional display the main page selection options
		if ((inpform.USOPPA.options[inpform.USOPPA.selectedIndex].value == ' ') || (inpform.USOPPA.options[inpform.USOPPA.selectedIndex].value == 'Y'))
		{
			prefmainpage2.style.display = "";
			prefmainpage3.style.display = "none";
			document.getElementById('mainpage').innerHTML = '<input class=\"field\" type=\"text\" name=\"usmapa\" value=\"\">';
			document.inpform.usmapa.disabled = false;
		}
		else
		{
			prefmainpage2.style.display = "none";
			prefmainpage3.style.display = "";
		}
	}
	
}

function load_mainpage(selECMdoc)
{
	
	var randnum = Math.round((Math.random()*10000)+1);
	var rtnvalue = getSelectedRadioValue(document.inpform.mpagetype);
	
	if (!selECMdoc)
		selECMdoc = '';
	
	if (rtnvalue == 'D')
	{
		document.getElementById('mainpage').innerHTML = '<input class=\"field\" type=\"text\" name=\"usmapa\" value=\"\">';
		document.inpform.usmapa.value = '*DEFAULT'; 
		document.inpform.usmapa.disabled = true;
	}
	else if (rtnvalue == 'P')
	{
		var myurl = 'nxusrmnt.pgm?task=listpage&rand=' + randnum + '&selpage=' + document.inpform.selpage.value + '&usernbr=' + document.inpform.usunbr.value;
		var mydiv = 'mainpage';
		
		// Fire request for data and populate div: 
		xl_AjaxUpdate(myurl, mydiv, sel_mainpage); 
	}
	else if (rtnvalue == 'E')
	{
		document.getElementById('mainpage').innerHTML = '<input size=\"50\" maxlength=\"256\" name=\"nodename2\" disabled type=\"text\" value=\"' + selECMdoc + '\"> <span id=\"seldoc\"><a class=\"cursorhand\" onclick=\"opendoctree3();\"><img src=\"/nexuspublic/images/Searchkey.gif\" alt=\"Select Default Location\"></a></span>';
	}
	
	if ((xl_GetObj('group')) && (xl_GetObj('group').value != 0))
		parent.SizePage('dyniframe1');
}

function sel_mainpage(mydiv, response)
{
	document.getElementById(mydiv).innerHTML = response;
}

function popupcheck()
{
	
	if (document.headfrm.popup.checked == true)
		xl_GetObj('windowdetails').style.display = "";
	else
		xl_GetObj('windowdetails').style.display = "none";
	
}


var allStyleRules;

// getStyleByClass: given an element type, a class selector and a property,
// return the value of the property for that element type. args:
//  t - element type
//  c - class identifier
//  p - CSS property
function getStyleByClass(t, c, p) 
{
	// if we got here it's because we didn't find anything try styleSheets
	var sheets = document.styleSheets;
	if(sheets.length > 0) 
	{
		// loop over each sheet
		for(var x = 0; x < sheets.length; x++) 
		{
			
			// grab stylesheet rules
			var rules;
			if (document.styleSheets[x].cssRules)
				rules = document.styleSheets[x].cssRules;
			else if (document.styleSheets[x].rules)
				rules = document.styleSheets[x].rules;
			
			
			if(rules.length > 0) 
			{
				// check each rule
				for(var y = 0; y < rules.length; y++) 
				{
					var z = rules[y].style;
					
					allStyleRules = rules[y].selectorText.toLowerCase();
					if(allStyleRules) 
					{
						if((allStyleRules == c) || (allStyleRules == (t + "." + c))) 
						{
							return z[p];
							break;
							
						}   
					} 
					else 
					{
						// use the native selectorText and style stuff
						if(((z[p] != "") && (z[p] != null)) && ((rules[y].selectorText == c) || (rules[y].selectorText == (t + "." + c)))) 
						{
							return z[p];
							break;
						}
					}
				}
			}
		}
	}
	
	return null;
}

function setuptabs()
{
	try 
	{ 
		var background = getStyleByClass('span', 'tab', 'background');

		NiftyCheck();
		
		Rounded('div#nav span','top','transparent',background,'small');
		var tabbar = xl_GetObj("tabbar"); 
		if (tabbar != null) 
			tabbar.style.visibility = "";	
	}
	catch(err) 
	{
		
	}  	
}

function corners()
{	
	var pageColor = getStyleByClass('body', 'body', 'background');
	var border = getStyleByClass('span', 'border', 'color');
	
	var divname = '';
	var list = xl_GetObj('mainpage');
	var InstCollection = list.getElementsByTagName("div");
	for (var i=0; i < InstCollection.length; i++) 
	{
		if ((InstCollection[i].id) && (InstCollection[i].getAttribute("id").substring(0, 2) == "wc") && (InstCollection[i].getAttribute("id").substring(0, 3) != "wcd")) 
		{
			
			var bdrdsp = 'bdr' + InstCollection[i].id.substring(2,12);
			bdrdsp = xl_GetObj(bdrdsp);
			if  (bdrdsp.style.display == '')
			{
				divname = 'div#' + InstCollection[i].id;
				Rounded(divname,"top",pageColor,border,"small");
			}
		} 
	}
}


function NiftyCheck()
{
	if(!document.getElementById || !document.createElement)
		return(false);
	isXHTML=/html\:/.test(document.getElementsByTagName('body')[0].nodeName);
	if(Array.prototype.push==null){Array.prototype.push=function()
		{
			this[this.length]=arguments[0]; return(this.length);}
	}
	return(true);
}

function Rounded(selector,wich,bk,color,opt)
{
	var i,prefixt,prefixb,cn="r",ecolor="",edges=false,eclass="",b=false,t=false;
	
	if(color=="transparent")
	{
		cn=cn+"x";
		ecolor=bk;
		bk="transparent";
	}
	else if(opt && opt.indexOf("border")>=0)
	{
		var optar=opt.split(" ");
		for(i=0;i<optar.length;i++)
		if(optar[i].indexOf("#")>=0) 
			ecolor=optar[i];
		if(ecolor=="") 
			ecolor="#666";
		
		cn+="e";
		edges=true;
	}
	else if(opt && opt.indexOf("smooth")>=0)
	{
		cn+="a";
		ecolor=Mix(bk,color);
	}
	
	
	if(opt && opt.indexOf("small")>=0) 
		cn+="s";
	
	prefixt=cn;
	prefixb=cn;
	
	if(wich.indexOf("all")>=0)
	{
		t=true;b=true
	}
	
	else if(wich.indexOf("top")>=0) 
		t="true";
	
	else if(wich.indexOf("tl")>=0){
		t="true";
		if(wich.indexOf("tr")<0) prefixt+="l";
	}
	else if(wich.indexOf("tr")>=0){
		t="true";
		prefixt+="r";
	}
	if(wich.indexOf("bottom")>=0) b=true;
	else if(wich.indexOf("bl")>=0){
		b="true";
		if(wich.indexOf("br")<0) prefixb+="l";
	}
	else if(wich.indexOf("br")>=0){
		b="true";
		prefixb+="r";
	}
	var v=getElementsBySelector(selector);
	var l=v.length;
	for(i=0;i<l;i++){
		if(edges) AddBorder(v[i],ecolor);
		if(t) AddTop(v[i],bk,color,ecolor,prefixt);
		if(b) AddBottom(v[i],bk,color,ecolor,prefixb);
	}
}

function AddBorder(el,bc){
	var i;
	if(!el.passed){
		if(el.childNodes.length==1 && el.childNodes[0].nodeType==3){
			var t=el.firstChild.nodeValue;
			el.removeChild(el.lastChild);
			var d=CreateEl("span");
			d.style.display="block";
			d.appendChild(document.createTextNode(t));
			el.appendChild(d);
		}
		for(i=0;i<el.childNodes.length;i++){
			if(el.childNodes[i].nodeType==1){
				el.childNodes[i].style.borderLeft="1px solid "+bc;
				el.childNodes[i].style.borderRight="1px solid "+bc;
			}
		}
	}
	el.passed=true;
}

function AddTop(el,bk,color,bc,cn){
	var i,lim=4,d=CreateEl("b");
	
	if(cn.indexOf("s")>=0) lim=2;
	if(bc) d.className="artop";
	else d.className="rtop";
	d.style.backgroundColor=bk;
	for(i=1;i<=lim;i++){
		var x=CreateEl("b");
		x.className=cn + i;
		x.style.backgroundColor=color;
		if(bc) x.style.borderColor=bc;
		d.appendChild(x);
	}
	el.style.paddingTop=0;
	el.insertBefore(d,el.firstChild);
}

function AddBottom(el,bk,color,bc,cn){
	var i,lim=4,d=CreateEl("b");
	
	if(cn.indexOf("s")>=0) lim=2;
	if(bc) d.className="artop";
	else d.className="rtop";
	d.style.backgroundColor=bk;
	for(i=lim;i>0;i--){
		var x=CreateEl("b");
		x.className=cn + i;
		x.style.backgroundColor=color;
		if(bc) x.style.borderColor=bc;
		d.appendChild(x);
	}
	el.style.paddingBottom=0;
	el.appendChild(d);
}

function CreateEl(x){
	if(isXHTML) return(document.createElementNS('http://www.w3.org/1999/xhtml',x));
	else return(document.createElement(x));
}

function getElementsBySelector(selector){
	var i,selid="",selclass="",tag=selector,f,s=[],objlist=[];
	
	if(selector.indexOf(" ")>0){  //descendant selector like "tag#id tag"
		s=selector.split(" ");
		var fs=s[0].split("#");
		if(fs.length==1) return(objlist);
		f=document.getElementById(fs[1]);
		if(f) return(f.getElementsByTagName(s[1]));
		return(objlist);
	}
	if(selector.indexOf("#")>0){ //id selector like "tag#id"
		s=selector.split("#");
		tag=s[0];
		selid=s[1];
	}
	if(selid!=""){
		f=document.getElementById(selid);
		if(f) objlist.push(f);
		return(objlist);
	}
	if(selector.indexOf(".")>0){  //class selector like "tag.class"
		s=selector.split(".");
		tag=s[0];
		selclass=s[1];
	}
	var v=document.getElementsByTagName(tag);  // tag selector like "tag"
	if(selclass=="")
	return(v);
	for(i=0;i<v.length;i++){
		if(v[i].className.indexOf(selclass)>=0){
			objlist.push(v[i]);
		}
	}
	return(objlist);
}

function Mix(c1,c2){
	var i,step1,step2,x,y,r=new Array(3);
	if(c1.length==4)step1=1;
	else step1=2;
	if(c2.length==4) step2=1;
	else step2=2;
	for(i=0;i<3;i++){
		x=parseInt(c1.substr(1+step1*i,step1),16);
		if(step1==1) x=16*x+x;
		y=parseInt(c2.substr(1+step2*i,step2),16);
		if(step2==1) y=16*y+y;
		r[i]=Math.floor((x*50+y*50)/100);
	}
	return("#"+r[0].toString(16)+r[1].toString(16)+r[2].toString(16));
}

function reloadmainpage()
{
	try
	{
		parent.window.opener.top.location.reload(true);
	}
	catch(err)
	{
		
	}
	
	parent.window.close();
	
}


function setupdftcnt()
{
	oEdit1.mode="HTMLBody";
	oEdit1.btnSpellCheck=true;
	
	oEdit1.height = '400';
	oEdit1.width="750";
	
	// Allow for custom style sheet
	oEdit1.btnStyles=true;
	oEdit1.initialRefresh=true;
	
	oEdit1.REPLACE("dftcnt");
}


function dragdiv(elementToDrag, event) 
{
	//elementToDrag.style.cursor = "pointer"; 
	var startX = event.clientX, startY = event.clientY;
	var origX = elementToDrag.offsetLeft, origY = elementToDrag.offsetTop;
	var deltaX = startX - origX, deltaY = startY - origY;
	
	if (document.addEventListener) 
	{ 
		document.addEventListener("mousemove", moveHandler, true);
		document.addEventListener("mouseup", upHandler, true);
	}
	else if (document.attachEvent) 
	{
		elementToDrag.setCapture( );
		elementToDrag.attachEvent("onmousemove", moveHandler);
		elementToDrag.attachEvent("onmouseup", upHandler);
		elementToDrag.attachEvent("onlosecapture", upHandler);
	}
	else 
	{  
		var oldmovehandler = document.onmousemove;
		var olduphandler = document.onmouseup;
		document.onmousemove = moveHandler;
		document.onmouseup = upHandler;
	}
	
	if (event.stopPropagation) event.stopPropagation( ); 
	else event.cancelBubble = true;
	
	if (event.preventDefault) event.preventDefault( );
	else event.returnValue = false;
	
	function moveHandler(e) 
	{
		//elementToDrag.style.cursor = "move"; 
		if (!e) e = window.event;  // IE Event Model
		elementToDrag.style.left = (e.clientX - deltaX) + "px";
		elementToDrag.style.top = (e.clientY - deltaY) + "px";
		
		if (e.stopPropagation) e.stopPropagation( );
		else e.cancelBubble = true;
	}
	
	function upHandler(e) {
		//elementToDrag.style.cursor = "default"; 
		
		if (!e) e = window.event;
		
		if (document.removeEventListener) 
		{
			document.removeEventListener("mouseup", upHandler, true);
			document.removeEventListener("mousemove", moveHandler, true);
		}
		else if (document.detachEvent) 
		{  
			elementToDrag.detachEvent("onlosecapture", upHandler);
			elementToDrag.detachEvent("onmouseup", upHandler);
			elementToDrag.detachEvent("onmousemove", moveHandler);
			elementToDrag.releaseCapture( );
		}
		else 
		{  
			document.onmouseup = olduphandler;
			document.onmousemove = oldmovehandler;
		}
		
		if (e.stopPropagation) e.stopPropagation( );
		else e.cancelBubble = true;
	}
}
/**************************************** esdi javascript library *********************************************/


function xl_oDOMFeats( ) 
{
	if (document.images) 
	{
		this.isCSS = (document.body && document.body.style) ? true : false;
		this.isW3C = (this.isCSS && document.getElementById) ? true : false;
		this.isIE4 = (this.isCSS && document.all) ? true : false;
		this.isNN4 = (document.layers) ? true : false;
		this.isIE6CSS = (document.compatMode && document.compatMode.indexOf("CSS1") >= 0) ? 
		true : false;
	}
}

/** Function:			xl_GetObj
 *  Purpose:   		Return a reference to an HTML element based on its id property (either as a string or a pointer) 
 *  Convert object name string or object reference into a valid element object reference
 *   @return  				ObjID 		Reference to an HTML element 
*/ 
function xl_GetObj(obj) 
{
	// If xl_DOM object not attached to document, then do it: 
	if(!document.xl_DOM) document.xl_DOM = new xl_oDOMFeats();
	var xl_DOM = document.xl_DOM; 
	var ObjID;
	if (typeof obj == "string") 
	{
		if (xl_DOM.isW3C) 
		{
			ObjID = document.getElementById(obj);
		} 
		else if (xl_DOM.isIE4) 
		{
			ObjID = document.all(obj);
		} 
		else if (xl_DOM.isNN4) 
		{
			ObjID = xl_SeekLayer(document, obj);
		}
	} 
	else 
		// pass through object reference
	return obj;
	
	return ObjID; 
}


// Seek nested NN4 layer from string name
function xl_SeekLayer(doc, name) 
{
	var ObjID;
	var LayersLength = doc.layers.length;
	for (var i = 0; i < LayersLength; i++) {
		if (doc.layers[i].name == name) {
			return doc.layers[i];
		}
		// dive into nested layers if necessary
		if (doc.layers[i].document.layers.length > 0) {
			// Could this simply return the result of the function?
			ObjID = xl_SeekLayer(document.layers[i].document, name);
		}
	}
	return ObjID;
}


/** Function:			xl_GetEvent
 *  Purpose:   		Get Event - returns an Event object. To see its type, for example, use e.type
 *  @param        e - Event name
 *  Cross-browser notes:    FireFox passes variable e to the function, while IE doesn't - the event is window.event.
 *  Usage notes:  See Wiki 
*/  
function xl_GetEvent(e) 
{
	// e gives access to the event in all browsers
	if (!e) var e = window.event; 
	
	return e; 
} 


/** Function:			xl_GetEventTarg
 *  Purpose:   		Get object reference to target of an Event such as onClick 
 *  @return    EventObj = element upon which the event occurred. 
 *  Cross-browser notes:    FireFox passes variable e to the function, while IE doesn't - the event is window.event.
 *  Usage notes:  See Wiki  (includes info on how to register an event handler) 
*/  
function xl_GetEventTarg(e) 
{
	var EventObj; 
	var e = xl_GetEvent(e); 
	
	if (e.target) EventObj  = e.target;
	else if (e.srcElement) EventObj = e.srcElement;
	
	return EventObj; 
} 


/** Function:			xl_AttachEvent
 *  Purpose:   		Attach a custom event handler to an object (such as document). Allows you to add multiple event handlers to objects.   
 *  @return       true -  it attached it ok.  false - it didn't, meaning browser doesn't support native methods used. 
 *  Cross-browser notes:    NS6 and Mozilla (FireFox) use addEventListener, IE uses attachEvent. 
 *                          in addition, Mozilla supports both event capturing and event bubbling while IE supports only event bubbling. 
 *  Usage notes:  See Wiki  
*/  
function xl_AttachEvent(obj, evType, fn, useCapture)
{
	if (!useCapture) var useCapture = true; 
	if (obj.addEventListener){
		obj.addEventListener(evType, fn, useCapture);
		return true;
	} else if (obj.attachEvent){
		var r = obj.attachEvent("on"+evType, fn);
		return r;
	} else {
		return false; 
	}
} 


/** Function:			xl_DetachEvent
 *  Purpose:   		Detach a custom event handler that was added with xl_AttachEvent  
 *  @return 		  true -  it attached it ok.  false - it didn't, meaning browser doesn't support native methods used. 
*/ 
function xl_DetachEvent(obj, evType, fn, useCapture)
{
	if (!useCapture) var useCapture = true; 
	if (obj.removeEventListener){
		obj.removeEventListener(evType, fn, useCapture);
		return true;
	} else if (obj.detachEvent){
		var r = obj.detachEvent("on"+evType, fn);
		return r;
	} else {
		return false;
	}
} 


/** Function:  	 xl_FindPosX 
 *  Purpose: 		 Find left position (x coordinate) of an object on a page. 
 *  @param			 Object reference (can be got with xl_GetObj) 
/*  @return			 curleft  left position of object
*/  

function xl_FindPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft;
			obj = obj.offsetParent;
		}
		curleft += obj.offsetLeft;  // added in Version 1.90 - ESDIAPI010.js
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
	
}


/** Function:  	 xl_FindPosY 
 *  Purpose: 		 Find top position (y coordinate) of an object on a page. 
 *  @param			 Object reference (can be got with xl_GetObj) 
/*  @return			 curleft  left position of object
*/  
function xl_FindPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop;
			obj = obj.offsetParent;
		}
		curtop += obj.offsetTop;  // added in Version 1.90 - ESDIAPI010.js
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

/** Function: 	   xl_Encode 
 *  Purpose: 		 	 URL-encode a string to ensure compatibility with all character sets
 *  @param				 uri - raw string
 *  @return 			 uri - encoded string
*/
function xl_Encode( uri ) {
	if (encodeURIComponent) {
		return encodeURIComponent(uri);
	}
	
	if (escape) {
		return escape(uri);
	}
} 


/** Function: 	   xl_Decode 
 *  Purpose: 		 	 Decode a URL-encoded string to ensure compatibility with all character sets
 *  @param				 uri - raw string
 *  @return        uri - decoded string
*/
function xl_Decode( uri ) {
	uri = uri.replace(/\+/g, ' ');
	
	if (decodeURIComponent) {
		return decodeURIComponent(uri);
	}
	
	if (unescape) {
		return unescape(uri);
	}
	
	return uri;
}


// Public domain cookie code written by: Bill Dortch, hIdaho Design (bdortch@netw.com)
// Modified by ESDI to conform to naming conventions


/** Function:	xl_GetCookieVal 
 *  Purpose: 	
 */
function xl_GetCookieVal (offset) 
{
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
		endstr = document.cookie.length;
	return xl_Decode(document.cookie.substring(offset, endstr));
}


/** Function:	xl_GetCookie 
 *  Purpose: 	Get a browser cookie
 */
function xl_GetCookie (name) 
{
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) 
	{
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
			return xl_GetCookieVal (j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break; 
	}
	
	return null;
}

/** Function:	xl_SetCookie 
 *  Purpose: 	Set a browser cookie
 */
function xl_SetCookie (name, value) 
{
	var argv = xl_SetCookie.arguments;
	var argc = xl_SetCookie.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	document.cookie = name + "=" + xl_Encode(value) +
		((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
	((path == null) ? "" : ("; path=" + path)) +
	((domain == null) ? "" : ("; domain=" + domain)) +
	((secure == true) ? "; secure" : "");
}

//      - - - - - - - - End of  Bill Dortch code - - - - - - - -      


/** Function:	xl_GetDay
 *  Purpose: 	Get the text for a given day of week index
 */
function xl_GetDay(intDay)
{
	var DayArray = new Array("Sunday", "Monday", "Tuesday", "Wednesday", 
	"Thursday", "Friday", "Saturday")
	return DayArray[intDay]
}

/** Function:	xl_Getmonth
 *  Purpose: 	Get the text for a given month index
 */
function xl_GetMonth(intMonth)
{
	var MonthArray = new Array("January", "February", "March",
	"April", "May", "June",
	"July", "August", "September",
	"October", "November", "December") 
	return MonthArray[intMonth] 	  	 
}

/** Function:	xl_GetDateStr
 *  Purpose: 	Format and return the current date
 */
// Example: September 21, 2004		
function xl_GetDateStr()
{
	var today = new Date()
	var year = today.getYear()
	if(year<1000) year+=1900
		var todayStr = GetMonth(today.getMonth()) + " " + today.getDate()
	todayStr += ", " + year
	return todayStr
}

/** Function:	xl_GetDateStr
 *  Purpose: 	Format and return the current date
 */
// Example: Monday September 21, 2004
function xl_GetDateStrWithDOW()
{
	var today = new Date()
	var year = today.getYear()
	if(year<1000) year+=1900
		var todayStr = GetDay(today.getDay()) + ", "
	todayStr += GetMonth(today.getMonth()) + " " + today.getDate()
	todayStr += ", " + year
	return todayStr
}

/** Function:	xl_GetShortDate
 *  Purpose: 	Format and return the current date
 */
// Example:  09/21/2004		
function xl_GetShortDate()
{
	var today = new Date();
	var year = today.getYear();
	// 2006-12-20 Tyson Gilberstad - added leading zeros for < 10 case for month & day
	var month = today.getMonth() + 1;
	if (month < 10) month = "0" + month;
	var day = today.getDate();
	if (day < 10) day = "0" + day;
	if(year<1000) year+=1900
		var shortdate=    month + "/" +  day + "/" + year;
	return shortdate;
}


/** Function:	xl_AjaxUpdate
 *  Purpose: 	Submit an Ajax call and when complete call the third parm (the
 *					function) with the second parm (possibly a div to be populated
 *					but really it could be anything which identifies which response
 *					it is)
 */
// 2006-12-20 Tyson Gilberstad - added optional parameter to automatically append random number to request	
var _ms_AJAX_Request_ActiveX = ""; // Holds type of ActiveX to instantiate
function xl_AjaxUpdate(url, obj, func, random)
{
	if (!url) return false;  // Don't run if missing the url parm. 
	
	// code for Mozilla, etc.
	if (window.XMLHttpRequest)
	{
		var xmlhttp=new XMLHttpRequest();
	}
	
	// code for IE
	else if (window.ActiveXObject)
	{
		
		// Instantiate the latest MS ActiveX Objects
		if (_ms_AJAX_Request_ActiveX) 
		{
			xmlhttp = new ActiveXObject(_ms_AJAX_Request_ActiveX);
		} 
		else 
		{
			// loops through the various versions of XMLHTTP to ensure we're using the latest
			var versions = ["Msxml2.XMLHTTP.7.0", "Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP",
			"Microsoft.XMLHTTP"];
			for (var i = 0; i < versions.length ; i++)
			{
				try 
				{
					// try to create the object
					// if it doesn't work, we'll try again
					// if it does work, we'll save a reference to the proper one to speed up future instantiations
					xmlhttp  = new ActiveXObject(versions[i]);
					if (xmlhttp) 
					{
						_ms_AJAX_Request_ActiveX = versions[i];
						break;
					}
				}
				catch (objException) 
				{
					// trap -  try next one
				} 
			}
		}
	}
	
	if (!xmlhttp) return false;
	
	if (func) 
		xmlhttp.onreadystatechange = 
	function()
	{
		if (xmlhttp.readyState != 4) return;
		if (xmlhttp.status == 200)
			func(obj, xmlhttp.responseText);
		//else 
		//  alert("An error occurred" + xmlhttp.status);
	};
	else
	xmlhttp.onreadystatechange = function() { return; }
	
	// 2006-12-20 Tyson Gilberstad - added optional parameter to automatically append random number to request	
	if (random)
	{
		url = xl_AddParmToURLString(url, 'rand', Math.floor(Math.random() * 1000000000 + 1));
	}
	
	
	xmlhttp.open('GET', url, true);
	xmlhttp.send(null);
	
	if (func != null)
		if (func) 
	{
	} 
	else 
		return xmlhttp.responseText;
	return false;
}


/** Function:	xl_SetLangs
 *  Purpose: 	This function is used to initialize the esdi multi-language
 *				engine in order to tell it what alternate languages are valid.
 *				The order of the languages provided to this function equates
 *				to the order of the alternate strings provided to the 
 *				xl_AddLangEntry function, and they also equate to the value
 *				passed to the xl_SwitchLang function
 */
function xl_SetLangs()
{
	var argv = xl_SetLangs.arguments;
	var argc = xl_SetLangs.arguments.length;
	var x = 0;
	lang_array = new Array();
	while(x < argc)
	{
		// Convert the parms into entries in the array
		lang_array[x] = argv[x];
		x++;
	}
	
	// Store the array in a new property of the document so that
	// we can retrieve it later
	document.xl_oSupportedLangs = lang_array;
}


/** Function:	xl_AddLangEntry
 *  Purpose: 	This function is used to create the 'translatation'
 *				table between the native language (the first parm)
 *				and each alternate language (as defined in the
 *				xl_SetLangs call)
 */
function xl_AddLangEntry(native_lang)
{
	var argv = xl_AddLangEntry.arguments;
	var argc = xl_AddLangEntry.arguments.length;
	var x = 1;
	
	// If the table (array) of language entries has not been
	// attached to the document yet, do it now.
	if(!document.xl_oMultiLangArr)
		document.xl_oMultiLangArr = new Array();
	
	// Construct a new language object for this 'record' in the table
	// and assign it the various translational equivalents (this assumes
	// the parms are in the same order as specified in xl_SetLangs
	langstr = new Object();
	while(x < argc)
	{
		langstr[document.xl_oSupportedLangs[x - 1]] = argv[x];
		x++;
	}
	
	// Add the entry to the array
	document.xl_oMultiLangArr[native_lang] = langstr;
	
}


/** Function:	xl_SwitchLang
 *  Purpose: 	This function is used to switch all string within
 *				spans identified as language specific (with lang="Y")
 *				to the equivalent string in the language specified
 *				as a parm.  If no match is found, the text is left as-is.
 *				If the same string needs to be translated differently
 *				then use an 'id' tag in the span, and also use the same
 *				id in the AddLangEntry call.
 */
function xl_SwitchLang(target_lang)
{
	var i=0; 
	var tokens = document.getElementsByTagName("SPAN"); 
	// Cycle through all spans
	for (i=0; i < tokens.length; i++) 
	{
		// Trap for ones with a lang attribute set to "Y"
		lang = tokens[i].getAttribute("lang");
		if (lang == "Y") 
		{ 
			// If there is an ID attribute, we want to use that
			// to look it up in our replacement table, otherwise
			// use the string itself
			id = tokens[i].getAttribute("id");
			if((id == "") || (id ==null))
				newstr = document.xl_oMultiLangArr[tokens[i].innerHTML];
			else
				newstr = document.xl_oMultiLangArr[id];
			
			// If we found a replacement, replace it.
			if((newstr != null) && (newstr[target_lang] != null))
				tokens[i].innerHTML = newstr[target_lang];
		}
	} 
} 


/** Function:	  xl_GetFormElementByName
 *  Purpose:   	  GetFormElementByName - returns the first Element object by name found within any page form 
 *  			(or within optionally-specified page form).
 *  @param        elementName - String Element name
 *  @param        formName - Specific form name (optional)
 *  Usage notes:  See Wiki 
*/  
function xl_GetFormElementByName(elementName, formName)
{
	var result;
	
	for(formIndex = 0; formIndex < document.forms.length; formIndex++)
	{ 
		frm = document.forms[formIndex];
		
		// 2006-12-20 Tyson Gilberstad - added optional formName, if specified, 
		//				 only check elements from specified form
		if ((formName == undefined) || (formName == frm.name))
		{
			for(elementIndex = 0; elementIndex < frm.elements.length; elementIndex++)
			{ 		
				if(frm.elements[elementIndex].name == elementName)
				{ 
					result = frm.elements[elementIndex]; 
					return result;
				}
			}
		}
	} 
	return result;
}

/** Function:	  xl_DisableFormElementByName
 *  Purpose:   	  Disable the first Element object by name found within any page form 
 *  			(or within optionally-specified page form).
 *  @param        elementName - String Element name
 *  @param        formName - Specific form name (optional)
 *  Usage notes:  See Wiki 
*/  
function xl_DisableFormElementByName(elementName, formName)
{
	var element = xl_GetFormElementByName(elementName, formName);
	if(element)
	{
		element.disabled = true;
		element.className = element.className + " disabled";	
	}
}

/** Function:	  xl_BuildURLWithFormElements
 *  Purpose:   	 Constructs a string that (usually) comprises a URL, to emulate the format provided by a conventional html form submission. It finds every element name and value for a specified form and appends them to the specified string in the format ?name1=value1&name2=value2 or &name1=value1&name2=&value2, depending on whether an initial parm is present.
 *  @param        frmname - Name of form on page containing elements to use 
 *                string - Starting string to contain the URL. 
 * 		            boolean - Flag if disabled elements should be added to string (optional: default true)
 *  @return       string - Resulting constructed string.
 *  Usage notes:  See Wiki 
*/  
function xl_BuildURLWithFormElements(frmname, str, addDisabled)
{
	// Look for '?' in string - if found, the first parm in a url exists- no need to add it. 
	if (str == undefined)
	{
		str = "";
	}
	
	var x=str.indexOf('?');
	var frm = xl_GetObj(frmname);
	// 2006-12-20 Tyson Gilberstad - check for form name if form not found by id
	if (frm == undefined) 
		frm = document.forms[frmname];
	var elem = frm.elements;
	var parmAdded = ( x != -1);
	
	if (addDisabled == undefined)
	{
		addDisabled = true;
	}
	
	for (var i = 0; i < elem.length; i++)
	{
		if (!addDisabled && elem[i].disabled) 
		{
			// do nothing
		}
		
		else if ((elem[i].tagName == 'INPUT') && ((elem[i].type == 'radio') || (elem[i].type == 'checkbox')) && (!elem[i].checked)) 
		{
			// do nothing
		}
		
		else if ((elem[i].tagName == 'SELECT') && (elem[i].multiple))
		{
			// need to iterate through the items in the select and add all that are selected
			
			for (j=0; j< elem[i].options.length; j++)
			{	
				if ( elem[i].options[j].selected == true )
				{
					
					str = xl_AddParmToURLString(str, elem[i].name, elem[i].options[j].value);
					
				}
			}
			
		}
		
		else 
		{
			str = xl_AddParmToURLString(str, elem[i].name, elem[i].value);
		}
	} 
	return str;
}

/** Function:	  xl_AddParmToURLString
 *  Purpose:   	  Adds a parameter to a URL string
 *  @param        string - Starting string to contain the URL.  
 *                string - Parameter name
 *                string - Parameter value
 *  @return       string - Resulting constructed string.
*/  
function xl_AddParmToURLString(str, name, value)
{
	if(str.indexOf('?') == -1) 
		str += "?";
	else 
		str += "&";
	return str + xl_Encode(name) + "=" + xl_Encode(value);
}

/** Function:    xl_EnableDisabledElements
 *  Purpose:    Enable the disabled fields
 *  @param      oForm - the form to be changed
 *  Usage notes:  See Wiki 
 *  Usage notes <form action="$pf_scriptname" method="get" onsubmit="return enableDisabledFields(this)"> >
*/    
function xl_EnableDisabledElements(oForm)
{
	for(nIndex = 0; nIndex < oForm.elements.length; nIndex++)
	if( oForm.elements[nIndex].disabled == true)
		oForm.elements[nIndex].disabled = false;
	return true;
}


/** Function:   xl_FocusFirstElement
 *  Purpose:    Set the focus to the first valid element we can find (regardless of form)
 * 	Source:		http://www.codeproject.com/jscript/FocusFirstInput.asp
 *  Usage notes:  See Wiki 
*/    
function xl_FocusFirstElement()
{
	var bFound = false;
	
	// for each form
	for (f=0; f < document.forms.length; f++)
	{
		// for each element in each form
		for(i=0; i < document.forms[f].length; i++)
		{
			// if it's not a hidden element
			if (document.forms[f][i].type != "hidden")
			{
				// and it's not disabled
				if (document.forms[f][i].disabled != true)
				{
					// set the focus to it
					document.forms[f][i].focus();
					var bFound = true;
				}
			}
			
			// if found in this element, stop looking
			if (bFound == true)
				break;
		}
		
		// if found in this form, stop looking
		if (bFound == true)
			break;
	}
}

/** Function:	  xl_HiliteRows
 *  Purpose:   	  Adds custom highlighting of rows in a table when hovering over them.
 *  @param        string - Table id (id attribute value of <table> tag)  
 *                string - Hover color if next parm is omitted or not true, class id if next parm is true.
 *                string - Optional. Value of true= prev parm is a class id instead of a color code.
 *  @return       false  
 *
 *  Notes: 20070926 TYS - You can optionally exclude specific table rows from the highlighting rules 
 *			  by specifying xlhilite="no" as a custom attribute for the table row. 
 */   
function xl_HiliteRows(tblid, hovercolor, hvrclass)
{
	var tbl=xl_GetObj(tblid); 
	
	var trs=tbl.getElementsByTagName('tr');
	for(var j=0;j<trs.length;j++)
	{
		// get xlhilite value from the table row if it is specified
		var hiliteval;
		if(trs[j].attributes["xlhilite"])
		{
			hiliteval = trs[j].attributes["xlhilite"].nodeValue.toUpperCase();
		}
		else
		{
			hiliteval = "";
		}
		
		// only operate on those nodes that are connected to the main table body
		// and those that are not excluded by xlhilite="no"	
		if(trs[j].parentNode.nodeName=='TBODY'  && trs[j].parentNode.nodeName!='TFOOT' && hiliteval != "NO")
		{
			// these attributes are added to the class so the event handlers know what the
			// highlighting parameters are
			trs[j].hvrclass = hvrclass;
			trs[j].hovercolor = hovercolor;
			
			// add the event handlers for mouseover and mouseout to the row
			// xl_AttachEvent is a cross-brower method of attaching events to objects
			xl_AttachEvent(trs[j], "mouseover", xl_HiliteMe);
			xl_AttachEvent(trs[j], "mouseout", xl_UnHiliteMe);
			
		}
	}
}

/** Function:	  xl_HiliteMe
 *  Purpose:   	  Event handler used by xl_HiliteRows to highlight the row
 *  @param        event object  
 */
function xl_HiliteMe(event)
{
	var tr = xl_GetEventTarg(event); 
	// we need to go back through the target's parents to find the tr tag that we want to
	// highlight
	while(tr.tagName != 'TR')
	{
		tr = tr.parentNode;
	}
	// if hvrclass is set to true, then the parameter in className is a class
	// set the table row's class to this class
	if (tr.hvrclass != undefined && tr.hvrclass == true) 
	{
		tr.svclass = tr.className; 
		tr.className = tr.hovercolor;  
		return false;	
		
	}
	// the parameter is className is a color value, set the background color to this color value
	else 
	{
		tr.svbgcolor = tr.style.backgroundColor; 
		tr.style.backgroundColor = tr.hovercolor;  
		return false;
	}			
}

/** Function:	  xl_UnHiliteMe
 *  Purpose:   	  Event handler used by xl_HiliteRows to unhighlight the row
 *  @param        event object  
 */

function xl_UnHiliteMe(event)
{
	var tr = xl_GetEventTarg(event); 
	// we need to go back through the target's parents to find the tr tag that we want to
	// unhighlight
	while(tr.tagName != 'TR')
	{
		tr = tr.parentNode;
	}
	// if hvrclass is set to true, then the original change was to the table row's class
	// set the table row's class to the original class
	if (tr.hvrclass != undefined && tr.hvrclass == true) 
	{
		tr.className = tr.svclass;  
		return false;	
	} 
	// the parameter in className is a color value, set the background color back to it's
	// original color value
	else 
	{
		tr.style.backgroundColor = tr.svbgcolor;
		return false;
	}	
}




/** Function:	  xl_EnableDrag
 *  Purpose:   	  Enables any element to be draggable, usually DIVs. 
 *  @param        object - Obj -  Handle to Object eg: xl_GetObj(id) using  id attribute value of <div> tag)  
 */  


function xl_EnableDrag(Obj)
{ 
	var ObjCurrStyle; 
	// Actually, allow use of id also: 
	
	if (Obj instanceof Object == false) Obj = xl_GetObj(Obj); 
	
	// IE method of getting computed style for this element (combines classes and inline CSS)
	if (Obj.currentStyle) 
		ObjCurrStyle = Obj.currentStyle; 
	// Mozilla method: 
	else 
		ObjCurrStyle  = window.getComputedStyle(Obj, null); 
	
	// Make sure the style sheet setting is position:absolute -required for drag and drop.
	// Use computed style to determine this, but change actual style (computed style is read-only)
	if (ObjCurrStyle.position != "absolute") Obj.style.position = "absolute"; 
	// If no z-index value, make sure our div sits above rest of page: 
	
	// Check for zIndex being 0 or auto (FireFox) . If so, make it sit above rest of page: 
	
	if (ObjCurrStyle.zIndex == 0 || ObjCurrStyle.zIndex == "auto") Obj.style.zIndex=999;  
	
	xl_AttachEvent(Obj, "mousedown", xl_DragMe); 
}   

/** Function:	  xl_DragMe
 *  Purpose:      Implementation for xl_EnableDrag - drag absolutely positioned HTML elements.
 *				  Drags element that is the direct target of the current event object. Uses xl_Drag, which requires the element id in addition to the event object.
 *  @param        event-  the Event object for the mousedown event.
 */
function xl_DragMe(event) 
{
	var target = xl_GetEventTarg(event); 
	xl_Drag(target, event); 
} 	

/** Function:	  xl_Drag

 *  Purpose:      Called from an onmousedown event handler. Subsequent mousemove events will
 *                move the specified element. A mouseup event will terminate the drag.
 *                If the element is dragged off the screen, the window does not scroll.
 *                This implementation works with both the DOM Level 2 event model and the IE event model.
 *
 *  @param 	      me - the element that received the mousedown event or
 *                  some containing element. It must be absolutely positioned. Its
 *                  style.left and style.top values will be changed based on the user's
 *                  drag.
 *                event-  the Event object for the mousedown event.
 */
function xl_Drag(me, event) 
{
	
	me.style.cursor = "pointer"; 
	// The mouse position (in window coordinates)
	// at which the drag begins
	var startX = event.clientX, startY = event.clientY;
	
	// The original position (in document coordinates) of the
	// element that is going to be dragged. Since me is
	// absolutely positioned, we assume that its offsetParent is the
	// document body.
	var origX = me.offsetLeft, origY = me.offsetTop;
	
	// Even though the coordinates are computed in different
	// coordinate systems, we can still compute the difference between them
	// and use it in the moveHandler( ) function. This works because
	// the scrollbar position never changes during the drag.
	var deltaX = startX - origX, deltaY = startY - origY;
	
	// Register the event handlers that will respond to the mousemove events
	// and the mouseup event that follow this mousedown event.
	if (document.addEventListener) {  // DOM Level 2 event model
		// Register capturing event handlers
		document.addEventListener("mousemove", moveHandler, true);
		document.addEventListener("mouseup", upHandler, true);
	}
	else if (document.attachEvent) {  // IE 5+ Event Model
		// In the IE event model, we capture events by calling
		// setCapture( ) on the element to capture them.
		me.setCapture( );
		me.attachEvent("onmousemove", moveHandler);
		me.attachEvent("onmouseup", upHandler);
		// Treat loss of mouse capture as a mouseup event.
		me.attachEvent("onlosecapture", upHandler);
	}
	else {  // IE 4 Event Model
		// In IE 4 we can't use attachEvent( ) or setCapture( ), so we set
		// event handlers directly on the document object and hope that the
		// mouse events we need will bubble up.
		var oldmovehandler = document.onmousemove; // used by upHandler( )
		var olduphandler = document.onmouseup;
		document.onmousemove = moveHandler;
		document.onmouseup = upHandler;
	}
	
	// We've handled this event. Don't let anybody else see it.
	if (event.stopPropagation) event.stopPropagation( );  // DOM Level 2
	else event.cancelBubble = true;                      // IE
	
	// Now prevent any default action.
	if (event.preventDefault) event.preventDefault( );   // DOM Level 2
	else event.returnValue = false;                     // IE
	
	/**
	* This is the handler that captures mousemove events when an element
	* is being dragged. It is responsible for moving the element.
	**/
	function moveHandler(e) 
	{
		
		me.style.cursor = "move"; 
		
		if (!e) e = window.event;  // IE Event Model
		
		// Move the element to the current mouse position, adjusted as
		// necessary by the offset of the initial mouse-click.
		me.style.left = (e.clientX - deltaX) + "px";
		me.style.top = (e.clientY - deltaY) + "px";
		
		// And don't let anyone else see this event.
		if (e.stopPropagation) e.stopPropagation( );  // DOM Level 2
		else e.cancelBubble = true;                  // IE
	}
	
	/**
	* This is the handler that captures the final mouseup event that
	* occurs at the end of a drag.
	**/
	function upHandler(e) 
	{
		me.style.cursor = "default"; 
		
		if (!e) e = window.event;  // IE Event Model
		
		// Unregister the capturing event handlers.
		if (document.removeEventListener) {  // DOM event model
			document.removeEventListener("mouseup", upHandler, true);
			document.removeEventListener("mousemove", moveHandler, true);
		}
		else if (document.detachEvent) {  // IE 5+ Event Model
			me.detachEvent("onlosecapture", upHandler);
			me.detachEvent("onmouseup", upHandler);
			me.detachEvent("onmousemove", moveHandler);
			me.releaseCapture( );
		}
		else {  // IE 4 Event Model
			// Restore the original handlers, if any
			document.onmouseup = olduphandler;
			document.onmousemove = oldmovehandler;
		}
		
		// And don't let the event propagate any further.
		if (e.stopPropagation) e.stopPropagation( );  // DOM Level 2
		else e.cancelBubble = true;                  // IE
	}
}
