var http_request = false;
var myFunction = '';

function setCarrot( carrotID, nodeID )
{
	myFunction = 'setCarrot';
	var poststr = "nodeID=" + encodeURI( nodeID ) + "&carrotID=" + encodeURI( carrotID );
	postRequest("/vztlibrary/setcarrot/", poststr);
	
}

function postRequest(url, parameters) {
  http_request = false;
  if (window.XMLHttpRequest) { // Mozilla, Safari,...
	 http_request = new XMLHttpRequest();
	 if (http_request.overrideMimeType) {
		// set type accordingly to anticipated content type
		//http_request.overrideMimeType('text/xml');
		http_request.overrideMimeType('text/html');
	 }
  } else if (window.ActiveXObject) { // IE
	 try {
		http_request = new ActiveXObject("Msxml2.XMLHTTP");
	 } catch (e) {
		try {
		   http_request = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e) {}
	 }
  }
  if (!http_request) {
	 alert('Kan ikke opprette XMLHTTP instansen. Bytt browser');
	 return false;
  }
  
  http_request.onreadystatechange = hentPHP;
  http_request.open('POST', url, true);
  http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  http_request.setRequestHeader("Content-length", parameters.length);
  http_request.setRequestHeader("Connection", "close");
  http_request.send(parameters);
}

function hentPHP() {
  if ( http_request.readyState == 4 ) {
	if ( http_request.status == 200 ) 
	 {
		result = http_request.responseText;
		
		if ( myFunction == 'setCarrot' )
		{
			// DN
		}
	 } 
	 else 
	 {
		//alert( 'Problemer med å finne fila det postes til.' );
	 }
  }
}
 
var numx; 
var node_id;

function checkValue(div)
{
	var checkbox = document.getElementById( div );
	
	if ( checkbox.checked )
		document.getElementById( 'planer' ).style.display = 'inline';	
	else
		document.getElementById( 'planer' ).style.display = 'none';	
}
function checkSelectValue(div)
{
	var selectF = document.getElementById( div );
	
	if ( selectF.value == 0 ){
		document.getElementById( 'planer' ).style.display = 'block';
	}
	else if ( selectF.value == 1 ){
		document.getElementById( 'planer' ).style.display = 'none';
		document.editform.getElementById( 'ezcoa-445_planer_klima' ).checked = false;
		document.getElementById( 'ezcoa-446_planer_avfall' ).checked = false;
		document.getElementById( 'ezcoa-447_planer_innkjop' ).checked = false;
		document.getElementById( 'ezcoa-448_planer_transport' ).checked = false;
	}
	else{
		document.getElementById( 'planer' ).style.display = 'none';	
		document.getElementById( 'ezcoa-445_planer_klima' ).checked = false;
		document.getElementById( 'ezcoa-446_planer_avfall' ).checked = false;
		document.getElementById( 'ezcoa-447_planer_innkjop' ).checked = false;
		document.getElementById( 'ezcoa-448_planer_transport' ).checked = false;
	}
}
