// login functionsfunction DoLogin() {	str = top.location.href;	str = str.split(".nsf")[1];	if( ((str.indexOf('?')>1) || (str.indexOf('?')>1)) && (str.indexOf('Login')<1)) {		top.location.href = top.location.href + '&Login';	} else {		str = str.substring(1,str.length);		pos = str.indexOf('/');		if (pos>1) {			top.location.href = top.location.href + '?OpenDocument&Login';		} else {			top.location.href = top.location.href + '?OpenView&Login';		}	}}// row color alternationvar rownumber=1;function altrow() {	if (rownumber==1){		rownumber=2;		document.write('<tr class="r1">');	} else {		rownumber=1;		document.write('<tr class="r2">');	}}// mouseover effectfunction hiOff(o){	str = o.className;	pos = str.indexOf('hilite');	if (pos>0){		o.className = str.substring(0,pos);	}}function hiOn(o){	str = o.className;	pos = str.indexOf('hilite');	if (pos<=0){		o.className = o.className + 'hilite';	}}// search related functionsfunction getElement(id) { return document.getElementById ? document.getElementById(id) : document.all ? document.all(id) : null; } function show(id) { 	var el = getElement(id); 	if (el && el.style) el.style.display = ''; } function hide(id) { 	var el = getElement(id); 	if (el && el.style) el.style.display = 'none'; } function toggleSearch(tog){	if(tog){		hide('searchSimple');		show('searchAdvanced');	} else {		hide('searchAdvanced');		show('searchSimple');	}	//document.forms.dbsearch.Query.focus();}//Code Ratingfunction hasRating(){	var field = document.forms.ratebox.rate; 	var hasSelection = false;	for(var i=0;i<field.length;i++) {	   if (field[i].checked) {		hasSelection = true;	   }	}	if (hasSelection){		return true;	} else {		return false;	}}// Cookies !!function setCookie (Name, cookieValue){	var expdate = new Date();	expdate.setTime(expdate.getTime() + 1000*60*60*24*365);	document.cookie = Name + "=" + escape(cookieValue) + ";expires=" + expdate.toGMTString() + ";path=/";}function getCookie(Name){	var search = Name + "=";	if (document.cookie.length > 0) {  // Are there are any cookies available		offset = document.cookie.indexOf(search)		if (offset != -1) {			offset += search.length			end = document.cookie.indexOf(";", offset)			if (end == -1) {				end = document.cookie.length;				}			return unescape(document.cookie.substring(offset, end))		} else {			return null;		}		}	else return null;}//Generic Functionsfunction trim(inputString) { 	var interimString='';	var lastCharSpace=true;	var i;	for(i=0;i<inputString.length;i++) {		if(inputString.charAt(i)==" ") {			if(lastCharSpace==false) {				interimString=interimString+inputString.charAt(i); 			}			lastCharSpace=true; 		} else {			interimString=interimString+inputString.charAt(i); 			lastCharSpace=false; 		}	}	if(interimString.charAt(interimString.length-1)==" ") {		interimString=interimString.substring(0,interimString.length-1);	}	return interimString;} function ListValue(field)  // returns value of listbox{	var result = '';	if (!(field.selectedIndex == null)) {		if (field.selectedIndex > -1) 		{			result = field.options[field.selectedIndex].value;		if (result == "")  result = field.options[field.selectedIndex].text;		}	}	return result;}function tabber(ta) {//var key = (evt.which) ? evt.which : event.keyCode;var key;//     if (event.keyCode==9) {     if (key==9) {          ta.value=ta.value + '    ';          event.returnValue=false;          ta.focus();     }}// Validation Routinesfunction validateDoc() {	var doc = document.forms[0];	//validate description	if (trim(doc.Subject.value) == "") {		alert('Title is a required field.');		doc.Subject.focus();				return false;	}		//validate contributor	if (trim(doc.Contributor.value) == "") {		alert('Contributor is a required field.');		doc.Contributor.focus();				return false;	}	//validate author	if (trim(doc.Author.value) == "") {		alert('Author is a required field.');		doc.Author.focus();				return false;	}	//validate category	if (trim(ListValue(doc.Category)) == "") {		alert('Category is a required field.');		doc.Category.focus();		return false;	}		//validate type	if (trim(ListValue(doc.Type)) == "") {		alert('Type is a required field.');		doc.Type.focus();		return false;	}	//validate download url	if (trim(doc.DownloadURL.value) == "") {		alert('Download URL is a required field.');		doc.DownloadURL.focus();				return false;	}	return true;}function validateCodeDoc() {	var doc = document.forms._SourceCode2;	//validate description	if (trim(doc.Subject.value) == "") {		alert('Description is a required field.');		doc.Subject.focus();				return false;	}		//validate contributor	if (trim(doc.Contributor.value) == "") {		alert('Contributor is a required field.');		doc.Contributor.focus();				return false;	}	//validate category	if (trim(ListValue(doc.CodeCategory)) == "") {		alert('Category is a required field.');		doc.CodeCategory.focus();		return false;	}		//validate type	if (trim(ListValue(doc.CodeType)) == "") {		alert('Type is a required field.');		doc.CodeType.focus();		return false;	}			return true;}function validateComment() {	var doc = document.forms.comment;	//validate subject	if (trim(doc.Subject.value) == "") {		alert('Subject is a required field.');		doc.Subject.focus();				return false;	}		//validate comment	if (trim(doc.BodyR.value) == "") {		alert('Comment is a required field.');		doc.BodyR.focus();				return false;	}	return true;}// DHTML Menu Functionsvar rimPath = '/notesoss.nsf/webcontent/dmbmenu/$file/';	var rjsPath = '/notesoss.nsf/webcontent/dmbmenu/$file/';	var rPath2Root = 'http://www.openntf.org';		function InitRelCode() {		var iImg;		var jImg;		var tObj;				if(!document.layers) {			iImg = document.images['DMBImgFiles'];			jImg = document.images['DMBJSCode'];			tObj = jImg;		} else {			tObj = document.layers['DMBRI'];			if(tObj) {				iImg = tObj.document.images['DMBImgFiles'];				jImg = tObj.document.images['DMBJSCode'];			}		}		if(!tObj) {//			window.setTimeout("InitRelCode()", 1500);			window.setTimeout("InitRelCode()", 500);			return false;		}				rimPath = _gp(iImg.src);		rjsPath = _gp(jImg.src);		rPath2Root = rjsPath + "";				return true;	}		function _purl(u) {		return xrep(xrep(u, "%%REP%%", rPath2Root), "\\", "/");	}		function _fip(img) {		if(img.src.indexOf("%%REL%%")!=-1)			img.src = rimPath + img.src.split("%%REL%%")[1];		return img.src;	}		function _gp(p) {		return p.substr(0,p.lastIndexOf("/")+1);	}		function FixImages() {		var h = null;			if(typeof(hStyle)!="undefined") h = hStyle;		if(typeof(hS)!="undefined") h = hS;		if(h)			for(var i=0; i<h.length; i++)				h[i] = xrep(h[i], "%%REL%%", rimPath);	}		function xrep(s, f, n) {		return s.split(f).join(n);	}
