/*
	Prototype inArray function
*/
Array.prototype.inArray = function (value) {
	var i;
	for (i=0; i < this.length; i++) {
		if (this[i] === value) {
			return true;
		}
	}
	return false;
};

/*
	All navigation items,that can be highlighted by javascript
*/
var highlight = new Array(
					'philosophie_1', 
					'philosophie_2',
					'shop_briefing',
					'design_konzept',
					'ladenbau',
					'regalsysteme',
					'kassentische',
					'displays_leitsysteme_beschilderung',
					'duftmarketing',
					'zubehoer',
					'brainstore'
				);

/*
	Open the detailBox if necessary and load content from url
*/
function loadContent(url) 
{
	width = 374;
	height = 374;
	if (detailBoxOpen == false) {
		
		$("#detailBox").animate({
			width: width + "px",
			height: height + "px"
		}, 1500, "swing", function(event) {
			$("#detailBoxInner").load(url + "_left.php");
		});
		
		$("#detailBox2").animate({
			width: width + "px",
			height: height + "px"
		}, 1500, "swing", function(event) {
			$("#detailBoxInner2").load(url + "_right.php");
		});
		
		detailBoxOpen = true;
		rePosition();
		
	}
	else {
		
		// slide out
		$("#detailBoxInner").hide("slide", { direction: "left" }, 1000, function(){
			// load content
			$("#detailBoxInner").load(url + "_left.php", null, function(){
				// slide in
				$("#detailBoxInner").show("slide", { direction: "right" }, 1000);
			});
		});
		$("#detailBoxInner2").hide("slide", { direction: "left" }, 1000, function(){
			// load content
			$("#detailBoxInner2").load(url + "_right.php", null, function(){
				// slide in
				$("#detailBoxInner2").show("slide", { direction: "right" }, 1000);
			});
		});
		// reset reference image scroll position
		nowPosition = 0;
		
	}
	
	$.scrollTo("0px", 500);
	
	// set hightlights
	if (highlight.inArray(url)) {
		// reset menu items
		$("li > a").removeClass("nav_active");
		// add class to specific item
		$("#" + url).addClass("nav_active");
	}

}