XDF_PATH = "/demo";

function Install()
{
	/*
	  // safari´Â Áö¿øÇÏÁö ¾Ê´Â´Ù.
	  if(new RegExp(/Safari/).test(navigator.userAgent))
	  {
		alert("One-click does not support safari browser.");
		return;
	  }
	  */
		if(new RegExp(/Safari/).test(navigator.userAgent))
		{
			document.AgentJava.SetXDFUrl("install");
		}
		else
		{
		  if (IsJvmEnabled())
		  {
				document.AgentJava.SetXDFUrl("install");
		  }
		}
}


function readXDF(LibCertURL, URL, page_num, find_word, title){
	if(URL.toUpperCase().search("/FILE") == -1){
		URL = "/FILE=\"" + URL + "\"";
	}
	if(page_num || page_num !=""){
		URL = URL + " /PAGE=\"" + page_num+"\"";
	}
	if(title !="" || title){
		URL = URL + " /TITLE=\"" + title + "\"";
	}
	if(find_word || find_word !=""){
		URL = URL + " /WORD=\"" + find_word + "\"";
	}
	if(new RegExp(/Safari/).test(navigator.userAgent)){
		document.AgentJava.SetXDFCert(LibCertURL, URL);
	}
	else{
		if (IsJvmEnabled()){
			document.AgentJava.SetXDFCert(LibCertURL, URL);
		}
	}
}

function readXDF(URL)
{
	  // safari´Â Áö¿øÇÏÁö ¾Ê´Â´Ù.
		  if(new RegExp(/Safari/).test(navigator.userAgent))
	  {
		alert("One-click does not support safari browser.");
		return;
	  }

	  if (IsJvmEnabled())
	  {
	  	URL = "http://210.219.252.213" + XDF_PATH + URL;
			document.AgentJava.SetXDFUrl(URL);
	  }
}


/*
function readXDF(URL, title)
{
	if (URL.toUpperCase().search("/FILE") == -1)
	{
		URL = "/FILE=\"" + URL + "\"";
	}
	
	if(title !="" || title) 
	{
		URL = URL + " /TITLE=\"" + title + "\"";
	}
	
	
	if(new RegExp(/Safari/).test(navigator.userAgent))
	{
		document.AgentJava.SetXDFUrl(URL);
	}
	else
	{
		 if (IsJvmEnabled())
		 {
			document.AgentJava.SetXDFUrl(URL);
		 }
	}
}
*/
function IsJvmEnabled()
{
  var lang;
  // ºê¶ó¿ìÁ®ÀÇ ¾ð¾î¸¦ °¡Á®¿Â´Ù.
  if(navigator.language)
    lang = navigator.language; // For FF(ko), Opera(ko), Safari(ko-KR)
  else
    lang = navigator.browserLanguage; // For IE6, IE7(ko)
  if (!JvmVersionCheck("1.6"))
  {
      var msg;
      if (lang)
      {
        if(lang.substring(0,2) == "ko")
          msg = "ÇöÀç ½Ã½ºÅÛÀÇ JRE(JVM)ÀÇ ¹öÀüÀÌ ³·½À´Ï´Ù. \nÃÖ½Å ¹öÀüÀÇ JRE ¾÷µ¥ÀÌÆ®¸¦ À§ÇØ ¼³Ä¡ÆäÀÌÁö¸¦ ¹æ¹®ÇÏ½Ã°Ú½À´Ï±î? ";
        else
          msg = "Do you want to go to a page where you can download Java?";
      }
      else
      {
        msg = "Do you want to go to a page where you can download Java?";
      }

      if (confirm(msg))
      {
        if (lang.substring(0,2) == "ko")
          window.open("http://java.com:80/ko/download/manual.jsp?locale=ko&host=java.com:80","needdownload"); // ÇÑ±¹¾î
        else
          window.open("http://jdl.sun.com/webapps/getjava/BrowserRedirect?locale=en&host=java.com","needdownload"); // ¿µ¾î
      }
      return false;
  }
  else
  {
    return true;
  }
}

function JvmVersionCheck(versionString)
{
    // Mozilla may not recognize new plugins without this refresh
    //navigator.plugins.refresh(true);
    if (navigator.mimeTypes['application/x-java-jnlp-file']) // only FF, Netscape
    {
        for (var i = 0; i < navigator.mimeTypes.length; ++i)
        {
            pluginType = navigator.mimeTypes[i].type;
            if (pluginType == "application/x-java-applet;version=" + versionString)
                return true;
         }
     }
     else // For Opera
     {
        if(window.navigator.javaEnabled())
        {
          var javaVer = java.lang.System.getProperty("java.version"); // ÀÌ ÄÚµå°¡ µ¿ÀÛÇÏ´Â ºê¶ó¿ìÁ®´Â opera, FF, Netscape
          if (javaVer.substring(0, 3) >= "1.6")
            return true;
         }
     }
}

