writeDisplayCookie();
function toggleCheck(thisField)
{
  checkSet = eval("document.nieuw."+thisField)
	checkSet.checked = !(checkSet.checked)
  document.getElementById('admin_list_entry_n_p').style.background = '#CA9600';
		
}

function toggleRadio(thisField,thisValue)
{
  radioSet = eval("document.nieuw."+thisField)
	for (i=0;i<radioSet.length;i++)
  {
    if (radioSet[i].value == thisValue)
				radioSet[i].checked = true
	}
}

function reloadIframe()
{ 
  parent.frames.planning_overzicht.location.reload();
}

function calcHeight()
{
  //find the height of the internal page
  var the_height=document.getElementById('planning_overzicht').contentWindow.document.body.scrollHeight;
  //alert(document.getElementById("planning_overzicht").offsetHeight+" "+document.getElementById("planning_overzicht").scrollHeight);
  //change the height of the iframe
  document.getElementById('planning_overzicht').height=the_height;
}

function writeDisplayCookie() 
{
	var today = new Date();
	var the_date = new Date("December 31, 2023");
	var the_cookie_date = the_date.toGMTString();
	var the_cookie = "screen_width="+ screen.width;
	var the_cookie = the_cookie + ";expires=" + the_cookie_date;
	document.cookie=the_cookie
}

function dynamicResize(frontend) {
  var myWidth = 0;
  var myHeight = 0;
  var t;
  if (frontend == 'admin'){
    uHeight = 80;
  }
  else if (frontend == 'gebruiker')
  {
    uHeight = 160;
  }
  
  if( typeof( window.innerWidth ) == 'number' ) {
    // Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight - uHeight + 'px';
    
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight - uHeight + 'px';
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight - uHeight + 'px';
  }
  if (document.getElementById('middle_scroll_container'))
  {
    document.getElementById('middle_scroll_container').style.height=myHeight;
  }
  if ( document.getElementById('middle_scroll_container_klant'))
  {
    document.getElementById('middle_scroll_container_klant').style.height=myHeight;
  }
  if (frontend == 'admin'){
    t=setTimeout("dynamicResize('admin')",1000)
  } else if (frontend == 'gebruiker') {
    t=setTimeout("dynamicResize('gebruiker')",1000)
  }
}
// Dit alles om een upload knopje te tonen.. 
function setPath(f) {
  document.getElementById('mypath').value = f;
}
function browse() {
  document.getElementById('realFile').click();
}

function clearIt(f) {
  f.value='';
  var d = document.getElementById('browser');
  var olddiv = document.getElementById('realFile');
  var new_element = document.createElement( 'input' );
  new_element.type = 'file';
  new_element.id='realFile';
  new_element.onchange = function() {document.getElementById('mypath').value = document.getElementById('realFile').value;};
  d.replaceChild( new_element,olddiv );
}

function confirmDelete(anchor)
{
  if (confirm('Weet u zeker dat u deze pagina permanent wilt verwijderen?'))
  {
    anchor.href += '&confirm=1';
    return true;
  }
  return false;
}


function confirmRefresh(anchor)
{
  if (confirm('Weet u zeker dat u dit nieuwsbericht wilt vernieuwen?'))
  {
    anchor.href += '&confirm=1';
    return true;
  }
  return false;
}

function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

// Laad id array => maak dropdown => klik li in dropdown => voer GET uit
function loadXMLDoc(url) {

  try {
    if (netscape.security.PrivilegeManager.enablePrivilege) {
      netscape.security.PrivilegeManager.enablePrivilege(        'UniversalBrowserRead');
    }
  }
  catch (ex) {
    // eat it
  };
  if (window.XMLHttpRequest) {
    req = new XMLHttpRequest();
    req.open("GET", url, false);
    req.send(null);
    }
  else if (window.ActiveXObject) {
    isIE = true;
    req = new ActiveXObject("Microsoft.XMLHTTP");
    if (req) {
      req.open("GET", url, false);
      req.send();
    }
  };

  // only if req shows "loaded"
  if (req.readyState == 4) {
    // only if "OK" or local file (headerless)
    if ((req.status == 200) || (req.status == 0)) {
      
      var items = req.responseXML.getElementsByTagName("label");
      var notes = req.responseXML.getElementsByTagName("note");
      for (var i = 0; i < items.length; i++) {
        var current = items[i].childNodes[0].nodeValue;
        //document.getElementById(current).value = notes[i].childNodes[0].nodeValue;
        };
 
    }
    else {
      alert(req.status)
    }
  }
}

var xmlHttp
 function showUser(str)
{ 
  xmlHttp=GetXmlHttpObject()
  if (xmlHttp==null)
  {
    alert ("Browser does not support HTTP Request")
    return
  }

  var url="includes/service_administrator_laad_opdracht.php"
  url=url+"?q="+str
  url=url+"&sid="+Math.random()
  xmlHttp.onreadystatechange=stateChanged 
  xmlHttp.open("GET",url,true)
  xmlHttp.send(null)
}

function stateChanged() 
{ 
  if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
  { 
    document.getElementById("txtHint").innerHTML=xmlHttp.responseText 
  } 
}

function GetXmlHttpObject()
{
  var xmlHttp=null;
  try
  {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
  }
  catch (e)
  {
    //Internet Explorer
    try
    {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e)
    {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}
