$(document).ready(function(){	$('#wrapper').css({ 'min-height': ($(window).height()-294)+'px'});	$('#menu a').each(function(){		$(this).append('<span> &rarr;</span>');	});	$('#menu a span').css({'visibility': 'hidden', 'color': '#ccc;'});	$('#menu a').hover(function(){		$(this).children('span').css('visibility', 'visible');	}, function(){		$(this).children('span').css('visibility', 'hidden');	});	$('#searchform').hide();	$('#search a').click(function(){		$(this).parents('li').animate({			width: '150px'		}, 500, function(){			$(this).children('a').hide('fast', function(){				$('#searchform').show('slow', function(){					$('#s').focus();				});			});		});		return false;	});		$('.shadowbox[thegallery]').attr('rel', 'shadowbox[thegallery]');/* Limit feed char */	var $limit = 25;                // The number of characters to show 	$('.links ul li a').each(function(){		$(this).addClass('fertigo').attr('target', '_blank');		var $str = $(this).html();        // Getting the text		var $strtemp = $str.substr(0,$limit);   // Get the visible part of the string		$str = $strtemp + '…<span class="hide">' + $str.substr($limit,$str.length) + '</span>';  // Recompose the string with the span tag wrapped around the hidden part of it		$(this).html($str);               // Write the string to the DOM 		$('span.hide').hide();	});		$('.grafix').hover(function(){		$(this).fadeTo('fast', 0.6);	}, function(){		$(this).fadeTo('slow', 1);	});		$('.links ul').addClass('circle');	$('body:not(.page) a.post-edit-link').attr('target', '_blank');	$('.wpcf7 input#sender').attr('aria-required', 'true').attr('placeholder', 'What should I call you?').attr('required', 'required');	$('.wpcf7 input#email').attr('aria-required', 'true').attr('placeholder', 'How can I reach you?').attr('required', 'required');	$('.wpcf7 input#subject').attr('aria-required', 'true').attr('placeholder', 'What you like to say?').attr('required', 'required');	/* Poraloid making */	$('img.poraloid').wrap('<div class="poraloid-wrap" />');	$('.poraloid-wrap').parents('p').addClass('text-center');	$('.poraloid-wrap').each(function(){		/* desaturate */		var el = $(this);		el.append($(this).html());		el.children('img.poraloid:first-child').css({'z-index': 1, 'position': 'relative'});		el.children('img.poraloid:last-child').css({'position': 'absolute', 'top': 0, 'left': 0, 'z-index': 0}).addClass('desaturate').removeClass('poraloid');				/* add description */		el.append('<span>'+$(this).children('img').attr('alt')+'</span>');		if(el.children('img.poraloid').hasClass('thai')){			el.children('span').addClass('thai');		}	});	/* Project showcase */	$('.single .project_thumb img').wrap('<div class="relative" />');	$('.single .project_thumb').each(function(){		/* desaturate */		var el = $(this).children('div');		el.append(el.html());		el.children('img:first-child').css({'z-index': 1, 'position': 'relative'});		el.children('img:last-child').css({'position': 'absolute', 'top': 0, 'left': 0, 'z-index': 0}).addClass('desaturate');	});/* image fadeBlack on mouse over*/	$('.content img.poraloid').hover(function(){		$(this).fadeTo('slow', 0);	}, function(){		$(this).fadeTo('slow', 1);	});	$('.single .project_thumb img').hover(function(){		$(this).fadeTo('slow', 0);	}, function(){		$(this).fadeTo('slow', 1);	});	$('img.desaturate').each(function(){		this.src = grayscale(this.src);	});});function grayscale(src){    var canvas = document.createElement('canvas');	var ctx = canvas.getContext('2d');    var imgObj = new Image();	imgObj.src = src;	canvas.width = imgObj.width;	canvas.height = imgObj.height; 	ctx.drawImage(imgObj, 0, 0); 	var imgPixels = ctx.getImageData(0, 0, canvas.width, canvas.height);	for(var y = 0; y < imgPixels.height; y++){		for(var x = 0; x < imgPixels.width; x++){			var i = (y * 4) * imgPixels.width + x * 4;			var avg = (imgPixels.data[i] + imgPixels.data[i + 1] + imgPixels.data[i + 2]) / 3;			imgPixels.data[i] = avg; 			imgPixels.data[i + 1] = avg; 			imgPixels.data[i + 2] = avg;		}	}	ctx.putImageData(imgPixels, 0, 0, 0, 0, imgPixels.width, imgPixels.height);	return canvas.toDataURL();}$.fn.innerWrap = function() {    var a, args = arguments;    return this.each(function() {        if (!a) a = jQuery.clean(args, this.ownerDocument);        // Clone the structure that we're using to wrap        var b = a[0].cloneNode(true),        c = b;         // Find the deepest point in the wrap structure        while (b.firstChild) b = b.firstChild;         // append the child nodes to the wrapper        jQuery.each(this.childNodes,        function(i, node) {            b.appendChild(node);        });        jQuery(this)         // clear the element        .empty()         // add the new wrapper with the previous child nodes appended        .append(c);    });};
