function LoadImgBanner (File, Width, Height) {
	document.write('<img src="'+File+'" width="'+Width+'" height="'+Height+'" />');
}

function LoadSwfBanner (File, Width, Height) {
	var topo = new Flash(File, "", Width, Height); 
    topo.write();
}

function RandomBanner (Arr, Width, Height, cookieName) {
	
	var Banners = Arr.split(',');
	var N =  Math.floor(Math.random()*Banners.length);
	var next = true;
	
	if (Banners.length > 1) { 
		
		if (getCookie('almanaque_'+cookieName) != N) {
			setCookie ('almanaque_'+cookieName, N, "");	
		} else {
			next = false;
			RandomBanner (Arr, Width, Height, cookieName);
		}	
	}
	
	//----------------------------------------------------
	
	if (next) {		
		var fileExt = Banners[N].substring(Banners[N].lastIndexOf(".") + 1, Banners[N].length);
			
		if (fileExt == "jpg" || fileExt == "jpeg" || fileExt == "gif" || fileExt == "png") {
			LoadImgBanner (Banners[N], Width, Height);
		}
		else if (fileExt == "swf") {
			LoadSwfBanner (Banners[N], Width, Height);
		}
		else {
			document.write('Formato não suportado.');
		}
	}
	
}