//SHOW/HIDE LAYER
function switchDiv(fromDiv,toDiv) {
	var option=[fromDiv,toDiv];
	for(var i=0; i<option.length; i++) { 
		obj=document.getElementById(option[i]);
		obj.className=(obj.className=="visible") ? "hidden" : "visible";
	}
}

<!-- Original: Eric King (eric_andrew_king@hotmail.com) -->
<!-- Web Site: http://redrival.com/eak/ --><!-- This script and many more are available free online at The JavaScript Source!! http://javascript.internet.com -->
function popUp(mypage, myname, w, h, scroll) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;

	// OBS! ingen radbrytning i texten nedan
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	//slut på område utan radbrytning

	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

// CHECK CONFIRM
function check(strMSG){
	var bolYes = confirm(strMSG)
	if(bolYes == true){
    	return true;
    }
    	else{
    return false;
	}
}

var xmlhttp;
function getPage(str) {
	xmlhttp=null;
	if (window.XMLHttpRequest) {				// code for Firefox, Opera, IE7, etc.
  		xmlhttp=new XMLHttpRequest();
  	}
	else if (window.ActiveXObject) {			// code for IE6, IE5
		  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  	}

	if (xmlhttp!=null) {
  		xmlhttp.onreadystatechange=state_Change;
  		xmlhttp.open("GET","fetch_data.php?str="+str,true);
  		xmlhttp.send(null);
  	}
	else {
	  alert("Your browser does not support XMLHTTP.");
  	}
}

function state_Change()
{
if (xmlhttp.readyState==4)
  {// 4 = "loaded"
  if (xmlhttp.status==200)
    {// 200 = "OK"
    document.getElementById('ajaxResult').innerHTML=xmlhttp.responseText;
    }
  else
    {
    alert("Problem retrieving data:" + xmlhttp.statusText);
    }
  }
}