$(document).ready(function() {
	
	/*
	 * NEW / BRAND / SALE / BEST / EVENT ¸Þ´º ÀÌ¹ÌÁö ·Ñ¿À¹ö Ã³¸®
	 * 
	 */
	(function(){
		$('img[class="sMenuImg"]').each(function(idx){
			$(this).mouseover(function(){
				if( $(this).attr("here") != 'yes' && $(this).attr("src").indexOf('_on.gif') < 0 )
					$(this).attr("src", $(this).attr("src").replace(".gif", "_on.gif"));
			});

			$(this).mouseout(function(){
				if( $(this).attr("here") != 'yes' && $(this).attr("src").indexOf('_on.gif') > 0 )
					$(this).attr("src", $(this).attr("src").replace("_on.gif", ".gif"));
			});
		});
	})();
	
	/*
	 * ±Û·Î¹ú ³×ºñ°ÔÀÌ¼Ç ¸Þ´º ( suckerfish )
	 *  - clothes / bag / watch / shoes / ...
	 */
	(function(){
		$('.gnb > li').mouseover(function(){
			$(this).children('ol').show();
			$(this).children('ol').css({'top' : '30px', 'background':'red'});
		});

		$('.gnb > li').mouseout(function(){
			$(this).children('ol').hide();
		});
	})();
	
	/*
	 * °øÁö »çÇ× ·Ñ¸µ
	 */
	(function(){
		if ( $("#main_notice1_area").length > 0 ) {
			var main_notice = new imageAutoRolling('main_notice1_area', 'main_notice1', true);
			main_notice.direction = 12;
			main_notice.oTimer = 10;
			main_notice.moveSpeed = 10;
			main_notice.stopTimer = 3000;
			main_notice._create();
			main_notice.movingContent();
		}
	})();
	
	/*
	 * ÀÎ±â°Ë»ö¾î ·Ñ¸µ
	 */
	(function(){
		if ( $("#hotKeyWords_area").length > 0 ) {

			var list = $('#hotKeyWords').html();
			$('#displayList').append(list);
			$('#hotKeyWords_area').mouseover(function(){
				$('#displayList').show();
			});
			$('#displayList').mouseover(function(){
				$(this).show();
			});
			$('#displayList').mouseout(function(){
				$(this).hide();
			});

			var main_notice = new imageAutoRolling('hotKeyWords_area', 'hotKeyWords', true);
			main_notice.direction = 12;
			main_notice.oTimer = 10;
			main_notice.moveSpeed = 5;
			main_notice.stopTimer = 3000;
			main_notice._create();
			main_notice.movingContent();
		}
	})();
	
	/*
	 * ·Î±×ÀÎ ¹öÆ° Å¬¸¯ ÀÌº¥Æ® Ã³¸®
	 */
	(function(){
		var btnId = "LoginBtn";

		$("#" + btnId).css({'cursor' : 'pointer'});

		$("#" + btnId).click(function(){
			login_popup(430, 300);
		});
	})();
		
	/*
	 * ÁÂ¿ì Sticky Banner 
	 */
	(function(){
		var wrapper = '#header';
		var side_l = 'left_side';
		var side_r = 'right_side';
		
		$(wrapper).append($('#' + side_l));	
		$(wrapper).append($('#' + side_r));
		
		var top_margin = 172;
		/* document load */
		$('#' + side_l).css("top", $(document).scrollTop() + top_margin);
		$('#' + side_r).css("top", $(document).scrollTop() + top_margin);
			
		$('#' + side_r).css("left", $(wrapper).width() + 10);
				
		$(window).scroll(function(){  
			$('#' + side_l).css("top", $(document).scrollTop() + top_margin);
			$('#' + side_r).css("top", $(document).scrollTop() + top_margin);
		});
	
		$('#' + side_l).show();
		$('#' + side_r).show();
		
	})();
	
	/*
	 * ·Î±×ÀÎ À©µµ¿ì(ÆË¾÷ Ãâ·Â) 
	 */
	(function(){
		// loginPopup
		var loginBtnCls = 'img.loginPopup';
		
		$(loginBtnCls).css("cursor", "pointer");
		$(loginBtnCls).livequery('click', function(event) { 
			login_popup(430, 300); 
			return false;
		});
	})();

	var InputFocus = {
		classNameFocus  : "focus",
		classNameBlur   : "",

		initialize : function() {
			if ( window.ActiveXObject && document.selection && document.all && document.getElementById && document.getElementsByTagName ) {
				var inputs = document.getElementsByTagName("input");
				var end = inputs.length;				
				for (var i = 0 ; i < end; i++) {
					inputs[i].onfocus = function() {
						InputFocus.doFocus(this);
					};

					inputs[i].onblur = function() {
						InputFocus.doBlur(this);
					};
				}
			}
		},

		doBlur : function(el) {
			el.className = el.className.replace(this.classNameFocus, this.classNameBlur);
			el = null;
		},

		doFocus : function(el) {
			el.className = el.className + ' ' + this.classNameFocus;
		}

	};

	(function(){
		InputFocus.initialize();
	})();

});
