<?php
/**
* @id $Id$
* @author  Joomla Bamboo
* @package  prettyBox
* @copyright Copyright (C) 2006 - 2010 Joomla Bamboo. http://www.joomlabamboo.com  All rights reserved.
* @license  GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
// Include helper file
require_once (dirname(__FILE__).DS.'helper.php');
$document =& JFactory::getDocument();
$library = JURI::base(true).'/media/plg_jblibrary/';
$modbase = JURI::base(true).'/modules/prettyBox/';
$id = $module->id;
// Load CSS & JS
$loadCSS = $params->get('loadCSS','head');
$loadJS = $params->get('loadJS','head');
// PrettyPhoto Settings
$prettyPhoto = $params->get('prettyPhoto','1');
$padding = str_replace('px', '', $params->get('padding','40'));
$resize = $params->get('resize','true');
$theme = $params->get('theme','dark_rounded');
$prettyBoxTitle = $params->get('prettyBoxTitle','false');
$opacity = $params->get('opacity','0.6');
$prettyBoxSpeed = $params->get('prettyBoxSpeed','normal');
$rightMargin = $params->get('right_margin','0');
// Image Size and container
$crop_height = str_replace('px', '', $params->get('crop_height', '100'));
$crop_width = str_replace('px', '', $params->get('crop_width','2'));
$img_width = str_replace('px', '', $params->get('img_width','150'));
$img_height = str_replace('px', '', $params->get('img_height','100'));
$height = str_replace('px', '', $params->get('height','200'));
$overlayGallery = $params->get('overlayGallery','1');
//include css styles in head
if(($loadCSS == 'head') && ($prettyPhoto)){
	// prettyPhoto Styles
	$document->addStyleDeclaration('.prettyBox div.prettydiv'.$id.' {width:'.$img_width.'px;height:'.$height.'px;float: left;margin-right:'.$rightMargin.'px;}');	
	$document->addStyleSheet($library.'prettyPhoto/css/prettyPhoto.css');
}
//include js scripts in head
if(($loadJS == 'head') && ($prettyPhoto)) { 
	// prettyPhoto Scripts
		$document->addScript($library.'prettyPhoto/js/jquery.prettyPhoto.js');	
}
//get items from helper
$items = modPrettyBoxHelper::getList($params, $id);
//load template
require(JModuleHelper::getLayoutPath('mod_prettyBox', 'default'));
?>
