<?php

/**

* @version		1.1

* @package		DJ Classifieds

* @subpackage	DJ Classifieds Component

* @copyright	Copyright (C) 2010 Blue Constant Media LTD, All rights reserved.

* @license		http://www.gnu.org/licenses GNU/GPL

* @autor url    http://design-joomla.eu

* @autor email  contact@design-joomla.eu

* @Developer    Lukasz Ciastek - lukasz.ciastek@design-joomla.eu

* 

* 

* DJ Classifieds 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.

*

* DJ Classifieds 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 DJ Classifieds. If not, see <http://www.gnu.org/licenses/>.

* 

*/



defined ('_JEXEC') or die('Restricted access');

$document=& JFactory::getDocument();

$js=JURI::base();

$js .= '/components/com_djclassifieds/views/showitem/tmpl/';

JHTML::_('behavior.mootools');

//$document->addScript($js.'slimbox/mootools.js');

$document->addScript($js.'slimbox/slimbox.js');

$par = &JComponentHelper::getParams( 'com_djclassifieds' );

$cs = JURI::base();

$cs .='/components/com_djclassifieds/views/showitem/tmpl/';

$document->addStyleSheet($cs.'slimbox/slimbox.css');

$user = & JFactory::getUser();

$i = $this->item;

?>

<div id="dj-classifieds" class="clearfix">

	<?php $modules_breadcrumb = &JModuleHelper::getModules('dj_breadcrumb');

			if(count($modules_breadcrumb)>0){

				echo '<div class="dj_breadcrumb clearfix">';

				foreach (array_keys($modules_breadcrumb) as $m){

					echo JModuleHelper::renderModule($modules_breadcrumb[$m]);

				}

				echo'</div>';		

			}

			?>

<div class="item">

<?php	

	echo '<div class="title_top">'.$i->name.'</div>';

	echo '<div class="name">';

	echo '<a class="title" href="index.php?option=com_djclassifieds&view=showitem&cid='.$i->cat_id.'&id='.$i->id.'">'.$i->name.'</a>';

	echo '</div>';

	echo '<div class="description"><h2>'.JText::_('Description').'</h2>'.$i->description.'</div>';		



	if($i->image_url!=''){

		echo '<div class="images"><h2>'.JText::_('Images').'</h2>';

		$images = explode(";",$i->image_url);

		for($ii=0; $ii<count($images)-1;$ii++ ){  //-1 bo wrzuca na koniec tablicy puste miejsce

		?>

   	        <a href="<?php echo JURI::base().'components/com_djclassifieds/images/'.$images[$ii];?>.thb.jpg"  title=""  rel="lightbox-gallery" target="_blank"><img src="<?php echo JURI::base().'components/com_djclassifieds/images/'.$images[$ii].'.th.jpg';?>" style="top: 0;"/></a>

   		<?php

		}

		echo '</div>';

	}

	?>	

	<div class="general_det"><h2><?php echo JText::_('General details'); ?></h2>

	<?php if((int)$par->get('showprice','1')){?>

	<div class="row">

		<span><?php echo JText::_('Price:'); ?></span>

		<?php echo $i->price; ?>

	</div>

	<?php }

	if((int)$par->get('showcontact','1')){?>

	<div class="row">

		<span><?php echo JText::_('Contact:'); ?></span><br />

		<?php echo $i->contact; ?>

	</div>

	<?php }?>

	<div class="row user_name">

		<span><?php echo JText::_('Sold by:'); ?></span>

		<?php 

		if($i->user_id==0){

			echo JText::_('Guest');

		}else{			

			echo '<a href="index.php?option=com_djclassifieds&view=show&uid='.$i->user_id.'">'.$i->username.' <span>('.$this->user_items_c.')</span></a>';

		}

		?>

	</div>

	<?php /*

	<div class="row">

		<span><?php echo JText::_('Email:'); ?></span><?php echo $i->email; ?>

	</div>

	*/?>

	<?php 

	if($par->get('ask_seller','0')){

	if($i->user_id>0){?>

	<button class="button" type="button" onclick="ask();" ><?php echo JText::_('Ask seller'); ?></button>

	<div id="ask_form" style="display:none">

	<form action="index.php" method="post" name="djForm" id="djForm">

	   <span><?php echo JText::_('Message'); ?></span><br /><textarea id="intro_desc" name="intro_desc" rows="5" cols="55" class="inputbox"></textarea><br />

	   <button class="button2" type="submit" id="submit_b" ><?php echo JText::_('Send'); ?></button>

	   <input type="hidden" name="ask_status" id="ask_status" value="0" />

	   <input type="hidden" name="item_id" id="item_id" value="<?php echo $i->id; ?>">

	   <input type="hidden" name="option" value="com_djclassifieds" />

	   <input type="hidden" name="view" value="ask" />

	</form> 	 

	</div>

	<?php }} ?>

	</div>

	<?php if((int)$par->get('showaddetails','1')){?>

	<div class="general_det"><h2><?php echo JText::_('Ad details'); ?></h2>

		<div class="row">

			<span><?php echo JText::_('Ad id:'); ?></span><?php echo $i->id; ?>

		</div>

		<div class="row">

			<span><?php echo JText::_('Ad views:'); ?></span><?php echo $i->display; ?>

		</div>

		<div class="row">

			<span><?php echo JText::_('Ad expires:'); ?></span><?php echo $i->date_exp; ?>

		</div>

		<div class="row">

			<span><?php echo JText::_('Added:'); ?></span><?php echo $i->date_start; ?>

		</div>

	</div>

	<?php }?>





	



	

</div>



	

</div>



<script type="text/javascript">

	

function ask(){



var af = document.getElementById("ask_form");

	var $user_id = <?php echo $user->id;?>;

	if($user_id=='0'){

		alert('<?php echo JText::_('Please login');?>');

	}else{

		if(document.getElementById("ask_status").value=='0'){

			af.style.display='block'; 

			document.getElementById("ask_status").value='1'

		}else{

			af.style.display='none';

			document.getElementById("ask_status").value='0'

		}

	}



	

	

	



}



</script>

