

this.formfield = function(){
	
	// CONFIG 
	
	// this is id of the  field you want to add this script to. 
	var ids = new Array(2);
	var defaultText  = new Array(2);
	
	ids[0] =  "posName";
	ids[1] =  "posEmail";

	
	// Text you want to set as a default value of your field.
	defaultText[0] =  "name";
	defaultText[1] =  "e-mail";


	// END CONFIG 

	for (i=0;i<2;i++){
		
	var field = document.getElementById(ids[i]);	
	var classInactive = "field_inactive";
	var classActive = "field_active";
	var classText = "field_text";
	
	
	this.safari = ((parseInt(navigator.productSub)>=20020000)&&(navigator.vendor.indexOf("Apple Computer")!=-1));
	if(field && !safari){
		field.value = defaultText[i];
		
		field.c = field.className;		
		field.className = field.c + " " + classInactive;
		field.onfocus = function(){
			for (i=0;i<2;i++){
				this.className = this.c + " "  + classActive;
				this.value = (this.value == "" || this.value == defaultText[i]) ?  "" : this.value;
			}
		};
		field.onblur = function(){
			
			for (i=0;i<2;i++){
				this.className = (this.value != "" && this.value != defaultText[i]) ? this.c + " " +  classText : this.c + " " +  classInactive;}
				
				if (this.id == "posName"){
				this.value = (this.value != "" && this.value != defaultText[0]) ?  this.value : defaultText[0];
				}
				if (this.id == "posEmail"){
				this.value = (this.value != "" && this.value != defaultText[1]) ?  this.value : defaultText[1];
				}
			
		};
		
	};
	
	
	
	
};
}
// script initiates on page load. 

this.addEvent = function(obj,type,fn){
	if(obj.attachEvent){
		obj['e'+type+fn] = fn;
		obj[type+fn] = function(){obj['e'+type+fn](window.event );}
		obj.attachEvent('on'+type, obj[type+fn]);
	} else {
		obj.addEventListener(type,fn,false);
	};
};
addEvent(window,"load",formfield);

