// Product Image failed, so load a standard image.
function imageMissingError(image)
{
    // Are we currently trying to load the replacement image
    if (image.src.toLowerCase().indexOf( 'pc_ps2_xbox_360_wii_ds_gba_games.gif') == -1 )
    {
        // Its not the replacement image, so try loading the replacement image
        image.src='/Images/pc_ps2_xbox_360_wii_ds_gba_games.gif'
        return true;
    }
    else
    {
        // Failed to load the replacement image, so do nothing;
        return true;
    }
}

function ReplaceImage(image, url)
{
    if (image.src.toLowerCase().indexOf(url) == -1 )
        image.src = url;
    
    image.onerror = null;

    return true;
}

function SwapImage(image, url, attributeSourceID, altText, screenshotContainer, VideoInfoContainer)
{
    if (image.src.toLowerCase().indexOf(url) == -1 )
    {
        var element = document.getElementById( attributeSourceID );

        image.src = url;

        element.writeAttribute( {
            'onclick' :  ''
        } );
        
        element.onclick = function() {
            LoadImage( image.id, url, altText, screenshotContainer, VideoInfoContainer );
        };
    }
    
    image.onerror = null;

    return true;
}

