﻿function SetLang(val)
{
  var _host = (location.protocol + '//' + location.host + '/').toLowerCase();
  var _url = location.href.toLowerCase();

  if(_host == _url)
  {
    $get('langEnglish').href = '/page/english/';
    $get('langMalay').href = '/page/malay/';
    $get('langChinese').href = '/page/chinese/';
  }
  else if(_url == _host + 'default.aspx')
  {
    $get('langEnglish').href = '/page/english/';
    $get('langMalay').href = '/page/malay/';
    $get('langChinese').href = '/page/chinese/';
  }
  else
  {
    var _olang = location.href.substring(_host.length + 5);
    _olang = _olang.substring(0, _olang.indexOf('/'));
    $get('langEnglish').href = location.href.replace('/' + _olang + '/', '/english/');  
    $get('langMalay').href = location.href.replace('/' + _olang + '/', '/malay/');  
    $get('langChinese').href = location.href.replace('/' + _olang + '/', '/chinese/');  
  }
}