window.defaultStatus="HOMART";


function chObr(id,pic){ 
  document.getElementById(id).src=pic;
}	

function onM(id){
  if (!document.getElementById(id)) {return false;}
  if (document.all) { /* ie */
    document.getElementById(id).style.filter='Alpha(Opacity=60, FinishOpacity=60, Style=1, StartX=0, StartY=0, FinishX=100, FinishY=100)';
  }else {
	document.getElementById(id).style.opacity= 0.6;
  }
}

function outM(id){
  if (!document.getElementById(id)) {return false;}	
  if (document.all) { /* ie */
    document.getElementById(id).style.filter='Alpha(Opacity=100, FinishOpacity=100, Style=1, StartX=0, StartY=0, FinishX=100, FinishY=100)';
  }else {
	document.getElementById(id).style.opacity= 1;
  }
}

function fncPhoto(albumID,start,pocet) {

        var http_request = false;
    	var adresa= 'photos.php?albumID='+albumID+'&start='+start+'&pocet='+pocet+'';
        
        if (window.XMLHttpRequest) { 
            http_request = new XMLHttpRequest();
        } else if (window.ActiveXObject) { 
            try {
              http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (eror) {
              http_request = new ActiveXObject("Microsoft.XMLHTTP");
            }
        }
       
	    http_request.onreadystatechange = function() { returnValidate(http_request); };
        http_request.open('GET', adresa, true);
        http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        http_request.send(null);
	
}


function returnValidate(http_request) {
        if (http_request.readyState == 4) {
            if (http_request.status == 200) { 
			document.getElementById('photos').innerHTML=http_request.responseText;
			
            } else {   alert('Chyba');    }
        }
}


function fncTrack(albumID,start,pocet) {

  if (start>4){
	  a=start-5;
	  document.getElementById('first').innerHTML="<a href=''><img src='img/first1.jpg' id='img_first' onMouseDown='fncTrack("+albumID+",0,"+pocet+");'></a>";
	  document.getElementById('prev').innerHTML="<a href=''><img src='img/prev1.jpg' id='img_prev' onMouseDown='fncTrack("+albumID+","+a+","+pocet+");'></a>";
    } else {
  	 document.getElementById('first').innerHTML=" ";
	 document.getElementById('prev').innerHTML=" ";
    }
	
	if ((Math.floor(pocet/5)*5)>start){
	  a=start+5;
      document.getElementById('next').innerHTML="<a href=''><img src='img/next1.jpg' id='img_next' onMouseDown='fncTrack("+albumID+","+a+","+pocet+");'></a>";
      b=Math.floor(pocet/5)*5;
	  document.getElementById('last').innerHTML="<a href=''><img src='img/last1.jpg' id='img_last' onMouseDown='fncTrack("+albumID+","+b+","+pocet+");'></a>";
    } 
	

	if ((Math.floor(pocet/5)*5)==start)
	{
	  document.getElementById('next').innerHTML=" ";
	  document.getElementById('last').innerHTML=" ";
	}
	
	
  str_akt=start/5+1;	
  str_celk=Math.ceil(pocet/5);
document.getElementById('pocet').innerHTML="Strana: "+str_akt+" / "+str_celk+"";
	
	
  onM('img_first');
  onM('img_prev');
  onM('img_next');
  onM('img_last');
  fncPhoto(albumID,start,pocet);
}
