﻿// JScript File

var flag=gfLockSpecsX=false;


window.onload = Init;

function Init()
{
	/* For all images with <a>nchors
	        if the image is a nav menu item (class = "menuitem")then
	            call setupRollover()
	        if the image is to open a new window when clicked (class = "newWin") then
	            set the image's onclick event to call newWindow();
	        else
	            do nothing
	*/
	for (var i=0; i<document.images.length; i++)
	{		 	 	
		/* Note: .parentNode refers to the tag around the image tag */
		if (document.images[i].parentNode.tagName == "A")
		{
			if (document.images[i].className == "menuitem")
			    setupRollover(document.images[i]);
			    
			if (document.images[i].className == "ThumbNail")
			    setupSpecWindow(document.images[i]);

			if (document.images[i].className == "ThumbNail_spCase1")
			    setupSpecWindow(document.images[i]);
			    
		}
	}
}

function setupRollover(thisImage)
{
	thisImage.outImage = new Image();
	thisImage.outImage.src = thisImage.src;
	thisImage.onmouseout = rollOut;

	thisImage.overImage = new Image();
	thisImage.overImage.src = "images/" + thisImage.id + "_on.jpg";
	thisImage.onmouseover = rollOver;	
}

function rollOver()
{
	this.src = this.overImage.src;
}

function rollOut()
{
	this.src = this.outImage.src;
}


function setupSpecWindow(thisImage)
{
    thisImage.onmouseover = showSpecsX
    thisImage.onmouseout = hideSpecsX
    thisImage.onmouseup = showSpecsXLock
}


function showSpecs(ImgObj)
{
    if (gfLockSpecsX)
        return;

    var obj = document.getElementById("SpecsWinTitle");
    obj.firstChild.nodeValue=ImgObj.alt;

    var obj = document.getElementById("SpecsWinImage");
    if (ImgObj.className == "ThumbNail_spCase1")
    {
        var SrcFileName=ImgObj.src;
        //var FileExt=SrcFileName.slice(SrcFileName.length - 4,SrcFileName.length);
        var newSrc=SrcFileName.slice(0,SrcFileName.length - 4)+"_lg"+".jpg";
        obj.setAttribute("src", newSrc);   

    }
    else
    {
        obj.setAttribute("src", ImgObj.src);   
    }

    obj = document.getElementById("SpecsWindow");
    obj.style.zIndex = 1;
    obj.blur();
}

function hideSpecs(ImgObj)
{
    var obj = document.getElementById("SpecsWindow");
    if (!gfLockSpecsX)
    {    
        obj.style.zIndex = -1;
    }
}

function showSpecsX()
{
    var VerStr = navigator.appVersion;
        
    if (VerStr.search("MSIE 6") > 0)
        return
    else
    {
        var flag=gfLockSpecsX;
        gfLockSpecsX=false;
        showSpecs(this);
        gfLockSpecsX=flag;
    }
}


function hideSpecsX()
{    
    var VerStr = navigator.appVersion;
    
    if (VerStr.search("MSIE 6") > 0)
        return
    else
    hideSpecs(this);
}


function showSpecsXLock()
{ 
    obj = document.getElementById("CloseButton");
    obj.setAttribute("src", "images/close_button1.jpg");
    
    gfLockSpecsX=false;
    showSpecs(this);
    gfLockSpecsX=true;
    
}


function closeSpecsWin()
{
    gfLockSpecsX=false;
    var obj = document.getElementById("SpecsWindow");    
    obj.style.zIndex = -1;

    obj = document.getElementById("CloseButton");
    obj.setAttribute("src", "images/hidden_button.jpg");    
}

