// Winston  
// add a node to dom and then load the flash into it
// can pass the holder div id and the class for the div that holds the flash


function loadWinston(cls,swf,q){
  
   	if(null == cls) cls = '';
	var el = document.createElement("div");
		el.id = 'winstonArea';
		if(cls != '') $(el).set('class', cls);
		//el.innerHTML = '<div id="animation" class="'+cls+'"></div>';
		//'container''toolbar'
		$('container').insertBefore(el, $('toolbar'));

	setWinstonContent(swf,q,'winstonArea');
	/**/
}

function unloadWinston(){
	//$('animation').innerHTML = '';
	//alert('unloadWinston');
	$('winstonArea').dispose();
	//$('container').removeChild('winstonArea');
	//$('container').insertBefore(el, $('toolbar'));
	return false;
}

function setWinstonContent(swf, q, d){
	if(swf == null || swf == '') swf = '/static/flash/winston.swf';
	if(q != null && q != '') swf += '?' + q;
	var fo = new SWFObject(swf, "winstonAnim", "100%", "100%", "9");
		fo.addParam("base", SITEBASE); 
		fo.addVariable("siteRoot", SITEBASE); 
		fo.addParam("wmode", "transparent"); 
		fo.write(d);
	
}
