/* Thanks to Scott Andrew */
function addEvent(obj, evType, fn){
     if (obj.addEventListener) {
         obj.addEventListener(evType, fn, true);
         return true;
     } else if (obj.attachEvent) {
         var r = obj.attachEvent("on"+evType, fn);
         return r;
     } else {
	    return false;
     }
}

/* http://adactio.com/articles/1112/*/

function clearInputs() {
 if (!document.getElementsByTagName) return false;
 var all_inputs = document.getElementsByTagName('input','textarea');
 for (var i=0;i<all_inputs.length;i++) {
  var current_input = all_inputs[i];
  if ((current_input.getAttribute('type') == 'text' || current_input.getAttribute('type') == 'textarea') && current_input.getAttribute('value') != '') {
   current_input.default_text = current_input.getAttribute('value');
   current_input.onfocus = function() {
    if (this.getAttribute('value') == this.default_text) {
     this.setAttribute('value','');
    };
   }
  }
 }
}


  function init() {
		if(document.getElementById('message')){  
	        var formField = document.getElementById('message');
	        addEvent(formField, 'focus', formfocus1, false);
		}
		if(document.getElementById('source')){
	        var formField = document.getElementById('source');
	        addEvent(formField, 'focus', formfocus2, false);	
		}		
      }

  function formfocus1() {	
        var formField = document.getElementById('message');
		formField.value = ""; 
	}
  function formfocus2() {	
        var formField = document.getElementById('source');
		formField.value = ""; 		
	}



addEvent(window, 'load', clearInputs, false);
addEvent(window, 'load', init, false);

