$(document).ready(function(){
	$("body").click(function() {
		var diy = $(".header_search").css("display");
		if (diy == "block") {
			$("#kw").val(defaultSearchText);
			$(".header_search").hide();
		}
	});	

	$("ul.dropdown > li").hover(function(){
		$(this).addClass("hover");
		$('ul:first',this).css('visibility','visible');
		$(this).find('a:eq(0)').addClass("onmanu");
	},function(){
		$(this).removeClass("hover");
		$('ul:first',this).css('visibility','hidden');
		$(this).find('a:eq(0)').removeClass("onmanu");
	});


	$("a").focus(function(){$(this).blur();});
	//sethttp_01_003()

	mainHero();
	set_index();

	// 2011-10-24 Scroll Top  re
		var currentPosition = parseInt($(".btn-Mtop").css("top"));
		$(window).scroll(function() {
			var scrollPosition = $(window).scrollTop(); // ���� ��ũ�ѹ��� ��ġ���� ��ȯ�մϴ�.
			var docHeight = $("body").outerHeight();

			if (docHeight <= 400){var position = scrollPosition-200;}
			else if (docHeight <= 600){var position = scrollPosition+currentPosition-200;}
			else {var position = scrollPosition+currentPosition;}

			$(".btn-Mtop").stop().animate({"top":position+"px"},100);
		});
});

function set_index(){
	$(".ad-bada-pop").click(function(){
		$(".servicesite-parent .servicesite").show();
		return false;
	});

	$(".servicesite-parent .servicesite .close-btn").click(function(){
		$(".servicesite-parent .servicesite").hide();
		return false;
	});
}

function set_dev_bl_001(){
	$(".betalab-list div.border").corner("round 5px").parent().css('padding', '1px').corner("round 7px");
	$(".Mobile-list div.border").corner("round 5px").parent().css('padding', '1px').corner("round 7px");
}

function mainHero(){

	$(".hero-thumb a").click(function(){
		$(".hero-thumb a").removeClass();

		//$(".hero-thumb a img").attr("src",$(".hero-thumb a img").attr("src").replace("on","off"))
		$(".hero-thumb a img").each(function(){
			var temp = $(this).attr("src");
			$(this).attr("src",temp.replace("on","off"))
		});
		$(this).addClass("on");
		var temp = $(".hero-thumb a").index(this);
		$(".hero-area > img").attr("src","../img/mv_0"+(temp+1)+".jpg")
		var imgstr = $(this).find("img").attr("src");
		$(this).find("img").attr("src",imgstr.replace("off","on"))

	});
}

function setSingup(){
	$("div.sign-list-box").corner("round 3px").parent().css('padding', '1px').corner("round 5px");
	$("div.sign-list-box").each(function(){
		var maxheight = 0
		if(maxheight<$(this).height())maxheight = $(this).height();
		$("div.sign-list-box").css("min-height",maxheight+"px")
	});
}

function set_ds_001(){
	//alert("!")
	$(".box-type-5").corner("7px");
	$(".compare-list").corner("round 5px").parent().css('padding', '1px').corner("round 7px");

}

function set_gt_001(){
	//alert("!")
	$(".getting-step ul").corner("round 5px").parent().css('padding', '1px').corner("round 7px");

}
function sethttp_01_003(){

	$("#boxType2").corner("7px");
	$(".resources-cont").corner("5px");
	$(".platform .list > ul").corner("round 3px").parent().css('padding', '2px').corner("round 5px");
	$(".resources-side .on").corner("4px left");

	$(".resources-cont:eq(0)").show();
	$(".resources-side ul li").hover(function(){
		$(this).css("font-weight","bold");
	},function(){
		$(this).css("font-weight","normal");
	}).click(function(){

		$(".resources-side li").removeClass();
		$(this).addClass("on");
		var temp = $(".resources-side ul li").index(this);
		$(".resources-cont").hide();
		$(".resources-cont:eq("+temp+")").show();
		$(".resources-side .on").corner("4px left");
		return false;

	});


}
function resizeLayer(){
	$("#modal-layers").width($(document).width());
	$("#modal-layers").height($(document).height());
}

function popupOpen(id){

	$("#modal-layers").show();
	$(window).bind("resize",resizeLayer);

	$("#"+id).show();

	$("#modal-layers").width($(document).width()).css('opacity',0.5);
	$("#modal-layers").height($(document).height());
}

function popupCloase(id){
	$("#modal-layers").hide();
	$("#"+id).hide();
	$(window).unbind("resize",resizeLayer);
}

$(function() {
	$(".btn-type-9").click(function() {
		$(".selLang").show();});
    $('.selLang').hover(
        function () { $(this).show();},
        function () { $(this).hide(); });
});

