// global variable
var g_strServerName = "www.myinsurancemanager.com";
var g_dbFilePath = "internet/bcbs/mim/mimanage.nsf";
var g_jsStatuses = "-1~Sent to Owner, -2~Sent To Management, -3~Sent to e-Business Communications, 0~New, 1~Approved";
var g_listUserNames = "Anonymous,*";
var g_strUploadFileName;
var g_strUploadField;
var listFlag = false;
var thisform;
var AJAXRequest;
var g_strReturnURL = '';
var g_boolPrototypeActive = false;
try {
	if (Prototype != undefined) {
		g_boolPrototypeActive = true;
	}
} catch (e) {
	g_boolPrototypeActive = false;
}
if (g_boolPrototypeActive) {
var FormData = Class.create();
FormData.prototype = {
    initialize: function (formElement) {
        this.form = formElement;
        this.action = formElement.action;
        this.valuePairs = '';
        this.serverResponse = '';
        var intDominoFormID = document.forms.length - 1;
        var audienceParam = document.forms[intDominoFormID].displayaudience.value;
        if (formElement.ReturnUrl.value == '') {
            g_strReturnURL = '../../DisplayHome?ReadForm&audience=' + audienceParam;
        } else {
            g_strReturnURL = formElement.ReturnUrl.value + '&audience=' + audienceParam;
        }
    },
    
    addValue: function (fieldName, fieldValue) {
        var strValuePair = fieldName + "=" + fieldValue;
        if (this.valuePairs != '') {
            this.valuePairs += '&';
        }
        this.valuePairs += strValuePair;
    },
    
    submit: function () {
        var formAjax = new Ajax.Request (this.action,
        {
            method: 'post',
            parameters: this.valuePairs,
            onComplete: this.displayResponse
        });
    },
    
    displayResponse: function (originalRequest) {
var strConfirmationMessage = $F('ConfirmationMessage');
if (strConfirmationMessage != "") {
alert(strConfirmationMessage);
}
location.replace(g_strReturnURL);
    }
    
}
}
Array.prototype.hasMatch = function() {
var matchFound=false;
var ComparisonArray = arguments[0];
for(i=0; i<this.length; i++) {
if (ComparisonArray.indexOf(this[i]) > -1) {
matchFound= true;
break;
}
}
return matchFound;
}
Array.prototype.removeValue = function() {
/** FYI: arguments passed to this function are auto-cast.
As a result, 0 = false = "0" */
// blank temporary array
var k = new Array();
// loops through the array being modified
for (i = 0; i < this.length; i++) {
 // assumes no match until proven guilty
var match = false;
 // remove leading and trailing spaces before evaluating
var thisValue = this[i].Trim();
 // loops through arguments, allowing multiple values (of any datatype) to be passed
for (a = 0; a < arguments.length && !match; a++) {
// if any of the arguments match the current value or current value is null
if (arguments[a] == thisValue || thisValue == '') {
match = true;
}
}
if (!match) {
// store the value in the temporary array
k.push(thisValue);
}
}
// clear the entire source array
this.splice(0,this.length);
// copy temporary array into the source array
for (i = 0; i < k.length; i++) {
this.push(k[i]);
}
}
Array.prototype.Trim = function() {
var k = new Array();
for (i = 0; i < this.length; i++) {
var strThisValue = this[i].Trim();
if (strThisValue != '') {
k.push(strThisValue);
}
}
this.splice(0,this.length);
for(i = 0; i < k.length;i++) {
this.push(k[i]);
}
}
/**
 * prototype for String object to remove leading newline, space, and tab characters.
 *
 * @return  trimmed string
 */
String.prototype.TrimLeft = function() {
var len = this.length;
var code, start = 0;
for (var i = 0; i < len; i++) {
code = this.charCodeAt(i);  
if ((code == 9) || (code == 10) || (code == 13) || (code == 32)) {
start = i + 1; // store the next position 
} else {
break;
}
}
return this.substr(start);
}
/**
 * prototype for String object to remove trailing newline, space, and tab characters
 *
 * @return  trimmed string
 */
String.prototype.TrimRight = function() {
var len = this.length;
var code, end = this.length - 1;
for (var i = end; i >= 0; i--) {
code = this.charCodeAt(i);  
if ((code == 9) || (code == 10) || (code == 13) || (code == 32)) {
end = i - 1; // store the previous position 
} else {
break;
}
}
return this.substr(0, len - (len - (end + 1)));
}
/**
 * prototype for String object to remove both leading and trailing newline, space, and tab characters
 *
 * @return  trimmed string
 */
String.prototype.Trim = function() {
return this.TrimRight().TrimLeft();
}
function setForm() {
thisform = document.forms[document.forms.length - 1];
}
function valSub(form) {
return true;
}
function trim(aStr) {
  return aStr.replace(/^\s{1,}/, "").replace(/\s{1,}$/, "");
}
function getSelectText(theOptionField) {
return theOptionField.options[theOptionField.selectedIndex].text;
}
function getSelectValue(theOptionField) {
var txt="";
txt = theOptionField.options[theOptionField.selectedIndex].value;
	if (txt=="") {
	txt= getSelectText(theOptionField);
	}
return txt;
}
function setSelectFieldOptions(NavModField, ChoicesArray) {
	if (!(ChoicesArray.length==1 & ChoicesArray[0] == '')) {
		//If Choices Array is a single entry and blank, there's no new entries to
		//build new options array
		var NewOptionsArray = new Array(1);
		//this code assumes that the old options array will already have the default
		//option '--Select One--' or some such in the first entry of the options array
		//and leaves it alone
		for (var i=0; i < ChoicesArray.length; i++) {
			NewOptionsArray[i] = new Option(ChoicesArray[i]);
		}
	} else {
		var NewOptionsArray = null;
	}
	//reset current field options
	for (i=NavModField.options.length; i>0; i--) {
		NavModField.options[i] = null;
	}
	if (NewOptionsArray != null) {
		for (i=0; i < NewOptionsArray.length; i++) {
			NavModField.options[i+1] = NewOptionsArray[i];
		}
	}
}
function isSelected(select, isMulti) {
  // select is the select field
  // isMulti is multiple attribute  
	var checkNum = 0;  
	if (isMulti) {
		checkNum = -1;
  	}
  
  	if (checkNum == select.selectedIndex) {
		return false;
	} else {
		return true;
	}  
}
function getCheckValues(aCheckField) {
  var returnArray = new Array();
  var j = 0;
  if (aCheckField.length == undefined && aCheckField.checked) {
    returnArray[0] = aCheckField.value;
    return returnArray;
  }
   
  for (var i = 0; i < aCheckField.length; i++) {
    if (aCheckField[i].checked == true) {
      returnArray[j++] = aCheckField[i].value;
    }
  }
  return returnArray;
}
function getRadioValue(aRadioField) {
	var valueChecked = "";
	for (var i = 0; i < aRadioField.length; i++) {
		if (aRadioField[i].checked == true) {
			valueChecked = aRadioField[i].value;
			break;
		}
	}
	return valueChecked;
}
function getRadioIFValidate(aRadioField) {
	var valueChecked = "";
	var theRadioField = eval("document.interactive." + aRadioField.name);
	for (var i = 0; i < theRadioField.length; i++) {
		if (theRadioField[i].checked == true) {
			valueChecked = theRadioField[i].value;
			break;
		}
	}
	return valueChecked;
}
function ConfirmDelete (title,url) {
    if (confirm("Are you sure you want to delete '" + title.replace("&apos;", "\'") + "'?")) {
	 window.location.href = url;
    }
}
function SetEditMode(id,args) {
  window.location="/" + g_dbFilePath + "/0/" + id + "?editdocument&cm=1" + args;
}
function translateStatus(n) {
	//looks up status label from keyword documents and returns the label for the numerical status
	var label = "Error Looking Up Status ("+n+")"; 
	switch (n) {
	case -1 :
label='Sent to Owner';
break;
case -2 :
label='Sent To Management';
break;
case -3 :
label='Sent to e-Business Communications';
break;
case 0 :
label='New';
break;
case 1 :
label='Approved';
break;

	}
	return label;
}
function translateDocType(txt) {
	//looks up DocType label from keyword documents and returns the label value
	var label = txt; 
	switch (txt) {
	case 'HomePage' :
label='Home Page';
break;
case 'Interactive' :
label='Interactive Form';
break;
case 'NavigatorEntry' :
label='Navigation Entry';
break;
case 'Page' :
label='Page';
break;
case 'Unbranded Jump Page' :
label='Unbranded Jump Page';
break;

	}
	return label;
}
function authorizedToDelete(url, doc_status, title, authList) {
	//if a user is authorized to delete a document, returns the url of the delete link
	var isPublisher = 0;
	var isCM = 0;
	var AuthArray = authList.split(",");
	var UserNamesArray= g_listUserNames.split(",");
	var url="&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"javascript:ConfirmDelete('" + title + "','" + url + "');\">Delete</a>";
	if ( isPublisher==1) {
		return url;
	} else {
		if (isCM==1) {
			if (parseInt(doc_status)< 1 && AuthArray.hasMatch(UserNamesArray)) {
			return url;
			} 
		}
	}
	return "";
}
function HistoryMode(Id) {
	var strURL=""
	if (Id=="rev") {
		strURL=document.location.href.replace('&hist=app', '');
	} else {
		strURL=document.location.href+'&hist=app';
	}
	window.location.replace(strURL)
}
function exp(strExp) {
	var strURL=""
	if(strExp == "more") {
		strURL=document.location.href+'&count=9999';
	} else {
		strURL=document.location.href.replace('&count=9999','')
	}
	window.location.replace(strURL)
}
function setlinks(p, v, n) {  
//This function takes a url parameter named p and appends the pair p=v to the end of a url string
//Also takes into account internal page links, preserves them, and moves to end of new url string
var alerted = false;
var lp = p.toLowerCase();
for (var i = n; i < document.links.length; i++) {
var strHost = location.hostname;
var strQuestion = '';
if (document.links[i].protocol == 'http:' && (document.links[i].hostname == strHost)) {
//Use the search property of the link object to append the view parameter
if (document.links[i].search.indexOf('?') == -1) {
strQuestion = '?Open';
}
if (document.links[i].href.toLowerCase().indexOf('&'+lp+'=') < 0) {
if (document.links[i].href.indexOf('#') > -1) {
//The link has an internal reference, preserve it and put on end of url
document.links[i].search = document.links[i].search + strQuestion + '&'+lp+'=' + v + document.links[i].href.substr(document.links[i].href.indexOf('#'));
} else {
document.links[i].search = document.links[i].search + strQuestion + '&'+lp+'=' + v;
}
}
var linkBegin = document.links[i].href.substring(0, document.links[i].href.toLowerCase().lastIndexOf('.nsf') + 4);
var linkEnd = document.links[i].search;
var linkMiddle = document.links[i].href.substr(linkBegin.length, document.links[i].href.length - (linkBegin.length + linkEnd.length));
document.links[i].href = linkBegin + escape(linkMiddle) + linkEnd;
        }
    }
}
function setAudienceLinks(p_strAudience) {
   //similar to setlinks, handles specific issues related to audience parameters
    var strHost = location.hostname;
    var strQuestion = '?opendocument';
    var boolProtocolMatch;
    var boolHostMatch;
    var boolHasQuestion;
    
    if (p_strAudience == '') {
    	return false;
    }
    
    for (var i = 0; i < document.links.length; i++) {
	var intQuestionPosition = document.links[i].search.toLowerCase().indexOf(strQuestion);
	if (document.links[i].protocol == 'http:') {
		boolProtocolMatch = true;
	} else {
		boolProtocolMatch = false;
	}
	if (document.links[i].hostname == strHost) {
		boolHostMatch= true;
	} else {
		boolHostMatch= false;
	}
	if (intQuestionPosition > -1) {
		boolHasQuestion= true;
	} else {
		boolHasQuestion= false;
	}
	if (boolProtocolMatch && boolHostMatch && boolHasQuestion) {
		var strURLParts = document.links[i].href.toLowerCase().split(strQuestion); // we want this to fall out of scope each time
		document.links[i].href = (strURLParts[0] + p_strAudience + strQuestion + strURLParts[1]);
        }
    }
}
function loadinparent(url){
self.opener.top.location = url;
self.close();
}
function CalcCancel(docId, isNew, targetWindow) {
 var foc = thisform["forwardOnCancel"].value;
	if (foc==""){
	foc='/internet/bcbs/mim/mimanage.nsf/CMS?Open&view=CM';
	}
var cancelfoc =  '/internet/bcbs/mim/mimanage.nsf/cancel?OpenAgent' +'&forwardTo=' +foc + '&contextunid=' + docId
	if (confirm("All changes will be lost?")) {
		if (isNew == '1') {	
		targetWindow.location.href = foc
		} else {
			if (window != targetWindow) {
			loadinparent(cancelfoc);
			} else {
			targetWindow.location.href = cancelfoc
	  		}
		}
	}
}
function fixAlt() {
var t='';
var t1='';
var t2 = '';
var jspos = 0;
var csnbr = '';
var sep1 = ",";
var sep2 = "~";
x=window.document.images.length
 for (i=0; i<x; i++) {
 var altText = window.document.images[i].alt; 
//   if (window.document.images[i].alt.indexOf('Show details for [') == 0) {
   if (altText.indexOf('Show details for [') == 0) {
   t1 = altText.substr(0,altText.indexOf('</span>')); 
   t2 = altText.substr(0,altText.indexOf('>')); 
   t = 'Show details for ' + altText.substr(t2.length +1,t1.length-t2.length-1);
   window.document.images[i].alt = t;
   }
   if (altText.indexOf('Hide details for [') == 0) {
   t1 = altText.substr(0,altText.indexOf('</span>')); 
   t2 = altText.substr(0,altText.indexOf('>')); 
   t = 'Hide details for ' + altText.substr(t2.length +1,t1.length-t2.length-1);
   window.document.images[i].alt = t;
   }
// check for next category alt text - - uses script tags
 if (altText.indexOf('Show details for') == 0) {
   jsEndPos = altText.indexOf('</script>');
   if (jsEndPos > 0) {   
   t1 = altText.substr(0,jsEndPos-3); 
   t2 = t1.charAt(t1.length-2); 
   if (t2 == "-") {
   csnbr = t2 + t1.charAt(t1.length-1); 
   }
   else {
  csnbr = t1.charAt(t1.length-1); 
   } 
var jStat = getStatus(g_jsStatuses, sep1, sep2, csnbr)
      t = 'Show details for ' + jStat;
     window.document.images[i].alt = t;    
    }
  }
 if (altText.indexOf('Hide details for') == 0) {
   jsEndPos = altText.indexOf('</script>');
   if (jsEndPos > 0) {   
   t1 = altText.substr(0,jsEndPos-3); 
   t2 = t1.charAt(t1.length-2); 
   if (t2 == "-") {
   csnbr = t2 + t1.charAt(t1.length-1); 
   }
   else {
  csnbr = t1.charAt(t1.length-1); 
   } 
var jStat = getStatus(g_jsStatuses, sep1, sep2, csnbr.toString())
      t = 'Hide details for ' + jStat;
     window.document.images[i].alt = t;    
    }
  }
 }
}
function getStatus(item, delimiter1, delimiter2, statKey){
  tempArray=new Array(1);
  var Count=0;
  var found = false;
  var tempString=new String(item);
  var theStatus = "";
  
  
  while (tempString.indexOf(delimiter1)>0) {
    tempArray[Count]=tempString.substr(0,tempString.indexOf(delimiter1));
    if (tempArray[Count].indexOf(statKey)>=0 ) {    //alert('stakey1= ' +statKey);
     theStatus = tempArray[Count].substr(tempArray[Count].indexOf(delimiter2) + 1); 
  
     }   
    tempString=tempString.substr(tempString.indexOf(delimiter1)+1,tempString.length-tempString.indexOf(delimiter1)+1); 
    Count++  ;
}
// get the last value
  tempArray[Count]=tempString;   
   if (tempArray[Count].indexOf(statKey)>=0 ) {    
     theStatus = tempArray[Count].substr(tempArray[Count].indexOf(delimiter2) + 1); 
}
  return theStatus
}
function detach(att) {
	if (att.checked==true) {
		if (!confirm("Delete " + att.value + "?")) {
			att.checked = false;
		} 
		thisform.detAtt.value='true';
		$('RequiredUploadAsterisk').style.display="block";
	}	
	if (att.checked==false) {
		if (!confirm("Keep " + att.value + "?")) {
			att.checked = true;
		}
		$('RequiredUploadAsterisk').style.display="none";
		thisform.detAtt.value='false';
		
	}
}
function checkBack() {
	if ($("CloseByButton")) {
		if($("CloseByButton").value=="0") {
			var strSaveButtonLabel = document.getElementById("savebutton").value;
			var strCancelButtonLabel = document.getElementById("cancelbutton").value;
			event.returnValue = "WARNING: You are trying to leave this page without using " + strCancelButtonLabel + " or " + strSaveButtonLabel  + ", which will lose any changes you have made. It will also lock this document and prevent others from accessing it. To avoid locking documents in the future, always use the " + strSaveButtonLabel + " or " + strCancelButtonLabel + " buttons to close a document you are editing."
		}
	}
}
function setCloseByButton (newValue) {
$("CloseByButton").value = newValue;
}
function InteractiveFormValidate(form) {
	resetErrorValue(errorlist);
	resetErrorHighlights(form);
	window.status='validating file submission';
	var interactiveFormData = new FormData(form);
	var elements = form.elements;
	var strFieldName = '';
	for (var i = 0; i < elements.length; i++) {
		if (!(strFieldName == elements.item(i).name)) {
			strFieldName = elements.item(i).name;
			var type=elements.item(i).type;
			var strFieldValue = $F(elements.item(i));
			if (type=="radio") {
				strFieldValue = getRadioIFValidate(elements.item(i));
			}
			if (strFieldName != undefined && strFieldName != '' && strFieldName != '_' && strFieldValue != undefined && strFieldValue != '') {
				interactiveFormData.addValue(strFieldName, strFieldValue);
			}           
			var val="";
			var req = elements.item(i).getAttribute('errText');
			if(req) {
				if (req!="") {
					window.status='Required field identified';
					var label=elements.item(i).getAttribute('label');
					
					window.status='Required field - '+label;
					if (type=="text") {
						val=elements.item(i).value;
						var cn=elements.item(i).getAttribute('ClassName');
						if (cn=="" | cn==null) {
							var cn=elements.item(i).getAttribute('class');
						}
						window.status='Required field - '+cn;
						if (cn=="acinput") {
							if (val.length!=3){
								val="validated";
								insertErrorValue(label, "The " + req + " Area Code must have 3 digits.");
								setFieldErrorHighlight(elements.item(i), type);
							} else if (isNaN(val)){
								val="validated";
								insertErrorValue(label, "The " + req + " Area Code must contain only digits.");
								setFieldErrorHighlight(elements.item(i), type);
							}
						}
						if (cn=="pninput") {
							window.status='Required field - '+val;
							val=val.replace("-", "");
							if (val.length!=7){
								val="validated";
								insertErrorValue(label, "The Phone Number must have 7 digits.");
								setFieldErrorHighlight(elements.item(i), type);
							} else if (isNaN(val)){
								val="validated";
								insertErrorValue(label, "The Phone Number must contain only digits.");
								setFieldErrorHighlight(elements.item(i), type);
							}
						}
					}
					if (type=="radio") {
						val=getRadioIFValidate(elements.item(i));
					}
					if (type=="select-one"){
						val=getSelectValue(elements.item(i));
					}
					if (type=="textarea"){
						val=elements.item(i).value;
					}
					if (val=="") {
						insertErrorValue(label, req)
						setFieldErrorHighlight(elements.item(i), type)
					}
				}
			}
		}
	}
	// Begin form-specific validation
	if (form.EmailAddress) {
		if (form.EmailAddress.value != '' & echeck(form.EmailAddress.value)==false) {
			insertErrorValue("E-mail Address", "Please enter your E-mail Address in the format:  EmailAddress@domain.ext")
			setFieldErrorHighlight(form.EmailAddress, "text")
		}
		if (form.ConfirmEmailAddress) {
			if (form.ConfirmEmailAddress.value != '' & form.EmailAddress.value!=form.ConfirmEmailAddress.value) {
				insertErrorValue("Confirm E-mail Address", "The E-mail Addresses you entered do not match.")
				setFieldErrorHighlight(form.ConfirmEmailAddress, "text")
			}
		}
	}
	// End form-specific validation
	window.status='validations complete, display errors or submit'
	if (errorlist == "") {
		window.status='No errors';
		showErrorBlock(false, errorlist, form);
		window.status='submitting file';
		interactiveFormData.submit();
	} else {
		window.status='display all errors'
		showErrorBlock(true, errorlist, form);
	}
}
function checkTAOName(eVal) {
	if (eVal.indexOf(".") < 0 || eVal.indexOf(".") == eVal.length-1) {
		return	false;
	} else {
		return true;
	}		
}
function checkRFCEmail(eVal) {
	var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3} \.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
    return re.test(eVal);
}
function checkIDName(eVal) {
	if (eVal.length<4) {
		return	false;
	} else {
		return true;
	}		
}
function strTrim(eVal) {
//This function trims spaces before and after a string
firstChar=eVal.substring(0,1)
		while (firstChar==" ") {
			eVal=eVal.substring(1,eVal.length)
			firstChar=eVal.substring(0,1)
		}
	
		lastChar=eVal.substring(eVal.length-1, 1)
		while (lastChar==" ") {
			eVal=eVal.substring(eVal.length,eVal.length-1)
			lastChar=eVal.substring(eVal.length-1,1)
		}
return eVal;
	
}
function echeck(str) {
var strListLength = str.length;
var strArray = str.split(",");
	if (listFlag == false) {
		n = 0
		listFlag = true	
	}
	
	for (i = 0 ; i < strArray.length ; i++) {
		if (!checkRFCEmail(strArray[i])) {
			return false;
		}
		
	}
	
}
function openNewPage(pageName) {
   	var curURL = window.location.href	
	var dbIndex = curURL.indexOf(".nsf");
	var newURL = curURL.substr(0,dbIndex+4);
	newURL += pageName;
	window.open(newURL,"window1","width=691,height=500,resizable=yes,toolbar=yes,scrollbars=yes,location=yes,status=yes")
}
function calcUnlocks(form,us) {
/*Confirms from end user that all selected document(s) from the document locked view are to be unlocked*/
	var fname = "";
	var fVal = "";
	var unlArray = new Array();
	var x=0;
	for (i=0 ; i<form.elements.length ; i++) {
		if (form.elements[i].type == "checkbox" && form.elements[i].name.substr(0,3)=='unl' && form.elements[i].checked) {
			unlArray[x] = form.elements[i].value;
			x++ 
		}	
	}	
	if (unlArray.length==1) {
		if (confirm("Are you sure you want to unlock this entry?")) {
			window.location = us + unlArray.join(',');
		} 	
	} else if (unlArray.length > 1) {
		if (confirm("Are you sure you want to unlock these " + unlArray.length + " entries?")) {
			window.location = us + unlArray.join(',');
		}
	} else {
		alert('No entries selected.');
	}
}
function hideAlt() {
/*Hides from end user any alternate tags for images*/
	for (i = 0; i < document.images.length; i++) {
		imagename = document.images(i).alt;
		if (imagename != "") {
			document.images(i).alt = "";
   		}
	}
}
function writeInCombo (p_cmbTarget, p_varData) {
	var strItemValue = "";
	p_cmbTarget.options.length = 0; // Clear existing entries
	p_cmbTarget.options.length += 1;
	p_cmbTarget.options[0].text = "--Please Choose One--";
	for (var intItemCount = 0; intItemCount < p_varData.length; intItemCount++) {
		
		p_cmbTarget.options.length += 1;
		strItemValue = p_varData[intItemCount];
		if (strItemValue != undefined && strItemValue != null) {
			if (strItemValue.indexOf('|') > 0) {  // if theres a pipe, split out text and value
				p_cmbTarget[p_cmbTarget.options.length - 1].text = trim(Left(strItemValue, '|'));
				p_cmbTarget[p_cmbTarget.options.length - 1].value = trim(Right(strItemValue, '|'));
			} else {			
			p_cmbTarget[p_cmbTarget.options.length - 1].text = trim(strItemValue);
			}
		}
	}
	p_cmbTarget.selectedIndex = 0;
}
function DbLookup(p_strPath, p_strView, p_strKey, p_intColumn) {
	var pos = 0;
	var currURL = (document.location.href).toLowerCase();
	pos = currURL.indexOf('://') + 3;
	pos = currURL.indexOf('/', pos);
	var strServer = currURL.substring(0, pos);
	var strXMLPath = trim(strServer) + "/" + trim(p_strPath) + "/" + p_strView + "?ReadViewEntries&RestrictToCategory=" + p_strKey + "&count=1000";
	if (window.XMLHttpRequest) {
		AJAXRequest = new XMLHTTPRequest();
		AJAXRequest.overrideMimeType('text/xml');
	} else if (window.ActiveXObject) {
		AJAXRequest = new ActiveXObject("Microsoft.XMLHTTP");
	}
	AJAXRequest.open("GET", strXMLPath, false);
	AJAXRequest.send();
	if (AJAXRequest.status == 200) { // Only process if no errors are encountered
		return lookupResults(AJAXRequest.responseXML.documentElement);
	} else {
		window.status = "Error retrieving database information:" + AJAXRequest.statusText;
	}
}
function DbColumn(p_strPath, p_strView, p_intColumn) {
	var pos = 0;
	var currURL = (document.location.href).toLowerCase();
	pos = currURL.indexOf('://') + 3;
	pos = currURL.indexOf('/', pos);
	var strServer = currURL.substring(0, pos);
	var strXMLPath = trim(strServer) + "/" + trim(p_strPath) + "/" + p_strView + "?ReadViewEntries" + "&count=10000";
	if (window.XMLHttpRequest) {
		AJAXRequest = new XMLHTTPRequest();
		AJAXRequest.overrideMimeType('text/xml');
	} else if (window.ActiveXObject) {
		AJAXRequest = new ActiveXObject("Microsoft.XMLHTTP");
	}
	AJAXRequest.open("GET", strXMLPath, false);
	AJAXRequest.send();
	if (AJAXRequest.status == 200) { // Only process if no errors are encountered
		return lookupResults(AJAXRequest.responseXML.documentElement);
	} else {
		window.status = "Error retrieving database information:" + AJAXRequest.statusText;
	}
}
function processReqChange() {
	if (AJAXRequest.readyState == 4) { // Only process once XML is loaded completely
		if (AJAXRequest.status == 200) { // Only process if no errors are encountered
			populateLookupResults(AJAXRequest.responseXML.documentElement);
		} else {
			window.status = "Error retrieving database information:" + AJAXRequest.statusText;
		}
	}
}
function lookupResults(p_strResponseXML) {
	var NodeList = p_strResponseXML.getElementsByTagName("viewentry");
	var strResult = "";
	var strDelimiter = ""; // Left blank on first for iteration to avoid a null entry at split
	
	for (var intNodeCount = 0; intNodeCount < NodeList.length; intNodeCount++) {
		strResult += strDelimiter + NodeList[intNodeCount].getElementsByTagName("text")[0].childNodes[0].nodeValue;
		strDelimiter = "#";
	}
	var varResultArray = strResult.split("#");
	return varResultArray;
}
// this function is needed to work around a bug in IE related to element attributes
function hasClass(obj) {
    var result = false;
    if (obj.getAttributeNode("class") != null) {
        result = obj.getAttributeNode("class").value;
    }
    return result;
}
function stripe(id) {
    // the flag we'll use to keep track of whether the current row is odd or even
    var even = false;
    // if arguments are provided to specify the colours of the even & odd rows, then use the them;
    // otherwise use the following defaults:
    var evenColor = arguments[1] ? arguments[1] : "#fff";
    var oddColor = arguments[2] ? arguments[2] : "#eee";
    // obtain a reference to the desired table if no such table exists, abort
    var table = $(id);
    if (! table) { return; }
    // by definition, tables can have more than one tbody element, so we'll have to get the list of child
    // <tbody>s 
    var tbodies = table.getElementsByTagName("tbody");
    // and iterate through them...
    for (var h = 0; h < tbodies.length; h++) {
        // find all the &lt;tr&gt; elements... 
        var trs = tbodies[h].getElementsByTagName("tr");     
        // ... and iterate through them
        for (var i = 0; i < trs.length; i++) {
            // avoid rows that have a class attribute
            // or backgroundColor style
            if (! hasClass(trs[i]) && !trs[i].style.backgroundColor) {
                // get all the cells in this row...
                var tds = trs[i].getElementsByTagName("td");
                // and iterate through them...
                for (var j = 0; j < tds.length; j++) {
                    var mytd = tds[j];
                    // avoid cells that have a class attribute or backgroundColor style
                    if (! hasClass(mytd) && ! mytd.style.backgroundColor) {
                        mytd.style.backgroundColor = even ? evenColor : oddColor;
                    }
                }
            }
            // flip from odd to even, or vice-versa
            even =  ! even;
        }
    }
}
function setViewLinks() {
  var viewType = thisform.ViewType.value;
  
  for (var i = 0; i < document.links.length; i++) {
    // check for the view navigation
    if ((document.links[i].search.indexOf('Expand') != -1) || (document.links[i].search.indexOf('Collapse') != -1)) {
      document.links[i].search = document.links[i].search + '&view=' + viewType;
    }
  }
}
//******************* from buttons subform ********************
function SendReview(sDocId, sForm,sType, sStat) {
  var strQuery = '/' + sForm + '?OpenForm&did=' + sDocId + '&ds=' + sStat+ '&sf=' + sType;
  var sFeatures = 'scrollbars=1; width=675; height=500; status=yes; help=no; toolbar=no; location=no; resizable=yes'; 
  newWin = window.open('/' + g_dbFilePath + strQuery, 'ApprovalHistory', sFeatures);
  newWin.focus();
}
function WorkingEditMode(unid) {
window.location='/' + g_dbFilePath+'/0/'+unid+'?EditDocument&cm=1';
}
//******************* end from buttons subform ********************
//******************* begin from Document form *******************
function IsDocContainAttach (form) {
		for (i = 0 ; i < form.elements.length ; i++) {
		if (form.elements[i].name == "%%Detach") {
			return true;									
		}
	}
	return false;
}
function removeAttach (form) {
	if (IsDocContainAttach(form)) {
		form.elements['%%Detach'].checked = true
	}
}
function IsNewAttachPresent (form) {
	for (i = 0 ; i < form.elements.length ; i++) {
		if (form.elements[i].type == "file") {					
			if (form.elements[i].value != "") {
				return true;
			}						
		}
	}
	return false;
}
function addHierarchy() {
	var intCategoryCount = parseInt(thisform.CategoryCount.value);
	var itmSortHierarchies = thisform.SortHierarchies;
	var strHierarchyText = '';
	var strCategoryText = '';
	var itmCategory = null;
	var itmSort = null;
	var strSortOrder = '';
	for (x = 1; x <= intCategoryCount; x++) {
		itmCategory = $('Category' + x );
		strCategoryText = getSelectValue(itmCategory);
		if (itmCategory.selectedIndex > 0 && strCategoryText != '') {
			if (x > 1) {
				strHierarchyText += '~';
			}
			strHierarchyText += strCategoryText + '^';
			itmSort = $('Sort' + x);
			strSortOrder = itmSort.value;
			if (strSortOrder == '') {
				strHierarchyText += '0';
			} else {
				strHierarchyText += strSortOrder;
			}
			itmCategory.selectedIndex = 0;
			itmSort.value = '0';
			itmSort.disabled = true;
		}
		if (x > 1) {
			itmCategory.disabled = true;
		}
	}
	if (strHierarchyText != '') {
		var itmHierarchy = thisform.SortHierarchy;
		var intOptionCount = itmHierarchy.options.length;
		if (itmHierarchy.options[0].text == '') {
			intOptionCount = 0; // initially the field will have a single null value; this overwrites it
		}
		itmHierarchy.options[intOptionCount] = new Option(strHierarchyText);
		if (itmSortHierarchies.value != '') {
			itmSortHierarchies.value += ', ';
		}
		itmSortHierarchies.value += strHierarchyText;
	}
}
function removeHierarchy() {
	var itmHierarchy = thisform.SortHierarchy;
	var itmSortHierarchies = thisform.SortHierarchies;
	var HierarchyOption = itmHierarchy.options[itmHierarchy.selectedIndex];
	var strHierarchyChoice = HierarchyOption.text;
	var strBeforeValue = itmSortHierarchies.value;
	
	if (itmHierarchy.options.length == 1) {
		HierarchyOption.text = '';
	} else {
		itmHierarchy.removeChild(HierarchyOption);
	}
	var strAfterValue = strBeforeValue.replace(strHierarchyChoice, '')
	itmSortHierarchies.value = strAfterValue;
	thisform.RemoveHierarchyButton.disabled = true;
}
function setDependentCategoryOptions(p_intParentID, p_intChildID) {
	var intCategoryCount = parseInt(thisform.CategoryCount.value);
	var strParentSortID = 'Sort' + p_intParentID.toString();
	var itmParentSort = thisform[strParentSortID];
	var boolHasChildCategory = true;
	var strChildCategoryID = null;
	var itmChildCategory = null;
	
	if (intCategoryCount <= p_intParentID) {
		boolHasChildCategory = false; // no more categories to return
	}
	
	var strParentCategoryID = 'Category' + p_intParentID.toString();
	var itmParentCategory = thisform[strParentCategoryID];
	
	var strCategoryValue = getSelectValue(itmParentCategory);
	if (strCategoryValue == "--Please Choose One--" || strCategoryValue == "") {
		for (x = p_intParentID; x <= intCategoryCount; x++) {
			thisform['Sort' + x.toString()].value = '0'
			thisform['Sort' + x.toString()].disabled = true;
			if (x > p_intParentID) {
				thisform['Category' + x.toString()].selectedIndex = 0;
				thisform['Category' + x.toString()].disabled = true;
			}
		}
		return;
	}
	if (boolHasChildCategory) {
		strChildCategoryID = 'Category' + p_intChildID.toString();
		itmChildCategory = thisform[strChildCategoryID];
		itmChildCategory.disabled = false;
	
		writeInCombo(itmChildCategory, DbLookup(thisform.DBPath.value, thisform.KeywordViewName.value, strCategoryValue.toLowerCase(), 2));
	}
	itmParentSort.disabled = false;
}
//*********************** end from Document form ************************
//*********************** from Approval History form ************************
function getUploadValues(requploads, FileID) {
	var UploadControl = $(FileID);
	g_strUploadField = UploadControl;
	g_strUploadFileName = UploadControl.value.substr(UploadControl.value.lastIndexOf('\\') + 1);
	//we're not requiring an upload, this is just to populate the variables
	return true;
}
function openLookUp() {
	$('AddButton').disabled=false;
	var strQuery = '/UserIDSearch?OpenForm&namefld=editRec';
	var sFeatures = 'scrollbars=1; width=520; height=420; status=yes; help=no; toolbar=no; location=no; resizable=no'; 
	LDAPWin = window.open('/' + g_dbFilePath + strQuery, 'LDAP',sFeatures);
	LDAPWin.focus();
}
function calcFields(){
	calcRecipients();
}
function calcRecipients() {
	var recArray = new Array()
	for (i = 0 ; i < thisform.rec.length ; i++) {
		recArray[i] = thisform.rec.options[i].text
	}
	thisform.strAppRecipientItem.value = recArray.join(",")
	
	var idArray = new Array()
	for (i = 0 ; i < thisform.id.length ; i++) {
		idArray[i] = thisform.id.options[i].text
	}
	thisform.strAppIDItem.value = idArray.join(",")
	
}
function calcAttachments() {
	var fname = ""
	var fVal = ""
	for (i=0 ; i<thisform.elements.length ; i++) {
		if (thisform.elements[i].type == "file") {
			fname = thisform.elements[i].name
			break
		}	
	}
	fVal = thisform.elements[fname].value
	thisform.attach1.value = fVal.slice(fVal.lastIndexOf('\\') +1)
}
function addRec(recVal) {
	resetErrorValue(errorlist);
	resetErrorHighlights(thisform);
	showErrorBlock(false, errorlist, thisform);
	$('RemoveButton').disabled=false;
	var recListLength = thisform.rec.options.length
	var recArray = recVal.split(",");
	
	var n = recListLength;	
	
		
	if (listFlag == false) {
		n = 0
		listFlag = true	
	}
	
	for (i = 0 ; i < recArray.length ; i++) {
		if (checkTAOName(recArray[i])) {			
			performTAOXRef('TAOToNovell', strTrim(recArray[i]),'addApprover');
			n = n + 1
			thisform.editRec.value = "";
				
		} else {
			alert("Please enter name in TAO format (i.e. Firstname.Lastname)")
			thisform.editRec.focus()	
		}
		
	}
	resetErrorValue(errorlist);	
	
}
function remRec() {
	var rec = thisform.rec;
	var id = thisform.id;
	var intSelectedIndex = rec.options.selectedIndex;
	
	if (intSelectedIndex >= 0) {
		var recOption = rec.options[intSelectedIndex];
		var idOption = id.options[intSelectedIndex];
		$('RemoveButton').disabled=true;
		rec.removeChild(recOption);
		id.removeChild(idOption);
	} else {
		alert("You must select an entry to remove")
	}
}
function trim(aStr) {
  return aStr.replace(/^\s{1,}/, "").replace(/\s{1,}$/, "");
}
//*********************** end from Approval History form ************************
//*********************** from Keyword form ************************
function addCategory () {
y = (prompt("Please enter new category.", "Type new category here"));
var currKwCats = thisform.KeywordCategory.options; 
var kwCatExists = false;
var newKwCat = y; 
if (newKwCat != '' && newKwCat != 'Type new category here' && newKwCat!=null) {
  if (currKwCats.length!= null) {
   for ( n=0;n<currKwCats.length;n++){
      if (currKwCats[n] == newKwCat) {
      kwCatExists = true;
      break;
      }
    }
  }
else {
 currKwCats.length +=1;
 currKwCats[currKwCats.length-1] = new Option(newKwCat, newKwCat, true, true);
    }
if (kwCatExists == false) {
  currKwCats.length +=1; 
  currKwCats[currKwCats.length-1] = new Option(newKwCat, newKwCat, true, true)
    }
}
if(y!=null){
 if (y=='Type new category here' || y==''){
 alert('Please enter a new category or choose one from the list');
 }
 else {
 document.all['catbtn'].style.display='none';
 }
}
}
//*********************** end from Keyword form ************************
//*********************** from File form ************************
function checkRequiredUploads(requploads, FileID) {
	var UploadControl = $(FileID);
	g_strUploadField = UploadControl;
	g_strUploadFileName = UploadControl.value.substr(UploadControl.value.lastIndexOf('\\') + 1);
	if (g_strUploadFileName == "") {
		return false;
	} else {
		return true;
	}
}
function duplicateFileExists (p_strFileName) {
	var AJAXRequest;
	var strRequestServer = $('Server_Name').value
	var strRequestArguments = "&FileName=" + p_strFileName + "&DID=" + $("DID").value;
	var strRequestURL = "http://" + strRequestServer + "/" + g_dbFilePath + "/DoesDuplicateFileExist?OpenAgent" + strRequestArguments;
	
	if (window.XMLHttpRequest) {
		AJAXRequest = new XMLHTTPRequest();
	} else if (window.ActiveXObject) {
		AJAXRequest = new ActiveXObject("Microsoft.XMLHTTP");
	}
	AJAXRequest.open("GET", strRequestURL, false);
	AJAXRequest.send();
	if (AJAXRequest.readyState == 4) { // Only process once response is loaded completely
		if (AJAXRequest.status == 200) { // Only process if no errors are encountered
			if (eval(AJAXRequest.responseText)) {
				return true;
			} else {
				return false;
			}
		} else {
			window.status = "Error retrieving database information: " + AJAXRequest.statusText;
		}
	}	
}
function filePageLoader() {
setForm();
  if (self.opener) {
	if($('cancelbutton')) {
	$('cancelbutton').style.display = "none";
	}
	if($('EWPCancel')) {
	$('EWPCancel').style.display = "inline";
	}
	if($('EWPInsert')) {
	$('EWPInsert').style.display = "inline";
	}
  } else {
	if($('cancelbutton')){
	$('cancelbutton').style.display = "inline";
	}
	if($('EWPCancel')) {
	$('EWPCancel').style.display = "none";
	}
	if($('EWPInsert')) {
	$('EWPInsert').style.display = "none";
	}
	
  }
  focus();
}
//*********************** end from File form ************************
//*********************** from Display form ************************
function preview(sDocId) {
  var strQuery = '/doc/' + sDocId + '?opendocument&cm=1';
  var sFeatures = 'scrollbars=1; width=900; height=600; status=yes; help=no; toolbar=no; location=no; resizable=yes'; 
  newWin = window.open('/' + g_dbFilePath + strQuery, 'Preview', "");
  newWin.focus();
}
//*********************** end from Display form ************************
//*********************** from Interactive subform ************************
function appendInteractiveField() {
var doc = document.forms[document.forms.length - 1];
var RemoveFieldContainer = $('RemoveFieldLabel');
var RemoveFieldHTML = RemoveFieldContainer.innerHTML;
if (doc.FormFieldLabels.value == "") {
RemoveFieldHTML = "";
}
var ctnt = $("formcontent").value;
var req = '&nbsp;'
var ThisOption = doc.FieldLabel.value;
if (ThisOption == '' || doc.FieldName.value == '') {
return alert('A field label and name must both be specified prior to adding a field.');
}
if (doc.FieldName.value.indexOf(' ') > 0) {
doc.FieldName.value = doc.FieldName.value.replace(' ','');
return alert('Field names may not contain spaces.');
}
if(getRadioValue(doc.FieldRequired)=="1") {
if(doc.ErrorText.value=="") {
return alert('Required fields must have Error Text to display.');
}
req="<SPAN class=IntRS>*</SPAN>"
}
if (ctnt.indexOf('name="' + doc.FieldName.value + '"') > -1) {
return alert('Please enter a unique Field Name.');
}
if (ctnt.indexOf('label="' + doc.FieldLabel.value + '"') > -1) {
return alert('Please enter a unique Field Label.');
}
var fieldList = doc.FormFieldLabels.value.split(',');
var requiredFieldList = doc.RequiredFields.value.split(',');
fieldList.push(ThisOption);
doc.FormFieldLabels.value = fieldList.toString();
if (doc.ErrorText.value != '') {
requiredFieldList.push(ThisOption);
doc.RequiredFields.value = requiredFieldList.toString();
}
			
existCtnt=ctnt
existCtnt = existCtnt + "<tr id=\"" + ThisOption + "\"><td class='fldlabel'>" + ThisOption+req+"</td><td class='flddata'>";
var ft = doc.FieldType.options[doc.FieldType.selectedIndex].value;
if (ft == "Txt") {
existCtnt = existCtnt + "<input type=\"text\" name=\"" + doc.FieldName.value + "\" label=\""+ThisOption+"\" errText=\""+doc.ErrorText.value+"\"></td></tr>";
} else if (ft == "TxtArea") {
existCtnt = existCtnt + "<textarea name=\"" + doc.FieldName.value + "\" label=\""+ThisOption+"\" errText=\""+doc.ErrorText.value+"\"></textarea></td></tr>";
} else if (ft == "D") {
existCtnt = existCtnt + getInteractiveSelectValue() + "</td></tr>";
} else if (ft == "R") {
existCtnt = existCtnt + getInteractiveRadioValue() + "</td></tr>";
} else if (ft == "P") {
existCtnt = existCtnt + "(<input type=\"text\" name=\"^" + doc.FieldName.value + "AC\" maxlength=\"3\" class=\"acinput\" size=\"4\" label=\""+ThisOption+"\" errText=\""+doc.ErrorText.value+"\" maxlength=3 onkeyup=\"if (this.value.length == 3) {document.getElementById('^" + doc.FieldName.value + "PN').focus();};\">) "
existCtnt = existCtnt + "<input type=\"text\" name=\"^" + doc.FieldName.value + "PN\"  id=\"^" + doc.FieldName.value + "PN\"maxlength=\"8\" class=\"pninput\" size=\"10\" label=\""+ThisOption+"\" errText=\""+doc.ErrorText.value+"\"></td></tr>";
}
doc.formcontent.value = existCtnt;
doc.FieldLabel.value = '';
doc.FieldName.value = '';
doc.FieldRequired[0].checked=true;
doc.ErrorText.value = '';
$('errText').style.display='none';
doc.FieldType.selectedIndex = 0;
doc.FieldKeyword.selectedIndex = 0;
RemoveFieldHTML += "<input type='radio' name='RemoveFieldChoice' value='" + ThisOption + "' onclick='processInteractiveRemoval();'>" + ThisOption + "<br/>"
resetInteractiveRemoveChoice(RemoveFieldHTML);
}
function displayInteractiveFields() {
var fieldsDiv = $("formFields");
var newDiv = document.createElement("div");
var fieldName = thisform.FieldLabel.value;
newDiv.setAttribute("id", fieldName);
var newSpan = document.createElement("span");
newSpan.appendChild(document.createTextNode(fieldName));
newDiv.appendChild(newSpan);
fieldsDiv.appendChild(newDiv);
}
function getInteractiveRadioValue() {
var result = ""; 
var fieldToUse = thisform.FieldKeyword.options[thisform.FieldKeyword.selectedIndex].text;
var useVal = false;
for (var val in fieldVals) {
if (fieldVals[val] == fieldToUse) {
useVal = true;
} else if (isInteractiveFieldName(fieldVals[val])) {
useVal = false;
} else if (useVal) {
result = result + "<input type=\"radio\" name=\"" + thisform.FieldName.value +"\" value=\"" + fieldVals[val] + "\" label=\""+thisform.FieldLabel.value+"\" errText=\""+thisform.ErrorText.value+"\" class=\"ifradio\">" + fieldVals[val] + "<br />";
}
}
return result;
}
function getInteractiveSelectValue() {
var result = "<select name=\"" + thisform.FieldName.value + "\" label=\""+thisform.FieldLabel.value+"\" errText=\""+thisform.ErrorText.value+"\">"; 
var fieldToUse = thisform.FieldKeyword.options[thisform.FieldKeyword.selectedIndex].text;
var useVal = false;
for (var val in fieldVals) {
if (fieldVals[val] == fieldToUse) {
useVal = true;
} else if (isInteractiveFieldName(fieldVals[val])) {
useVal = false;
} else if (useVal) {
result = result + "<option value=\"" + fieldVals[val] + "\">" + fieldVals[val] + "</option>";
}
}
result = result + "</select>";
return result;
}
function isInteractiveFieldName(testVal) {
for (var fields in fieldNames) {
if (fieldNames[fields] == testVal) {
return true;
}
}
return false;
}
function processInteractiveRemoval() {
var boolRemovalConfirmed = confirm("Are you sure you want to remove this field?")
var RemoveOptions = thisform.RemoveFieldChoice;
var RemoveOption = '';
var FieldHTML = '';
if (RemoveOptions.length === undefined) {
RemoveOption = RemoveOptions.value;
} else {
for (i = 0; i < RemoveOptions.length; i++) {
var ThisOption = RemoveOptions[i].value;
if (RemoveOptions[i].checked) {
RemoveOption = ThisOption;
RemoveOptions[i].checked = boolRemovalConfirmed;
} else {
FieldHTML += "<input type='radio' name='RemoveFieldChoice' value='" + ThisOption + "' onclick='processInteractiveRemoval();'>" + ThisOption + "<br/>"
}
}
}
if (boolRemovalConfirmed) {
if (RemoveOption != '') {
removeInteractiveField(RemoveOption);
}
resetInteractiveRemoveChoice(FieldHTML);
}
}
function rebuildInteractiveFieldList() {
if ($("formcontent")) {
var ctnt = $("formcontent").value;
var fieldsDiv = $("formFields");
var marker = ctnt.indexOf("<tr id=");
var newDiv;
var fieldName;
while (marker > -1) {
marker = marker + 8;
fieldName = ctnt.substring(marker, ctnt.indexOf("\"", marker));
newDiv = document.createElement("div");
newDiv.setAttribute("id", fieldName);
var newSpan = document.createElement("span");
newSpan.appendChild(document.createTextNode(fieldName));
newDiv.appendChild(newSpan);
fieldsDiv.appendChild(newDiv);
marker = ctnt.indexOf("<tr id=", marker);
}
}
}
function removeInteractiveField(label) {
	var ctnt = $("formcontent").value;
	var startLoc = ctnt.indexOf("<tr id=\"" + label);
	var endLoc = ctnt.indexOf("/tr", startLoc) + 4; 
	var result = ctnt.substring(0, startLoc) + ctnt.substring(endLoc, ctnt.length);
	thisform.formcontent.value = result;	
	var fieldValues;
	var fieldList = thisform.FormFieldLabels.value;
	if (fieldList.indexOf(",") > -1) {
		fieldValues = fieldList.split(',');
	} else {
		fieldValues = new Array(fieldList);
	}
	fieldValues.removeValue(label);
	thisform.FormFieldLabels.value = fieldValues.toString();
	var requiredFieldList = thisform.RequiredFields.value;
	if (requiredFieldList.indexOf(",") > -1) {
		fieldValues = requiredFieldList.split(',');
	} else {
		fieldValues = new Array(requiredFieldList );
	}
	fieldValues.removeValue(label);
	thisform.RequiredFields.value = fieldValues.toString();
}
function resetInteractiveRemoveChoice(newHTML) {
var Wrapper = $('RemoveFieldOptions');
var FieldContainer = $('RemoveFieldLabel');
var strFieldList = thisform.FormFieldLabels.value;
if (strFieldList != '') {
FieldContainer.innerHTML = newHTML;
Wrapper.style.display = "block";
} else {
Wrapper.style.display = "none";
}
}
//*********************** end from Interactive subform ************************
function winfull(site) {
    var iWinWidth = screen.availWidth-10;
    var iWinHeight = screen.availHeight-48;
    var iStartX = 0;
    var iStartY = 0;    
    if (iStartX<0) {
		iStartX=0 }
	if (iStartX<0) {
		iStartX=0 }
    var params = "width="+iWinWidth+",height="+iWinHeight+",resizable=no,scrollbars=yes,status=yes,left=" + iStartX + ",top=" + iStartY;
    thewindow=window.open(site,"window1", params);
}
function nw2(site) { 
		 thewindow=window.open(site,"window1","width=691,height=500,resizable=yes,scrollbars=yes,status=yes") 
}
function nwtools2(site) {
	thewindow=window.open(site,"window1","width=691,height=500,resizable=yes,toolbar=yes,scrollbars=yes,location=yes,status=yes") 
}
function Left(strSource, strSearch){
	var pos = strSource.indexOf(strSearch);
	strVal = strSource.slice(0,pos);
	return strVal;
}
function Right(strSource, strSearch){
	var pos = strSource.indexOf(strSearch);
	strVal = strSource.slice(pos+1);
	return strVal;
}
function showHistory (strDID, strType, intCount) {
var strRequestURL = "http://" + g_strServerName + "/" + g_dbFilePath + "/documenthistory?readform";
var strRequestParameters = "hist=" + strType.substr(0, 3).toLowerCase() + "&DID=" + strDID + "&count=" + intCount;
var AJAXObject = new Ajax.Updater(
strType + "HistoryTable",
strRequestURL ,
{
method: "get",
parameters: strRequestParameters,
evalScripts: true
}
);
}

