function changeBlogTab(which) {
	if(which=='najwyzej_ocenieni') {
		document.getElementById('tab_najnowsi').src = "/blogi/images/tab_najnowsi2.gif";
		document.getElementById('tab_najwyzej_ocenieni').src = "/blogi/images/tab_najwyzej_ocenieni2.gif";
		document.getElementById('najnowsi_cont').style.display = "none";
		document.getElementById('najwyzej_ocenieni_cont').style.display = "block";
	} else {
		document.getElementById('tab_najnowsi').src = "/blogi/images/tab_najnowsi.gif";
		document.getElementById('tab_najwyzej_ocenieni').src = "/blogi/images/tab_najwyzej_ocenieni.gif";
		document.getElementById('najwyzej_ocenieni_cont').style.display = "none";
		document.getElementById('najnowsi_cont').style.display = "block";
	}
}

function changeBackground(element) {
	element.style.background = "#fff";
}

function restoreBackground(element) {
	element.style.background = "none";
}

function showDescription(kategoria) {
	document.getElementById('opis_kategorii').src = "/blogi/images/kategorie_"+kategoria+"_desc.gif";
}

function show_stars(n, id, location, skin, path ) {
	if ( location == null ) {
		location = '';
	}
	if ( path == null ) {
		path = '/images/blog';
	}
	if ( skin == null ) {
		skin = 'skin_1';
	}
	// path = path + '/' + skin;

	var number_all_stars = 5;
	for(i=1;i<=n;i++) {
		nam = 'star_' + id + '_' + i;
		document.getElementById(nam).src = ( path + '/news-star-1.gif' );
	}
	tst = (n-parseInt(n));
	if (0 < tst) {
		//tst = 1-tst;
		nam = 'star_' + id + '_' + i;
		if ( 1 <= tst ) {
			document.getElementById(nam).src = path + '/news-star-1.gif';
		} else if ( 0.3 <= tst ) {
			document.getElementById(nam).src = path + '/news-star-1-2.gif';
		} else {
			document.getElementById(nam).src = path + '/news-star-0.gif';
		}
		/*
		if (0.7 <=tst) {
			document.getElementById(nam).src = '/images/star_2_3.gif';
		} else if (0.4 <=tst) {
			document.getElementById(nam).src = '/images/star_1_2.gif';
		} else if (0.1 <=tst) {
			document.getElementById(nam).src = '/images/star_1_3.gif';
		} else {
			document.getElementById(nam).src = '/images/star_0.gif';
		}
		*/
		i += 1;
	}
	for(j=i;j<=number_all_stars;j++) {
		nam = 'star_' + id + '_' + j;
		document.getElementById(nam).src = path + '/news-star-0.gif';
	}
}

function myAjax( id, div_id, voted, rank_type, location, skin ) {
	// t: 'podroze'
	if ( location == null ) {
		location = '';
	}
	if ( skin == null ) {
		skin = 'skin_1';
	}
	var full_url = location + '/util/rank.htm';
	//alert( 'full_url ' + full_url );
	advAJAX.get({
		url: '/util/rank.htm',
		parameters : {
		"i" : id,
		"div_id" : div_id,
		"t" : rank_type,
		"v" : voted,
		"skin" : skin
		},
		onSuccess : function(obj) {
			document.getElementById(div_id).innerHTML=obj.responseText;
		},
		onError : function(obj) { alert("Blad: " + obj.status); },
		onLoading : function(obj) {
			document.getElementById(div_id).innerHTML='Głosowanie ..';
		}
	});
}
