$(function(){

//copyright
$(function(){
var myDate = new Date() ;
var myYear = myDate.getFullYear();
if(myYear>2000){Year = ("-"+myYear);}
$("#passlogic-footer").html('&copy; 2000'+Year+' Passlogy Co.,Ltd.');
});

//乱数表
$(function(){
for(i=0; i<48; i++){
	var rand = Math.floor( Math.random() * 10 );
	document.getElementById(i).innerHTML = rand;
}
});

//フォーカス
$(function(){
var element = $("#fc")
element.focus();
});

});//END $(function(){


//認証
var j = 0;
function login(){
var passwd = $("td#0").html();
	passwd += $("td#5").html();
	passwd += $("td#10").html();
	passwd += $("td#15").html();
	passwd += $("td#28").html();
	passwd += $("td#25").html();
	passwd += $("td#22").html();
	passwd += $("td#19").html();
	var inpasswd = $(":text").val();
	if(passwd==inpasswd){
	  $("#PL_TitleText").text("Congratulations !");
	  $(".Message").text("Successful login.");
	  $("#wr")
	  .html('How did you like it?<br />Passlogic is a simple one-time password system that uses an extraction pattern predetermined by a user. <br /><br /> Though the password that you just used for login was <b>'+inpasswd+'</b>, it cannot be used again as a password because a random number table unique to the user session is generated each time. Even if the initial set of password is stolen, it becomes obsolete because it has already been used. <br /><br />Moreover, you can freely set it originally though "Shape of V" was used as a position for the password this time. <br /><img src="/engImages/PATTERNS-2.gif" /><img src="/engImages/PATTERNS-3.gif" /><br /><br /><a href="index.html">LOGOUT</a>');
	}else{
	  if(j==0){
	    $("#error").text("The password is wrong.");
	    j++;
	  }else if(j==1){
	    $("#error").html("The password is wrong.<br />The number at the highlighted position is used as a password.");
	    $("td#0").css('background-color','#FFBCBC');
	    $("td#5").css('background-color','#FFBCBC');
	    $("td#10").css('background-color','#FFBCBC');
	    $("td#15").css('background-color','#FFBCBC');
	    $("td#28").css('background-color','#FFBCBC');
	    $("td#25").css('background-color','#FFBCBC');
	    $("td#22").css('background-color','#FFBCBC');
	    $("td#19").css('background-color','#FFBCBC');
	    j++;
	  }else{
	    $("#error").html("The password is wrong.<br />The number at the highlighted position is used as a password.");
	    $("td#0").css('background-color','#FFBCBC');
	    $("td#5").css('background-color','#FFBCBC');
	    $("td#10").css('background-color','#FFBCBC');
	    $("td#15").css('background-color','#FFBCBC');
	    $("td#28").css('background-color','#FFBCBC');
	    $("td#25").css('background-color','#FFBCBC');
	    $("td#22").css('background-color','#FFBCBC');
	    $("td#19").css('background-color','#FFBCBC');
	    $("#mes").text("The password to input should be as follows ");
	    $(":text").val(passwd);
	    j++;
	  }
	}
};

//demo.htmlへ
function demohtml(){
	location.href = "demo.html";
}

