/**
 * @author	Maik Peuser
 * @path	/fileadmin/templates/scripts/js/jquery/application_overlay.js
 * @content	Transparent Overlays for elements
 */
 
/**********************************************************************/

$j(function() {
	$j('div.opener-box').each(function(){
		if($j(this).find('div.csc-textpic-text').text().length > 0){
			$j(this).find('div.csc-textpic-text').hide();
			var container = $j('<span class="overlay-opener"></span>');
			var width = $j(this).find('img:next').attr('width');
			var height = $j(this).find('img:next').attr('height');
			container.css('width',width);
			container.css('height',height);		
			$j(this).find('div.csc-textpic-imagewrap').prepend(container);
		}
	});
	
	$j('div.opener-box').bind('mouseenter',function(ev){
		if($j(this).find('div.csc-textpic-text').text().length > 0){
			if(this.busyIn!=true){
			    this.busyIn = true;
				var el = this;
				$j(this).find('span.overlay-opener,div.csc-textpic-text').fadeIn(function(){
					
					el.busyIn = false;
				});				
			}
		}
	});
	
	$j('div.opener-box').bind('mouseleave',function(ev){
		if($j(this).find('div.csc-textpic-text').text().length > 0){
			$j(this).find('div.csc-textpic-text,span.overlay-opener').fadeOut();
		}
	});
});
