
function div_show_stars(n, id, location ) {
	if ( location == null ) {
		location = '';
	}
	var path = '/images/';
	var number_all_stars = 5;
	for(i=1;i<=n;i++){
		nam = 'star_' + id + '_' + i;
		document.getElementById(nam).className = 'on';
		document.getElementById(nam).src= '/images/star_on.gif';
	}
	tst = (n-parseInt(n));
	if (0 < tst) {
		//tst = 1-tst;
		nam = 'star_' + id + '_' + i;
		if ( 0.6 <= tst ) {
			document.getElementById(nam).className = 'on';
			document.getElementById(nam).src= '/images/star_on.gif';
		} else {
			document.getElementById(nam).className = 'off';
			document.getElementById(nam).src= '/images/star_off.gif';
		}
		i += 1;
	}
	for(j=i;j<=number_all_stars;j++) {
		nam = 'star_' + id + '_' + j;
		document.getElementById(nam).className = 'off';
		document.getElementById(nam).src= '/images/star_off.gif';
	}
}


function div_show_big_stars(n, id, location ) {
	if ( location == null ) {
		location = '';
	}
	var path = '/images/';
	var number_all_stars = 5;
	for (i=1;i<=n;i++) {
		nam = 'big_star_' + id + '_' + i;
		document.getElementById(nam).className = 'on';
		document.getElementById(nam).src= '/images/rank/on/'+ i +'.gif';
	}
	np = parseInt(n) + 1;
	tst = (n-parseInt(n));
	if (0 < tst) {
		//tst = 1-tst;
		nam = 'big_star_' + id + '_' + i;
		if ( 0.6 <= tst ) {
			document.getElementById(nam).className = 'on';
			document.getElementById(nam).src= '/images/rank/on/'+np+'.gif';
		} else {
			document.getElementById(nam).className = 'off';
			document.getElementById(nam).src= '/images/rank/off/'+np+'.gif';
		}
		i += 1;
	}
	for(j=i;j<=number_all_stars;j++) {
		nam = 'big_star_' + id + '_' + j;
		document.getElementById(nam).className = 'off';
		document.getElementById(nam).src= '/images/rank/off/'+j+'.gif';
	}
}

function myAjax( id, div_id, voted, rank_type ) {
	advAJAX.get({
		url: '/util/rank.htm',
		parameters : {
		"i" : id,
		"div_id" : div_id,
		"t" : rank_type,
		"v" : voted
		},
		onSuccess : function(obj) {
			document.getElementById(div_id).innerHTML=obj.responseText;
		},
		onError : function(obj) { alert("Błąd: " + obj.status); },
		onLoading : function(obj) {
			document.getElementById(div_id).innerHTML='Głosowanie ..';
		}
	});
}

function div_show_starsbigtimerush(n, id, location ) {
	if ( location == null ) {
		location = '';
	}
	var path = '/images/';
	var number_all_stars = 5;
	for(i=1;i<=n;i++){
		nam = 'star_' + id + '_' + i;
		document.getElementById(nam).className = 'on';
		document.getElementById(nam).src= '/images/star_on.gif';
	}
	tst = (n-parseInt(n));
	if (0 < tst) {
		//tst = 1-tst;
		nam = 'star_' + id + '_' + i;
		if ( 0.6 <= tst ) {
			document.getElementById(nam).className = 'on';
			document.getElementById(nam).src= '/images/bigtimerush/star_on.gif';
		} else {
			document.getElementById(nam).className = 'off';
			document.getElementById(nam).src= '/images/bigtimerush/star_off.gif';
		}
		i += 1;
	}
	for(j=i;j<=number_all_stars;j++) {
		nam = 'star_' + id + '_' + j;
		document.getElementById(nam).className = 'off';
		document.getElementById(nam).src= '/images/bigtimerush/star_off.gif';
	}
}


function div_show_big_starsbigtimerush(n, id, location ) {
	if ( location == null ) {
		location = '';
	}
	var path = '/images/';
	var number_all_stars = 5;
	for (i=1;i<=n;i++) {
		nam = 'big_star_' + id + '_' + i;
		document.getElementById(nam).className = 'on';
		document.getElementById(nam).src= '/images/bigtimerush/rank/on/'+ i +'.gif';
	}
	np = parseInt(n) + 1;
	tst = (n-parseInt(n));
	if (0 < tst) {
		//tst = 1-tst;
		nam = 'big_star_' + id + '_' + i;
		if ( 0.6 <= tst ) {
			document.getElementById(nam).className = 'on';
			document.getElementById(nam).src= '/images/bigtimerush/rank/on/'+np+'.gif';
		} else {
			document.getElementById(nam).className = 'off';
			document.getElementById(nam).src= '/images/bigtimerush/rank/off/'+np+'.gif';
		}
		i += 1;
	}
	for(j=i;j<=number_all_stars;j++) {
		nam = 'big_star_' + id + '_' + j;
		document.getElementById(nam).className = 'off';
		document.getElementById(nam).src= '/images/bigtimerush/rank/off/'+j+'.gif';
	}
}

function myAjaxbigtimerush( id, div_id, voted, rank_type ) {
	advAJAX.get({
		url: '/konkursy/big-time-rush/vote.htm',
		parameters : {
		"i" : id,
		"div_id" : div_id,
		"t" : rank_type,
		"v" : voted
		},
		onSuccess : function(obj) {
			document.getElementById(div_id).innerHTML=obj.responseText;
		},
		onError : function(obj) { alert("Błąd: " + obj.status); },
		onLoading : function(obj) {
			document.getElementById(div_id).innerHTML='Głosowanie ..';
		}
	});
}

