(function () {

    scoutadsv3 = {
        _rno: 0,
        env: {
            showtitle: 1,
            showcontentline1: 2,
            showcontentline2: 4,
            showcontentstyle: 8,
            showhintline: 16,
            showurl: 32
        }
    };

    // The system pre-defined adtext configuration
    scoutadsv3.systemadconfig = [{ w: 88, h: 31, maxad: 1 }
, { w: 120, h: 60, maxad: 1 }
, { w: 120, h: 90, maxad: 1 }
, { w: 120, h: 240, maxad: 2, AdTextConfig: [undefined, { taconfig: { name: "Text Ad 119x145", w: 119, h: 145, maxoccur: 6, t_style: 55, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 17255
}
]
, listofad: []
}
, { w: 120, h: 600, maxad: 4, AdTextConfig: [undefined, { taconfig: { name: "Text Ad 119x145", w: 119, h: 145, maxoccur: 6, t_style: 55, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 17255
}
, { taconfig: { name: "Text Ad 119x145", w: 119, h: 145, maxoccur: 6, t_style: 55, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 34510
}
, { taconfig: { name: "Text Ad 119x145", w: 119, h: 145, maxoccur: 6, t_style: 55, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 51765
}
, { taconfig: { name: "Text Ad 119x145", w: 119, h: 145, maxoccur: 6, t_style: 55, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 69020
}
]
, listofad: []
}
, { w: 125, h: 125, maxad: 4 }
, { w: 160, h: 600, maxad: 4, AdTextConfig: [undefined, { taconfig: { name: "Text Ad 160x130", w: 160, h: 130, maxoccur: 6, t_style: 55, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 20800
}
, { taconfig: { name: "Text Ad 160x130", w: 160, h: 130, maxoccur: 6, t_style: 55, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 41600
}
, { taconfig: { name: "Text Ad 160x130", w: 160, h: 130, maxoccur: 6, t_style: 55, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 62400
}
, { taconfig: { name: "Text Ad 160x130", w: 160, h: 130, maxoccur: 6, t_style: 55, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 83200
}
]
, listofad: []
}
, { w: 180, h: 150, maxad: 2, AdTextConfig: [undefined, { taconfig: { name: "Text Ad 160x130", w: 160, h: 130, maxoccur: 6, t_style: 55, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 20800
}
, { taconfig: { name: "Text Ad 180x75", w: 180, h: 75, maxoccur: 6, t_style: 63, h_font: "arial,sans-serif", h_fontsize: "10px", h_height: "12px", c1_font: "arial,sans-serif", c1_fontsize: "10px", c1_height: "12px", c2_font: "arial,sans-serif", c2_fontsize: "10px", c2_height: "12px", durl_font: "arial,sans-serif", durl_fontsize: "10px", durl_height: "12px", ht_font: "arial,sans-serif", ht_fontsize: "10px", ht_height: "12px" }
, weight: 27000
}
]
, listofad: []
}
, { w: 234, h: 60, maxad: 4, AdTextConfig: [undefined, { taconfig: { name: "Text Ad 225x60", w: 225, h: 60, maxoccur: 6, t_style: 31, h_font: "arial,sans-serif", h_fontsize: "10px", h_height: "12px", c1_font: "arial,sans-serif", c1_fontsize: "10px", c1_height: "12px", c2_font: "arial,sans-serif", c2_fontsize: "10px", c2_height: "12px", durl_font: "arial,sans-serif", durl_fontsize: "10px", durl_height: "12px", ht_font: "arial,sans-serif", ht_fontsize: "10px", ht_height: "12px" }
, weight: 13500
}
, { taconfig: { name: "Text Ad 200x30", w: 200, h: 30, maxoccur: 6, t_style: 1, h_font: "arial,sans-serif", h_fontsize: "10px", h_height: "12px", c1_font: "arial,sans-serif", c1_fontsize: "0px", c1_height: "0px", c2_font: "arial,sans-serif", c2_fontsize: "0px", c2_height: "0px", durl_font: "arial,sans-serif", durl_fontsize: "0px", durl_height: "0px", ht_font: "arial,sans-serif", ht_fontsize: "0px", ht_height: "0px" }
, weight: 12000
}
]
, listofad: []
}
, { w: 240, h: 400, maxad: 4, listofad: []
, AdTextConfig: [undefined, { taconfig: { name: "Text Ad 160x130", w: 160, h: 130, maxoccur: 6, t_style: 55, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 20800
}
, { taconfig: { name: "Text Ad 160x130", w: 160, h: 130, maxoccur: 6, t_style: 55, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 41600
}
, { taconfig: { name: "Text Ad 160x130", w: 160, h: 130, maxoccur: 6, t_style: 55, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 62400
}
, { taconfig: { name: "Text Ad 119x145", w: 119, h: 145, maxoccur: 6, t_style: 55, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 69020
}
, { taconfig: { name: "Text Ad 225x60", w: 225, h: 60, maxoccur: 6, t_style: 31, h_font: "arial,sans-serif", h_fontsize: "10px", h_height: "12px", c1_font: "arial,sans-serif", c1_fontsize: "10px", c1_height: "12px", c2_font: "arial,sans-serif", c2_fontsize: "10px", c2_height: "12px", durl_font: "arial,sans-serif", durl_fontsize: "10px", durl_height: "12px", ht_font: "arial,sans-serif", ht_fontsize: "10px", ht_height: "12px" }
, weight: 67500
}
, { taconfig: { name: "Text Ad 225x60", w: 225, h: 60, maxoccur: 6, t_style: 31, h_font: "arial,sans-serif", h_fontsize: "10px", h_height: "12px", c1_font: "arial,sans-serif", c1_fontsize: "10px", c1_height: "12px", c2_font: "arial,sans-serif", c2_fontsize: "10px", c2_height: "12px", durl_font: "arial,sans-serif", durl_fontsize: "10px", durl_height: "12px", ht_font: "arial,sans-serif", ht_fontsize: "10px", ht_height: "12px" }
, weight: 81000
}
]
}
, { w: 250, h: 250, maxad: 4, AdTextConfig: [undefined, { taconfig: { name: "Text Ad 119x145", w: 119, h: 145, maxoccur: 6, t_style: 55, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 17255
}
, { taconfig: { name: "Text Ad 119x145", w: 119, h: 145, maxoccur: 6, t_style: 55, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 34510
}
, { taconfig: { name: "Text Ad 225x60", w: 225, h: 60, maxoccur: 6, t_style: 31, h_font: "arial,sans-serif", h_fontsize: "10px", h_height: "12px", c1_font: "arial,sans-serif", c1_fontsize: "10px", c1_height: "12px", c2_font: "arial,sans-serif", c2_fontsize: "10px", c2_height: "12px", durl_font: "arial,sans-serif", durl_fontsize: "10px", durl_height: "12px", ht_font: "arial,sans-serif", ht_fontsize: "10px", ht_height: "12px" }
, weight: 40500
}
, { taconfig: { name: "Text Ad 225x60", w: 225, h: 60, maxoccur: 6, t_style: 31, h_font: "arial,sans-serif", h_fontsize: "10px", h_height: "12px", c1_font: "arial,sans-serif", c1_fontsize: "10px", c1_height: "12px", c2_font: "arial,sans-serif", c2_fontsize: "10px", c2_height: "12px", durl_font: "arial,sans-serif", durl_fontsize: "10px", durl_height: "12px", ht_font: "arial,sans-serif", ht_fontsize: "10px", ht_height: "12px" }
, weight: 54000
}
, { taconfig: { name: "Text Ad 200x30", w: 200, h: 30, maxoccur: 6, t_style: 1, h_font: "arial,sans-serif", h_fontsize: "10px", h_height: "12px", c1_font: "arial,sans-serif", c1_fontsize: "0px", c1_height: "0px", c2_font: "arial,sans-serif", c2_fontsize: "0px", c2_height: "0px", durl_font: "arial,sans-serif", durl_fontsize: "0px", durl_height: "0px", ht_font: "arial,sans-serif", ht_fontsize: "0px", ht_height: "0px" }
, weight: 30000
}
, { taconfig: { name: "Text Ad 200x30", w: 200, h: 30, maxoccur: 6, t_style: 1, h_font: "arial,sans-serif", h_fontsize: "10px", h_height: "12px", c1_font: "arial,sans-serif", c1_fontsize: "0px", c1_height: "0px", c2_font: "arial,sans-serif", c2_fontsize: "0px", c2_height: "0px", durl_font: "arial,sans-serif", durl_fontsize: "0px", durl_height: "0px", ht_font: "arial,sans-serif", ht_fontsize: "0px", ht_height: "0px" }
, weight: 36000
}
]
, listofad: []
}
, { w: 300, h: 600, maxad: 6, listofad: []
, AdTextConfig: [undefined, { taconfig: { name: "Text Ad 300x100", w: 300, h: 100, maxoccur: 6, t_style: 63, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 30000
}
, { taconfig: { name: "Text Ad 300x100", w: 300, h: 100, maxoccur: 6, t_style: 63, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 60000
}
, { taconfig: { name: "Text Ad 300x100", w: 300, h: 100, maxoccur: 6, t_style: 63, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 90000
}
, { taconfig: { name: "Text Ad 300x100", w: 300, h: 100, maxoccur: 6, t_style: 63, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 120000
}
, { taconfig: { name: "Text Ad 300x100", w: 300, h: 100, maxoccur: 6, t_style: 63, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 150000
}
, { taconfig: { name: "Text Ad 300x100", w: 300, h: 100, maxoccur: 6, t_style: 63, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 180000
}
]
}
, { w: 300, h: 250, maxad: 4, listofad: []
, AdTextConfig: [undefined, { taconfig: { name: "Text Ad 300x100", w: 300, h: 100, maxoccur: 6, t_style: 63, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 30000
}
, { taconfig: { name: "Text Ad 300x100", w: 300, h: 100, maxoccur: 6, t_style: 63, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 60000
}
, { taconfig: { name: "Text Ad 225x60", w: 225, h: 60, maxoccur: 6, t_style: 31, h_font: "arial,sans-serif", h_fontsize: "10px", h_height: "12px", c1_font: "arial,sans-serif", c1_fontsize: "10px", c1_height: "12px", c2_font: "arial,sans-serif", c2_fontsize: "10px", c2_height: "12px", durl_font: "arial,sans-serif", durl_fontsize: "10px", durl_height: "12px", ht_font: "arial,sans-serif", ht_fontsize: "10px", ht_height: "12px" }
, weight: 40500
}
, { taconfig: { name: "Text Ad 225x60", w: 225, h: 60, maxoccur: 6, t_style: 31, h_font: "arial,sans-serif", h_fontsize: "10px", h_height: "12px", c1_font: "arial,sans-serif", c1_fontsize: "10px", c1_height: "12px", c2_font: "arial,sans-serif", c2_fontsize: "10px", c2_height: "12px", durl_font: "arial,sans-serif", durl_fontsize: "10px", durl_height: "12px", ht_font: "arial,sans-serif", ht_fontsize: "10px", ht_height: "12px" }
, weight: 54000
}
]
}
, { w: 300, h: 100, maxad: 1, AdTextConfig: [undefined, { taconfig: { name: "Text Ad 300x100", w: 300, h: 100, maxoccur: 6, t_style: 63, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 30000
}
, { taconfig: { name: "Text Ad 200x30", w: 200, h: 30, maxoccur: 6, t_style: 1, h_font: "arial,sans-serif", h_fontsize: "10px", h_height: "12px", c1_font: "arial,sans-serif", c1_fontsize: "0px", c1_height: "0px", c2_font: "arial,sans-serif", c2_fontsize: "0px", c2_height: "0px", durl_font: "arial,sans-serif", durl_fontsize: "0px", durl_height: "0px", ht_font: "arial,sans-serif", ht_fontsize: "0px", ht_height: "0px" }
, weight: 12000
}
, { taconfig: { name: "Text Ad 200x30", w: 200, h: 30, maxoccur: 6, t_style: 1, h_font: "arial,sans-serif", h_fontsize: "10px", h_height: "12px", c1_font: "arial,sans-serif", c1_fontsize: "0px", c1_height: "0px", c2_font: "arial,sans-serif", c2_fontsize: "0px", c2_height: "0px", durl_font: "arial,sans-serif", durl_fontsize: "0px", durl_height: "0px", ht_font: "arial,sans-serif", ht_fontsize: "0px", ht_height: "0px" }
, weight: 18000
}
, { taconfig: { name: "Text Ad 200x30", w: 200, h: 30, maxoccur: 6, t_style: 1, h_font: "arial,sans-serif", h_fontsize: "10px", h_height: "12px", c1_font: "arial,sans-serif", c1_fontsize: "0px", c1_height: "0px", c2_font: "arial,sans-serif", c2_fontsize: "0px", c2_height: "0px", durl_font: "arial,sans-serif", durl_fontsize: "0px", durl_height: "0px", ht_font: "arial,sans-serif", ht_fontsize: "0px", ht_height: "0px" }
, weight: 24000
}
, { taconfig: { name: "Text Ad 200x30", w: 200, h: 30, maxoccur: 6, t_style: 1, h_font: "arial,sans-serif", h_fontsize: "10px", h_height: "12px", c1_font: "arial,sans-serif", c1_fontsize: "0px", c1_height: "0px", c2_font: "arial,sans-serif", c2_fontsize: "0px", c2_height: "0px", durl_font: "arial,sans-serif", durl_fontsize: "0px", durl_height: "0px", ht_font: "arial,sans-serif", ht_fontsize: "0px", ht_height: "0px" }
, weight: 30000
}
, { taconfig: { name: "Text Ad 200x30", w: 200, h: 30, maxoccur: 6, t_style: 1, h_font: "arial,sans-serif", h_fontsize: "10px", h_height: "12px", c1_font: "arial,sans-serif", c1_fontsize: "0px", c1_height: "0px", c2_font: "arial,sans-serif", c2_fontsize: "0px", c2_height: "0px", durl_font: "arial,sans-serif", durl_fontsize: "0px", durl_height: "0px", ht_font: "arial,sans-serif", ht_fontsize: "0px", ht_height: "0px" }
, weight: 36000
}
]
, listofad: []
}
, { w: 336, h: 280, maxad: 4, listofad: []
, AdTextConfig: [undefined, { taconfig: { name: "Text Ad 300x100", w: 300, h: 100, maxoccur: 6, t_style: 63, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 30000
}
, { taconfig: { name: "Text Ad 300x100", w: 300, h: 100, maxoccur: 6, t_style: 63, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 60000
}
, { taconfig: { name: "Text Ad 160x130", w: 160, h: 130, maxoccur: 6, t_style: 55, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 62400
}
, { taconfig: { name: "Text Ad 160x130", w: 160, h: 130, maxoccur: 6, t_style: 55, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 83200
}
]
}
, { w: 468, h: 60, maxad: 2, AdTextConfig: [undefined, { taconfig: { name: "Text Ad 375x60", w: 375, h: 60, maxoccur: 6, t_style: 55, h_font: "arial,sans-serif", h_fontsize: "10px", h_height: "12px", c1_font: "arial,sans-serif", c1_fontsize: "10px", c1_height: "12px", c2_font: "arial,sans-serif", c2_fontsize: "10px", c2_height: "12px", durl_font: "arial,sans-serif", durl_fontsize: "10px", durl_height: "12px", ht_font: "arial,sans-serif", ht_fontsize: "10px", ht_height: "12px" }
, weight: 22500
}
, { taconfig: { name: "Text Ad 225x60", w: 225, h: 60, maxoccur: 6, t_style: 31, h_font: "arial,sans-serif", h_fontsize: "10px", h_height: "12px", c1_font: "arial,sans-serif", c1_fontsize: "10px", c1_height: "12px", c2_font: "arial,sans-serif", c2_fontsize: "10px", c2_height: "12px", durl_font: "arial,sans-serif", durl_fontsize: "10px", durl_height: "12px", ht_font: "arial,sans-serif", ht_fontsize: "10px", ht_height: "12px" }
, weight: 27000
}
, { taconfig: { name: "Text Ad 200x30", w: 200, h: 30, maxoccur: 6, t_style: 1, h_font: "arial,sans-serif", h_fontsize: "10px", h_height: "12px", c1_font: "arial,sans-serif", c1_fontsize: "0px", c1_height: "0px", c2_font: "arial,sans-serif", c2_fontsize: "0px", c2_height: "0px", durl_font: "arial,sans-serif", durl_fontsize: "0px", durl_height: "0px", ht_font: "arial,sans-serif", ht_fontsize: "0px", ht_height: "0px" }
, weight: 18000
}
, { taconfig: { name: "Text Ad 200x30", w: 200, h: 30, maxoccur: 6, t_style: 1, h_font: "arial,sans-serif", h_fontsize: "10px", h_height: "12px", c1_font: "arial,sans-serif", c1_fontsize: "0px", c1_height: "0px", c2_font: "arial,sans-serif", c2_fontsize: "0px", c2_height: "0px", durl_font: "arial,sans-serif", durl_fontsize: "0px", durl_height: "0px", ht_font: "arial,sans-serif", ht_fontsize: "0px", ht_height: "0px" }
, weight: 24000
}
, { taconfig: { name: "Text Ad 200x30", w: 200, h: 30, maxoccur: 6, t_style: 1, h_font: "arial,sans-serif", h_fontsize: "10px", h_height: "12px", c1_font: "arial,sans-serif", c1_fontsize: "0px", c1_height: "0px", c2_font: "arial,sans-serif", c2_fontsize: "0px", c2_height: "0px", durl_font: "arial,sans-serif", durl_fontsize: "0px", durl_height: "0px", ht_font: "arial,sans-serif", ht_fontsize: "0px", ht_height: "0px" }
, weight: 30000
}
, { taconfig: { name: "Text Ad 200x30", w: 200, h: 30, maxoccur: 6, t_style: 1, h_font: "arial,sans-serif", h_fontsize: "10px", h_height: "12px", c1_font: "arial,sans-serif", c1_fontsize: "0px", c1_height: "0px", c2_font: "arial,sans-serif", c2_fontsize: "0px", c2_height: "0px", durl_font: "arial,sans-serif", durl_fontsize: "0px", durl_height: "0px", ht_font: "arial,sans-serif", ht_fontsize: "0px", ht_height: "0px" }
, weight: 36000
}
]
, listofad: []
}
, { w: 720, h: 300, maxad: 6, AdTextConfig: [undefined, { taconfig: { name: "Text Ad 300x100", w: 300, h: 100, maxoccur: 6, t_style: 63, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 30000
}
, { taconfig: { name: "Text Ad 300x100", w: 300, h: 100, maxoccur: 6, t_style: 63, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 60000
}
, { taconfig: { name: "Text Ad 300x100", w: 300, h: 100, maxoccur: 6, t_style: 63, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 90000
}
, { taconfig: { name: "Text Ad 300x100", w: 300, h: 100, maxoccur: 6, t_style: 63, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 120000
}
, { taconfig: { name: "Text Ad 300x100", w: 300, h: 100, maxoccur: 6, t_style: 63, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 150000
}
, { taconfig: { name: "Text Ad 300x100", w: 300, h: 100, maxoccur: 6, t_style: 63, h_font: "arial,sans-serif", h_fontsize: "12px", h_height: "14px", c1_font: "arial,sans-serif", c1_fontsize: "12px", c1_height: "14px", c2_font: "arial,sans-serif", c2_fontsize: "12px", c2_height: "14px", durl_font: "arial,sans-serif", durl_fontsize: "12px", durl_height: "14px", ht_font: "arial,sans-serif", ht_fontsize: "12px", ht_height: "14px" }
, weight: 180000
}
]
, listofad: []
}
, { w: 728, h: 90, maxad: 4, listofad: []
, AdTextConfig: [undefined, { taconfig: { name: "Text Ad 225x60", w: 225, h: 60, maxoccur: 6, t_style: 31, h_font: "arial,sans-serif", h_fontsize: "10px", h_height: "12px", c1_font: "arial,sans-serif", c1_fontsize: "10px", c1_height: "12px", c2_font: "arial,sans-serif", c2_fontsize: "10px", c2_height: "12px", durl_font: "arial,sans-serif", durl_fontsize: "10px", durl_height: "12px", ht_font: "arial,sans-serif", ht_fontsize: "10px", ht_height: "12px" }
, weight: 13500
}
, { taconfig: { name: "Text Ad 225x60", w: 225, h: 60, maxoccur: 6, t_style: 31, h_font: "arial,sans-serif", h_fontsize: "10px", h_height: "12px", c1_font: "arial,sans-serif", c1_fontsize: "10px", c1_height: "12px", c2_font: "arial,sans-serif", c2_fontsize: "10px", c2_height: "12px", durl_font: "arial,sans-serif", durl_fontsize: "10px", durl_height: "12px", ht_font: "arial,sans-serif", ht_fontsize: "10px", ht_height: "12px" }
, weight: 27000
}
, { taconfig: { name: "Text Ad 225x60", w: 225, h: 60, maxoccur: 6, t_style: 31, h_font: "arial,sans-serif", h_fontsize: "10px", h_height: "12px", c1_font: "arial,sans-serif", c1_fontsize: "10px", c1_height: "12px", c2_font: "arial,sans-serif", c2_fontsize: "10px", c2_height: "12px", durl_font: "arial,sans-serif", durl_fontsize: "10px", durl_height: "12px", ht_font: "arial,sans-serif", ht_fontsize: "10px", ht_height: "12px" }
, weight: 40500
}
, { taconfig: { name: "Text Ad 180x75", w: 180, h: 75, maxoccur: 6, t_style: 63, h_font: "arial,sans-serif", h_fontsize: "10px", h_height: "12px", c1_font: "arial,sans-serif", c1_fontsize: "10px", c1_height: "12px", c2_font: "arial,sans-serif", c2_fontsize: "10px", c2_height: "12px", durl_font: "arial,sans-serif", durl_fontsize: "10px", durl_height: "12px", ht_font: "arial,sans-serif", ht_fontsize: "10px", ht_height: "12px" }
, weight: 54000
}
, { taconfig: { name: "Text Ad 200x30", w: 200, h: 30, maxoccur: 6, t_style: 1, h_font: "arial,sans-serif", h_fontsize: "10px", h_height: "12px", c1_font: "arial,sans-serif", c1_fontsize: "0px", c1_height: "0px", c2_font: "arial,sans-serif", c2_fontsize: "0px", c2_height: "0px", durl_font: "arial,sans-serif", durl_fontsize: "0px", durl_height: "0px", ht_font: "arial,sans-serif", ht_fontsize: "0px", ht_height: "0px" }
, weight: 30000
}
, { taconfig: { name: "Text Ad 200x30", w: 200, h: 30, maxoccur: 6, t_style: 1, h_font: "arial,sans-serif", h_fontsize: "10px", h_height: "12px", c1_font: "arial,sans-serif", c1_fontsize: "0px", c1_height: "0px", c2_font: "arial,sans-serif", c2_fontsize: "0px", c2_height: "0px", durl_font: "arial,sans-serif", durl_fontsize: "0px", durl_height: "0px", ht_font: "arial,sans-serif", ht_fontsize: "0px", ht_height: "0px" }
, weight: 36000
}
]
}
];

    // Browser checking function
    scoutadsv3.browserCheck = function () {
        var browser = navigator.appName;
        var b_version = navigator.appVersion;
        var version = parseFloat(b_version);
        if (browser.indexOf("Internet Explorer") >= 0) {
            this.isIE = true;
        }
    };
    scoutadsv3.browserCheck();

    // Essential javascript functions
    scoutadsv3.clone = function (obj) {
        var cloneObj = {};
        for (var i in obj) {
            cloneObj[i] = obj[i];
        }
        return cloneObj;
    };
    scoutadsv3.merge = function (obj1, obj2) {
        for (var i in obj2) {
            obj1[i] = obj2[i];
        }
    };
    scoutadsv3.applyStyle = function (ele, styleOpt) {
        for (var i in styleOpt) {
            switch (i) {
                case "cellSpacing":
                case "cellPadding":
                    ele[i] = styleOpt[i];
                    break;

                default:
                    if (i == "display") {
                        if (styleOpt[i] == "inline-table" && scoutadsv3.isIE)
                            styleOpt[i] = "inline";
                    }
                    ele.style[i] = styleOpt[i];
            }
        }
    };
    scoutadsv3.getNextEleNo = function (prefix) {
        this._rno += 1;
        return prefix + this._rno;
    };

    scoutadsv3.getCurrentURL = function () {
        var strURL = "";

        strURL = document.location.href;

        if (strURL == undefined || strURL.length == 0)
            strURL = document.URL;

        strURL = escape(strURL);
        return strURL;
    };



    // Banner and Ads related functions
    scoutadsv3.createBannerUnit = function (bannerInfo, bannerStyle) {
        // Create a table of the size
        var eleBN_T = document.createElement("TABLE");
        var eleBN_TB = document.createElement("TBODY");
        var eleBN_TR = document.createElement("TR");
        var eleBN_TD = document.createElement("TD");
        var eleBN_UL = document.createElement("UL");

        var styleBN_UL = { padding: "0px", margin: "0px" };
        scoutadsv3.applyStyle(eleBN_UL, styleBN_UL);

        eleBN_TD.appendChild(eleBN_UL);
        eleBN_TR.appendChild(eleBN_TD);
        eleBN_TB.appendChild(eleBN_TR);
        eleBN_T.appendChild(eleBN_TB);

        scoutadsv3.applyStyle(eleBN_T, bannerStyle);

        return { BannerElement: eleBN_T, InnerContainer: eleBN_UL };
    };

    scoutadsv3.createAdTextUnit = function (taInfo, taLayoutConfig, taStyle, bannerLayout) {
        // Parameter reference
        // taInfo = Content of the text ads
        // taLayoutConfig = system prefixed layout (font, size, etc).
        // taStyle = Styling that is to be imposed on individual Ad Text

        // Create the AdText unit
        var eleT = document.createElement("TABLE");
        var eleTB = document.createElement("TBODY");
        var eleTR = document.createElement("TR");
        var eleTD = document.createElement("TD");

        eleT.id = scoutadsv3.getNextEleNo("t");

        eleTR.appendChild(eleTD);
        eleTB.appendChild(eleTR);
        eleT.appendChild(eleTB);

        // The Headline Element
        var eleAH = document.createElement("SPAN");
        eleAH.appendChild(document.createTextNode(taInfo.headline));
        eleAH.onclick = function () {
            var isInIFrame = (window.location != window.parent.location) ? true : false;
            if (!isInIFrame)
                location.href = taInfo.targeturl;
            else
                window.parent.location.href = taInfo.targeturl;
        };

        // The Content Element
        var eleC1 = document.createElement("DIV");
        eleC1.appendChild(document.createTextNode(taInfo.contentline1));
        var eleC2 = document.createElement("DIV");
        eleC2.appendChild(document.createTextNode(taInfo.contentline2));

        if ((taLayoutConfig.t_style & scoutadsv3.env.showcontentstyle) == 0) {
            eleC1.appendChild(document.createTextNode(" "));
            eleC1.appendChild(document.createTextNode(taInfo.contentline2));
        }

        // The HintLine Element
        var eleHL = document.createElement("DIV");
        eleHL.id = eleT.id + "_hint";
        eleHL.style.visibility = "hidden";
        eleHL.appendChild(document.createTextNode(taInfo.hintline));

        eleT.onmouseover = function () {
            var eleHint = document.getElementById(this.id + "_hint");
            eleHint.style.visibility = "visible";
        };

        eleT.onmouseout = function () {
            var eleHint = document.getElementById(this.id + "_hint");
            eleHint.style.visibility = "hidden";
        };

        // The URL
        var eleDURL = document.createElement("SPAN");
        eleDURL.appendChild(document.createTextNode(taInfo.displayurl));
        eleDURL.onclick = function () {
            var isInIFrame = (window.location != window.parent.location) ? true : false;
            if (!isInIFrame)
                location.href = taInfo.targeturl;
            else
                window.parent.location.href = taInfo.targeturl;
        };


        // Apply the style for TABLE
        var styleT = scoutadsv3.clone(taStyle.adunit);
        scoutadsv3.merge(styleT, { width: taLayoutConfig.w, height: taLayoutConfig.h, overflow: "hidden" });

        // Apply the style for Headline
        var styleAH = { cursor: "pointer", fontFamily: taLayoutConfig.h_font, fontSize: taLayoutConfig.h_fontsize, height: taLayoutConfig.h_height, overflow: "hidden" };
        scoutadsv3.merge(styleAH, taStyle.headline);

        // Apply the style for Content Line 1 and 2
        var styleC1 = { fontFamily: taLayoutConfig.c1_font, fontSize: taLayoutConfig.c1_fontsize, overflow: "hidden" };
        scoutadsv3.merge(styleC1, taStyle.contentline1);
        var styleC2 = { fontFamily: taLayoutConfig.c2_font, fontSize: taLayoutConfig.c2_fontsize, overflow: "hidden" };
        scoutadsv3.merge(styleC2, taStyle.contentline2);

        // Constraint the size of the text lines if the banner layout do not permits so
        if ((taLayoutConfig.t_style & scoutadsv3.env.showcontentstyle) > 0) {
            if (bannerLayout != undefined && !bannerLayout.expand_height) {
                styleC1.height = taLayoutConfig.c1_height;
                styleC2.height = taLayoutConfig.c2_height;
            }
        }

        // The style for URL line
        var styleDURL = { cursor: "pointer", fontFamily: taLayoutConfig.durl_font, fontSize: taLayoutConfig.durl_fontsize, height: taLayoutConfig.durl_height, overflow: "hidden" };
        scoutadsv3.merge(styleDURL, taStyle.displayurl);
        // The style for Hint Line
        var styleHL = { fontFamily: taLayoutConfig.ht_font, fontSize: taLayoutConfig.ht_fontsize, height: taLayoutConfig.ht_height, overflow: "hidden" };
        scoutadsv3.merge(styleHL, taStyle.hintline);

        scoutadsv3.applyStyle(eleT, styleT);
        scoutadsv3.applyStyle(eleAH, styleAH);
        scoutadsv3.applyStyle(eleC1, styleC1);
        scoutadsv3.applyStyle(eleC2, styleC2);
        scoutadsv3.applyStyle(eleDURL, styleDURL);
        scoutadsv3.applyStyle(eleHL, styleHL);

        eleTD.appendChild(eleAH);

        if ((taLayoutConfig.t_style & scoutadsv3.env.showcontentline1) > 0)
            eleTD.appendChild(eleC1);

        if ((taLayoutConfig.t_style & scoutadsv3.env.showcontentstyle) > 0) {
            if ((taLayoutConfig.t_style & scoutadsv3.env.showcontentline2) > 0)
                eleTD.appendChild(eleC2);
        }


        if ((taLayoutConfig.t_style && scoutadsv3.env.showurl) > 0)
        {
            eleTD.appendChild(eleDURL);

        }

        if ((taLayoutConfig.t_style & scoutadsv3.env.showhintline) > 0)
            eleTD.appendChild(eleHL);


        return eleT;
    };

    scoutadsv3.generateAdTextBanner = function (systemAdConfig, cBannerConfig, elePlacementDiv) {
        // cBannerConfig is pass from server side, it contains h, w, adtype, listofad,
        // adstyle, bannerstyle

        if (cBannerConfig.listofad.length == 0)
            return;

        var bannerStyleReference = cBannerConfig.bannerstyle;

        // Check the number of ads to display and pick the according AdTextConfig
        var pickedAdConfig = null;
        for (var i = 0; i < systemAdConfig.length; i++) {
            if (systemAdConfig[i].w == cBannerConfig.w && systemAdConfig[i].h == cBannerConfig.h) {
                pickedAdConfig = systemAdConfig[i];
                break;
            }
        }

        if (pickedAdConfig == undefined) {
            alert("Invalid Banner Size.");
            return;
        }

        var cTASize = pickedAdConfig.AdTextConfig[cBannerConfig.listofad.length].taconfig;
        if (cTASize == undefined) {
            // TODO: need to remove this in live environment
            alert("Invalid AdTextConfig for " + cBannerConfig.listofad.length);
            return;
        }

        // Calculate how many text ads can be shown
        var bannerLayout = { w: 0, h: 0 };
        bannerLayout.w = parseInt(cBannerConfig.w / cTASize.w);
        bannerLayout.h = parseInt(cBannerConfig.h / cTASize.h);

        var bannerStyle = bannerStyleReference;
        var bannerUnit = scoutadsv3.createBannerUnit(cBannerConfig, bannerStyle);

        var ListOfAd = cBannerConfig.listofad;

        for (var iAd = 0; iAd < ListOfAd.length; iAd++) {
            var ta = ListOfAd[iAd];

            var eleT = scoutadsv3.createAdTextUnit(ta, cTASize, cBannerConfig.adstyle, bannerLayout);

            var eleLI = document.createElement("LI");
            // Apply the style for LI element
            var styleLI = { display: "inline", borderColor: cBannerConfig.adstyle.adunit.borderColor, margin: "0px" };
            scoutadsv3.applyStyle(eleLI, styleLI);
            eleLI.appendChild(eleT);

            bannerUnit.InnerContainer.appendChild(eleLI);
        };
        elePlacementDiv.appendChild(bannerUnit.BannerElement);

    };

    scoutadsv3.generateAdGraphicsBanner = function (systemAdConfig, cBannerConfig, elePlacementDiv) {
        var ele = document.createElement("DIV");
        scoutadsv3.applyStyle(ele, cBannerConfig.bannerstyle);

        var adInstance = cBannerConfig.listofad[0];

        var hintline = adInstance.hintline;
        var spanhintid = scoutadsv3.getNextEleNo("div");
		var poweredid = scoutadsv3.getNextEleNo("div");
        var addivid = scoutadsv3.getNextEleNo("div");
        ele.id = addivid;

        //    ele.onmouseover = function(){
        //        scoutads.adtexthint(spanhintid, hintline);
        //    };
        //    
        //    ele.onmouseout = function(){
        //        scoutads.adtexthint(spanhintid, '');
        //    };

        // Create the Image File
        var eleBannerImageA = document.createElement("A");
        eleBannerImageA.onclick = function () {
            var isInIFrame = (window.location != window.parent.location) ? true : false;
            if (!isInIFrame)
                location.href = adInstance.targeturl;
            else
                window.parent.location.href = adInstance.targeturl;
        };

        var eleBannerImage = document.createElement("IMG");
        eleBannerImage.src = adInstance.adimg;
        eleBannerImage.border = "0";

        eleBannerImageA.appendChild(eleBannerImage);
        scoutadsv3.applyStyle(eleBannerImageA, cBannerConfig.adstyle.headline);

        // Create the Hint Line
        var eleHintLine = document.createElement("SPAN");
        eleHintLine.appendChild(document.createTextNode(""));
        eleHintLine.id = spanhintid;
        scoutadsv3.applyStyle(eleHintLine, cBannerConfig.adstyle.hintline);

		//Create the Powered by ScoutAds
		var elePowered =  getPoweredByScoutAds(poweredid, cBannerConfig.adstyle.poweredby);
		
        // Add the Content Elements
        ele.appendChild(eleBannerImageA);
        ele.appendChild(document.createElement("BR"));
        ele.appendChild(eleHintLine);
        ele.appendChild(elePowered);
		
        elePlacementDiv.appendChild(ele);
		//alert(elePlacementDiv.innerHTML);
    };

    scoutadsv3.generateAdFlashBanner = function (systemAdConfig, cBannerConfig, elePlacementDiv) {
        var ele = document.createElement("DIV");
        scoutadsv3.applyStyle(ele, cBannerConfig.bannerstyle);

        var adInstance = cBannerConfig.listofad[0];

        var hintline = adInstance.hintline;
        var spanhintid = scoutadsv3.getNextEleNo("div");
		var poweredid = scoutadsv3.getNextEleNo("div");
        var addivid = scoutadsv3.getNextEleNo("div");
        ele.id = addivid;

        var strSWFCode = AC_FL_RunContent(
		'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0',
		'width', adInstance.width,
		'height', adInstance.height,
		'src', adInstance.adimg,
		'quality', 'high',
		'pluginspage', 'http://www.adobe.com/go/getflashplayer',
		'align', 'middle',
		'play', 'true',
		'loop', 'true',
		'scale', 'showall',
		'wmode', 'transparent',
		'devicefont', 'false',
		'id', adInstance.adimg,
		'bgcolor', '#ffffff',
		'name', adInstance.adimg,
		'menu', 'true',
		'allowFullScreen', 'false',
		'allowScriptAccess', 'sameDomain',
		'movie', adInstance.adimg,
		'salign', ''
		);

        ele.innerHTML = strSWFCode;
		
		//Create the Powered by ScoutAds
		var elePowered =  getPoweredByScoutAds(poweredid, cBannerConfig.adstyle.poweredby);
        ele.appendChild(elePowered);
		
        elePlacementDiv.appendChild(ele);
		//alert(elePlacementDiv.innerHTML);
    };

    scoutadsv3.generateBanner = function (systemAdConfig, cBannerConfig, elePlacementDiv) {
        // Check and see if it is AdText, AdGraphics or AdFlash
        switch (cBannerConfig.adtype) {
            case "adtext":
                scoutadsv3.generateAdTextBanner(systemAdConfig, cBannerConfig, elePlacementDiv);
                break;

            case "adgraphics":
                scoutadsv3.generateAdGraphicsBanner(systemAdConfig, cBannerConfig, elePlacementDiv);
                break;

            case "adflash":
                scoutadsv3.generateAdFlashBanner(systemAdConfig, cBannerConfig, elePlacementDiv);
                break;
        }
    };

    scoutadsv3.showAds = function () {
        // Check if iframe is supported
        var bframesupport = true;
        var eframe = document.createElement("iframe");
        if (!eframe)
            bframesupport = false;

        if (typeof (scoutads_ad_inframe) != "undefined") {
            if (scoutads_ad_inframe == true) {
                bframesupport = false;
                scoutadsv3.referralurl = scoutads_ad_referral;
            }
        }

        if (!bframesupport) {
            document.write("<sc" + "ri" + "pt type=\"text/java");
            document.write("script\" ");
            document.write("src=\"http://ads.scoutads.com/adservice.ashx?pubid=" + scoutads_ad_client);
            document.write("&zoneid=" + scoutads_ad_zone);
            document.write("&ref=" + scoutadsv3.referralurl);
            if (typeof (scoutads_ad_advertiser) != "undefined")
                document.write("&ads=" + scoutads_ad_advertiser);
            document.write("&hittype=" + scoutads_ad_hittype + "\">");
            document.write("</scr" + "ipt>");
        }
        else {
            document.write("<sc" + "ri" + "pt type=\"text/java");
            document.write("script\" ");
            document.write("src=\"http://ads.scoutads.com/iadservice.ashx?pubid=" + scoutads_ad_client);
            document.write("&zoneid=" + scoutads_ad_zone);
            document.write("&ref=" + scoutadsv3.referralurl);
            if (typeof (scoutads_ad_advertiser) != "undefined")
                document.write("&ads=" + scoutads_ad_advertiser);
            document.write("&hittype=" + scoutads_ad_hittype + "\">");
            document.write("</scr" + "ipt>");
        };
    };

    scoutadsv3.referralurl = scoutadsv3.getCurrentURL();
    scoutadsv3.showAds();


    //v1.7
    // Flash Player Version Detection
    // Detect Client Browser type
    // Copyright 2005-2008 Adobe Systems Incorporated.  All rights reserved.
    var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
    var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
    var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
    function ControlVersion() {
        var version;
        var axo;
        var e;
        // NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry
        try {
            // version will be set for 7.X or greater players
            axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
            version = axo.GetVariable("$version");
        } catch (e) {
        }
        if (!version) {
            try {
                // version will be set for 6.X players only
                axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");

                // installed player is some revision of 6.0
                // GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
                // so we have to be careful. 

                // default to the first public version
                version = "WIN 6,0,21,0";
                // throws if AllowScripAccess does not exist (introduced in 6.0r47)		
                axo.AllowScriptAccess = "always";
                // safe to call for 6.0r47 or greater
                version = axo.GetVariable("$version");
            } catch (e) {
            }
        }
        if (!version) {
            try {
                // version will be set for 4.X or 5.X player
                axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
                version = axo.GetVariable("$version");
            } catch (e) {
            }
        }
        if (!version) {
            try {
                // version will be set for 3.X player
                axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
                version = "WIN 3,0,18,0";
            } catch (e) {
            }
        }
        if (!version) {
            try {
                // version will be set for 2.X player
                axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
                version = "WIN 2,0,0,11";
            } catch (e) {
                version = -1;
            }
        }

        return version;
    }
    // JavaScript helper required to detect Flash Player PlugIn version information
    function GetSwfVer() {
        // NS/Opera version >= 3 check for Flash plugin in plugin array
        var flashVer = -1;

        if (navigator.plugins != null && navigator.plugins.length > 0) {
            if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
                var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
                var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
                var descArray = flashDescription.split(" ");
                var tempArrayMajor = descArray[2].split(".");
                var versionMajor = tempArrayMajor[0];
                var versionMinor = tempArrayMajor[1];
                var versionRevision = descArray[3];
                if (versionRevision == "") {
                    versionRevision = descArray[4];
                }
                if (versionRevision[0] == "d") {
                    versionRevision = versionRevision.substring(1);
                } else if (versionRevision[0] == "r") {
                    versionRevision = versionRevision.substring(1);
                    if (versionRevision.indexOf("d") > 0) {
                        versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
                    }
                }
                var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
            }
        }
        // MSN/WebTV 2.6 supports Flash 4
        else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
        // WebTV 2.5 supports Flash 3
        else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
        // older WebTV supports Flash 2
        else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
        else if (isIE && isWin && !isOpera) {
            flashVer = ControlVersion();
        }
        return flashVer;
    }
    // When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
    function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) {
        versionStr = GetSwfVer();
        if (versionStr == -1) {
            return false;
        } else if (versionStr != 0) {
            if (isIE && isWin && !isOpera) {
                // Given "WIN 2,0,0,11"
                tempArray = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
                tempString = tempArray[1]; 		// "2,0,0,11"
                versionArray = tempString.split(","); // ['2', '0', '0', '11']
            } else {
                versionArray = versionStr.split(".");
            }
            var versionMajor = versionArray[0];
            var versionMinor = versionArray[1];
            var versionRevision = versionArray[2];
            // is the major.revision >= requested major.revision AND the minor version >= requested minor
            if (versionMajor > parseFloat(reqMajorVer)) {
                return true;
            } else if (versionMajor == parseFloat(reqMajorVer)) {
                if (versionMinor > parseFloat(reqMinorVer))
                    return true;
                else if (versionMinor == parseFloat(reqMinorVer)) {
                    if (versionRevision >= parseFloat(reqRevision))
                        return true;
                }
            }
            return false;
        }
    }
    function AC_AddExtension(src, ext) {
        if (src.indexOf('?') != -1)
            return src.replace(/\?/, ext + '?');
        else
            return src + ext;
    }
    function AC_Generateobj(objAttrs, params, embedAttrs) {
        var str = '';
        if (isIE && isWin && !isOpera) {
            str += '<object ';
            for (var i in objAttrs) {
                str += i + '="' + objAttrs[i] + '" ';
            }
            str += '>';
            for (var i in params) {
                str += '<param name="' + i + '" value="' + params[i] + '" /> ';
            }
            str += '</object>';
        }
        else {
            str += '<embed ';
            for (var i in embedAttrs) {
                str += i + '="' + embedAttrs[i] + '" ';
            }
            str += '> </embed>';
        }
        return str;
    }
    function AC_FL_RunContent() {
        var ret =
    AC_GetArgs
    (arguments, "", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
        return AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
    }
    function AC_SW_RunContent() {
        var ret =
    AC_GetArgs
    (arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
        AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
    }
    function AC_GetArgs(args, ext, srcParamName, classid, mimeType) {
        var ret = new Object();
        ret.embedAttrs = new Object();
        ret.params = new Object();
        ret.objAttrs = new Object();
        for (var i = 0; i < args.length; i = i + 2) {
            var currArg = args[i].toLowerCase();
            switch (currArg) {
                case "classid":
                    break;
                case "pluginspage":
                    ret.embedAttrs[args[i]] = args[i + 1];
                    break;
                case "src":
                case "movie":
                    args[i + 1] = AC_AddExtension(args[i + 1], ext);
                    ret.embedAttrs["src"] = args[i + 1];
                    ret.params[srcParamName] = args[i + 1];
                    break;
                case "onafterupdate":
                case "onbeforeupdate":
                case "onblur":
                case "oncellchange":
                case "onclick":
                case "ondblclick":
                case "ondrag":
                case "ondragend":
                case "ondragenter":
                case "ondragleave":
                case "ondragover":
                case "ondrop":
                case "onfinish":
                case "onfocus":
                case "onhelp":
                case "onmousedown":
                case "onmouseup":
                case "onmouseover":
                case "onmousemove":
                case "onmouseout":
                case "onkeypress":
                case "onkeydown":
                case "onkeyup":
                case "onload":
                case "onlosecapture":
                case "onpropertychange":
                case "onreadystatechange":
                case "onrowsdelete":
                case "onrowenter":
                case "onrowexit":
                case "onrowsinserted":
                case "onstart":
                case "onscroll":
                case "onbeforeeditfocus":
                case "onactivate":
                case "onbeforedeactivate":
                case "ondeactivate":
                case "type":
                case "codebase":
                case "id":
                    ret.objAttrs[args[i]] = args[i + 1];
                    break;
                case "width":
                case "height":
                case "align":
                case "vspace":
                case "hspace":
                case "class":
                case "title":
                case "accesskey":
                case "name":
                case "tabindex":
                    ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i + 1];
                    break;
                default:
                    ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i + 1];
            }
        }
        ret.objAttrs["classid"] = classid;
        if (mimeType) ret.embedAttrs["type"] = mimeType;
        return ret;
    }

})();

function getPoweredByScoutAds(poweredid, adstyle)  {
		// Create the powered by scoutads
        var elePowered = document.createElement("a");
        //elePowered.appendChild(document.createTextNode(adInstance.poweredby));
        elePowered.id = poweredid;
		elePowered.href = "http://www.scoutads.com";
        elePowered.target = "_blank";
		elePowered.onmouseover =  function () {
		     document.getElementById('button').src='http://' + 'sandbox.scoutads.com' +'/media/powered-by-scoutads.png';
		};
		
		elePowered.onmouseout = function () {
		       document.getElementById('button').src='http://' + 'sandbox.scoutads.com' + '/media/info.gif';
		};
		
		scoutadsv3.applyStyle(elePowered, adstyle);
		
		var elePoweredImage = document.createElement("IMG");
		elePoweredImage.src = "http://" + 'sandbox.scoutads.com' + "/media/info.gif";
		elePoweredImage.id = "button";
		elePoweredImage.setAttribute('border', 'none');
        elePowered.appendChild(elePoweredImage);
		
		return elePowered;
}
