function msg_popup(msg) {
	if (msg) {
		$("#ph_body_popup").hide().html('<div id="body_popup">'+msg+'</div>').fadeIn(250).animate({width: 'auto'}, msg.length * 15).fadeOut(1000);
	}
}

function get_unq(id) {
	var u = id.split('_');
	return u[1];
}

function topblock_open(event, url, focus) {
	topblock_close(event);
	$.getJSON(url, function(json){
		if (json.stat == "ok") {
			st['json_ok'] = true;
			$('#ph_body_topblock').hide().html('<div id="body_topblock_w"><div id="body_topblock">'+json.form+'</div></div>').slideDown(function(){
				$('#'+focus).focus();
			});
		}
		else {
			msg_popup(json.msg);
		}
	});
	event.preventDefault();
}
function topblock_close(event) {
	$("#ph_body_topblock").slideUp(function(){
		$(this).html(false);
	});
	event.preventDefault();
}
