function menuLogout(logoutURL)
{
	var conf=confirm("Continue with logout process?");
	if (conf)
	{		
		document.location.href=logoutURL;
	}
}


function globalProductKeyDown(event)
{

	if (window.event)
	{
		var element=window.event.srcElement.nodeName;
		if (element=="TEXTAREA" || element=="INPUT" || element=="SELECT")
		{
			return;
		}
	}

	if (!event)
	{
		if( window.event ) 
		{

		    event = window.event;
		} 

		if( typeof( event.which ) == 'number' ) 
		{
			event = event.which;
		 }
	}

	if (event.keyCode==37)
	{
		if (typeof doPrevious == "function")
		{
			doPrevious();
		}
	}
	if (event.keyCode==39)
	{
		if (typeof doNextPage == "function")
		{
			doNextPage();
		}
	}
	if (event.keyCode==83 && event.ctrlKey)
	{
		if (typeof saveProduct == "function")
		{
			saveProduct();
		}
	}
	if (event.keyCode==112)
	{
		showHelpTopics();
	}
	if (event.keyCode==118)
	{
		if (typeof gotoCalculate =="function")
		{
			gotoCalculate();
		}
	}
}


function showHelpTopics()
{
	var winHelp = window.open("help/mainHelp/FastvalHelp.htm","helpWindow","height=700,width=800,resizable");
	winHelp.focus();
	//document.location.href='jsp/help/help.jsp';
}

function showUserGuide()
{
	var userGuide = window.open("help/FastvalUserGuide.pdf","helpWindow","height=700,width=800,resizable");
	userGuide.focus();
}

function showReleaseNotes()
{
	var winHelp = window.open("help/releaseNotes/FVReleaseNotes.htm","helpWindow","height=700,width=800,resizable");
	releaseNotes.focus();
}

function viewProducts()
{
	document.location.href='fastval?action=productEditor2';	
}



// This function displays the Adep keyword help popup next to the object 'div_id'
function showKeywordPopup(div_id,parent_id)
{
   var parentCtl = document.getElementById(parent_id);
   var divCtl    = document.getElementById(div_id);
   
  
   var leftpos = 0;
   var toppos = 0;

   // This javascript traverses up the object tree determining the co-ordinates of the specified 'parent_id' object
   var leftParent=parentCtl.offsetParent;
   var aTag = parentCtl;
   do {
   	aTag = aTag.offsetParent;
        leftpos += aTag.offsetLeft;
        toppos += aTag.offsetTop;
    } while(aTag.tagName!="BODY");

    leftpos+=(leftParent.offsetWidth-divCtl.offsetWidth);
   //leftpos += (parentCtl.offsetWidth);
   //leftpos -= 5; // To allow for borders etc.
   toppos+=parentCtl.offsetParent.offsetHeight;
   
   setXYPos(div_id,leftpos,toppos);
}


function hideKeywordDiv(div_id)
{
  setXYPos(div_id,-500,-500);
}



function showAdepHelp(baseurl)
{	
	//alert( "showAdepHelp -- " + baseurl ); 
    var id = event.srcElement.id;
    //var win = window.open( "help/mainHelp/Content/FastvalUserGuide/" + baseurl,"_help","resizable scrollbars, width=400,height=500");   
    var win = window.open("help/mainHelp/FastvalHelp_CSH.htm#FastvalUserGuide/" + baseurl,"helpWindow","height=700,width=800,resizable");
    
    win.focus();
}
