

//voor ubb venstertje
function mkUbb (obj,tag,par)
{
		e=document.getElementById(obj + "_editor");
		
		e.focus();

		if(!par){}else{
			answer=prompt (par,"");	
		}
		
		if(e.setSelectionRange)
		{
				if(!par){
					e.value = e.value.substring(0,e.selectionStart)
					+ "["+ tag +"]"
					+ e.value.substring(e.selectionStart,e.selectionEnd)
					+ "[/"+ tag+"]"
					+ e.value.substring(e.selectionEnd,e.value.length);
				}else
				{
					e.value = e.value.substring(0,e.selectionStart)
					+ "[" + tag + "=" + answer  + "]"
					+ e.value.substring(e.selectionStart,e.selectionEnd)
					+ "[/"+ tag+"]"
					+ e.value.substring(e.selectionEnd,e.value.length);
				}
		}
		else
		{ //fix voor firefox
		   text=document.selection.createRange().text;
		   document.selection.createRange().text="[replacethistoubb]";
		   
			if(!par){
				e.value=e.value.replace("[replacethistoubb]","[" + tag + "]" + text + "[/" + tag + "]");
			}else{
				e.value=e.value.replace("[replacethistoubb]","[" + tag + "=" + answer  + "]" + text + "[/" + tag + "]");
			}

		}
		e.focus();

}


function ubbEditor(obj){
	
	e=document.getElementById(obj + "_editor");
	p=document.getElementById(obj + "_sample");
	
	e.style.height="200px";
	p.style.height="1px";
	
}

function ubbPreview(obj){
	
	e=document.getElementById(obj + "_editor");
	p=document.getElementById(obj + "_sample");
	
	e.style.height="1px";
	ajax("?page=compileUbb&tekst=" + e.value, obj + "_sample");
	p.style.height="200px";
}



$(function () {
	$('.dropdown').each(function () {
		$(this).parent().eq(0).hover(function () {
			$('.dropdown:eq(0)', this).show();
		}, function () {
			$('.dropdown:eq(0)', this).hide();
		});
	});
});

