function _rnd() {
  return Math.round(Math.random())-0.5;
}
function setBg(resp) {
  var urls = A(eval(resp.responseText));
  alert("loaded");
  window.document.getElementById("cnt").style.backgroundColor = 'red';
}

function loadBackgrounds() {
  new Ajax.Request( '/public/site/backgrounds', { parameters: '',  method: 'get', onSuccess: setBg });
}

Event.observe(window, "click", function(e) {
	var res, w, h;
	var link = Event.findElement(event, 'A');
	
	if (link && link.hasClassName("vidlink")) {
		// Intercept link. Open a window
		w = link.getAttribute("vw");
		h = link.getAttribute("vh");
		var windowOptions;
		if (w && h) {
			windowOptions = 'width=' + (parseInt(w) + 32) + ',height=' + (parseInt(h) + 72) + ',toolbar=no';
		} else {
			windowOptions = 'width=320,height=240,toolbar=no';
		}
		res = window.open(link.href, "player", windowOptions);
		// Presumably if a popup blocker is operating we will get a null return and wont suppress
		// the event in that case
		if(res) Event.stop(e);
	}
});
Event.observe(document, "load", loadBackgrounds);