var IsSafari = ( navigator.userAgent.indexOf( 'Safari' ) != -1 );

function fixTranscript(node) {
	if (isIE) {
		if (node.childNodes.length > 1) {
			for (var j = 0; j < (node.childNodes.length - 1); j++) {
				var firstNode = node.childNodes[j];
				var nextNode = node.childNodes[j + 1];
				if (firstNode.tagName == "FONT"
						&& firstNode.getAttribute("id")
						&& firstNode.getAttribute("id").indexOf("highlight") != -1
						&& nextNode.tagName == "FONT"
						&& nextNode.getAttribute("id")
						&& nextNode.getAttribute("id").indexOf("highlight") != -1) {
					node.insertBefore(document.createTextNode(" "), nextNode);
				}
			}
		}
	}
}

function noLineBreak(e,element)
{
    var keynum;
    var keychar;
    var numcheck;
    var retVal;

    if (window.event) // IE
    {
        keynum = e.keyCode;
    }
    else if (e.which) // Netscape/Firefox/Opera
    {
        keynum = e.which;
    }
    retVal = keynum != 13;

    if (!retVal && element){
        element.blur();
        while (element.tagName!='undefined' && element.tagName.toUpperCase() != "FORM"){
            element = element.parentNode;
        }
        if (element.tagName.toUpperCase() == "form"){
	        element.submit();
        }
    }

    return retVal;
}


if (IsSafari){
    document.nativeGetElementById = document.getElementById;
    document.getElementById = getElementByIdSafari;
}

 function getElementByIdSafari(id){
     if (Cacher.has(id)){
        var elem = Cacher.get(id);

        if (elem.parentNode == null){
            var buff = Cacher.getRecord(id);
            elem = searchGetElementById(id,buff.tagName);
            Cacher.set(id,elem);
        }
        return elem;
    } else {
        var elem = document.nativeGetElementById(id);
        Cacher.set(id,elem);
        return elem;
    }
}

Cacher = {
        cache: new Array(),
        exclude: new Array(),
        excludeCount: 0,
        get:  function(id){
            return this.cache[id].el;
        },
        set: function(id,value){
            if (this.shouldExclude(id)) return false;
            if (value==null || value =="undefined" || value==false) return;
            this.cache[id] = {
             el: value,
             tagName: value.tagName
            }
        },
        remove: function(id){
            this.cache[id] = false;
        }
        ,
        has: function(id){
            return (this.cache[id]!=null && this.cache[id]!="undefined" && this.cache[id]!=false);
        }
        ,
        getRecord: function(id){
            return this.cache[id];
        }
        ,
        addExclude: function(id){
            this.exclude[this.excludeCount] = id;
            this.excludeCount++;
        },

        shouldExclude: function(id){
            var retVal = false;
            for (var i = 0; i < this.exclude.length; i++){
                if (id.indexOf(this.exclude[i])!=-1){
                    retVal = true;
                    break;
                }
            }
            return retVal;
        }
}
Cacher.addExclude("highlight");