// JavaScript Document
(function($){
//						$("#loader").click(function(){
//									
//									$("#cont").Loader();
//													
//													
//													});
						$.fn.Loader = function(){
							///---- 
						///---- GET DIMENSIONS FOR BG CSS ALIGNMENT
							///---- 
						var parHeight = $(this).height();
						var parWidth = $(this).width();
						if(parHeight == 0){
							var gifTop = 0;}
						else {
								var gifTop = $(this).height() - 24/2;
							};
						if(parWidth == 0){
							var gifBottom = 0;}
						else {
							var gifBottom = $(this).height() - 24/2;
							};
							
							///---- 
						///---- PREPEND LOADER DIV(s)
							///---- 
							
						$(this).parent().prepend('<div class="ldr"><div class="ldrBg"></div><div class="ldrImg"></div></div>');
						$(".ldr",$(this).parent()).css({'opacity':'0.8'});
						
						$(".ldr",$(this).parent()).css({'height': parHeight,'width': parWidth,'z-index':'99'});
						
						$(".ldrBg",$(this).parent()).css({'opacity':'0.4','height': parHeight,'width': parWidth});
						
						$(".ldrImg",$(this).parent()).css({'height': parHeight,'width': parWidth});
						
						
						//var contents = $(this).contents();/**/
						//$(this).one("load",function(){
						$(this).one("load",function(){
//do something
						$(".ldr",$(this).parent()).fadeOut(400, function(){
						$(".ldr",$(this).parent()).remove();
						
						});
										})
						.each(function(){
						if(this.complete)$(this).trigger("load", function(){
																	   
						//	$(".ldr",$(this).parent()).fadeOut(400, function(){
						//$(".ldr",$(this).parent()).remove();	});									   
																	   });
						});
						/*$(this).load(function(){
						if(this.ready)				   
						$(".ldr",$(this).parent()).fadeOut(400, function(){
						$(".ldr",$(this).parent()).remove();		 
						}).each(function(){
							if(this.complete)
							$(this).trigger("load");
							
							
							});  
											   
											   
											   });*/
							///---- 
						///---- execute first time load and follow with function
							///---- 
						
						//$(this).one('load', function(){
//						
//						//if(this.complete){
//						//alert('Height:' + parHeight + ', Width:' + parWidth);
//						$(".ldr",$(this)).fadeOut(400, function(){
//						$(".ldr",$(this)).remove();
//						//$(this).fadeIn(600);
//						//$(this).css({'z-index': '0'});
//																
//																	 });
//														// }
//														 })
//							///---- 
//						///---- if statement for $(this)
//						///---- so if $(this) content has already been 
//						///----loaded from prior visit,
//						///----  reload it at trigger function.
//							///---- 
//							.each(function(){
//								  
//							if(this.complete){
//							$(this).trigger('load');}
//								  
//						$(".ldr",$(this)).fadeOut(400, function(){
//						$(".ldr",$(this)).remove();
//						//$(this).fadeIn(600);
//						//$(this).css({'z-index': '0'});
//																
//																	 });
//								  });
//							
//							
/*		$("#th").Loader(function(){ 
		$("#th").click(function(){
		$("#pic1").fadeOut(0, function(){
		$("#pic1").replaceWith('<img src="" name="pic1" width="815" height="530" id="pic1">', function(){ $("#pic1").Loader();
																															});
		
		
		
		$("#assc span.asc").remove();
		$("#assc").append('<span class="asc"><a href="youth_profile.php?unique="></a><br></span>');
	});	
});});*/
};
						   
						   
						   
						   
						   
						   
						   })(jQuery);
