<?php
$init_script = <<<HTML
	jQuery('[name="_source[]"]').live("change",function(){
		var __val = jQuery(this).val();
		var _val={};
		jQuery.each(__val, function(key, value) { 
			if(value.indexOf('|')!=-1){
				var source = value.split('|');
				if(_val[source[0]] == undefined){
					_val[source[0]]=[];
				}
				if(_val[source[0]] != true){
					_val[source[0]].push(source[1])
				}
			}else{
				_val[value] = true;
			}
		});
		var val=[];
		jQuery.each(_val, function(key, value) { 
			if($.isArray(value)){
				val.push('{'+key+':'+value.join(',')+'}');
			}else{
				val.push('{'+key+'}');
			}
		});
		jQuery('[name="source"]').val(val.join(''));
	});
HTML;
if (! function_exists("theme_dialog_slideshow_source")) {
function theme_dialog_slideshow_source($option){
	include_once (THEME_HELPERS . '/baseOptionsGenerator.php');
	$generator = new baseOptionsGenerator();
	echo '<input type="hidden" id="' . $option['id'] . '" name="' . $option['id'] . '" value="" />';
	$option['id'] = '_source';
	$generator->multiselect($option);
}
}
return array(
	"title" => __("Nivo Slideshow", THEME_ADMIN_DOMAIN),
	"shortcode" => 'slideshow',
	"attributes" => 'type="nivo"',
	"type" => 'both',
	"init" => $init_script,
	"options" => array(
		array(
			"name" => __("Images Srcs (optional)",THEME_ADMIN_DOMAIN),
			"id" => "content",
			"default" => "",
			"type" => "textarea"
		),
		array(
			"name" => __("Number (optional)",THEME_ADMIN_DOMAIN),
			"desc" => __("Sets the number of images to display.<br> 0: Display all images.",THEME_ADMIN_DOMAIN),
			"id" => "number",
			"default" => '0',
			"min" => 0,
			"max" => 20,
			"step" => "1",
			"type" => "range"
		),
		array(
			"name" => __("SlideShow Source (optional)",THEME_ADMIN_DOMAIN),
			"desc" => __("Select which SlideShow Source to show.",THEME_ADMIN_DOMAIN),
			"id" => "source",
			"options" => array(
				"g" => __('Self Gallery',THEME_ADMIN_DOMAIN),
			),
			"default" => "",
			"chosen" => true,
			"prompt" => __("Select Source..",THEME_ADMIN_DOMAIN),
			'target' => 'slideshow_source',
			'function' => 'theme_dialog_slideshow_source',
			"type" => "custom"
		),
		array(
			"name" => __("Width",THEME_ADMIN_DOMAIN),
			"desc" => __("Width of slider.",THEME_ADMIN_DOMAIN),
			"id" => "width",
			"min" => "10",
			"max" => "960",
			"step" => "1",
			"unit" => 'px',
			"default" => "630",
			"type" => "range"
		),
		array(
			"name" => __("Height",THEME_ADMIN_DOMAIN),
			"desc" => __("Height of slider.",THEME_ADMIN_DOMAIN),
			"id" => "height",
			"min" => "10",
			"max" => "1000",
			"step" => "1",
			"unit" => 'px',
			"default" => "300",
			"type" => "range"
		),
		array(
			"name" => __("Transition Effects",THEME_ADMIN_DOMAIN),
			"desc" => __("Select which effect to use on the slideshow.",THEME_ADMIN_DOMAIN),
			"id" => "effect",
			"default" => 'random',
			"options" => array(
				"random" => 'random',
				"sliceDown" => 'sliceDown',
				"sliceDownLeft" => 'sliceDownLeft',
				"sliceUp" => 'sliceUp',
				"sliceUpLeft" => 'sliceUpLeft',
				"sliceUpDown" => 'sliceUpDown',
				"sliceUpDownLeft" => 'sliceUpDownLeft',
				"fold" => 'fold',
				"fade" => 'fade',
				'slideInRight' => 'slideInRight',
				'slideInLeft' => 'slideInLeft',
				'boxRandom' => 'boxRandom',
				'boxRain' => 'boxRain',
				'boxRainReverse' => 'boxRainReverse',
				'boxRainGrow' => 'boxRainGrow',
				'boxRainGrowReverse' => 'boxRainGrowReverse',
			),
			"type" => "select",
		),
		array(
			"name" => __("Segments",THEME_ADMIN_DOMAIN),
			"desc" => __("Number of segments in which the image will be sliced for slice animations.",THEME_ADMIN_DOMAIN),
			"id" => "slices",
			"min" => "1",
			"max" => "30",
			"step" => "1",
			"default" => "10",
			"type" => "range"
		),
		array(
			"name" => __("Box Columns",THEME_ADMIN_DOMAIN),
			"desc" => __("Number of Columns in which the image will be sliced for box animations.",THEME_ADMIN_DOMAIN),
			"id" => "boxcols",
			"min" => "1",
			"max" => "30",
			"step" => "1",
			"default" => "8",
			"type" => "range"
		),
		array(
			"name" => __("Box Rows",THEME_ADMIN_DOMAIN),
			"desc" => __("Number of Rows in which the image will be sliced for box animations.",THEME_ADMIN_DOMAIN),
			"id" => "boxrows",
			"min" => "1",
			"max" => "30",
			"step" => "1",
			"default" => "4",
			"type" => "range"
		),
		array(
			"name" => __("Animation Speed",THEME_ADMIN_DOMAIN),
			"desc" => __("Define the duration of the animations.",THEME_ADMIN_DOMAIN),
			"id" => "animspeed",
			"min" => "200",
			"max" => "3000",
			"step" => "100",
			'unit' => 'miliseconds',
			"default" => "500",
			"type" => "range"
		),
		array(
			"name" => __("Pause Time",THEME_ADMIN_DOMAIN),
			"desc" => __("Define the delay which each slide will have to wait to be played",THEME_ADMIN_DOMAIN),
			"id" => "pausetime",
			"min" => "1000",
			"max" => "30000",
			"step" => "500",
			"unit" => 'miliseconds',
			"default" => "3000",
			"type" => "range"
		),
		array(
			"name" => __("Control Navigation",THEME_ADMIN_DOMAIN),
			"desc" => __("If you want show Control Navigation on the slidershow, turn on the button.",THEME_ADMIN_DOMAIN),
			"id" => "controlnav",
			"default" => true,
			"type" => "toggle"
		),
		array(
			"name" => __("autoPlay",THEME_ADMIN_DOMAIN),
			"desc" => __("If true, the slideshow will starts running automatically.",THEME_ADMIN_DOMAIN),
			"id" => "nvio_slide_autoPlay",
			"default" => true,
			"type" => "toggle"
		),
		array(
			"name" => __("Pause On Hover",THEME_ADMIN_DOMAIN),
			"desc" => __("If you want stop animation while hovering, turn on the button.",THEME_ADMIN_DOMAIN),
			"id" => "pauseonhover",
			"default" => true,
			"type" => "toggle"
		),
		array(
			"name" => __("Caption",THEME_ADMIN_DOMAIN),
			"desc" => __("If you want display the title of slider item, turn on the button.",THEME_ADMIN_DOMAIN),
			"id" => "captions",
			"default" => false,
			"type" => "toggle"
		),
		array(
			"name" => __("Caption Position",THEME_ADMIN_DOMAIN),
			"desc" => __("The Position of Caption.",THEME_ADMIN_DOMAIN),
			"id" => "captionposition",
			"options" => array(
				"top" => __("top",THEME_ADMIN_DOMAIN),
				"bottom" => __("bottom",THEME_ADMIN_DOMAIN),
				"center"=>__("center",THEME_ADMIN_DOMAIN),
				"right"=>__("right",THEME_ADMIN_DOMAIN),
				"left"=>__("left",THEME_ADMIN_DOMAIN),
			),
			"default" => "bottom",
			"type" => "select"
		),
		array(
			"name" => __("Caption Opacity",THEME_ADMIN_DOMAIN),
			"desc" => __("The Opacity of Caption with it's background.",THEME_ADMIN_DOMAIN),
			"id" => "captionopacity",
			"min" => "0",
			"max" => "1",
			"step" => "0.1",
			"default" => "0.5",
			"type" => "range"
		),
		array(
			"name" =>  __("Align (optional)",THEME_ADMIN_DOMAIN),
			"id" => "align",
			"default" => '',
			"prompt" => __("Default",THEME_ADMIN_DOMAIN),
			"options" => array(
				"left" => __('left',THEME_ADMIN_DOMAIN),
				"right" => __('right',THEME_ADMIN_DOMAIN),
				"center" => __('center',THEME_ADMIN_DOMAIN),
			),
			"type" => "select",
		),
		array(
			"name" => __("Random Start",THEME_ADMIN_DOMAIN),
			"desc" => __("If you want random start the slide, turn on the button.",THEME_ADMIN_DOMAIN),
			"id" => "randomStart",
			"default" => false,
			"type" => "toggle"
		),
		array(
			"name" => __("Css Code",THEME_ADMIN_DOMAIN),
			"id" => "style",
			"default" => "",
			"type" => "textarea"
		),
	),
);
