// sketch view

	
$(document).ready(function() {

	var effect_durance = 150;
	
	var sketch = $('#sketch');
	var preloader = new Image();
	
	preloader.onload = function() {
		sketch.find('img').fadeIn(effect_durance);
	}
	
	// hide/show sketch on mouseover/mouseout
	$('a.sketch').click(function(e) {
		// hiding the sketchimage
		sketch.find('img').hide(0);
		sketch.find('img').attr('src', '');
		
		// setting the image & content of the layer
		source = $(this).attr('href');
		sketch.find('img').attr('src', source);
		sketch.find('div').html($(this).parent('td').prev('td').html());
		
		// positioning of the layer
		if (self.pageYOffset) {
			x = self.pageXOffset;
			y = self.pageYOffset;
		} else if (document.documentElement && document.documentElement.scrollTop) {
			x = document.documentElement.scrollLeft;
			y = document.documentElement.scrollTop;
		} else if (document.body) {
			x = document.body.scrollLeft;
			y = document.body.scrollTop;
		}
		
		sketch.css('top', e.clientY + y - 250);
		sketch.css('left', 105);
		
		// preloading the image
		preloader.src = source;
		
		sketch.fadeIn(effect_durance / 2);
	}, function() {
		sketch.hide(0);
	});
	
	// hide sketch on mouseout
	sketch.hover(function() {
		sketch.show(0);
	}, function() {
		sketch.hide(0);
	});
	
	// hide the sketch when clicking on it
	sketch.click(function() {
		sketch.hide(0);
	});
	
	// disable clicking the thumbnails link
	$('a.sketch').click(function() {
		return false;
	});
});


