/**
 * Filename:
 * Created : Andy Christian S. Loyola <admin@andyloyola.com> (http://andyloyola.com)
 * Copyright 2015 - Andy Christian S. Loyola <admin@andyloyola.com> (http://andyloyola.com)
 *
 * Skype: andy_christian_loyola_
 * Yahoo: andz_christian
 * GTalk: acl20032003@gmail.com
 */

function tinymceGetContent( editor_id, textarea_id ) {
    if (typeof editor_id == 'undefined') editor_id = wpActiveEditor;
    if (typeof textarea_id == 'undefined') textarea_id = editor_id;

    if (jQuery('#wp-'+ editor_id +'-wrap').hasClass('tmce-active') && tinyMCE.get(editor_id)) {
        return tinyMCE.get(editor_id).getContent();
    }
    else {
        return jQuery('#'+ textarea_id).val();
    }
}

function tinymceSetContent( content, editor_id, textarea_id ) {
    if (typeof editor_id == 'undefined') editor_id = wpActiveEditor;
    if (typeof textarea_id == 'undefined') textarea_id = editor_id;

    if (jQuery('#wp-'+ editor_id +'-wrap').hasClass('tmce-active') && tinyMCE.get(editor_id)) {
        return tinyMCE.get(editor_id).setContent(content);
    }
    else {
        return jQuery('#'+ textarea_id).val(content);
    }
}

function tinymceFocus( editor_id, textarea_id ) {
    if (typeof editor_id == 'undefined') editor_id = wpActiveEditor;
    if (typeof textarea_id == 'undefined') textarea_id = editor_id;

    if (jQuery('#wp-'+ editor_id +'-wrap').hasClass('tmce-active') && tinyMCE.get(editor_id)) {
        return tinyMCE.get(editor_id).focus();
    }
    else {
        return jQuery('#'+ textarea_id).focus();
    }
}