jQuery(document).ready(function(){
	jQuery("#imagetest").attr("src","img/1x1.gif?"+Math.random());	
});

/* If images are disabled*/
function checkImages(){
		 if (!IsImageOk(document.getElementById("imagetest"))){
			jQuery("#topmenu a").addClass("removebgimg");
			jQuery("#imagelinks a").html("Save $2.00 on any Midol product 20ct. or larger. Download coupon here");
			jQuery(".toplogo a").html("Midol");
			jQuery(".mhome").html("Home");
			jQuery(".mproducts").html("Products");
			jQuery(".mliving").html("Living With Your Period");
			jQuery(".mfaqs").html("FAQS");
			
			jQuery(".leftmenu .submenu a b").addClass("display_item");
			
			jQuery(".leftmenu .submenu, .leftmenu .submenu a").addClass("removebgimg");
			jQuery(".leftmenu .submenu a.active").removeClass("active");
			
			jQuery(".hidealttext").removeClass("hidealttext");
			
			jQuery(".content ul li").addClass("show_bullet");
			
			jQuery('.product_icon_holder img').each(function(){
				if(window.devicePixelRatio){
					var altText = jQuery(this).attr("alt");
					jQuery(this).replaceWith("<span class='more_space'>"+altText+"</span>");
				}
				jQuery(this).addClass("more_space");
			});
			
			jQuery('.title img').each(function(){
					var altText = jQuery(this).attr("alt");
					jQuery(this).replaceWith("<span>"+altText+"</span>");
				});
			
			if(window.devicePixelRatio){
				jQuery('.buylogo, .webkit_alt').each(function(){
					var altText = jQuery(this).attr("alt");
					jQuery(this).replaceWith("<span>"+altText+"</span>");
				});
		 	}
		 }
}

function IsImageOk(img) {
    if (!img.complete) {
        return false;
    }


    //These give the true size of the image. If it failed
    // to load, either of these should be zero.
    if (typeof img.naturalWidth != "undefined" && img.naturalWidth == 0) {
        return false;
    }

    // No other way of checking: assume it's ok.
    return true;
}

jQuery(window).load(function(){
	checkImages();
});

