// jQuery konfilkt mit mootools

var $j = jQuery.noConflict();




// round bottom corners 
DD_roundies.addRule('.rounded_button', '0 0 7px 7px', true);
DD_roundies.addRule('.round_border_all', '7px 7px 7px 7px', true);




// sync height and add classes

$j(document).ready(function(){

	// history back wenn javascript
	$j('.news-single-backlink a').attr('href','javascript:history.back();');
	
	// blank target
	$j('a[href|=http://www.mayr-melnhof.com/karriere/menschen-bei-mm.html]').attr('target','_blank');
	$j('a[href|=http://www-dev.mm-karton.com/index.php?id=156]').attr('target','_blank');
	$j('a[href|=index.php?id=156]').attr('target','_blank');
	$j('a[href|=http://www.mayr-melnhof.com/en/career/people-at-mm.html]').attr('target','_blank');
	$j('a[href|=http://www-dev.mm-karton.com/index.php?id=156&L=1]').attr('target','_blank');
	$j('a[href|=index.php?id=156&L=1]').attr('target','_blank');
  
  // Add classes to different boxes if js is enabled
  $j('.news-latest-item > div:eq(0)').addClass("one_of_4");
  $j('.news-latest-item > div:eq(1)').addClass("two_of_4");
  // firefox bug - second box must be 1px higher
  $j('.news-latest-item > div:eq(1) .newsclearing').css("height","2px"); 
  $j('.news-latest-item > div:eq(2)').addClass("three_of_4");
  $j('.news-latest-item > div:eq(3)').addClass("four_of_4"); 
  
  $j('.textblock').syncHeight();
  $j(window).resize(function(){ 
    $j('.textblock').syncHeight();
  });    

  $j('.news-latest-item > div').syncHeight();
  $j(window).resize(function(){ 
    $j('.news-latest-item > div').syncHeight();
  }); 

  $j('.sameheight').syncHeight();
  $j(window).resize(function(){ 
    $j('.sameheight').syncHeight();
  });
  	
	// iphone weiche 
	if ((navigator.userAgent.indexOf('iPhone') != -1) || (navigator.userAgent.indexOf('iPod')!= -1) || (navigator.userAgent.indexOf('Android')!= -1)) {  
		$j('div.page_margins').css({
			'width' : '1024px', 
			'max-width' : 'auto', 
			'min-width' : '0'
		});	
	} else { 
		// jquery color von 91A1A6 auf 435f68
		$j(".NO").animate({ backgroundColor: "#B3C2C6" }, 1000);
		$j(".ACT-CUR").css('backgroundColor','#435f68');
		
		
		$j(".NO").hover(function() {
			// hover in
		
			if($j(this).is(':animated')) { 
				$j(this).stop().animate({ backgroundColor: "#435f68" }, 400);
			} else {
				$j(this).animate({ backgroundColor: "#435f68" }, 400);
			}


		}, function() {
			// hover out
			if($j(this).is(':animated')) { 
				$j(this).stop().animate({ backgroundColor: "#B3C2C6" }, 400);
			} else {
				$j(this).animate({ backgroundColor: "#B3C2C6" }, 400);
			}
		});
	} 

	$j(".jqtabsingle").css('display','none');
	$j(".jqtabcwrap").append('<div id="loadingtxt" style="position:absolute; top:20px; left:20px; font-family:Arial, Verdana;">...loading</div>');

});

//initialize after images are loaded 
$j(window).load(function(){  
	$j("#loadingtxt").remove();
	// jquery tool tabs
	$j("ul.jqtabsnav").tabs(".jqtabcwrap > div", {effect: 'fade', fadeOutSpeed: 400});
});

