﻿function doCorrectClickOnEnter(buttonName, e) {
    if (window.event)
        key = window.event.keyCode;     //IE
    else
        key = e.which;     //firefox

       if (key == 13) {
       	
        //Get the button the user wants to have clicked
        var btn = $(buttonName);
        if (btn != null) { //If we find the button click it
        	if (btn.click)
        		btn.click();
        	else
        		location = btn.href; //could be a link button, find the a tag

        	try {
        		if (window.event) {
        			window.event.keyCode = 0;
        		} else {
        			e.keyCode = 0;
        		}
        	}
        	catch (e) { }
        }
    }
}

