function addLoadEvent(func) { // This function allows you to dynamically add Javascript functions to the onload event
   	var oldonload = window.onload;
   	if (typeof window.onload != 'function') {
       	window.onload = func;
   	} else {
       	window.onload = function() {
           	if (oldonload) {
           		oldonload();
           	}
           	func();
       	}
   	}
}

function initForm() {
	if (document.getElementById("sendemail")) { // Check form is there
		var cForm = document.getElementById("sendemail");
	} else {
		return false; // Otherwise, exit script
	}
	var inputs = cForm.elements; // Collect all elements in the form
	
	for(var i=0; i<inputs.length; i++) { // Loops through each element in the form
		var input = inputs[i];
		if (input.name != 'security_code' && input.type != 'submit') { // Check input is not captcha or submit button:
			
			if (input.value < 1) { // If input is empty:
				input.value = 'Your '+input.name.substr(0, 1).toUpperCase() + input.name.substr(1); 
			}
				
			input.onfocus = function() { // Set onfocus function to delete value
				if (this.value == 'Your '+this.name.substr(0, 1).toUpperCase() + this.name.substr(1)) {
					this.value = '';
				}
			}
			input.onblur = function() { // Set onblur function to restore value if empty 
				if (this.value < 1) {
					this.value = 'Your '+this.name.substr(0, 1).toUpperCase() + this.name.substr(1);
				}
			}
		}
	}
}
addLoadEvent(initForm); // Add the function to the onload event (see top)