this.imagePreview = function(){
	/* CONFIG */

		xOffset = 110;
		yOffset = 40;

		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
	

	/* END CONFIG */
	$("a.preview").hover(function(e){
		this.t = this.title;
		this.title = "";
		var g=$(this).children("img").attr("src").replace("small","mid");
		var a=$(this).children("img").attr("alt");

		//alert (g);
		var c = (a != "") ? "<br/>" + a : "";
		$("body").append("<p id='preview'><img src='"+ g +"' alt='"+ c +"' />"+ c +"</p>");
		var gg=$("#preview").width();
		//var gg=300
		//alert (gg);
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX - yOffset-gg) + "px")
			.fadeIn("fast");
    },
	function(){
		this.title = this.t;
		$("#preview").remove();
    });
	$("a.preview").mousemove(function(e){
		var gg=$("#preview").width();
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX - yOffset-gg) + "px");
	});
};


$(document).ready(function(){

	$("a.underline[href*=#]")
		.click(function() {
		var duration=500;
		var easing="swing";
		var newHash=this.hash;
		var target=$(this.hash).offset().top;
		var oldLocation=window.location.href.replace(window.location.hash, '');
		var newLocation=this;
		if(oldLocation+newHash==newLocation){
			$('html:not(:animated),body:not(:animated)')
			.animate({ scrollTop: target }, duration, easing, function() {
				window.location.href=newLocation;
			})
			return false;
		}
	});
	
	$(".image a").fancybox({
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'titlePosition'	: 'inside',
		overlayOpacity: 0.5,
		overlayColor: '#707070'
	});
	
	$(".photo a").fancybox({
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'titlePosition'	: 'inside',
		overlayOpacity: 0.5,
		overlayColor: '#707070'
	});

	$("div.fancyform a").fancybox({
		'scrolling'		: 'no',
		'titleShow'		: false,
		'width'			: 400
	});
	

	imagePreview();


});



