// Copyright 2003-2014 Adobe Systems and its licensors. All rights reserved.
//This is borrowed from insertDiv.js, to help add block type elements in LiveView
function doInsertBlock(tagName)
{
	var dom = dw.getDocumentDOM();
	if (dom)
	{
		var newTag = '<'+tagName+'>';
		var content = dw.loadString("insertbar/semanticTag/tagContentNoID");
		content = content.replace(/%1/, tagName);
		var closeTag = '</'+tagName+'>';
		var newTagWithContent = newTag + content + closeTag;

        var selection = dw.getSelection();
        if (selection[0] == selection[1])
            dom.insertHTML(newTagWithContent, false, false);
        else
            dom.wrapTag(newTag + closeTag, true, true);
	}
}
