function opennastypopup() {
window.open("admin.html.php?ind=nei", "", "toolbar=no,height=100,width=200");
}

function ismaxlength(obj){
var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
if (obj.getAttribute && obj.value.length>mlength)
obj.value=obj.value.substring(0,mlength)
}
var howLong = 5000;
t = null;
function closeMe(){
t = setTimeout("self.close()",howLong);
}
var theURL = 'admin.html.php?ind=nei';
var width  = 150;
var height = 100;
function popWindow() {
newWindow = window.open(theURL,'newWindow','toolbar=no,menubar=no,resizable=no,scrollbars=no,status=no,location=no,left=750,top=500,width='+width+',height='+height);
}
function frames(input1) {
    document.all("frame_navn1").src=input1
}

function slett(tekst) {
	var OK = false;
	OK = confirm("Vil du virkelig slette " + tekst + " ?")
	if (OK) return true;
	else return false;
}

function viewRefreshFields() {
var f=document.forms[0];
f.__Click.value="$Refresh";
f.submit();
}
function wrapString(inputString,wrapLength,delimiter)
{
  if (!delimiter) delimiter = '\n';
  if (!wrapLength) wrapLength = inputString.length.
  buildString = '';
  for (i=0; i < inputString.length; i+=wrapLength)
  {
    buildString += inputString.slice(i,i+wrapLength) + delimiter;
  }
  return buildString.slice(0,(buildString.length - delimiter.length));
}
var nW,nH,oH,oW;
function zoomToggle(iWideSmall,iHighSmall,iWideLarge,iHighLarge,whichImage){
oW=whichImage.style.width;oH=whichImage.style.height;
if((oW==iWideLarge)||(oH==iHighLarge)){
nW=iWideSmall;nH=iHighSmall;}else{
nW=iWideLarge;nH=iHighLarge;}
whichImage.style.width=nW;whichImage.style.height=nH;
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
function myprint() {
window.parent.hoved.focus();
window.print();
}
function autoSubmit(){
     document.xyz.submit();
}
function maskKeyPress(objEvent)
{
  var iKeyCode;
  iKeyCode = objEvent.keyCode;
  if(iKeyCode>=48 && iKeyCode<=57 || iKeyCode==32 || iKeyCode==8 || iKeyCode==9)  return true ;
  alert("Beklager, men kun \n tall er tillatt!\n ");
   return false;
form.select();
form.focus();
}
function maskKeyPress2(objEvent)
{
  var iKeyCode;
  iKeyCode = objEvent.keyCode;
  if(iKeyCode<=48 || iKeyCode>=58 ) return true ;
  alert("Beklager, men \n tall er ikke tillatt!\n");
  return false;
form.select();
form.focus();
}
var downStrokeField;
function autojump(fieldName,nextFieldName,fakeMaxLength)
{
var myForm=document.forms[document.forms.length - 1];
var myField=myForm.elements[fieldName];
myField.nextField=myForm.elements[nextFieldName];
if (myField.maxLength == null)
   myField.maxLength=fakeMaxLength;
myField.onkeydown=autojump_keyDown;
myField.onkeyup=autojump_keyUp;
}
function autojump_keyDown()
{
this.beforeLength=this.value.length;
downStrokeField=this;
}
function autojump_keyUp()
{
if (
   (this == downStrokeField) &&
   (this.value.length > this.beforeLength) &&
   (this.value.length >= this.maxLength)
   )
   this.nextField.focus();
downStrokeField=null;
}
var mikExp = /[$\\@\\\#%\^\&\*\(\)\[\]\+\_\{\}\`\~\=\|]/;
function dodacheck(val) {
var strPass = val.value;
var strLength = strPass.length;
var lchar = val.value.charAt((strLength) - 1);
if(lchar.search(mikExp) != -1) {
var tst = val.value.substring(0, (strLength) - 1);
val.value = tst;
   }
}
var mikExp1 = /[$\\\\\#%\^\&\*\(\)\[\]\+\_\{\}\`\~\=\|]/;
function dodacheckmail(val) {
var strPass = val.value;
var strLength = strPass.length;
var lchar = val.value.charAt((strLength) - 1);
if(lchar.search(mikExp1) != -1) {
var tst = val.value.substring(0, (strLength) - 1);
val.value = tst;
 if(val.value.search(mikExp1) == -1) {
return true;
}
else {
alert("Beklager, men de følgende tegnene\n\r\n\r $ % ^ & * # ( ) [ ]  \\ { + } ` ~ =  | \n\r\n\rer ikke tilatt!\n");
form.select();
form.focus();
return false;
}
   }
}
var testresults
function checkemail(){
var str=document.endre_aktivitet.epostadresse.value
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str))
testresults=true
else{
alert("Vennligst skriv inn en godkjent email addresse!")
testresults=false
}
return (testresults)
}
function checkbae(){
if (document.layers||document.getElementById||document.all)
return checkemail()
else
return true
}
function doanothercheck(form) {
if(form.value.length < 1) {
alert("Du må fylle ut dette feltet.");
form.select();
form.focus();
return false;
}
if(form.value.search(mikExp) == -1) {
return true;
}
else {
alert("Beklager, men de følgende tegnene\n\r\n\r@ $ % ^ & * # ( ) [ ] \\ { + } ` ~ =  | \n\r\n\rer ikke tilatt!\n");
form.select();
form.focus();
return false;
}
return true;
}
function goback()
{
      awin = self.parent.displayFrm
      awin.history.back()
}
function gonext()
{
      awin = self.parent.displayFrm
      awin.history.forward()
}
    function sjekkbruker() {
	 if (window.document.regbruker.navn.value=="") {
      alert ("Du må fylle ut navn!");
      window.document.regbruker.navn.focus();
      return false;
      };
    if (window.document.regbruker.brukernavn.value=="") {
      alert ("Du må fylle ut brukernavn!");
      window.document.regbruker.brukernavn.focus();
      return false;
      };
           if (window.document.regbruker.passord.value=="") {
      alert ("Du må fylle ut passord!");
      window.document.regbruker.passord.focus();
      return false;
      };
    return true;
    }
    
    function sjekkaktivitet() {
    if (window.document.endre_aktivitet.aktivitetssted.value=="") {
      alert ("Du må fylle ut aktivitetssted!");
      window.document.endre_aktivitet.aktivitetssted.focus();
      return false;
      };
           if (window.document.endre_aktivitet.aktivitetsnavn.value=="") {
      alert ("Du må fylle ut aktivitetsnavn!");
      window.document.endre_aktivitet.aktivitetsnavn.focus();
      return false;
      };
           if (window.document.endre_aktivitet.ingress.value=="") {
      alert ("Du må fylle ut ingress!");
      window.document.endre_aktivitet.ingress.focus();
      return false;
      };
    return true;
    }
function sjekkforening() {
    if (window.document.endre_forening.foreningsnavn.value=="") {
      alert ("Du må fylle ut foreningsnavn!");
      window.document.endre_forening.foreningsnavn.focus();
      return false;
      };
    if (window.document.endre_forening.adresse.value=="") {
      alert ("Du må fylle ut adresse!");
      window.document.endre_forening.adresse.focus();
      return false;
      };
  if (window.document.endre_forening.postnr.value=="") {
      alert ("Du må fylle ut postnummer!");
      window.document.endre_forening.postnr.focus();
      return false;
      };
           if (window.document.endre_forening.ingress.value=="") {
      alert ("Du må fylle ut ingress!");
      window.document.endre_forening.ingress.focus();
      return false;
      };
    return true;
    }
function sjekkregistrering() {
    if (window.document.Registrer.navn.value=="") {
      alert ("Du må fylle ut navn!");
      window.document.Registrer.navn.focus();
      return false;
      };
  if (window.document.Registrer.postnr.value=="") {
      alert ("Du må fylle ut postnummer!");
      window.document.Registrer.postnr.focus();
      return false;
      };
            if (window.document.Registrer.alder.value=="") {
      alert ("Du må fylle ut alder!");
      window.document.Registrer.alder.focus();
      return false;
      };
    return true;
    }
    function sjekknyhet() {
    if (window.document.regnyhet.ingress.value=="") {
      alert ("Du må fylle ut ingress");
      window.document.regnyhet.ingress.focus();
      return false;
      };
  if (window.document.regnyhet.resten.value=="") {
      alert ("Du må fylle ut resten!");
      window.document.regnyhet.ingress.focus();
      return false;
      };
    return true;
    }
    
    function sjekklink() {
    if (window.document.Registrer_link.link_kategori.value=="") {
      alert ("Du må fylle ut kategori!");
      window.document.Registrer_link.link_kategori.focus();
      return false;
      };
  if (window.document.Registrer_link.linker.value=="") {
      alert ("Du må fylle ut linken!");
      window.document.Registrer_link.linker.focus();
      return false;
      };
            if (window.document.Registrer_link.beskrivelse.value=="") {
      alert ("Du må fylle ut beskrivelse!");
      window.document.Registrer_link.beskrivelse.focus();
      return false;
      };
    return true;
    }

   function wrapSelectionBold (element) {
    var range = document.selection.createRange();
    if (range.parentElement() == element) range.text = '<b>' + range.text + '<\/b>';
   }
   function wrapSelectionItalic (element) {
    var range = document.selection.createRange();
    if (range.parentElement() == element) range.text = '<i>' + range.text + '<\/i>';
   }
   function wrapSelectionBlockQuote (element) {
    var range = document.selection.createRange();
    if (range.parentElement() == element) range.text = '<blockquote>' + range.text + '<\/blockquote>';
   }
   function wrapSelectionBigHeadline (element) {
    var range = document.selection.createRange();
    if (range.parentElement() == element) range.text = '<h1>' + range.text + '<\/h1>';
   }
   function wrapSelectionSmallHeadline (element) {
    var range = document.selection.createRange();
    if (range.parentElement() == element) range.text = '<h4>' + range.text + '<\/h4>';
   }
   function wrapSelectionMakeALink (element) {
    var range = document.selection.createRange();
    address = prompt('What address?', 'http://');
    address = '<a href=\"' + address + '\">';
    if (range.parentElement() == element) range.text = address + range.text + '<\/a>';
   }
   function wrapSelectionMakeALinkNew (element) {
    var range = document.selection.createRange();
    address = prompt('What address?', 'http://');
    address = '<a target="_new" href=\"' + address + '\">';
    if (range.parentElement() == element) range.text = address + range.text + '<\/a>';
   }
   function wrapSelectionInsertImage (element) {
    var range = document.selection.createRange();
    address = prompt('Add address for image. If the image is on your site, look in Image Info.', '');
    address = '<img src=\"' + address + '\">';
    if (range.parentElement() == element) range.text = address + range.text;
   }


