$().ready(function() {
   $('textarea.mceAdvancedEditor').tinymce({
        script_url : '/js/tiny_mce/tiny_mce.js',

    /* GENERAL */
        custom_shortcuts : false,
        gecko_spellcheck : true,
        language :"hu",
        plugins : "advimage,paste,preview,safari,xhtmlxtras",
        skin : "o2k7",
        skin_variant: "silver",
        theme : "advanced",

    /* CLEANUP/OUTPUT */
        doctype : "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">",
        entities : "160,nbsp,38,amp,34,quot,60,lt,62,gt",
        fix_list_elements : true,
        fix_nesting : true,
        forced_root_block : 'p',
        valid_elements : "@[id|class|title]"
            +"a[accesskey|!href|tabindex],"
            +"abbr,"
            +"acronym,"
            +"blockquote[cite],"
            +"br,"
            +"cite,"
            +"code,"
            +"del[cite|datetime],"
            +"dfn,"
            +"div,"
            +"em/i,"
            //+"h1,"
            +"h2,"
            +"h3,"
            +"h4,"
            +"h5,"
            +"h6,"
            +"img[alt=|height|longdesc|name|src|width],"
            +"ins[cite|datetime],"
            +"li,"
            +"ol[type|compact<compact],"
            +"p,"
            +"pre/listing/plaintext/xmp,"
            +"q[cite],"
            +"span,"
            +"strong/b,"
            +"ul[type|compact<compact]",

    /* URLS */
        relative_urls : false,
        document_base_url : "/",

    /* LAYOUT */
        //content_css : "/css/ravazd.css",

    /* FILE LISTS */
        external_image_list_url : "/js/tiny_mce_image_list.php",

    /* BUTTONS */
        theme_advanced_styles : "Balra=left;Jobbra=right;Középre=center",
        theme_advanced_blockformats : "p,h2,h3,h4,h5,h6,pre",
        theme_advanced_toolbar_align : "left",
        theme_advanced_toolbar_location : "top",
        theme_advanced_statusbar_location : "bottom",

        theme_advanced_buttons1 : "cut,copy,paste,pastetext,pasteword,separator,styleselect,formatselect,separator,bold,italic,del,separator,bullist,numlist,link,unlink,"+ "image,separator,abbr,blockquote,separator,charmap,separator,preview,cleanup,code,attribs",
        theme_advanced_buttons2 : "",
        theme_advanced_buttons3 : ""/**/
   });

      $('textarea.mceSimpleEditor').tinymce({
        script_url : '/js/tiny_mce/tiny_mce.js',

    /* GENERAL */
        custom_shortcuts : false,
        gecko_spellcheck : true,
        language :"hu",
        plugins : "advimage,paste,preview,safari,xhtmlxtras",
        skin : "o2k7",
        skin_variant: "silver",
        theme : "advanced",

    /* CLEANUP/OUTPUT */
        doctype : "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">",
        entities : "160,nbsp,38,amp,34,quot,60,lt,62,gt",
        fix_list_elements : true,
        fix_nesting : true,
        forced_root_block : 'p',
        valid_elements : "@[id|class|title]"
            +"a[accesskey|!href|tabindex],"
            +"br,"
            +"em/i,"
            +"li,"
            +"ol[type|compact<compact],"
            +"p,"
            +"span,"
            +"strong/b,"
            +"ul[type|compact<compact]",

    /* URLS */
        relative_urls : false,
        document_base_url : "/",

    /* LAYOUT */
        //content_css : "/css/ravazd.css",

    /* FILE LISTS */
        external_image_list_url : "/js/tiny_mce_image_list.php",

    /* BUTTONS */
/*        theme_advanced_styles : "Balra=left;Jobbra=right;Középre=center",
        theme_advanced_blockformats : "p,h2,h3,h4,h5,h6,pre",*/
        theme_advanced_toolbar_align : "left",
        theme_advanced_toolbar_location : "top",
        theme_advanced_statusbar_location : "bottom",

        theme_advanced_buttons1 : "cut,copy,paste,pastetext,pasteword,separator,bold,italic,separator,bullist,numlist,link,unlink,",
        theme_advanced_buttons2 : "",
        theme_advanced_buttons3 : ""/**/
    });

    $('#kepek img').draggable({
        containment: '#content',
        revert: true,
        helper: 'clone'
    });
    $('#PostAddForm').droppable({
        drop: function(event, ui) {
            var alt = ui.draggable.attr('alt');
            var src = ui.draggable.attr('src');
            var height = ui.draggable.attr('height');
            var width = ui.draggable.attr('width');
            $('#PostContent').append('<img src="'+src+'" alt="'+alt+'" height="'+height+'" width="'+width+'" />');
        }
    });



});


/*function ajaxLoad() {
	var ed = tinyMCE.get('content');

	// Do you ajax call here, window.setTimeout fakes ajax call
	ed.setProgressState(1); // Show progress
	window.setTimeout(function() {
		ed.setProgressState(0); // Hide progress
		ed.setContent('HTML content that got passed from server.');
	}, 3000);
}

function ajaxSave() {
	var ed = tinyMCE.get('content');

	// Do you ajax call here, window.setTimeout fakes ajax call
	ed.setProgressState(1); // Show progress
	window.setTimeout(function() {
		ed.setProgressState(0); // Hide progress
		alert(ed.getContent());
	}, 3000);
}*/