                //centers in-page popup in client window
                function getPopupPosition(popupwidth, popupheight)
                {
                    var pos = [];
                    var d = document;  
                    var rootElm = (d.documentelement && d.compatMode == 'CSS1Compat') ? d.documentelement : d.body;  
                    var vpw = self.innerWidth ? self.innerWidth : rootElm.clientWidth; // viewport width  
                    var vph = self.innerHeight ? self.innerHeight : rootElm.clientHeight; // viewport height
                    pos['x'] = ((vpw - popupwidth) / 2);   
                    pos['y'] = (document.getScroll().y + (vph - popupheight)/2 - (Browser.Engine.trident == true ? (popupheight/2) : 0));                     
                    return pos;
                }
                function getTitle(id)
                {
                    var title = $(id).get('html');
                    return title;   
                }
                function bindLinks(){
                    if ($$('a.showlink')){
                        $$('a.showlink').addEvent('click', function(e){
                        new Event(e).stop();
                        var title = getTitle(this.id);
                        displayPopup(this.id, title);
                        });
                    }    
                }
                
                var displayPopup = function(id, title){
                    var pos = getPopupPosition(600,400);
                    new MochaUI.Window({
                        id: 'modalshow',
                        title: title,
                        loadMethod: 'xhr',
                        contentURL: 'http://www.bvtamerica.com/shows_attractions/ajax_show/'+id.substr(4)+'/'+Math.floor(Math.random()*10000)+'.html',
                        type: 'modal',
                        width: 600,
                        height: 400,                        
                        x: pos['x'],
                        y: pos['y']
                    });
                    //if (Browser.Engine.trident == false)
                    //{MochaUI.centerWindow();}
                                                    
                }
                window.addEvent('domready', function(){bindLinks();MochaUI.Modal = new MochaUI.Modal();});
