function pleaseWait(o) {
	//o.value = "please wait...";
	o.style.color = "#001127";
}



function intFilter(objV,ordermin) {

	var val = "";
	var len = objV.value.length;

	//Remove all non-numeric

    	for(i=0;i<len;i++) {
		charatA = objV.value.charAt(i);
		charat0 = objV.value.charCodeAt(i);
        	if(charat0 >= 48 && charat0 <= 57) { val=val+charatA; }
	}
	
	if(val.length>0) { objV.value=val; } else { objV.value=[ordermin]; }
}




var zoom;

function LoadProductImage(handle,showloadingimage) {
	
	var mainImageID = "myimage";
	var instructionsID = "ProductImageInstructions";
	var loadingImageSrc = "/_resources/benjaminmoore.dvemfg.com/images/ajax-loader.gif";
	var thumbWidth = 246;
	var thumbHeight = 241;
	var mainImageWidth = 246;
	var mainImageHeight = 241;
	var zoomImageWidth = 500;
	var zoomImageHeight = 500;	
	
	if(!handle.src) {
		handle = getElement(handle);
		LoadProductImage(handle, showloadingimage);
		return false;
	}

	var imgSrc;
	var magnifySrc;	
	imgSrc = handle.src;
	imgSrc = imgSrc.replace("width="+thumbWidth,"width="+mainImageWidth);
	imgSrc = imgSrc.replace("height="+thumbHeight,"height="+mainImageHeight);
	magnifySrc = imgSrc;
	magnifySrc = magnifySrc.replace("width="+mainImageWidth,"width="+zoomImageWidth);
	magnifySrc = magnifySrc.replace("height="+mainImageHeight,"height="+zoomImageHeight);
	
	if(zoom){zoom.parentNode.removeChild(zoom);}
	
	if(showloadingimage){
		// -- if used in IE before main image is done loading, we get the '1 item loading' bug --- //
		var parentHandle = getElement(mainImageID).parentNode;
		parentHandle.removeChild(getElement(mainImageID));
	
		var imageLoading = new Image();
		imageLoading.onload = function() {
			imageLoading.onload = null;
		}
		imageLoading.src = loadingImageSrc;
		imageLoading.id = mainImageID;
	
		parentHandle.appendChild(imageLoading);
		// --- end IE bug --- //
	}
	
	var zoomImage = new Image();
	zoomImage.onload = function() {
		zoomImage.onload = null;
		var image = new Image();
		
		image.onload = function() {
			
			image.onload = null;
			getElement(mainImageID).src = imgSrc;
			zoom = MojoMagnify.makeMagnifiable(getElement(mainImageID),magnifySrc);
			
			// move stuff out of the way...
			var imageWidth;
			var imageHeight;
			var instructionsHeight;
			imageWidth = getElement(mainImageID).offsetWidth;
			imageHeight = getElement(mainImageID).offsetHeight;
			instructionsHeight = getElement(instructionsID).offsetHeight;
			if(imageWidth > 0){				
				//getElement("ProductDetailLeft").style.width = imageWidth + "px";
			}	
			if(imageHeight > 0){	
				//getElement("ProductMultipleImages").style.top = (imageHeight + instructionsHeight) + "px";
				//getElement("ProductMultipleImages").style.display = "block";
			}
			
		};
		image.src = imgSrc;
		
	};
	zoomImage.src = magnifySrc;		
}

function getElement(name) {
	var o1 = null;
	if(document.all) {
		o1 = document.all(name);
	}
	else if(document.getElementById) {
		o1 = document.getElementById(name);
	}
	return o1;
}