var basicClass = function() {
	var self = this;
	
	this.homelinks = function () {
		$('#homewrapper ul li a').hover(	
			function () {
				$(this).parent('li').children('span.colorlayer').animate({"right": "+=50px"}, "medium");
			}, 
			function () {
				$(this).parent('li').children('span.colorlayer').animate({"right": "-=50px"}, "medium");
			}
		);
	};
	
	this.showGroup = function(id) {
		
		$('#projectlist').children().each( function() {
			
			if($(this).attr('class') == id) {
				$(this).animate({opacity: 'show', height: 'show'},200);
			}
			else {
				$(this).animate({opacity: 'hide', height: 'hide'},200);
			}
			
		});
		
		$('#projectgroup #showall').show();
		
	};
	
	this.showAllGroup = function() {
		$('#projectlist li').animate({opacity: 'show', height: 'show'},200);
		$('#projectgroup #showall').hide();
	};
	
	this.showProjectDetails = function(id) {
		
		if($('#detail-' + id).html() == '')
		{
			$.ajax({
				type: "POST",
				url: "/projekte/projectdetails",
				data: 'id=' + id,
				beforeSend: function() {
					$('#list-item-' + id + ' .loadingicon').show();
				},
				success: function(content){
					
					$('#detail-' + id).append(content);
					
					$('#list-item-' + id + ' .loadingicon').hide();
					
					$('#detail-' + id).toggle('blind',200);
					$('#list-item-' + id).toggle('blind',200);
					
					//google analytics
					pageTracker._trackPageview("/ProjectDetails/" + id );
					
					//load imagegallery
					$(function() {
						basic.projectgallery(id);
					});
	
				}
			});
		}
		else
		{
			$('#detail-' + id).toggle('blind',200);
			$('#list-item-' + id).toggle('blind',200);
		}
		
	};
	
	this.showSliderDetails = function (id) {
		$('#detail-' + id).toggle('blind',200);
		$('#list-item-' + id).toggle('blind',200);		
	};
	
	this.projectgallery = function(id) {
		$('#imagewrapper' + id).cycle({ 
		    fx:     'fade', 
		    speed:  'fast', 
		    timeout: 0, 
		    next:   '#prev' + id, 
		    prev:   '#next' + id
		});	
	};
	
	

};




var basic = new basicClass();

$(function(){
	
	basic.homelinks();
	
});
