if (info.SYSTEM_ID == "iPECS eMG80" || info.SYSTEM_ID == "iPECS eMG800") {
	if (info.BOARD_ID == 2) {
		$('#login_content').css('padding','40px 30px');
		if (info.SYSTEM_ID == "iPECS eMG800") {
			$('#logo_image img').attr('src','img/Vertical_summit_800_login.png');
		} else {
			$('#logo_image img').attr('src','img/Vertical_summit_logo_login.png');
		}
		$('#elg_logo img').attr('src','img/ELG_logo(non_iPECS_ver).png');
	} else if (info.BOARD_ID == 3) {
		$('#login_content').css('padding','40px 30px');
		$('#logo_image img').attr('src','img/Aria_IP_100_logo_login.png');
		$('#elg_logo img').attr('src','img/ELG_logo(non_iPECS_ver).png');
	} else {
		$('#logo_image img').attr('src','img/iPECS_logo_login.png');
		$('#elg_logo img').attr('src','img/ELG_logo(iPECS_ver).png');
		if (info.NCODE == "TKM") {
			$('#system_id').text("OptiCon eMG");
		} else {
			$('#system_id').text(info.SYSTEM_ID);
		}
	}
} else {
	$('#logo_image img').attr('src','img/iPECS_logo_login.png');
	$('#elg_logo img').attr('src','img/ELG_logo(iPECS_ver).png');
	$('#system_id').text(info.SYSTEM_ID);
}

$('input[name=login_id]').focus();
$('#site_name').text(info.SITE_NAME);
$('#login_span_id').text(langs.getText("login","userid") + ":");
$('#login_span_pw').text(langs.getText("login","passwd") + ":");
$('.btn_login').text(langs.getText("login","submit"));
$('#link_userguide a').append(langs.getText("common","ug_title"));

if (err_code == 1) {
   $('#print_err').text(langs.getText("login","err_fail"));
} else if (err_code == 2) {
   $('#print_err').text(langs.getText("login","err_online"));
} else if (err_code == 3) {
   $('#print_err').text(langs.getText("login","err_blocked"));
}

if (info.SYSTEM_ID == "iPECS eMG80" || info.SYSTEM_ID == "iPECS eMG800") {
	if (info.SITE_NAME) {
		if (info.BOARD_ID == 2) {
			if (info.SYSTEM_ID == "iPECS eMG800") {
				$('title').text('Vertical Summit 800 (' + info.SITE_NAME + ')');
			} else {
				$('title').text('Vertical Summit (' + info.SITE_NAME + ')');
			}
		} else if (info.BOARD_ID == 3) {
			$('title').text('Aria IP 100 (' + info.SITE_NAME + ')');
		} else {
			if (info.NCODE == "TKM") {
				$('title').text('OptiCon eMG (' + info.SITE_NAME + ')');
			} else {
				$('title').text('iPECS (' + info.SITE_NAME + ')');
			}
		}
	} else {
		if (info.BOARD_ID == 2) {
			if (info.SYSTEM_ID == "iPECS eMG800") {
				$('title').text("Vertical Summit 800 " + langs.getText("common","adm_title"));
			} else {
				$('title').text("Vertical Summit " + langs.getText("common","adm_title"));
			}
		} else if (info.BOARD_ID == 3) {
			$('title').text("Aria IP 100 " + langs.getText("common","adm_title"));
		} else {
			if (info.NCODE == "TKM") {
				$('title').text("OptiCon eMG " + langs.getText("common","adm_title"));
			} else {
				$('title').text(info.SYSTEM_ID + " " + langs.getText("common","adm_title"));
			}
		}
	}
} else {
	if (info.SITE_NAME) {
		$('title').text('iPECS (' + info.SITE_NAME + ')');
	} else {
		$('title').text(info.SYSTEM_ID + " " + langs.getText("common","adm_title"));
	}
}

$('.text_login').keypress(function (evt) {
   if (evt.keyCode === 13) {
      sendit();
   }
});

$('.btn_login').click(function () {
   sendit();
});

function sendit() {
   $('#print_err').html("");

   if ($('input[name=login_id]').val() === "") {
      $('#print_err').text(langs.getText("login","err_idmiss"));
      $('input[name=login_id]').focus();
      return;
   } else if ($('input[name=login_pw]').val() === "") {
      $('#print_err').text(langs.getText("login","err_pwmiss"));
      $('input[name=login_pw]').focus();
      return;
   }

   var id_data, pwd_data, enc_id_data, enc_pwd_data;
   var $pem = public_key;
   var $key = RSA.getPublicKey($pem);
   id_data = $('input[name=login_id]').val();
   pwd_data = $('input[name=login_pw]').val();
   if(!offline_mode)
   {
       enc_id_data = RSA.encrypt(id_data, $key);
       enc_pwd_data = RSA.encrypt(pwd_data, $key);
   }
   else
   {
       enc_id_data = id_data;
       enc_pwd_data = pwd_data;
   }
   if (enc_id_data == "" || enc_pwd_data == "") {
      console.log("Error : Log-in failure");
      return;
   }

   $('input[name=ID]').val(enc_id_data);
   $('input[name=PWD]').val(enc_pwd_data);

   $('form[name=LOGIN_FORM]').submit();
}
