var AdLiaison = new Class({
    
    /* initialize()
     *
     * Constructor for AdLiaison. Presets all of the class
     * properties and sets the ad positions as invisible.
     */
    initialize: function() {
        //ad variables sent to DART
        this.playerID = 0;
        this.currPlaylistID = 0;
        this.currVidID = 0;
        this.dartZone = 0;
        this.dartKeyword = '';
        this.pre = 0;
        this.mid = 0;
        this.post = 0;

        this.cacheBuster = Math.random()*10000000000000000;
    },


    /* updateAds( int playerID, int currPlaylistID, int currVidID, int pre, int mid, int post )
     *
     */
    updateAds: function(playerID, currPlaylistID, currVidID, pre, mid, post) {
        this.playerID = playerID;
        this.currPlaylistID = currPlaylistID;
        this.currVidID = currVidID;
        this.pre = pre;
        this.mid = mid;
        this.post = post
        
        this.getBottom();
    },

    /* getBottom()
     *
     */
    getBottom: function() {
        var bottomIframe = new IFrame('botAdContent',{
            src: 'http://video.healthination.com/files/php/iframeDynamic.php?position=bottom&dartZone='+this.dartZone+'&dartKeyword='+this.dartKeyword+'&currVidID='+this.currVidID
                +'&playerID='+this.playerID+'&currPlaylistID='+this.currPlaylistID+'&ord='+this.cacheBuster,
            events: {
                load: function() {
                    var content = myAds.getIFrameData($('botAdContent'));
                    if(!content.test("817-grey.gif")) {
                        $('botAdLabel').setStyle('display', 'block');
                    }
                }
            }
        });
    },
    
    /* getIFrameData( iframe el )
     *
     * Returns innerHTML from a iframe's <body> element. Used to implant iframe content into another page.
     */
    getIFrameData: function(el) {
        var data;
        if (el.contentDocument) { 
            // NS6 & Gecko & Opera & IE7+ 
            data = el.contentDocument.body.innerHTML; 
        }
        else if (el.contentWindow) { 
            // IE 5.5 & 6.x 
            data = el.contentWindow.document.body.innerHTML;
        }
        return data;
    }

});