// ----------------------------------------------------- //
//                                                       //
//             IMAGE REPLACEMENT HELPER v0.2             //
//                                                       //
//     (C) 2009 Mark O'Neill - designedby@iikon.co.uk    //
//                                                       //
//  Free for use. To use, simply link to this js file in //
//  your code. This will bring back the text of a h1 or  //
//  h2 element if images are turned off.                 //
//                                                       //
//  IMPORTANT: If there is another window.onload event   //
//  in your document, remove the window.onload function  //
//  from here and place the checkComplete(imgJSCheck)       //
//  function into the common window.onload event.        //
//                                                       //
//  NOTE: By default the image check tries to load the   //
//  Google logo. This should be replaced by a known      //
//  image that resides on your site just in case Google  //
//  removes that particular image. You never know. :)    //
//                                                       //
// ----------------------------------------------------- //

//window.onload = function(){
//	checkComplete(imgTemp);
//}

//setup the image to be loaded...
var imgJSCheck = new Image();
imgJSCheck.src = '../images/page/top.jpg';





function checkComplete(img) {
	if (img.complete) {
		imageLoaded(img);
	}else{
		if (img.width == 0){
			checkComplete(img);
		}else{
			imageLoaded(img,true);
		}
	}
}

function imageLoaded(img,isIE) {
	if (img.width == 0 || isIE) {
		resetHeadings("h1");
		resetHeadings("h2");
		resetHeadings("a");
	}
}

function resetHeadings(element){
	if (!document.getElementsByTagName) return false;
	var items = document.getElementsByTagName(element);
	
	for(var i=0; i < items.length; i++) {
		items[i].style.textIndent = '0px';
		items[i].style.height = 'auto';
		items[i].style.width = 'auto';
		items[i].style.fontSize = '12px';
	}
}