function f_showAll(o)
{
	o.style.display = 'none';
	var oMain = o.parentNode.parentNode;
	var oContent = oMain.parentNode;
	var aDiv = o.parentNode.getElementsByTagName('div');
	//oMain.style.paddingBottom = '2em';
	oContent.style.height = 'auto';
	for ( var i=0; i<aDiv.length; i++ )
	{
		var oDiv = aDiv[i];
		if ( oDiv.className.match(/hide/) ) { oDiv.className = oDiv.className.replace(/hide/,'') }
	}
}


		
// replace header with flash

/*
var aFlashVar = {
	vTitle: "<strong>Willkommen bei SampleZone</strong>",
	vAnimation: "eigenwelt-208",
	vStyle: "mobile",
	vFullWidth: "false"
	};
*/
var aParam = {
	menu: "false",
	play: "true",
	allowfullscreen: "false",
	wmode: "opaque"
	};
var aAttribute= {
	};

// swfobject.embedSWF("/gallery/samplezone/header/header.swf", "panoramaplayer", "932", "202", "9",false,aFlashVar,aParam,aAttribute);


// jquery plugin samplezone
jQuery.fn.szmore = function(options) {
	// speed: pixel/s
	var oOption = jQuery.extend({ speed: 500 }, options);
	// more reference
	var oMore = $(this);
	// create link use title attriute from oMore
	var oLinkMore = $("<div id='weitere_referenzen'><a href=''>" + oMore.attr('title') + "</a></div>");
	// hide list and display link
	oMore.addClass("hide").before(oLinkMore);
	// set click action
	$('a', oLinkMore).click(function(event){
		var oLinkMore = $(this).parent();
		var oMore = oLinkMore.next();
		// calculate speed according height (pixel per second)
		var vSpeed = parseInt(oMore.height() / oOption.speed * 1000);
		oLinkMore.remove();
		oMore.attr('title','').slideDown(vSpeed);
		event.preventDefault();
		return this;
	});
};

// jquery document.ready
$(function() {

	// copy first class item to ID

	$('#mainnavigation div.unser-angebot li.internet').attr("id","minternet");
	$('#mainnavigation div.unser-angebot li.mobile').attr("id","mmobile");
	$('#mainnavigation div.unser-angebot li.services').attr("id","mservices");
	$('#mainnavigation div.unser-angebot li.company').attr("id","mcompany");
	
	$("div.chapterbox").click(function() {
		v_url = $(this).find("a.internal").attr("href");
		window.location = v_url;
		return false;
	});

	// weitere referenzen
	if ($('#more_reference').length > 0) {
		$('#more_reference').szmore();
	}
	/* gallery generation if ul.reference-gallery-unstyled */
	$('.reference-gallery-unstyled').addClass('reference-gallery'); // adds new class name to maintain degradability
	$('ul.reference-gallery').galleria({
		// rs: don't turn history on, bad usability
		history   : false, // activates the history object for bookmarking, back-button etc.
		clickNext : true, // helper for making the image clickable
		insert    : '#reference-gallery-main', // the containing selector for our main image
		onImage   : function(image,caption,thumb) { // let's add some image effects for demonstration purposes
			
			// fade in the image & caption
			image.css('display','none').fadeIn(1000);
			caption.css('display','none').fadeIn(1000);
			
			// fetch the thumbnail container
			var _li = thumb.parents('li');
			
			// fade out inactive thumbnail
			_li.siblings().children('img.selected').fadeTo(500,0.3);
			
			// fade in active thumbnail
			thumb.fadeTo('fast',1).addClass('selected');
			
			// add a title for the clickable image
			image.attr('title','Next image >>');
		},
		onThumb : function(thumb) { // thumbnail effects goes here
			
			// fetch the thumbnail container
			var _li = thumb.parents('li');
			
			// if thumbnail is active, fade all the way.
			var _fadeTo = _li.is('.active') ? '1' : '0.3';
			
			// fade in the thumbnail when finnished loading
			thumb.css({display:'none',opacity:_fadeTo}).fadeIn(1500);
			
			// hover effects
			thumb.hover(
				function() { thumb.fadeTo('fast',1); },
				function() { _li.not('.active').children('img').fadeTo('fast',0.3); } // don't fade out if the parent is active
			)
		}
	});
	
	// iPad Menu portrait view
	
	
	$('h2.acc.menu').toggle(
		function() {
	  	$('#navAlpha').fadeIn();
	 		$('h2.acc.menu').css('opacity','.70');
	 		$('body #wrapper:not(#navAlpha *)').bind('click', function(){
 			$('h2.acc.menu').click();
 		});
		}, 
		function() {
			$('h2.acc.menu').css('opacity','1');
  		$('#navAlpha').fadeOut();
			$('body #wrapper:not(#navAlpha *)').unbind('click');
		});
	
});


