﻿function playSwf(swf)
{
    swf.TGotoLabel('/', 'start');
    swf.Play();
}

function gotoLabel(swf, label)
{
    swf.TGotoLabel('/', label);
    swf.Stop();
}

function loadSwf(div, newswf)
{
    div.innerHTML = newswf;
}

function getCurrentVersion(drp)
{
    var val = drp.options[drp.selectedIndex].value;
    return val.substring(val.indexOf(':') + 1);
}

function getCurrentVersionID(drp)
{
    var val = drp.options[drp.selectedIndex].value;
    return val.substring(0, val.indexOf(':'));
}

function customizeSnippet()
{
    var drp = getObject('_ctl0_bodyContent_drpVersions');    
    var id = getCurrentVersionID(drp);

    location.href = "customizesnippet.aspx?id=" + id;
}

function openImage(file, type, width, height)
{
    var imgWin = window.open('', 'imageWin', 'status=yes,location=no,menubar=no,personalbar=no,toolbar=no,scrollbars=no,resizable=yes,width=' + width + ',height=' + height);
    
    var path = file;
    
    switch (type)
    {
        case 'c':
            path = '/ClipArt/' + path;
            break;
        case 'b':
            path = '/Backgrounds/' + path;
            break;
    }
    
    var html = '' +
        '<html><head><title>ToonUp Snippet</title></head><body>' +
        '<p align="center">' +
        '<img src="' + path + '" alt="" /></p></body></html>';
    
    imgWin.document.write(html);
    imgWin.focus();
}

function changeURL(lnk, rad)
{
    if (getCheckedValue(rad) == "wide")
    {
        if (lnk.href.indexOf('.png') > -1)
            lnk.href = lnk.href.replace('4x3', '16x9');
        else if (lnk.href.indexOf('_wide.pot') == -1)
            lnk.href = lnk.href.replace('.pot', '_wide.pot');
    }
    else
    {
        if (lnk.href.indexOf('.png') > -1)
            lnk.href = lnk.href.replace('16x9', '4x3');
        else
            lnk.href = lnk.href.replace('_wide.pot', '.pot');
    }
}
