/* Conf & Experts scroller */
var limit=6;//в секундах, реально 5, 1 юзаєм для рестарту циклу
window.onload=initLinks;
function initLinks(){
	document.getElementById("prev_conf").onclick=processPrev_conf;
	document.getElementById("next_conf").onclick=processNext_conf;
	document.getElementById("prev_expert").onclick=processPrev_expert;
	document.getElementById("next_expert").onclick=processNext_expert;
	processTimer();
}
function processTimer(){
	if(limit>1){
		setTimeout("processTimer()",1000);
		limit--;
	}else{
		if(limit>0){
			// таймер вийшов, починаєм прокрутку
			processNext_expert();
			limit=6;
			processTimer()
		}
	}
}
function processPrev_conf(){
	changeConfOpac(0)
	if(thisConfPhoto1==0){thisConfPhoto1=ConfPhoto.length;}
	if(thisConfPhoto2==0){thisConfPhoto2=ConfPhoto.length;}
	if(thisConfPhoto3==0){thisConfPhoto3=ConfPhoto.length;}
	thisConfPhoto1--;thisConfPhoto2--;thisConfPhoto3--;
	document.getElementById("ConfPic1").src=ConfPhoto[thisConfPhoto1];
	document.getElementById('ConfText1').innerHTML=ConfTitle[thisConfPhoto1];
	document.getElementById('ConfLink1').innerHTML=ConfLnk[thisConfPhoto1];
	document.getElementById("ConfPic2").src=ConfPhoto[thisConfPhoto2];
	document.getElementById('ConfText2').innerHTML=ConfTitle[thisConfPhoto2];
	document.getElementById('ConfLink2').innerHTML=ConfLnk[thisConfPhoto2];
	document.getElementById("ConfPic3").src=ConfPhoto[thisConfPhoto3];
	document.getElementById('ConfText3').innerHTML=ConfTitle[thisConfPhoto3];
	document.getElementById('ConfLink3').innerHTML=ConfLnk[thisConfPhoto3];
	opacityConfShow()
	return false;
}
function processPrev_expert(){
	changeExpertOpac(0)
	if(thisExpertPhoto1==0){thisExpertPhoto1=ExpertPhoto.length;}
	if(thisExpertPhoto2==0){thisExpertPhoto2=ExpertPhoto.length;}
	if(thisExpertPhoto3==0){thisExpertPhoto3=ExpertPhoto.length;}
	thisExpertPhoto1--;thisExpertPhoto2--;thisExpertPhoto3--;
	document.getElementById("ExpertPic1").src=ExpertPhoto[thisExpertPhoto1];
	document.getElementById('ExpertText1').innerHTML=ExpertTitle[thisExpertPhoto1];
	document.getElementById('ExpertLink1').innerHTML=ExpertLnk[thisExpertPhoto1];
	document.getElementById("ExpertPic2").src=ExpertPhoto[thisExpertPhoto2];
	document.getElementById('ExpertText2').innerHTML=ExpertTitle[thisExpertPhoto2];
	document.getElementById('ExpertLink2').innerHTML=ExpertLnk[thisExpertPhoto2];
	document.getElementById("ExpertPic3").src=ExpertPhoto[thisExpertPhoto3];
	document.getElementById('ExpertText3').innerHTML=ExpertTitle[thisExpertPhoto3];
	document.getElementById('ExpertLink3').innerHTML=ExpertLnk[thisExpertPhoto3];
	opacityExpertShow();
	limit=120;
	return false;
}

function processNext_conf(){
	changeConfOpac(0)
	thisConfPhoto1++;thisConfPhoto2++;thisConfPhoto3++;
	if(thisConfPhoto3==ConfPhoto.length){thisConfPhoto3=0;}
	if(thisConfPhoto2==ConfPhoto.length){thisConfPhoto2=0;}
	if(thisConfPhoto1==ConfPhoto.length){thisConfPhoto1=0;}
	document.getElementById("ConfPic1").src=ConfPhoto[thisConfPhoto1];
	document.getElementById('ConfText1').innerHTML=ConfTitle[thisConfPhoto1];
	document.getElementById('ConfLink1').innerHTML=ConfLnk[thisConfPhoto1];
	document.getElementById("ConfPic2").src=ConfPhoto[thisConfPhoto2];
	document.getElementById('ConfText2').innerHTML=ConfTitle[thisConfPhoto2];
	document.getElementById('ConfLink2').innerHTML=ConfLnk[thisConfPhoto2];
	document.getElementById("ConfPic3").src=ConfPhoto[thisConfPhoto3];
	document.getElementById('ConfText3').innerHTML=ConfTitle[thisConfPhoto3];
	document.getElementById('ConfLink3').innerHTML=ConfLnk[thisConfPhoto3];
	opacityConfShow()
	return false;
}
function processNext_expert(){
	changeExpertOpac(0)
	thisExpertPhoto1++;thisExpertPhoto2++;thisExpertPhoto3++;
	if(thisExpertPhoto3==ExpertPhoto.length){thisExpertPhoto3=0;}
	if(thisExpertPhoto2==ExpertPhoto.length){thisExpertPhoto2=0;}
	if(thisExpertPhoto1==ExpertPhoto.length){thisExpertPhoto1=0;}
	document.getElementById("ExpertPic1").src=ExpertPhoto[thisExpertPhoto1];
	document.getElementById('ExpertText1').innerHTML=ExpertTitle[thisExpertPhoto1];
	document.getElementById('ExpertLink1').innerHTML=ExpertLnk[thisExpertPhoto1];
	document.getElementById("ExpertPic2").src=ExpertPhoto[thisExpertPhoto2];
	document.getElementById('ExpertText2').innerHTML=ExpertTitle[thisExpertPhoto2];
	document.getElementById('ExpertLink2').innerHTML=ExpertLnk[thisExpertPhoto2];
	document.getElementById("ExpertPic3").src=ExpertPhoto[thisExpertPhoto3];
	document.getElementById('ExpertText3').innerHTML=ExpertTitle[thisExpertPhoto3];
	document.getElementById('ExpertLink3').innerHTML=ExpertLnk[thisExpertPhoto3];
	opacityExpertShow();
	limit=120;
	return false;
}

function opacityConfFade(){
	timer=100;
	for(i=100;i>=0;i--){setTimeout("changeConfOpac("+i+")",(timer));timer=timer+2;}
}
function opacityExpertFade(){
	timer=100;
	for(i=100;i>=0;i--){setTimeout("changeExpertOpac("+i+")",(timer));timer=timer+2;}
}
function opacityConfShow(){
	timer=100;
	for(i=0;i<=100;i++){setTimeout("changeConfOpac("+i+")",(timer));timer=timer+2;}
}
function opacityExpertShow(){
	timer=100;
	for(i=0;i<=100;i++){setTimeout("changeExpertOpac("+i+")",(timer));timer=timer+2;}
}

function changeConfOpac(opacity){
	var objectConf1=document.getElementById('ConfLi1').style;
	objectConf1.opacity=(opacity/100);
	objectConf1.MozOpacity=(opacity/100);
	objectConf1.KhtmlOpacity=(opacity/100);
	objectConf1.filter="alpha(opacity="+opacity+")";
	var objectConf2=document.getElementById('ConfLi1').style;
	objectConf2.opacity=(opacity/100);
	objectConf2.MozOpacity=(opacity/100);
	objectConf2.KhtmlOpacity=(opacity/100);
	objectConf2.filter="alpha(opacity="+opacity+")";
	var objectConf3=document.getElementById('ConfLi1').style;
	objectConf3.opacity=(opacity/100);
	objectConf3.MozOpacity=(opacity/100);
	objectConf3.KhtmlOpacity=(opacity/100);
	objectConf3.filter="alpha(opacity="+opacity+")";
}
function changeExpertOpac(opacity){
	var objectExpert1=document.getElementById('ExpertLi1').style;
	objectExpert1.opacity=(opacity/100);
	objectExpert1.MozOpacity=(opacity/100);
	objectExpert1.KhtmlOpacity=(opacity/100);
	objectExpert1.filter="alpha(opacity="+opacity+")";
	var objectExpert2=document.getElementById('ExpertLi1').style;
	objectExpert2.opacity=(opacity/100);
	objectExpert2.MozOpacity=(opacity/100);
	objectExpert2.KhtmlOpacity=(opacity/100);
	objectExpert2.filter="alpha(opacity="+opacity+")";
	var objectExpert3=document.getElementById('ExpertLi1').style;
	objectExpert3.opacity=(opacity/100);
	objectExpert3.MozOpacity=(opacity/100);
	objectExpert3.KhtmlOpacity=(opacity/100);
	objectExpert3.filter="alpha(opacity="+opacity+")";
}

/* tab switcher */
function switch_tabs(id,all,where,off){
	for(var i=1;i<=all;i++){
		if(i!=id){
			document.getElementById(where+""+i).style.display="none";
			if(off==1){document.getElementById(where+"hd"+i).className=document.getElementById(where+"hd"+id).className.replace("active","");
			}else{document.getElementById(where+"hd"+i).className=document.getElementById(where+"hd"+id).className.replace("active","last");}
		}
	}
	document.getElementById(where+""+id).style.display="block";
	if(off==1){document.getElementById(where+"hd"+id).className+=" active";
	}else{document.getElementById(where+"hd"+id).className=document.getElementById(where+"hd"+id).className.replace("last","active");}
}

function switch_club(id,all,where){
	for(var i=1;i<=all;i++){if(i!=id){document.getElementById(where+""+i).style.display="none";}}
	document.getElementById(where+""+id).style.display="block";
}

/* set popup instructions */
function popup(mylink,windowname){
	if(!window.focus) return true;
	var href;
	if(typeof(mylink)=='string') href=mylink;else href=mylink.href;
	window.open(href,windowname,'width=670,height=500,scrollbars=no');
	return false;
}
