function doHover(linkElement, overStateSrc) {

	if(document.getElementById(linkElement)) {	
			var linkImage = document.getElementById(linkElement);	
			
			//Make sure we've got an appropriate element here (allowing for input type=image)
			if(linkImage.tagName == 'img' || linkImage.tagName == 'IMG' || linkImage.tagName == 'input' || linkImage.tagName == 'INPUT') {
				
				//Create new image for over state: this will cache the image
				var overImg = new Image;
				overImg.src = overStateSrc;
				
				//We need to keep hold of the original SRC for switching back onmouseout:
				var normalSrc = linkImage.src;
				linkImage.onmouseover = function() {
					this.src = overImg.src;
				}
				linkImage.onmouseout = function() {
					this.src= normalSrc;
				}
				
			}
		}

}

function doTextBox(element, text) {
	if(document.getElementById(element)) {

		var textBox = document.getElementById(element);
		textBox.onfocus = function() {
			if(this.value == text) this.value = '';
		}	

	}
}

function doTextArea(element, text) {
	if(document.getElementById(element)) {

		var textBox = document.getElementById(element);
		textBox.onfocus = function() {
			if(this.value == text) this.innerHTML = '';
		}	

	}
}

function doClearForm(link, form) {
	
	if(document.getElementById(link) && document.getElementById(form)) {
		var thisForm = document.getElementById(form);
		var thisLink = document.getElementById(link);

		thisLink.onclick = function() {
			thisForm.reset();
			return false;
		}
	}
}

window.onload = function() {
		doHover('sendbtn', './images/btn-send-hov.png');		
}
