﻿function HighlightPic(picNum, isHighlight)
{
    var pic = document.getElementById('leftPic' + picNum);

    if (pic.width < 150)
    {
        if (isHighlight == 1)
        {
            pic.style.MozOpacity = .7;
            pic.style.filter = "alpha(opacity=70)";
        }
        else
        {
            pic.style.MozOpacity = 1;
            pic.style.filter = "alpha(opacity=100)";
        }
    }
}

function ZoomPic(picNum)
{
    //////////////////////////////////////////////////////////////////
    //This function is called when user clicks left thumbnail image
    
    //////////////////////////////////////////////////////////////////
    //Extract page name (without extension) from URL to base image name from
    //
    var pathStart = window.location.pathname.lastIndexOf("/");
    var pathEnd = window.location.pathname.lastIndexOf(".");
    var nameBase = window.location.pathname.slice(pathStart+1, pathEnd);
    //
    //////////////////////////////////////////////////////////////////

    //////////////////////////////////////////////////////////////////
    //Build image name from page name and image clicked and call new window
    //
    //Example: page="diy_exteriorpaints", picNum=1, imageName="diy_exteriorpaints_large1"
    //
    var picWindow = window.open('zoompic.htm?pic=' + nameBase + '_l' + picNum, 'zoompicwin', 'width=1000,height=1000,resizable');
    //////////////////////////////////////////////////////////////////
}

function LoadPic()
{
    //////////////////////////////////////////////////////////////////
    //This function is called by zoompic window onload()
    
    //////////////////////////////////////////////////////////////////
    //Extract image name from query string in URL, set image source
    //        
    var pathStart = window.location.href.lastIndexOf("=");
    var picName = window.location.href.slice(pathStart+1) + ".jpg";
    document.images[0].src = "images/" + picName;
    //////////////////////////////////////////////////////////////////
    
    //////////////////////////////////////////////////////////////////
}

function ResizePic()
{
    //////////////////////////////////////////////////////////////////
    //Resize pop-up window to content based on browser.
    //Called by image onload()
    
    if (window.innerWidth) //Firefox
    {
    	iWidth = document.images[0].width-window.innerWidth;
	    iHeight = document.images[0].height-window.innerHeight;
    }
    else //IE
    {
    	iWidth = document.images[0].width - document.body.clientWidth;
	    iHeight = document.images[0].height - document.body.clientHeight;
    }
    window.resizeBy(iWidth, iHeight);
    //////////////////////////////////////////////////////////////////
}