<%@ EnableSessionState=False %><% option explicit %>
<!--#include virtual="/NR/Shared/ASPUtils.inc"-->
<!--#include virtual="/NR/Shared/whatbrowser.inc"-->
<!--#include virtual="/NR/System/WBC/Customizable/WBCFuncPagesConfig/UIStringConstants/DHTMLAuthoringPlaceholderUIStrings.inc"-->
<%
' ********************************************************************
' File:		/NR/System/WBC/Internals/PageTemplate/PlaceholdersSupport/
'			DhtmlPlaceholder/Deditor.asp
' Author:	Microsoft Corporation.
' Purpose:	Implements the Dhtml Placeholder
' ********************************************************************

' ********************************************************************
' Copyright (C) 2001 Microsoft Corporation. All rights reserved.
'
'	IMPORTANT.  Please read the legal.txt file, located in the
'	"<CMS Install Directory>\Server\httpexec\WBC\Internals"
'	directory, governing the use of this internal file."
' ********************************************************************
%>

<html id="entirePage">
<head>
<TITLE></TITLE>
<link REL="stylesheet" TYPE="text/css" HREF="./styles.css">
<SCRIPT LANGUAGE=JScript RUNAT=SERVER>
Response.CacheControl = "Public";
var dateNow = new Date();
Response.AddHeader("Last-Modified", dateNow.toGMTString() );
</SCRIPT>
<SCRIPT>
<!--
var myCssText="";
var bLoad=false;
var pureText=true;
var bTextMode=false;
var pParentWindow = null;

public_description=new Editor

function Editor() {
	// setting up the Public methods of this object
  this.put_html=SetHtml;
  this.get_html=GetHtml;

  // Scriptlet-specific code to expose the DOM property. The accessor
  // of this property does so using <placeholder_name>.dom and can
  // script against it using standard IE DHTML.
  this.get_dom=GetDOM;

  this.put_cssText=SetStyle;
  this.get_cssText=GetStyle;
  this.insertHtml=insertHtml;
  this.disableButton=disableButton;
  this.disableDropList=disableDropList;
  this.autosize=autoSize;
  this.setEventHandler=setEventHandler;
  this.disableHtmlEditing=disableHtmlEditing;
  this.setFocusOnPlaceholder=setFocusOnPlaceholder;
}


// Public: called to grab the DOM for the contents of the placeholder.
// Expose the new DOM property to the outside world so that the contents
// of this instance of the DHTML placeholder may be manipulated
function GetDOM() {
	// make sure we return the DOM of the Composition object (DIV tag)
	// and not the root-level DOM, or things won't work right
	return Composition.document;
}


// Public: called to disable a droplist
function disableDropList(name) {
	var obj;
	if (name == 'ParagraphStyle') {
		obj = document.all.ParagraphStyle;
	} else if (name == 'FontName') {
		obj = document.all.FontName;
	} else {
		obj = document.all.FontSize;
	}
	obj.disabled=true;
}

// Public: called to disable a button
function disableButton(name) {
	disableImg(document.all['img'+name]);
	disableBtn(document.all['btn'+name]);
}

// Private: called by disableButton
function disableImg(img) {
	img.style.filter='gray() alpha(opacity=30) dropshadow(OFFX=1, OFFY=1, COLOR=#ffffff)';
}

// Private: called by disableButton
function disableBtn(btn) {
	btn.onclick=YCancelEvent;
	btn.onmouseover=YCancelEvent;
	btn.onmouseout=YCancelEvent;
	btn.onmousedown=YCancelEvent;
	btn.onmouseup=YCancelEvent;
}

function SetStyle(sVal) {
	myCssText = sVal;
}

function GetStyle() {
	return myCssText;
}

// Public: return the current HTML in the edit area
function GetHtml() {
	if (bTextMode)
	{
		// refresh it a couple of times to make it convert all hyperlink
		// into format the ROM expects
		Composition.document.body.innerHTML = Composition.document.body.innerText;
		cleanHtml();
		Composition.document.body.innerText = Composition.document.body.innerHTML;
		return Composition.document.body.innerText;
	}
	else
	{
		cleanHtml();
		return Composition.document.body.innerHTML;
	}
}

// Public: set the current HTML in the edit area
function SetHtml(sVal) {
	var i
	var sString

	sString = "<HTML><HEAD>";
	var coll = parent.document.all.tags("META");
	if (coll!=null)
	{
		for (i=0; i<coll.length; i++)
		{
		  if (coll[i].httpEquiv == "Content-Type")
		  {
		  	// Construct something like the following:
			// 	<meta Http-Equiv="Content-Type" Content="SomeValue">
			var strMetaTag = "<meta Http-Equiv=\"Content-Type\" Content=\"" + coll[i].content + "\">";
		    sString += strMetaTag;
		  }
		}
	}

	sString += "<STYLE type=\"text/css\"><!-- \nbody { \n" + myCssText + "\n } --></style>";
	sString += "</HEAD><BODY alinkColor=" + parent.document.alinkColor + " bgColor=" + parent.document.bgColor + " linkColor=" + parent.document.linkColor + " vlinkColor=" + parent.document.vlinkColor + ">";
	sString += sVal;
	sString += "</BODY></HTML>";

	Composition.document.open();
	Composition.document.write(sString)
	Composition.document.close();
}

function insertHtml(strHtml) {
	var sel = Composition.document.selection;

	// Depending on what's selected, rng will be either a TextRange
	// or a ControlRange. If it's a TR then we can just use PasteHTML
	// but if it's a CR then we need to massage it into a TextRange
	var rng = sel.createRange();
	if (sel.type == "Control") {
		// this seems to only ever return one element in the collection
		// so we'll assume that this is always the case and we can just
		// replace the first element with the new HTML
		rng(0).outerHTML = strHtml;
	} else {
		// create the div and replace it.
		rng.pasteHTML(strHtml);
	}
}

function autoSize() {
  // Setting the HTML element's size resizes the scriptlet.
  // Set the size of the scriptlet to the size of its contents
  document.all.entirePage.style.pixelHeight=document.body.scrollHeight
  document.all.entirePage.style.pixelWidth=document.body.scrollWidth
}

// ---- [Public] For setting up event handlers
function setEventHandler() {
	Composition.document.body.ondrop = FilterClipboardData;
	Composition.document.body.onpaste = FilterClipboardData;
}

// ---- [Public] Disables the HTML checkbox (disallows HTML src editing)
function disableHtmlEditing() {
    document.all('switchMode').disabled=true;
}

// ---- [Public] Focus the placeholder
function setFocusOnPlaceholder() {
	Composition.focus();
}

// -->
</script>

</head>
<script>
document.write("<body onload=\"bLoad=true\" BGCOLOR=" + parent.document.bgColor + " STYLE=\"MARGIN: 0pt; PADDING-BOTTOM: 0pt; PADDING-LEFT: 0pt; PADDING-RIGHT: 0pt; PADDING-TOP: 0pt\">");
</script>
<div class="yToolbar" ID="ParaToolbar">
  <div class="TBHandle"></div>
  <select ID="ParagraphStyle" style="width=80px" class="TBGen" TITLE="<%= IDS_UI_TOOLTIP_DHTML_PARAGRAPH_FORMAT %>" LANGUAGE="javascript" onchange="format('formatBlock',this[this.selectedIndex].value);this.selectedIndex=0">
    <option class="heading" selected>Styles</option>
    <option value="Normal">Normal</option>
    <option value="Heading 1">Heading 1</option>
    <option value="Heading 2">Heading 2</option>
    <option value="Heading 3">Heading 3</option>
    <option value="Heading 4">Heading 4</option>
    <option value="Heading 5">Heading 5</option>
    <option value="Heading 6">Heading 6</option>
  </select>
  <select ID="FontName" style="width=120px" class="TBGen" TITLE="<%= IDS_UI_TOOLTIP_DHTML_FONT_NAME %>" LANGUAGE="javascript" onchange="format('fontname',this[this.selectedIndex].value);this.selectedIndex=0">
    <option class="heading" selected>Font</option>
    <option value="Arial">Arial</option>
    <option value="Arial Black">Arial Black</option>
    <option value="Arial Narrow">Arial Narrow</option>
    <option value="Comic Sans MS">Comic Sans MS</option>
    <option value="Courier New">Courier New</option>
    <option value="System">System</option>
    <option value="Times New Roman">Times New Roman</option>
    <option value="Verdana">Verdana</option>
    <option value="Wingdings">Wingdings</option>
  </select>
  <select ID="FontSize" class="TBGen" TITLE="<%= IDS_UI_TOOLTIP_DHTML_FONT_SIZE %>" LANGUAGE="javascript" onchange="format('fontsize',this[this.selectedIndex].value);this.selectedIndex=0">
    <option class="heading" selected>Size</option>
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    <option value="5">5</option>
    <option value="6">6</option>
    <option value="7">7</option>
  </select>
  <div class="TBSep"></div>
	<div class="Btn" id="btnImage" TITLE="<%= IDS_UI_TOOLTIP_DHTML_INSERT_IMAGE %>" LANGUAGE="javascript" onclick="launchImageGallery()">
	    <img class=Ico id="imgImage" src="./Images/image.gif">
	</div>
	<div class="Btn" id="btnVideo" TITLE="<%= IDS_UI_TOOLTIP_DHTML_INSERT_VIDEO %>" LANGUAGE="javascript" onclick="launchVideoGallery()">
		<img class=Ico id="imgVideo" src="./Images/video.gif">
	</div>
	<div class="Btn" id="btnAttachment" TITLE="<%= IDS_UI_TOOLTIP_DHTML_INSERT_ATTACHMENT %>" LANGUAGE="javascript" onclick="launchAttachmentGallery()">
		<img class=Ico id="imgAttachment" src="./Images/attachment.gif">
	</div>
  <div class="TBSep"></div>
	<div class="Btn" id="btnTable" TITLE="<%= IDS_UI_TOOLTIP_DHTML_INSERT_TABLE %>" LANGUAGE="javascript" onclick="createTable()">
		<IMG class=Ico id="imgTable" src="./Images/table.gif">
	</div>
	<div class="Btn" id="btnHlink" TITLE="<%= IDS_UI_TOOLTIP_DHTML_EDIT_HYPERLINK %>" LANGUAGE="javascript" onclick="createLink()">
		<IMG class=Ico id="imgHlink" src="./Images/wlink.gif">
	</div>
  <div class="TBSep"></div>
  <div ID="EditMode" class="TBGen" style="WIDTH: 90px" TITLE="<%= IDS_UI_TOOLTIP_DHTML_EDIT_SOURCE %>">
    <input type="checkbox" name="switchMode" LANGUAGE="javascript" onclick="setMode(switchMode.checked)">HTML
  </div>
</div>

<div class="yToolbar" ID="FormatToolbar">
  <div class="TBHandle"></div>
  <div class="Btn" id="btnCut" TITLE="<%= IDS_UI_TOOLTIP_DHTML_CUT %>" LANGUAGE="javascript" onclick="format('cut')">
    <IMG class=Ico id="imgCut" src="./Images/cut.gif">
  </div>
  <div class="Btn" id="btnCopy" TITLE="<%= IDS_UI_TOOLTIP_DHTML_COPY %>" LANGUAGE="javascript" onclick="format('copy')">
    <IMG class=Ico id="imgCopy" src="./Images/copy.gif">
  </div>
  <div class="Btn" id="btnPaste" TITLE="<%= IDS_UI_TOOLTIP_DHTML_PASTE %>" LANGUAGE="javascript" onclick="format('paste')">
    <IMG class=Ico id="imgPaste" src="./Images/paste.gif">
  </div>
  <div class="TBSep"></div>
<% If browserVer < 5 Then %>
  <div class="Btn" id="btnUndo" TITLE="<%= IDS_UI_TOOLTIP_DHTML_UNDO_AVAILABLE %>" LANGUAGE="javascript" onclick="format('undo')">
    <IMG class=Ico id="imgUndo" src="./Images/undo.gif">
  </div>
  <div class="Btn" id="btnRedo" TITLE="<%= IDS_UI_TOOLTIP_DHTML_REDO_AVAILABLE %>" LANGUAGE="javascript" onclick="format('redo')">
    <IMG class=Ico id="imgRedo" src="./Images/redo.gif">
  </div>
<% Else %>
  <div class="Btn" id="btnUndo" TITLE="<%= IDS_UI_TOOLTIP_DHTML_UNDO %>" LANGUAGE="javascript" onclick="format('undo')">
    <IMG class=Ico id="imgUndo" src="./Images/undo.gif">
  </div>
  <div class="Btn" id="btnRedo" TITLE="<%= IDS_UI_TOOLTIP_DHTML_REDO %>" LANGUAGE="javascript" onclick="format('redo')">
    <IMG class=Ico id="imgRedo" src="./Images/redo.gif">
  </div>
<% End If %>
  <div class="TBSep"></div>
  <div class="Btn" id="btnBold" TITLE="<%= IDS_UI_TOOLTIP_DHTML_BOLD %>" LANGUAGE="javascript" onclick="format('bold');">
    <IMG class=Ico id="imgBold" src="./Images/bold.gif">
  </div>
  <div class="Btn" id="btnItalic" TITLE="<%= IDS_UI_TOOLTIP_DHTML_ITALIC %>" LANGUAGE="javascript" onclick="format('italic')">
    <IMG class=Ico id="imgItalic" src="./Images/italic.gif">
  </div>
  <div class="Btn" id="btnUnderline" TITLE="<%= IDS_UI_TOOLTIP_DHTML_UNDERLINE %>" LANGUAGE="javascript" onclick="format('underline')">
    <IMG class=Ico id="imgUnderline" src="./Images/under.gif">
  </div>
  <div class="TBSep"></div>
  <div class="Btn" id="btnFgColor" TITLE="<%= IDS_UI_TOOLTIP_DHTML_FOREGROUND_COLOR %>" LANGUAGE="javascript" onclick="foreColor()">
    <IMG class=Ico id="imgFgColor" src="./Images/tpaint.gif">
  </div>
  <div class="Btn" id="btnBgColor" TITLE="<%= IDS_UI_TOOLTIP_DHTML_BACKGROUND_COLOR %>" LANGUAGE="javascript" onclick="backColor()">
    <IMG class=Ico id="imgBgColor" src="./Images/parea.gif">
  </div>
  <div class="TBSep"></div>
  <div class="Btn" id="btnAlignLeft" TITLE="<%= IDS_UI_TOOLTIP_DHTML_ALIGN_LEFT %>" NAME="Justify" LANGUAGE="javascript" onclick="format('justifyleft')">
    <IMG class=Ico id="imgAlignLeft" src="./Images/aleft.gif">
  </div>
  <div class="Btn" id="btnAlignCenter" TITLE="<%= IDS_UI_TOOLTIP_DHTML_ALIGN_CENTER %>" NAME="Justify" LANGUAGE="javascript" onclick="format('justifycenter')">
    <IMG class=Ico id="imgAlignCenter" src="./Images/center.gif">
  </div>
  <div class="Btn" id="btnAlignRight" TITLE="<%= IDS_UI_TOOLTIP_DHTML_ALIGN_RIGHT %>" NAME="Justify" LANGUAGE="javascript" onclick="format('justifyright')">
    <IMG class=Ico id="imgAlignRight" src="./Images/aright.gif">
  </div>
  <div class="TBSep"></div>
  <div class="Btn" id="btnNumList" TITLE="<%= IDS_UI_TOOLTIP_DHTML_NUMBERED_LIST %>" LANGUAGE="javascript" onclick="format('insertorderedlist')">
    <IMG class=Ico id="imgNumList" src="./Images/nlist.gif">
  </div>
  <div class="Btn" id="btnBulList" TITLE="<%= IDS_UI_TOOLTIP_DHTML_BULLETED_LIST %>" LANGUAGE="javascript" onclick="format('insertunorderedlist')">
    <IMG class=Ico id="imgBulList" src="./Images/blist.gif">
  </div>
  <div class="TBSep"></div>
  <div class="Btn" id="btnDecIndent" TITLE="<%= IDS_UI_TOOLTIP_DHTML_DECREASE_INDENT %>" LANGUAGE="javascript" onclick="format('outdent')">
    <IMG class=Ico id="imgDecIndent" src="./Images/ileft.gif">
  </div>
  <div class="Btn" id="btnIncIndent" TITLE="<%= IDS_UI_TOOLTIP_DHTML_INCREASE_INDENT %>" LANGUAGE="javascript" onclick="format('indent')">
    <IMG class=Ico id="imgIncIndent" src="./Images/iright.gif">
  </div>
</div>
<IFRAME src="IFrameEmpty.htm"
	class="Composition"
	width="<%= CLng(Request.QueryString("width")) - 1 %>"
	ID="Composition"
	height="<%= CLng(Request.QueryString("height")) - 55 %>">
</IFRAME>

<SCRIPT>
<!--
Composition.document.designMode="On";
// -->
</SCRIPT>

<script LANGUAGE="Javascript" SRC="./compose.js"></script>
</body>
</html>
