$(document).ready(function() {


// force every http:// to open in a new window and exclude READ MORE
$('a').not('[href^="http://graphic-design.us"]').not('.stbutton').not('[href^="mailto"]').click(function() {
    window.open( $(this).attr('href') );
    return false;
});

/* add some margin */
// $('#sidebar ul:first').css({
//	"margin-bottom" : "40px"
// });

/* adjustment for sharethis icon */
$('span a').removeClass('stbutton, stico_default');

$('.entry ul').prev('p').css({
	"margin-bottom":"0"
});

/* replace p with div */
jQuery.fn.replaceWith = function(replacement) {
	return this.each(function(){
	element = $(this);
		$(this)
		.after(replacement).next()
		// .attr('class', element.attr('class')).attr('id',element.attr('id'))
		.html(element.html())
		.prev().remove();
	});
};

$('.entry img').parent().not('.items').replaceWith('<div></div>');

/* 
usage example: $('a#fooid').replaceWith('<span></span>');
before: <a id="fooid" class="whatever">some text</a>
after: <span id="fooid" class="whatever">some text</span>
*/

$('.entry img.slide').parent().addClass('items');
$('.items').wrap('<div><div class="scrollable"></div><div class="slidebrowse"><a class="prev browse">previous</a><a class="next browse">next</a></div></div>');

/* remove br tags inside scrollable items */
$('.items').find('br').remove();

/* slide images - jquery tools */
$('.scrollable').scrollable({
	size: 1,
	clickable: true,
	loop: true
});

}); // end doc ready
