function submitIt(frm) {
	  if (frm.title.value == "" ) {
	    alert("Innlegget trenger en tittel.     ");
	    frm.title.focus();
	    return false;
	  }
	  else if (frm.comment.value == "" ) {
	    alert("Skriv en kommentar, det er jo hele poenget her!     ");
	    frm.comment.focus();
	    return false;
	  }
	  else if (frm.signature.value == "" ) {
	    alert("Din kommentar trenger en signatur.     ");
	    frm.signature.focus();
	    return false;
	  }
	  return true;
	}

function check(){
        validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
        strEmail = document.getElementById('newuser_email').value;

        if (strEmail.search(validRegExp) == -1)
        {
            alert('Skriv inn en gyldig epostadresse.');
            return false;
        }
        return true;
    }

function goFigure(url) {
  /*  psfile://    */
  if (url.indexOf('psfile://') != -1) {
    url = url.replace('psfile://','./?module=Files;action=File.getFile;ID=');
  }

  /*  psm://    */
  if (url.indexOf('psm://') != -1) {
    url = url.replace('psm://','mailto:');
  }

  /*  psf://    */
  if (url.indexOf('psf://') != -1) {
    url = url.replace('psf://','./?module=Articles;action=ArticleFolder.publicOpenFolder;ID=');
  }

  /*  ps://    */
  if (url.indexOf('ps://') != -1) {
    url = url.replace('ps://','');
    if (url.indexOf(';')) {
      url = url.substring(url.indexOf(';')+1,url.length);
    }
    url = './?module=Articles;action=Article.publicShow;ID=' + url;
  }

  /*  psff://    */
  if (url.indexOf('psff://') != -1) {
    url = url.replace('psff://','./?module=Files;action=FileFolder.publicDisplay;ID=');
  }
  window.open(url);
}
function goTarget(url) {
  window.open(url);
}
function popUp(URL) {
 day = new Date();
 id = day.getTime();
 eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,location=0,statusbar=0,menubar=0,resizable=1,scrollbars=yes,width=430,height=600,left = 242.5,top = 112');");
 setTimeout("checkPop('"+id+"', '"+URL+"')", 2000);
}
function checkPop(id, URL) {
 eval("obj = page"+id+";")
 if (obj==undefined) {
  document.location = URL;
 }
}

function obfuscate(beforedot, content, afterdot, beforea) {
  var mai=new Array('lto:','hre','.',String.fromCharCode(64));
   if (content=='') {
     document.write('<'+'a '+mai[1]+'f="mai'+mai[0]+beforea+mai[3]+beforedot+mai[2]+afterdot+ '">'+beforea+mai[3]+beforedot+mai[2]+ afterdot+ '<' + '/' + 'a>');
   } else {
     document.write('<'+'a '+mai[1]+'f="mai'+mai[0]+beforea+mai[3]+beforedot+mai[2]+afterdot+'">'+content+ '<' + '/' + 'a>');
   }
}

function facebook_click() {
  u=location.href;
  t=document.title;
  window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
  return false;
}

function twitter_click() {
  u=location.href;
  t=document.title;
  window.open('http://twitter.com/home?status='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=810,height=436');
  return false;
}