(function() {

	Just.front = function() {
		Just.front.common();

//		if (!$('.bg_main .div_submenu ul li').length) $('.bg_main_top').height($('.bg_main_top').height() - 40);
	};

	Just.front.common = function() {
		if ($('#center-comments').length) Just.front.center.comments();
		if ($('#center-schedule').length) Just.front.center.schedule();

		if ($('textarea.editor').length) Just.front.common.editors.tinymce($('textarea.editor'));

		if ($('.just-gallery').length) {Just.front.common.just_gallery()};
	};

	Just.front.common.just_gallery = function() {
		// Настройки highslide.
		hs.graphicsDir = '/media/images/highslide/';
		hs.showCredits = false;
		hs.wrapperClassName = 'wide-border';
		hs.loadingText = 'Загрузка!';
		// Картинки с применённым highslide.
		$('.highslide').click(function() {
			return hs.expand(this);
		});
		$("#scroll").thumbnailScroller({
			scrollerType:"clickButtons",
//			scrollerType:"hoverAccelerate",
			scrollerOrientation:"horizontal"
//			scrollSpeed:2,
//			scrollEasing:"easeOutCirc",
//			scrollEasingAmount:600,
//			acceleration:4,
//			scrollSpeed:800,
//			noScrollCenterSpace:10,
//			autoScrolling:0,
//			autoScrollingSpeed:2000,
//			autoScrollingEasing:"easeInOutQuad",
//			autoScrollingDelay:500
		});
		// загрузка изображения в блок и вывод анимированного прелоадера
		var loader = $('.just-gallery-loader');
		$('.just-gallery-photos a').click(function() {
			$('#scroll').trigger('scrollTo', this);
			loader.fadeIn(100);
			$('.just-gallery-photos a').removeClass('active');
			$(this).addClass('active');
			var img = document.createElement('img');
			img.onload = function() {loader.stop(true, true).fadeOut(100);};
			img.src = ($(this).data('full') || this.href) + ($.browser.msie ? '?'+(new Date).getTime() : '');
			$('.just-gallery-slide a').html('').append(img).attr('href', $(this).data('full') || this.href);
			return false;
		});
		$('.just-gallery-arrow').click(function() {
			var $this = $(this), img, list = $('.just-gallery-photos a'), href, active;
			if (!list.filter('.active').length) {
				href = $('.just-gallery-slide a').attr('href');
				list.filter('[href="'+href+'"]').addClass('active');
			}
			active = list.filter('.active');
			if ($this.hasClass('just-gallery-arrow-right')) {
				if (list.filter(':last').is(active)) {
					img = list.filter(':first');
				} else {
					img = active.next();
				}
			} else {
				if (list.filter(':first').is(active)) {
					img = list.filter(':last');
				} else {
					img = active.prev();
				}
			}
			img.click();
			return false;
		});
		$('.just-gallery-photos a.active').click();
		loader.fadeOut(400);
	};

	Just.front.common.editors = function() {};
	Just.front.common.editors.redactor = function($elem) {
		$elem.each(function() {
			var self = this;
			function init() {
				var options = $.extend($(self).data('optionsRedactor'), {path: '/media/js/redactor/'});
//				$this.redactor(options);
				self.redactor = $(self).redactor({toolbar: 'comment', resize: true, skin: 'carrara_white', path: '/media/js/redactor/', pathCss: '/media/css', css: ['wysiwyg.css']});
				}
			if (typeof ($.fn.redactor ) == 'undefined') {
//				$.getScript('/media/js/redactor/redactor.js', function() {init()});
				$.ajax({
					url: '/media/js/redactor/redactor.js',
					dataType: 'script',
					success: function() {init()},
					cache: true
				})
				$('head').append('<link type="text/css" rel="stylesheet" href="/media/js/redactor/css/redactor.css"/>');
						} else {
				init();
						}
		});
	};
	Just.front.common.editors.tinymce = function($elem) {
		$elem.each(function() {
			var self = this;
			var defaults = {
				script_url: $config.media.js + '/tiny_mce/tiny_mce_gzip.php',
				// General options
				theme: 'advanced',
				plugins : "spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,embed",
				// Theme options
//				theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
//				theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
//				theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
//				theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage,embed",

//				theme_advanced_buttons1 : "code,preview,fullscreen,visualchars,|,cut,copy,pasteword,cleanup,removeformat,|,undo,redo,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,sub,sup,|,styleprops",
//				theme_advanced_buttons2 : "outdent,indent,blockquote,|,bullist,numlist,|,link,unlink,anchor,image,|,spellchecker,styleselect,formatselect,|,charmap,iespell,media,|,insertfile,insertimage,embed",

				theme_advanced_buttons1 : 'cut,copy,pastetext,|,undo,redo,|,bold,italic,strikethrough,formatselect,|,link,unlink,|,bullist,numlist,|,image,|,embed,code,|,fullscreen',
				theme_advanced_buttons2 : '',
				theme_advanced_buttons3 : '',
				theme_advanced_buttons4 : '',
				theme_advanced_blockformats : 'p,h2,h3',
				theme_advanced_toolbar_location : "top",
				theme_advanced_toolbar_align : "left",
				theme_advanced_statusbar_location : "bottom",
				theme_advanced_resizing : true,
//				document_base_url : '/',
				convert_urls: false,
				relative_urls : false,
				language: 'ru',
				content_css: '/media/css/styles.css',
//				extended_valid_elements: 'object[width|height|classid|codebase],param[name|value],embed[src|type|width|height|flashvars|wmode]',
				media_strict: false,

				// Spellchecker
				spellchecker_languages : "+Russian=ru,Ukrainian=uk,English=en",
				spellchecker_rpc_url : "/media/js/tiny_mce/plugins/tinyspell.php",
				spellchecker_word_separator_chars : '\\s!"#$%&()*+,./:;<=>?@[\]^_{|}\xa7 \xa9\xab\xae\xb1\xb6\xb7\xb8\xbb\xbc\xbd\xbe\u00bf\xd7\xf7\xa4\u201d\u201c',
				paste_remove_styles: true,

				setup : function(ed) {
					ed.onInit.add(function(ed) {
//						Just(ed.getDoc()).toggleFocusParent('#'+ed.editorId);
					});
				}
			};
			function init() {
				$(self).tinymce($.extend(true, defaults, $(self).data('optionsEditor')));
			}
			if (typeof($.fn.tinymce) == 'undefined') {
				$.ajax({
					url: '/media/js/tiny_mce/jquery.tinymce.js',
					dataType: 'script',
					success: function() {init()},
					cache: true
				})
				} else {
				init();
				}
		});
	}
	Just.front.common.editors.elrte = function($elem) {
		var defaults = {
			cssClass : 'el-rte',
			lang     : 'ru',
			height   : 450,
			toolbar  : 'maxi',
			cssfiles : ['/media/js/elrte/css/elrte-inner.css'],
			allowSource: false
		}
		function init() {

			elRTE.prototype.ui.prototype.buttons.embed = function(rte, name) {
				this.constructor.prototype.constructor.call(this, rte, name);
				this.active  = true;
				this.input = $('<textarea rows="20" cols="86" name="content"></textarea>');
				this.content = $('<span>Введите HTML-код для вставки</span><br/>');
				var self = this;
				this.command = function() {
					var opts, d, txt;
					opts = {
						rtl : rte.rtl,
						submit : function(e, d) { e.stopPropagation(); e.preventDefault(); self.set(); d.close(); },
						dialog : {
							width : 560,
							title : this.rte.i18n('Embed code'),
							submit: function(e, d) { e.stopPropagation(); e.preventDefault(); d.close(); self.set();  }
						}
					}
					d = new elDialogForm(opts);
					d.append([this.content, this.input]).open();
					setTimeout(function() { self.input.focus()}, 20);
				}
				this.update = function() {
					this.domElem.removeClass('disabled');
				}
				this.set = function() {
					var n = $.trim(this.input.val());
					rte.selection.restoreIERange();
					if (n) {
						rte.selection.insertHtml(n, true);
						rte.ui.update(true);
					}
					this.input.val('');
				}
			}

			elRTE.prototype.ui.prototype.buttons.source = function(rte, name) {
				this.constructor.prototype.constructor.call(this, rte, name);
				this.active  = true;
				this.command = function() {
					var opts, d, txt;
					opts = {
						rtl : rte.rtl
					}
					rte.workzone.children().toggle();
					if (this.domElem.hasClass('active')) {
						this.domElem.removeClass('active');
						rte.updateEditor();
						rte.window.focus();
						rte.ui.update(true);
					} else {
						this.domElem.addClass('active');
						rte.updateSource();
						rte.source.focus();
						if ($.browser.msie) {
//							@todo
						} else {
//							rte.source[0].setSelectionRange(0, 0);
						}
						rte.ui.disable();
						rte.statusbar.empty();
					}

				}
				this.update = function() {
					this.domElem.removeClass('disabled');
				}
			}

			elRTE.prototype.options.panels.web2pyPanel = [
//				'bold', 'italic', 'underline', 'forecolor', 'justifyleft', 'justifyright',
//				'justifycenter', 'justifyfull', 'formatblock', 'insertorderedlist', 'insertunorderedlist',
//				'link', 'image', 'flash',
				'embed', 'source'
			];
			elRTE.prototype.options.toolbars.maxi.push('web2pyPanel');

			$elem.each(function() {
				var options = $.extend(true, defaults, $(this).data('optionsEditor'));
				$(this).elrte(options);
			});
		}
/*
		if (typeof($.fn.elrte) == 'undefined') {
			$.ajax({
				url: '/media/js/elrte/elrte.full.js',
				dataType: 'script',
				cache: true,
				success: function() {
					$.ajax({
						url: '/media/js/elrte/i18n/elrte.ru.js',
						dataType: 'script',
						success: function() {init()},
						cache: true
					});
				}
			});
		} else {
*/
			init();
//		}
	}

	Just.front.center = function() {};
	Just.front.center.comments = function() {
		try {
		VK.init({apiId: $config.common.social.vk.apiId, onlyWidgets: true, nameTransportPath: '/xd_receiver.html'});
		function on_post(num, last_comment, date, sign) {
			$.ajax({
				url: $config.uri.ajax + '/comments/social/vk',
				type: 'POST',
				dataType: 'json',
				data: {text: last_comment, link: window.location.href, date: date, num: num, sign: sign},
				success: function(data) {}
			});
		}
		VK.Observer.subscribe('widgets.comments.new_comment', on_post);
		VK.Widgets.Comments("vk_comments", {limit: 10, width: 600, attach: "*"}, $('#vk_comments').data('hash'));
		$('.title_c').click(function() {
			$(this).parent().children('.center-comments').slideToggle();
			var sign = $(this).find('em');
			sign.text(sign.text() == '-' ? '+' : '-');
		});
		FB.Event.subscribe('auth.login', function(r) { if (r.status == "connected") { $('.fb_login').hide(); } });
		FB.init({
			appId  : $config.common.social.fb.apiId,
			status : true, // check login status
			cookie : true, // enable cookies to allow the server to access the session
			xfbml  : true  // parse XFBML
		});
		FB.Event.subscribe('comment.create', function(com) {
			function post() {
				FB.api('/me', function(user){
					$.ajax({
						url: $config.uri.ajax + '/comments/social/fb',
						type: 'POST',
						dataType: 'json',
						data: {link: window.location.href, user: user.name, href: com.href},
						success: function(data) {}
					})
				});
			}
			FB.getLoginStatus(function(r){
				if (r.status == 'connected') { post(); }
				else { FB.login(function(r) { if (r.status == 'connected') { post(); } }) }
			});
		});
		} catch (e) {}
				};
	Just.front.center.schedule = function() {
		var dp = $('#datepicker')
				.val(Just.getUrlParam('day') || $.datepicker.formatDate('yy.mm.dd', new Date()))
				.after('<li class="select_day"><span>'+$('#datepicker').attr('title')+'</span><img src="/media/images/ico_cal_min.png" width="18" height="20"/></li>')
				.datepicker({
					showOn: 'focus',
					dateFormat: 'yy.mm.dd',
					onSelect: function(d) {
						d = $.datepicker.parseDate('yy.mm.dd', d);
						window.location.href = '?day='+d.getFullYear()+'.'+(d.getMonth()+1)+'.'+d.getDate();
					}
		});
		$('li.select_day').live('click', function() {
			dp.datepicker('show');
		});
	};

	Just.front.common.comments = function() {};
	Just.front.common.pagebar = function() {};
	Just.front.common.schedule = function() {};
	Just.front.common.timetable = function() {};

	Just.front.jam = function() {};
	Just.front.jam.index = function() {
		if ($('.latest-trailers').length) {
			var a = $('.latest-trailers li:first a');
			var preview = Just.common.video.getImage(a.data('link'));
			$('.latest-trailers a:first').attr('href', a.attr('href')).children('img:first').attr('src', preview);
		}

		function clip_post_preview() {
			var $this = $(this);
			if ($this.height() > 160 && this.parentNode.nodeName.toLowerCase() != 'div') {
				$this.wrap('<div style="width: 100%; height: 160px; overflow: hidden;"></div>').css('margin-top', -Math.round(($this.height()-200)/2));
			}
		}

		function change_post_blocks() {
			var $news = $('#news_blogs');
			var $newsBlogs = $('.div_news_blogs');
			var $newsBlogsVis = $newsBlogs.filter(':visible');
			var mr = Math.round((($news.width()-40) - ($newsBlogs.eq(0).width() * $newsBlogsVis.length))/$newsBlogsVis.length);
			$newsBlogs.not($newsBlogs.last()).css({marginRight: (mr <= 0 ? 0 : mr) });
			if ($news.width() < Math.floor($newsBlogs.width() * $newsBlogs.length)+40) {
				$newsBlogs.last().hide();
			} else {
				$newsBlogs.last().show();
			}
//			$newsBlogs.css({marginRight: (mr < 0 ? 0 : mr) });
//			$newsBlogs.not($newsBlogs.last()).css({marginRight: (mr > 0 ? mr : 0) });
		}

		$('.news_blogs h3 a img').load(clip_post_preview);

		$(window).ready(change_post_blocks).resize(change_post_blocks);
	};
	Just.front.jam.videos = function() {
		Just('.place_tr a.trailer-link').common.video.gallery({width: 853, height: 510, callback: function() {$(this).find('.thumb').attr('src', this.image)}})
				.click(function() {
					if ($.browser.msie) return true;
					$('.mintreiler.active').removeClass('active');
					$(this).parents('.mintreiler:first').addClass('active');
					$('.player>h2').html($(this).attr('title'));
					$('.player>div').html(this.code);
					return false;
				});

		if (!$.browser.msie && $('.player>div').html().length) {
			$('.mintreiler.active a:first').click();
		}
	};

	Just.front.jam.place_map = function() {
		Just.YMap.init('#map_latitude', '#map_longitude', undefined, {searchControl:false, startPlacemarkDraggable: false});
	};

	Just.front.jam.places = function() {
		var marks = {};
		$('input[type="hidden"][name="mark"]').each(function() {
			var data = $(this).data();
			marks[parseInt(data.id)] = {
				latitude: parseFloat(data.latitude),
				longitude: parseFloat(data.longitude),
				title: data.title,
				content: data.content,
				link: data.link
			};
		});
		var map_opts = {
			startPosition: $config.common.citycoords[$config.request.city],
			searchControl:false, startPlacemark: false, minimap: false
		};
		Just.YMap.init(undefined, undefined, function(){marks = Just.YMap.set_marks(marks)}, map_opts);
		$('table.content-table-places img.show-placemark').click(function() {
			if (!$('.places-map').is(':visible')) {
				$('.places-map-control span:eq(0)').click();
			}

			var input = $(this).parents('tr:first').find('input');
			var data = $(input).data();
			Just.YMap.set_center(parseFloat(data.latitude), parseFloat(data.longitude));
			$('html,body').animate({scrollTop: $('.bg_main_top').offset().top}, 'slow');
			marks[parseInt(data.id)].placemark.openBalloon();
		});
		$('.places-map-control span').bind('click', function() {
			if ($('.places-map').is(':visible')) {
				$('.places-map').slideUp();
					} else {
				$('.places-map').slideDown();
					}
			$('.places-map-control span').toggle();
				});
	};

	Just.front.jam.gallery = function() {
		// Настройки highslide.
		hs.graphicsDir = '/media/images/highslide/';
		hs.showCredits = false;
		hs.wrapperClassName = 'wide-border';
		hs.loadingText = 'Загрузка!';
		// Картинки с применённым highslide.
		$('.highslide').click(function() {
			return hs.expand(this);
		});
/*
		window.$pane = $('#scroll-box').jScrollHorizontalPane({showArrows:true,arrowSize:20,scrollbarHeight:20,scrollbarMargin:0,reset:0,animateInterval:10});
		$(window).resize(function() {
			$('#scroll-box').jScrollHorizontalPane({showArrows:true,arrowSize:20,scrollbarHeight:20,scrollbarMargin:0,reset:0,animateInterval:10});
		});
*/
//		change_gallery_image($('.div_gallery .gallery_thumb')[$('.div_gallery .gallery_normal').data('pos') - 1]);
		//==================================================================================================
/*
		$('.div_gallery .srt_left_gal, .div_gallery .srt_right_gal').click(function() {
			var $galleryNormalImage = $('.div_gallery .gallery_normal');
			var $parent = $(this).parents('.div_gallery');
			var pos = $galleryNormalImage.data('pos');
			var newpos = 0;
			var thumb_count = $('.div_gallery .gallery_thumb').size();
			if ($(this).hasClass('srt_left_gal')) {
				if (pos > 1) newpos = pos - 2;
				else newpos = thumb_count - 1;
			} else {
				if (pos < thumb_count) newpos = pos;
				else newpos = 0;
			}
			change_gallery_image($('.div_gallery .gallery_thumb')[newpos]);
			return false;
		});
		$('.div_gallery .gallery_thumb').click(function() { change_gallery_image(this); return false; });
		function change_gallery_image(obj) {
			var self = obj;
			var $objImg = $(obj).find('img');
			var $galleryNormal = $('.div_gallery .gallery_normal');
			var $galleryNormalImage = $galleryNormal.find('img');
			var href = $('.div_gallery .srt_left_gal a').attr('href');
			var thumb_count = $('.div_gallery .gallery_thumb').size();
			$('.div_gallery .srt_left_gal a').attr('href', href.replace(/\d+$/, ($(obj).data('pos') == 1 ? thumb_count : $(obj).data('pos') - 1)) );
			$('.div_gallery .srt_right_gal a').attr('href', href.replace(/\d+$/, ($(obj).data('pos') == (thumb_count) ? 1 : $(obj).data('pos') + 1)) );
			$galleryNormal.data('pos', $(obj).data('pos'));
			$galleryNormalImage.attr('src', '');
			$galleryNormalImage.attr('width', $(self).data('width'));
			$galleryNormalImage.attr('height', $(self).data('height'));
			$galleryNormalImage.attr('src', 'http://jam.kz' + $config.media.img + '/' + $(self).data('addDir') + $config.request.parts[$config.request.uri_level].value + '/' + $(self).data('filename'));
			$galleryNormal.attr('href', 'http://jam.kz' + $config.media.img + '/' + $(self).data('addDir') + $config.request.parts[$config.request.uri_level].value + '/full_' + $(self).data('filename'));
			$galleryNormalImage.attr('alt', $(self).attr('alt'));
			if ($objImg.position().left + $objImg.width() + $pane.position().left > $('.jScrollPaneContainer').width()) {
				$pane[0].scrollTo($objImg.position().left + $objImg.width() - $('.jScrollPaneContainer').width());
		}
			if ($objImg.position().left + $pane.position().left < 0) {
				$pane[0].scrollTo('a img:eq(' + $(obj).index() + ')');
	}
			$galleryNormalImage.load(function() { });
		}
*/
		//==================================================================================================
	};

	Just.front.jam.premiere = function() {
		$.getScript($config.media.js + '/grid-a-licious-premier.js');
	};

	Just.front.jam.event_add = function() {
		var form = Just('form[name="event"]');
		var required = form.data('requiredFields');
		var ff = {
			d: $('.form-table-data'),
			w: $('.form-table-wait').hide(),
			s: $('.form-table-success').hide(),
			anim: false
		};
		form.activeForm({
			required: required,
			id: 'user_id',
			success: function(data) {
				var ivid = setInterval(function() {
					if (!ff.anim) {
						if (data.status == 1) {
							ff.w.fadeOut(300, function() {
								ff.s.fadeIn(function() {
									setTimeout(function() {
										window.location.href = '/';
									}, 1200);
								});
							});
						} else {
							ff.w.fadeOut(300, function() {
								ff.d.fadeIn();
							});
						}
						clearInterval(ivid);
					}
				}, 100);

			},
			beforeSubmit: function() {
				ff.anim = true;
				ff.d.fadeOut(300, function() {
					ff.w.fadeIn(300, function() {
						ff.anim = false;
					});
				});
			}
		});

		Just($('.form-table').find('input,textarea,select')).toggleFocusParent().attr('autocomplete', 'off');
		form.find('input:button[name="image"]').filewrap({placeholder: 'Выбран файл: %%'});

		var date_edit = false;
		var datepicker = $('.datetimepicker').clone();
		$('.datepicker-date-text').live('click', function() {
			$(this).parent().children('input[type="hidden"]').datepicker('show');
		});
		$('.datepicker-date-delete').live('click', function() {
			$(this).parent().remove();
		});
		$('[name="datepick"]').bind('click', function() {
			var p = $('<p class="datepicker-date-row"><span class="datepicker-date-text"></span><input type="hidden" name="date[]"/><span class="datepicker-date-delete">&lt; Удалить</span></p>');
			$(this).before(p);
			function element_date(elem, date) {
				elem.children('.datepicker-date-text').text(date);
				elem.children('input[type="hidden"]').val(date);
			}
			p.children('input[type="hidden"]').datetimepicker({
				beforeShow: function(input,obj) {
					if ($(input).val() == '') {
						var date = new Date();
						date = $.datepicker.formatDate('yy.mm.dd', date)+' 00:00';
						element_date(p,date);
					}
				},
				onSelect: function(date) {
					element_date(p,date);
				},
				onClose: function(date,picker,obj) {
					if (date == '') {
						date = new Date();
						date = $.datepicker.formatDate('yy.mm.dd', date)+' '+$.timepicker._formatTime({hour: date.getHours(), minute: date.getMinutes()}, 'hh:mm');
					}
					element_date(p,date);
				},
				dayNames: ['Воскресенье', 'Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота'],
				dayNamesShort: ['Вск', 'Пнд', 'Втр', 'Срд', 'Чтв', 'Птн', 'Сбт'],
				dayNamesMin: ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'],
				firstDay: 1,
				monthNames: ['Январь','Февраль','Март','Апрель','Май','Июнь','Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'],
				monthNamesShort: ['Янв','Фев','Мар','Апр','Май','Июн','Июл','Авг','Сен','Окт','Ноя','Дек'],
				buttonImage: "/media/images/icons/admin/16/calendar.png",
				changeMonth: true,
				changeYear: true,
				dateFormat: 'yy.mm.dd',
				timeFormat: 'hh:mm',
				stepHour: 1,
				stepMinute: 1,
				timeOnlyTitle: 'Выберите время',
				timeText: 'Время',
				hourText: 'Часы',
				minuteText: 'Минуты',
				secondText: 'Секунды',
				currentText: 'Сейчас',
				closeText: 'Закрыть',
				showButtonPanel: true
			}).datepicker('show');
		});
	}

	Just.front.posts = function() {
	};
	Just.front.posts.edit = function() {
		
	};

	Just.front.posts.view = function() {};

})(Just);
