function viewDownloadFile(xFilename)
{
    if(xFilename.length > 0)
    {
         Shadowbox.open({
            content:    xFilename,
            player:     "iframe",
            title:      "File Viewer",
            height:     580,
            width:      780
        });
    }
}

/**
 *
 * @access public
 * @return void
 **/
function clearDimProducts()
{
    var oForm = document.frmDownloads;

    if(oForm)
    {
        var iSelectedRange = oForm.dimrange[oForm.dimrange.selectedIndex].value;
        var arrProdParts;
        var iOptionCounter = 0;
        for(var i=0; i < oForm.dimproduct.options.length; i++)
        {
            oForm.dimproduct.options[i] = null;
        }
    }
}

function refreshDimProducts()
{
    var oForm = document.frmDownloads;

    if(oForm)
    {
        if((jdimdownloadids != null) && (jdimdownloadvalues != null))
        {
            clearDimProducts();

            var iSelectedRange = oForm.dimrange[oForm.dimrange.selectedIndex].value;
            var arrProdParts;
            var iOptionCounter = 1;

            oForm.dimproduct.options[0] = new Option("Please Select Product","") ;
            for(var i=0; i < jdimdownloadids.length; i++)
            {
                if(jdimdownloadids[i].length > 0)
                {
                    arrProdParts = jdimdownloadids[i].split('_');

                    if(arrProdParts[0] == iSelectedRange)
                    {
                        oForm.dimproduct.options[iOptionCounter] = new Option(jdimdownloadvalues[i],jdimdownloadids[i]) ;
                        iOptionCounter++;
                    }
                }
            }

        }

        oForm.dimproduct.selectedIndex = 0;
    }
}

function viewDimensions()
{
    var oForm = document.frmDownloads;

    if(oForm)
    {
        var szSelectedProduct = oForm.dimproduct[oForm.dimproduct.selectedIndex].value;
        var szFilename = szSelectedProduct;
        var arrProductParts = szSelectedProduct.split('_');

        if(arrProductParts.length >2)
        {

            var szFilename = '';

            for(i=2; i < arrProductParts.length; i++)
            {
                if(szFilename != "")
                {
                    szFilename += "_";
                }
                szFilename += arrProductParts[i];
            }

            if(szFilename.length > 0)
            {
                 Shadowbox.open({
                    content:    'http://www.skybluecreatives.co.uk/CROSSWATER/uploads/crosswater/dimensions/' + szFilename,
                    player:     "iframe",
                    title:      "File Viewer",
                    height:     580,
                    width:      780
                });
            }
        }
    }
}

function viewVideo(yFilename)
{
    if(yFilename.length > 0)
    {
         Shadowbox.open({
            content:    yFilename,
            player:     "flv",
            title:      "File Viewer",
            height:     580,
            width:      780
        });
    }
}