
//
// Corporate Web Site : JavaScript\Interactive.js
// Yi Yang 
// 08-02-2004 
//

// disable the right click context menu
var isNS = (navigator.appName == "Netscape") ? 1 : 0;
var EnableRightClick = 0;

if(isNS)
{ 
	document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP);
}

function mischandler()
{
  if(EnableRightClick==1){ return true; }
  else {return false; }
}

function mousehandler(e)
{
  if(EnableRightClick==1){ return true; }
  var myevent = (isNS) ? e : event;
  var eventbutton = (isNS) ? myevent.which : myevent.button;
  if((eventbutton==2)||(eventbutton==3)) return false;
}

function keyhandler(e) 
{
  var myevent = (isNS) ? e : window.event;
  if (myevent.keyCode==96)
    EnableRightClick = 1;
  return;
}

document.oncontextmenu = mischandler;
document.onkeypress = keyhandler;
document.onmousedown = mousehandler;
document.onmouseup = mousehandler;

// invoke a proper file in another window
function OpenNewWindow(FileName)
{
	if (document.title.indexOf('Bank') > -1 | document.title.indexOf('Credit Union') > -1 | document.title.indexOf('General Information') > -1) 
	{
		if (document.title.indexOf('Why Card Programs') > -1 | document.title.indexOf('Card Processing Suite') > -1) 
		{
			folders = FileName.split("/");
			if (folders[0] == "GeneralInfo" | folders[0] == FileName)
				window.open('../../' + FileName);
			else
				window.open('../' + folders[1] + '/' + folders[2]);
		}
		else
			window.open('../' + FileName);
	} 
	else 
	{
		window.open(FileName);
	}
}

// make a proper link in menus
function LinkTo(FileName)
{
	if (document.title.indexOf('Bank') > -1 | document.title.indexOf('Credit Union') > -1 | document.title.indexOf('General Information') > -1) 
	{
		if (document.title.indexOf('Why Card Programs') > -1 | document.title.indexOf('Card Processing Suite') > -1) 
		{
			folders = FileName.split("/");
			if (folders[0] == "GeneralInfo" | folders[0] == FileName)
				return "../../" + FileName;
			else
				return "../" + folders[1] + "/" + folders[2];
		}
		else
			return "../" + FileName;
	} 
	else 
	{
		return FileName;
	}
}


