<?php
$init_script = <<<HTML
	jQuery('[name="controls"]').live("change",function(){
		if(this.checked){
			jQuery('.shortcode-item[data-option="panControl"]').show();
			jQuery('.shortcode-item[data-option="zoomControl"]').show();
			jQuery('.shortcode-item[data-option="mapTypeControl"]').show();
			jQuery('.shortcode-item[data-option="scaleControl"]').show();
			jQuery('.shortcode-item[data-option="streetViewControl"]').show();
			jQuery('.shortcode-item[data-option="overviewMapControl"]').show();
		}else{
			jQuery('.shortcode-item[data-option="panControl"]').hide();
			jQuery('.shortcode-item[data-option="zoomControl"]').hide();
			jQuery('.shortcode-item[data-option="mapTypeControl"]').hide();
			jQuery('.shortcode-item[data-option="scaleControl"]').hide();
			jQuery('.shortcode-item[data-option="streetViewControl"]').hide();
			jQuery('.shortcode-item[data-option="overviewMapControl"]').hide();
		}
	}).trigger("change");
HTML;
$custom_script = <<<HTML
	if(attrs['html'].value!=''){
		attrs['html'].value = attrs['html'].value.replace(/\\n/gi,"{linebreak}");
		attrs['html'].attributeText = attrs['html'].attributeText.replace(/\\n/gi,"{linebreak}");
	}
	return '[gmap' + this.builtAttributesChain(attrs) + '] ';
HTML;
return array(
	"title" => __("Google Map", THEME_ADMIN_DOMAIN),
	"shortcode" => 'gmap',
	"type" => 'custom',
	"init" => $init_script,
	"custom" => $custom_script,
	"options" => array(
		array (
			"name" => __("Width (optional)",THEME_ADMIN_DOMAIN),
			"desc" => __("set to 0 is the full width",THEME_ADMIN_DOMAIN),
			"id" => "width",
			"default" => "",
			"min" => 0,
			"max" => 942,
			"step" => "1",
			"units" => array('px','%'),
			'default_unit' => 'px',
			"type" => "measurement",
		),
		array (
			"name" => __("Height",THEME_ADMIN_DOMAIN),
			"id" => "height",
			"default" => '400',
			"min" => 0,
			"max" => 960,
			"step" => "1",
			'unit' => 'px',
			"type" => "range",
		),
		array(
			"name" => __("Address (optional)",THEME_ADMIN_DOMAIN),
			"id" => "address",
			"size" => 30,
			"default" => "",
			"type" => "text",
		),
		array(
			"name" => __("Latitude",THEME_ADMIN_DOMAIN),
			"id" => "latitude",
			"size" => 30,
			"default" => "",
			"type" => "text",
		),
		array(
			"name" => __("longitude",THEME_ADMIN_DOMAIN),
			"id" => "longitude",
			"size" => 30,
			"default" => "",
			"type" => "text",
		),
		array (
			"name" => __("Zoom",THEME_ADMIN_DOMAIN),
			"id" => "zoom",
			"default" => '',
			"min" => 1,
			"max" => 19,
			"step" => "1",
			"type" => "range"
		),
		array (
			"name" => __("Marker",THEME_ADMIN_DOMAIN),
			"id" => "marker",
			"default" => true,
			"type" => "toggle"
		),
		array (
			"name" => __("Html",THEME_ADMIN_DOMAIN),
			"id" => "html",
			"size" => 30,
			"default" => "",
			"type" => "text",
		),
		array (
			"name" => __("Popup Marker",THEME_ADMIN_DOMAIN),
			"id" => "popup",
			"default" => false,
			"type" => "toggle"
		),
		array (
			"name" => __("Controls",THEME_ADMIN_DOMAIN),
			"id" => "controls",
			"default" => false,
			"type" => "toggle"
		),
		array (
			"name" => __("panControl",THEME_ADMIN_DOMAIN),
			"id" => "panControl",
			"default" => true,
			"type" => "toggle"
		),
		array (
			"name" => __("zoomControl",THEME_ADMIN_DOMAIN),
			"id" => "zoomControl",
			"default" => true,
			"type" => "toggle"
		),
		array (
			"name" => __("doubleClickZoom",THEME_ADMIN_DOMAIN),
			"id" => "doubleclickzoom",
			"default" => true,
			"type" => "toggle"
		),
		array (
			"name" => __("mapTypeControl",THEME_ADMIN_DOMAIN),
			"id" => "mapTypeControl",
			"default" => true,
			"type" => "toggle"
		),
		array (
			"name" => __("scaleControl",THEME_ADMIN_DOMAIN),
			"id" => "scaleControl",
			"default" => true,
			"type" => "toggle"
		),
		array (
			"name" => __("streetViewControl",THEME_ADMIN_DOMAIN),
			"id" => "streetViewControl",
			"default" => true,
			"type" => "toggle"
		),
		array (
			"name" => __("overviewMapControl",THEME_ADMIN_DOMAIN),
			"id" => "overviewMapControl",
			"default" => true,
			"type" => "toggle"
		),
		array (
			"name" => __("Scrollwheel",THEME_ADMIN_DOMAIN),
			"id" => "scrollwheel",
			"default" => true,
			"type" => "toggle"
		),
		array(
			"name" => __("Maptype (optional)",THEME_ADMIN_DOMAIN),
			"id" => "maptype",
			"default" => 'ROADMAP',
			"prompt" => __("Choose one..",THEME_ADMIN_DOMAIN),
			"options" => array(
				"ROADMAP" => __('Default road map',THEME_ADMIN_DOMAIN),
				"SATELLITE" => __('Google Earth satellite',THEME_ADMIN_DOMAIN),
				"HYBRID" => __('Mixture of normal and satellite',THEME_ADMIN_DOMAIN),
				"TERRAIN" => __('Physical map',THEME_ADMIN_DOMAIN),
			),
			"type" => "select",
		),
		array(
			"name" => __("Align (optional)",THEME_ADMIN_DOMAIN),
			"id" => "align",
			"default" => '',
			"prompt" => __("Choose one..",THEME_ADMIN_DOMAIN),
			"options" => array(
				"left" => __('Left',THEME_ADMIN_DOMAIN),
				"right" => __('Right',THEME_ADMIN_DOMAIN),
				"center" => __('Center',THEME_ADMIN_DOMAIN),
			),
			"type" => "select",
		),
	),
);
