ClientScript_967 = new function() {
    var htmlOnly = false;
    var urlbase = 'http://www.voicepad.com/broker-api/';
    var formURL = 'http://www.voicepad.com/broker-api/activate.asp';
    var CustomerID = '';
    var PopupBgColor = '';
    var UseSeparateWindow = true;

    function $(v, o) { return ((typeof (o) == 'object' ? o : document).getElementById(v)); }
    function $S(o) { o = $(o); if (o) return (o.style); }

    function addStyleSheet() {
        if (document.createStyleSheet) {
            document.createStyleSheet('http://www.voicepad.com/broker-api/Clients/967/vp_stylesheet.css');
        }
        else {
            // document.implementation.createCSSStylesheet(
            var styles = "@import url('http://www.voicepad.com/broker-api/Clients/967/vp_stylesheet.css');";
            var newSS = document.createElement('link');
            newSS.rel = 'stylesheet';
            newSS.href = 'data:text/css,' + escape(styles);

            document.getElementsByTagName("head")[0].appendChild(newSS);
        }
    }

    function popupUrl() {
	var szPopupUrl = 'http://www.voicepad.com/broker-api/Clients/967/Popup.asp';

        if (VP_MLS != undefined && VP_MLS != '') szPopupUrl += '?VP_MLS=' + VP_MLS;

        if (VP_AgentID != undefined && VP_AgentID != '') {
            szPopupUrl += (szPopupUrl.indexOf('?') >= 0 ? '&' : '?');
            szPopupUrl += 'VP_AgentID=' + VP_AgentID;
        }

        return szPopupUrl;
    }

    function include(script_filename) {
        document.write('<' + 'script');
        document.write(' language="javascript"');
        document.write(' type="text/javascript"');
        document.write(' src="' + script_filename + '">');
        document.write('</' + 'script' + '>');
    }


    this.PopupWidget = function() {
        if (!UseSeparateWindow) {
            $S("popcontainer").display = 'block';
            $S("masterdiv").display = 'block';
            $S("shadow").display = 'inline';
        }
        else {
            var left = (screen.width / 2) - (510 / 2);
            var top = (screen.height / 2) - (620 / 2);
            var w = window.open(popupUrl(), 'Widget', 'left=' + left + ',top=' + top + ',width=510,height=620,toolbar=0,location=0,status=0,menubar=0,scrollbars=0,', false);

        }
    };
    this.ClosePopup = function() {
        $S("popcontainer").display = 'none';
        $S("masterdiv").display = 'none';
        $S("shadow").display = 'none';

    };

    /***********************************************
    * Floating Iframe script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
    * Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
    * This notice must stay intact for legal use
    ***********************************************/

    //Specify iframe to display. Change src and other attributes except "position" and "left/top":


    //specify x coordinates of iframe ("right" for right corner, or a pixel number (ie: "20px")):
    function mygetViewportDimensions() {
        var intH = 0, intW = 0;

        if (self.innerHeight) {
            intH = window.innerHeight;
            intW = window.innerWidth;
        }
        else {
            if (document.documentElement && document.documentElement.clientHeight) {
                intH = document.documentElement.clientHeight;
                intW = document.documentElement.clientWidth;
            }
            else {
                if (document.body) {
                    intH = document.body.clientHeight;
                    intW = document.body.clientWidth;
                }
            }
        }

        return {
            height: parseInt(intH, 10),
            width: parseInt(intW, 10)
        };
    }

    this.writeHtml = function() {
        var viewport = mygetViewportDimensions();

        var masterdivleft = (viewport.width / 2) - 230;
        var masterdivtop = (viewport.height / 2) - 280;

        var contdivtop = (viewport.height / 2) - 275;
        var contdivleft = (viewport.width / 2) + 185;

        addStyleSheet();

        document.write('<div class="form" id="voicepad_badge_container">' +
                       '<div class="intro_text" id="intro"><!-- var introtext -->Search any home from any phone!</div>' +
                       '<div class="phonenumber_text" id="phonenumber">(330) 433-2929</div>' +
                       '<div id="bg_phone"></div>' +
                       '<div id="bg_number"><!-- can this single color bg.png be dynamically created? [not two hex colors, just one]--></div>' +
                       '<div id="bg_click" class="bg_click" ><a href="javascript:ClientScript_967.PopupWidget();" class="button"><span><!-- var popuptext -->Click for more info</span></a></div>' +
                       '<div id="subphone" class="subphone"></div>' +
                       '</div><div id="shadow" style="display:none;position:absolute; z-index: 7; left:0px; top:0px; width:100%; height:100%; filter:alpha(opacity=70); opacity:0.7; background-color:#EEEEEE"></div>' +
                       '<div style = "text-align:right;top: ' + contdivtop + 'px; left: ' + contdivleft + 'px; position:absolute; z-index:8;display:none;" id="popcontainer"><a href="javascript:ClientScript_967.ClosePopup();">Close</a></div>' +
                       '<iframe id="masterdiv" src="' + popupUrl() + '" width="460px" height="570px" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="1" scrolling="no" style="position: absolute; display:none;top: ' + masterdivtop + 'px; left: ' + masterdivleft + 'px;z-index: 7;"></iframe>');
    };
};

ClientScript_967.writeHtml();

