/* Warning: if you will use Prototype here, check pages with 
   usePrototype == false, like /edit_portfolio.php */

function fplayer(attrs, params)
{
    var c = document.getElementById(attrs.container);
    if (document.documentElement.outerHTML) {
        var code = '<object allowFullScreen=true id="' + attrs.id + '" type="' + attrs.type + '" data="' + attrs.data + '" width="' + attrs.width + '" height="' + attrs.height + '">';

        for (var key in params) {
            code += '<param name="' + key + '" value="' + params[key] + '"/>';
        }

        code += '<\/object>';
        c.innerHTML = code;
    }
    else {
        var obj = document.createElement('object');
        obj.width  = attrs.width;
        obj.height = attrs.height;
        obj.style.width  = attrs.width + 'px';
        obj.style.height = attrs.height + 'px';
        obj.setAttribute('type', attrs.type);
        obj.setAttribute('data', attrs.data);
        obj.setAttribute('id', attrs.id);
		obj.setAttribute('allowFullScreen', 'true');

        for (var key in params) {
            var param = document.createElement('param');
            param.setAttribute('name', key);
            param.setAttribute('value', params[key]);
            obj.appendChild(param);
        }

        while (c.childNodes.length > 0) {
            c.removeChild(c.childNodes[0]);
        }
        c.appendChild(obj);
    }
    if (attrs.header)
    	document.getElementById(attrs.header).innerHTML = attrs.title;
}

function qplayer(attrs, params)
{
    var c = document.getElementById(attrs.container);
    if (document.documentElement.outerHTML) {
        var code = '<div id="movie_container_inner" style="visibility:visible"><object id="' + attrs.id + '" width="' + attrs.width + '" height="' + attrs.height + '" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B">';

        for (var key in params) {
            code += '<param name="' + key + '" value="' + params[key] + '"/>';
        }

        code += '</object></div>';
        c.innerHTML = code;
    }
    else {
        var obj = document.createElement('object');
        obj.width  = attrs.width;
        obj.height = attrs.height;
        obj.style.width  = attrs.width + 'px';
        obj.style.height = attrs.height + 'px';
        obj.setAttribute('type', attrs.type);
        obj.setAttribute('data', attrs.data);
        obj.setAttribute('id', attrs.id);

        for (var key in params) {
            var param = document.createElement('param');
            param.setAttribute('name', key);
            param.setAttribute('value', params[key]);
            obj.appendChild(param);
        }

        var div = document.createElement('DIV');
        div.setAttribute('id', 'movie_container_inner');
        div.setAttribute('style', 'visibility:visible');
        div.appendChild(obj);

        while (c.childNodes.length > 0) {
            c.removeChild(c.childNodes[0]);
        }
        c.appendChild(div);
    }
}
