var scrolleroffset = 8000; /* интервал таймера перелистывания */
var scrolltimer = 0;
var scroller;

function $(id){
   return document.getElementById(id);
}

function switchlogin(switchid) {
	if (switchid == 'login') { $("login").className = "login_active"; $("register").className = "register"; $("logindata").className="logindata_active"; $("registerdata").className="registerdata"; } else { $("register").className = "register_active"; $("login").className = "login"; $("logindata").className="logindata"; $("registerdata").className="registerdata_active"; }
}

function specialoffer_show(listerid, switchid) {
	for (var i = 1; i < specialoffers_maxswitches + 1; i++) { $("lister" + listerid + "-" + i).className = ""; $("specialoffers_block" + i).className = "banner"; }
	$("lister" + listerid + "-" + switchid).className = "active";
	$("specialoffers_block" + switchid).className = "banner_active";
	if (tmrspecialoffer != 0) { window.clearTimeout(tmrspecialoffer); }
	if (lastspecialoffer != switchid) { lastspecialoffer = switchid; }
	tmrspecialoffer = window.setTimeout("specialoffer_scroll()", tmroffset);
}

function specialoffer_scroll() {
	if (lastspecialoffer + 1 <= specialoffers_maxswitches) { lastspecialoffer++; }
	else { lastspecialoffer = 1; }
	specialoffer_show(specialoffers_lister, lastspecialoffer, specialoffers_maxswitches);
}

function switchtabs(srctag) {
	if (srctag.tagName == "TH") {
		var tabs = srctag.getElementsByTagName("A");
		for ( var i = 0; i < tabs.length; i+=1 ) { if (tabs[i].id == "defaulttab") { tabs[i].className = "active"; $(srctag.id + "_tabcontent" + (i+1)).className = "tabcontent_active"; } } }
	else {
		var tabs = srctag.parentNode.getElementsByTagName("A");
		for ( var i = 0; i < tabs.length; i+=1 ) { if (tabs[i] != srctag) { tabs[i].className = ""; $(srctag.parentNode.id + "_tabcontent" + (i+1)).className = "tabcontent"; } else { tabs[i].className = "active"; $(srctag.parentNode.id + "_tabcontent" + (i+1)).className = "tabcontent_active"; } } }
}

function repeatswitchscroller(switchnum) {
	var switches = scroller.getElementsByTagName("A");
	if (switchnum < switches.length) {
		switchscroller(switches[switchnum]); }
	else {
		switchscroller(switches[0]);
	}
}

function switchscroller(srctag) {
	if (srctag.tagName == "DIV") {
		var switches = srctag.getElementsByTagName("A");
		for ( var i = 0; i < switches.length; i+=1 ) { 
			if (switches[i].className == "active") { switchscroller(switches[i]); }
		}
		for ( var i = 0; i < switches.length; i+=1 ) { 
			if (switches[i].id == "defaultswitch") { switchscroller(switches[i]); }
		}
	}
	else {
		var switches = srctag.parentNode.getElementsByTagName("A"); var switchindex;
		for ( var i = 0; i < switches.length; i+=1 ) {
			switches[i].className = ""; $(srctag.parentNode.id + "_content" + (i+1)).className = "switchcontent";
			if (switches[i] == srctag) { switchindex = i+1; }
		}
		srctag.className = "active";
		$(srctag.parentNode.id + "_content" + switchindex).className = "switchcontent_active";
		if (scrolltimer != 0) { self.clearTimeout(scrolltimer); }
		scroller = srctag.parentNode;
		newindex = switchindex;
		scrolltimer = setTimeout("repeatswitchscroller(" + newindex + ")", scrolleroffset);
	}
}

function showfullcategories() {
	$("fullcategories").className = "fullcategories show"; }
	
function hidefullcategories() {
	$("fullcategories").className = "fullcategories"; }