﻿// JScript File
function showSwatch(swatch, otherImageSrc, otherStyleImageSrc, swatchName, id) 
{
    imgLineDrawing = document.getElementById(window['LineImageId_' + id]);
    imgBackGround = document.getElementById(window['BackImageId_' + id]);
    imgTopStyleImageX = document.getElementById(window['imgTopStyleImage_' + id]);
   
    lblSwatchNamex = document.getElementById(window['lblSwatchName_' + id]);

    lblSwatchNamex.value = swatchName;

    if(otherImageSrc != 'N/A')
    {        
        imgLineDrawing.src = otherImageSrc;
    }
    else
    {   
        var lineDrawing = document.getElementById(window['hdnLineValue_' + id]);
  
        imgLineDrawing.src = lineDrawing.value;
        imgBackGround.src = swatch.src;
    }
    
    if(otherStyleImageSrc != 'N/A')
    {        
        imgTopStyleImageX.src = otherStyleImageSrc;
    }

}

function clearSwatch(swatch, style, origLineImagePAth, id) 
{
    imgLineDrawing = document.getElementById(window['LineImageId_' + id]);
    lblSwatchNamex = document.getElementById(window['lblSwatchName_' + id]);

    imgLineDrawing.src = origLineImagePAth;
    lblSwatchNamex.value = '';
    
    imgBackGround = document.getElementById(window['BackImageId_' + id]);
    imgBackGround.src = swatch;
    
    if(style.length>0)
    {
        imgTopStyleImageX = document.getElementById(window['imgTopStyleImage_' + id]);
        imgTopStyleImageX.src = style; 
    }
}

function ShowImagesForm(id)
{
    var oWnd = radopen("/userControls/ImageViewer.aspx?Id=" + id, "rdwImageViewer_" + id);
    oWnd.SetSize(260, 380);
    return false; 
}

function ShowImagesLibrary(id)
{
    var oWnd = radopen("/userControls/ImageLibrary.aspx?Id=" + id, "rdwImageLibrary_" + id);
    oWnd.SetSize(300, 500);
    return false; 
}

function ShowTextureForm(id)
{
    var oWnd = radopen("/userControls/TextureViewer.aspx?Id=" + id, "rdwTextureViewer_" + id);
    oWnd.SetSize(250, 320);
    return false; 
}

function ShowColoursForm(id, category)
{
    var oWnd = radopen("/userControls/ColourViewer.aspx?productId=" + id + "&categoryId=" + category, "rdwColourViewer_" + id);
    oWnd.SetSize(200, 400);
    return false; 
}
