function menu()
{
	jQuery('ul.menu div').hide(); // Opera Fix

	jQuery('ul.menu  li').hover(function()
	{
		jQuery(this).find('div:first').show();
	}
	,function()
	{
		jQuery(this).find('div:first').hide();
	});

}

function headerMenu()
{
	jQuery('.header_menu_extended').hide(); // Opera Fix

	jQuery('#header .header_menu').hover(function()
	{
		jQuery(this).find('div:first').show();
	}
	,function()
	{
		jQuery(this).find('div:first').hide();
	});

}

function productSmall() {

	jQuery('.product_small').hover(function()
	{
		jQuery(this).find('.product_basket').animate({
			'margin-top': '0px'
		},200);

		jQuery(this).find('.product_price').animate({
			'margin-top': '10px'
		},200);
	}
	,function()
	{
		jQuery(this).find('.product_basket').animate({
			'margin-top': '52px'
		},200);

		jQuery(this).find('.product_price').animate({
			'margin-top': '0px'
		},200);
	});
}

function showResponse(responseText, statusText, xhr, $form)  {
    alert('status: ' + statusText + '\n\nresponseText: \n' + responseText +
        '\n\nThe output div should have already been updated with the responseText.');
}

function responseHandler(responseText, statusText, xhr, $form) {

	switch (responseText.event) {
		case ('redirect'):
			redirect(responseText.data);
		break;

		case ('message'):
			message(responseText.data);
		break;

		case ('delete'):
			remove(responseText.data);
		break;

		default:
			alert('error');
	}
}

function redirect(url) {
	window.location = url;
}

function message(message) {
	alert(message);
}

function remove(object) {
	$(object).hide();
}

function toggleSearchValue() {
	var value;
	$('input#search_input').focus(function() {
		value = $(this).val();
		$(this).val('');
	}).blur(function() {
		if($(this).val() == '') {
			$(this).val(value);
		}
	});
}
