trys = 2;
a_Images = new Array();
a_Trys = new Array();
shim = 'http://images.palmgear.com/skins/cohiba/shim.gif';

function errorHandler(){
	var thiselement = window.event.srcElement;
	var tryagain = true;
	for(i=0;i < a_Images.length ; i++){
		if(a_Images[i] == thiselement.src){
			if(a_Trys[i] == trys){
				tryagain = false;
			}
			break;
		}
	}
	
	if(tryagain){
		if(i < a_Images.length){
			a_Trys[i]++;
			//alert('Second Try');
		}else{
			a_Images[i] = thiselement.src;
			a_Trys[i] = 1;
			//alert('Broken Link: '+ tempsrc + '  total: ' + String(a_Images.length));
		}
		var tempsrc = thiselement.src;
		thiselement.src = shim;
		thiselement.src = tempsrc;
		
	}
}

for(i=0; i < document.images.length; i++){
	document.images[i].onerror = errorHandler;
}