<?php require '../public/system/headers/headers.php';?>
<?php $this->headLink()->appendStylesheet($this->websiteUrl . 'system/css/seotoaster.css'); ?>
<?php $this->headLink()->appendStylesheet($this->websiteUrl . 'system/css/datepicker/datepicker.css'); ?>
<?php $this->headLink()->appendStylesheet($this->websiteUrl . 'system/js/thickbox/thickbox.css'); ?>
<?php echo $this->headLink(); ?>
<?php $this->headScript()->appendFile($this->websiteUrl . 'system/js/jquery/jquery.js'); ?>
<?php $this->headScript()->appendFile($this->websiteUrl . 'system/js/thickbox/thickbox.js'); ?>
<?php $this->headScript()->appendFile($this->websiteUrl . 'system/js/jquery/plugins/core.js'); ?>
<?php $this->headScript()->appendFile($this->websiteUrl . 'system/js/jquery/plugins/datepicker.js'); ?>
<?php //$this->headScript()->appendFile($this->websiteUrl . 'system/js/tiny_mce/tiny_mce_gzip.js'); ?>
<?php $this->headScript()->appendFile($this->websiteUrl . 'system/js/tiny_mce/tiny_mce.js'); ?>
<?php $this->headScript()->appendFile($this->websiteUrl . 'system/js/tiny_mce/jquery.tinymce.js'); ?>
<?php $this->headScript()->appendFile($this->websiteUrl . 'system/js/system.js'); ?>
<?php $this->headScript()->appendFile($this->websiteUrl . 'system/js/wheel/wheel.js'); ?>
<?php $this->headScript()->appendFile($this->websiteUrl . 'system/js/shoppingforcontent/shoppingforcontent.js'); ?>
<?php echo $this->headScript(); ?>
<!--script type="text/javascript">tinyMCE_GZ.init({plugins : 'safari,preview,spellchecker,media', themes : 'simple,advanced', languages : 'en', disk_cache : true, debug : false});</script-->
<script type="text/javascript">
function toggleEditor(id)
{
    if (!tinyMCE.getInstanceById(id)) {
        tinyMCE.execCommand('mceAddControl', false, id);
    } else {
        tinyMCE.execCommand('mceRemoveControl', false, id);
    }
 }
	$(document).ready(function(){
        Sc.init({websiteurl:'<?php echo $this->websiteUrl; ?>'});
        Sc.tabForContent();
		// Creates a new plugin class and a custom listbox
		tinymce.create('tinymce.plugins.ExamplePlugin', {
			createControl: function(n, cm) {
				switch (n) {
					case 'variables':
						var mlb = cm.createListBox('variables', {
							title : 'Widgets',
							onselect : function(v) { $('textarea.tinymce').tinymce().execCommand('mceInsertContent',false, v); }
						});

						// Add some values to the list box
						mlb.add('{$page_title}', '{$page_title}');
						mlb.add('{$page_h1}', '{$page_h1}');
						mlb.add('{$main_menu}', '{$main_menu}');
						//mlb.add('{$main_menu_jq}', '{$main_menu_jq}');
						mlb.add('{$static_menu}', '{$static_menu}');
						mlb.add('{$pages_list}', '{$pages_list}');
						mlb.add('{$categories_list}', '{$categories_list}');
						mlb.add('{$categories_list_img}', '{$categories_list_img}');
						mlb.add('{$sitemap}', '{$sitemap}');
						mlb.add('{$pages_list_img}', '{$pages_list_img}');
						mlb.add('{$category_name}', '{$category_name}');
						mlb.add('{$website_url}', '{$website_url}');
						mlb.add('{$newsscroller}', '{$newsscroller}');
						mlb.add('{$search_result}', '{$search_result}');
						mlb.add('{$search_result_img}', '{$search_result_img}');
						mlb.add('{$social_bookmarks_block}','{$social_bookmarks_block}');




						//get additional variables
						jQuery.ajax({
							type: "get",
							url: '<?php echo $this->websiteUrl; ?>sys/backend_ajax/getvars',
							success: function(response) {
								if(response !== 'no_vars') {
									var varNames = eval('(' + response + ')')
									for(var i=0; i<=(varNames.length - 1); i++) {
										mlb.add('{$' + varNames[i] + '}', '{$' + varNames[i] + '}');
										if(varNames[i] == 'rssfeed:all'){
											mlb.add('{$news_aggregator_block}','{$news_aggregator_block}');
										}
									}
								}
							}
						});
						// Return the new listbox instance
						return mlb; }
					return null; }
			});
			// Register plugin with a short name
			tinymce.PluginManager.add('example', tinymce.plugins.ExamplePlugin);
			$('textarea.tinymce').tinymce({
				script_url : '<?php echo $this->websiteUrl; ?>system/js/tiny_mce/tiny_mce.js',
				mode: "exact",
				elements : "admincontentarea",
				width: 620,
				height: 506,
				theme : "advanced",
				convert_urls: 0,
				plugins : "safari,preview,spellchecker,fullscreen,media,example",
				content_css: "<?php echo $this->websiteUrl; ?>themes/<?php echo $this->currTheme; ?>/content.css",
				theme_advanced_buttons1 : "bold,italic,underline,|,"
					+"justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,formatselect,styleselect,fontsizeselect,forecolor,|,"
					+"link,unlink,anchor,hr",
				theme_advanced_buttons2 : "charmap,image,media,|,variables,|,fullscreen,preview,spellchecker,|,undo,redo,|,removeformat,cleanup,code",
				theme_advanced_buttons3 : "",
				spellchecker_languages : "+English=en,French=fr,German=de,Hebrew=iw,Italian=it,Polish=pl,Portuguese (Brazil)=pt-BR,"
					+"Portuguese (Portugal)=pt-PT,Russian=ru,Spanish=es,Ukrainian=uk",
				spellchecker_rpc_url: '<?php echo $this->websiteUrl; ?>system/js/tiny_mce/plugins/spellchecker/rpc.php',
				theme_advanced_blockformats: "p,address,pre,h2,h3,h4,h5,h6",
				theme_advanced_toolbar_location : "top",
				theme_advanced_toolbar_align : "left",
				extended_valid_elements : "iframe[width|height|frameborder|scrolling|marginheight|marginwidth|src]",
				external_link_list_url : "<?php echo $this->websiteUrl; ?>system/js/tiny_mce/link_list.js" });
		});
		$(function() { $('#datepicker').datepicker({ dateFormat: 'mm-dd-yy' }); $("#datepicker").datepicker(); });
</script>

<div id="seotoaster" class="inspired" style="display:none;">
	<div id="ajaxBusy" class="success" style="display:none;">Querying Google wheel. Please wait...</div>
	<div class="close_window" onclick="backToPage();"></div>
	<div id="inspired-errors" class="errors"  style="display:none;cursor:pointer;">
		<ul>
			<li id="search-empty" style="display:none;"><strong>Search field can't be empty.</strong></li>
		</ul>
	</div>
	<div id="admineditwhat">{%Get Inspired%}</div>
	<p>
		<?php echo $this->inspiredForm; ?>
	</p>
	<div class="words-list"></div>
</div>
<div id="seotoaster" class="editor">
	<div class="admineditwhat">{%Content%}</div>
	<div class="close_window" onclick="parent.tb_remove();"></div>
	<?php echo $this->form; ?>
	<div id="selector">
		<div id="borderfortoolbar">
			<!--  right toolbar -->
			<div id="adminthingsviewer">
				<!-- small images -->
				<div id="small" class="button" onclick="showDiv(this.id);">{%Small%} <span>(<?php echo $this->widthSmallImg; ?>px)</span></div>
				<div id="images_small" class="hide"></div>
				<!-- end small images -->
				<!-- medium images -->
				<div id="medium" class="button" onclick="showDiv(this.id);">{%Medium%} <span>(<?php echo $this->widthMediumImg; ?>px)</span></div>
				<div id="images_medium" class="hide"></div>
				<!-- end medium images -->
				<!-- large images -->
				<div id="large" class="button" onclick="showDiv(this.id);">{%Large%} <span>(<?php echo $this->widthLargeImg; ?>px)</span></div>
				<div id="images_large" class="hide"></div>
				<!-- end large images -->
				<!-- video -->
				<div id="original" class="button" onclick="showDiv(this.id);">{%Original%}</div>
				<div id="images_original" class="hide"></div>
				<!-- end video -->
				<!-- list files -->
				<div id="files" class="button" onclick="showDiv(this.id);">{%Files%}</div>
				<div id="list_files" class="hide">
					<?php if(!empty($this->downloadFiles ) && is_array($this->downloadFiles )): ?>
						<?php foreach ($this->downloadFiles as $fileName): ?>
					<p><a href="javascript:;" title="<?php echo Default_View_Helper_ToolsHelper::cropType($fileName); ?>" onmousedown="$('#admincontentarea').tinymce().execCommand('mceInsertContent',false, '<a href=\'<?php echo $this->websiteUrl . 'downloads/' . $fileName; ?>\' title=\'<?php echo Default_View_Helper_ToolsHelper::cropType($fileName); ?>\'><?php echo $fileName; ?></a>');">
								<?php echo $fileName; ?></a></p>
						<?php endforeach; ?>
					<?php endif; ?>
				</div>
				<!-- end list files -->
				<!--  widgets maker -->
				<div id="variables_maker" class="button" onclick="showDiv(this.id);">{%Widgets Maker%}</div>
				<div id="content_variables_maker" class="hide">
					<!-- featured areas -->
					<h3>{%Featured Areas%}</h3>
					<form action="javascript:;" onsubmit="insertFeaturedAreasInContent(this);">
						<p align="left" style="margin-top:10px;"><span>{%select%} </span>
							<select name="list_featured_areas" id="list_featured_areas">
								<?php if(!empty($this->fa) && is_array($this->fa)): ?>
									<?php foreach($this->fa as $fa): ?>
								<option value="<?php echo $fa; ?>"><?php echo $fa; ?></option>
									<?php endforeach; ?>
								<?php endif; ?>
							</select></p>
						<p align="left" style="padding:5px 0px 5px 0px;">
							<span style="margin-right:25px;">{%max results:%}</span>
							<input type="text" style="width:30px;" name="featured_areas_max" id="featured_areas_max" value="4" onfocus="this.select();" />
						</p>
						<p align="left" style="padding:5px 0px 5px 0px;">
							<span>{%max characters:%} </span>
							<input type="text" style="width:30px;" name="featured_areas_max_characters" id="featured_areas_max_characters" value="200" onfocus="this.select();" />
						</p>
						<p align="left" style="padding:5px 0px 5px 0px;">
							<span> {%use image?%}</span>
							<input type="checkbox" name="featured_areas_img" id="featured_areas_img" />
							<span> {%random?%}</span>
							<input type="checkbox" name="featured_areas_random" id="featured_areas_random" />
						</p>

						<input type="submit" class="submitform" value="{%Apply%}" />
						<div style="clear:both;"></div>
					</form>
					<!-- end featured areas -->
					<!-- related -->
					<hr class="hrseparate" />
					<h3>{%Related Pages List%}</h3>
					<form action="javascript:;" onsubmit="insertRelatedInContent(this);">
						<p align="left"><span>{%relevance:%} </span>
							<input type="text" style="width:30px;" name="related_count_keywords" id="related_count_keywords"/>
							<span> {%keywords.%}</span></p>
						<p align="left" style="margin-top:5px;">
							<span>{%max results:%} </span><input type="text" style="width:30px;" name="related_max" id="related_max" value="" />
							<input type="checkbox" name="related_img" id="related_img" /><span> {%use image?%}</span></p>
						<input type="submit" class="submitform" value="{%Apply%}" />
						<div style="clear:both;"></div>
					</form>
					<!-- end related -->
					<!-- gallery -->
					<hr class="hrseparate" />
					<h3>{%Image Gallery%}</h3>
					<form action="javascript:;" onsubmit="insertGallery(this, '<?php echo $this->websiteUrl; ?>');">
						<p align="left" style="margin-top:10px;"><span>{%new gallery:%} </span><input type="text" style="width:100px;" id="gallery_name" name="gallery_name" value="" onkeyup="if(this.value != ''){this.form.list_galleries.disabled='disabled';}else{this.form.list_galleries.disabled='';}" /></p>
						<p align="left" style="margin-top:10px;"><span>{%or%} </span>
							<select name="list_galleries" id="list_galleries" onchange="loadSettingsForGallery(this.options[this.selectedIndex].value, this.form, '<?php echo $this->websiteUrl; ?>');">
								<option value="" selected="selected">{%select gallery%}</option>
								<?php if(!empty($this->galleries) && is_array($this->galleries)): ?>
									<?php foreach($this->galleries as $gallery): ?>
								<option value="<?php echo $gallery; ?>"><?php echo $gallery; ?></option>
									<?php endforeach; ?>
								<?php endif; ?>
							</select></p>
						<p style="margin-top:5px;">&nbsp;<input type="checkbox" name="gallery_lightbox" id="gallery_lightbox" /><span>  {%use lightbox?%}</span></p>
						<p align="left" style="margin-top:5px;"><span>{%images thumbnails size:%}</span><input type="text" style="width:30px;" id="gallery_thumbnails" name="gallery_thumbnails" value="" /></p>
						<p style="margin-top:5px;">&nbsp;<input type="checkbox" name="gallery_crop" id="gallery_crop" /><span> {%crop image?%}</span>
							<input type="checkbox" style="margin-left:10px;" name="gallery_caption" id="gallery_caption" /><span> {%caption?%}</span></p>
						<input type="submit" class="submitform" value="{%Apply%}" />
						<div style="clear:both;"></div>
					</form>
					<!-- end gallery -->
					<!-- payment button -->
					<!--
					<hr class="hrseparate" />
					<h3>{%Payment Button%}</h3>
					<form action="javascript:;" onsubmit="insertPaymentButtonInContent(this, '<?php echo $this->websiteUrl; ?>');">
					<p align="left" style="margin-top:10px;"><span>{%new:%}</span> <input type="text" style="width:120px;" id="payment_name" name="payment_name" value="" /></p>
					<p align="left" style="margin-top:10px;"><span>{%or%} </span>
					<select name="list_payment" style="width:170px;" id="list_payment" onchange="loadContentForPaymentButton(this ,'<?php echo $this->websiteUrl; ?>');">
						<option value="" selected="selected">{%select payment button%}</option>
					<?php if(!empty($this->variables) && is_array($this->variables)): ?>
						<?php foreach($this->variables as $variable): ?>
							<option value="<?php echo $variable['name']; ?>"><?php echo $variable['name']; ?></option>
						<?php endforeach; ?>
					<?php endif; ?>
					</select></p>
					<p align="left" style="margin-top:5px;"><textarea cols="27" rows="7" name="payment_content" id="payment_content"></textarea></p>
					<input type="submit" class="submitform" value="{%Apply%}" />
					<div style="clear:both;"></div>
					</form>
					-->
					<!-- end payment button -->

					<!-- comment -->
					<hr class="hrseparate" />
					<h3>{%Commenting System%}</h3>
					<form action="javascript:;" onsubmit="insertCommentInContent(this, '<?php echo $this->websiteUrl; ?>');">
						<!--
						 <p align="left" style="margin-top:10px;"><span>{%topic:%}</span> <input type="text" style="width:100px;" id="comment_topic" name="comment_topic" value="" /></p>
						 <p align="left" style="margin-top:5px;"><span>{%keyword:%} </span> <input type="text" style="width:100px;" id="comment_keyword" name="comment_keyword" value="" /></p>
						-->
						<p align="left" style="margin-top:5px;"><span>{%count on page:%} </span> <input type="text" style="width:30px;" id="comment_count" name="comment_count" value="4" onfocus="this.value='';" /><input type="checkbox" checked="checked" style="margin-left:5px;" name="comment_publish" id="comment_publish" /><span> {%publish?%}</span></p>
						<input type="hidden" name="container_name" id="container_name" value="<?php echo $this->containerName; ?>" />
						<input type="submit" class="submitform" value="{%Apply%}" />
						<div style="clear:both;"></div>
					</form>
					<!-- end comment -->

					<!-- Form Maker -->
					<hr class="hrseparate" />
					<h3>{%Forms%}</h3>
					<form action="javascript:void(0);" onsubmit="insertForm(this, '<?php echo $this->websiteUrl; ?>');">
						<p align="left" style="margin-top:10px;">
							<span>{%new form:%} </span>
							<input type="text" style="width:100px;" id="formname" name="formname" value="" onkeyup="if(this.value != ''){this.form.forms_list.disabled='disabled';}else{this.form.forms_list.disabled='';}" />
						</p>
						<p align="left" style="margin-top:10px;">
							<span>{%or%}</span>
							<select name="forms_list" id="forms_list" >
								<option value="" selected="selected">{%select form%}</option>
								<?php if(!empty($this->forms) && is_array($this->forms)): ?>
									<?php foreach($this->forms as $form): ?>
								<option value="<?php echo trim($form); ?>"><?php echo trim($form); ?></option>
									<?php endforeach; ?>
								<?php endif; ?>
							</select></p>
						<p style="margin-top:5px;">&nbsp;<input type="checkbox" name="formcaptcha" id="formcaptcha" /><span>  {%use captcha?%}</span></p>
						<input type="submit" class="submitform" value="{%Apply%}" />
						<div style="clear:both;"></div>
					</form>
					<!-- End Form Maker -->

					<!-- Search Maker -->
					<hr class="hrseparate" />
					<h3>{%Add Search Engine%}</h3>
					<form action="javascript:void(0);" onsubmit="insertSearch(this, '<?php echo $this->currentPageId;?>','<?php echo htmlspecialchars($this->currentNavigationName);?>');">
						<p align="left" style="margin-top:10px;">
							<span>{%Select search result page:%}</span>
							<select name="pages_list" id="pages_list" >
								<option value="this page" selected="selected">{%this page%}</option>
								<?php if(!empty($this->pages) && is_array($this->pages)): ?>
									<?php foreach($this->pages as $key=>$page): ?>
								<option value="<?php echo $key; ?>"><?php echo trim($page); ?></option>
									<?php endforeach; ?>
								<?php endif; ?>
							</select></p>
						<input type="submit" class="submitform" value="{%Apply%}" />
						<div style="clear:both;"></div>
					</form>
					<!-- End Search Maker -->

					<!-- Swapper -->
					<hr class="hrseparate" />
					<h3>{%Image Rotator%}</h3>
					<form action="javascript:void(0);" onsubmit="insertSwapper(this);">
						<p align="left" style="margin-top:10px;">
							<select name="folder" style="width:120px;">
								<option value="" selected="selected">{%select folder%}</option>
								<?php if(!empty($this->listFolders) && is_array($this->listFolders)): ?>
									<?php foreach($this->listFolders as $folderName): ?>
								<option value="<?php echo trim($folderName); ?>"><?php echo $folderName; ?></option>
									<?php endforeach; ?>
								<?php endif; ?>
							</select></p>

							<p style="margin:5px 0px 6px 1px;">
							<span style="margin-right:3px;">{%max width:%}</span>
							<input type="text" id="imgWidth" name="imgWidth" style="width:35px;" onchange="setHeight();" />
							<span>{%px%}</span>&nbsp;
							</p>

							<p>
								<span>{%max height:%}</span>
								<input type="text" id="imgHeight" name="imgHeight" style="width:35px;" />
								<span>{%px%}</span>
							</p>

						<p style="margin:5px 0px 6px 1px;">
							<input type="checkbox" name="slideshow">
							<span>{%slide show?%}</span>
							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
							<span>{%time:%} </span>
							<input type="text" name="time" style="width:35px;" />
							<span>{%sec%}</span>
						</p>
						<input type="submit" class="submitform" value="{%Apply%}" />
						<div style="clear:both;"></div>
					</form>
					<!-- End Swapper -->
					<!-- External RSS -->
					<hr class="hrseparate" />
					<h3>{%Externall RSS%}</h3>
					<form action="javascript:;" onsubmit="insertExternalRSS(this);">
						<p align="left" style="padding:5px 0px 5px 0px;">
							<span style="margin-right:0px;">{%url:%}</span>
							<input type="text" style="width:180px;" name="url" id="url" value="" onfocus="this.select();" />
						</p>

						<p align="left" style="padding:5px 0px 5px 0px;">
							<span style="margin-right:39px;">{%max result:%}</span>
							<input type="text" style="width:40px;" name="max_result" id="max_result" value="4" onfocus="this.select();" />
						</p>

						<p align="left" style="padding:5px 0px 5px 0px;">
							<span style="margin-right:5px;">{%max characters:%}</span>
							<input type="text" style="width:40px;" name="max_characters" id="max_characters" value="" onfocus="this.select();" />
						</p>

						<input type="submit" class="submitform" value="{%Apply%}" />
						<div style="clear:both;"></div>
					</form>
					<!-- External RSS -->
					<!-- Pageslist -->
					<!--  <hr class="hrseparate" />
					  <h3>{%Pages list%}</h3>
					  <form action="javascript:void(0);" onsubmit="insertPagesList(this);">
					  <p align="left" style="margin-top:10px;">
					  <select name="categories">
						  <option value="" selected="selected">{%select category%}</option>
					<?php //if(!empty($this->listCategories) && is_array($this->listCategories)): ?>
					<?php //foreach($this->listCategories as $categoryName): ?>
							  <option value="<?php //echo trim($categoryName); ?>"><?php //echo $categoryName; ?></option>
					<?php //endforeach; ?>
					<?php //endif; ?>
					  </select></p>
					  <p align="left" style="margin-top:5px;"><input type="checkbox" name="pagesWithImage"> <span>{%with iamge?%}</span></p>
					  <input type="submit" class="submitform" value="{%Apply%}" />
					  <div style="clear:both;"></div>
					  </form> -->
					<!-- End Pageslist -->

				</div>
				<!-- end widgets maker -->
				<!-- upload things -->
				<div id="upload_things_button" class="button" onclick="tb_show('','<?php echo $this->websiteUrl; ?>sys/backend_things/uploadthings/?TB_iframe=true&height=580&width=600');">{%Upload Things%}</div>
				<!-- end upload things -->
			</div></div></div>
	<!-- list folders -->
	<select name="adminselectimgfolder" id="adminselectimgfolder" onchange="loadImages('<?php echo $this->websiteUrl; ?>',this.value);">
		<option value="" selected="selected">{%select folder%}</option>
		<?php if(!empty($this->listFolders) && is_array($this->listFolders)): ?>
			<?php foreach($this->listFolders as $folderName): ?>
		<option value="<?php echo $folderName; ?>"><?php echo $folderName; ?></option>
			<?php endforeach; ?>
		<?php endif; ?>
	</select>
	<input type="hidden" id="hid-main-wsurl" name="hid-main-wsurl" value="<?php echo $this->websiteUrl; ?>" />
	<a id="toogletinymce" href="javascript:void(0);" onclick="toggleEditor('admincontentarea');" title="{%No Editor%}">{%No Editor%}</a>
	<!-- end list folders -->
	<!-- end right toolbar -->
    <div class="tabtools" id="tabtools"><!--span title="show content" style="border-right:2px solid #7c7c7c;" class="active">Content</span><span title="show shopping">Shopping</span--></div>
    <div class="tabshopping" id="tabshopping">
        <div class="shoppingcategories">
            <p class="title">Categories</p>
            <div class="data" id="shoppinggroups" style="height:80px;"></div>
            <p class="title">Brands</p>
            <div class="data" id="shoppingbrands" style="height:60px;"></div>
            <p align="right"><span class="apply" onclick="Sc.addVariableProductCategory();">Create list</span></p>
        </div>
        <div class="shoppingseparate"><p>Per Product</p></div>
        <div class="shoppingproducts" id="shoppingproducts"></div>
    </div>
</div>