function CheckIE()
{
 var ie=0;
 var bw=navigator.userAgent;
 var ie=bw.indexOf('MSIE ');
 if(bw.indexOf('Opera')==-1 && ie>-1)
   ie=1;
 return ie;
}
function GetWindowWidth()
{
if(CheckIE()==1) 
   return document.body.clientWidth;
else 
   return window.innerWidth;
}
function GetWindowHeight()
{
if(CheckIE()==1) 
   return document.body.clientHeight;
else 
   return window.innerHeight;
}
function centerBgim()
{
 var x=((GetWindowWidth()-160)/2-w/2)+160;
 var y=GetWindowHeight()/2-h/2;
 document.getElementById("bgim").style.left=x + "px";
 document.getElementById("bgim").style.top=y + "px";
}
var bgnr,w,h;
if(window.screen.width>1024)
{
 bgnr=0;
 w=852;
 h=611;
} 
if(window.screen.width<1025 && window.screen.width>800)
{
 bgnr=1;
 w=685;
 h=510;
} 
if(window.screen.width<801 && window.screen.width>640)
{
 bgnr=2;
 w=585;
 h=410;
}
if(window.screen.width<800)
{
 bgnr=3;
 w=485;
 h=370;
}
var block=0;
var stm,af;
var newPhotosBlink=0;
function deblock()
{
 document.getElementById('psbut'+block).style.background="url(Data/play.png) no-repeat";
 document.getElementById('psbut'+block).style.cursor="pointer";
 block = 0;
 clearTimeout(stm);
}
function writeFilters(lg,fp)
{
 var fr=(fp >> 1) & 0x0000001F;
 var fv=(fp >> 6) & 0x00000007;
 var fpr=0;
 for(var i=9;i<15;i++)
 {
  if((fp >> i) & 0x00000001)
  {
   fpr=i-8;
   break;
  }
 }
 document.write("<div class='fldiv'><div class='mmenut'></div><div class='mmenuc'><div class='flcdiv'>Filtr druhù</div>");
 if(fp>0)
    document.write("<a href='"+af+"0.html' class='fx'><div class='xcl' title='Resetovat filtr druhù'></div></a>");
 document.write("<div class='flsdiv'><select id='frad' onChange='applyFilter();'>");
 for(var i=0;i<radyAr[0].length;i++)
 {
  document.write("<option value='" + radyAr[lg+2][i] + "'");
  if(radyAr[lg+2][i]==fr)
     document.write(" selected");
  document.write(">" + radyAr[lg][i]);
 }
 document.write("</select></div>");
 document.write("<div class='flsdiv'><select id='fvel' onChange='applyFilter();'>");
 for(var i=0;i<velAr.length;i++)
 {
  document.write("<option");
  if(i==fv)
     document.write(" selected");
  document.write(">" + velAr[i]);
 }
 document.write("</select></div><div class='flsdiv'><select id='fpro' onChange='applyFilter();'>");
 for(var i=0;i<proAr.length;i++)
 {
  document.write("<option");
  if(i==fpr)
     document.write(" selected");
  document.write(">" + proAr[i]);
 }
 document.write("</select></div></div><div class='mmenub'></div></div>");
}
function applyFilter()
{
 var fpar=parseInt("0");
 var cfurl;
 fpar|=(document.getElementById("frad").options[document.getElementById("frad").selectedIndex].value & 0x0000001F) << 1;
 fpar|=(document.getElementById("fvel").selectedIndex & 0x00000007) << 6;
 var psi=document.getElementById("fpro").selectedIndex;
 if(psi>0)
    fpar|=(1 & 0x00000001) << psi+8;
 fpar|=(1 & 0x00000001) << 30;
 cfurl=af+fpar+".html";
 document.location.href=cfurl;
}
function newPhotosBlinker()
{
 document.getElementById("snewp").style.color=(newPhotosBlink<2)?"#000000":"#f7e77f";
 if(newPhotosBlink>0)
 {
  newPhotosBlink=(newPhotosBlink==1)?2:1;
  setTimeout("newPhotosBlinker()",300);
 }
}
