<?php
/**
 * @version		$Id$
 * @author		JoomlaUX
 * @package		Joomla.Site
 * @subpackage	mod_jux_google_maps
 * @copyright	Copyright (C) 2015 JoomlaUX. All rights reserved.
 * @license		License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
 * 
 */

// no direct access
defined('_JEXEC') or die('Restricted access'); 
$document = JFactory::getDocument();
//$document->addScript('http://maps.google.com/maps/api/js?sensor=true&language='.$params->get('lang','en-GB'));
$document->addScript('http://maps.googleapis.com/maps/api/js?libraries=places&key=AIzaSyC65Cru0kXK7Ftn0C7IA2BZ3UeYO5Y0kGU&sensor=false&language='.$params->get('lang','en-GB'));
$document->addScript('modules/mod_jux_google_maps/assets/js/script.js');
$document->addStyleSheet('modules/mod_jux_google_maps/assets/css/style.css');
$document->addScriptDeclaration('
	jQuery(document).ready(function($){
		$("#jux_m'.$module->id.'").juxmap({
			address:"'.$params->get('address').'",
			description:"'.base64_encode($params->get('description')).'",
			zoom:'.$params->get('zoom',14).',
			latitude:"'.$params->get('latitude').'",
			longitude:"'.$params->get('longitude').'",
			language:"'.$params->get('lang','en-GB').'",
			infowindow:'.$params->get('alw_infowindow',1).',
			scrollwheel:'.$params->get('scrollwheel',1).',
			translates: {
				"DIRECTIONS": "'.JText::_('JUX_GOOGLE_MAPS_DIRECTIONS').'",
				"STREET_VIEW": "'.JText::_('JUX_GOOGLE_MAPS_STREET_VIEW').'",
				"GO": "'.JText::_('JUX_GOOGLE_MAPS_GO').'",
				"FROM_ADDRESS": "'.JText::_('JUX_GOOGLE_MAPS_FROM_ADDRESS').'"
			}
		});
	});
');

require (JModuleHelper::getLayoutPath('mod_jux_google_maps',$params->get('layout', 'default')));