var shootermode = 'inactive';

$(document).ready(function() {
	
	$(document).unbind('keydown').bind('keydown', function(key) {
		if (key.which == 83) {
			$('#logo').mouseenter(function() {
				
				$('body').css({
					'cursor': 'crosshair'
				});
				
				$('div, a, img, span, p').unbind('click').bind('click', function(e) {
					e.preventDefault();
					e.stopPropagation();

					$(this).animate({
						'opacity': 0
					}, 500, false, function() {
						$(this).remove();
					});
				});
			});
		}
	});
	
	// content_login
	$('.content_login .content_login_wrapper .content_login_middle .registration_wrapper').css({
		'opacity': 0.7
	});
	
	$('.content_login .content_login_wrapper .content_login_middle .registration_wrapper').hover(function() {
		$(this).stop().animate({
			'opacity': 1
		}, 150);
	}, function() {
		$(this).stop().animate({
			'opacity': 0.7
		});
	});
	
	$('.content_login .content_login_wrapper .content_login_middle .registration_wrapper').click(function(e) {
		e.preventDefault();
		$('#registration_submit_button').trigger('click');
	});
	
	$('.content_box_banner').cycle({
		'fx': 'fade',
		'speed': 2500,
		'timeout': 5000
	});
	
	$('.category_field').click(function(){
		$(this).find('.category_menu').slideToggle();
	});
	
	

	
	// shoppingcart item search
	var shoppingcart_search_item_selector = $('#shoppingcart_search_item');
	
	shoppingcart_search_item_selector.focus(function() {
		var shoppingcart_search_item_value = shoppingcart_search_item_selector.val();
		if (shoppingcart_search_item_value == 'Suchartikel hier eingeben') {
			shoppingcart_search_item_selector.val('');
		}
		
	});

	shoppingcart_search_item_selector.live('keyup', function(e) {
		e.preventDefault();

		var search = $(this).val();
		
		if (search.length > 2) {
			var jqxhr = $.ajax({
				'url': '/index.php?website_modul=website_search&type=shoppingcart&search=' + search
			});
			
			jqxhr.success(function(data){
				
				$('#shoppingcart_searchResultBox').empty().remove();
				
				searchbox = $('<div id="shoppingcart_searchResultBox">'+data+'</div>')
					.appendTo('#shoppingcart_search_result');
			});
			
			jqxhr.error(function(data) {
				//alert(data);
			});
		} else {
			
			$('#shoppingcart_searchResultBox').empty().remove();
		}
	});
	
	

	
	
	
});

