function LadujStrone(sadres){
	script = "/film/zdjecie.asp?t1i=1&xi=&number=" + sadres;
	window.open(script,'','width=640,height=510,screenX=10,screenY=10,toolbar=no,scrollbars=no,resizeable=no,');
}
function LadujStrone2(url){
	script = "/film/zdjecie.asp?t1i=1&xi=" + url + "&number=1";
	window.open(script,'','width=640,height=510,screenX=10,screenY=10,toolbar=no,scrollbars=no,resizeable=no,');
}
function LadujASP2(fi, numer){
	script = "/film/zdjecie.asp?t1i=1&xi=" + fi + "&number=" + numer;
	window.open(script,'','width=640,height=510,screenX=10,screenY=10,toolbar=no,scrollbars=no,resizeable=no,');
}
function drukuj(lista) {
	script = "/narzedzia/drukuj.asp?typ=" + drukuj.arguments[0] + "&id=" + drukuj.arguments[1];
	oknodrukuj = window.open(script,'','toolbar=no,menubar=yes,location=no,personalbar=no,scrollbars=yes,directories=no,status=no,resizable=no,width=800,height=600');
	oknodrukuj.focus;
}
function wyslij_tekst(lista) {
	script = "/narzedzia/wyslij_tekst.asp?typ=" + wyslij_tekst.arguments[0] + "&id=" + wyslij_tekst.arguments[1];
	oknodrukuj = window.open(script,'','toolbar=no,menubar=no,location=no,personalbar=no,scrollbars=no,directories=no,status=yes,resizable=no,width=440,height=490');
	oknodrukuj.focus;
}
function PokazOknoSMS(intType, intID, intMidletFamily) {
window.open('http://partner.wapster.pl/partnerSendMe.aspx?cID=' + intID + '&Type=' + intType + '&ID=124&MidletFamily=' + intMidletFamily,'sendMe','titlebar=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=404,height=380');
}
function LadujChat() {
	window.open("http://czat.stopklatka.pl/","","width=630,height=440,screenX=10,screenY=10,toolbar=no,scrollbars=no,resizeable=no");
}
function submitForm(objectId){
	document.getElementById(objectId).submit();
}

var ns4 = (document.layers);
var ie4 = (document.all);
var ie5 = (document.all && document.getElementById);
var ns6 = (!document.all && document.getElementById);

// Pobranie obiektu o identyfikatorze id

function getObj( id ) {
  if( document.getElementById )
    return document.getElementById( id );
  if( document.all )
    return document.all[ id ];
  return document.layers[ id ];
}

// Odczytanie pozycji x obiektu o identyfikatorze id

function getPosX( id ) {
  var curleft = 0;
  obj = getObj( id );
  if( obj ) {
    if( document.getElementById || document.all ) {
      while( obj.offsetParent ) {
        curleft += obj.offsetLeft;
        obj = obj.offsetParent;
      }
    } else
      if( document.layers )
        curleft += obj.x;
  }
  return curleft;
}

// Odczytanie pozycji y obiektu o identyfikatorze id

function getPosY( id ) {
  var curtop = 0;
  obj = getObj( id );
  if( obj ) {
    if( document.getElementById || document.all ) {
      while( obj.offsetParent ) {
        curtop += obj.offsetTop;
        obj = obj.offsetParent;
      }
    } else
      if( document.layers )
        curtop += obj.y;
  }
  return curtop;
}

function przesun(id){
	var reklama_brak_banera = getObj("reklama_brak_banera");

	if (navigator.appName == "Netscape") {
		innerW = window.innerWidth;
	}
	else {
		innerW = document.body.clientWidth;
	}

	offset_billboard_left = innerW/2 - 385;
	//offset_billboard_top = getPosY("reklama_billboard_refpos") - 51
	offset_billboard_top = getPosY("reklama_billboard_refpos")

	// Netscape 4
	if(ns4){
		document.layers[id].left = offset_billboard_left;
		document.layers(id).top = offset_billboard_top;
	}
	// Explorer 4
	else if(ie4){
		if (!reklama_brak_banera) {
		document.all["reklama_billboard_tabela"].style.height = 104;
		document.all[id].style.left = offset_billboard_left;
		document.all[id].style.top = offset_billboard_top;}
	}
	// W3C - Explorer 5+ and Netscape 6+
	else if(ie5 || ns6){
		if (!reklama_brak_banera) {
		document.getElementById("reklama_billboard_tabela").style.height = 104;
		document.getElementById(id).style.left = offset_billboard_left;
		document.getElementById(id).style.top = offset_billboard_top;}
	}
}

function showStars(num){
	for(var i=1; i<num+1; i++)
		showStar(i);
	for(var i=num+1; i < 11; i++)
		hideStar(i);

}
function showStar(num){
	if(document.getElementById('g_'+num)){
		document.getElementById('g'+num).style.visibility = 'hidden';
		document.getElementById('g'+num).style.width = '0px';
		document.getElementById('g_'+num).style.visibility = 'visible';
		document.getElementById('g_'+num).style.width = '17px';
		setHintPosition(num);
	}
}
function hideStar(num){
	if(document.getElementById('g_'+num)){
		document.getElementById('g_'+num).style.visibility = 'hidden';
		document.getElementById('g_'+num).style.width = '0px';
		document.getElementById('g'+num).style.visibility = 'visible';
		document.getElementById('g'+num).style.width = '17px';
	}
}
function clearStars(){
	for(var i=1; i<11; i++)
		hideStar(i);
	hideHint();
}

function setHintPosition(num){
	var xPos = getPosX('hintReferer');
	var yPos = getPosY('hintReferer');
	showHint((xPos + 12*17), yPos, getOcena(num)+" ("+num+")");
}

function getOcena(num){
	var oceny = new Array();
	oceny[0] = '';
	oceny[1] = 'katastrofa';
	oceny[2] = 'strata czasu';
	oceny[3] = 'słaby';
	oceny[4] = 'taki sobie';
	oceny[5] = 'przeciętny';
	oceny[6] = 'niezły';
	oceny[7] = 'dobry';
	oceny[8] = 'bardzo dobry';
	oceny[9] = 'znakomity';
	oceny[10] = 'wybitny!';
	return oceny[num];
}
function showHint(xPos, yPos, text){
	document.getElementById('hintText').style.display = '';
	document.getElementById('hintText').style.top = (yPos)+"px";
	document.getElementById('hintText').style.left = (xPos)+"px";
	document.getElementById('hintText').innerHTML = text;
}
function hideHint(){
	if(document.getElementById('hintText')){
		document.getElementById('hintText').style.display = 'none';
		document.getElementById('hintShadow').style.display = 'none';
	}
}
function buttonHintOn(){
	showHint(getPosX('hintReferer') + 12*17, getPosY('hintReferer'), 'Usuń moją ocenę');
}
function showPseudoTab(tabClass, tabId, referer, refererClass){
	$('div.'+tabClass).hide();
	$('#'+tabId).show();
	$('a.'+refererClass).removeClass('normal');
	$(referer).addClass('normal');
//	alert(referer);
}

function getSurveyResults(surveyId, mode, displayLegend){
	if(mode != 'full'){
		var width = 300;
	}else{
		var width = 500;
	}
	$.ajax({
		    url: 'http://'+document.location.host +'/ankiety/getResults.php',
			method: 'get',
			data: 'mode='+mode+'&id='+surveyId,
			dataType: 'json',
			success: function(data){
//				var jsonData = responseObject.responseText.evalJSON(true);
				var chart_surveyResult = new FusionCharts("/ankiety/fc/Charts/FCF_Bar2D.swf", "surveyResult", width, data.height);
				chart_surveyResult.setDataXML(data.xml);
				chart_surveyResult.render("surveyHolder");
				if(data.sum){
					$('#surveyHolder').html('<center>Oddano głosów: '+data.sum+'</center>');
				}
				//if(mode == 'short'){
				$.ajax(
					{
						url:'http://'+document.location.host +'/ankiety/getLegend.php',
						method: 'get',
						data:'mode='+mode+'&id='+surveyId,
						success: function(data){
							$('#legendHolder').html(data);
							$('#legendHolder').show();
							if(displayLegend || mode =='full'){
								showLegend();
							}
						},
						failure: function(){}
					});
				//}
			},
			failure: function(){}
		});

}

function voteS(surveyId, survey, mode){
	var form = $('#voteForm').serialize();
	$.ajax({
		    url: 'http://'+document.location.host +'/ankiety/vote.php',
			method: 'post',
		    data: 'survey='+form,
			success: function(responseObject){
				getSurveyResults(surveyId, mode, true);
			},
			failure: function(){}
	});
}

function showLegend(){
	if($('#legend:visible').length){
	    $('#legend').slideUp();
	}else{
	    $('#legend').slideDown();
	}
}
function showSWFMovie(fi, pi){
	document.write('<div id="playerHolder'+fi+pi+'"></div>');
	var so = new SWFObject('http://'+document.location.host +'/swf/flv.swf?fi='+fi+'&pi='+pi, 'player', '480', '390', '8', '#FFF');
	so.write('playerHolder'+fi+pi);
}

var toHide = new Array();

function pausecomp(millis) {
	var date = new Date();
	var curDate = null;
	do { curDate = new Date(); }
	while(curDate-date < millis);
}

function showMovieHint(referer, id, dieFast){
	//pausecomp(1000);
	if(window.time !== undefined)
		clearTimeout(time);

//	if(toHide[id]) {
//		toHide[id] = false;
//    		exit;
//	}
	if (dieFast) {
	    return;
	}
	/*
	var visibleObjects = $A(document.getElementsByClassName('movieHint'));
	//alert(visibleObjects[4].identify());
	for(var i = 0; i < visibleObjects.size(); i++){
		if(visibleObjects[i].identify() != 'mhint_'+id){
			visibleObjects[i].hide();
		}
	}
	*/

	$(".movieHint[id!=mhint_"+id+"]").hide();
	$('.personHint').hide();

	/*
	visibleObjects = $A(document.getElementsByClassName('personHint'));
	//alert(visibleObjects[4].identify());
	for(var i = 0; i < visibleObjects.size(); i++){
		visibleObjects[i].hide();
	}
	if(navigator.appName.include('Microsoft')){
		Element.extend(referer);
	}
	*/

	var xy = $(referer).offset();
	$('#mhint_'+id).css({top: xy.top, left: xy.left});
	$('#mhint_'+id).show();
	if($('#mhint_'+id+'_c').text() == ''){
		$.ajax(
			{
				method: 'get',
				url:'http://'+document.location.host +'/film/pobierzHint.php',
				data: { fi: id },
				success: function(data){
					if($('#mhint_'+id+'_c').text() == ''){
						$('#mhint_'+id+'_c').html(data);
						$('#mhint_'+id+'_p').hide();
					}
				},
				failure: function(){}
			});
	}
}

function showPersonHint(referer, id, dieFast){
	//pausecomp(200);
	if(window.time !== undefined) {
		clearTimeout(time);
	}
	/*
	if(toHide[id]) {
		toHide[id] = false;
		exit;
	}
	*/
	if (dieFast) {
	    return;
	}

	/*
	var visibleObjects = $A(document.getElementsByClassName('personHint'));
	for(var i = 0; i < visibleObjects.size(); i++){
		if(visibleObjects[i].identify() != 'phint_'+id){
			visibleObjects[i].hide();
		}
	}
	*/
	$(".personHint[id!=phint_"+id+"]").hide();
	/*
	visibleObjects = $A(document.getElementsByClassName('movieHint'));
	for(var i = 0; i < visibleObjects.size(); i++){
		visibleObjects[i].hide();
	}

	*/
	$('.movieHint').hide();



//	if(jQuery.browser.msie){
//	    tu byl kod prototypea dla ie
//		Element.extend(referer);
//	}

	var xy = $(referer).offset();
	$('#phint_'+id).css({top: xy.top, left: xy.left});
	$('#phint_'+id).show();
	if($('#phint_'+id+'_c').text() == ''){
		$.ajax({
		        url: 'http://'+document.location.host +'/filmowcy/pobierzHint.php',
				method: 'post',
				data: { oi: id },
				success: function(data){
					if($('#phint_'+id+'_c').text() == ''){
						$('#phint_'+id+'_c').html(data);
						$('#phint_'+id+'_p').hide();
					}
				},
				failure: function(){}
			});
	}
}

function hideHint(id){

    if (id) {
		time = setTimeout(function () {
//            console.log(id);
            $('#' + id).hide();
		}, 200);
//		toHide[id] = true;
    }
}


function favById(userId, rekordId, strona, akcja) {
	if(userId == 0) {
	    $.nyroModalManual({
            url: '/uzytkownik/login_modalbox2.php',
            title: 'Opcja tylko dla zalogowanych'
        });
        return false;
	}
	aUrl = 'http://'+document.location.host +'/uzytkownik/favourites.php';
	$.ajax({
        url: aUrl,
		type: 'get',
		data: {rid: rekordId, uid: userId, strona: strona, akcja: akcja},
		dataType: 'json',
		success: function(data){
			if(data.ulubione == 'tak') {
				$('#fav_' + rekordId + '_off').attr('class', 'fav favOff hidden');
				$('#fav_' + rekordId + '_on').attr('class', 'fav favOn visible');
			} else {
				$('#fav_' + rekordId + '_off').attr('class', 'fav favOff visible');
				$('#fav_' + rekordId + '_on').attr('class', 'fav favOn hidden');
			}
		},
		failure: function(){}
	});
} // function favById();



function wantedById(userId, rekordId, strona, akcja) {
	if(userId == 0) {
	    $.nyroModalManual({
            url: '/uzytkownik/login_modalbox2.php',
            title: 'Opcja tylko dla zalogowanych'
        });
		return false;
	}
	aUrl = 'http://'+document.location.host +'/uzytkownik/wanted.php';
	$.ajax({
        url: aUrl,
		type: 'get',
		data: {rid: rekordId, uid: userId, strona: strona, akcja: akcja},
		dataType: 'json',
		success: function(data){
			if(data.chceobejrzec == 'tak') {
				$('#wanted_' + rekordId + '_off').attr('class', 'wanted wantedOff hidden');
				$('#wanted_' + rekordId + '_on').attr('class', 'wanted wantedOn visible');
			} else {
				$('#wanted_' + rekordId + '_off').attr('class', 'wanted wantedOff visible');
				$('#wanted_' + rekordId + '_on').attr('class', 'wanted wantedOn hidden');
			}
		},
		failure: function(){}
	});
} // function wantedById();

$(document).ready(function() {
  $.nyroModalSettings({
    width: 935,
    height: 323,
    zIndexStart: 99999,
    title: ' ',
    closeButton: '<a href="#" class="nyroModalClose" id="closeBut" title="Zamknij">×</a>'
  });
})

function observed(userId, tematId, akcja, klasy) {
	aUrl = 'http://'+document.location.host +'/forum/observed.php';
	$.ajax({
			  url:aUrl,
				type: 'get',
				data: {userId: userId, tematId: tematId, akcja: akcja},
				//method: 'get',
				dataType:'json',
				success: function(data) {
					if(data.obserwowany == 'tak') {
						$('#observedOff').attr('class', klasy + 'hidden');
						$('#observedOn').attr('class', klasy + 'visible');
					} else {
						$('#observedOn').attr('class', klasy + 'hidden');
						$('#observedOff').attr('class', klasy + 'visible');
					}
				},
				failure: function(){}
			});
}



//////////////////////////////////////////////

	var starsSize = 14; // medium
	var stars = new Array();
	var posY = new Array();
	function showStarsById(num, movieId, init, hintPos) {
		if(init > 0) {
			stars[movieId] = num;
		}
		for(var i = 1; i < num + 1; i++) {
			showStarById(i, movieId, hintPos);
		}
		for(var i = num + 1; i < 11; i++) {
			hideStarById(i, movieId);
		}
	}
	function showStarById(num, movieId, hintPos) {
		if(document.getElementById('g_'+num + '_' + movieId)) {
			document.getElementById('g'+num + '_' + movieId).style.visibility = 'hidden';
			document.getElementById('g'+num + '_' + movieId).style.width = '0px';
			document.getElementById('g_'+num + '_' + movieId).style.visibility = 'visible';
			document.getElementById('g_'+num + '_' + movieId).style.width = starsSize + 'px';
		}
		setHintPositionById(num, movieId, hintPos);
	}
	function hideStarById(num, movieId) {
		if(document.getElementById('g_'+num + '_' + movieId)) {
			document.getElementById('g_'+num + '_' + movieId).style.visibility = 'hidden';
			document.getElementById('g_'+num + '_' + movieId).style.width = '0px';
			document.getElementById('g'+num + '_' + movieId).style.visibility = 'visible';
			document.getElementById('g'+num + '_' + movieId).style.width =  starsSize + 'px';
		}
	}
	function clearStarsById(movieId) {
		stars[movieId] = 0;
		for(var i = 1; i < 11; i++)
			hideStarById(i, movieId);
		hideHintById(movieId);
	}
	function hideHintById(movieId){
		if(document.getElementById('hintText' + movieId)){
			document.getElementById('hintText' + movieId).style.display = 'none';
			document.getElementById('hintShadow' + movieId).style.display = 'none';
		}
	}
	function setHintPositionById(num, movieId, hintPos) {
		var newMid = movieId;
		var xPos = 0;
		var yPos = 0;
		xPos = getPosX('hintReferer' + movieId);
		yPos = getPosY('hintReferer' + movieId);
		if(hintPos == 'blimp') {
			newMid = movieId.substr(0, movieId.length - 1);
			xPos = 100;
			if(!posY[movieId]) {
				var yPosMinus = getPosY('phint_' + newMid);
				if(!yPosMinus) {
					yPosMinus = getPosY('mhint_' + newMid);
				}
				posY[movieId] = yPosMinus;
			}
			yPos -= posY[movieId];
		}
		var ocena = num;
		if(hintPos != 'off') {
			if((hintPos != 'blimp') || ((hintPos == 'blimp') && getPosY('mhint_'+newMid))) {
				ocena = getOcena(num)+" ("+num+")";
			}
		}
		if(hintPos == 'obok') {
			showHintById((xPos + 2 + 12 * starsSize), yPos, ocena, movieId);
		} else if(hintPos == 'obok2') {
			showHintById((xPos + 72 + 12 * starsSize), yPos, ocena, movieId);
		} else {
			showHintById(xPos, (yPos + 24), ocena, movieId);
		}
	}
	function showHintById(xPos, yPos, text, movieId){
		var hHint = document.getElementById('hintText' + movieId);
		//alert(xPos+':'+(yPos-4));
		hHint.style.display = '';
		hHint.style.top = (yPos - 4) + "px";
		hHint.style.left = xPos + "px";
		hHint.innerHTML = text;
	}
	function showUserStars(userId, movieId) {
		if(userId == 0) {
			showStarsById(0, movieId, 0, 'obok');
			hideHintById(movieId);
			return false;
		}
		if(stars[movieId] > -1) {
			showStarsById(stars[movieId], movieId, 0, 'obok');
			hideHintById(movieId);
		}else{
		    //przerobione ale nie przetestowane
		    //alert('Skontaktuj sie z jarkiem blad zapo-html');
			$.ajax({
			    url: 'http://'+document.location.host +'/film/pobierzOcene.php',
				method: 'get',
				data:'fi='+movieId+'&uid='+userId,
				success: function(responseObject) {
					stars[movieId] = parseInt(responseObject.responseText);
				},
				failure: function(){}
			});
		}
	}
	function voteById(userId, movieId, value, strona, ocenaWszystkichId, rozmiarGwiazdki) {
		if(userId == 0) {
    	    $.nyroModalManual({
                url: '/uzytkownik/login_modalbox2.php',
                title: 'Opcja tylko dla zalogowanych'
            });
			return false;
		}
		var id, dzial;
		ocenaWszystkichId = ocenaWszystkichId ? ocenaWszystkichId : 'starsBg';
		rozmiarGwiazdki = rozmiarGwiazdki ? rozmiarGwiazdki : 17;
		switch (rozmiarGwiazdki) {
		    case 14: klasa = 'gwiazdkiMedium'; break;
		    case 17: klasa = 'gwiazdki'; break;
		}
		switch(strona) {
			case 'film':		id = 'fi'; dzial = 'film'; break;
			case 'osoba':		id = 'oi'; dzial = 'filmowcy'; break;
			case 'plakat':	id = 'zdjecie'; dzial = 'plakaty'; break;
			case 'wideo':		id = 'mi'; dzial = 'wirtualnekino'; break;
		}
		var aUrl = 'http://'+document.location.host +'/'+dzial+'/glosuj.php';
//        var params = id + ': ' + movieId + ', uid: ' + userId + ', vote: ' + value;
       // id: movieId, uid: userId, vote: value;
		$.ajax({
		    url: aUrl,
			method: 'post',
			data: { id: movieId, uid: userId, vote: value, strona: strona },
            dataType: 'json',
			success: function(data) {
				stars[movieId] = data.ocena;
				showUserStars(userId, movieId);
				if(stars[movieId] > 0 ) {
				    if (strona == 'film' ) {
				        clickVote = 'voteById('+userId+', '+movieId+', 0, \''+strona+'\', \'starsBg'+movieId+'\', ' + rozmiarGwiazdki + ');';
				    } else {
				        clickVote = 'voteById('+userId+', '+movieId+', 0, \''+strona+'\');';
				    }
					$('#removeVote' + movieId).html('<a href="#" title="Usuń moją ocenę"><img src="http://img.stopklatka.pl/img/skasuj_glos.gif" alt="" onclick="' + clickVote + ' showStarsById(0, '+movieId+'); return false;" /></a>');
				} else {
					$('#removeVote' + movieId).html('');
				}

				//odswiez box z ocena wszystkich uzytkownikow
				if(ocenaWszystkichId) {
					var starsTitle = 'Ocena użytkowników: '+data.wszystkieZaokr +' Głosów: '+data.liczba;
					$('#'+ocenaWszystkichId).title = starsTitle;
					$('#'+ocenaWszystkichId).html('<div class="' + klasa + '" style="width: '+ Math.floor(rozmiarGwiazdki * 10 * data.wszystkie / 10) + 'px; float: left;" title="' + starsTitle + '"></div>');
					var ocenaId = 'ocena' + ocenaWszystkichId.substr(7);
					$('#'+ocenaId).html(data.liczba);
				}
			},
			failure: function(){}
		});
	}


	function voteByIdBlimp(userId, movieId, value, strona, ocenaWszystkichId, rozmiarGwiazdki) {
		if(userId == 0) {
			location.href='http://'+document.location.host +'/uzytkownik/logowanie';
		}
		var id, dzial;
		ocenaWszystkichId = ocenaWszystkichId ? ocenaWszystkichId : 'starsBg';
		rozmiarGwiazdki = rozmiarGwiazdki ? rozmiarGwiazdki : 17;
		switch (rozmiarGwiazdki) {
		    case 14: klasa = 'gwiazdkiMedium'; break;
		    case 17: klasa = 'gwiazdki'; break;
		}
		switch(strona) {
			case 'film':		id = 'fi'; dzial = 'film'; break;
			case 'osoba':		id = 'oi'; dzial = 'filmowcy'; break;
			case 'plakat':	id = 'zdjecie'; dzial = 'plakaty'; break;
			case 'wideo':		id = 'mi'; dzial = 'wirtualnekino'; break;
		}
		var aUrl = 'http://'+document.location.host +'/'+dzial+'/glosuj.php';
//        var params = id + ': ' + movieId + ', uid: ' + userId + ', vote: ' + value;
       // id: movieId, uid: userId, vote: value;
		$.ajax({
		    url: aUrl,
			method: 'post',
			data: { id: movieId, uid: userId, vote: value, strona: strona },
            dataType: 'json',
			success: function(data) {
				stars[movieId+'b'] = data.ocena;
				showUserStars(userId, movieId+'b');
				if(stars[movieId+'b'] > 0 ) {
					if (strona == 'film' ) {
						clickVote = 'voteByIdBlimp('+userId+', \''+movieId+'\', 0, \''+strona+'\', \'starsBg'+movieId+'\', ' + rozmiarGwiazdki + ');';
					} else {
						clickVote = 'voteByIdBlimp('+userId+', \''+movieId+'\', 0, \''+strona+'\');';
					}
					$('#removeVote'+movieId+'b').html('<a href="#" title="Usuń moją ocenę"><img src="http://img.stopklatka.pl/img/skasuj_glos.gif" alt="" onclick="' + clickVote + ' showStarsById(0, \''+movieId+'\'); return false;" /></a>');
				} else {
					$('#removeVote'+movieId+'b').html('');
				}

				//odswiez box z ocena wszystkich uzytkownikow
//				if(ocenaWszystkichId) {
//					var starsTitle = 'Ocena użytkowników: '+data.wszystkieZaokr +' Głosów: '+data.liczba;
//					$('#'+ocenaWszystkichId).title = starsTitle;
//					$('#'+ocenaWszystkichId).html('<div class="' + klasa + '" style="width: '+ Math.floor(rozmiarGwiazdki * 10 * data.wszystkie / 10) + 'px; float: left;" title="' + starsTitle + '"></div>');
//					var ocenaId = 'ocena' + ocenaWszystkichId.substr(7);
//					$('#'+ocenaId).html(data.liczba);
//				}
			},
			failure: function(){}
		});
	}


	function przelaczGwiazdki(userId) {
		if(userId == 0) {
    	    $.nyroModalManual({
                url: '/uzytkownik/login_modalbox2.php',
                title: 'Opcja tylko dla zalogowanych'
            });
			return false;
		}
        $('.starsWrapperFilmografia').toggleClass('hidden');
        $('.dodajObejrzyjBox').toggleClass('hidden');
        $('#przelaczGwiazdki').toggleClass('filmografiaPokazOcene');
        $('#przelaczGwiazdki').toggleClass('filmografiaUkryjOcene');
        $('table.filmografiaLista td').toggleClass('liniaDol');
	}
function setCity(uid, cid, context){
		setMask('userRep', 'small');
		$.ajax(
			{
				method: 'get',
				url:'http://'+document.location.host +'/uzytkownik/ustaw_miasto.asp',
				data: { uid: uid, cid: cid },
				success: function(data){
					$.ajax({
						method: 'get',
						url:'http://'+document.location.host +'/uzytkownik/pobierz_miasto.asp',
						data: { uid: uid, cid: context },
						success: function(data){
							$('#userRep').replaceWith(data);
						}
					});
					removeMask('userRep');
					return false;
				},
				failure: function(){}
			});
		return false;
	}
	function setMask(containerId, cssClass){
		$('#'+containerId).css('position', 'relative');
		$('#'+containerId).prepend('<div id="'+containerId+'_mask"><div></div></div>');
		$('#'+containerId+'_mask').css({
			'height' : $('#'+containerId).height()+'px',
			'width' : $('#'+containerId).width()+'px',
			'position' : 'absolute',
			'top' : '0px',
			'left' : '0px',
			'z-index': '10000',
			'background' : 'url(\'http://img.stopklatka.pl/mask/mask_bg.png\')'
		});
		$('#'+containerId+'_mask div').css({
			'height' : $('#'+containerId).height()+'px',
			'width' : $('#'+containerId).width()+'px',
			'position' : 'absolute',
			'top' : '0px',
			'left' : '0px',
			'background' : 'url(\'http://img.stopklatka.pl/mask/loading_'+cssClass+'.gif\') 50% 50% no-repeat'
		});
		return false;
	}
	function removeMask(containerId){
		$('#'+containerId+'_mask').remove();
		return false;
	}

function sklepKlik(typ, id) {
	$.ajax({
		method: 'get',
		url: 'http://' + document.location.host + '/sklep/sklep.php',
		data: { typ : typ, id: id }
	});
	return true;
}