﻿
function QTEmbed(movie)
{
    this.width = 239;
    this.height = 195;
    this.src = movie;
    this.autoplay=false;
    this.loop = false;
    this.starttime = null;
    this.controller = true;

    this.HTMLOut = function() {
        var p1='', p2='', i=0;
        for(var prop in this){
            i++; //counter
            if (i > 2) { //skip the first three properties src, width, height
                if (prop != 'HTMLOut'  && this[prop] != null) {
                    p1 += '     <param name="' + prop + '" value="' + this[prop] + '">\n';
                    p2 += prop + '="' + this[prop] + '" ';
                }
            }
        }
        document.write('<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="' + this.width + '" height="' + this.height +'"');
        document.write('    codebase="http://www.apple.com/qtactivex/qtplugin.cab">');
        document.write(p1);
        document.write('    <embed src="' + movie + '" width="' + this.width + '" height="' + this.height +'" pluginspage="http://www.apple.com/quicktime/" ' + p2 + '></embed>');
        document.write('</object>');
    }
}

function InsertMovie(movie, params) {
    var embed = new QTEmbed(movie);
    if (params) {
        p = params.split(",");
        for(var i = 0; i < p.length; i++) {
            var va = p[i].split("=");
            //alert(va[0] + ":" + va[1]);
            embed[va[0]] = va[1]; //set the property
        }
    }        
    embed.HTMLOut(); // print the tag
}

