jQuery.noConflict();
jQuery(document).ready(function() {
	$imgcaption = jQuery('p.news-single-imgcaption');
	$newsSingleImgWidth = jQuery('.news-single-img');
	$imgcaptionWidth = jQuery('.news-single-img a img').attr('width');
	$imgcaptionHeight = jQuery('.news-single-img a img').attr('height');
	
	$atag = jQuery('.news-single-img-item');
	$rel = jQuery('.news-single-img a');
	$imageLupe = '<img src="fileadmin/template/images/bg_lightbox_lupe_1.png" />';
	
	$linkrel = $rel.attr('rel');
	$link = $atag.attr('href');				
	
	$imgcaption.show();
	//$newsSingleImgWidth.css('width',$imgcaptionWidth);
	//jQuery('.news_media').css('width',$imgcaptionWidth);
	
	var news_container = jQuery('.news-single-img');
	var tmpMaxWidth = 0;
	news_container.children('.news-single-img-item').each(function(){
		var element = jQuery(this);
		width = element.find('img').attr('width');			
		
		if(tmpMaxWidth < width){
			tmpMaxWidth = width;
		}
		
		jQuery('.news-single-img').css('width', tmpMaxWidth);
		jQuery('.news-single-img').css('margin', '0px 0px 0px 10px');		
		jQuery(this).css('width', width);
		jQuery(this).css('float', 'right');
		
	});	
	

	jQuery.each($atag.children('a'), function(index, value){
		
	  var href = jQuery(this).attr('href');
	  
	  $res = '<span><a rel="' + $linkrel + '" href="' + href + '" class="lupe">' + $imageLupe +'</a></span>';
	  
	  jQuery($res).appendTo(jQuery(this).parent());  
	  
	  $img = jQuery(this).html();
	  jQuery($img).prependTo(jQuery(this).parent()); 
	});
	
	jQuery($atag).children('a').remove();
	
});
