function stylon(id) {
  document.getElementById('i'+id).className='img_on';
  document.getElementById('t'+id).style.color='#eee';
}


function styloff(id) {
  document.getElementById('i'+id).className='img';
  document.getElementById('t'+id).style.color='#888';
}


function opacity(id,zas) {
  id.style.opacity = zas;
  id.style.filter = "alpha(opacity="+(zas*100)+")";
}


function httpRequest() {
  var req = null;
  if (window.XMLHttpRequest) {//other than IE
     try {
       req = new XMLHttpRequest();
     } catch (e) {
       req = null;
     }
  } else if (window.ActiveXObject) {//IE
     try {
       req = new ActiveXObject("Msxml2.XMLHTTP");
     } catch (e) {
       try {
         req = new ActiveXObject("Microsoft.XMLHTTP");
       } catch (e) {
         req = null;
       }
     }
  }
  return req;
}


function reloadLogo() {
  var req = httpRequest();
  if (req != null) {
     var id = document.getElementById('loga');
     var url = 'ajax.php?loga='+Math.floor(Math.random()*20);
     req.onreadystatechange = function() { viewLogo(id,req); };
     req.open('GET', url, true);
     req.send(null);
  }
}
function viewLogo(id,req) {
 try {
  if (req.readyState == 4) {
   if (req.status == 200) {
     setTimeout(function(){opacity(id,0.7);},100);
     setTimeout(function(){opacity(id,0.3);},200);
     setTimeout(function(){opacity(id,0);},300);
     setTimeout(function(){id.innerHTML = req.responseText;},500);
     setTimeout(function(){opacity(id,0.3);},700);
     setTimeout(function(){opacity(id,0.6);},800);
     setTimeout(function(){opacity(id,1);},900);
   } else {
     id.innerHTML = ('error');
   }
  }
 } catch (e) {
   id.innerHTML = ('error: ' + e.description);
 }
}



function displayId(ident,url) {
  var req = httpRequest();
  if (req != null) {
     var id = document.getElementById(ident);
     document.getElementById('stron').innerHTML = ('<img src="img/gallery-spinner.gif" />');
     opacity(id,0.4);
     req.onreadystatechange = function() { viewId(id,req); };
     req.open('GET', 'ajax.php'+url, true);
     req.send(null);
  }
}
function viewId(id,req) {
 try {
  if (req.readyState == 4) {
   if (req.status == 200) {
     id.innerHTML = req.responseText;
     opacity(id,1);
   } else {
     id.innerHTML = ('error');
   }
  }
 } catch (e) {
   id.innerHTML = ('error: ' + e.description);
 }
}


window.onload = function() {
	 setInterval("reloadLogo()",9000);
};

