window.onload = function(){

	submitButtonReplacement.initialize('replacesubmit');

}

var submitButtonReplacement = {
	initialize: function (classname) {
		this.classname = classname;
		this.allButtons = document.getElementsByTagName('input');
		this.replaceButtons();
	},
	replaceButtons : function(){
		if(this.allButtons){
			var inputCounter = this.allButtons.length;
			for(i = 0; i < inputCounter; i++){
				if( this.allButtons[i].className == this.classname ){
					this.allButtons[i].style.display = "none";
					var theAnchor = document.createElement("a");
					var theEm = document.createElement("em");
					var theText = document.createTextNode(this.allButtons[i].value);
					theAnchor.appendChild(theEm);
					theAnchor.appendChild(theText);
					theAnchor.setAttribute('href', '#');
					theAnchor.className = this.classname;
					var insertedElement = this.allButtons[i].parentNode.insertBefore(theAnchor, this.allButtons[i]);
					insertedElement.onclick = function(){
						this.nextSibling.click();
					}
				}
			}
		}
	}
}