// branchelink.js © Copyright of Teamsoft 1998-2003. All rights Reserved. function newWin(url) { var dir = "/Branche.nsf/"; if (window.location.hostname == "localhost") dir = "/Branchelink" + dir; var win = window.open(dir + "redir?OpenPage&url=" + url, "External"); win.focus(); } // end function newWin function searchOrgs(str) { var dir = "/Hotel/Branche/"; if (window.location.hostname == "localhost") dir = "/Branchelink/"; var newstr = str; while (newstr != "" && newstr.charAt(0) == " ") newstr = newstr.substr(1); while (newstr != "" && newstr.charAt(newstr.length - 1) == " ") newstr = newstr.substr(0, newstr.length - 1); if (newstr == "") window.alert("Du skal indtaste et søgeord i søgefeltet"); else if (newstr.toLowerCase() == "semaphor") location = dir + "Orgs.nsf/AllPublished?SearchView&Query=field+firmanavn+contains+" + newstr; else { var from = new Array("+", ",", " ", " ", "&", "/", "Æ", "æ", "Ø", "ø", "Å", "å", "Ä", "Ö", "ä"); var to = new Array("%2B", " ", " ", "+and+", '"%26"', "%2F", "%C6", "%E6", "%D8", "%F8", "%C5", "%E5", "%C4", "%D6", "%E6"); for (var i = 0; i < 15; i++) do { var j = newstr.indexOf(from[i]); if (j < 0) break; newstr = newstr.substring(0, j) + to[i] + newstr.substring(j + from[i].length); } while (true) var newloc = dir + "Orgs.nsf/AllPublished?SearchView&SearchOrder=4&Count=5000&Query=" + newstr; if (newstr.length >= 4) newloc = newloc + "*"; open(newloc, "_top"); } // end if } // end searchOrgs function subscribe(field) { var mailAddr = field.value; var userDomain = mailAddr.split("@"); if (userDomain.length==2 && userDomain[0].search(/[^A-Za-z0-9_.]/)) { var companyCountry = userDomain[1].split("."); if (companyCountry.length>1 && userDomain[1].search(/[^A-Za-z0-9_.]/)) { var dir = "/hotel/branche/"; if (location.hostname == "localhost") dir = "/branchelink/"; location = dir + "newssub.nsf/Subscribe?OpenAgent&mail=" + mailAddr; return true; } // end if } // end if alert('"' + mailAddr + '" er ikke en lovlig e-mail adresse'); field.focus(); } // end subscribe function checkSearchSubmit() { // Submit search if Enter key pressed // Only working correctly for IE. Do nothing for NS... if (document.all) { if ( event.keyCode=="13" ) { searchOrgs(document.main.search.value); } } } // end checkSearchSubmit