$(document).ready(
	function()
	{
					//	$('div.portlet_content2').toggle();

						$('a.toggle2close').hide();
						$('a.toggle2open').parent('div').prev('div').hide();
		// Toggle Single Portlet
		$('a.toggle').click(function()
			{
				$(this).parent('div').next('div').slideToggle(500);
				return false;
			}
		);
		

		
			$('a.toggle2open').click(function()
			{
				$(this).parent('div').prev('div').slideToggle(500);
				$('a.toggle2close').show();
				$('a.toggle2open').hide();


				return false;
			}
			
		);
			
		    $('a.toggle2close').click(function()
			{
				$(this).parent('div').prev('div').slideToggle(500);
				$('a.toggle2close').hide();
				$('a.toggle2open').show();


				return false;
			}
			
		);
				
		$(".portlet_content_inner").hide();		
		$(".portlet_content2 h4").click(function(){
			$(this).next().slideToggle("5000");
			if ($(this).attr('class') == "cs_closed2" ) {
				$(this).removeClass();
				$(this).addClass("cs_open2");
				return false;
				
			} else if ($(this).attr('class') == "cs_open2" ) {
				$(this).removeClass();
				$(this).addClass("cs_closed2");
				return false;
			}
			
		});

		// Invert All Portlets
		$('a#all_invert').click(function()
			{
				$('div.portlet_content').toggle();
				return false;
			}
		);

		// Expand All Portlets
		$('a#all_expand').click(function()
			{
				$('div.portlet_content:hidden').show();
				return false;
			}
		);

		// Collapse All Portlets
		$('a#all_collapse').click(function()
			{
				$('div.portlet_content:visible').hide();
				return false;
			}
		);

		// Open All Portlets
		$('a#all_open').click(function()
			{
				$('div.portlet:hidden').show();
				$('a#all_open:visible').hide();
				$('a#all_close:hidden').show();
				return false;
			}
		);

		// Close All Portlets
		$('a#all_close').click(function()
			{
				$('div.portlet:visible').hide();
				$('a#all_close:visible').hide();
				$('a#all_open:hidden').show();
				return false;
			}
		);

		// Controls Drag + Drop
		$('#columns td').Sortable(
			{
				accept: 'portlet',
				helperclass: 'sort_placeholder',
				opacity: 0.7,
				tolerance: 'intersect'
			}
		);
	}
);