<?php
/**
 * Pro Super Slider
 *This program 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.
 *
 *This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 *@author ProJoom
 *@copyright (C) 2008 - 2012 ProJoom
 *@link http://www.projoom.com/extensions/pro-super-slider.html Official website
 **/
defined('_JEXEC') or die;
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');
?>
<script type="text/javascript">
	Joomla.submitbutton = function(task)
	{
		if (task == 'slide.cancel' || document.formvalidator.isValid(document.id('slide-form'))) {
			Joomla.submitform(task, document.getElementById('slide-form'));
		}
	};
    Preview = function()
    {
        address = "<?php echo JURI::root(); ?>";
        thediv = document.getElementById("picbox");
        pic = document.getElementById("jform_nssjpg").value;
        thediv.innerHTML = '<img src="' + address + pic + '" style="max-width: 400px; max-height: 400px; width: expression(this.width > 400 ? 400: true); height: expression(this.height > 400 ? 400: true);"/>';
    }
    addPicture = function(pic)
    {
        if (pic != "Select Picture"){
            document.getElementById('jform_nssjpg').value = "images/pss/" + pic;
            Preview();
        }
    }
    function jSelectArticle(id, title, catid, object) {
			document.getElementById("jform_nssurl").value = id + '|' + title;
			SqueezeBox.close();
	}
</script>
<form action="<?php echo JRoute::_('index.php?option=com_novass&layout=edit&id='.(int) $this->item->id); ?>" method="post" name="adminForm" id="slide-form" class="form-validate">
	<div class="width-60 fltlft">
		<fieldset class="adminform">
			<legend><?php echo empty($this->item->id) ? JText::_('New Slide') : JText::sprintf('Details', $this->item->id); ?></legend>
			<ul class="adminformlist">
				<li><?php echo $this->form->getLabel('name'); ?>
				<?php echo $this->form->getInput('name'); ?></li>

                <li><?php echo $this->form->getLabel('catid'); ?>
				<?php echo $this->form->getInput('catid'); ?></li>

                <li><?php echo $this->form->getLabel('nsstit'); ?>
				<?php echo $this->form->getInput('nsstit'); ?></li>

                <li><?php echo JText::_('<label id="jform_picture-lbl" for="jform_picture" class="hasTip required" title="">Stored Picture</label>'); ?>
				<?php echo JText::_('<select id="jform_picture" name="jform[picture]" class="inputbox" style="float:left;" onchange="addPicture(this.value);">
								<option>Select Picture</option>');
								$dir = JPATH_ROOT . "/images/pss";
    							$farray = @JFolder::files($dir, $filter = '.');
                                if (!empty($farray)){
                                    foreach ($farray as $file) {
    								    echo '<option value="'.$file.'">'.$file.'</option>';
    							     }
                                }

                                echo '</select>';
                ?></li>

                <li><?php echo $this->form->getLabel('nssjpg'); ?>
				<?php echo $this->form->getInput('nssjpg'); ?></li>

                <li><?php echo $this->form->getLabel('nssdesc'); ?>
				<?php echo $this->form->getInput('nssdesc'); ?></li>

                <li><?php echo $this->form->getLabel('nsstimer'); ?>
				<?php echo $this->form->getInput('nsstimer'); ?></li>

				<li><?php echo $this->form->getLabel('nssurl'); ?>
				<?php echo $this->form->getInput('nssurl'); ?><div class="button2-left"><div class="article"><a class="modal" title="Article" href="index.php?option=com_content&amp;view=articles&amp;layout=modal&amp;tmpl=component" onclick="IeCursorFix(); return false;" rel="{handler: 'iframe', size: {x: 770, y: 400}}">Article</a></div></div></li>

                <li><?php echo $this->form->getLabel('nsstgt'); ?>
				<?php echo $this->form->getInput('nsstgt'); ?></li>

				<li><?php echo $this->form->getLabel('type'); ?>
				<?php echo $this->form->getInput('type'); ?></li>

				<li><?php echo $this->form->getLabel('state'); ?>
				<?php echo $this->form->getInput('state'); ?></li>

				<li><?php echo $this->form->getLabel('id'); ?>
				<?php echo $this->form->getInput('id'); ?></li>
			</ul>
			<div class="clr"> </div>

		</fieldset>
	</div>

<div class="width-40 fltrt">
	<?php echo JHtml::_('sliders.start','slide-sliders-'.$this->item->id, array('useCookie'=>1)); ?>

	<?php echo JHtml::_('sliders.panel',JText::_('Preview'), 'preview'); ?>
		<fieldset class="panelform">
		<ul class="adminformlist">
			 <?php echo JText::_('<div class="button2-left">
                        <div class="blank"><a title="Preview" href="#" onclick="Preview()">Preview</a></div>
                    </div>
                    <div id="picbox"> </div>') ?>
			</ul>
		</fieldset>
	<?php echo JHtml::_('sliders.end'); ?>
	<input type="hidden" name="task" value="" />
	<?php echo JHtml::_('form.token'); ?>
</div>

<div class="clr"></div>
</form>
