
function new_window(url){
	fenster = window.open(url,"");
}

function trim(s){
	return s.replace(/\s+$/,"").replace(/^\s+/,"");
}

function confirmLink(theLink,text){
	var is_confirmed = confirm(text);
	if(is_confirmed){
		theLink.href += '&is_confirmed=1';
	}

	return is_confirmed;
}

function confirmButton(text){
	var is_confirmed = confirm(text);
	return is_confirmed;
}

function hide(el){

	if(typeof el == 'string'){
		var el = document.getElementById(el);
	}

	if(typeof el == 'object' && el != null){
		el.style.display = 'none';
	}

}

function show(el){

	if(typeof el == 'string'){
		var el = document.getElementById(el);
	}

	if(typeof el == 'object' && el != null){
		el.style.display = 'block';
	}

}

function fillSelect(target,data,selected){
	target.innerHTML = '';
	for(var i in data){
		var o = document.createElement('option');
		o.value = i;
		o.selected = (selected && i == selected);
		o.appendChild(document.createTextNode(data[i]));
		target.appendChild(o);
	}
}


