jQuery(document).ready(function(){
	imagePreview();
	jQuery('img.redborder').wrap('<div class="redborder">');					// Wrap the site images with a div
	jQuery('div.widePost div.thumbCont img.attachment-post-thumbnail').wrap('<div class="redborder">');		// Wrap blog post attachment with a div
	jQuery('div.redborder').prepend('<span></span>');						// Insert image holder into div
	
	/* GA */
	// Newsletter
	jQuery("#webform-client-form-55").submit(function() {
		_gaq.push(['_trackEvent', 'Form Submissions', 'Newsletters', 'Registered']);
	});
	// Chill Weekend
	jQuery("#webform-client-form-54").submit(function() {
		_gaq.push(['_trackEvent', 'Form Submissions', 'Chill Weekend', 'Registered']);
	});
	// Form Submit
	jQuery('form').submit(function(){
		$('input[type=submit]').attr('disabled', 'disabled').css({ opacity: 0.3 });
	});
});



this.imagePreview = function(){	
	/* CONFIG */
		
		xOffset = 10;
		yOffset = -10;
		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
		
	/* END CONFIG */
	jQuery("a.preview").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "<br/>" + this.t : "";
		jQuery("body").append("<p id='preview'><img src='"+ this.href +"' alt='Image preview' />"+ c +"</p>");								 
		jQuery("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		$("#preview").remove();
    });	
	jQuery("a.preview").mousemove(function(e){
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};


