var notc = 0;
var cnt = document.getElementById("connect-images");
var dftc = cnt.src;
function connector(){
notc++;
switch(4 - notc){
case 3: cnt.src = cnt.dataset.secondImage;
break;
case 2: cnt.src = cnt.dataset.thirdImage;
break;
case 1: cnt.src = cnt.dataset.forthImage;
break;
case 0: cnt.src = dftc; notc = 0;
break;
}}



function CountDown(){
    var count = 20, tmID, infobox = document.getElementById("start").addEventListener("click");


    function countDown(){
	if (--count == 0){
	    infobox.innerHTML = "失敗!";
	}
	//当たりをクリックしたら成功!と表示する。

	
	else {
	    infobox.innerHTML = count + "秒前";
	    tmID = setTimeout(countDown, 1000);
	}
    }

    function startCountDown(){
	tmID = setTimeout(countDown, 1000);
	infobox.removeEventListener("click", startCountDown, false);
    }
    infobox.addEventListener("click", startCountDown, false);
};
document.addEventListener("DOMContentLoaded", CountDown, false);
	
