function set_active(item) {
    for (i=1; i<=8; i++) {
        $("#"+item.id.substr(0,3)+i).removeClass('left-menu-active');
    }

    current_active = "#"+item.id;
    
    $("#"+item.id).addClass('left-menu-active');
}

var current_active = '';

jQuery(function( $ ){
	
	$.localScroll.defaults.axis = 'xy';
	
	$.localScroll({
		target: '#content',
		queue:true,
		duration:1000,
		onBefore:function( e, anchor, $target ){
			// The 'this' is the settings object, can be modified
		},
		onAfter:function( anchor, settings ){
			// The 'this' contains the scrolled element (#content)
		}
	});
	
	$("a").addClass('a-default');
	
	        $('#wrap-1 a.left-menu').click(function() {
            $.get("grab-data.php", { id: $(this).attr('title') }, function (data) {
                $("#wrap-1 .content").html(data);
            });
	    });	 
	    $('#wrap-2 a.left-menu').click(function() {
            $.get("grab-data.php", { id: $(this).attr('title') }, function (data) {
                $("#wrap-2 .content").html(data);
            });
	    });
	    $('#wrap-3 a.left-menu').click(function() {
            $.get("grab-data.php", { id: $(this).attr('title') }, function (data) {
                $("#wrap-3 .content").html(data);
            });
	    });
	    $('#wrap-4 a.left-menu').click(function() {
            $.get("grab-data.php", { id: $(this).attr('title') }, function (data) {
                $("#wrap-4 .content").html(data);
            });3
	    });
	    $('#wrap-5 a.left-menu').click(function() {
            $.get("grab-data.php", { id: $(this).attr('title') }, function (data) {
                $("#wrap-5 .content").html(data);
            });
	    });
	    $('#wrap-6 a.left-menu').click(function() {
            $.get("grab-data.php", { id: $(this).attr('title') }, function (data) {
                $("#wrap-6 .content").html(data);
            });
	    });   
        $('#wrap-1 a.left-menu-active').click(function() {
            $.get("grab-data.php", { id: $(this).attr('title') }, function (data) {
                $("#wrap-1 .content").html(data);
            });
	    });	 
	    $('#wrap-2 a.left-menu-active').click(function() {
            $.get("grab-data.php", { id: $(this).attr('title') }, function (data) {
                $("#wrap-2 .content").html(data);
            });
	    });
	    $('#wrap-3 a.left-menu-active').click(function() {
            $.get("grab-data.php", { id: $(this).attr('title') }, function (data) {
                $("#wrap-3 .content").html(data);
            });
	    });
	    $('#wrap-4 a.left-menu-active').click(function() {
            $.get("grab-data.php", { id: $(this).attr('title') }, function (data) {
                $("#wrap-4 .content").html(data);
            });
	    });
	    $('#wrap-5 a.left-menu-active').click(function() {
            $.get("grab-data.php", { id: $(this).attr('title') }, function (data) {
                $("#wrap-5 .content").html(data);
            });
	    });
	    $('#wrap-6 a.left-menu-active').click(function() {
            $.get("grab-data.php", { id: $(this).attr('title') }, function (data) {
                $("#wrap-6 .content").html(data);
            });
	    }); 
	
});

function goto(sectionid, wrapid) {
	
	$("#s"+sectionid.substr(0,1)+"-1").removeClass('left-menu-active');    
	$(current_active).removeClass('left-menu-active');
    current_active = "#s"+sectionid;
    $("#s"+sectionid).addClass('left-menu-active');
    var tmp = (sectionid.substr(2,1));
    
    $.get("grab-data.php", { id: $("#s"+sectionid.substr(0,1)+"-"+tmp).attr('title') }, function (data) {
        $("#wrap-"+wrapid+" .content").html(data);
    });
}