// ---
/*
	ELO - Encapsulated Load Object, by Robert Nyman, http://www.robertnyman.com
	Inspired and influenced by Dean Edwards, Matthias Miller, and John Resig: http://dean.edwards.name/weblog/2006/06/again/
*/
var ELO = {
	loaded : false,
	timer : null,
	functionsToCallOnload : [], // Type in functions as strings here. e.g. "myFunction()"
	init : function (){
		if(ELO.loaded) return;
		ELO.loaded = true;
		ELO.load();
	},
	
	load : function (){
		if(this.timer){
			clearInterval(this.timer);
		}
		for(var i=0; i<this.functionsToCallOnload.length; i++){
			try{
				eval(this.functionsToCallOnload[i]);
			}
			catch(e){
				// Handle error here
			}
		}
	}
};
// ---
/* Internet Explorer */
/*@cc_on @*/
/*@if (@_win32)
	if(document.getElementById){
		document.write("<script id=\"ieScriptLoad\" defer src=\"//:\"><\/script>");
	    document.getElementById("ieScriptLoad").onreadystatechange = function() {
	        if (this.readyState == "complete") {
	            ELO.init();
	        }
	    };
	}
/*@end @*/
// ---
/* Mozilla/Opera 9 */
if (document.addEventListener) {
	document.addEventListener("DOMContentLoaded", ELO.init, false);
}
// ---
/* Safari */
if(navigator.userAgent.search(/WebKit/i) != -1){
    ELO.timer = setInterval(function (){
		if(document.readyState.search(/loaded|complete/i) != -1) {
			ELO.init();
		}
	}, 10);
}
// ---
/* Other web browsers */
window.onload = ELO.init;
// ---

function $(o) {
  if (typeof(o) == "string")
    return document.getElementById(o)
    else
    return o;
};
sfHover = function() {
  var sfEls = document.getElementById("nav").getElementsByTagName("LI");
  for (var i=0; i<sfEls.length; i++) {
    sfEls[i].onmouseover=function() {
      this.className+=" sfhover";
    }
    sfEls[i].onmouseout=function() {
      this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
    }
  }
}
if (window.attachEvent){
  ELO.functionsToCallOnload.push("sfHover()");
}

function externalLinks() {
  if (!document.getElementsByTagName) return;
  var anchors = document.getElementsByTagName("a");
  for (var i=0; i<anchors.length; i++) {
    var anchor = anchors[i];
    if (anchor.getAttribute("href") &&
      anchor.getAttribute("rel") == "external")
      anchor.target = "_blank";
    }
}
ELO.functionsToCallOnload.push("externalLinks()");

function rmClearkp (thefield){
  if (thefield.value=="ditt navn...")
  thefield.value = "";
  }

function rmCleartlf (thefield){
  if (thefield.value=="telefonnummer...")
  thefield.value = "";
  }

function ringmegValidate(thefield){
  if (thefield.rmkp.value=="ditt navn..."){
    alert("Du har glemt å skrive inn ditt navn.\nVi vil gjerne vite hvem vi skal henvende oss til.");
    thefield.rmkp.focus();
    return false;
  }
  if (!thefield.rmkp.value){
    alert("Du har glemt å skrive inn ditt navn.\nVi vil gjerne vite hvem vi skal henvende oss til.");
    thefield.rmkp.focus();
    return false;
  }
  if (thefield.rmtlf.value=="telefonnummer..."){
    alert("Du har glemt å skrive ditt telefonnummer,\nvennligst oppgi dette slik at vi kan ta kontakt med deg.");
    thefield.rmtlf.focus();
    return false;
  }
  var temp = ForceNumber(thefield.rmtlf.value);
  thefield.rmtlf.value = temp;
  if((thefield.rmtlf.value.length<9)&&(thefield.rmtlf.value.length>7)){
  } else {
    alert("Du har en feil i ditt telefonnummer,\nvennligst sjekk dette før du prøver på nytt.");
    thefield.rmtlf.focus();
    return false;
  }
  sw_zoomURL("/script/RingMeg/?kp="+thefield.rmkp.value+"&tlf="+thefield.rmtlf.value,300,200,0);
  return false;
}
function sw_zoomURL(url,Xvalue,Yvalue,scroll) {
  var w = 480, h = 340;
  if (document.all || document.layers) {
    w = screen.availWidth;
    h = screen.availHeight;
  }
  var popW = Xvalue, popH = Yvalue;
  var leftPos = (w-popW)/2, topPos = (h-popH)/2;
  if (scroll) {
    i = open(url, "displayWindow2","top="+topPos+",left="+leftPos+",width="+Xvalue+",height="+Yvalue+",status=no,toolbar=no,menubar=no,resize=no,dependent=yes,scrollbars=yes");
  } else {
    i = open(url, "displayWindow2","top="+topPos+",left="+leftPos+",width="+Xvalue+",height="+Yvalue+",status=no,toolbar=no,menubar=no,resize=no,dependent=yes,scrollbars=no");
  }
}

/* - - - - */

function yb(el,cl){
  el.className = cl;
}

/* Zebra stripes */

  // this function is needed to work around 
  // a bug in IE related to element attributes
  function hasClass(obj) {
     var result = false;
     if (obj.getAttributeNode("class") != null) {
         result = obj.getAttributeNode("class").value;
     }
     return result;
  }   

 function stripe(id) {

    // the flag we'll use to keep track of 
    // whether the current row is odd or even
    var even = false;
  
    // if arguments are provided to specify the colours
    // of the even & odd rows, then use the them;
    // otherwise use the following defaults:
    var evenColor = arguments[1] ? arguments[1] : "#fff";
    var oddColor = arguments[2] ? arguments[2] : "#eee";
  
    // obtain a reference to the desired table
    // if no such table exists, abort
    var table = document.getElementById(id);
    if (! table) { return; }
    
    // by definition, tables can have more than one tbody
    // element, so we'll have to get the list of child
    // &lt;tbody&gt;s 
    var tbodies = table.getElementsByTagName("tbody");

    // and iterate through them...
    for (var h = 0; h < tbodies.length; h++) {
    
     // find all the &lt;tr&gt; elements... 
      var trs = tbodies[h].getElementsByTagName("tr");
      
      // ... and iterate through them
      for (var i = 0; i < trs.length; i++) {

        // avoid rows that have a class attribute
        // or backgroundColor style
        if (! hasClass(trs[i]) &&
            ! trs[i].style.backgroundColor) {
 		  
          // get all the cells in this row...
          var tds = trs[i].getElementsByTagName("td");
        
          // and iterate through them...
          for (var j = 0; j < tds.length; j++) {
        
            var mytd = tds[j];

            // avoid cells that have a class attribute
            // or backgroundColor style
            if (! hasClass(mytd) &&
                ! mytd.style.backgroundColor) {
        
              mytd.style.backgroundColor =
                even ? evenColor : oddColor;
            
            }
          }
        }
        // flip from odd to even, or vice-versa
        even =  ! even;
      }
    }
  }
  
/********************************************************************************************************
*    				Script : sw_zoom v1.2.1 enhanced					*
*				      Author : Kim Steinhaug          					*
*    				    Url    : www.steinhaug.com						*
*    				  (c) Steinhaug Webdesign 2002						*
*  --   --   --   --   --   --   --   --   --   --   --   --   --   --   --   --   --   --   --   --	*
*       THIS SCRIPT IS FREE TO USE ASLONG AS THIS COPYRIGHT IS INTACT AND NOT TAMPERED WITH!		*
*  --   --   --   --   --   --   --   --   --   --   --   --   --   --   --   --   --   --   --   --	*
* Usage :												*
* sw_zoom(copyright,cop2,title,header,alt,url,Xvalue,Yvalue,scroll,loading,topImage,special)		*
*													*
* Parameter info :											*
* copyright = '(c) Steinhaug Webdesign - www.steinhaug.com'	 <-- MUST BE LIKE THIS!			*
* cop2      = copyright text at bottom of page								*
* title     = title of webpage opened, up left corner status						*
* header    = header text on the accual popped page							*
* alt       = alt text for the image,									*
*             0 inherits the 'title' parameter								*
* url       = the path for the image to be inserted							*
* Xvalue    = the x value for the window, should be equal to the image width				*
* Yvalue    = the y value for the window, should be equal to the image height				*
* scroll    = 0 for no scrollbar, and 1 for scrollbar							*
* loading   = 0 eq off,											*
*             1 inserts "please wait while loading" status...						*
* topImage  = 0 											*
* special   = path to second image, below the first image 						*
*													*
* --> You might be wondering what the topImage feature is :						*
* topImage  = enhanced feature, specifies top and bottom image which is					*
*             parsed with the other parameters. Should not be used!					*
********************************************************************************************************/
function sw_zoom(copyright,cop2,title,header,alt,url,Xvalue,Yvalue,scroll,loading,topImage,special) {
if (copyright != '(c) Steinhaug Webdesign - www.steinhaug.com') {
var title = "(c) Steinhaugs Webdesign";
var header = "Popup script by Steinhaug Webdesign";
var alt = "Script created by Steinhaug Webdesign";
}

var breaker = "";
if(special=='break'){ breaker="<br>"; special=0; Yvalue = Yvalue+40;}

var w = 480, h = 340; if (alt==0){ alt = title;}
if (document.all || document.layers) {
w = screen.availWidth;
h = screen.availHeight;
}
if (topImage){ Yvalue = Yvalue+48; }
var popW = Xvalue, popH = Yvalue;
var leftPos = (w-popW)/2, topPos = (h-popH)/2;

if (scroll) {
 i = open("", "displayWindow2","top="+topPos+",left="+leftPos+",width="+Xvalue+",height="+Yvalue+",status=no,toolbar=no,menubar=no,resize=no,dependent=yes,scrollbars=yes");
}
else {
 i = open("", "displayWindow2","top="+topPos+",left="+leftPos+",width="+Xvalue+",height="+Yvalue+",status=no,toolbar=no,menubar=no,resize=no,dependent=yes,scrollbars=no");
}
 i.focus();
 i.document.open();
 i.document.write('<html>\n');
 i.document.write('<head>\n');
 i.document.write('<title>',title,'</title>\n');
 i.document.write('<\head>\n');
 i.document.write('<body bgcolor="#ffffff" text="#000000" TOPMARGIN=0 LEFTMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>\n');
if (topImage){
i.document.write('<img src="/images/info_topp_',Xvalue,topImage,'.gif" height=25 width=',Xvalue,'><br>');
}
if (header) {
i.document.write('<center>\n<font size="4" face="verdana"><b>',header,'</b></font><br>');
}
i.document.write(breaker,'<center><a href="javascript:window.close();"><img src="',url,'" border="0" alt="',alt,'"></a></center>',breaker);
if (special) { i.document.write('<a href="javascript:window.close();"><img src="',special,'" border="0" alt="',alt,'"></a><br>'); }
if (topImage){ i.document.write('<a href="javascript:window.close();"><img src="/images/info_bunn_',Xvalue,'.gif" height=25 width=',Xvalue,' border=0></a>'); }

if (loading) { i.document.write('<br><b>Vennligst vent mens bildet laster....</b>\n'); }
else { i.document.write('<br><div style="font-size:10px;font-family:verdana;color:#808080;" align=center>',cop2,'</div></center>\n'); }
i.document.write('</body>\n</html>\n');
i.document.close();
}
function sw_zoomURL(url,Xvalue,Yvalue,scroll) {
  var w = 480, h = 340;
  if (document.all || document.layers) {
    w = screen.availWidth;
    h = screen.availHeight;
  }
  var popW = Xvalue, popH = Yvalue;
  var leftPos = (w-popW)/2, topPos = (h-popH)/2;
  if (scroll) {
    i = open(url, "displayWindow2","top="+topPos+",left="+leftPos+",width="+Xvalue+",height="+Yvalue+",status=no,toolbar=no,menubar=no,resize=no,dependent=yes,scrollbars=yes");
  } else {
    i = open(url, "displayWindow2","top="+topPos+",left="+leftPos+",width="+Xvalue+",height="+Yvalue+",status=no,toolbar=no,menubar=no,resize=no,dependent=yes,scrollbars=no");
  }
}
function ChecDomainSearch(theform) {
  if (theform.domene.value=="Skriv inn domenenavn..."){
    alert("Du har glemt å skrive inn navnet på domenet du ønsker å se om er ledig.");
    theform.domene.focus();
    return false;
  }
  if(theform.domene.value.length<2){
    alert("Et domenenavn må bestå av minst 2 bokstaver,\nvennligst sjekk dette før du prøver på nytt.");
    theform.domene.focus();
    return false;
  }
  return true;
}
/* OLD FLASH ZOOMER */
/* Zoomer v1.2 (c) Steinhaugs Webdesign 2002 */
function FlashPop(copyright,title,file,Xvalue,Yvalue) {
  if (copyright == '(c) Steinhaug Webutvikling - www.steinhaug.com') {
  } else {
    var title = "(c) Steinhaug Webutvikling";
  }
  var w = 480, h = 340;
  if (document.all || document.layers) {
    w = screen.availWidth;
    h = screen.availHeight;
  }
  var popW = Xvalue, popH = Yvalue;
  var leftPos = (w-popW)/2, topPos = (h-popH)/2;

  i = open("", "displayWindow1","top="+topPos+",left="+leftPos+",width="+Xvalue+",height="+Yvalue+",status=no,toolbar=no,menubar=no,resize=no,dependent=yes,scrollbars=0");

  i.focus();
  i.document.open();
  i.document.write('<html>\n');
  i.document.write('<head>\n');
  i.document.write('<title>',title,'</title>\n');
  i.document.write('<script><\!-- \n');
  i.document.write('function zzoom(url,Xvalue,Yvalue,scroll) {\n');
  i.document.write('var w = 480, h = 340;\n');
  i.document.write('if (document.all || document.layers) {\n');
  i.document.write('w = screen.availWidth;\n');
  i.document.write('h = screen.availHeight;\n');
  i.document.write('}\n');
  i.document.write('var popW = Xvalue, popH = Yvalue;\n');
  i.document.write('var leftPos = (w-popW)/2, topPos = (h-popH)/2;\n');
  i.document.write('if (scroll) {\n');
  i.document.write('i = open(url, "displayWindow","top="+topPos+",left="+leftPos+",width="+Xvalue+",height="+Yvalue+",status=no,toolbar=no,menubar=no,resize=no,dependent=yes,scrollbars=yes");');
  i.document.write('}\n');
  i.document.write('else {\n');
  i.document.write('i = open(url, "displayWindow","top="+topPos+",left="+leftPos+",width="+Xvalue+",height="+Yvalue+",status=no,toolbar=no,menubar=no,resize=no,dependent=yes,scrollbars=no");');
  i.document.write('}\n');
  i.document.write('}\n');
  i.document.write('\n -\-></script>');
  i.document.write('<\head>\n');
  i.document.write('<body bgcolor="#ffffff" text="#000000" TOPMARGIN=0 LEFTMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>\n');
  i.document.write('<OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" ');
  i.document.write('codebase=\"http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0\" ');
  i.document.write('ID="',file,'" WIDTH="',Xvalue,'" HEIGHT="',Yvalue,'"><PARAM NAME=movie VALUE="',file,'.swf">');
  i.document.write('<PARAM NAME="quality" VALUE="high"> <PARAM NAME="bgcolor" VALUE="#ffffff"> <EMBED src="',file,'.swf" ');
  i.document.write('quality="high" bgcolor="#ffffff" WIDTH="',Xvalue,'" HEIGHT="',Yvalue,'" TYPE="application/x-shockwave-flash" ');
  i.document.write('PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED></OBJECT>');
  i.document.close();
}