/*
* Copyright (c) 2008 Victor A.Spirin <victor_aspirin # mail.ru>
* v. 1.0.3 - 2008.02.28
*/





/*void*/
function RiniX_Flash_insert( /*string*/ url, /*int*/ width, /*int*/ height, /*object*/ parameters )
	{
		if( typeof url != 'string' || url == '' )
		throw new Error(_e = 'RiniX_Flash_insert: Illegal argument "url"', _e);
		if( width != null && !(typeof width == 'number' && 0 < width) &&
			!(typeof width == 'string' && width.search(/^[0-9]+%$/) != -1) )
		throw new Error(_e = 'RiniX_Flash_insert: Illegal argument "width"', _e);
		if( height != null && !(typeof height == 'number' && 0 < height) &&
			!(typeof height == 'string' && height.search(/^[0-9]+%$/) != -1)  )
		throw new Error(_e = 'RiniX_Flash_insert: Illegal argument "height"', _e);
		if( parameters != null && typeof parameters != 'object' )
		throw new Error(_e = 'RiniX_Flash_insert: Illegal argument "parameters"', _e);
	
	var ps = {allowscriptaccess:'sameDomain', bgcolor:'transparent', menu:'false', quality:'high', salign:'lt'/*tl*/, scale:'noscale', wmode:'transparent', flashvars:''};
	
		if( parameters != null )
			for( var n in parameters )
			ps[n] = parameters[n];
	
	var sz = (width != null ? ' width="' + width + '"' : '') + (height != null ? ' height="' + height + '"' : '');
	var img = '<img src="' + url.substring(0, url.indexOf('.swf')) + '_swf.jpg"' + sz + ' border="0" />';
	var ts = navigator.mimeTypes;
	var t = 'application/x-shockwave-flash';
	var txt;
		if( ts.length == 0 )
		{
		txt = '<object' + sz + ' align="middle" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"><param name="movie" value="' + url + '" />';
			for( var p in ps )
			txt += '<param name="' + p + '" value="' + ps[p] + '" />';
		txt += img + '</object>';
		}
		else
		if( ts[t] != null && ts[t].enabledPlugin != null )
		{
		txt = 
		'<embed' + sz + ' align="middle" type="' + t + '" swLiveConnect="true" pluginspage="http://www.macromedia.com/go/getflashplayer" src="' + url + '"';
			for( var p in ps )
			txt += ' ' + p + '="' + ps[p] + '"';
		txt += ' />';
		}
		else
		txt = img;
	document.write(txt);
	}

