var timerBig;
function setBigImg(id, clear) {
	if(id==lastBigImg) return;

	if(clear==1) {
		clearTimeout(timerBig);
		timerBig = setTimeout("setTimerBigImg()", motiveTime*1000);
	}
	
	$("#sq_"+lastBigImg).toggleClass("act");

/*
	$("#motive_" + lastBigImg).hide();
	$("#imgAnons_" + lastBigImg).hide();
*/
	$("#motive_" + lastBigImg).fadeOut(300)
	$("#imgAnons_" + lastBigImg).fadeOut(300)

	$("#sq_"+id).toggleClass("act");

/*
	$("#motive_" + id).show();
	$("#imgAnons_" + id).show();
*/
	$("#motive_" + id).fadeIn(300);
	$("#imgAnons_" + id).fadeIn(300);
	
	lastBigImg = id;

}
function setTimerBigImg() {
	var next = lastBigImg+1;
	if(next==6) next = 1;
	setBigImg(next, 0)
	clearTimeout(timerBig);
	timerBig = setTimeout("setTimerBigImg()", motiveTime*1000);
}

var nowShowLamp = 1;
var nextLampN = 0;
function nextLamp() {
	nextLampN = nowShowLamp+1;
	setLamp();
}
function prevLamp() {
	nextLampN = nowShowLamp-1;
	setLamp();
}
function setLampNumber(id) {
	nextLampN = id;
	setLamp();
}

function setLamp() {
	$("#imgAnons_"+nowShowLamp).hide();
	$("#slogAnons_"+nowShowLamp).hide();
	$("#title_"+nowShowLamp).removeClass("act");

	$("#imgAnons_"+nextLampN).show();
	$("#slogAnons_"+nextLampN).show();
	$("#title_"+nextLampN).addClass("act");

	if(nextLampN>=totalLamp) {
		$("#arrNext").hide();
	}
	else {
		$("#arrNext").show();
	}
	if(nextLampN>1) $("#arrPrev").show();

	if(nextLampN>1) {
		$("#arrPrev").show();
	}
	else {
		$("#arrPrev").hide();
	}
	if(nextLampN<totalLamp) $("#arrNext").show();

	nowShowLamp = nextLampN;
}


//////////////////////////////////////////////////////////////////////////////

function setTimerBigImgThree(toc_id) {
//	alert(toc_id)
	var next = lastBigImgThree[toc_id]+1;
	if(next==4) next = 1;
	setBigImgThree(next, 0, toc_id)
	clearTimeout(timerBigThree[toc_id]);
	timerBigThree[toc_id] = setTimeout(function(){setTimerBigImgThree(toc_id)}, motiveTimeThree[toc_id]*1000);
}

var timerBigThree = new Array();
var motiveTimeThree = new Array();
var lastBigImgThree = new Array();

function setBigImgThree(id, clear, toc_id) {
	if(id==lastBigImgThree[toc_id]) return;

	if(clear==1) {
		clearTimeout(timerBigThree[toc_id]);
		timerBigThree[toc_id] = setTimeout("setTimerBigImgThree()", motiveTime*1000);
	}
	
	$("#sq_" + toc_id + "_" + lastBigImgThree[toc_id]).toggleClass("act");

//	$("#motive_" + toc_id + "_" + lastBigImgThree[toc_id]).fadeOut(300)
	$("#imgAnons_" + toc_id + "_" + lastBigImgThree[toc_id]).fadeOut(300)

	$("#sq_" + toc_id + "_" + id).toggleClass("act");

//	$("#motive_" + toc_id + "_" + id).fadeIn(300);
	$("#imgAnons_" + toc_id + "_" + id).fadeIn(300);
	
	lastBigImgThree[toc_id] = id;

}
//////////////////////////////////////////////////////////////////////////////



function showFormGuestVisit() {
	if ($("#formGuestVisit").css("display") == "none" ) {
		$("#formGuestVisit").show();
		$(".banner-ind").css({
			visibility: "hidden"
		});
	}
	else {
		$("#formGuestVisit").hide();
		$(".banner-ind").css({
			visibility: "visible"
		});
	}
}

function showHideBlock(id) {
	if ($("#"+id).css("display") == "none" ) {
		$("#"+id).show();
	}
	else {
		$("#"+id).hide();
	}
}

function showReg (id){
    //aki: переписал на jQuery потому что баги лезли - id иногда null был
    //document.getElementById("reg"+id).style.display = "block";
    $('#reg'+id).show();
}
function hideReg (id){
    //aki: переписал на jQuery  потому что баги лезли - id иногда null был
    //document.getElementById("reg"+id).style.display = "none";
    if(id != curr_set_map)
        $('#reg'+id).hide(); 
}




