$(function() {
        $('a.lightbox').lightBox();
    });  
 $(document).ready(function() {
   $("a.pokaz-komentarz").click(function() {
       $("div.komentarz-add").addClass("pokaz").slideDown("slow");
    return false;
   });
 });
 
 $(document).ready(function() {
   $("a#co-robia-gal").click(function() {
       $("div#co-robia-forum").css("display","none").fadeOut("fast");
       $("div#co-robia-komenty").css("display","none").fadeOut("fast");       
       $("div#co-robia-galerie").fadeIn("slow");
    return false;
   });
 });
 $(document).ready(function() {
   $("a#co-robia-for").click(function() {
       $("div#co-robia-komenty").css("display","none").fadeOut("fast");
       $("div#co-robia-galerie").css("display","none").fadeOut("fast");
       $("div#co-robia-forum").fadeIn("slow");
    return false;
   });
 });
 $(document).ready(function() {
   $("a#co-robia-kom").click(function() {
       $("div#co-robia-galerie").css("display","none").fadeOut("fast");
       $("div#co-robia-forum").css("display","none").fadeOut("fast");
       $("div#co-robia-komenty").fadeIn("slow");
    return false;
   });
 });
  
 
function YouTubeMovie(id){
 document.write('<object width="640" height="360"><param name="movie" value="http://www.youtube.com/v/'+id+'&rel=0&color1=0x3a3a3a&color2=0x999999&hl=pl"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/'+id+'&rel=0&color1=0x3a3a3a&color2=0x999999&hl=pl" type="application/x-shockwave-flash" wmode="transparent" width="640" height="360"></embed></object>');
}   

function img_over (nazwa, id)
{
  var mapa;
  image=document.getElementById(id);
  image.src = nazwa;    
}

function zoom(adres) {
  var nazwa = "Polska_Jazda_zoom";
  var dane= "menubar=no, toolbar=no, location=no, scrollbars=yes, resizable=no, status=no, width=820, height=640";
  noweOkno = window.open(adres, nazwa, dane);
}

 
function pokaz_div(div,x,t)
{
	div_=document.getElementById(div);
 	if(x>0) { div_.style.visibility="visible";  }
 	else { div_.style.visibility="hidden" ;  }
}
function limit_short(text,max)
{
  if(text.value.length>max)
  {
   	text.value=text.value.substring(0,max);
  }
  else text.form.licznik_short.value=(max-text.value.length);
}
function limit(text,max)
{
  if(text.value.length>max)
  	{
  	text.value=text.value.substring(0,max);
  	}
  else text.form.licznik.value=(max-text.value.length);
}

function limit_slowa(text,max)
{
  if(text.value.length>max)
  {
   	text.value=text.value.substring(0,max);
  }
  else text.form.licznik_slowa.value=(max-text.value.length);
}

function check(text)
{
  if(text.form.temat.value!='' && text.form.podpis_short.value!='' && text.form.podpis.value!='' && text.form.slowa_kluczowe.value!='')
  {
   	text.form.akcja.disabled=0;
  }
  else text.form.akcja.disabled=1;
}

function emote(text) {
	var txtarea = document.newpost.post;
	text = ' ' + text + ' ';
	if (txtarea.createTextRange && txtarea.caretPos) {
		var caretPos = txtarea.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
		txtarea.focus();
	} else {
		txtarea.value  += text;
		txtarea.focus();
	}
}

function StarsHighlight(star){
	/*Gwiazdki
	star1=gwiazdka pusta
	star2 wypelniowna
	star3 wypelniona ale wieksza niz zaznaczona
	*/
	var star0=new Image();
  star0.src="gfx/koronka_szara.gif";
  var star1=new Image();
  star1.src="gfx/koronka.gif";
  var star2=new Image();
  star2.src="gfx/koronka.gif";
  var stars=new Array();
  stars[1]=document.getElementById("koronka1");
  stars[2]=document.getElementById("koronka2");
  stars[3]=document.getElementById("koronka3");
  stars[4]=document.getElementById("koronka4");
  stars[5]=document.getElementById("koronka5");
  for(i=5;i>=1;i--)
   {
			if(i<=star)
         {
				if(stars[i].src!=star1.src)
            {
               stars[i].src=star1.src;
            }
			}
         else
         {
				if(stars[i].src!=star0.src)
            {
               stars[i].src=star0.src;
            }
			}
	}
}
