
var atmenet = 10;
var Obj = "";
var opt = 0;
var optim = 0;
var rrL = 0;
function setOpacity() {
	Obj.style.opacity = atmenet/10;
	Obj.style.filter = 'alpha(opacity=' + atmenet*10 + ')';

if(atmenet > 0){atmenet--;}else{atmenet=10;
opt=window.clearInterval(opt)
imgrotates();
}
}
function opacTim(){

opt = window.setInterval("setOpacity()", OpacityTime);
optim=window.clearInterval(optim);

}
function imgrotates(){

var imgrotate = document.getElementById("imgrotate");
var rotateLink = imgrotate.getElementsByTagName("a");


if(visibleRadio){
var rotateInp = document.getElementById("radiorotate").getElementsByTagName("img");
}
for(var rL=0;rL<rotateLink.length;rL++){

if(visibleStart == rL){
if(rL >= 0){
rrL = rL+1;
}
if(rL == rotateLink.length-1){
rrL = 0;
}

rotateLink[rrL].style.opacity = 1;
rotateLink[rrL].style.filter = 'alpha(opacity=' + 100 + ')';



rotateLink[rL].style.opacity = 1;
rotateLink[rL].style.filter = 'alpha(opacity=' + 100 + ')';
if(visibleRadio){
rotateInp[rL].src = onRadio;
}
rotateLink[rL].style.zIndex=888;
Obj = rotateLink[rL];
optim = window.setInterval("opacTim()", visibleTime*1000);
}else{

rotateLink[rL].style.zIndex=1;
if(visibleRadio){
rotateInp[rL].src = offRadio;
}
}
}
if(visibleStart < rotateLink.length-1){visibleStart++;}else{visibleStart=0;}
}
//setInterval("imgrotate()", visibleTime*1000);
window.onload = function(){
if(document.getElementById("imgrotate")){
var imgrotate = document.getElementById("imgrotate");
var imgrotateHTML = imgrotate.innerHTML;
imgrotateHTML = imgrotateHTML.replace(/<br>/g,"");
imgrotateHTML = imgrotateHTML.replace(/<br\/>/g,"");
imgrotateHTML = imgrotateHTML.replace(/<BR>/g,"");
imgrotateHTML = imgrotateHTML.replace(/<BR\/>/g,"");
imgrotate.innerHTML = imgrotateHTML;


var rotateLink = imgrotate.getElementsByTagName("a");
if(visibleRadio){
var radiodiv  = document.createElement('div');
radiodiv.id = "radiorotate";
imgrotate.appendChild(radiodiv);
imgrotate.style.height = rotateLink[0].offsetHeight+20+"px";
imgrotate.style.width = rotateLink[0].offsetWidth;
}else{
imgrotate.style.height = rotateLink[0].offsetHeight;
imgrotate.style.width = rotateLink[0].offsetWidth;
}

for(var rL=0;rL<rotateLink.length;rL++){
rotateLink[rL].style.visibility = "visible";
if(visibleRadio){
      var inp  = document.createElement('img');
		  inp.src = offRadio;
		  inp.name = "radioRotate";
		  inp.style.cursor = "pointer";
		  inp.rel = rL;
		  if(document.all){
		  inp.setAttribute("onclick", function() { rotateValtas(this.rel) });

		  }else{
		  inp.setAttribute("onclick","rotateValtas("+rL+");");
		  }
		  if(rL==0){ inp.src=onRadio; }
          radiodiv.appendChild(inp);
}
rotateLink[rL].style.opacity = 0;
rotateLink[rL].style.filter = 'alpha(opacity=' + 0 + ')';

}

imgrotates();
}
start();
}
function rotateValtas(rL){
var imgrotate = document.getElementById("imgrotate");
var rotateLink = imgrotate.getElementsByTagName("a");

for(var res=0;res<rotateLink.length;res++){
rotateLink[res].style.opacity = 0;
rotateLink[res].style.filter = 'alpha(opacity=' + 0 + ')';
}

visibleStart=rL;
clearInterval(optim);
optim=0;
imgrotates();
}
