$(document).ready( function() {

	/*===========================
	*
	* Date Created: 09/10/2010
	* Last Update: 09/10/2010
	* Source: -
	* Description: -
	*
	*===========================*/
		
	$("p:last-child").addClass('last-child');

	if ($(".contactforms").length) {
	  	$(".contactforms").change(function(){
				var value = $('option:selected', this).val();
				if ( value != '' ) {
					window.location.href = value;
				}
	  	})
  	}
	
	/*===========================
	*
	* Pluginname: Accordion
	* Date Created: 30/09/2010
	* Last Update: 30/09/2010
	* Source: http://docs.jquery.com/UI/Accordion
	* Description: -
	*
	*===========================*/
		
	if ( $(".accordion").length ) {	
		$(".accordion").accordion({
			header:'.acc',
			autoHeight: false
		});
	}
	
	// DE
	if ($("body.page-47 .accordion").length) {$("body.page-47 .accordion").accordion({header:'.acc',autoHeight: false,collapsible: true,active: false});}	
	if ($("body.page-48 .accordion").length) {$("body.page-48 .accordion").accordion({header:'.acc',autoHeight: false,collapsible: true,active: false});}	
	if ($("body.page-49 .accordion").length) {$("body.page-49 .accordion").accordion({header:'.acc',autoHeight: false,collapsible: true,active: false});}	
	if ($("body.page-50 .accordion").length) {$("body.page-50 .accordion").accordion({header:'.acc',autoHeight: false,collapsible: true,active: false});}
	// EN	
	if ($("body.page-51 .accordion").length) {$("body.page-51 .accordion").accordion({header:'.acc',autoHeight: false,collapsible: true,active: false});}	
	if ($("body.page-52 .accordion").length) {$("body.page-52 .accordion").accordion({header:'.acc',autoHeight: false,collapsible: true,active: false});}	
	if ($("body.page-53 .accordion").length) {$("body.page-53 .accordion").accordion({header:'.acc',autoHeight: false,collapsible: true,active: false});}	
	if ($("body.page-54 .accordion").length) {$("body.page-54 .accordion").accordion({header:'.acc',autoHeight: false,collapsible: true,active: false});}	
	
	// Unternehmen
	if ( $("body.page-16 .sidebar-right .sb .mid").length ) {
		var jO = $("body.page-16 .sidebar-right .sb .mid");
		var Image = $('img', jO);	
		$('.ui-accordion-header').click(function() {
			var strImgPath = $('a.dn', this).attr("rel");	
			$(Image).fadeOut("slow", function() {
				$(this).attr({ src: strImgPath }).fadeIn("slow");
			});
			return false;
		});
	}
	
	// Companies
	if ( $("body.page-37 .sidebar-right .sb .mid").length ) {
		var jO = $("body.page-37 .sidebar-right .sb .mid");
		var Image = $('img', jO);	
		$('.ui-accordion-header').click(function() {
			var strImgPath = $('a.dn', this).attr("rel");	
			$(Image).fadeOut("slow", function() {
				$(this).attr({ src: strImgPath }).fadeIn("slow");
			});
			return false;
		});
	}	
	
	
	/*===========================
	*
	* Pluginname: bgStrechter
	* Date Created: 29/09/2010
	* Last Update: 29/09/2010
	* Source: http://www.ajaxblender.com/bgstretcher-jquery-stretch-background-plugin.html
	* Description: -
	*
	*===========================*/	
	
	$(document).bgStretcher({
		images: ['/fileadmin/templates/images/bg/background.jpg'],
		imageWidth: 1650, imageHeight: 1050
	});	
	
	/*===========================
	*
	* Pluginname: Fancybox - Fancy lightbox alternative
	* Date Created: 21/10/2010
	* Last Update: 21/10/2010
	* Source: http://fancybox.net/
	* Description: lightbox
	*
	*===========================*/
	
	if ($('a[rel="fancybox"]').length) {
	  	$('a[rel="fancybox"]').fancybox({
	  		overlayOpacity: '0.7',
	  		overlayColor: '#000'
	  	});
  	}

});
