function hidePostBlock(){
	var podlojka = document.getElementById("podlojka");
	var confirmBlock = document.getElementById("confirmBlock");
	
	podlojka.style.display = "none";
	confirmBlock.style.display = "none";
	window.location.reload();
}

function showPostBlock(id)
{
	var podlojka = document.getElementById("podlojka");
	var confirmBlock = document.getElementById("confirmBlock");
	var iframe_posts =  document.getElementById("iframes_post");
	podlojka.style.height = document.body.clientHeight + "px";
	podlojka.style.display = "block";
	confirmBlock.style.display = "block";
	
	if(id > 0)
		iframe_posts.src="../blog/?pg=add_comment&id="+id;
	else 
		iframe_posts.src="../blog/?pg=add_post";
}

    
function clear_text_topic()
{

	tinyMCE.execInstanceCommand("text_topic", "mceCleanup");		
	tinyMCE.idCounter = 0; 
	tinyMCE.execCommand('mceRemoveControl', true, 'text_topic');
	content = document.getElementById('text_topic').value;
	content = content.replace(/<(!--)([\s\S]*)(--)>/gi, ""); 			
	document.getElementById('text_topic').value = content;
	tinyMCE.execCommand('mceAddControl', true, 'text_topic');

} 
	    
function CleanupHTML_callback(e) 
{
	if (e.ctrlKey && e.keyCode == 86 && e.type != "keyup")
    {
    	var FF3=(function x(){})[-5]=='x';
    	if(FF3) 
    		setTimeout('clear_text_topic()',100);
    	else 
    		setTimeout('tinyMCE.execInstanceCommand("text_topic", "mceCleanup")',100);	
    }
}   

function init_text_topic()
{
	tinyMCE.init({
	mode : "exact",
	theme : "advanced",
	elements : "text_topic",
	width:"450",
	height:"140",
	language : "fr",
	auto_reset_designmode : true,
	plugins:"contextmenu,inlinepopups",
	theme : "advanced",
	handle_event_callback : "CleanupHTML_callback",
	theme_advanced_buttons1 : "bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright, justifyfull,bullist,numlist,undo,redo,link,unlink",
	theme_advanced_buttons2 : "",
	theme_advanced_buttons3 : "",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_statusbar_location : "bottom",
	valid_elements : "a[href|target=_blank|rel],strong/b,div[align],br,p[align],div[align],li,ul,u,i,font[color],h1,h2,h3,h4,h5,h6",
	theme_advanced_path : "false"
	 });
}


function validateEmail(emails)
{
    if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(emails))
        return true
    else
        return false;
}

