function open_smiley() {
	w=window.open("page/smileys.html", "smileys", "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no,width=250,height=150");
	if(!w.opener)
	{
		w.opener=self;
	}
}


function open_link() {
	w=window.open("page/add_link.html", "links", "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no,width=250,height=150");
	if(!w.opener)
	{
		w.opener=self;
	}
}

function format_text(area,tagstart,tagend) {

	if (area.setSelectionRange) {
		area.value = area.value.substring(0,area.selectionStart) + tagstart + area.value.substring(area.selectionStart,area.selectionEnd) + tagend + area.value.substring(area.selectionEnd,area.value.length)
	}
	else {
		var selectedText = document.selection.createRange().text;

		if (selectedText != "") {
			var newText = tagstart+ selectedText + tagend;
			document.selection.createRange().text = newText;
		}

	}
}


function open_window(theURL,winName,features) {
	window.open(theURL,winName,features);
}


function writeBox(txt, div){
	
	document.getElementById(div).innerHTML=txt;
	
}



function writeText(txt, div){
	document.getElementById(div).innerHTML=txt;
	CB_Init();
}



function page_reload(theURL,winName,features){

	var winPop= window.open(theURL,winName,features);
	if(winPop && !winPop.closed){
		window.open(theURL,winName,features);
	}


}


function select_enabled(id, t_f){

	if(t_f==1){
		if (document.getElementById(id).disabled == true){
			document.getElementById(id).disabled = false;
			document.getElementById(id).focus();
		}
		
	}
	else{

		if(document.getElementById(id).value==""){
			document.getElementById(id).disabled = true;
		}


	}


}
