
$(document).ready(function(){	
	
	//slider
	
	$("#slider").easySlider({
		auto: true, 
		continuous: true
	});
	
	//wp-content opens in new window
	
	$("a[@href*='www.heinencreative.com/wp-content/']")
		.attr({ 
				target: "_blank", 
				title: "Opens in new window"
	});
	
	//links open in new window
	
	$("a[href^='http:'], a[href^='https:']").not("[href*='heinencreative.com']")
        .addClass("getMeOutOfHere")
        .attr({ 
				target: "_blank", 
				title: "Opens in new window"
	});

	//email link
	
	$(function(){
	var spt = $('span.mailme');
	var at = / at /;
	var dot = / dot /g;
	var addr = $(spt).text().replace(at,"@").replace(dot,".");
	$(spt).after('<a href="mailto:'+addr+'" title="Send an email">'+ addr +'</a>')
	.hover(function(){window.status="Send a letter!";}, function(){window.status="";});
	$(spt).remove();
	});
	
	//get rid of annoying wp p tags on img
	
	$("p:has(img)").css('margin' , '0');

	//offset the scroll by 10px

	$.localScroll({offset:-10});
	
	/*
	 * Url preview script 
	 * powered by jQuery (http://www.jquery.com)
	 * 
	 * written by Alen Grakalic (http://cssglobe.com)
	 * 
	 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
	 *
	 */

	this.screenshotPreview = function(){	
		/* CONFIG */

			xOffset = 10;
			yOffset = 30;

			// these 2 variable determine popup's distance from the cursor
			// you might want to adjust to get the right result

		/* END CONFIG */
		$("a.screenshot").hover(function(e){
			this.t = this.title;
			this.title = "";	
			var c = (this.t != "") ? "<br/>" + this.t : "";
			$("body").append("<p id='screenshot'><img src='"+ this.rel +"' alt='url preview' />"+ c +"</p>");								 
			$("#screenshot")
				.css("top",(e.pageY - xOffset) + "px")
				.css("left",(e.pageX + yOffset) + "px")
				.fadeIn("fast");						
	    },
		function(){
			this.title = this.t;	
			$("#screenshot").remove();
	    });	
		$("a.screenshot").mousemove(function(e){
			$("#screenshot")
				.css("top",(e.pageY - xOffset) + "px")
				.css("left",(e.pageX + yOffset) + "px");
		});			
	};
			

});