//
// Active X °ü·Ã IE ¼³°èº¯°æÀ¸·Î ÀÎÇÑ °¢ Ãâ·Â ±â´É ¼öÁ¤ ÇÔ¼ö
// (APPLET, EMBED ¶Ç´Â OBJECT)
//
// @@ -- Active X, APPLET´Â º°µµ·Î Ã³¸®
//

// write document contents
function docwrite(str)
{
    document.write(str);
}

function setMediaCommon(id, objURI, vWidth, vHeight , vLink, vTitle)
{
    var objType = "";

    if (vWidth == 0) vWidth = "";
    else vWidth = ' width="' + vWidth + '" ';
    if (vHeight == 0) vHeight = "";
    else vHeight = ' height="' + vHeight + '" ';

    // È®ÀåÀÚ ±¸ºÐ
    if (objURI.indexOf('.jpg') >= 0 || objURI.indexOf('.gif') >= 0 || objURI.indexOf('.png') >= 0)
        objType = "img";
    else if (objURI.indexOf('.swf') >= 0)
        objType = "swf";
    else if (objURI.indexOf('.mov') >= 0 || objURI.indexOf('.avi') >= 0 || objURI.indexOf('.mp3') >= 0)
        objType = "mov";

    switch (objType) {
        case "img":
            setImgCommon(id, objURI, vWidth, vHeight, vLink, vTitle);
            break;
        case "swf":
            setFlashCommon(id, objURI, vWidth, vHeight);
            break;
        case "mov":
            setMovieCommon(id, objURI, vWidth, vHeight);
            break;
    }
}

function setImgCommon(id, imgUri, vWidth, vHeight, vLink, vTitle)
{
    var str = '';
    if (!vLink)
        str = '<img src="' + imgUri + '" ' + vWidth + '' + vHeight + ' id="' + id + '" border="0" align="middle" /><br>';
    else
        str = vLink + '<img src="' + imgUri + '" ' + vWidth + '' + vHeight + ' id="' + id + '" border="0" align="middle" alt="'+ vTitle +'" /></a><br>';
    document.writeln(str);
}

function setFlashCommon(id, flashUri, vWidth, vHeight)
{
    var str = '';
    str  = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ' + vWidth + '' + vHeight + ' id="' + id + '" align="middle">\n';
    str += '<param name="movie" value="' + flashUri + '" />\n';
    str += '<param name="quality" value="high" /><param name="wmode" value="transparent" />\n';
    str += '<param name="bgcolor" value="#ffffff" />\n';
    str += '<embed src="' + flashUri + '" quality="high" wmode="transparent" bgcolor="#ffffff" ' + vWidth + '' + vHeight + ' id="' + id + '" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed>\n';
    str += '</object>\n';
    document.writeln(str);
}

function setMovieCommon(id, movieUri, vWidth, vHeight)
{
    var str = '';
    str  = '<object classid="clsid:098F2470-BAE0-11CD-B579-08002B30BFEB" ' + vWidth + '' + vHeight + ' id="' + id + '" align="middle">\n';
    str += '<param name="movie" value="' + movieUri + '" />\n';
    str += '<param name="quality" value="high" /><param name="wmode" value="transparent" />\n';
    str += '<param name="bgcolor" value="#ffffff" />\n';
    str += '<embed src="' + movieUri + '" quality="high" wmode="transparent" bgcolor="#ffffff" ' + vWidth + '' + vHeight + ' id="' + id + '" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed>\n';
    str += '</object>\n';
    document.writeln(str);
}

