<!--
//*****************************************************************************************
// Filename: Common_OpenWin.js
// Refer to /javascript/NABCommon/comments.txt for documentation on this file
//*****************************************************************************************

// Global Variables (if any)

var yes = 1;
var Y = 1;
var no = 0;
var N = 0;

var olccWin = null;

// Main piece(s) of code

function globalWindowOpen(targetURL, windowName, windowWidth, windowHeight, scrollBars,
	menuBar, toolbar, resizable, status, directories, location, leftPix, topPix)
{
	// Local Variables (if any)
	var strFeatures;
	var strCheckDefinition;
	// Validate the "windowName" variable. If the windowName has not been passed
	// then a date/time stamp will be assigned as the window name.
	strCheckDefinition = typeof windowName;
	if (strCheckDefinition == "undefined")
	{
		windowName = new Date();
		windowName = windowName.getTime();
		windowName = windowName.toString();
	}

	// Build strFeatures list depending on what variables have been passed into this
	// function.
	if ((isNaN(parseInt(windowWidth))) || (parseInt(windowWidth) == 0))
	{
		windowWidth = "700";
	}
	strFeatures = "width=" + parseInt(windowWidth);
	if ((isNaN(parseInt(windowHeight))) || (parseInt(windowHeight) == 0))
	{
		windowHeight = "500";
	}
	strFeatures += ",height=" + parseInt(windowHeight);
	if ((scrollBars == "no") || (scrollBars == "N") ||
		(scrollBars == "n") || (parseInt(scrollBars) == 0))
	{
		strFeatures += ",scrollbars=no";
	}
	else
	{
		strFeatures += ",scrollbars=yes";
	}
	if ((menuBar == "no") || (menuBar == "N") ||
		(menuBar == "n") || (parseInt(menuBar) == 0))
	{
		strFeatures += ",menubar=no";
	}
	else
	{
		strFeatures += ",menubar=yes";
	}
	if ((toolbar == "no") || (toolbar == "N") ||
		(toolbar == "n") || (parseInt(toolbar) == 0))
	{
		strFeatures += ",toolbar=no";
	}
	else
	{
		strFeatures += ",toolbar=yes";
	}
	if ((resizable == "no") || (resizable == "N") ||
		(resizable == "n") || (parseInt(resizable) == 0))
	{
		strFeatures += ",resizable=no";
	}
	else
	{
		strFeatures += ",resizable=yes";
	}
	if ((status == "no") || (status == "N") ||
		(status == "n") || (parseInt(status) == 0))
	{
		strFeatures += ",status=no";
	}
	else
	{
		strFeatures += ",status=yes";
	}
	if ((directories == "no") || (directories == "N") ||
		(directories == "n") || (parseInt(directories) == 0))
	{
		strFeatures += ",directories=no";
	}
	else
	{
		strFeatures += ",directories=yes";
	}
	if ((location == "no") || (location == "N") ||
		(location == "n") || (parseInt(location) == 0))
	{
		strFeatures += ",location=no";
	}
	else
	{
		strFeatures += ",location=yes";
	}
	if (isNaN(parseInt(leftPix)))
	{
		strFeatures += ",left=" + (screen.width/2 - parseInt(windowWidth)/2);
	}
	else
	{
		strFeatures += ",left=" + parseInt(leftPix);
	}
	if (isNaN(parseInt(topPix)))
	{
		strFeatures += ",top=" + (screen.height/2 - parseInt(windowHeight)/2);

	}
	else
	{
		strFeatures += ",top=" + parseInt(topPix);
	}
	strFeatures += ",channelmode=no";

	// Open the new window
	window.open(targetURL, windowName, strFeatures);
}

//this function is used for the 3rd party disclaimer.  Any url's that have a comma in them ie. sites other than ours that user Vignette, replace the comma with the url encoded %2C .  The page should then display correctly   -  SJB July 2002
function ext_href (url,winName,winWidth,winHeight,sBars,menuBar,toolbar,resizable,status,dir,loc,lPix,tPix) {
  if (url=="") {url="http://www.nab.com.au"};
  if (winName==null) {winName="3rd_party_disclaimer"};
  if (winWidth==null) {winWidth="100"};
  if (winHeight==null) {winHeight="500"};
  if (sBars==null) {sBars="1"};
  if (menuBar==null) {menuBar="1"};
  if (toolbar==null) {toolbar="1"};
  if (resizable==null) {resizable="1"};
  if (status==null) {status="1"};
  if (dir==null) {dir="1"};
  if (loc==null) {loc="1"};
  if (lPix==null) {lPix="1"};
  if (tPix==null) {tPix="1"};

  url= "/disclaimer/3rd_party_disclaimer.html?"+url+","+winName+","+winWidth+","+winHeight+","+sBars+","+menuBar+","+toolbar+","+resizable+","+status+","+dir+","+loc+","+lPix+","+tPix;
  globalWindowOpen(url,'winName',400,400,1,0,0,1,0,0,0,1,1);
}

function ext_href (url,winName,winWidth,winHeight,sBars,menuBar,toolbar,resizable,status,dir,loc,lPix,tPix) {
  if (url=="") {url="http://www.nab.com.au"};
  if (winName==null) {winName="3rd_party_disclaimer"};
  if (winWidth==null) {winWidth="100"};
  if (winHeight==null) {winHeight="500"};
  if (sBars==null) {sBars="1"};
  if (menuBar==null) {menuBar="1"};
  if (toolbar==null) {toolbar="1"};
  if (resizable==null) {resizable="1"};
  if (status==null) {status="1"};
  if (dir==null) {dir="1"};
  if (loc==null) {loc="1"};
  if (lPix==null) {lPix="1"};
  if (tPix==null) {tPix="1"};

  url= "/disclaimer/3rd_party_disclaimer.html?"+url+","+winName+","+winWidth+","+winHeight+","+sBars+","+menuBar+","+toolbar+","+resizable+","+status+","+dir+","+loc+","+lPix+","+tPix;
  globalWindowOpen(url,'winName',400,400,1,0,0,1,0,0,0,1,1);
}

// this ext_hrefR uses the same function as ext_href, with the exception of the 3rd_party_dislaimer.html it uses.
function ext_hrefR (url,winName,winWidth,winHeight,sBars,menuBar,toolbar,resizable,status,dir,loc,lPix,tPix) {
  if (url=="") {url="http://www.nab.com.au"};
  if (winName==null) {winName="3rd_party_disclaimer"};
  if (winWidth==null) {winWidth="100"};
  if (winHeight==null) {winHeight="500"};
  if (sBars==null) {sBars="1"};
  if (menuBar==null) {menuBar="1"};
  if (toolbar==null) {toolbar="1"};
  if (resizable==null) {resizable="1"};
  if (status==null) {status="1"};
  if (dir==null) {dir="1"};
  if (loc==null) {loc="1"};
  if (lPix==null) {lPix="1"};
  if (tPix==null) {tPix="1"};

  url= "/disclaimer/3rd_party_disclaimerR1.html?"+url+","+winName+","+winWidth+","+winHeight+","+sBars+","+menuBar+","+toolbar+","+resizable+","+status+","+dir+","+loc+","+lPix+","+tPix;
  globalWindowOpen(url,'winName',400,400,1,0,0,1,0,0,0,1,1);
}

// no new window for 3rd party
function ext_hrefR2 (url,winName,winWidth,winHeight,sBars,menuBar,toolbar,resizable,status,dir,loc,lPix,tPix) {
  if (url=="") {url="http://www.nab.com.au"};
  if (winName==null) {winName="3rd_party_disclaimer"};
  if (winWidth==null) {winWidth="100"};
  if (winHeight==null) {winHeight="500"};
  if (sBars==null) {sBars="1"};
  if (menuBar==null) {menuBar="1"};
  if (toolbar==null) {toolbar="1"};
  if (resizable==null) {resizable="1"};
  if (status==null) {status="1"};
  if (dir==null) {dir="1"};
  if (loc==null) {loc="1"};
  if (lPix==null) {lPix="1"};
  if (tPix==null) {tPix="1"};

  url= "/disclaimer/3rd_party_disclaimerR2.html?"+url+","+winName+","+winWidth+","+winHeight+","+sBars+","+menuBar+","+toolbar+","+resizable+","+status+","+dir+","+loc+","+lPix+","+tPix;
  globalWindowOpen(url,'winName',400,400,1,0,0,1,0,0,0,1,1);
}

// Global Window for OLCC
function globalWindowOpenOLCC(targetURL, windowWidth, windowHeight, scrollBars,
	menuBar, toolbar, resizable, status, directories, location, leftPix, topPix)
{
	var strFeatures;
	var windowName = "nab_olcc_win";

	if ((isNaN(parseInt(windowWidth))) || (parseInt(windowWidth) == 0))
	{
		windowWidth = "700";
	}
	strFeatures = "width=" + parseInt(windowWidth);
	if ((isNaN(parseInt(windowHeight))) || (parseInt(windowHeight) == 0))
	{
		windowHeight = "500";
	}
	strFeatures += ",height=" + parseInt(windowHeight);
	if ((scrollBars == "no") || (scrollBars == "N") ||
		(scrollBars == "n") || (parseInt(scrollBars) == 0))
	{
		strFeatures += ",scrollbars=no";
	}
	else
	{
		strFeatures += ",scrollbars=yes";
	}
	if ((menuBar == "no") || (menuBar == "N") ||
		(menuBar == "n") || (parseInt(menuBar) == 0))
	{
		strFeatures += ",menubar=no";
	}
	else
	{
		strFeatures += ",menubar=yes";
	}
	if ((toolbar == "no") || (toolbar == "N") ||
		(toolbar == "n") || (parseInt(toolbar) == 0))
	{
		strFeatures += ",toolbar=no";
	}
	else
	{
		strFeatures += ",toolbar=yes";
	}
	if ((resizable == "no") || (resizable == "N") ||
		(resizable == "n") || (parseInt(resizable) == 0))
	{
		strFeatures += ",resizable=no";
	}
	else
	{
		strFeatures += ",resizable=yes";
	}
	if ((status == "no") || (status == "N") ||
		(status == "n") || (parseInt(status) == 0))
	{
		strFeatures += ",status=no";
	}
	else
	{
		strFeatures += ",status=yes";
	}
	if ((directories == "no") || (directories == "N") ||
		(directories == "n") || (parseInt(directories) == 0))
	{
		strFeatures += ",directories=no";
	}
	else
	{
		strFeatures += ",directories=yes";
	}
	if ((location == "no") || (location == "N") ||
		(location == "n") || (parseInt(location) == 0))
	{
		strFeatures += ",location=no";
	}
	else
	{
		strFeatures += ",location=yes";
	}
	if (isNaN(parseInt(leftPix)))
	{
		strFeatures += ",left=" + (screen.width/2 - parseInt(windowWidth)/2);
	}
	else
	{
		strFeatures += ",left=" + parseInt(leftPix);
	}
	if (isNaN(parseInt(topPix)))
	{
		strFeatures += ",top=" + (screen.height/2 - parseInt(windowHeight)/2);

	}
	else
	{
		strFeatures += ",top=" + parseInt(topPix);
	}
	strFeatures += ",channelmode=no";

	// Open new window

	if (! olccWin || olccWin.closed) {
		olccWin = window.open(targetURL, windowName, strFeatures);
		olccWin.focus();
	} else {
		if (confirm("You are about to start a new NAB Credit Card application.\n\nWe have detected that you currently have an application in progress that has not been submitted. Proceeding will end the current application and discard the data you have entered.\n\nDo you wish to continue with this new application?")){
			olccWin = window.open(targetURL, windowName, strFeatures);
			olccWin.focus();
		} else {
			olccWin.focus();
		}
	}
}

//-->
