﻿// JScript 파일
runtimeVersion = "2.0.0";
directLink = "ExamClient.application";


function Initialize()
{
  if (HasRuntimeVersion(runtimeVersion))
  {
    InstallButton.href ="http://61.100.180.104:8080/Client/"+directLink;
    //BootstrapperSection.style.display = "none";
  }
}

function goExam(exam)
{
  if (HasRuntimeVersion(runtimeVersion))
  {
    location.href ="http://61.100.180.104:8080/Client/ExamClient.application?exam="+exam;
    //BootstrapperSection.style.display = "none";
  }
  else
  {
    location.href='http://61.100.180.104:8080/Client/setup.exe';
  }
}

function goExamSection(exam)
{
  if (HasRuntimeVersion(runtimeVersion))
  {
    location.href ="http://61.100.180.104:8080/Client/ExamClient.application?exam="+exam;
    //BootstrapperSection.style.display = "none";
  }
  else
  {
    location.href='http://61.100.180.104:8080/Client/setup.exe';
  }
}

function goAudioCheck()
{
  if (HasRuntimeVersion(runtimeVersion))
  {
    location.href ="http://61.100.180.104:8080/audiocheck/AudioCheck.application";
    //BootstrapperSection.style.display = "none";
  }
  else
  {
    location.href='http://61.100.180.104:8080/audiocheck/setup.exe';
  }
}

function Initialize_test()
{
  if (HasRuntimeVersion(runtimeVersion))
  {
    InstallButton.href ="http://61.100.180.104:8080/Client/ExamClient.application?exam=ggQv3SRXPhs5MrttJMcuVuOSyMaAM4ruC9h31yMi+4MamCIYqM1hlg%3d%3d";
    //BootstrapperSection.style.display = "none";
  }
}

function HasRuntimeVersion(v)
{
  var va = GetVersion(v);
  var i;
  var a = navigator.userAgent.match(/\.NET CLR [0-9.]+/g);
  if (a != null)
    for (i = 0; i < a.length; ++i)
      if (CompareVersions(va, GetVersion(a[i])) <= 0)
		return true;
  return false;
}
function GetVersion(v)
{
  var a = v.match(/([0-9]+)\.([0-9]+)\.([0-9]+)/i);
    return a.slice(1);
}
function CompareVersions(v1, v2)
{
  for (i = 0; i < v1.length; ++i)
  {
    var n1 = new Number(v1[i]);
    var n2 = new Number(v2[i]);
    if (n1 < n2)
      return -1;
    if (n1 > n2)
      return 1;
  }
  return 0;
}