function insertBB(txtID, start, end) 
{
	element = document.getElementById(txtID);
	
	if (document.selection) 
	{
		element.focus();
		sel = document.selection.createRange();
		sel.text = start + sel.text + end;
	} 
	else if (element.selectionStart || element.selectionStart == '0') 
	{
		element.focus();
		var startPos = element.selectionStart;
		var endPos = element.selectionEnd;
		element.value = element.value.substring(0, startPos) + start + element.value.substring(startPos, endPos) + end + element.value.substring(endPos, element.value.length);
	} 
	else 
	{
		element.value += start + end;
	}
	
	return false;
}

function view_modal(cl_id, comment, no_load){
if(typeof comment == 'undefined') comment = 1;
if(typeof no_load == 'undefined') no_load = 0;

$('#modal_img').show();

	$('#modal_img').show();
	$('#modal_img').css('top', (($(window).height())/2)-200 + $(window).scrollTop());

	$('#modal_img').html('<div style="padding:10px 10px 10px 20px; border-bottom:1px solid gray;"><div style="float:right; height:30px;"><img src="/images/cancel.png" onClick="$(\'#modal_img\').hide()"></div><h3 style="height:30px; margin:0;">Добавить фотографию</h3></div>');
	$('#modal_img').append('<iframe src="/netcat/modules/default/modal_img.php?cl_id='+cl_id+'&comment='+comment+'&no_load='+no_load+'" class="modal_iframe"></iframe>');
}

