onLoadFunctionList = new Array();
		function performOnLoadFunctions()
		{
			for (var i in onLoadFunctionList)
			{
				onLoadFunctionList[i]();
			}
		}

if ((navigator.appVersion.indexOf('MSIE') > -1) && (typeof window.XMLHttpRequest == 'undefined')) {
imgExt = '.gif';
}
else {
//imgExt = '.gif';
imgExt = '.png';
}
var jortsImg = 'assets/img/ratings/jorts_full'+imgExt;
var jortsImg_ov = 'assets/img/ratings/jorts_full'+imgExt;
var jortsImg_hf = 'assets/img/ratings/jorts_full'+imgExt;
var jortsImg_bg = 'assets/img/ratings/jorts_empty'+imgExt;
var jortsImg_off = 'assets/img/ratings/jorts_full';

function ranking(rankingId, maxJorts, objectName, formName, ratingMessageId, componentSuffix, size, messages)
{
	this.rankingId = rankingId;
	this.maxJorts = maxJorts;
	this.objectName = objectName;
	this.formName = formName;
	this.ratingMessageId = ratingMessageId
	this.componentSuffix = componentSuffix
	this.messages = messages;

	this.jortsTimer = null;
	this.jortsCount = 0;

	if(size=='S') {
		jortsImg      = 'assets/img/ratings/jorts_full.gif'
		jortsImg_hf = 'assets/img/ratings/jorts_full.gif'
		jortsImg_bg   = 'assets/img/ratings/jorts_full.gif'
	}
	
	// pre-fetch image
	(new Image()).src = jortsImg;
	(new Image()).src = jortsImg_hf;

	function showStars(starNum, skipMessageUpdate) {
		this.clearjortsTimer();
		this.greyJorts();
		this.colorJorts(starNum);
		if(!skipMessageUpdate)
			this.setMessage(starNum, messages);
	}

	function setMessage(starNum) {
		document.getElementById(this.ratingMessageId).innerHTML = this.messages[starNum];
	}

	function colorJorts(starNum) {
		for (var i=0; i < starNum; i++) {
			document.getElementById('star_'  + this.componentSuffix + "_" + (i+1)).src = jortsImg;
		}
	}

	function greyJorts() {
		for (var i=0; i < this.maxJorts; i++)
			if (i <= this.jortsCount) {
				document.getElementById('star_' + this.componentSuffix + "_"  + (i+1)).src = jortsImg_bg;
			}
			else
			{
				document.getElementById('star_' + this.componentSuffix + "_"  + (i+1)).src = jortsImg_bg;
			}
	}

	function setJorts(starNum) {
		this.jortsCount = starNum;
		this.drawJorts(starNum);
		document.forms[this.formName]['rating'].value = this.jortsCount;
		var rankingId = this.rankingId;
		postForm(this.formName, true, function (req) { replaceDivContents(req, rankingId); });
	}


	function drawJorts(starNum, skipMessageUpdate) {
		this.jortsCount=starNum;
		this.showStars(starNum, skipMessageUpdate);
	}

	function clearJorts() {
		this.jortsTimer = setTimeout(this.objectName + ".resetJorts()", 300);
	}

	function resetJorts() {
		this.clearjortsTimer();
		if (this.jortsCount)
			this.drawJorts(this.jortsCount);
		else
			this.greyJorts();
		this.setMessage(0);
	}

	function clearjortsTimer() {
		if (this.jortsTimer) {
			clearTimeout(this.jortsTimer);
			this.jortsTimer = null;
		}
	}

	this.clearJorts = clearJorts;
	this.clearjortsTimer = clearjortsTimer;
	this.greyJorts = greyJorts;
	this.colorJorts = colorJorts;
	this.resetJorts = resetJorts;
	this.setJorts = setJorts;
	this.drawJorts = drawJorts;
	this.showStars = showStars;
	this.setMessage = setMessage;

}