function NB_login(){
	hideDiv('kalender_div');
	showDiv('nblogin_div');
}
function showKalender(){
	hideDiv('nblogin_div');
	showDiv('kalender_div');
}



/******/


function showtext(id,txt){
	$(id).innerHTML = txt;
}
function hidetext(id){
	$(id).innerHTML = '';
}

function showDiv(id){
	$(id).setStyle("display", "block");
}


function hideDiv(id){
	$(id).setStyle("display", "none");
}

function showhideDiv(id,idt){
	$(idt).setStyle('display', 'none');
	$(id).setStyle('display', 'block');
}



/*kalender*/
function showAct(act){
	if(act=='---'){return;}
	postString = "q=act&act="+act;
	//alert(postString);
	var myAjax = new Ajax('ajax_php/calendar.php', {
	method: 'post',
	data: postString,
	onRequest: function() { 
		$('message_busy').setStyle("display", "block");				
		$('message_busy').innerHTML = '<img src="img/ajax-loader.gif"> Please wait... processing request...'; 
			},
	onComplete: function(req){
			//alert(req);
			$('message_busy').setStyle("display", "none");	
			$('rechtstekst').innerHTML = req;
			
	}
	}).request();
		
}

/*menu*/
function hoverer(ulname) {
	function mouseOver() {
	this.className += ' hover';
	}
	function mouseOut() {
	this.className = this.className.replace(/ *hover\b/g, '');
	}
	var navroot = document.getElementById &&
	document.getElementById(ulname);
	if (document.all && navroot && navroot.currentStyle ) {
	var navroot = document.getElementById(ulname);
	var lis=navroot.getElementsByTagName("li");
	for (var i=0; i<lis.length; i++) {
	lis[i].onmouseover=mouseOver;
	lis[i].onmouseout=mouseOut;
	}
	}
	}

/*besteltachyon*/
function meerinfo(id){
	window.scrollBy(0,50);
	document.getElementById(id).style.display = 'block';
}
function inWinkelwagen(code){
	var overlay = new ItpOverlay();
	var postString = "q=bestel&code="+code;
	var myAjax = new Ajax('ajax_php/besteltachyon.php', {
		method: 'post',
		data: postString,
		onRequest: function() { 
			window.scroll(0,0);
			overlay.show("body");
				},
		onComplete: function(req){
				//alert(req);
				var info = req.split('{@}')
				overlay.hide("body");
				$('winkelwagen').innerHTML = info[0];
				$('winkelwagen_tot').innerHTML = info[1];
				$('winkelwagen_aantal').innerHTML = info[2];
				
		}
		}).request();
	
}

function productaddminus(code,addminus){
	var overlay = new ItpOverlay();
	var postString = "q=bestel&code="+code+"&addminus="+addminus;
	var myAjax = new Ajax('ajax_php/besteltachyon.php', {
		method: 'post',
		data: postString,
		onRequest: function() { 
			window.scroll(0,0);
			overlay.show("body");
				},
		onComplete: function(req){
				//alert(req);
				overlay.hide("body");
				window.location.href = '?q=tachyonbestelcheckout';
		}
		}).request();
	
}

function portkosten(value){
	var overlay = new ItpOverlay();
	var postString = "q=bestelportkosten&code="+value;
	//alert(postString);
	var myAjax = new Ajax('ajax_php/besteltachyon.php', {
		method: 'post',
		data: postString,
		onRequest: function() { 
			window.scroll(0,0);
			overlay.show("body");
				},
		onComplete: function(req){
				//alert(req);
				overlay.hide("body");
				window.location.href = '?q=tachyonbestelcheckout';
		}
		}).request();
	
}

function setfocus(a_field_id) {
    $(a_field_id).focus();
}


function in_array(stringToSearch, arrayToSearch) {
    for (s = 0; s < arrayToSearch.length; s++) {
                thisEntry = arrayToSearch[s].toString();
                if (thisEntry == stringToSearch) {
                           return true;
                }
    }
    return false;
}


function pause(millis){

	var date = new Date();

	var curDate = null;

 

	do { curDate = new Date(); }

	while(curDate-date < millis)

}
//return the value of the radio button that is checked
//return an empty string if none are checked, or
//there are no radio buttons
function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

//set the radio button with the given value as being checked
//do nothing if there are no radio buttons
//if the given value does not exist, all the radio buttons
//are reset to unchecked
function setCheckedValue(radioObj, newValue) {
	if(!radioObj)
		return;
	var radioLength = radioObj.length;
	if(radioLength == undefined) {
		radioObj.checked = (radioObj.value == newValue.toString());
		return;
	}
	for(var i = 0; i < radioLength; i++) {
		radioObj[i].checked = false;
		if(radioObj[i].value == newValue.toString()) {
			radioObj[i].checked = true;
		}
	}
}

function roundNumber(rnum, rlength) { // Arguments: number to round, number of decimal places
	  var newnumber = Math.round(rnum*Math.pow(10,rlength))/Math.pow(10,rlength);
	  return newnumber;
}

function maakGetal(str){
	var newNumber = parseFloat(str.replace(',', '.'));
    return newNumber;
}
