<?php
/*
=================================================================
Bullet Energy - by White-Master 
-----------------------------------------------------------------
http://white-master.ru/
-----------------------------------------------------------------
Copyright (c) 2011 White-Master
=================================================================
Данный код защищен авторскими правами
=================================================================
Файл: load_style.php
=================================================================
*/
if ($do != 'forum') {
  return '';
}
$actionForum = totranslit($_REQUEST['action'], true, true);
$subActionForum = totranslit($_REQUEST['sub_action'], true, true);
$directoryTpl = '/templates/' . $config['skin'] . '/bullet_energy';
$libraryForum = '/engine/bullet_energy/library';
$arrayLoad = array();
$staticJS = '';
$arrayLoad[] = '<script type="text/javascript" src="' . $directoryTpl . '/js/base_site_bullet_energy.js"></script>';
$arrayLoad[] = '<link media="screen" href="' . $directoryTpl . '/style/styles.css" type="text/css" rel="stylesheet" />';
require (ENGINE_DIR . '/bullet_energy/data/forum_config.php');
if ($actionForum == 'showtopic') {
  $arrayLoad[] = '<link media="screen" href="' . $libraryForum . '/bbcode/bbcode_message.css" type="text/css" rel="stylesheet" />';
  $arrayLoad[] = '<script type="text/javascript" src="' . $libraryForum . '/bbcode/bbcodes.js"></script>';
} elseif ($actionForum == 'newtopic' or $actionForum == 'add_message') {
  $arrayLoad[] = '<link media="screen" href="' . $libraryForum . '/bbcode/bbcode.css" type="text/css" rel="stylesheet" />';
  $arrayLoad[] = '<link media="screen" href="' . $libraryForum . '/colorpicker/colorpicker.css" type="text/css" rel="stylesheet" />';
  $arrayLoad[] = '<link media="screen" href="' . $libraryForum . '/upload/upload.css" type="text/css" rel="stylesheet" />';
  $arrayLoad[] = '<script type="text/javascript" src="' . $libraryForum . '/colorpicker/colorpicker.js"></script>';
  $arrayLoad[] = '<script type="text/javascript" src="' . $libraryForum . '/colorpicker/eye.js"></script>';
  $arrayLoad[] = '<script type="text/javascript" src="' . $libraryForum . '/colorpicker/utils.js"></script>';
  $arrayLoad[] = '<script type="text/javascript" src="' . $libraryForum . '/bbcode/bbcodes.js"></script>';
  $arrayLoad[] = '<script type="text/javascript" src="' . $libraryForum . '/upload/upload.js"></script>';
  $arrayLoad[] = '<script type="text/javascript" src="' . $libraryForum . '/upload/swfobject.js"></script>';
  $optionLoad = array('session' => session_id(), 'extWindow' => implode(', .', explode(',', $bullet_energy_config['upload_file_type'])) . ', .gif, .jpg, .png, .jpe, .jpeg', 'extLoad' => '*.' . implode(';*.', explode(',', $bullet_energy_config['upload_file_type'])) . ';*.gif;*.jpg;*.png;*.jpe;*.jpeg', 'sizeLimit' => intval($bullet_energy_config['upload_max_size']) * 1024);
  if ($bullet_energy_config['mass_upload'] == '1') {
    $optionLoad['mass'] = "'multi' : true,";
    $optionLoad['massCount'] = "'queueSizeLimit' :" . intval($bullet_energy_config['upload_count_file']) . ",";
  } else {
    $optionLoad['mass'] = '';
    $optionLoad['massCount'] = '';
  }
  $staticJS .= <<< HTML
\n<script language="javascript" type="text/javascript">
var imageAlign = '{$bullet_energy_config['float_img']}';
$(document).ready(function(){
   $('#file_upload').uploadify({
    'uploader'  : '{$config['http_home_url']}engine/bullet_energy/library/upload/uploadify.swf',
    'script'    : '{$config['http_home_url']}engine/bullet_energy/ajax/upload.php',
    'cancelImg' : '{$config['http_home_url']}engine/bullet_energy/library/upload/images/cancel.png',
    'buttonImg' : '{$config['http_home_url']}engine/bullet_energy/library/upload/images/buttom.png',
    {$optionLoad['mass']}
    {$optionLoad['massCount']}
    'fileExt'   : '{$optionLoad['extLoad']}',
    'fileDesc'  : 'Files ({$optionLoad['extWindow']})', 
    'width'     : 102,
    'height'    : 25,
    'scriptData': { 'session': '{$optionLoad['session']}'},
    'folder'    : '/uploads/forum/',
    'auto'      : true,
    'sizeLimit'   : {$optionLoad['sizeLimit']},
    'onAllComplete' : function(event,data) {
       $.post("{$config['http_home_url']}engine/bullet_energy/ajax/site.php", {be_action:'refresh_list'}, function(data) {
		$("#block_files").fadeOut(500, function() {
			$(this).html(data);
			$(this).fadeIn(500);
			});}); 
   }
});
$('#colorSelector').ColorPicker({
			color: '#0000ff',
			onShow: function (colpkr) {
				$(colpkr).fadeIn(50);
				return false;
			},
			onHide: function (colpkr) {
				$(colpkr).fadeOut(50);
				return false;
			},
           onSubmit: function(hsb, hex, rgb, el) {
            setColor(hex);
            $(".colorpicker").fadeOut(50);
        	},
			onChange: function (hsb, hex, rgb) {
				$('#colorSelector div').css('backgroundColor', '#' + hex);
  }
});  
});
</script>
HTML;
} elseif ($actionForum == 'search' or $actionForum == 'search_proccess') {
  /* $staticJS .= <<< HTML
  \n<script type="text/javascript" language="javascript">
  $(function() {
  $("#datepicker_o, #datepicker_e").datepicker($.datepicker.regional["ru"]);
  $("#datepicker_o, #datepicker_e").datepicker("option", "showAnim", false);
  });
  function list_submit(prm) {
  var frm = document.getElementById('search_forum');
  if (prm == -1) {
  prm = Math.ceil(frm.result.value / 10);
  } else {
  frm.result.value = (prm - 1) * 10 + 1;
  }
  frm.page.value = prm;
  frm.submit();
  return false;
  }
  </script>
  HTML;*/
  $arrayLoad[] = '<script type="text/javascript" src="' . $libraryForum . '/jquery/datepicker.js"></script>';
  $arrayLoad[] = '<script type="text/javascript" src="' . $libraryForum . '/jquery/datepicker_local.js"></script>';
  $arrayLoad[] = '<link media="screen" href="' . $libraryForum . '/jquery/datapicker.css" type="text/css" rel="stylesheet" />';
}
if ($config['version_id'] <= '9.0') {
  $staticJS .= <<< HTML
\n<script language="javascript" type="text/javascript">
 var dle_group = {$member_id['user_group']}
</script>
HTML;
}
return implode("\n", $arrayLoad) . $staticJS;

?>