/* jQuery Content Panel Switcher JS */
var jcps = {};
jcps.fader = function(speed, target, panel) {
	jcps.show(target, panel);
	
	
	
    if (panel == null) {panel = ''};

	$('.switcher' + panel).click(function() {

	

		var _contentId = '#' + $(this).attr('id') + '-content';
		var _contentButton = '#' + $(this).attr('id');
		var _content = $(_contentId).html();
		var _contentLeft = $(_contentId).html();
		if (speed == 0) {
			$(target).html(_content);
		}
		else {	
		if ($(_contentButton).hasClass('switcher_active')){
			//Do Nothing
		}else{
		 $(".switcher_active").switchClass("switcher_active", "switcher", 1);
		}
		
			$(target).fadeToggle(speed, function(){
				var position = $(_contentButton).position(); 
				$left = position.left + 40;
				$top = position.top - 50;
				$(".comm_propertyPreview").css( {display: "block"} );
				$(".comm_propertyPreview").stop(true, false).animate({
				  top: $top,
				  left: $left
				}, 500, function() {
				  // Animation complete.
				});

				//$(".projectWrapper").text( "left: " + position.left + ", top: " + position.top ); 
				//$(".projectWrapper").css( {left: position.left} );
				
				$(this).html(_content);}).fadeToggle(speed);
				$(_contentButton).removeClass("switcher");
            	$(_contentButton).addClass("switcher_active");
		}
		
	});
};

jcps.show = function (target, panel) {
	
$('.show').each(function() {
	if (panel == null) {
		$(target).append($(this).html() + '<br/>');
	}
	else {
		var trimPanel = panel.replace('.', '');
		if ($(this).hasClass(trimPanel) == true){$(target).append($(this).html() + '<br/>');}
	}
});
}


