$(document).ready(function(){

	// $(document).pngFix();

	function bluring(){
		if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();
	}
	

	document.onfocusin=bluring;

	check_searchbar_bg();
	
	function check_searchbar_bg() {
		var $search_value = $("#top_search_input").val();
		if ($search_value == "") {
			$("#top_search_input").css("background-image", "url(/img/common/btn_top_search_bg.png) no-repeat");
		} else {
			$("#top_search_input").css("background-image", "none");
		}
	}
	
	$("#icon_twitter").click(function() {
		window.open("http://twitter.com/", "twitter", "");
	});
	
	$("#icon_facebook").click(function() {
		window.open("http://facebook.com/", "facebook", "");
	});
	
	$("#menu1_div").hover(
		function() {
			$(this).css("color","#ffcc00");
		}, function () {
			$(this).css("color","#666666");
		}
	);
	
	$("#menu2_div").hover(
		function() {
			$(this).css("color","#00cccc");
			$("#menu2_sub_div").fadeIn(300);
		}, function () {
			$(this).css("color","#666666");
			$("#menu2_sub_div").fadeOut(600);
		}
	);	
/*	
	$("#menu2_div").click(function() {
		window.location.href="/ourworks/index.php?w_idx=0";
	});
*/	
	$("#menu3_div").hover(
		function() {
			$(this).css("color","#cc3366");
		}, function () {
			$(this).css("color","#666666");
		}
	);		
	
	$("#menu4_div").hover(
		function() {
			$(this).css("color","#ff9933");
		}, function () {
			$(this).css("color","#666666");
		}
	);	
		
	$("#menu_right1_div").hover(
		function() {
			$(this).css("color","#cccc33");
		}, function () {
			$(this).css("color","#666666");
		}
	);	
	
	$("#menu_right2_div").hover(
		function() {
			$(this).css("color","#6699cc");
		}, function () {
			$(this).css("color","#666666");
		}
	);	
	
	$("#menu_right3_div").hover(
		function() {
			$(this).css("color","#993399");
			$("#menu2_sub_div2").fadeIn(300);
		}, function () {
			$(this).css("color","#666666");
			$("#menu2_sub_div2").fadeOut(600);
		}
	);	
	
	$(".menu2_sub_subject").hover(
	function() {
		$(this).css("background", "url(/img/common/menu_single_bg.png) no-repeat");
		$(this).css("color", "#ffffff");
	}, function() {
		$(this).css("background-image", "none");
		$(this).css("color", "#000000");
	});
	
	$(".menu2_sub_subject").click(function() {
		var w_idx = $(this).attr("w_num");
		window.location.href="/ourworks/index.php?w_idx="+w_idx;
	});
	
	
	$(".menu2_sub_subject2").hover(
	function() {
		$(this).css("background", "url(/img/common/menu_single_bg2.png) no-repeat");
		$(this).css("color", "#ffffff");
	}, function() {
		$(this).css("background-image", "none");
		$(this).css("color", "#000000");
	});	
	
	$(".menu2_sub_subject2").click(function() {
		var link_src = $(this).attr("link_src");
		window.location.href=link_src;
	});
	
	
	$("#div_top_logo").click(function() {
		window.location.href="/index.php";
	});
	
	
	
	$("#menu1_div").click(function() {
		var db_src = $(this).attr("db_src");
		window.location.href=db_src;
	});	
	
	$("#menu3_div").click(function() {
		var db_src = $(this).attr("db_src");
		window.location.href=db_src;
	});		

	$("#menu4_div").click(function() {
		var db_src = $(this).attr("db_src");
		window.location.href=db_src;
	});		
	
	$("#menu_right1_div").click(function() {
		var db_src = $(this).attr("db_src");
		window.location.href=db_src;
	});

	$("#menu_right2_div").click(function() {
		var db_src = $(this).attr("db_src");
		window.location.href=db_src;
	});


	
});
