Display-Hide-Div with Iframe

//ctrl is ouetrmost Div Id
// wysiwygctl00_PlaceHolderMain_txtDescription is the Iframe Id

function DisplayNewPost(ctrl)
{
           
var
PreState=document.getElementById(ctrl).style.display;
   
if(PreState!="none")
           
{
               
document.getElementById(ctrl).style.display="none";
           
}
           
else
           
{

       document.getElementById(ctrl).style.display="block";

       var content = document.getElementById('ctl00_PlaceHolderMain_txtDescription').value;               

       var doc = document.getElementById("wysiwygctl00_PlaceHolderMain_txtDescription").contentWindow.document;         // Write the textarea's content into the iframe
      
doc.open();
      
doc.write(content);
      
doc.close();              
      
// Make the iframe editable in both Mozilla and IE
      
doc.body.contentEditable = true;
      
doc.designMode = "on";

            }
}