<?php
$image_path =  $tpl['arr']['image'];
if(!empty($tpl['arr']['image']))
{
	if (file_exists(PJ_INSTALL_PATH . $image_path)) 
	{
		$image_url = PJ_INSTALL_URL . $image_path;
		?>
		<img class="frCampaignImage" src="<?php echo $image_url?>"/>
		<?php
	}
}else{
	?><br/><?php
}
?>
<div class="frCampaignDetail">
	<div class="frCampaignTitle"><?php echo pjSanitize::clean($tpl['arr']['title']);?></div>
	<div class="frCampaignDesc">
		<div class="frShortDesc"><?php echo nl2br(stripslashes(pjUtil::truncateDescription($tpl['arr']['description'], 110, ' ')));?>
			<?php
			if(strlen($tpl['arr']['description']) > 110)
			{ 
				?>
				&nbsp;<a href="#" class="frReadMore"><?php __('front_read_more');?></a>
				<?php
			} 
			?>
		</div>
		<div class="frFullDesc"><?php echo nl2br(pjSanitize::clean($tpl['arr']['description']));?></div>
	</div>
</div>
<div class="frDonation">
	<?php
	$left_percentage = 100 - $tpl['percentage']; 
	if($left_percentage <= 0)
	{
		$left_percentage = 0;
	}
	$height = intval(($left_percentage * 52) / 100);
	?>
	<span class="frPercentage"><?php echo $tpl['percentage']?>%</span>
	<div class="frPie"><span style="height:<?php echo $height;?>px;"></span></div>
	<div class="frAmount">
		<label><?php echo pjUtil::getCurrencySign($tpl['option_arr']['o_currency'])?></label>
		<input type="text" id="frAmount_<?php echo $_GET['cid'];?>" name="amount" value="<?php echo isset($_SESSION[$controller->defaultAmount]) ? $_SESSION[$controller->defaultAmount] : null;?>" class="frText frW70 frAmountText"/>
	</div>
	<button class="frButton frButtonDonate"><?php __('front_button_donate');?></button>
</div>
<div class="frCampaignStat">
	<div class="frLeftCol">
		<label><span><?php echo pjUtil::formatCurrencySign($tpl['arr']['amount'], $tpl['option_arr']['o_currency'])?>&nbsp;</span><?php __('front_needed');?></label>
		<label><abbr><?php echo pjUtil::formatCurrencySign($tpl['received_amount'], $tpl['option_arr']['o_currency'])?></abbr>&nbsp;<?php __('front_received');?></label>
	</div>
	<div class="frRightCol">
		<label class="frTimer"><span><?php echo $tpl['days_left']?>&nbsp;</span><?php $tpl['days_left'] != 1 ? __('front_days_left') : __('front_day_left');?></label>
		<label><?php echo $tpl['donations']?>&nbsp;<?php $tpl['donations'] != 1 ? __('front_donations') : __('front_donation');?></label>
	</div>
</div>