﻿//fix for erroneous %2f "/"
if(location.href.indexOf("%2f")>-1)
{
location.href = location.href.replace(/\%2f/g,"/");
//alert(location.href);
}
//fix for defaultbutton under firefox
function clickButton(e,buttonid) {
    //debugger;
    var bt = document.getElementById(buttonid);
    if (typeof(bt) == 'object') {
        if (navigator.appName.indexOf("Netscape") > -1) {
            if(e.keyCode == 13) {
                //if (bt && typeof(bt.click) == 'undefined') {
                    bt.click =  addClickFunction1(bt);
                //}
            }
        }
        if (navigator.appName.indexOf("Microsoft Internet Explorer") > -1) {
            if (event.keyCode == 13) {
                bt.click();
                return false;
            }
        }
    }
}

function addClickFunction1(bt) {
    //debugger;
    var result = true;
    if (bt.onclick) result = bt.onclick();
    if (typeof(result) == 'undefined' || result) {
        eval(bt.href);
    }
}

//this fixes issues when run locally
//if(document.location.href.indexOf('localhost')==-1 && document.location.href.indexOf('ballard-dev')==-1)
//    document.domain="checkmd.com";


if ( top != self  && top.location.href.indexOf('communities.checkmd.com')==-1)
{
    //top.location.href = unescape(window.location.pathname);
}

//this fixes the click() problem in firefox
function fixclickfirefox()
{
    if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent))
    {
        HTMLElement.prototype.click = function() {
        var evt = this.ownerDocument.createEvent('MouseEvents');
        evt.initMouseEvent('click', true, true, this.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
        this.dispatchEvent(evt);
        }
    }
}
fixclickfirefox();