Amara = {};
Amara.snazzyFormClick = function (el) {
	var originalValue = el.value;
	Event.observe(el, 'focus', function () {
		if (el.value == originalValue) {
			el.value = '';
		}
	});
	
	Event.observe(el, 'blur', function () {
		if (el.value == '') {
			el.value = originalValue;
		}
	});
}

Amara.imagePreload = function (src, onComplete) {
	// load in the new image
	var newImage 	= null;
	newImage 		= new Image();
	newImage.src 	= src;
	
	if (newImage.complete) {
		onComplete();
	} else {
		// image not in cache
		Event.observe(newImage, 'load', onComplete);
	}
}

Amara.onDomReady = function (observer) {
	// todo... proper domready from prototype
	Event.observe(window, 'load', observer);
}


Amara.ieHoverFix = function (id) {
	sfHover = function() {
		var sfEls = document.getElementById(id).getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" iehover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" iehover\\b"), "");
			}
		}
	}
	
	if (window.attachEvent) window.attachEvent("onload", sfHover);
}

