﻿// JScript File
function displaySwatches(prod, e)
  {

        var x = 0;
        var y = 0;
        if (e.pageX || e.pageY) 	
        {
		    x = e.pageX;
		    y = e.pageY;
	    }
        else if (e.clientX || e.clientY) 	
        {
		    x = e.clientX + document.body.scrollLeft
			    + document.documentElement.scrollLeft;
		    y = e.clientY + document.body.scrollTop
			    + document.documentElement.scrollTop;
	    }

        var swatches = document.getElementById("swatches");
        swatches.style.top = (y-160) + "px";
        swatches.style.left = (x-10) + "px";
        swatches.style.visibility ="visible";
        swatches.style.display="block";
        swatches.style.postition="";
        
        GetColors(prod);
        
        
  }
  function hideSwatches()
  {
        var swatches = document.getElementById("swatches");
        var swatchcontent = document.getElementById("swatchcontent");
        swatches.style.display="none";
        swatches.style.visibility ="hidden";
        while (swatchcontent.childNodes[0])
        {
           swatchcontent.removeChild(swatchcontent.childNodes[0]);
        }
  }
  
  function GetColors(prod)
  {
    $("#swatchcontent").load("get-color-swatches.asp?idpr=" + prod);
  }
