/*------------------------------------------------------------------------------------*/
/*------------------------------ °ÔÀÓ ½ÇÇà °ü·Ã : ½ÃÀÛ -------------------------------*/
/*------------------------------------------------------------------------------------*/

// °ÔÀÓ½ÇÇà
// bolType : 1 = Á¤»ó, 0 = Á¦Àç
// °ÔÀÓ½ÇÇà ¹öÆ°À» ´©¸£¸é Á¦ÀÏ ¸ÕÀú È£ÃâµÈ´Ù
function startgame( bolType )
{
	document.all.ifrForLog.src = 'http://maplestory.nexon.com/Common/Page/Gnx.aspx?URL=ForWiseLog/StartGame';
	
	var n1Mode = 0;
	
	if ( n1Mode == "0" )
	{
		if ( getCookies( "MIL" ) == "1" )
		{
			if ( bolType == "1" )      // Á¤»ó À¯Àú
			{
				location.href = "http://maplestory.nexon.com/MapleStory/Page/Optimize.aspx";
				//Launch( 1, 0 );
			}
			//else if ( bolType == "2" )      // ³Ø½¼Å»Åð
			//{
			//    window.open('http://maplestory.nexon.com/MapleStory/Page/Gnx.aspx?URL=Common/POP_Clean01','winClean','width=550, height=400');   
			//}
			else      // Á¦Àç À¯Àú
			{
				alert( 'Á¢¼ÓÀÌ Á¦ÇÑµÈ °èÁ¤ÀÔ´Ï´Ù' );
				//blockuser();
			}
		}
		else
			//openModalDialog( 10 );	
			alert( "°ÔÀÓ ½ÇÇàÀ» À§ÇØ ·Î±×ÀÎÀÌ ÇÊ¿äÇÕ´Ï´Ù" );
	}
	else
	{
    	LaunchGame();
	}
}

// ÇØÀû ºê·£µå »çÀÌÆ®¿¡¼­ °ÔÀÓ ½ÇÇà½Ã
function startgame2(WID)
{
	document.all.ifrForLog.src = 'http://maplestory.nexon.com/Common/Page/Gnx.aspx?URL=ForWiseLog/StartGame';
	
	var n1Mode = 0;
	
	if ( n1Mode == "0" )
	{
		if ( getCookies("MIL") == "1" )      // ·Î±×ÀÎ À¯Àú
		{
			if ( getCookies("MIB") == "1" )      // Á¦Àç À¯Àú
				alert( 'Á¢¼ÓÀÌ Á¦ÇÑµÈ °èÁ¤ÀÔ´Ï´Ù' );
			else      // Á¤»ó À¯Àú  
    			LaunchGame(WID);
				//Launch( 1, 0 );
		}
		else
			//openModalDialog( 10 );	
			alert( "È¨ÆäÀÌÁö¿¡¼­ ·Î±×ÀÎ ÈÄ °ÔÀÓ½ÇÇàÀ» ÇØÁÖ¼¼¿ä" );
	}
	else
	{
    	LaunchGame(WID);
		//gamelauncher();
	}
}


// °ÔÀÓ Àç¼³Ä¡
function reInstall()
{	
	Launch( 1, 1 );
}

// Æ¯Á¤ ÀÌ¸§ÀÇ ÄíÅ°°ª ÃßÃâ
function getCookies( nameVal ) 
{
	var numCookie = document.cookie.length;      // ÄíÅ° °¹¼ö
	var oven = document.cookie.split( "; " );      // °¢°¢ÀÇ ÄíÅ°¼Ó¼º=°ª ºÐ¸®
	
	for ( var i = 0; i < oven.length; i++ ) 
	{
		if ( oven[ i ].indexOf( "=" ) != -1 )      // '=' ÀÌ Á¸ÀçÇÏ´Â °æ¿ì
			cookieName = oven[ i ].substring( 0, oven[ i ].indexOf( "=" ) );      // ÄíÅ° ÀÌ¸§ ÃßÃâ
		else      // '=' ÀÌ Á¸ÀçÇÏÁö ¾Ê´Â °æ¿ì
			cookieName = oven[ i ];
		
		if ( cookieName == nameVal )      // ÃßÃâÇÑ ÄíÅ° ÀÌ¸§ÀÌ ³Ñ¾î¿Â °ª°ú ÀÏÄ¡ÇÏ¸é 
		{
			if ( oven[ i ].indexOf( "=" ) != -1 )      // '=' ÀÌ Á¸ÀçÇÏ´Â °æ¿ì
				cookieVal = oven[ i ].substr( oven[i].indexOf( "=" ) + 1 );      // ÄíÅ° °ª ÃßÃâ
			else      // '=' ÀÌ Á¸ÀçÇÏÁö ¾Ê´Â °æ¿ì
				cookieVal = "";      // ÄíÅ°°ª ¾øÀ½
			
			return cookieVal;
		}
	}
	
	return "";

}


// NGM °ÔÀÓ½ÇÇà °ü·Ã ÇÔ¼ö Ãß°¡
function LaunchGame(WID)
{
	NGM.MxLaunchGame( '589825', 'WebStart', WID );
}
	
function ForceInstall()
{
	NGM.MxForceInstall( '589825', '' );
}
/*------------------------------------------------------------------------------------*/
/*------------------------------ °ÔÀÓ ½ÇÇà °ü·Ã :  ³¡  -------------------------------*/
/*------------------------------------------------------------------------------------*/
