var stabs = new Array("stab_startpage", "stab_news", "stab_offers");

var this_speed = 1000;

var speed = 10;
var step = 1;

function scrF(i,i2,sH,eH) {
	var x = parseInt(i.top)+ -step;
	var x2 = parseInt(i2.top)+ -step;
	if(x<2-eH) x = eH; i.top = x+'px';
	if(x2<2-eH) x2 = eH; i2.top = x2+'px';
}

function startScroll(sN,txt) {
	var scr = document.getElementById(sN);
	var sW = scr.offsetWidth;
	var sH = scr.offsetHeight;
	scr.innerHTML = '<div id="'+sN+'in" style="position: absolute; height: '+scroll_count+'px;">'+txt+'<\/div><div id="'+sN+'2in" style="position: absolute; height: '+scroll_count+'px;">'+txt+'<\/div>'; //width: '+sW+';
	var sTxt = document.getElementById(sN+'in');
	var sTxt2 = document.getElementById(sN+'2in');
	var eH=sTxt.offsetHeight;
	sTxt.style.top = '0px';
	sTxt2.style.top = eH+'px';
	sTxt.style.clip = 'rect(0,'+sW+'px,'+eH+'px,0)';
	setInterval(function() {scrF(sTxt.style,sTxt2.style,sH,eH);},1000/speed);
}

function switchImg(last_index, first_call) {
	if(first_call != true) {
		index = Math.floor(Math.random() * startup_pics.length);
	}
	if(last_index == index) {
		switchImg(last_index);
	} else {
		blendimage('blenddiv', 'blendimage', startup_pics[index], this_speed);
		var last_index = index;
		setTimeout("switchImg(" + last_index + ", false)", 10 * this_speed);
	}
}
	
function mainCnt() {
	document.getElementById('blendimage').src = startup_pics[index];
	setTimeout("switchImg(" + index + ", true)", 10 * this_speed);
}

function switchTab(selected_tab) {
	for (var i=0; i < stabs.length; i++) {
		if(stabs[i] == selected_tab) {
			document.getElementById(selected_tab).style.color = '#F90';
			document.getElementById(selected_tab+'_ctn').style.display = 'block';
		}	else {
			document.getElementById(stabs[i]).style.color = '#999';
			document.getElementById(stabs[i]+'_ctn').style.display = 'none';
		}
	}
}
