/**
 * SetWMode
 *
 * @author Jeremiah/Alana
 * @requirements MooTools1.11
 * @classDescription A function to force the wmode attribute on all object and embed elements
 *
 **/

mdp.app.setWMode = function(){
    /* ---[ CLASS VARIABLES ]--- */

    /* public */

    /* private */

    /* ---[ CONSTRUCTOR ]--- */
    function init(){
		changeAllFlashToTransparent();
	}

    /* ---[ PUBLIC METHODS ]--- */

    /* ---[ PRIVATE METHODS ]--- */
    function changeAllFlashToTransparent(){
        var i = 0;
        /* embed - add attribute */
        var em = $('embed').each(function(){
            $(this).attr('wmode', 'transparent');
        });
        var em_op = "";

        /* object - add param tag */
        /* <param value="wmode" name="transparent"/> */
        var ob = document.getElementsByTagName('object');
        for( i = 0; i<ob.length; i++ ){

            var newParam = document.createElement('param');
                newParam.setAttribute('name',"wmode");
                newParam.setAttribute('value',"transparent");
            ob[i].appendChild(newParam);

        }
    }


    /* ---[ EVENT LISTENERS ]--- */

    /* ---[ RUN ]--- */
    init();
};

$(document).ready(function(){
    mdp.setWMode = new mdp.app.setWMode();
});

