<?php
require("inc/stop_cache.php");
$nAdminOnlyPg = 0;
require("inc/secure_page.php");
// connect to mysql
require("../inc/dbconnect.php");
?>
<?php
/*
 * This file is part of Web Pro Manager.
 * 
 * Web Pro Manager is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Web Pro Manager is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Web Pro Manager.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * @author The Web Pro Miami, Inc. <info@thewebpro.com>
 * @copyright The Web Pro Miami, Inc. <info@thewebpro.com>, http://www.thewebpro.com/
 * @license http://www.gnu.org/licenses/gpl.html GNU GPL
 * @package WebProManager
*/

$nFieldName = $_GET["nFieldName"];
$nFormName = $_GET["nFormName"];
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title>Editor</title>
<link href="css/salcms.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="rte/fckeditor.js"></script>
<script>
function sendToParent(){
	var thisEditor = window.FCKeditorAPI.GetInstance('<?php echo $nFieldName?>');
	var dataToMove = thisEditor.GetXHTML(true);
	window.opener.document.<?php echo $nFormName?>.<?php echo $nFieldName?>.value = dataToMove;
	self.close();
}
function initRTE(){
	if(window.FCKeditorAPI){
		var thisEditor = window.FCKeditorAPI.GetInstance('nTextarea_1');
		var dataToMove = "test";
		if(window.opener.document.FormCompEdit.nTextarea_1){
			dataToMove = window.opener.document.FormCompEdit.nTextarea_1.value;
		} else {
			alert('Config error: sending field does not exist or can not be read (window.opener.FormCompEdit.nTextarea_1).');
		}
		thisEditor.SetData(dataToMove);
	}
}
function FCKeditor_OnComplete( editorInstance )
{
	initRTE();
}
</script>
</head>

<body style="background-color: #EEEEEE;" onLoad="">

<form method="post" name="nProdForm" id="nProdForm" onSubmit="sendToParent();return false;" style="margin:0px;">
<script type="text/javascript">
<!--
// load editor
var oFCKeditor = new FCKeditor('<?php echo $nFieldName;?>');
oFCKeditor.BasePath	= 'rte/';
oFCKeditor.Value	= '';
oFCKeditor.Height	= 486;
oFCKeditor.Config['SkinPath'] = 'skins/office2003/';
oFCKeditor.SpellChecker = 'SpellerPages';
oFCKeditor.CustomStyles =
{
	'Red Title'	: {
	Element : 'h3',
	Styles : { 'color' : 'Red', 'font-size' : '24px' }
	},

	'Yellow Title'	: {
	Element : 'h2',
	Styles : { 'color' : 'Yellow', 'font-size' : '14px' }
	}

};
// preload images
oFCKeditor.Config['PreloadImages'] =
	'skins/office2003/images/toolbar.start.gif' + ';' +
	'skins/office2003/images/toolbar.end.gif' + ';' +
	'skins/office2003/images/toolbar.bg.gif' + ';' +
	'skins/office2003/images/toolbar.buttonarrow.gif' ;
oFCKeditor.Create();
//-->
</script>
<div>
	<input type="submit" name="nSave" value=" <?php echo _("Finished"); ?> "> 
	<input type="button" name="nCancel" value=" <?php echo _("Cancel"); ?> " class="contentFormButton" onClick="self.close();">
</div>
</form>
</body>
</html>
<?php require("../inc/db_close.php"); ?>
