var view = 'docs'; // viewname to documents
var tabelStart = '
\r';
var cookieReturnName = 'Zonen_Return';
var cookieNameName = 'Zonen_Name';
var cookieEmailName = 'Zonen_Email';
var cookieDomain = '';
var cookiePath = '/';
var IE4 = (document.all);
// Decide which array item to use as link
function decideLink(ownDocId, specialLink) {
if(specialLink == '') { // if url link is same as document
return ownDocId;
}
else { // document has special url in docs third array item
return specialLink;
}
}
// Validate and build URL
function generateUrl(urlOrDoc) {
if(urlOrDoc.indexOf('://') != -1 || urlOrDoc.indexOf('/') == 0) { // urlOrDoc either contains :// or starts with /, is therefore proper URL
return urlOrDoc;
} // urlOrDoc is doc
return graphicPath + view + '/' + urlOrDoc;
}
// Check if given DocId is this documents
function isThisDoc(doc) {
if(doc == currentDocId) {
return true;
}
return false;
}
// Build Primary Menu for all pages
function buildPrimeMenu () {
var itemFieldsCount = 5; // number of array items per doc
var link = '';
var beforeLink = '';
var beforeLinkFront = ' | \r | ';
var thirdMenuMiddle = ' |
\r | \r \r | \r
\r |
\r |
';
var link ='';
var beforeLink = '';
var beforeLinkNotActive = ' \r | \r = itemFieldsCount) || contextMenuItems.length >= 2 * itemFieldsCount;
var weCanRunBool = (contextMenuItems.length >= itemFieldsCount && contextMenuItems[0] != currentDocId) || contextMenuItems.length >= 2 * itemFieldsCount;
// alert('type = ' + type);
// alert('weCanRunBool = ' + weCanRunBool);
// alert('linksShown = ' + linksShown);
// alert('showCount = ' + showCount);
// alert('Antal elementer = ' + contextMenuItems.length);
if(weCanRunBool) { // if array contextMenuItems seems to contain proper and enough data then GO
document.write(contextMenuPre);
for (var k=0; k < contextMenuItems.length && linksShown < showCount; k+=itemFieldsCount) {
if (! isThisDoc(contextMenuItems[k])) {
document.write(beforeLink + generateUrl(contextMenuItems[k]) + beforeLinkResume + contextMenuItems[k+2] + beforeLinkText + contextMenuItems[k+1] + afterLinkText);
linksShown+=1;
}
}
document.write(contextMenuPost);
}
}
// Remember return URL when submitting forms
function setReturnURL(url) {
var expSeconds = 60;
saveCookie(document, cookieReturnName, url, expSeconds, cookieDomain, cookiePath);
}
// Remember users name when submitting forms eg. in discussion
function setName(name) {
var expSeconds = 60*60*24*365*2;
saveCookie(document, cookieNameName, escape(name), expSeconds, cookieDomain, cookiePath);
}
// Remember users email when submitting forms eg. in tip
function setEmail(email) {
var expSeconds = 60*60*24*365*2;
saveCookie(document, cookieEmailName, email, expSeconds, cookieDomain, cookiePath);
}
// Open URL in Front1 window
function openPopUp(windowURL) {
var windowName = 'Front1';
var windowFeatures = 'width=402,height=402,toolbar=0,location=0,left=150,top=10,directories=0,status=0,menuBar=0,scrollbars=1,resizable=0';
popUpWin = window.open(windowURL, windowName, windowFeatures);
}
// Open URL in Front2 window
function openPopUpPict(windowURL) {
var windowName = 'Front2';
var windowFeatures = 'width=560,height=435,toolbar=0,location=0,left=172,top=50,directories=0,status=0,menuBar=0,scrollbars=1,resizable=0';
popUpWin = window.open(windowURL, windowName, windowFeatures);
}
// Open URL in Front3 window
function openPopUpArt(windowURL) {
var windowName = 'Front3';
var windowFeatures = 'width=740,height=500,toolbar=0,location=0,left=10,top=10,directories=0,status=0,menuBar=0,scrollbars=1,resizable=1';
popUpWin = window.open(windowURL, windowName, windowFeatures);
}
// Open URL in Front4 window
function openPopUpFull(windowURL) {
var windowName = 'Front4';
var windowFeatures = 'fullscreen,left=10,top=10,scrollbars=1';
popUpWin = window.open(windowURL, windowName, windowFeatures);
}
// Close browser window
function done() {
window.close()
}
function checkSubmitSearchAll(v)
{
// Submit if Enter key pressed
// if (IE4)
if (true)
{
if ( event.keyCode=="13" )
{
doSearchAll(document.search.Search.value,true);
}
}
}
function GLcheckSubmitSearchAll()
{
// Submit if Enter key pressed
// Only working correctly for IE. Do nothing for NS...
if (IE4)
{
if ( event.keyCode=="13" )
{
doSearchAll(document.all.Search.value);
}
else
{
searchStringAll = this.value;
alert(searchStringAll);
}
}
}
function doSearchAll(v,t) {
if(t) {
var searchURL = trimSearchValue(v);
server = location.hostname;
if(searchURL == '' || searchURL == '\*') {
alert('Indtast venligst et eller flere søgeord eventuelt efterfulgt af \*.');
document.search.Search.focus();
}
else {
document.location.href = 'http://' + server + '/hotel/zonen/search.nsf/Search?OpenAgent&*^' + searchURL + '%1%10~1';
}
return false;
}
}
function trimSearchValue(s) {
s = s.replace(/æ/g, '|ae')
s = s.replace(/Æ/g, '|AE')
s = s.replace(/ø/g, '|oe')
s = s.replace(/Ø/g, '|OE')
s = s.replace(/å/g, '|aa')
s = s.replace(/Å/g, '|AA')
s = s.replace(/\s\s/g, ' ')
s = s.replace(/\sand\s/gi, '&')
s = s.replace(/\s\+\s/g, '&')
s = s.replace(/\s\+/g, '&')
s = s.replace(/\s/g, '&')
s = s.replace(/&&&/g, '&')
return s.replace(/\+/g, '&')
}
|