<?php

$cs_lang = cs_translate('multislide');

$data = array();
$data['options'] = cs_sql_option(__FILE__,'multislide');

$files = cs_files();

if(isset($_POST['submit'])) {

  require_once 'mods/clansphere/func_options.php';
  $error = '';
  $save = array();

  $save['slide_width'] = $_POST['slide_width'];
  $save['slide_height'] = $_POST['slide_height'];
  $save['max_navslide'] = (int) $_POST['max_navslide'];
  $save['effect'] = $_POST['effect'];
  $save['strips'] = (int) $_POST['strips'];
  $save['strips_delay'] = (int) $_POST['strips_delay'];
  $save['slide_delay'] = (int) $_POST['slide_delay'];
  $save['title_opacity'] = $_POST['title_opacity'];
  $save['title_speed'] = (int) $_POST['title_speed'];
  $save['position'] = $_POST['position'];
  $save['direction'] = $_POST['direction'];
  $save['navigation'] = (int) empty($_POST['navigation']) ? 0 : 1;

  cs_optionsave('multislide', $save);
	
  cs_redirect($cs_lang['success'], 'options', 'roots');
}

if(!isset($_POST['submit']) || !empty($error)) {

  if (!empty($error)) $data['lang']['manage_options'] = $cs_lang['error_occured'] . $error;

	$data['eff']['empty'] = $data['options']['effect'] == '' ? 'selected="selected"' : '';
	$data['eff']['wave'] = $data['options']['effect'] == 'wave' ? 'selected="selected"' : '';
	$data['eff']['zipper'] = $data['options']['effect'] == 'zipper' ? 'selected="selected"' : '';
	$data['eff']['curtain'] = $data['options']['effect'] == 'curtain' ? 'selected="selected"' : '';

		$data['opa']['0.0'] = $data['options']['title_opacity'] == '0.0' ? 'selected="selected"' : '';
		$data['opa']['0.1'] = $data['options']['title_opacity'] == '0.1' ? 'selected="selected"' : '';
		$data['opa']['0.2'] = $data['options']['title_opacity'] == '0.2' ? 'selected="selected"' : '';
		$data['opa']['0.3'] = $data['options']['title_opacity'] == '0.3' ? 'selected="selected"' : '';
		$data['opa']['0.4'] = $data['options']['title_opacity'] == '0.4' ? 'selected="selected"' : '';
		$data['opa']['0.5'] = $data['options']['title_opacity'] == '0.5' ? 'selected="selected"' : '';
		$data['opa']['0.6'] = $data['options']['title_opacity'] == '0.6' ? 'selected="selected"' : '';
		$data['opa']['0.7'] = $data['options']['title_opacity'] == '0.7' ? 'selected="selected"' : '';
		$data['opa']['0.8'] = $data['options']['title_opacity'] == '0.8' ? 'selected="selected"' : '';
		$data['opa']['0.9'] = $data['options']['title_opacity'] == '0.9' ? 'selected="selected"' : '';
		$data['opa']['1.0'] = $data['options']['title_opacity'] == '1.0' ? 'selected="selected"' : '';

	$data['pos']['top'] = $data['options']['position'] == 'top' ? 'selected="selected"' : '';
	$data['pos']['bottom'] = $data['options']['position'] == 'bottom' ? 'selected="selected"' : '';
	$data['pos']['alternate'] = $data['options']['position'] == 'alternate' ? 'selected="selected"' : '';
	$data['pos']['curtain'] = $data['options']['position'] == 'curtain' ? 'selected="selected"' : '';

	$data['dir']['left'] = $data['options']['direction'] == 'left' ? 'selected="selected"' : '';
	$data['dir']['right'] = $data['options']['direction'] == 'right' ? 'selected="selected"' : '';
	$data['dir']['alternate'] = $data['options']['direction'] == 'alternate' ? 'selected="selected"' : '';
	$data['dir']['random'] = $data['options']['direction'] == 'random' ? 'selected="selected"' : '';
	$data['dir']['fountain'] = $data['options']['direction'] == 'fountain' ? 'selected="selected"' : '';
	$data['dir']['fountainAlternate'] = $data['options']['direction'] == 'fountainAlternate' ? 'selected="selected"' : '';

    
	$data['op']['more'] = empty($data['options']['navigation']) ? '' : 'checked="checked"';

  echo cs_subtemplate(__FILE__,$data,'multislide','options');
}