﻿var rollPeriod = 3000;

var rollCoun;
var rollPeriod = 6000;
var isStart = true;
var rollCount;
var nn = 1;
var tt = false;
function change_img() {

    if (isStart) {
        if (nn > rollCount) {
            nn = 1;
        }
        setFocus(nn);
    } else {
        tt = setTimeout('change_img()', 2000);
    }
}
function setFocus(i) {
    if (tt) {
        clearTimeout(tt);
    }
    selectLayer1(i);
    nn = parseInt(i) + 1;
    tt = setTimeout('change_img()', rollPeriod);
}

function stopFocus(i) {
    if (tt) {
        clearTimeout(tt);
    }
    selectLayer1(i);
}

function selectLayer1(i) {
    for (var j = 1; j <= rollCount; j++) {
        if (j == i) {
            
            document.getElementById("focus" + j).style.display = "block";
            document.getElementById("change" + j).className = "current";
        } else {
            document.getElementById("focus" + j).style.display = "none";
            document.getElementById("change" + j).className = "";
        }
    }
}
function nTabs(thisObj, Num) {
    if (thisObj.className == "active") return;
    var tabObj = thisObj.parentNode.id;
    var tabList = document.getElementById(tabObj).getElementsByTagName("li");
    for (i = 0; i < tabList.length; i++) {
        if (i == Num) {
            thisObj.className = "active";
            $('#' + tabObj + "_Content" + i).css('display', 'block');
        } else {
            tabList[i].className = "normal";
            $('#' + tabObj + "_Content" + i).css('display', 'none');
        }
    }
}
//    function selectValueMix(Obj, display, value) {
//        parent.document.getElementById('specialtytype').value = value;
//        parent.document.getElementById('specialtytype1').value = display;
//        Obj.removeAttribute('href');
//        parent.document.getElementById('select_specialtytype_specialtytype1').style.display = "none";
//    }

$(document).ready(function() {
    $("li.focusbtn").each(function(i) {

        $(this).click(function() {
            var countn = i + 1;
            stopFocus(countn);
        });
    });
    setFocus(rollCount);
});



