var _debug = null;var id = '';var path = "/";var okURL= "";function CreateId() {  d = new Date();  r_year = d.getFullYear().toString();  r_month = (d.getMonth()+1).toString();  r_day = d.getDate().toString();  r_date = r_year + r_month + r_day;  r_rnd = Math.round((Math.random() * 100000))  id = r_date + r_rnd;}function pause(millisecondi)  {   var now = new Date();   var exitTime = now.getTime() + millisecondi;   while(true) {      now = new Date();      if(now.getTime() > exitTime) return;   }}//-----------------------------------------------------------------------------------------------------//  Response fr\u00E5n AJAX anrop vid skapande av projektkodsanv\u00E4ndare //-----------------------------------------------------------------------------------------------------function setTopLoc(tourl) {   top.location = tourl;}function projCodeUserResp() {	resultXML = this.req.responseXML;	var resultText = this.req.responseText;	var result = getPartString(resultText,"<results>","</results>","true");	var user = getPartString(resultText,"<user>","</user>","true");	var server = getPartString(resultText,"<server>","</server>","true");	if(user == null) {		alert("Det gick inte att skapa anv\u00E4ndaren");		return;	}	if(result = "true") {        pause(500);       top.location =  server + "/autologin.html?username=" + user +"&password=juridik"     } else {    		alert("Det gick inte att skapa anv\u00E4ndaren");		return;     }}	//-----------------------------------------------------------------------------------------------------// Response fr\u00E5n AJAX anrop av webservice vid s\u00F6kning i esp //-----------------------------------------------------------------------------------------------------function espSearchResp() {	var ret = getPartString(this.req.responseText,'<out xmlns="http://se.nj.cs/Weqa">','</out></ZSearchResponse>',"true");	var results = ret.split("&lt;navigator&gt;");	var title ="";	var description ="";	var infotype ="";	var getBack ="";	var navName = "";	var navCount = "";	var i=1;	getBack +='<div class="newsbox" id="newsbox-right"><div class="newsheadline-right">Zeteo tr\u00E4ffar</div><div class="newscontent"><span class="notis-headline">'	while (i < results.length) {		result = results[i];		navName 		= getPartString(result,"&lt;navName&gt;","&lt;/navName&gt;","true");		navCount 		= getPartString(result,"&lt;navCount&gt;","&lt;/navCount&gt;","true");				getBack += "<div>"+navName + "&nbsp;(" + navCount  + ")</div>"		i++;	}	getBack += "</span></div></div>";	byId('espSearchResp').innerHTML = getBack;}//-----------------------------------------------------------------------------------------------------// L\u00E4gger en vara i kundkorgen//-----------------------------------------------------------------------------------------------------function CreateOrder(docid,validate) {   //check to see if we hav a form with a antal field, if not set to one!       if (document.forms.buy) {     var antal = byId("antant").value;     var count = byId("count").value;     if (count > 0) antal = count;     } else   {      var antal=1;   } 	var urlOK=encodeURIComponent(location.href); 	okURL = location.href;	urlOK=urlOK.replace(/%26/g, '\u00A4');	var urlNotOK=urlOK;      if(validate == 3) {      var prov='prov'   } else {      var prov='prov'   }     var isthereacookie = getCookie("Order");   if (isthereacookie == null) {      CreateId();      var string = "NJOrder" + id + "ec";      var expdate = new Date ();      expdate.setTime (expdate.getTime() + ( 60 * 60 * 1000 * 4));      SetCookie ("Order", string, expdate, path);        doAjax("/NJAB/Produkt.nsf/ProcessOrderFL2?OpenAgent&cid="+string+"&isbn="+docid+"&number="+antal+"&un=" + 'Anonymous' + "&at=" + prov,createOrderResp);   } else {         doAjax("/NJAB/Produkt.nsf/ProcessOrderFL2?OpenAgent&cid="+getCookie("Order")+"&isbn="+docid+"&number="+ antal + "&un=" + 'Anonymous' + "&at=" + prov,createOrderResp);     }  }//-----------------------------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------------------------function createOrderResp() {	r = this.req.responseText;	top.location = decodeURI(okURL);}//-----------------------------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------------------------function doSearch(s) {if (s.search.value != "") {  str=s.search.query.value;  str = str.replace(/[^a-\u00F6A-\u00D6 0-9 \/ * : -]+/g,'');  top.location.href = "/cms/pub/sokresultat!open&search=" + str + "&scope=" + s.search.scope.value  }}//-----------------------------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------------------------function doDetailedSortSearch(s) {var text=s.resort.url.value;for (var i=0; i < s.resort.sort.length; i++)   {   if (s.resort.sort[i].checked)      {      var o2 = s.resort.sort[i].value;      }   }   var o1=s.resort.sortresults.value;  top.location.href = "/cms/pub/" + text + "&sortby=" + o1+"-" + o2;}//-----------------------------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------------------------function doDetailedSearch(s) {var text=s.freetext.value;  text = text.replace(/[^a-\u00F6A-\u00D6 0-9 \/ * : -]+/g,'');  var o1=s.scope.value;var o2=s.subject.value;var o3=s.producttype.value;var o4=s.pubtype.value;var o5=s.publisher.value;var o6=s.timespan.value;  top.location.href = "/cms/pub/sokresultat-detaljerat!open&search=" + text + "&scope="+o1+"&topic="+o2+"&prodtype="+o3+"&publtype="+o4+"&publisher="+o5+"&timespan="+o6 }//-----------------------------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------------------------function openWindow(docurl, title, w,h) { 	if(w==null) w = 450;	if(h==null) h = 350;	winURL = docurl;	if(title==null) title = "External_Window";	winName = title;	winOpts = "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width="+w+", height="+h;	win = window.open(winURL, winName, winOpts)}//-----------------------------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------------------------function pageOnLoad() {doAjax("/njab/home.nsf/AjaxGetIssuers?openagent", callbackFunctionName,"issuer");	}//-----------------------------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------------------------function callbackFunctionName(r) {r = this.req.responseText;byId("issuer").innerHTML= r;}/*------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------   Function: getFooterMenu AND footerMenyResp   Get footer menu information from SystemBlock and returns it into the right dic------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ function getFooterMenu(cat) {	doAjax("/njab/home.nsf/AjaxGetLowerMenu?openagent&cat="+cat, footerMenyResp);}//-----------------------------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------------------------function footerMenyResp() {	r = this.req.responseText;	resetFootMenu();	var id =  getPartString(r.toString(),"<id>","</id>","true");	var subcat =  getPartString(r.toString(),"<subcat>","</subcat>","true");	subcat =  getPartString(subcat,"<ul>","</ul>","false");	changeByClass(id,"expanded");	changeByClass(id+"A","first");	byId(id+"Sub").innerHTML = subcat;}//-----------------------------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------------------------function doForm() {//<div class="simpleClosed" type="ajaxGet" aaction="price" id="price1" param="123123"></div>	var allDivs = document.getElementsByTagName("div");	var aType='';	var aAction	var aId ='';	var aParam1='';	var aParam2='';	var aParam3='';	var aParam4='';	var aParam5='';	var allParams='';	for(i=0;i<allDivs.length;i++) {	//	try c		aType = allDivs[i].getAttribute('type');							if(aType == 'ajaxGet') {			if(allParams=="") allParams += "<triggers>";			aId 	= allDivs[i].getAttribute('id');			aAction = allDivs[i].getAttribute('action');			aParam1 	= allDivs[i].getAttribute('param1');			aParam2 	= allDivs[i].getAttribute('param2');			aParam3 	= allDivs[i].getAttribute('param3');			aParam4 	= allDivs[i].getAttribute('param4');			aParam5 	= allDivs[i].getAttribute('param5');			allParams += "<trigger>";			allParams += "<id>" + aId + "</id>"			allParams += "<action>"+aAction + "</action>"			if(aParam1 != null) allParams += "<param1>"+aParam1 +"</param1>";			if(aParam2 != null) allParams += "<param2>"+aParam2 +"</param2>";			if(aParam3 != null) allParams += "<param3>"+aParam3 +"</param3>";			if(aParam4 != null) allParams += "<param4>"+aParam4 +"</param4>";			if(aParam5 != null) allParams += "<param5>"+aParam5 +"</param5>";//			debug(i +" aId=" + aId + " aAction=" + aAction + " aParam=" + aParam);			allParams += "</trigger>";		}	//} catch(ex) {	//}					}	if(allParams != "")  {		allParams +=  "</triggers>";		doAjax("/njab/home.nsf/AjaxFormHandler?openagent&params=" + allParams, doFormResp);	}}//-----------------------------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------------------------function doIssuerDropBox(aParam,aId, aAnt) {	var aAction = "issuer"		var allParams='';	allParams += "<triggers>";	allParams += "<trigger>";	allParams += "<id>" + aId + "</id>"	allParams += "<action>"+aAction + "</action>"	allParams += "<param1>"+aParam +"</param1>";	allParams += "<param2>"+aAnt +"</param2>";//	debug(i +" aId=" + aId + " aAction=" + aAction + " aParam=" + aParam);	allParams += "</trigger>";	allParams +=  "</triggers>";	doAjax("/njab/home.nsf/AjaxFormHandler?openagent&params=" + allParams, doFormResp);}//-----------------------------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------------------------function doFormResp() {	resultXML = this.req.responseXML;	var resultText = this.req.responseText;	var result = "";	var i=1;	debug(resultText);	var results = resultText.split("<result>");	while (i < results.length) {		result = results[i];	debug("results(i)=" +result);		var id 				= getPartString(result,"<id>","</id>","true");		var value 			= getPartString(result,"<value>","</value>","true");				byId(id).innerHTML = value;		debug("id=" + id + " value=" + value + " " + byId(id).innerHTML);				changeByClass(id,"simpleOpen");		i++;	}}	/*------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------   Function: getIfExist   Check if a specific tag exist in the XML. If exist return the text ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ function getIfExist(resultXML,tag,num){	var aValue= '';	try {	 	aValue = resultXML.getElementsByTagName(tag)[num].firstChild.nodeValue ;	 	//return extremTrim(aValue);	 	return aValue;	} catch(ex) {		debug("getifExist ERRROR + " + ex);		return ""; 	} }/*------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------   Function: getAttIfExist   Check if a specific tag exist in the XML. If exist return a attribute------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ function getAttIfExist(element,att,num){	var attribute= '';	try {	 	attribute = element.getAttribute(att);	 	return attribute;	} catch(ex) {		return ""; 	}}/*------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------   Function: debug	Open a debug window and write a msg in that window.------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/function debug(msg) {	var server = window.location.toString();	if(server.indexOf('devnjab.wksc.local')!=-1) {		var user = getCookie("username");		if ( user!= null && user.indexOf("thomas.lindqvist") != -1)  {	//	if ( (user.indexOf("thomas.lindqvist") != -1) || (user.indexOf("lalle") != -1) ) { 			if((_debug == null) || (_debug.closed)) {				_debug = window.open("","debug","width=1000,height=600,resizable=yes, toolbar=yes, status=yes, menubar=yes, scrollbars=yes");				_debug.document.open("text/plain");			}			_debug.document.writeln(msg);		}	}}/*------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Function: getPartStringExtract a part of a string------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/function getPartString(remFrom,startStr,endStr,incl) {	var pos1 = 0;	var pos2 = 0;	var between = "";	pos1 = remFrom.toLowerCase().indexOf(startStr.toLowerCase());	if (pos1 == -1) return null;		pos2 = remFrom.toLowerCase().indexOf(endStr.toLowerCase(),pos1);	if (pos2 == -1) return null;	if(incl== "true") {		between = remFrom.substring((pos1+ startStr.length),pos2 );	} else {		between = remFrom.substring(pos1,pos2+ endStr.length);	}	return between;}/*------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------   Function: byId   shortcommand for getting a id from a document if exist------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/  function byId(id) {    return document.getElementById ? document.getElementById(id) : false;}/*------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------   Function: changeByClass   Change class on a div------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ function changeByClass(elementId, className) {	    var element = byId(elementId);    if (element) {        element.className = className;    }  }/*------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------   Function: addClass   Add a class from a div------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ function addClass(elementId,className) {   var element = byId(elementId);    if(element)    {      element.className+=element.className? + " " + className:className;    }  }  /*------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------   Function: removeClass   Remove a  class from a div------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ function removeClass(elementId,className) {   var element = byId(elementId);    if(element)    {      element.className+=element.className.replace(className,"");    }  }//-----------------------------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------------------------function resetFootMenu() {		changeByClass("Arbetsliv","collapsed");		changeByClass("ArbetslivA","");		byId("ArbetslivSub").innerHTML="";		changeByClass("EkoNar","collapsed");		changeByClass("EkoNarA","");		byId("EkoNarSub").innerHTML="";		changeByClass("EneMil","collapsed");		changeByClass("EneMilA","");		byId("EneMilSub").innerHTML="";		changeByClass("ForSak","collapsed");		changeByClass("ForSakA","");		byId("ForSakSub").innerHTML="";		changeByClass("HalSju","collapsed");		changeByClass("HalSjuA","");		byId("HalSjuSub").innerHTML="";		changeByClass("Juridik","collapsed");		changeByClass("JuridikA","");		byId("JuridikSub").innerHTML="";		changeByClass("KommIT","collapsed");		changeByClass("KommITA","");		byId("KommITSub").innerHTML="";		changeByClass("Kultur","collapsed");		changeByClass("KulturA","");		byId("KulturSub").innerHTML="";		changeByClass("LanLiv","collapsed");		changeByClass("LanLivA","");		byId("LanLivSub").innerHTML="";		changeByClass("OffFor","collapsed");		changeByClass("OffForA","");		byId("OffForSub").innerHTML="";		changeByClass("FasSam","collapsed");		changeByClass("FasSamA","");		byId("FasSamSub").innerHTML="";		changeByClass("SocFra","collapsed");		changeByClass("SocFraA","");		byId("SocFraSub").innerHTML="";		changeByClass("Sprak","collapsed");		changeByClass("SprakA","");		byId("SprakSub").innerHTML="";		changeByClass("StrRat","collapsed");		changeByClass("StrRatA","");		byId("StrRatSub").innerHTML="";		changeByClass("TraTra","collapsed");		changeByClass("TraTraA","");		byId("TraTraSub").innerHTML="";		changeByClass("UtbFor","collapsed");		changeByClass("UtbForA","");		byId("UtbForSub").innerHTML="";}//-----------------------------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------------------------var net=new Object();net.READY_STATE_UNINITIALIZED=0;net.READY_STATE_LOADING=1;net.READY_STATE_LOADED=2;net.READY_STATE_INTERACTIVE=3;net.READY_STATE_COMPLETE=4;/*------------------------------------------------------------------------------------------------------------------------   Function: net.xxx	 content loader object for cross-browser requests------------------------------------------------------------------------------------------------------------------------*/ net.ContentLoader=function(url,onload,onerror,method,params,contentType){  this.req=null;  this.onload=onload;  this.onerror=(onerror) ? onerror : this.defaultError;  this.loadXMLDoc(url,method,params,contentType);  this.parameter = null;}net.ContentLoader.prototype.loadXMLDoc=function(url,method,params,contentType){  if (!method){    method="POST";  }  if (!contentType && method=="POST"){    contentType ="application/x-www-form-urlencoded";  }  if (window.XMLHttpRequest){    this.req=new XMLHttpRequest();  } else if (window.ActiveXObject){    this.req=new ActiveXObject("Microsoft.XMLHTTP");  }  if (this.req){    try{      var loader=this;      this.req.onreadystatechange=function(){        net.ContentLoader.onReadyState.call(loader);      }      this.req.open(method,url,true);      if (contentType){        this.req.setRequestHeader("Content-Type", contentType);      }      this.req.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" ); /* Added 060828 OS to workaround IE cache bug. */      this.req.send(params);    }catch (err){      this.onerror.call(this);    }  }}net.ContentLoader.onReadyState=function(){  var req=this.req;  var ready=req.readyState;  if (ready==net.READY_STATE_COMPLETE){    var httpStatus=req.status;      if (httpStatus==200 || httpStatus==0){      	//resultXML = xmlRequestObj.responseXML        this.onload.call(this);      }      else {        this.onerror.call(this);      }  }}net.ContentLoader.prototype.defaultError=function(){  alert("error fetching data!"    +"\n\nreadyState:"+this.req.readyState    +"\nstatus: "+this.req.status    +"\nheaders: "+this.req.getAllResponseHeaders());} /*------------------------------------------------------------------------------------------------------------------------   Function: doAjax   Check if a specific tag exist in the XML. If exist return the text ------------------------------------------------------------------------------------------------------------------------*/ function doAjax(url, callback) {  loader = new net.ContentLoader(url,callback);}/*------------------------------------------------------------------------------------------------------------------------ Function: openExternalLink  open a url in an new window. Used from the resultlist ------------------------------------------------------------------------------------------------------------------------*/ function openExternalLink(theUrl, w,h) { 	if(w==null) w = 800;	if(h==null) h = 600;	ext_link =  window.open(theUrl,"External_Link","toolbar=yes, location=yes, directories=yes, status=yes, menubar=yes, scrollbars=yes, resizable=yes, width="+w+", height="+h);	ext_link .focus();}//--------------------------------------------------------------------------------------------// Rensar ett f\u00E4lt om v\u00E4rdet \u00E4r samma som default v\u00E4rdet//---------------------------------------------------------------------------------------------function clearText(thefield) {if (thefield.defaultValue==thefield.value)thefield.value = "";}//--------------------------------------------------------------------------------------------// get information from a cookie// name - name of the desired cookie// return value of specified cookie or null if cookie does not exist//---------------------------------------------------------------------------------------------function getCookie(name) {	var prefix = name + "="	var cookieStartIndex = document.cookie.indexOf(prefix)	if (cookieStartIndex == -1)		return null	var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)	if (cookieEndIndex == -1)		cookieEndIndex = document.cookie.length	return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))}function getCookieVal (offset) { 	var endstr = document.cookie.indexOf(";", offset);	if (endstr == -1)       endstr = document.cookie.length;	return unescape(document.cookie.substring(offset,endstr));}function SetCookie2 (name, value) {var argv = SetCookie2.arguments;var argc = SetCookie2.arguments.length;var expires = (argc > 2) ? argv[2] : null;var path = (argc > 3) ? argv[3] : null;var domain = (argc > 4) ? argv[4] : null;var secure = (argc > 5) ? argv[5] : false;document.cookie = name + "=" + escape (value) +((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +((path == null) ? "" : ("; path=" + path)) +((domain == null) ? "" : ("; domain=" + domain)) +((secure == true) ? "; secure" : "");}function GetCookie2 (name) { var arg = name + "=";var alen = arg.length;var clen = document.cookie.length;var i = 0;while (i < clen) { var j = i + alen;if (document.cookie.substring(i, j) == arg)  return getCookieVal (j);i = document.cookie.indexOf(" ", i) + 1;if (i == 0) break;        }return null;}//--------------------------------------------------------------------------------------------// set information in a cookie// name - name of the desired cookie, value to cookie//---------------------------------------------------------------------------------------------function SetCookie (name, value) {  var argv = SetCookie.arguments;  var argc = SetCookie.arguments.length;  var expires = (argc > 2) ? argv[2] : null;  var path = (argc > 3) ? argv[3] : null;  var domain = (argc > 4) ? argv[4] : null;  var secure = (argc > 5) ? argv[5] : false;  document.cookie = name + "=" + escape (value) +    ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +    ((path == null) ? "" : ("; path=" + path)) +    ((domain == null) ? "" : ("; domain=" + domain)) +    ((secure == true) ? "; secure" : "");}//--------------------------------------------------------------------------------------------// Runs when uses want to tips a friend//---------------------------------------------------------------------------------------------function doTips() {   if (byId("email").value == byId("email").defaultValue ) {      alert("Du m\u00E5ste fylla i en epost adress")      return;   }   if (byId("fullname").value == byId("fullname").defaultValue ) {      alert("Du m\u00E5ste fylla i ett namn");      return;   }   if(validateEmail(byId("email").value)) {      byId("tipsMsg").innerHTML = "Skapar epost"      //alert("&toAddr=" +byId("email").value + "&fromAddr=" + byId("fullname").value +"&prdID=" +byId("prdID").value + "&site=NJ");            doAjax("/NJAB/Produkt.nsf/SendMail3?OpenAgent&toAddr=" +byId("email").value + "&fromAddr=" + byId("fullname").value +"&prdID=" +byId("prdID").value + "&site=NJ",tipsResp);            //var _url=top.location + "/NJAB/Produkt.nsf/SendMail2?OpenAgent";   }   }//-----------------------------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------------------------function tipsResp() {	r = this.req.responseText;	if(getPartString(r,"<nodevalue>","</nodevalue>","true")=="true") {	   byId("tipsMsg").innerHTML = "Tips skickat";	} else {	   byId("tipsMsg").innerHTML = "Det gick inte att skicka epost";	} }//-----------------------------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------------------------//OBSOLETE, maybe future functionfunction doGrant() {   if (byId("villkor").value == byId("villkor").defaultValue ) {      alert("Du m\u00E5ste godk\u00E4nna avtalet")      return;   }         byId("tipsMsg").innerHTML = "V\u00E4nta..."            doAjax("/NJAB/Produkt.nsf/subscribeTranslegal?OpenAgent&toAddr=" +byId("email").value + "&fromAddr=" + byId("fullname").value +"&prdID=" +byId("prdID").value + "&site=NJ",grantResp);            }//-----------------------------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------------------------function grantResp() {	r = this.req.responseText;	if(getPartString(r,"<nodevalue>","</nodevalue>","true")=="true") {	   byId("tipsMsg").innerHTML = "Tips skickat";	} else {	   byId("tipsMsg").innerHTML = "Det gick inte att skicka epost";	} }//--------------------------------------------------------------------------------------------// Validate a email adress// do a basic check for null, zero-length string, ".", "@",// and the absence of spaces//---------------------------------------------------------------------------------------------function validateEmail(str){      var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid  var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid  if (!reg1.test(str) && reg2.test(str)) { // if syntax is valid    return true;  }  alert("\"" + str + "\" \u00E4r en felaktig e-postadress!"); // this is also optional  return false;}/*------------------------------------------------------------Function: getPartStringExtract a part of a stringArguments:  remFrom - The string to get a part from  startStr - The start string  endStr - the end string  incl - should the start and stop text be included------------------------------------------------------------*/function getPartString(remFrom,startStr,endStr,incl) {	var pos1 = 0;	var pos2 = 0;	var between = "";	if (remFrom == null) return null;		pos1 = remFrom.toLowerCase().indexOf(startStr.toLowerCase());	if (pos1 == -1) return null;		pos2 = remFrom.toLowerCase().indexOf(endStr.toLowerCase(),pos1);	if (pos2 == -1) return null;	if(incl== "true") {		between = remFrom.substring((pos1+ startStr.length),pos2 );	} else {		between = remFrom.substring(pos1,pos2+ endStr.length);	}	return between;}function DeleteCookie() {  var expireddate = new Date ();var cookiecontent = GetCookie("Order")expireddate.setTime (expireddate.getTime() - ( 60 * 60 * 1000 * 1));SetCookie ("Order", cookiecontent, expireddate, path);SetCookie ("nj_value", cookiecontent, expireddate, path);}function parseURL(url) {    var a =  document.createElement('a');    a.href = url;    return {        source: url,        protocol: a.protocol.replace(':',''),        host: a.hostname,        port: a.port,        query: a.search,        params: (function(){            var ret = {},                seg = a.search.replace(/^\?/,'').split('&'),                len = seg.length, i = 0, s;            for (;i<len;i++) {                if (!seg[i]) { continue; }                s = seg[i].split('=');                ret[s[0]] = s[1];            }            return ret;        })(),        file: (a.pathname.match(/\/([^\/?#]+)$/i) || [,''])[1],        hash: a.hash.replace('#',''),        path: a.pathname.replace(/^([^\/])/,'/$1'),        relative: (a.href.match(/tps?:\/\/[^\/]+(.+)/) || [,''])[1],        segments: a.pathname.replace(/^\//,'').split('/')    };}function calc() {if (byId("attendemail1").value > "") 	byId("count").value="1"if (byId("attendemail2").value > "") 	byId("count").value="2"if (byId("attendemail3").value > "") 	byId("count").value="3"if (byId("attendemail4").value > "") 	byId("count").value="4"if (byId("attendemail5").value > "") 	byId("count").value="5"}function validateForm(bestnr) {u1="";u2="";u3="";u4="";u5="";if (byId("attendemail1").value > "") {u1=byId("attendename1").value + "," +byId("attendemail1").value;}if (byId("attendemail2").value > "") {u2=byId("attendename2").value + "," +byId("attendemail2").value;}if (byId("attendemail3").value > "") {u3=byId("attendename3").value + "," +byId("attendemail3").value;}if (byId("attendemail4").value > "") {u4=byId("attendename4").value + "," +byId("attendemail4").value;}if (byId("attendemail5").value > "") {u5=byId("attendename5").value + "," +byId("attendemail5").value;}ct=byId("course").value;CreateOrder(bestnr, '2');return doAjax("/njab/order.nsf/handleKurs?OpenAgent&u1="+u1+"&u2="+u2+"&u3="+u3+"&u4="+u4+"&u5="+u5+"&ct="+ct);}