function itemPictureDiv(refPicture)
{
	var thePicture;
	var theWindowHeight;
	thePicture = "images/largeswatch/" + refPicture + ".jpg";
	
	var xmlHttp;
	try
	{    // Firefox, Opera 8.0+, Safari    
		xmlHttp=new XMLHttpRequest();    
	}
	
	catch (e)
	{    // Internet Explorer    
		try {xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
	
		catch (e)
		{      
			try {xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
			
			catch (e)
			{
				alert("Your browser lacks certain object/Javascript support.  Please make sure you're using a recent browser, such as Internet Explorer, Firefox, Opera 8.0+ or Safari!");
				return false;
			}
		}
    }
   xmlHttp.onreadystatechange=function()
     {
     if(xmlHttp.readyState==4)
       {
       // document.all.mainContainer.innerHTML=xmlHttp.responseText;
       document.getElementById('ImagePop' + (refPicture)).innerHTML=xmlHttp.responseText;
       }
     }
    theWindowHeight = typeof window.innerHeight != 'undefined' ? window.innerHeight : document.body.offsetHeight;
    xmlHttp.open("GET","picturediv.asp?theItem=" + thePicture,true);
    xmlHttp.send(null);
    if (theWindowHeight - (findPosY(document.getElementById(refPicture))) <=450)
        { 
            document.getElementById('ImagePop' + (refPicture)).style.top=((findPosY(document.getElementById(refPicture)) - 350) + "px"); 
        }
    else
        { 
           document.getElementById('ImagePop' + (refPicture)).style.top=((findPosY(document.getElementById(refPicture))) + "px"); 
        }
    if (findPosX(document.getElementById(refPicture))>710)
        { 
            document.getElementById('ImagePop' + (refPicture)).style.left=((findPosX(document.getElementById(refPicture)) - 340) + "px"); 
        }
    else
        { 
            document.getElementById('ImagePop' + (refPicture)).style.left=((findPosX(document.getElementById(refPicture)) + 76) + "px"); 
        }
    document.getElementById('ImagePop' + (refPicture)).style.display="block";
}

function itemPictureDivClose(refPicture)
{
    document.getElementById('ImagePop' + (refPicture)).style.display="none";
    document.getElementById('ImagePop' + (refPicture)).innerHTML="";

}


function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }
