$(document).ready(function() {
	$cateogry = '';
	$('.productoverview').click(function() {
		$category = $(this).attr('title');
		 
		var maintitle = $(this).attr('title');

		$("#fuellenDetailView").hide();
	    $("#fuellenDetailView").load('/ajax.php?package=ch.iframe.snode.catalog&module=ASM_product_handler&param_method=subcategory_typ&param_category=' + $(this).attr('rel'), function() {
	        $("#fuellenDetailView").fadeIn();
		
	        $("#selectionMainTitel").html(maintitle);
	        
	        // Load subnavigation
	        $history = '';
	        $subcategory = '';
	        $('.productsubnav').click(function() {
	        	// Keep title for subsubnavigation
	        	$subcategory = $(this).attr('title');
	        	$("#selectionTitel").html("&raquo; " + $(this).attr('title'));
	    		// To hide previously visited element
	    		if($history) {
	    			$($history).hide();
	    		}
	    	    $("#fuellLinksItem_" + $(this).attr('rel')).fadeIn();
	    	    $history = '#fuellLinksItem_' + $(this).attr('rel');
	    	    return false;
	    	});
	        // Load subsubnavigation
	        $('.productsubsubnav').click(function() {
	        	$("#selectionTitel").html("&raquo; " + $subcategory + " &raquo; " + $(this).attr('title'));
	        	$("#fuellContent").load('/ajax.php?package=ch.iframe.snode.catalog&module=ASM_product_handler&param_method=article&param_style=detail.tpl&param_article=' + $(this).attr('rel'),function(){
	                $("#fuellContent").fadeIn();
	            });
	        	return false;
	        });	
	    });
	    return false;
	});
	
	
	$('.prodbyanwendung > A').click(function() {
		$category = $(this).attr('rel');
		
		var maintitle = $(this).attr('title');
		
		$("#fuellenDetailView").hide();
	    $("#fuellenDetailView").load('/ajax.php?package=ch.iframe.snode.catalog&module=ASM_product_handler&param_method=subcategory_use&param_category=' + $category, function() {
	        $("#fuellenDetailView").fadeIn();
	        $("#selectionMainTitel").html(maintitle);
	        // Load subnavigation
	        $history = '';
	        $subcategory = '';
	        $('.productsubnav').click(function() {
	        	// Keep title for subsubnavigation
	        	$subcategory = $(this).attr('title');
	        	$("#selectionTitel").html("&raquo; " + $(this).attr('title'));
	    		// To hide previously visited element
	    		if($history) {
	    			$($history).hide();
	    		}
	    	    $("#fuellLinksItem_" + $(this).attr('rel')).fadeIn();
	    	    $history = '#fuellLinksItem_' + $(this).attr('rel');
	    	    return false;
	    	});
	        // Load subsubnavigation
	        $('.productsubsubnav').click(function() {
	        	$("#selectionTitel").html("&raquo; " + $subcategory + " &raquo; " + $(this).attr('title'));
	        	$("#fuellContent").load('/ajax.php?package=ch.iframe.snode.catalog&module=ASM_product_handler&param_method=article&param_style=detail.tpl&param_article=' + $(this).attr('rel'),function(){
	                $("#fuellContent").fadeIn();
	            });
	        	return false;
	        });	
	    });
	    return false;
	});
	
	$('.prodbysystem > A').click(function() {
		$category = $(this).attr('rel');
		var maintitle = $(this).attr('title');
		$("#fuellenDetailView").hide();
	    $("#fuellenDetailView").load('/ajax.php?package=ch.iframe.snode.catalog&module=ASM_product_handler&param_method=subcategory_sys&param_category=' + $category, function() {
	        $("#fuellenDetailView").fadeIn();
	        $("#selectionMainTitel").html(maintitle);
	        // Load subnavigation
	        $history = '';
	        $subcategory = '';
	        $('.productsubnav').click(function() {
	        	// Keep title for subsubnavigation
	        	$subcategory = $(this).attr('title');
	        	$("#selectionTitel").html("&raquo; " + $(this).attr('title'));
	    		// To hide previously visited element
	    		if($history) {
	    			$($history).hide();
	    		}
	    	    $("#fuellLinksItem_" + $(this).attr('rel')).fadeIn();
	    	    $history = '#fuellLinksItem_' + $(this).attr('rel');
	    	    return false;
	    	});
	        // Load subsubnavigation
	        $('.productsubsubnav').click(function() {
	        	$("#selectionTitel").html("&raquo; " + $subcategory + " &raquo; " + $(this).attr('title'));
	        	$("#fuellContent").load('/ajax.php?package=ch.iframe.snode.catalog&module=ASM_product_handler&param_method=article&param_style=detail.tpl&param_article=' + $(this).attr('rel'),function(){
	                $("#fuellContent").fadeIn();
	            });
	        	return false;
	        });	
	    });
	    return false;
	});
});

function closeDetailView() {
    $("#fuellenDetailView").fadeOut();
}