//////////////////////////////////////////////////////////////////////////////////////////////////////////////
// ÆÄÀÏ¸í : AGSTrust.js
// ÀÛ¼ºÀÏÀÚ : 2004/04
//
// AGSTrust ÇÃ·¯±×ÀÎ µ¿ÀÛÀ» Á¦¾îÇÏ´Â ÀÚ¹Ù½ºÅ©¸³Æ®¼Ò½º
//
// Copyright 2004 AEGISHYOSUNG.Co.,Ltd. All rights reserved.
//////////////////////////////////////////////////////////////////////////////////////////////////////////////

var AGSTRUST_MSG = "À©µµ¿ìÁî XP SP2 Àû¿ë »ç¿ëÀÚÀÇ °æ¿ì °­È­µÈ º¸¾È ¼³Á¤À¸·Î ÀÎÇØ ¿Ã´õ°ÔÀÌÆ®°¡ Á¦°øÇÏ´Â ÀÎÅÍ³Ý °áÁ¦Ã¢ÀÌ ¶ßÁö ¾ÊÀ» ¼ö ÀÖ½À´Ï´Ù. \n\n¾ÈÁ¤ÀûÀÎ ¼­ºñ½º »ç¿ëÀ» À§ÇÏ¿© °í°´ PCÀÇ Internet Explorer '½Å·ÚÇÒ ¼ö ÀÖ´Â »çÀÌÆ®' ¼³Á¤¿¡ ¾Æ·¡ »çÀÌÆ®¸¦ µî·ÏÇÏ°íÀÚ ÇÏ´Â °æ¿ì µ¿ÀÇÇÔÀ» Å¬¸¯ÇØ ÁÖ½Ê½Ã¿À.";

function SetField(form)
{
	//////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// General
	//////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	document.AGSTrust.IFplugin(0, "AGSTRUST_MSG", AGSTRUST_MSG);
	
	document.AGSTrust.IFplugin(0, "StoreId", form.StoreId.value);
	
	document.AGSTrust.IFplugin(0, "StoreNm", form.StoreNm.value);
	
	document.AGSTrust.IFplugin(0, "Domains", form.Domains.value);
	
	return true;
}

function StartTrustUpdate()
{
	
	if(navigator.appName == 'Netscape')
		;
	else
	{
		if(IsSP2() == true)
		{
			document.writeln("<OBJECT ID=AGSTrust CLASSID=CLSID:67A438CF-D993-439B-B981-3023FF9E5757 width=0 height=0 CODEBASE=http://www.allthegate.com/plugin/AGSTrust.cab#Version=1,0,0,2 onerror=OnErr()></OBJECT>");
		}
	}
}

function OnErr()
{
	if(IsSP2() == true)
	{
		alert("[AGSTrust ÄÁÆ®·Ñ]ÀÌ ¼³Ä¡µÇÁö ¾Ê¾Ò½À´Ï´Ù.\n\nºê¶ó¿ìÀú »ó´ÜÀÇ ³ë¶õ»ö[¾Ë¸²Ç¥½ÃÁÙ]À» Å¬¸¯ÇÏ½Å ÈÄ [ActiveX ÄÁÆ®·Ñ ¼³Ä¡]¸¦ Å¬¸¯ÇÏ¼¼¿ä.");
	}
}

function MakeTrustMessage(form)
{
	if(IsSP2() == true)
	{
		if(SetField(form) == false) 
		{
			return false;
		}
		
		if(document.AGSTrust.IFplugin(1, "", "") == "ERROR") 
		{
			return false;
		}
		
		if(document.AGSTrust.IFplugin(2, "", "") == "ERROR") 
		{
			return false;
		}
		
		if(document.AGSTrust.IFplugin(3, "", "") == "ERROR") 
		{
			return false;
		}
	}
	
	return true;
}

function IsSP2()
{
	var ua = window.navigator.userAgent;
	
	var msie = ua.indexOf("MSIE");	
	var msxp = ua.indexOf("Windows NT 5.1");
	var ms2003 = ua.indexOf("Windows NT 5.2");
	var msxpsp2 = ua.indexOf("SV1");
	var msxpie7 = ua.indexOf("MSIE 7.0");	
	var msxpie8 = ua.indexOf("MSIE 8.0");	

	if(msie > 0 && msxp > 0) // WindowsXP
	{
		if(msxpie7 > 0 || msxpie8 > 0) // WindowsXP - Service Pack 2 - Internet Explorer 7
		{
			return true;
		}
		else
		{
			if(msxpsp2 > 0) // WindowsXP - Service Pack 2
			{
				return true;
			}
			else
			{
				return false;
			}
		}
	}
	else if(msie > 0 && ms2003 > 0) // Windows2003
	{
		if(msxpie7 > 0 || msxpie8 > 0)
		{
			return true;
		}
		else
		{
			return false;
		}
	}
	else // Windows98, WindowsME, WindowsNT, Windows2000
	{
		return false;
	}
}