function twitPop(myURL, myTitle, myRelated) {

	var width  = 650;

	var height = 500;

	var left   = (screen.width  - width)/2;

	var top    = (screen.height - height)/2;

	var params = 'width='+width+', height='+height;

	params += ', top='+top+', left='+left;

	params += ', directories=no';

	params += ', location=no';

	params += ', menubar=no';

	params += ', resizable=no';

	params += ', scrollbars=no';

	params += ', status=no';

	params += ', toolbar=no';

	newwin=window.open("http://twitter.com/share?url="+myURL+"&text="+myTitle+"&related="+myRelated,'Share via Twitter', params);

	if (window.focus) {newwin.focus()}

	return false;

}





jQuery.noConflict();



jQuery(function(){

	

	// =======================================================

	//					Sub-menu Hover

	// =======================================================	

	jQuery('.menu li').find("ul.sub-menu").css('opacity', 0);

	jQuery(".menu li").hover(function() {

		 jQuery(this).find("ul.sub-menu").animate({

			opacity: 1,

			}).show();  

		},

		function(){

			jQuery(this).find("ul.sub-menu").animate({

			opacity: 0

			}, 'fast');

		}

	);

	// =======================================================

	//					Hide Filter Menu

	// =======================================================	

	jQuery('#filtering-nav ul').slideToggle();

	jQuery('a.filter-btn').click(function(){

		jQuery('#filtering-nav ul').slideToggle();

	});

	

	// MouseOver Events

		
/*
	jQuery('.box').hover(function(){

			jQuery('.img-container img', this).fadeTo("fast", 0.65).addClass('box-hover');

			jQuery('.actions', this).fadeTo("fast", 1);

		},

		function(){

			jQuery('img', this).fadeTo("fast", 1).removeClass('box-hover');

			jQuery('.actions', this).fadeTo("fast", 0)

	});

	*/

	// Sidebar Ads

	jQuery('.shaken_sidebar_ads a:odd img').addClass('last-ad');

	

	// =======================================================

	//						Share Icons

	// =======================================================

	jQuery('.share-container').hide();

	

	jQuery('.share').click(function(){

		var myParent =  jQuery(this).parent();

		jQuery('.share-container', myParent).slideToggle('fast');				   

	});

	

	// ======== Find the spaces and replace with %20 =========

	jQuery(".share-icons a").each(function(){

	  jQuery(this).attr( 'href', encodeURI( jQuery(this).attr("href") ) );

	});

	

	// Colorbox

	jQuery('.gallery-icon a').attr('rel', 'post-gallery');

	jQuery("a[rel='gallery'], a[rel='lightbox'], .gallery-icon a").colorbox();

	

	

	jQuery(window).load(function(){

	

		// Grid jQuery plugin: http://desandro.com/resources/jquery-masonry/

		// =======================================================

		//						Masonry Setup

		// =======================================================

		

		speed = 1000;

		

		attachMasonry();

		jQuery('.box').fadeIn(0, function() {
		
			jQuery('#footer').fadeIn(1000);

		});

		/*

		jQuery('#sort').masonry({ 

			columnWidth: 175,

			itemSelector: '.box:not(.invis)',

			animate: true,

			animationOptions: {

				duration: speed,

				queue: false,

			}

		});

		*/ 

		

		// =======================================================

		//					Masonry Filtering

		// =======================================================

		jQuery('#filtering-nav li a').click(function(){

			var colorClass = '.' + jQuery(this).attr('class');

			

			if(colorClass=='.all') {

				// show all hidden boxes

				jQuery('#sort').children('.invis')

					.toggleClass('invis').animate({opacity: 1},{ duration: speed });

			} else {    

				// hide visible boxes 

				jQuery('#sort').children().not(colorClass).not('.invis')

					.toggleClass('invis').animate({opacity: 0},{ duration: speed });

				// show hidden boxes

				jQuery('#sort').children(colorClass+'.invis')

					.toggleClass('invis').animate({opacity: 1},{ duration: speed });

			}

			jQuery('#sort').masonry();

		

			return false;

		});

		

		// =========================================================

		//         On load Cleanup [SJG 200110127]

		// =========================================================

		function attachMasonry()

		{

			jQuery('#sort').masonry({ 

				//columnWidth: 510,
				singleMode: true, 

				/* itemSelector: '.box:not(.invis)', */

				itemSelector: '.box',

				animate: true,

				animationOptions: {

					duration: speed,

					queue: false,

				}

			});

		}

		

	});

});
