// ÇöÀçÁ¢¼ÓÀÚ ¸ñ·Ï ºÒ·¯¿À±â
function connect_ajax() {
	$.ajax({
		type: "POST",
		url: "/g2/module/connect/connect_ajax.php",
    	cache: "false",
		success: function(html){
			$("#connect_ajax").fadeIn("fast");
			$("#connect_ajax_content").html(html);
		}
	}); 
    $("#connect_ajax").expose({
    	api: true,
    	color: "#000",
    	opacity: 0.1,
    	onClose: function(){
    		$("#connect_ajax").hide();
    	}
    }).load(); 
}		
$(function() {
	var zIndexNumber = 1000;
	$('#menu_div li').each(function() {
		$(this).css('zIndex', zIndexNumber);
		zIndexNumber -= 10;
	});
});
$(document).ready(function(){


	
	$("td.doubleclick_navi").dblclick(function(){
		var scrollPos = Math.max( document.body.scrollTop, document.documentElement.scrollTop );
	    if (scrollPos == 0) {
	    	window.scrollTo(0,document.body.scrollHeight);
	    } else {
	    	window.scrollTo(0,0);
	    }
	})
	$("#body_table").dblclick(function(){
		return false;
	})
    $("#view_Contents").bind("contextmenu",function(e){
        $(this).expose({
        	api: true,
        	color: "#888",
        	opacity: 1,
        	maskId: 'a_lights_help',
        	onClose: function(){
        		$("#a_light").fadeIn("fast");
        	}
	        }).load(); 
        $("#a_light").fadeOut("fast")
    });


	// ¸ÞÀÎ follow ÀúÀÚ Ç¥½Ä
	$(".follow_row").each(function(){
		$(this).hover(function(){
			$(this).find(".follow_author").show();
		},function(){
			$(this).find(".follow_author").hide();
		});
	});

/*
	$("#connect_close").click(function(){
		$("#connect_ajax").fadeOut("fast");
	})
*/

	$("#outlogin_login").click(function(){
		$("#outlogin_form").fadeIn("fast");
        $("#outlogin_form").expose({
        	api: true,
        	color: "#000",
        	opacity: 0.1,
        	onClose: function(){
        		$(".outlogin_form").hide();
        	}
	    }).load(); 
		$("#outlogin_id").focus();
	})
/*
	$(".outlogin_close").click(function(){
		$(".outlogin_form").fadeOut("fast");
	})
*/



	$("#outlogin_standings").click(function(){
		$("#outlogin_standings_ajax").fadeIn("fast");
        $("#outlogin_standings_ajax").expose({
        	api: true,
        	color: "#000",
        	opacity: 0.1,
        	onClose: function(){
        		$("#outlogin_standings_ajax").hide();
        	}
	    }).load(); 
		$.ajax({
			type: "POST",
			url: "/g2/module/playbyplay/game_schedule/mini_standings_conference.php",
			cache: "false",
			success: function(html){
				$("#outlogin_standings_ajax_content").html(html);
			}
		});
	})
/*
	$("#outlogin_standings_close").click(function(){
		$("#outlogin_standings_ajax").fadeOut("fast");
	})
*/
	

	// ¼±ÅÃµÈ ¸Þ´º È¿°ú
	$("li.menu_selected").css({
		'color': '#eee'
	})
	
		$("#lounge span").css({
			'text-decoration': 'none'
		})


	// µå·Ó´Ù¿î ¸Þ´º
	$("#menu_div li.dropdown").hover(function() {

		$(this).find("ul.subnav").fadeIn('fast');
		$(this).removeClass('menu_no_over');
		$(this).addClass('menu_community_over2');
		$(this).addClass("subhover");

	}, function(){
		$(this).find("ul.subnav").fadeOut('fast');
		$(this).addClass('menu_no_over');
		$(this).removeClass('menu_community_over2');
		$(this).removeClass("subhover");

	});

	// µå·Ó´Ù¿î ¸Þ´º (¼­ºê¸Þ´º)
	$("#sub_menu_community .bottom_dropdown").mouseenter(function() { 

		$(this).find("ul.subnav").fadeIn('fast').show();
		$(this).removeClass('bottom_no_over');
		$(this).addClass('bottom_on_over');

		$(this).mouseleave(function() {
			$(this).find("ul.subnav").fadeOut('fast');
			$(this).removeClass('bottom_on_over');
			$(this).addClass('bottom_no_over');
		});

		}).hover(function() {
			$(this).addClass("subhover");
		}, function(){
			$(this).removeClass("subhover");
	});
	

	// ¸Þ´º ¼½¼Ç Ç¥½Ã È¿°ú ½ÃÀÛ
	$("ul#menu_nba_ul").hover(function(){
		$("div#nba_section").show();
	}, function() {
		$("div#nba_section").hide();
	})
	$("ul#menu_community_ul").hover(function(){
		$("div#community_section").show();
	}, function() {
		$("div#community_section").hide();
	})
	// ¸Þ´º ¼½¼Ç Ç¥½Ã È¿°ú ³¡


	// ¸Þ´º ¸¶¿ì½º ¿À¹ö È¿°ú ½ÃÀÛ
	$("li.menu_nba").hover(function(){
		$(this).removeClass('menu_no_over');
		$(this).addClass('menu_nba_over');
	}, function() {
		$(this).removeClass('menu_nba_over');
		$(this).addClass('menu_no_over');
	})
	$("li.menu_community").hover(function(){
		$(this).removeClass('menu_no_over');
		$(this).addClass('menu_community_over');
	}, function() {
		$(this).removeClass('menu_community_over');
		$(this).addClass('menu_no_over');
	})
	// ¸Þ´º ¸¶¿ì½º ¿À¹ö È¿°ú ³¡
	
	// ÇÏ´Ü ¸Þ´º ¸¶¿ì½º ¿À¹ö È¿°ú ½ÃÀÛ
	$("ul#sub_menu_nba li, ul#sub_menu_community li").hover(function(){
		$(this).removeClass('bottom_no_over');
		$(this).addClass('bottom_on_over');
	}, function() {
		$(this).removeClass('bottom_on_over');
		$(this).addClass('bottom_no_over');
	})
	// ÇÏ´Ü ¸Þ´º ¸¶¿ì½º ¿À¹ö È¿°ú ³¡


	// ¿î¿µ°ü·Ã ¸Þ´º ¸¶¿ì½º ¿À¹ö È¿°ú ½ÃÀÛ
	$("div#bottom_row1 a span").hover(function(){
		$(this).css({
			'color': '#eee'
		})
	}, function() {
		$(this).css({
			'color': '#aaa'
		})
	})
	// ¿î¿µ°ü·Ã ¸Þ´º ¸¶¿ì½º ¿À¹ö È¿°ú ³¡


	
	function schedule_load(day) {
		$.ajax({
			type: "POST",
			url: "/g2/module/playbyplay/game_schedule/mini_schedule.php",
			data: "day=" + day,
			cache: "false",
			success: function(html){
				$("#schedule_content").html(html);
			}
		});
	}
	$("div#outlogin_schedule").click(function(){
		schedule_load(4);
		$("#show_schedule").fadeIn("fast");
        $("#show_schedule").expose({
        	api: true,
        	color: "#000",
        	opacity: 0.1,
        	onClose: function(){
        		$("#show_schedule").hide();
        	}
	    }).load(); 
	})
	$("#schedule_ago3").click(function(){
		schedule_load(1);
	})
	$("#schedule_ago2").click(function(){
		schedule_load(2);
	})
	$("#schedule_ago1").click(function(){
		schedule_load(3);
	})
	$("#schedule_today").click(function(){
		schedule_load(4);
	})
	$("#schedule_later1").click(function(){
		schedule_load(5);
	})
	$("#schedule_later2").click(function(){
		schedule_load(6);
	})
	$("#schedule_later3").click(function(){
		schedule_load(7);
	})

	$("#show_schedule").mouseenter(function(){
		$(this).show();
	})
/*
	$("#schedule_content, .schedule_close").click(function(){
		$("#show_schedule").fadeOut("fast");
	})
*/


	// ÂÊÁö ¿ÔÀ» ¶§ ¾Ë¸² ÆË¾÷
	$("div#message_call").animate({
		height: "toggle",
		opacity: "toggle"
	}, "slow").delay(5000).animate({
		height: "toggle",
		opacity: "toggle"
	}, "normal");	


	// ÃÖ±ÙÂ¡°è
	$("a#recent_executions").colorbox({
		width:"710px", 
		height:"600px", 
		iframe:true,
		close: "close"
	});

	// Useful Links Å¬¸¯ÇÒ ¶§
	$("div#about_slidedown_btn").click(function(){
		$.ajax({
			type: "POST",
			url: "/g2/sidebar/side.useful_links_ajax.php",
	    	cache: "true",
			success: function(html){
				$("div#about_slidedown").html(html);
			}
		}); 
		$("div#about_slidedown").slideToggle("normal");
	})
	
	// ¾Æ¿ô·Î±×ÀÎ¿¡¼­ ÇÃ·¹ÀÌ¸®½ºÆ® Å¬¸¯ÇßÀ» ¶§ 
	$("a#playlist_load_ol").click(function(){
		$(".outlogin_form").fadeOut("normal");
	})

	// »ó´Ü¾Æ¿ô·Î±×ÀÎ
	$("a#password_forget").colorbox({
		width:"630px", 
		height:"550px", 
		iframe:true,
		close: "close"
	});

	// »ó´Ü¾Æ¿ô·Î±×ÀÎ
	$("a.report_proceed_btn, a.report_btn").colorbox({
		width:"630px", 
		height:"90%", 
		iframe:true,
		close: "close"
	});

	$("div#outlogin_login").click(function(){
		$("form#outlogin_form").fadeIn("fast");
		$("#outlogin_id").focus();
	})

/*
	$(".outlogin_close").click(function(){
		$(".outlogin_form").fadeOut("fast");
	})
*/
	
	
});

