
function windowstatus(what) {
	window.status = what;
}


function getbyid(id) {
	return document.getElementById(id);
}

function win_open(the_url, the_name, the_width, the_height){ 
	the_width -= 0;
	the_height -= 0;
	var screen_width = screen.availWidth;
	var screen_height = screen.availHeight;
	var the_toolbar = "no";
	var the_addressbar = "no";
	var the_directories = "no";
	var the_statusbar = "yes";
	var the_menubar = "no";
	var the_scrollbars = "yes";
	var the_do_resize =  "yes";
	var the_copy_history = "yes";
	//alert('screen_width=' + screen_width + ', screen_height=' + screen_height + ', the_width=' + the_width + ', the_height=' + the_height);
	
	if ((the_height+60) >= screen_height) {
		the_height = screen_height - 60;
	}
	if ((the_width+50) >= screen_width) {
		the_width = screen_width - 50;
	}	
	
	top_pos = (screen_height/2) -  (the_height/2) - 30;
	if (top_pos < 0) {
		top_pos = 0;
	}
	left_pos = (screen_width/2) -  (the_width/2);
	/*if (window.outerWidth ){
		alert('outerwidth');
		var option = "toolbar="+the_toolbar+",location="+the_addressbar+",directories="+the_directories+",status="+the_statusbar+",menubar="+the_menubar+",scrollbars="+the_scrollbars+",resizable="+the_do_resize+",outerWidth="+the_width+",outerHeight="+the_height+",copyhistory="+the_copy_history+",left="+left_pos+",top="+top_pos;
		site=open(the_url, the_name, option);
		var Opera = (navigator.userAgent.indexOf('Opera') != -1);
		if(Opera){
			site.resizeTo(the_width,the_height);
			site.moveTo(0,0);
		}
	}
	else
	{*/
		//alert('else');
		var option = "toolbar="+the_toolbar+",location="+the_addressbar+",directories="+the_directories+",status="+the_statusbar+",menubar="+the_menubar+",scrollbars="+the_scrollbars+",resizable="+the_do_resize+",Width="+the_width+",Height="+the_height+",copyhistory="+the_copy_history+",left="+left_pos+",top="+top_pos;
		site=open('', the_name, option);
		site.location=the_url;
		if(site.open){site.focus();return false;}
		//site.resizeTo(the_width,the_height);
	//}
	
	return false;
}
function showobject(id) {
	if (document.getElementById(id)) {
		document.getElementById(id).style.display = 'block';
		setcookie(id, 'true', 0);
 	//	alert("showing " + id);
	}
}

function hideobject(id) {
	if (document.getElementById(id)) {
		document.getElementById(id).style.display = 'none';
		setcookie(id, 'false', 0);
// 		alert("hiding " + id);
	}
}


function setmouseicon(id, what) {
	if (document.getElementById(id)) {
		document.getElementById(id).style.cursor = what;
	}
}

function setvar(name, value) {
	actualname = "FORM_" + name;
	//alert("setting "+ actualname + " to " + value);	
	if (document.PageForm.elements[actualname] != null) {
		document.PageForm.elements[actualname].value = value;
		//alert("setvar done: " + actualname + ' is now ' + document.PageForm.elements[actualname].value);
	}
}

function setactivewebtab(whichtab) {
	setvar("ActiveWebTab", whichtab);
}
function reinit(exceptions) {
	setvar("ReInit", "true");
	setvar("ReInitExceptions", exceptions);
}
function setpageaction(value) {
	setvar("PageAction", value);
}
function setpagesubaction(value) {
	setvar("PageSubAction", value);
}
function setwebtabaction(value) {
	setvar("WebTabAction", value);
}
function getpageaction() {
	return getvar("PageAction");
}
function getpagesubaction() {
	return getvar("PageSubAction");
}
function getwebtabaction(webtabid, webtabcontentid) {
	return getvar("WebTabAction");
}
function getvar(name) {
	actualname = "FORM_" + name;
	
	if (document.PageForm.elements[actualname] != null) {
		//alert("name " + name + " = " + document.PageForm.elements[actualname].value);
		return document.PageForm.elements[actualname].value;
	}
	else {
		return "";
	}
}

function submit() {
	document.PageForm.submit();
}


// rondt een float af op 2 cijfers na de komma
function roundfloat(fltValue) {
	return Math.round(fltValue * 100) / 100;
}


function setlayout(newlayout) {
	//alert("setcookie: layout = " + newlayout);
	setcookie("layout", newlayout, 365);
	//alert(window.location.href);
	
	if (window.location.href.indexOf("?") > 0) {
		//alert("gewoon");
		window.location.reload(true); // argument true -> fetch document again from webserver
	}
	else {
		//alert('form');
		submit();
	}
}

function setlang(language) {
	setcookie("lang", language, 365);
	//alert(window.location.href);
	
	if (window.location.href.indexOf("?") > 0) {
		//alert("gewoon");
		window.location.reload(true); // argument true -> fetch document again from webserver
	}
	else {
		//alert('form');
		submit();
	}
}



function setcookie(name, value, days) {
    //if(!days) days = 0;
    var expire = new Date();
    expire.setTime(expire.getTime() + 86400000 * days); // expire nooit
	
	if (days == 0) {
		//alert("expiry to 0");
    	
    	//document.cookie = name + "=" + escape(value) +  ";" + "path=/" + webroot;
    	//blijkbaar zet javascript er geen / achter en php wel!
    	document.cookie = name + "=" + escape(value) +  ";" + "path=" + webroot;
    }
	else {
		//alert("expiry to " + days);
		//document.cookie = name + "=" + escape(value) +  ";"	+ "expires=" + expire.toGMTString() + ";" + "path=" + webroot;
		
		//blijkbaar zet javascript er geen / achter en php wel!
		document.cookie = name + "=" + escape(value) +  ";"	+ "expires=" + expire.toGMTString() + ";" + "path="+webroot;
	}
	//alert("results " + getCookie(name));
}

// sets the CSS style class to a new value
function setcssclass(id, newclass) {
	//alert("newclass for " + id + " = " + newclass);
	if (document.getElementById(id)) {
		
		//alert('setting ' + document.getElementById(id).className);
		document.getElementById(id).className = newclass;
		
	}
}



// changes the form encoding type
function setformenctype(what) {
	//alert('setting to' + what);
	document.PageForm.enctype = what;	
}
