
function url(path) {
	return 'url(' + path + ')';
}

var steelheart = {
	version: 2.0,
	copyright: '2010 (c) steelheart.kr',

	debug: false,
//	easing: 'easeInOutBack'
	easing: 'easeOutQuad'
};




(function($) { $(document).ready(function() {

	$.ajaxSettings.traditional = true;


	// 푸터 '상단으로' 버튼
	$('#footer a.to-top').click(function(event, element) {
		event.stopPropagation();

		$('html, body').animate({
			scrollTop: 0
		}, 300, 'easeOutQuad');

		return false;
	});


	$.easing.def = steelheart.easing;


	$('textarea,input,button,a').live('mouseover mouseout focusin focusout', function(event) {
		switch (event.type) {
			case 'mouseover': $(this).addClass('hover'); break;
			case 'mouseout': $(this).removeClass('hover'); break;
			case 'focusin': $(this).addClass('focus').css('background-image', 'none'); break;
			case 'focusout': var v=$.trim($(this).val()); $(this).val(v).removeClass('focus').css('background-image', v ? 'none' : ''); break;
		}
	});


	if ($.browser.ie) {
		$('a')
			.keypress(function() {
				this.blur();
				this.hideFocus = false;
				this.style.outline = null;
			})
			.mousedown(function() {
				this.blur();
				this.hideFocus = true;
				this.style.outline = 'none';
			})
		.end();
	}

	$('a[href^=http://],a[href^=https://]').live('click', function(event) {
		event.preventDefault();
		window.open($(this).attr('href'));
	});

	$('form').submit(function() {
//			$(':submit', this).attr('disabled', 'disabled');
	});


	$('.ui-widget-overlay').live('click', function(event) {
		$('#signin-popup').dialog('close');
	});


	$('a.signin').click(function(event) {
		event.preventDefault();

		if ($('#signin-popup').is('*')) {
			$('#signin-popup').dialog('open');
		}
		else {
			$.ajax({
				url: '/user/signin',
				type: 'post',
				mode: 'sync',
				success: function(html) {

					$('<div id="signin-popup"></div>')
						.html(html)
						.appendTo('body')
						.dialog({
							autoOpen: false,
							title: '로그인',
							width: 500,
							height: 300,
							modal: true,
							draggable: false,
							resizable: false,
							show: {effect: 'slide', direction: 'left'},
							hide: {effect: 'slide', direction: 'left'}
						});

					$('#signin-popup').dialog('open');
				},
				error: function() {
					window.alert("ERROR");
				}
			});

		}
	});





	$('#search').submit(function(event) {
		event.stopPropagation();
		event.preventDefault();

		var keyword = $.trim($(this).find('input[name=keyword]').val());

		if (keyword != '') {
			window.location.href='/blog/search/' + keyword;
		}

	});



}); })(jQuery);




