function zrob_flasha(szerokosc, wysokosc, kolor, id, plik){
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="' + szerokosc + '" height="' + wysokosc + '" id="' + id + '" align="middle">');
document.write('<param name="allowScriptAccess" value="sameDomain" />');
document.write('<param name="movie" value="' + plik + '" />');
document.write('<param name="quality" value="high" />');
if(kolor == ""){
document.write('<param name="wmode" value="transparent" />');
var trans;
trans = 'wmode="transparent"';
}
document.write('<param name="bgcolor" value="' + kolor + '" />');
document.write('<embed src="' + plik + '" quality="high" ' + trans + ' bgcolor="' + kolor + '" width="' + szerokosc + '" height="' + wysokosc + '" name="' + id + '" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
document.write('</object>');
}

var dayarray=new Array("Niedziela","Poniedziałek","Wtorek","¦roda","Czwartek","Pi±tek","Sobota")
var montharray=new Array("01","02","03","04","05","06","07","08","09","10","11","12")

function getthedate(){
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var hours=mydate.getHours()
var minutes=mydate.getMinutes()
var seconds=mydate.getSeconds()

year = year - 30; 

if (minutes<=9)
minutes="0"+minutes
if (seconds<=9)
seconds="0"+seconds
var cdate=dayarray[day]+", "+daym+"."+montharray[month]+"."+year+" "+hours+":"+minutes+":"+seconds
+"</b></font></small>"
if (document.all)
document.all.clock.innerHTML=cdate
else if (document.getElementById)
document.getElementById("clock").innerHTML=cdate
else
document.write(cdate)
}
if (!document.all&&!document.getElementById)
getthedate()
function czas(){
if (document.all||document.getElementById)
setInterval("getthedate()",1000)
}
function maskuj(ev, dozwolone) {
   
  if (window.Event) { kod=ev.which; }
  else { kod=ev.keyCode; }

  // enter, backspace, klawisze sterujace
  if ((kod==13) || (kod==8) || (kod==0)) {
    return true; 
  };

  if (dozwolone.indexOf(String.fromCharCode(kod))==-1) {
    return false;
  } else { return true; }
 
}

function selecturl(s) {
	var gourl = s.options[s.selectedIndex].value;	window.top.location.href = gourl;
}

/***********************************************
* Textarea Maxlength script- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

function ismaxlength(obj){
  var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
  document.getElementById('maxer').innerHTML = obj.value.length
  if (obj.getAttribute && obj.value.length>mlength)
    obj.value=obj.value.substring(0,mlength)
}
function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width + ',height=' + height + ',resizable=0,scrollbars=yes,menubar=no' );
}
function pytanie(adres) {
	var answer = confirm('Czy jeste¶ pewny, że chcesz skasować ten post?\nUWAGA: Kasowanie jest nieodwracalne');
	if (answer) {
	  window.location.href=adres; 
	}
}

function obrazek(id, kt, klikniety){
  obrazki = document.getElementsByName("obrazki");
  for (i=0; i <obrazki.length; i++) {
    if (obrazki[i].id != klikniety.id){ 
      obrazki[i].style.display = '';
    }
	else{
      obrazki[i].style.display = 'none';	
	}
  }
  if (klikniety.id == 0){ 
	document.getElementById("obraz").src = 'users/avatar/' + id + '.jpg';
  }
  else{
	document.getElementById("obraz").src = 'users/galeria/' + id + '_' + kt + '.jpg';	
  }  
  document.getElementById("obraz").className = 'obram';
}  

function findPos(co) {
	obj = document.getElementById(co);
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
	}
	return [curleft,curtop];
}
function pokaz_emot (co, gdzie){
  var gdzie = findPos('emo' + gdzie);
  document.getElementById('emot_di' + co).style.visibility = 'visible';
  var x_top = gdzie[1] + 25;
  var x_left = gdzie[0] - 25;  
  document.getElementById('emot_di' + co).style.top = x_top + 'px';
  document.getElementById('emot_di' + co).style.left = x_left + 'px';
}
function ukryj_emot (co){
  document.getElementById('emot_di' + co).style.visibility = 'hidden';  
}

$(document).ready(function(){
  ajax_bhv();
});

function ajax_bhv(){
  $('.nas_pop').click (function () {
   var adres = $(this).attr('href').split("\?");	 
	$('#ajax_zdjecie').html('<div style="margin:50px; color:#fff"><img src="grafa/ajax-loader.gif" alt="" /><br />Wczytuję stronę proszę czkeać...</div>');
	$.ajax({
	  type: 'GET',
	  url: 'podstrony/zdjecie.php',
	  data: adres[1]+'&ajax=1',
	  success: function(odp){
	    $('#ajax_zdjecie').html(odp);  	
		 ajax_bhv();
	  }		
	})		 
	 return false;
  });  
}