Array.prototype.shuffle = function() {
function randOrd(){ return (Math.round(Math.random())-0.5); }
this.sort( randOrd );
}

function build_html(row, maxwidth, maxheight) {
	final_str = "<a href='";
	if(isNaN(row[0])){
		final_str += row[0];
	} else {
		final_str += "http://www.imvu.com/shop/web_search.php?manufacturers_id=" + row[0];
	}

	final_str +="' target='_blank'>";

	if(maxwidth==0 && maxheight==0){
		final_str += "<img src='" + row[1] + "' border='0'>"; 
	} else {
		final_str += "<img src='" + row[1] + "' border='0' style=\"max-width: " + maxwidth + "px; height:auto;\" onload=\"if (typeof(this.style.maxWidth) == 'undefined'){ if (this.width > " + maxwidth + ") this.style.width='" + maxwidth + "px'; if (this.height > " + maxheight + ") this.style.height='" + maxheight + "px';}\"></a>"; 
	}

	final_str +="</a>";

	return final_str;
}

function update_banner(id,currindex,lot) {

	sfstring="";
	 for(k=0; k<lot; k++){
		sfstring += build_html(sbanners[(currindex+k)%MAX_SBANNERS],0,0);
	 }

	currindex += lot;

	document.getElementById(id).innerHTML = sfstring;

	setTimeout ("update_banner('"+ id + "',"+ currindex + ","+ lot + ")", 15000);
}