function check()
{
  bad = 0;
  if(document.ocen.rank.value == "0")
    window.alert("Wybierz ocenê"),bad=1
  if(bad == 0)
    document.ocen.submit()
}


function UpdateChars(obj)
{
  chars_left = 600 - obj.value.length;
  if(chars_left < 0)
  {
    obj.value = obj.value.substr(0, 600);
    chars_left = 0;
  }
  document.getElementById('chars').innerHTML = chars_left;
}

function checkcomment()
{
  bad = 0;
  if(document.komentarze.komentarz.value == "")
  window.alert("Komentarz jest pusty!"),bad=1

  if(bad == 0)
  document.komentarze.submit()
}

function ustaw()
{
  var sx,sy,cx,cy,mx,my;
  var myf = 0;

  sx = screen.width;
  sy = screen.height;

  if (self.innerHeight)  // all except Explorer
  {
  	cx = self.outerWidth;
  	cy = self.outerHeight;
  }
  else if (document.documentElement && document.documentElement.clientHeight)
  	// Explorer 6 Strict Mode
  {
  	cx = document.documentElement.clientWidth+30;
  	cy = document.documentElement.clientHeight+150;
  }
  else if (document.body) // other Explorers
  {
  	cx = document.body.clientWidth+30;
  	cy = document.body.clientHeight+150;
  }
  else
  {
    alert('???');
  }

  if(sx > 800)
  {
    mx = Math.round(sx*0.8);
    my = Math.round(sy*0.8);
  }
  else
  {
    mx = Math.round(sx*0.9);
    my = Math.round(sy*0.85);
  }
   if(mx > cx || my > cy || cx > (sx+10) || cy > (sy+10))
  {
    //alert(cx + ',' + mx + ',' + cy + ',' + my);

    parent.window.resizeTo(mx,my);
    center_x = (sx-mx)/2;
    center_y = (sy-my)/2;
  }
  else
  {
    center_x = (sx-cx)/2;
    center_y = (sy-cy)/2;
  }
  var Firefox = (navigator.userAgent.search('Firefox') != -1);
  if(!Firefox)
    parent.window.moveTo(center_x, center_y);
}



