//constructor
/*
a reflechir
position du swf dans l'arborescence (param?)
swfID a préciser ? optionnel ? inutile ?
positionnement

*/



function Swfimage(src)
{
	this.divID = swfimage_getCurrentDiv().id;
	var randstr = swfimage_getRandomString(20);
	//var swfID = 
	this.so = new SWFObject('swfimage.swf?p='+randstr+'', randstr, '1px', '1px', '9', '', true);
	this.so.addParam("wmode", "transparent");
	this.so.addVariable("src", src);
	this.so.write(this.divID);
}

function swfimage_resizeSWF(_id, _width, _height) 
{
	//alert("swfimage_resizeSWF "+_id+", "+_width+", "+_height);
	document.getElementById(_id).width = _width;
	document.getElementById(_id).height = _height;
}

function swfimage_getCurrentDiv()
{
	var randstr = swfimage_getRandomString(20);
	document.write("<a id='"+randstr+"' style='display:none'></a>");
	var retour = document.getElementById(randstr).parentNode;
	return retour;
}

function swfimage_getRandomString(length) {
	var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
	var randomstring = '';
	for (var i=0; i<length; i++) {
		var rnum = Math.floor(Math.random() * chars.length);
		randomstring += chars.substring(rnum,rnum+1);
	}
	return randomstring;
}


