/* js for package: std-layout */

/*if(navigator.userAgent.indexOf('MSIE 6.0') == -1) {*/

Cufon.replace("#main-menu a.cufon-replace", { fontFamily: 'Akkurat Pro', hover: true});
Cufon.replace("h1[class!='noreplace']", { fontFamily: 'Akkurat Pro', hover: true});
Cufon.replace("h2[class!='noreplace']", { fontFamily: 'Akkurat Pro', hover: true});
Cufon.replace(".startseiten-link .title", { fontFamily: 'Akkurat Pro', hover: true});

	
/*===========================================================================================*/
/*       PEOJECT DETAIL SEITE                */
/*===========================================================================================*/

function reformat() {
	$(".reformat").each(function(){
		
		//$(".bottom-text-content").find("*").first().appendTo(".top-text");
		//$(".bottom-text-content").find("*").first().remove();
		$(".bottom-text-content").find("*").first().appendTo(".top-text");
		$(".bottom-text-content").find("*").first().remove();
				
		var arr = new Array();
		$(".content-main:eq(1) .content-box").each(function(){
			arr.push($(this).height());
		});
		arr.sort();
		sheight = arr.pop();
		$(".content-main:eq(1) .spalte1 .content-box-content").css("height", sheight - 20 + "px");
		$(".content-main:eq(1) .spalte2 .content-box-content").css("height", sheight + "px");
	});
}

/*===========================================================================================*/
/*       DOCUMENT READY               */
/*===========================================================================================*/

$(document).ready(function() {

	/*===========================================================================================*/
	/*       SLIDER MENU                */
	/*===========================================================================================*/
	
	
	//$('#c_menu_master').sliderMenu({animation: {effect: 'slide', settings: {direction: "up"}}});
	$('#c_menu_master').sliderMenu();


	/*===========================================================================================*/
	/*       links in der rechten spalte                 */
	/*===========================================================================================*/

	$(".spalte2 a.avtext").each(function(){
		$(this).addClass("website");
			
	}); 
	
	$('.spalte2 a.avtext[href*="mailto"]').each(function(){
		$(this).addClass("email");
			
	}); 

	

	/*===========================================================================================*/
	/*       FILTER BOX                 */
	/*===========================================================================================*/

	$(".filter-box").each(function(){
		$(".notset .filter-options").hide();
		

		$(".notset .filter-name").toggle(
                   function()
                   {
			$(this).removeClass('closed');
                	$(this).addClass('open');
		        $(this).next().slideDown();    
                   },
                   function()
                   {
			$(this).removeClass('open');
                	$(this).addClass('closed');
                       	$(this).next().slideUp();                  
		});		
		
		/*
		$(this).accordion({
			collapsible: true,
			active: false,
			fillSpace: false,
			autoHeight: false
		});
		*/


		
	}); 
	
	/*===========================================================================================*/
	/*       FILTER BOX ERWEITERUNG                 */
	/*===========================================================================================*/
  
    	$("a.filter-remove").each(function(){
			
		$(this).click(function() {
  			//$(this).parent().find("li").css("display","block");
			$(this).parent().find(".filter-name").removeClass('closed');
                	$(this).parent().find(".filter-name").addClass('open');

			$(this).parent().find("li").slideDown();
			
			$(this).hide();
		});
	});


	/*===========================================================================================*/
	/*       NORMALE BILD POPUPS                */
	/*===========================================================================================*/

	$(".alignable-content-image a.fancybox").each(function(){
		var info = "" + $(this).attr('title');
		var highres = '';
		
		$(this).fancybox({				
			'titleShow'		: true,
			'overlayOpacity'	: 0.6,
			'titlePosition' 	: 'inside',			
			'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
							//return '<span id="fancybox-title-overx">'+ currentIndex + ':::'+  info + '</span>';
							return '<span class="fancybox-numbers">' + (currentIndex + 1) + ' / ' + currentArray.length + '</span><span id="fancybox-title-overx">'+ info +'</span>'+highres+'<div style="clear: both;"></div>';
							}	
	
		}); 
	}); 
	
	/*===========================================================================================*/
	/*       GALLERY POPUPS                 */
	/*===========================================================================================*/

	
	$(".gallery a.fancybox").each(function(){
		//alert("hallo");
		var info = "" + $(this).attr('info');
		var highres = '';
		
		//var highres = '<div style="clear: both;"></div><a class="highres-download" href="http://www.google.com">DOWNLOAD</a>'
		
		if($(this).next('.highres-download-info').html()){
			var highres = $(this).next('.highres-download-info').html();	
		}
		
		
		$(this).fancybox({				
			'titleShow'		: true,
			'overlayOpacity'	: 0.6,
			'titlePosition' 	: 'inside',			
			'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
							//return '<span id="fancybox-title-overx">'+ currentIndex + ':::'+  info + '</span>';
							return '<span class="fancybox-numbers">' + (currentIndex + 1) + ' / ' + currentArray.length + '</span><span id="fancybox-title-overx">'+ info +'</span>'+highres+'<div style="clear: both;"></div>';
							}	
	
		}); 
	}); 
	


	/*===========================================================================================*/
	/*       ACCORDION                */
	/*===========================================================================================*/

	/*	
	var icons = {
			header: "yellow-zu",
			headerSelected: "yellow-offen"
	};
	$( ".accordion" ).accordion({
		icons: icons,
		collapsible: true,
		active: false,
		fillSpace: false,
		autoHeight: false
	});
	*/

	$('.accordion h3').each(function() {
		$(this).next().slideToggle(0);
		$(this).click(function() {
			$(this).next().slideToggle('fast');
			$(this).toggleClass("active");

		});

		
	});
	
	//$("#logo img").dropShadow({left: 2, top: 2, blur: 1, color: "#03f", opacity: 0.8});
	
  
});


/*===========================================================================================*/
/*       HINTERGRUND EINBLEDEN                */
/*===========================================================================================*/

function toggle_body(){
	//$("#bg_switch").click(function(){
		$("body").toggleClass("bg_body");
	//});
}
