
var Menu = 
{
	init : function ()
	{
		$(".PeopleList").click( function () 
		{  
			PopOpen('/PeopleList', 'PeopleList', 1020, 900, 'S');
		});
		
		this.loginBoxSet();
		
		$('.NeedLogin').click(function()
		{
			if(!$('#SESSION').attr('MIDX'))
			{
				alert('글쓰기를 하시려면 로그인이 필요합니다.');
				go('/Login/?Ref='+encodeURIComponent($(this).attr('href')));
				
				return false;
			}
		});
		
		
	},
	
	loginBoxSet : function ()
	{
		
				$(".Detail").unbind().click( function () 
				{  
						PopOpen('/PopUp', 'Detail', 380, 320);
				});
			
				$(".logout").unbind().click( function () 
		 		{  
		 			if(confirm('로그 아웃 하시겠습니 까?'))
		 			{
		 				var Result = Ajax("/Regist.userLogout()", { dataType : 'text' });
		 				if(Result == 'OK') 
		 				{
		 					try
		 					{
			 					if(isObject(Main))
			 						Main.reloadLoginBox();
			 					else
			 						window.location.reload();
		 					}
			 				catch(e)
		 					{
		 						window.location.reload();
		 					} 
		 				}
		 			}
		 			
					return false;
				});
		
		
		
	}
	
};

$().ready( function () { Menu.init(); });


$().ready(function()
{
	var url = location.href;
	if(url.indexOf("/Eng") == -1)
	{
		var div = $(document.createElement('div')).attr({ id : 'viewPictureDialog'});
		div.insertAfter($('#wrap'));
	}
	
	$('.btnViewPicture').click(function()
	{
		var img = new Image();
		img.src=$(this).find('img').attr("src");
		
		
		$('#viewPictureDialog').html(
			'<img src="' + $(this).find('img').attr("src") + '" />' 
		);
		$('#viewPictureDialog').dialog(
		{
			width:img.width+26,
			height:img.height+37,
			title:$('#thisTitle').text() + " 이미지 보기"
		});
		
		return false;
	});
	
	$('.FileDownLoad').click(function()
	{
		var FileName = $(this).attr('href').replace('/_PDS', '');
		location.href = getComponentURL('Board', true) + 'Download.php?FileName=' + FileName;
		return false;
	});
});
