function fBrowser(field_name, url, type, win)
{
	var cmsURL = '/upload.php?type=' + type;
	if (type == 'image')
	{
		a_width = 590;
		a_height = 545;
	}
	else
	{
		a_width = 475;
		a_height = 375;
	}
	tinyMCE.activeEditor.windowManager.open({
		file: cmsURL,
		title: 'fBrowser',
		width: a_width,
		height: a_height,
		resizable: 'no',
		inline: 'yes',
		close_previous: 'no'
	}, {
		window: win,
		input: field_name
	});
	return false;
}
function changeIndex(image, text, redirect, id)
{
	if (redirect == 1) document.location = '/index/' + id;
	$('#image').attr('style', 'background: url(/uploads/index/' + image + ')');
	$('#text_to_change').html(text);
}
function imagesPrevious()
{
	var divs = $('.thumbnails');
	for (var i = 0; i < divs.length; i++)
	{
		if (divs[i].style.display != 'none') var visible = i;
	}
	if (visible == 0) visible_real = divs.length - 1;
	else visible_real = visible - 1;
	$('#thumbnails_' + visible).attr('style', 'display: none');
	$('#thumbnails_' + visible_real).attr('style', 'display: block');
}
function imagesNext()
{
	var divs = $('.thumbnails');
	for (var i = 0; i < divs.length; i++)
	{
		if (divs[i].style.display != 'none') var visible = i;
	}
	if (visible == divs.length - 1) visible_real = 0;
	else visible_real = visible + 1;
	$('#thumbnails_' + visible).attr('style', 'display: none');
	$('#thumbnails_' + visible_real).attr('style', 'display: block');
}
