var CurrentTimeoutTimer;
var mousex, mousey;

document.onmousemove = getXY;

//*****************************************************************************
// Function    : getXY
// Description :
// Created     : 27-10-2005
// Author      : ATP
//*****************************************************************************
function getXY(e) {
  mousex = event.clientX + document.body.scrollLeft;
  mousey = event.clientY + document.body.scrollTop;
  return true;
}

function ehOnMouseOver()
{

	//ShowImage (cImg)
	if(window.event.srcElement != null && window.event.srcElement.cImg){
		DisplayPopup(window.event.srcElement.cImg)
    window.event.srcElement.alt=''
	}
}

function ehOnMouseOut()
{
	//ShowImage (cImg)
	if(window.event.srcElement != null && window.event.srcElement.cImg){
		ClearPopup()
	}
}

//*****************************************************************************
// Function    : ClearPopup
// Description :
// Created     : 27-10-2005
// Author      : ATP
//*****************************************************************************
function ClearPopup()
{
	window.clearTimeout(CurrentTimeoutTimer);	
	ResizeDiv.className = 'PopImageHidden';
	fDoDisplayPopup = false;
}

//*****************************************************************************
// Function    : DisplayPopup
// Description :
// Created     : 27-10-2005
// Author      : ATP
//*****************************************************************************
function DisplayPopup(PopPageParam)
{
	window.clearTimeout(CurrentTimeoutTimer);	
	if (document.body != null)
	{
		if (PopPageParam != '' && PopPageParam != null) {

      var AreaHeight = 10;
      var AreaWidth  = 100;
      
      
	    if (mousex != null)
	    {
		    if (mousex < (document.body.offsetWidth-250)+50)
			    ResizeDiv.style.left		= mousex+25;
		    else
			    ResizeDiv.style.left		= mousex-(AreaWidth+70);
  				
		    if (mousey < (document.body.offsetHeight/2)+20)
			    ResizeDiv.style.top			= mousey+10;
		    else
			    ResizeDiv.style.top			= mousey-(AreaHeight+10);

			  ResizeDiv.className = 'PopImageLoading';
			  fDoDisplayPopup			= true;
			  ResizeDiv.innerHTML = 'Loading!';
			  CurrentTimeoutTimer	= window.setTimeout('DoDisplayPage(\''+ PopPageParam +'\')', 500);

	    }

		}
	}
}

//*****************************************************************************
// Function    : DoDisplayPage
// Description :
// Created     : 27-10-2005
// Author      : ATP
//*****************************************************************************
function DoDisplayPage(PopPageParam)
{
	window.clearTimeout(CurrentTimeoutTimer);	
  
  if (fDoDisplayPopup)
  {
    ResizeDiv.className = 'PopImageDisplay';
    ResizeDiv.innerHTML = '<img src=\"' + PopPageParam + '\" />';
  }
}

//*****************************************************************************
// Function    : ValidateDelete
// Description :
// Created     : 27-10-2005
// Author      : ATP
//*****************************************************************************
function ValidateDelete(strValidate)	
{
	return(confirm(strValidate))
}


function saveExtraText(strIDToSave)
{
	var theText = document.getElementById('Description' + strIDToSave);
	if (theText != null)
		document.location.href = '_print_catalog_edit_products_description.asp?PrintCatalogGroupProduct_ID=' + strIDToSave + '&Description=' + theText.value
}

function insertBlankProduct(strIDToSave)
{
	document.location.href = '_print_catalog_edit_products_insertblank.asp?PrintCatalogGroupProduct_ID=' + strIDToSave
}

