//login page
function ValidateForm() {
var email = document.getElementById("email");
var password = document.getElementById("password");
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (!filter.test(email.value)) {
alert("Eメールアドレスを入力してください。");email.focus();
return false;
}
if ((password.value==null)||(password.value=="")){
alert("パスワードを入力してください。");password.focus();
}
}
/*
function showdiv(id) {
if (document.getElementById) { // DOM3 = IE5, NS6
if (document.getElementById(id).style.display == "none"){
document.getElementById(id).style.display = 'block';
} else {
document.getElementById(id).style.display = 'none';
}
} else {
if (document.layers) {
if (document.id.display == "none"){
document.id.display = 'block';
} else {
document.id.display = 'none';
}
} else {
if (document.all.id.style.visibility == "none"){
document.all.id.style.display = 'block';
} else {
document.all.id.style.display = 'none';
}
}
}
}
*/
// Password strength meter
var bCheckNumbers = true;
var bCheckUpperCase = true;
var bCheckLowerCase = true;
var bCheckPunctuation = true;
var nPasswordLifetime = 365;
// Check password
function checkPassword(strPassword){
// Reset combination count
nCombinations = 0;
// Check numbers
if (bCheckNumbers){
strCheck = "0123456789";
if (doesContain(strPassword, strCheck) > 0) {
nCombinations += strCheck.length;
}
}
// Check upper case
if (bCheckUpperCase){
strCheck = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
if (doesContain(strPassword, strCheck) > 0) {
nCombinations += strCheck.length;
}
}
// Check lower case
if (bCheckLowerCase){
strCheck = "abcdefghijklmnopqrstuvwxyz";
if (doesContain(strPassword, strCheck) > 0){
nCombinations += strCheck.length;
}
}
// Check punctuation
if (bCheckPunctuation){
strCheck = ";:-_=+\|//?^&!.@$」#*()%~<>{}[]";
if (doesContain(strPassword, strCheck) > 0) {
nCombinations += strCheck.length;
}
}
// Calculate
// -- 500 tries per second => minutes
var nDays = ((Math.pow(nCombinations, strPassword.length) / 500) / 2) / 86400;
// Number of days out of password lifetime setting
var nPerc = nDays / nPasswordLifetime;
return nPerc;
}
// Runs password through check and then updates GUI
function runPassword(strPassword, strFieldID){
// Check password
nPerc = checkPassword(strPassword);
// Get controls
var ctlBar = document.getElementById(strFieldID + "_bar");
var ctlText = document.getElementById(strFieldID + "_text");
if (!ctlBar || !ctlText)
return;
// Set new width
var nRound = Math.round(nPerc * 50);
if (nRound < (strPassword.length * 2)){
nRound += strPassword.length * 2;
}
if (nRound > 50)
nRound = 50;
ctlBar.style.width = nRound + "%";
// Color and text
if (nRound > 40){
strText = "強";
strColor = "#3bce08";
}
else if (nRound > 30){
strText = "中";
strColor = "orange";
}
else if (nRound > 25){
strText = "短すぎます";
strColor = "#ffd801";
}else{
strColor = "red";
strText = "短すぎます";
}
ctlBar.style.backgroundColor = strColor;
ctlText.innerHTML = "" + strText + "";
}
// Checks a string for a list of characters
function doesContain(strPassword, strCheck){
nCount = 0;
for (i = 0; i < strPassword.length; i++) {
if (strCheck.indexOf(strPassword.charAt(i)) > -1) {
nCount++;
}
}
return nCount;
}
var enablepersist="on" //Enable saving state of content structure using session cookies? (on/off)
var collapseprevious="no" //Collapse previously open content when opening present? (yes/no)
if (document.getElementById){
document.write('')
}
function getElementbyClass(classname){
ccollect=new Array()
var inc=0
var alltags=document.all? document.all : document.getElementsByTagName("*")
for (i=0; i 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}
function getselectedItem(){
if (get_cookie(window.location.pathname) != ""){
selectedItem=get_cookie(window.location.pathname)
return selectedItem
}
else
return ""
}
function saveswitchstate(){
var inc=0, selectedItem=""
while (ccollect[inc]){
if (ccollect[inc].style.display=="block")
selectedItem+=ccollect[inc].id+"|"
inc++
}
document.cookie=window.location.pathname+"="+selectedItem
}
function do_onload(){
uniqueidn=window.location.pathname+"firsttimeload"
getElementbyClass("switchcontent")
if (enablepersist=="on" && typeof ccollect!="undefined"){
document.cookie=(get_cookie(uniqueidn)=="")? uniqueidn+"=1" : uniqueidn+"=0"
firsttimeload=(get_cookie(uniqueidn)==1)? 1 : 0 //check if this is 1st page load
if (!firsttimeload)
revivecontent()
}
}
if (window.addEventListener)
window.addEventListener("load", do_onload, false)
else if (window.attachEvent)
window.attachEvent("onload", do_onload)
else if (document.getElementById)
window.onload=do_onload
if (enablepersist=="on" && document.getElementById)
window.onunload=saveswitchstate