function autoComplete(key,cont){var script_name='ajax/autocomplete';var params={'q':key.replace(/\s/g,'+')};$.get(script_name,params,function(obj){var res=[];for(var i=0;i<obj.length;i++){res.push({id:i,value:obj[i]});}
cont(res);},'json');}
function capitalFirstLetter(node){var sp=node.value.split(" ");var ret="";for(var i=0;i<sp.length;i++){var word=sp[i];var first=word.charAt(0).toUpperCase();word=first+ word.substr(1);ret+=word;if(i<sp.length-1)ret+=" ";}
node.value=ret;}
function validateNewUser(form){var user=form.user;var pw1=form.pw1;var pw2=form.pw2;var mail=form.mail;var captcha=form.captcha;var isValid=true;if(!validateField(user.value,4))
isValid=false;if(!validateField(pw1.value,6))
isValid=false;if(!validateField(pw1.value,6)&&pw1.value==pw2.value)
isValid=false;if(!validateEmail(mail.value))
isValid=false;if(captcha.value!='c'||!validateField(captcha.value,1))
isValid=false;if(!isValid){var msg="Alle feltene m&aring; v&aelig;re riktig fylt ut!<br />";msg+="Lovlige tegn er: [a-z] [A-Z] og [0-9]";document.getElementById('nyBruker_feil').innerHTML+=msg;}
return isValid;}
function evalLIVE(){var user=document.getElementById('user_form').user;var pw1=document.getElementById('user_form').pw1;var pw2=document.getElementById('user_form').pw2;var mail=document.getElementById('user_form').mail;var captcha=document.getElementById('user_form').captcha;if(validateField(user.value,4))
user.style.background="#70DB93";else
user.style.background="#FFFFFF";if(validateField(pw1.value,6))
pw1.style.background="#70DB93";else
pw1.style.background="#FFFFFF";if(validateField(pw1.value,6)&&pw1.value==pw2.value)
pw2.style.background="#70DB93";else
pw2.style.background="#FFFFFF";if(validateEmail(mail.value))
mail.style.background="#70DB93";else
mail.style.background="#FFFFFF";if(captcha.value=='c')
captcha.style.background="#70DB93";else
captcha.style.background="#FFFFFF";}
function validateField(txt,minLength){if(txt.length<minLength)
return false;if(!legalSign(txt))
return false;return true;}
function validateEmail(mail){if(mail.length<6)
return false;if(mail.indexOf("@",1)==-1)
return false;if(mail.indexOf(".",mail.indexOf("@")+2)==-1)
return false;if(mail.length-mail.lastIndexOf(".")<3)
return false;return true;}
function legalSign(txt){var legal="abcdefghijklmnopqrstuvwxyz";legal+=legal.toUpperCase();legal+="0123456789";for(var i=0;i<txt.length;i++){if(legal.indexOf(txt.charAt(i))==-1){return false;}}
return true;}
function updateDLStats(subid,ext){$('#popdown').slideDown();location.href="http://norsub.com/download/"+subid+"/"+ext;return false;}
var first=1;function emptyNode(node){if(first==1){node.value='';first=0;}
else{node.value='skriv her:)';first=1;}}
function external(link){link.target="_blank";}
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";}}
window.onload=externalLinks;
