	
	function openModalCart(baseUrl) {
		$("#modal_cart").dialog({
			height: 'auto',
			width: 700,
			title: 'Ihr Warenkorb',
			modal: true,
			open: function(event, ui) { 
				$('#cart_holder').load(baseUrl+'warenkorb/show/'+Math.random()); 
			},
			close: function(event, ui) {
				document.location.reload(); 
			}

		});
	} 
	
	function removeFromCart(action, baseUrl) {
		$.ajax({
			url: action,
			success: function(data) {
				$('#cart_holder').load(baseUrl+'warenkorb/show/'+Math.random());
			}
		}); 
	} 
	
	function ajaxCatSearch(kc ,baseUrl) {
		//alert(e.keyCode);
		$('#result_holder').stop();
		 
		var KEY = {
			UP: 38,
			DOWN: 40,
			DEL: 46,
			TAB: 9,
			RETURN: 13,
			ESC: 27,
			COMMA: 188,
			PAGEUP: 33,
			PAGEDOWN: 34,
			BACKSPACE: 8
		};
		
		switch(kc) {
		
			case KEY.UP:
			case KEY.DOWN:
			case KEY.PAGEUP:
			case KEY.PAGEDOWN:
			case KEY.TAB:
				//event.preventDefault();
				break;
			case KEY.ESC:
				$('#result_holder').stop();
				$('#result_holder').html('');
				$('#result_holder').css('display','none');
				break;	
			default:
				//alert($('#sCat').val());
				if ($('#sTerm').val() != '') {
					$.post(baseUrl, {term:$('#sTerm').val(), cat:$('#sCat').val()}, function(data) {
						if (data) {
							$('#result_holder').html(data); 
							$('#result_holder').css('display','block');
							
							$('#result_holder').mouseover(function() {
								$('#result_holder').stop();	
							}); 
							$('#result_holder').mouseout(function() {
								$('#result_holder').animate({opacity: 1.0}, 2000,function(){
									$('#result_holder').css('display','none');
								});  	
							});
							
							$('#result_holder').animate({opacity: 1.0}, 5350,function(){
								$('#result_holder').css('display','none');
							});  
						}	
					});
				}  
				break;
		}
	}
	
	function helper(subject, obj, baseUrl) {
		if (subject == false) {
			$('#helper').stop();
			$('#helper #help_holder').html(''); 
			$('#helper').dialog('destroy');
		}
		else {
			
			
			var x = jQuery(obj).offset().left + 50;
			var y = jQuery(obj).offset().top - jQuery(document).scrollTop() + 15;
			
			/* wait a litte bit */
			$("#helper").animate({opacity: 1.0}, 350,function(){ 
    				$('#helper').dialog({
    					height:'auto', 
    					minWidth:200,
    					title:'Hilfe',
    					position:[x,y],
    					open: function(event, ui) { 
    						$('#helper #help_holder').load(baseUrl+'hilfe/'+subject); 
					},
					close: function(event, ui) {
						 
					}
    				});
    			});	
    		} 
    		
    		//$("#dialog").dialog('option', 'position', [position.top, position.left]); 
	}
	
	
	function sendPro() {
		var finalPrice = $('#finalprice').html(); 
		finalPrice = finalPrice.split(' '); 
		finalPrice = finalPrice[0]; 
		finalPrice = parseFloat(finalPrice); 
		if ($('input[name=sendpro]:checked').val() == 'own') {
			$('#sendprice').html('4.00 &euro;'); 
			$('#completeprice').html((finalPrice + 4)+' &euro;'); 
		} 
		else {
			$('#sendprice').html('0.00 &euro;'); 
			$('#completeprice').html((finalPrice)+' &euro;');
		} 
	}
	
	
	function goto(gotourl) {
		document.location.href = gotourl; 
	}
	
	
	function setEvent(ecat, eaction, econtent) {
		_gaq.push(['_trackEvent', ecat, eaction, econtent]);
	}
	
	
	var $j = jQuery;
	$j.fn.extend({
		toggleValue : function (defaultText) {
			return this.each(function() {
				$j(this).focus(function() {
					if ($j(this).val() == defaultText) {
						$j(this).val('');
					}
					$j(this).blur(function () {
						if ($j.trim($j(this).val()) == '') {
							$j(this).val(defaultText);
						}
					});
				});
			});
		}
	});
	
	
	$(function(){
	// Scroll to Top
		$.fn.scrollToTop=function(){
			var scrollHelper =$('#scrollHelper'); 
			$(this).removeAttr("href");
			
			$(window).scroll(function(){
				if($(window).scrollTop() < 120){
					scrollHelper.fadeOut("slow") 
				} else{
					//alert($(window).scrollTop());
					scrollHelper.fadeIn("slow") 
				}
			});

			
			$(this).click(function(){ 
				if($(window).scrollTop()=="0"){
          			  	$('#scrollHelper').fadeOut("slow") 
          			} 
          			else{
					$('#scrollHelper').fadeIn("slow") 
          			}

				$("html, body").animate({scrollTop:0},"slow")
			})
		}
        	
		$(document).ready(function(){
			$(function() {
				$("#toTop").scrollToTop(); 
			});
		});

	});

	
	
	
	
