function redirect(url) {
	window.location.href = url;
}


function in_array(needle, haystack) {
	for (var haystack_count = haystack.length, i = 0; i < haystack_count; i++) {
		if (needle == haystack[i]) {
			return true;
		}
	}

	return false;
}

function toggle_display(id) {
	$(id).style.display = $(id).style.display == 'none' ? '' : 'none';
}

function show_notice() {
	var notice = $('notice');
	var effect = new fx.Opacity(notice, {duration:1000,
		onComplete: function(){
			//alert('the effect is finished');
		}
	}, 0);

	effect.custom(0, 1);
	notice.style.visibility = 'visible';
}

function var_dump(foo) {
	var content = '';
	for (k in foo) {
		content += k + ' => ' + foo[k] + "\n";
	}
	return content;
}

function load(page) {
	var filter = entry_type == 'vendors' ? $('vendor_cat_id').value : $('name_order').value;
	$('preloader').style.display = '';
	var myAjax = new Ajax (
		'actions.php?action=get_page&table=' + entry_type + '&filter=' + filter + '&page=' + page, {
			method : 'get',
			update : 'entries_loader',
			onComplete : function(response) {
				$('preloader').style.display = 'none';
			}
		}
	).request();
}

function load_photo(id) {
	var myAjax = new Ajax (
		'actions.php?action=load_photo&id=' + id, {
			method : 'get',
			update : 'fg_image',
			onComplete : function(response) {

			}
		}
	).request();

/*
	new ajax (
		'actions.php?action=load_photo&id=' + id,
		{
			onComplete : function (req) {
				if (req.responseText) {
					$('fg_image').innerHTML = req.responseText;
				}
			}
		}
	);
*/

}