
var imgBuffer = new Array();
function preload (url) {
	var image = new Image();
	image.src = url;
	imgBuffer.push(image);
}


function doFocus (domId) {
	window.setTimeout("document.getElementById('" + domId + "').focus()", 100);
}


function videoPlay (proxyId, url, width, height, autostart) {
	// <embed src="/media/xy.mpg" width="320" height="255" autostart="no"></embed>
	var div = document.getElementById(proxyId);
	if (div == null) {
		alert("videoPlay(): DOM-Element mit ID \""+proxyId+"\" nicht gefunden!");
		return;
	}
	
	var embed = document.createElement("embed");
	embed.setAttribute("src", url);
	embed.setAttribute("width", width);
	embed.setAttribute("height", height);
	embed.setAttribute("autostart", autostart);
	
/*	if (videoPlay.arguments.length > 2) {
		for (var a in attrs)
			embed.setAttribute(a, attrs.a);
	} */
	
	while (div.hasChildNodes())
		div.removeChild(div.firstChild);
		
	div.appendChild(embed);
}

/**
 * Prints a DIV with the given ID containing the overlay image with the correct
 * link to start the video.
 */
function kreisky_video (htmlID, file, overlayImage, width, height, altText) {
	document.writeln('<div id="'+ htmlID +'" style="width: '+ width +'px; height: '+ height +'px;">');
	document.write("<a href=\"javascript:videoPlay('"+ htmlID +"', '"+ file +"', '"+ width +"', '"+ height +"', 'true')\">");
	document.write('<img src="'+ overlayImage +'" alt="'+ altText +'" width="'+ width +'" height="'+ height +'" />');
	document.writeln('</a>');
	document.writeln('</div>');
}

