function popup(u,w,h,s,extra) {
  if (extra) { extra = ","+extra; } else { extra = ""; }
  var popup = window.open(u,'popup','toolbar=no,location=no,directories=no,status=no,scrollbars=' + s + ',menubar=no,titlebar=no,width=' + w + ',height=' + h + extra);
  popup.focus();
}

// NB! styleswitchter.js depends on createCookie() and readCookie()

function createCookie(name,value,days,path) {
  if (!path) { path = ""; }
  var expires = "";
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    expires = "; expires="+date.toGMTString();
  }
  document.cookie = name+"="+value+expires+"; domain=.sfk.is; path="+path;
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}


function OpenCertDetails() {
   var thewindow = window.open('https://www.thawte.com/cgi/server/certdetails.exe?code=ISARVA2', 'anew', config='height=400,width=450,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,directories=no,status=yes');
}

// Emulate :hover pseudoclass for <li> and <tr> in IE
function regHover (idName, tagName) {
  if (document.all && document.getElementById && navigator.appVersion.indexOf("Win") != -1) {
	navRoot = document.getElementById(idName);
	for (i=0; i<navRoot.childNodes.length; i++) {
	  node = navRoot.childNodes[i];
	  if (node.nodeName==tagName) {
		node.onmouseover = function() { this.className += " ie-hover"; };
		node.onmouseout  = function() { this.className=this.className.replace(" ie-hover", ""); };
	  }
	  // IE6 tacitly interpolates tbody between table and tr...
	  else if (node.nodeName=="TBODY") {
		subNodes = node.childNodes;
		for (j=0; j<subNodes.length; j++) {
		  cnode = subNodes[j];
		  if (cnode.nodeName==tagName) {
			cnode.onmouseover = function() { this.className += " ie-hover"; };
			cnode.onmouseout  = function() { this.className=this.className.replace(" ie-hover", ""); };
		  }
		}
	  }
	}
  }
}

// Mark active URL in a linkbox
function markActive (idName) {
  var here = window.location;
  if (document.getElementById) {
    navRoot = document.getElementById(idName);
    for (i=0; i<navRoot.childNodes.length; i++) {
      node = navRoot.childNodes[i];
      if (node.nodeName=="LI" && node.childNodes[0].nodeName=="A" && node.childNodes[0].href==document.URL) {
	    node.className += " highlight";
      }
    }
  }
}

// "DHTML MicroAPI" building block from quirksmode.org.
// Returns an object representing a named element in HTML. 
// Properties of the object: obj and style.
// Usage : var x = new getObj(id);

function getObj(name) {
  if (document.getElementById) {
  	this.obj = document.getElementById(name);
	if (this.obj) {
		this.style = document.getElementById(name).style;
    }
  }
  else if (document.all) {
	this.obj = document.all[name];
	if (this.obj) {
	    this.style = document.all[name].style;
    }
  }
  else if (document.layers) {
   	this.obj = document.layers[name];
	if (this.obj) {
   	    this.style = document.layers[name];
    }
  }
}

// Submit form upon enter. 
function entsub(myform) {
	if (window.event && window.event.keyCode == 13) {
		myform.submit();
	} else {
		return true;
	}
}

// Burst out of (most) old framesets, keeping the bottom part and discarding the top frame
// NB! Does not work in Safari!
var is_frameless = (top == self);
if (!is_frameless 
    && (self.name == "main" || self.name == "body" || self.name == "textinn" || self.name == "texti")) { 
  top.location.href = self.location.href;
}