var __mb_params = {};

function berryBar()
{
	var default_params =
	{
		host_id: 2,
		// filters
		genres: "",
		years: "2008,2009",
		countries: "",
		// sorting
		order: 'rating',
		order_dir: 'desc',
		limit: 5,
		randomize: 1,

		// block settings
		colls: 1, // number of table columns, must be equal to limit param in order to display vertical block
		title_bottom: 0, // draw title and etc bottom of image
		coll_width: '250px',
		image_size: 'small',
		image_class: '',
		show_year_country: 'true',
		show_genres: 'true',
		vertical_align: 'top',

		// colors & fonts
		background: "",
		table_td_paddind: '2px',
		table_class: '',
		font: '',
		title_size: '',
		title_color: '',
		title_class: '',
		text_size: '',
		text_color: '',
		text_class: ''
	}

	var keys = ['host_id', 'genres','years','countries', 'limit', 'order', 'show_year_country', 'show_genres', 'vertical_align',
				'colls', 'title_bottom', 'coll_width', 'randomize',
				'background', 'table_td_padding', 'table_class', 'image_size', 'image_class', 'font',
				'title_size', 'title_color', 'title_class', 'text_size','text_color', 'text_class',
				'partner_id', 'subaccount'
				];

	var params = (__mb_params) ? __mb_params : dafault_params;

	var query_string = '?';
	for(var i = 0; i != keys.length; i++)
	{
		if (params[keys[i]] != null)
		{
			query_string += keys[i] + '=' + params[keys[i]] + '&';
		}
		else if (default_params[keys[i]] != null)
		{
			query_string += keys[i] + '=' + default_params[keys[i]] + '&';
		}
	}

	document.write( '<scr' + 'ipt language="Javascript" type="text/javascript" src="http://js.movieberry.com/berryBar.php' + query_string + '"></s'+'cript>' );

}
