function Initialize()
{
  document.getElementById("chkIAgree").checked = false;
  if (HasRuntimeVersion(runtimeVersion))
  {
    InstallButton.href = directLink;
    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;
}


function CopyValues()
{	
	
	if (document.login_form.accounttype.selectedIndex < 1)
	{
		alert("請選擇賬戶類型");				
		document.login_form.accounttype.focus;
		return false;
	}	
	
	if (document.login_form.platformtype.selectedIndex < 1)
	{
		alert("請選擇交易平臺");				
		document.login_form.platformtype.focus;
		return false;
	}
	
	if (document.login_form.platformtype.selectedIndex == 1)
	{		
		document.login_form.method = 'GET';		
		
		if (document.login_form.accounttype.selectedIndex == 1)
		{
			document.login_form.action = 'http://applet.efxnow.com/frxc_sys/fxgui_t.html';
			document.login_form.target = '_blank';
		}    		
		else
		{
			document.login_form.action = 'http://demo.efxnow.com/frxc_demo/fxgui_t.html';
			document.login_form.target = '_blank';
		}
		
		return true;
	}
	
	if (document.login_form.platformtype.selectedIndex == 2)
	{
		document.login_form.method = 'GET';		
		
		if (document.login_form.accounttype.selectedIndex == 1)
		{
			document.login_form.action = 'login.html?accountype=live&platformtype=html';
			document.login_form.target = '_top';
		}    		
		else
		{
			document.login_form.action = 'login.html?accountype=demo&platformtype=html';
			document.login_form.target = '_top';
		}
										
	}
	
	if (document.login_form.platformtype.selectedIndex == 3)
	{
		document.login_form.method = 'GET';
		
		if (HasRuntimeVersion(runtimeVersion))
    {
      document.login_form.action = 'http://cndownload.efxnow.com/forextrader/forextrader.application';
      document.login_form.target = '_top';
    }
    else
    {
    	document.login_form.action = 'http://www.forex.com/cnt/land-windows.html';
    	document.login_form.target = '_top';
    }
    		
		return true;
	}	
	
}