/**
 * minitabs (jQuery plugin)
 * Nizam Sayeed (nizam@nomadjourney.com)
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php) 
 *
 * Version: 1.0
 * Requires: jQuery 1.2.6+
 * 
 * Based on simpleTabs (http://supercanard.phpnet.org/jquery-test/simpleTabs/)
 * Originally developed by: Jonathan Coulet (j.coulet@gmail.com)
 *
 * Example:
 *
 *     $( '#myTabs' ).minitabs({
 *         first: '#minitabFoo',
 *         callback: myFunc,
 *         speed: 'slow'
 *     });
 *
 **/
(function( $ ) {
	$.fn.minitabs = function( opt ) {
		var options = jQuery.extend( {
			first: '',            // id of first tab to activate
			callback: null,       // callback function when a tab is switched
			speed: 'fast'         // transition effect speed
		}, opt );

		$( this ).each( function() {
			var tabContainer = '#' + this.id;
			hideAll();

			// if first tab id is not provided, try to guess
			if( options.first == '' ) {
				var first = $( this ).children( 'div.tabs' ).children( 
					'ul' ).children( 'li' )[ 0 ];
				options.first = '#' + $( first ).attr( 'id' );
			}
			changeTab( options.first );
			
			// hide all tab content divs
			function hideAll() {
				$( tabContainer + ' .tab_content' ).hide();
			}
			
			// change active tab
			function changeTab( tabId ) {
				hideAll();
				$( tabContainer + ' .tabs li' ).removeClass( 'active' );
				$( tabContainer + ' .tabs ' + tabId ).addClass( 'active' );
				$( tabContainer + ' div.tab_content' + tabId ).fadeIn( options.speed );
				if( $.isFunction( options.callback ) ) {
					options.callback.apply();
				}
			}

			// attach tab click event
			$( tabContainer + ' .tabs li' ).click( function() {
				changeTab( '#' + this.id );
			});
		});
	}
})( jQuery );

$(function(){

	//FuckDesigns.com Customs
	
	 $(".ShowComments").click(function () {
      $(".BoxComments").toggle();
    });

	
	$('div').filter(function() {
			if ($(this).attr("class") == "Box") {
				var id_name = $(this).attr("id");
				$("#"+id_name).minitabs({first: "#tab1"});
			}
		});
	
	$("a.loadup").click(function() {
		var title = $(this).attr("title");
		$('#ViewPost').show(function() {
			$(".PostPreview").html("").append(title);							 
		});
	}); 
	
	$('.closeLoad').click(function() {
		  $('#ViewPost').fadeOut(function() {
				$(".PostPreview").html("");
		  }); 
	});

});
