function overlayGAdget() {


    function __apk() {

        if(window.appointyHeight === undefined)
            appointyHeight = '700';
        if(window.appointyWidth === undefined)
            appointyWidth = '900';
        
        if(window.ShowSchedulemeImg === undefined)
            ShowSchedulemeImg = true; 
        //if showSchedulemeImg is set to false then it will override the properties below. This can be used if you want to call overlay from your own custom link.
        if(window.ScheduleMeBgImg === undefined)
            ScheduleMeBgImg = 'http://static.appointy.com/Widget/Images/schedule-an-appointment.png';
        if(window.ScheduleMeBg === undefined)
            ScheduleMeBg = '#000000';       
        if(window.ScheduleMeWidth === undefined)
            ScheduleMeWidth = '50';
        if(window.ScheduleMeHeight === undefined)
            ScheduleMeHeight = '350';
        if(window.ScheduleMePosition === undefined)
            ScheduleMePosition = 'right';
        
        

        var acn_ = document.getElementsByTagName('body')[0];

        var ae_ = __apl();
        var aco_ = document.createElement('div');
        aco_.setAttribute('id', 'appointyOverlayGdOv');
        aco_.setAttribute('style', 'position: fixed; top: 0px; left: 0px; 	filter: alpha(opacity=30);	-moz-opacity: 0.3;	opacity: 0.3; background-color: rgb(0, 0, 0); z-index: 2000000003; width: 100%; height: ' + ae_[1] + 'px; display: none;');

        //aco_.style.display = 'none';
        acn_.appendChild(aco_);
        //aco_.style.height= ae_[1]+'px';


        var acp_ = document.createElement('div');
        acp_.setAttribute('id', 'appointyOverlayGdIf');
        acp_.setAttribute('style', '-moz-border-radius: 5px 5px 5px 5px; -moz-box-shadow: 3px 3px 3px #CCCCCC;	-webkit-border-radius: 0px 0px 4px 4px;	-webkit-box-shadow: 3px 3px 3px #ddd;    background-color: #F4F4F4; border: 2px solid #CCCCCC; left: 50%; margin-left: -'+ appointyWidth/2 +'px;    padding: 10px; position: absolute; top: 50px; width: ' + appointyWidth + 'px; z-index: 2000000004;    display: none; background-image:url(http:\/\/static.appointy.com/Widget/Images/loading.png);background-repeat:no-repeat;background-position:center center');
        acp_.innerHTML = '<iframe src="" frameborder="0" id="appoiontyOvIfram" style="width:'+ appointyWidth +'px; height: '+ appointyHeight +'px; border: 0px;"></iframe>';

        acn_.appendChild(acp_);
        var iframClosSp = document.createElement('span');
        iframClosSp.setAttribute('style', 'background-image: url(http:\/\/static.appointy.com/Widget/Images/buttonClose1.gif); background-position: left top;        background-repeat: no-repeat; cursor: pointer; padding: 12px; position: absolute;        right: -15px; top: -15px; z-index: 2000000005;');

        acp_.appendChild(iframClosSp);

        
        var acq_ = document.createElement('div');
        acq_.setAttribute('id', 'appScheduleMeBt');
		acq_.innerHTML = 'Appointment Scheduling Software';
        acq_.setAttribute('style', 'background-color:' + ScheduleMeBg + '; background-image: url('+ScheduleMeBgImg+');        color: #FFFFFF; cursor: pointer; height: '+ScheduleMeHeight+'px; '+ScheduleMePosition+': -3px; margin-left: -7px; overflow: hidden; background-repeat:no-repeat; position: fixed; text-indent: -100000px; top: 25%; width: '+ScheduleMeWidth+'px; z-index: 100000;');
        
        if(!ShowSchedulemeImg)
            acq_.style.display='none';
            
        acn_.appendChild(acq_);

        acq_.onclick = function () { document.documentElement.scrollTop = '0px'; acp_.style.display = ''; aco_.style.display = ''; document.getElementById('appoiontyOvIfram').src = 'http:\/\/' + appointy + '.appointy.com/?isgadget=1' }
        iframClosSp.onclick = function () { acp_.style.display = 'none'; aco_.style.display = 'none'; document.getElementById('appoiontyOvIfram').src='' }
    }




    function __apl() {
        var xScroll, yScroll;
        if (window.innerHeight && window.scrollMaxY) {

            xScroll = document.body.scrollWidth;
            yScroll = window.innerHeight + window.scrollMaxY;
        } else if (document.body.scrollHeight > document.body.offsetHeight) {

            xScroll = document.body.scrollWidth;
            yScroll = document.body.scrollHeight;
        } else {
            //document.documentElement.scrollHeight;
            xScroll = document.documentElement.offsetWidth;
            yScroll = document.documentElement.scrollHeight;
        }
        var windowWidth, windowHeight;
        if (self.innerHeight) {
            windowWidth = self.innerWidth;
            windowHeight = self.innerHeight;
        } else if (document.documentElement && document.documentElement.clientHeight) {
            windowWidth = document.documentElement.clientWidth;
            windowHeight = document.documentElement.clientHeight;
        } else if (document.body) {
            windowWidth = document.body.clientWidth;
            windowHeight = document.body.clientHeight;
        }
        if (yScroll < windowHeight) {
            pageHeight = windowHeight;
        } else {
            pageHeight = yScroll;
        }
        if (xScroll < windowWidth) {
            pageWidth = windowWidth;
        } else {
            pageWidth = xScroll;
        }

        arrayPageSize = new Array(pageWidth, pageHeight, windowWidth, windowHeight);
        return arrayPageSize;
    };
     
        __apk();
}
window.onload = function () { overlayGAdget() };

function ShowAppointyInOverlay()
{
    if(document.getElementById('appScheduleMeBt').click)
        document.getElementById('appScheduleMeBt').click();
    else
        document.getElementById('appScheduleMeBt').onclick();
}
