function surfto(form, objectname, object) { var myindex=object.selectedIndex; if (object.options[myindex].value !="0") { var dbpath = form.dbpath.value; var view = form.view.value; var user = form.user.value; var key = objectname + "=" + object.options[myindex].value URL='/' + dbpath + '/' + view + '?openview&user=' + user + '&' + key location = URL; } } /* From within a view, loads a document in read mode */ function opendoc(uniqueid) { var dbpath = self.document.forms[0].dbpath.value; var view = self.document.forms[0].view.value; var user = self.document.forms[0].user.value; var key = self.document.forms[0].key.value; var URL ='/' + dbpath + '/0/' + uniqueid + '?opendocument&view=' + view + '&user=' + user + '&' + key; location = URL; } function openview(view, key, keyval) { //alert('openview'); var servername = location.host; //alert(servername); var dbpath = top.menu.document.forms[0].dbpath.value; //alert(dbpath); var myindex=top.menu.document.forms[0].contacts.selectedIndex; //alert(myindex); var user = top.menu.document.forms[0].contacts.options[myindex].value; //alert(user); var nURLParam = ''; if (key != '') { nURLParam = '&' + key + '=' + keyval; } nURL = 'http://' + servername + '/' + dbpath + '/' + view + '?openview&user=' + user + nURLParam; window.parent.content.location=nURL; } /*doSearch is called from the button below simple query box on all forms */ function doSearch ( s ) { var regExp1 = /\bfield\b/i; //used to test for reserved word field in query string var regExp2 = /[(,),<,>,\[,\]]/; //used to test for reserved char(s) in the query string var str = s.value; if ( str == "" ){ alert("Please be sure to enter something to search for."); s.focus(); return false; } else { if ( typeof regExp1.source != 'undefined' ) //supports regular expression testing if ( regExp1.test( str ) || regExp2.test( str ) ){ var alrt = "Please note that you can not include:"; alrt += "\n\nThe reserved word 'field'\nthe characters [, ], (, ), < or >"; alrt += "\n\nin your search query!\n\nIf you are confident that you know"; alrt += "\nwhat you are doing, then you can\nmanually produce the URL required." alert( alrt ); s.focus(); return false; } document.location = "/A55692/store.nsf/srch?SearchView&Query=" + escape( str ) + "&start=1&count=10"; } } /*open search results and append the search term in the URL..*/ function openAndHighlight( docID ) { appTerm = document.forms[0].SearchTerm.value; document.location = "/A55692/store.nsf/all/" + docID + "?OpenDocument&Highlight=0," + escape( appTerm ); } //Remove leading and trailing spaces from a string //Originally written by Jim Fricker function trim(aStr) { return aStr.replace(/^\s{1,}/, "").replace(/\s{1,}$/, "") } /* getPathName. Required due to Opera bug where location.pathname returns location.search as well. */ function getPathName(){ var pth = location.pathname.split('?'); return pth[0]; } /* NavigateView cycles through a view using the start and count paramaters of the ?OpenView method. */ /* Required as @Commands do not work with single category views on the web !! */ /* Arguments: d = direction, either "prev" or "next" n = incremental count number */ function navigateView (d, n) { var c = 0; var args = location.search.split('&'); var news = new Array(); var ii = 0; for (var i = 0; i < args.length; i ++) { if ( args[i].toLowerCase().indexOf('start=') != -1){ c = parseInt(args[i].split('=')[1]); } else { news[ii] = args[i]; ii ++; } } var strt = getPathName(); if (args[0] == ''){ location.href = strt + '?OpenView&start=' + n; } else if (c == 0 && d == 'next'){ location.href += '&start=' + n; } else if (c == 0 && d == 'prev'){ return alert('Ingen flere dokumenter...'); } else if (c <= n && d == 'prev'){ location.href = strt + news.join('&'); } else if (d == 'next'){ location.href = strt + news.join('&') + '&start=' + ( c + n ); } else if (d == 'prev'){ location.href = strt + news.join('&') + '&start=' + ( c - n); } } /* Opens specified form in edit mode */ function compose (formname) { var servername = location.host; var dbpath = document.forms[0].dbpath.value; var view = document.forms[0].view.value; var user = document.forms[0].user.value; var key = document.forms[0].key.value; nURL = 'http://'+servername+'/'+dbpath+'/' + formname + '?openform&view=' + view + '&user=' + user + '&' + key; window.parent.content.location=nURL; }