$(document).ready(function(){

	// jedes object um clone methode erweitern
	Object.prototype.clone = function() {
	  var newObj = (this instanceof Array) ? [] : {};
	  for (i in this) {
		if (i == 'clone') continue;
		if (this[i] && typeof this[i] == "object") {
		  newObj[i] = this[i].clone();
		} else newObj[i] = this[i]
	  } return newObj;
	};

	// bei click auf ein thumbnail
	$("div.portfolioSingle div.gridImage a").click(function(event){
		event.preventDefault();
		
		// original bildname aus dem thumb holen
		var href = $(this).attr("href").replace(sb_portImagePath,"");
		
		// array mit imgInfos der extension clonen
		var info = sb_portImages.clone().pop().pop();

		// neuen href aus dem array suchen und als src für grosses bild setzen
		for (i in info) {
			if (info[i]['source'] === href) {
				src = info[i]['generated'];
				$("img.portSingleImage").attr("src", src).removeAttr("width").removeAttr("height");				
				break;
			}
		}
	});
	
});
