<!--
//**************************************************/
//  © 1997-2004  Nortia Technologies.   All rights reserved.
//
//	File:			incLatestAddition.js		
//	Author(s):		ks
//  Created:		5/23/2004	
//	Description:	Handles events when Latest Addition items are clicked
//	Dependencies:
//	Functions:		
//	Notes:
//	TODO:		
//	History:
//		
//**************************************************/


//--------------------------------------------------------------------------------------
//Public Function ShowLatestAdditionItem()
//Usage:	launches a latest addition link
//
//Input:	code - the component code or custom component pcode
//			id	 - the id of the item to display
//Output:	
//Notes:	

function ShowLatestAdditionItem(code, id)
{	
	var href = document.location.href.toLowerCase();
	var root = href.indexOf("/content")
			
	if (root!=-1) // found the site root, add the path to the display page
	{
		href = href.slice(0, root+1);
		href += "Custom/LatestAddition/conLAItem.asp?id=" + id + "&OrgID=" + OrgID + "&LangID=" + LangID;
					
		OpenItemWin(href, "LAItem", 640, 480);
	}

}

function ShowLatestAdditionItemPage(code, id)
{	
	var idField = document.getElementById("txtResLibItem");
		
	if (typeof(idField)!='undefined')
	{
		idField.value = id;
		idField.parentNode.submit();
	}
}



// opens the page to display the item
function OpenItemWin(URL, name, width, height)
{
	var win;

	if (document.all)
	    var xMax = screen.width, yMax = screen.height;
	else
	    if (document.layers)
	        var xMax = window.outerWidth, yMax = window.outerHeight;
	    else
	        var xMax = 640, yMax=480;

	var xOffset = (xMax - 640)/2;
	var yOffset = (yMax - 480)/2;
			
	win=window.open(URL,name,"width=" + width + ",height=" + height + ",resizable=yes,scrollbars=yes,screenX="+xOffset+",screenY="+yOffset+",top="+yOffset+",left="+xOffset+"");
	win.focus();
}

