window.onload = initAll;

function initAll() {

	document.getElementById("gethtmlcontent").addEventListener('click',getEditorContent,false);
        //document.getElementById("add_post_btn").addEventListener('click',parse_content_to_textbox,false);
}

function parse_content_to_textbox() {
    //alert(getIFrameDocument('wysiwygtextarea1').body.innerHTML);
    //document.getElementById("p_content_hidden").value =  getIFrameDocument('wysiwygtextarea1').body.innerHTML
}

function getEditorContent() {
    //document.getElementById("showcontent").innerHTML =  getIFrameDocument('wysiwygtextarea1').body.innerHTML

    var thecontent = getIFrameDocument('wysiwygtextarea1').body.innerHTML;
    document.getElementById("p_content_hidden").value = thecontent;
  //alert(getIFrameDocument('wysiwygtextarea1').body.innerHTML);

}








 function getIFrameDocument( id )
        {
                var iframe = document.getElementById(id);

                if (iframe.contentDocument) {
                        // For NS6
                        return iframe.contentDocument;
                } else if (iframe.contentWindow) {
                        // For IE5.5 and IE6
                        return iframe.contentWindow.document;
                } else if (iframe.document) {
                        // For IE5
                        return iframe.document;
                } else {
                        return null;
                }
        }