var cookieDomain    = ".waagstein.se";
var serverHost      = "www";
var homePage        = "default.asp";
var urlPage         = "http://" + serverHost + cookieDomain;
var cookieName      = "cookieTest";
var cookieData      = "cookieTest";
var flashLocation   = "";

function SetCookie (name,value,expires,path,domain,secure) {
  document.cookie = name + "=" + value + ((expires) ? ";expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") +((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
}

// function setQuickSearchCookie(keywords)

// Description: This function will set a keywords cookie, called when a user submits a quick search
// from any static page, in html docroot, or a domino page.
// testSearchForm.jsp - must be modified to use the keywords in this cookie, if available, and expire it
// after use.

function setQuickSearchCookie(keywords, searchcollection)
{	

// Only set if user does not have a BV_IDS session cookie.  If already have a session, no need.

	var cookies = document.cookie;
	var pos = cookies.indexOf("BV_IDS=");
	if ( pos == -1 )
	{
		// Set keywords cookie.  The testSearchForm.jsp page will check for this cookie and expire it after
		// use.
		document.cookie = "quickSearch=" + keywords + "||" + searchcollection +
						";path=/;domain=metagroup.com";

	}
} 
// End function setQuickSearchCookie().
// netIqSessionCookie() sets phony session cookie -- this cookie is then logged by the Web server
// and is used by reporting packages (like NetIQ) to track "sessions" in a stateless environment

function netIqSessionCookie() {
        if (document.cookie.indexOf('netIqSession') < 0) {
	        var expdate = new Date ();
                expdate.setTime (expdate.getTime() + (30 * 24 * 60 * 1000));
		 // 1 month from now
                SetCookie("netIqSession",genSessionId(),expdate,"/",cookieDomain);
	}
}

// genSessionId() generates a phony session id from a string of letters and numbers, and is
// probably only ever called from within the netIqSessionCookie() function

function genSessionId() {

	str = "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	fakeSessionId = "";
	for (x = 0; x < 20; x++) {
		fakeSessionId += str.charAt(Math.floor( Math.random() * str.length - 1 ));
	}
	return fakeSessionId;
}

// check -- and if missing, set -- a netIqSessionCookie from EVERY page on our site
netIqSessionCookie();
// ---------------------------------------------------------------------------------------------
// Function: fileNumberCheck().
// If the keywords match a file number pattern, XXX|XX IIII, then set keywords to the value, and
// set the searchType = FileNumber.
// ---------------------------------------------------------------------------------------------

function fileNumberCheck( form ) {
	var string = form.keywords.value;
	var regexp = /^([a-zA-Z]{2,3})?[\s]*([0-9]{3,4})$/;
	var result = string.match(regexp);
	if ( result != null ) {
		// alert("file number: " + result[2]);
		form.searchType.value = "FileNumber";
		form.keywords.value = result[2];
	}
	return true;
}
<!--
	// The bulk of this script is taken from the website mentioned
	// Courtesy of SimplytheBest.net (http://simplythebest.net/info/dhtml_scripts.html)
	
	window.onerror = null;
	var NS4 = (document.layers);
	var IE4 = (document.all && !document.getElementById);
	var IE5 = (document.all && document.getElementById);
	var NS6 = (!document.all && document.getElementById);
	var menuActive = 0;
	var menuOn = 0;
	var onLayer
	var timeOn = null; 
	// LAYER SWITCHING CODE

	if ( NS4) {
		layerStyleRef="layer.";
		layerRef="document.layers";
		styleSwitch="";
	}

	// SHOW MENU

	function showLayer(id){

		if (NS4 || IE4 || IE5 || NS6) {
			if (timeOn != null) {
				clearTimeout(timeOn)
				hideLayer(onLayer)
			}
	 	if(NS4){
			document.layers[id].visibility = "show";
		}
	
		// Explorer 4
	
		else if(IE4){

			document.all[id].style.visibility = "visible";
		}
	
		// W3C - Explorer 5+ and Netscape 6+

		else if(IE5 || NS6){

			document.getElementById(id).style.visibility = "visible";
		}

		onLayer = id
	 	
		}
	}

	// HIDE MENU

	function hideLayer(id){

		if (menuActive == 0) {
			if(NS4){
				document.layers[id].visibility = "hide";
			}
	
			// Explorer 4
	
			else if(IE4){
				document.all[id].style.visibility = "hidden";
			}
	
			// W3C - Explorer 5+ and Netscape 6+

			else if(IE5 || NS6){
				document.getElementById(id).style.visibility = "hidden";
			}
		}	
	}
	
	// TIMER FOR BUTTON MOUSE OUT

	function btnTimer() {

		 timeOn = setTimeout("btnOut()",1000)
	}

	// BUTTON MOUSE OUT

	function btnOut(id) {
		if (menuActive == 0) {
			hideLayer(onLayer)
		}
	}

	// MENU MOUSE OVER 
	
	function menuOver(id) {
		clearTimeout(timeOn)
		menuActive = 1
	}

	// MENU MOUSE OUT 

	function menuOut(itemName) {
		menuActive = 0 
		timeOn = setTimeout("hideLayer(onLayer)", 3000)
	}

	// HIGHLIGHT IMAGES

	if (document.images){
		var imglist = new Array ("images/about_o.gif","images/research_o.gif","images/benchmark_o.gif","images/benchmark_o.gif","images/consulting_o.gif","images/consulting_o.gif");
		var imgs = new Array();
		var count;
		for (count=0; count<imglist.length; count++){
			imgs[count]=new Image();
			imgs[count].src=imglist[count];
		}
	}

	function hilite(name,m){
		if (document.images){
			imgswap(name, imgs[m])
		}
	}

	function imgswap(i1,i2){
		if (document.images){
			var temp = i1.src; i1.src=i2.src;
			i2.src=temp;
		}
	}
	
	// -->
