var pht_cur = 1;

function SelectPhoto(aDelta) {
  pht_cnt = pht_Arr.length;
  pht_cur += aDelta;
  
  while (pht_cur < 1) pht_cur ++;
  while (pht_cur > pht_cnt) pht_cur --;  
  
  LoadPhoto();   
}

function LoadPhoto(){
  if (document.images && document.images['pht_Photo']) {
      document.images['pht_Photo'].src = pht_Arr[pht_cur-1];
      x=pht_Arr[pht_cur-1];
		//alert(x.substring(x.length-3,x.length));
    if(x.substring(x.length-3,x.length)=='__x'){
	    document.images['pht_Photo'].width=135;
    	document.images['pht_Photo'].height=180;
    	document.images['pht_Photo'].src=x.substring(0,x.length-3)
	}else{
		document.images['pht_Photo'].width=240;
    	document.images['pht_Photo'].height=180;
	}
	
  }

  if(document.all && document.all('pht_Cntr')) {
    document.all('pht_Cntr').innerHTML = '' + pht_cur;
  } else {
    if (document.getElementById && document.getElementById('pht_Cntr')) {
      document.getElementById('pht_Cntr').innerHTML = '' + pht_cur;
    }
  }
}


function ShowPhoto(bd,nr,w,h){
    if (w == 0)
    {
      w = screen.availWidth;// * 1 / 2;
    };
    if (h == 0)
    {
      h = screen.availHeight;// * 3 / 4;
    };
	x1=pht_Arr[pht_cur-1];
	if(x1.substring(x1.length-3,x1.length)=='__x'){
		x1=x1.substring(0,x1.length-3)
	};
    okno = window.open("","oknoz","toolbar=0,left=0,top=0,location=0,directories=0,status=0,menubar=0,resizable=1,dependent=1,hotkeys=0,scrollbars=1,titlebar=0,z-lock=1,width="+w+",height="+h+"");
    okno.resizeTo(w,h);
    okno.document.write("<HEAD><TITLE>Wczytuję dane...</TITLE></HEAD>");
    okno.document.write("<body bgcolor='#FFFFFF>");
    okno.document.write('<font size="2" face="Verdana"><CENTER><BIG><B>Wczytuję dane. Proszę czekać...</B></BIG></CENTER></font></body>');
    okno.focus();
    //okno.location.href="/si.php?t="+bd+"&nrof="+nr+"&p="+pht_Arr[pht_cur-1]; 
    okno.location.href="/si.php?t="+bd+"&nrof="+nr+"&p="+x1;
};

function ShowPhoto_m(bd,nr,x1,w,h){
    if (w == 0)
    {
      w = screen.availWidth;// * 1 / 2;
    };
    if (h == 0)
    {
      h = screen.availHeight;// * 3 / 4;
    };
	if(x1.substring(x1.length-3,x1.length)=='__x'){
		x1=x1.substring(0,x1.length-3)
	};
    okno = window.open("","oknoz","toolbar=0,left=0,top=0,location=0,directories=0,status=0,menubar=0,resizable=1,dependent=1,hotkeys=0,scrollbars=1,titlebar=0,z-lock=1,width="+w+",height="+h+"");
    okno.resizeTo(w,h);
    okno.document.write("<HEAD><TITLE>Wczytuję dane...</TITLE></HEAD>");
    okno.document.write("<body bgcolor='#FFFFFF>");
    okno.document.write('<font size="2" face="Verdana"><CENTER><BIG><B>Wczytuję dane. Proszę czekać...</B></BIG></CENTER></font></body>');
    okno.focus();
    okno.location.href="/si.php?t="+bd+"&nrof="+nr+"&p="+x1;
};

function ShowPhoto_m1(adr,pos){
   	document.getElementById('pht_Photo').src=adr;
	if (document.getElementById('phtTitle'))
   	  document.getElementById('phtTitle').innerHTML=pht_Title[pos];
	if (document.getElementById('phtOpis'))
    	  document.getElementById('phtOpis').innerHTML=pht_Opis[pos];
};

function photoOver(adr,pos){
   	document.getElementById('pht_Photo').src=adr;
   	document.getElementById('phtTitle').innerHTML=pht_Title[pos];
   	document.getElementById('phtOpis').innerHTML=pht_Opis[pos];
};

function photoOut(adr,pos){
   	document.getElementById('pht_Photo').src=adr;
 	document.getElementById('phtTitle').innerHTML=pht_Title[pos];
      document.getElementById('phtOpis').innerHTML=pht_Opis[pos];   	
};

LoadPhoto();

    function copy_to_clipboard(text)  
    {  
        if(window.clipboardData)  
        {  
        window.clipboardData.setData('text',text);  
        }  
        else  
        {  
            var clipboarddiv=document.getElementById('divclipboardswf');  
        if(clipboarddiv==null)  
        {  
           clipboarddiv=document.createElement('div');  
               clipboarddiv.setAttribute("name", "divclipboardswf");  
           clipboarddiv.setAttribute("id", "divclipboardswf");  
           document.body.appendChild(clipboarddiv);  
        }  
            clipboarddiv.innerHTML='<embed src="flash/clipboard.swf" FlashVars="clipboard='+  
    encodeURIComponent(text)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';  
        }  
        alert('The text is copied to your clipboard...');  
        return false;  
    }  
