jQuery(document).ready(function(){
if(jQuery('#content.page').length==0)
{
//fixThumbs();
}
else if(jQuery('#content.page').length==1)
{
//fixPage();
}


function fixPage() { 

if (jQuery('.post p img').length>0)
{
var postImages = jQuery('.post p img');
postImages.each(function() {

	if((typeof this.naturalWidth != "undefined" &&this.naturalWidth == 0 )|| this.readyState == 'uninitialized' ) {

	jQuery(this).attr('src', '/design/no-image.jpg'); 
	}
});
}

if (jQuery('#ngg-gallery img').length>0)
{

var allImages = jQuery('#ngg-gallery img');
jQuery.each(allImages,function () { 

	jQuery(this).error(function () {
	//alert('error');
	jQuery(this).hide();//attr('src', 'design/no-thumb.jpg'); 
	
	});


});

}


}
jQuery ('#ngg-gallery').change(function() {

if (jQuery('#ngg-gallery img').length>0) {
	jQuery('#ngg-gallery img').each(function() {

		if((typeof this.naturalWidth != "undefined" &&this.naturalWidth == 0 )|| this.readyState == 'uninitialized' ) {

			jQuery(this).hide();
			//attr('src', 'missing.jpg');

		}

	});
	}
	});
	jQuery('#tab_gallery').click(function(){
	fixImage();
	});


/* -------------tabs------------ */
		
		jQuery(".tab_content").hide(); //Hide all content
	jQuery("ul.tabs li:first").addClass("active").show(); //Activate first tab
	jQuery(".tab_content:first").show(); //Show first tab content

	//On Click Event
	jQuery("ul.tabs li").click(function() {

		jQuery("ul.tabs li").removeClass("active"); //Remove any "active" class
		jQuery(this).addClass("active"); //Add "active" class to selected tab
		jQuery(".tab_content").hide(); //Hide all tab content

		var activeTab = jQuery(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		jQuery(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});
		
/* -------------tabs------------ */
 });
 function fixThumbs() {

var allImages = jQuery('#contentin .post img');
allImages.each(function () { 

	if((typeof this.naturalWidth != "undefined" &&this.naturalWidth == 0 )|| this.readyState == 'uninitialized' ) {
	
	jQuery(this).attr('src', '/design/no-thumb.jpg'); 
	
	}



});
if (jQuery('.ngg-gallery-thumbnail-box').length>0)
{
	var gallImages = jQuery('.ngg-galleryoverview img');
	gallImages.each(function() {

		if((typeof this.naturalWidth != "undefined" &&this.naturalWidth == 0 )|| this.readyState == 'uninitialized' ) {

		jQuery(this).attr('src', '/design/no-thumb.jpg').hide('fast');
		}
	});
}
}
function fixImage() {
if (jQuery('#ngg-gallery img').length>0) 
{
	jQuery('#ngg-gallery img').each(function() {

		if((typeof this.naturalWidth != "undefined" &&this.naturalWidth == 0 )|| this.readyState == 'uninitialized' ) {

			jQuery(this).hide();
		
		}

	});
	}
	}
	
jQuery(window).bind('load', function() {

if(jQuery('#content.page').length==0)
{
fixThumbs();
}
		fixImage();
	

})

 
