// EPL general javascript functions
// ********************************

	// This code check for flash on the user's computer
	// #############################################
	// these are the user defined globals
	// modify the following variables to customize the inspection behaviour

	var requiredVersion = 4;			// version the user needs to view site (max is 5, min is 2)
	var useRedirect = true; 			// "true" loads new flash or non-flash page into browser
										// "false" embeds movie or alternate html code into current page

	// set next three vars if useRedirect is true...

	var upgradePage = "upgrade.html"	// send user here if we detect an old plugin
	// #############################################
 
	// *************
	// everything below this point is internal until after the body tag
	// do not modify! 
	// *************

	// system globals
	var flash2Installed = false;		// boolean. true if flash 2 is installed
	var flash3Installed = false;		// boolean. true if flash 3 is installed
	var flash4Installed = false;		// boolean. true if flash 4 is installed
	var flash5Installed = false;		// boolean. true if flash 5 is installed
	var flash6Installed = false;		// boolean. true if flash 5 is installed
	var maxVersion = 6;					// highest version we can actually detect
	var actualVersion = 0;				// version the user really has
	var hasRightVersion = false;		// boolean. true if it's safe to embed the flash movie in the page
	var jsVersion = 1.0;				// the version of javascript supported

	// check the browser...we're looking for ie/win
	var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;		// true if we're on ie
	var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false; // true if we're on windows

	// this is a js1.1 code block, so make note that js1.1 is supported.
	jsVersion = 1.1;

	// write vbscript detection if we're not on mac.
	if(isIE && isWin){ // don't write vbscript tags on anything but ie win
		document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
		document.write('on error resume next \n');
		document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
		document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
		document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
		document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');	
		document.write('</SCR' + 'IPT\> \n'); // break up end tag so it doesn't end our script
	}

	// next comes the standard javascript detection that uses the navigator.plugins array
	// we pack the detector into a function so it loads before we run it
    
 

    
	
	function cpl_tpconfirm(windowURL)
	/**************************************************************************************
	// Description : Displays a confirmation message before redirecting to a third
	//			   : party web site.
	// Input       : windowURL - the URL of the web site being redirected to.
	//							 If the URL is not specified, the function returns true
	//							 or false depending on the button clicked, and does not
	//							 open up a new window.
	***************************************************************************************/
	{
	var msg = "You are leaving an ANZ web site to go to a Third Party web site. Any information you choose to provide on the Third Party web site is not controlled or protected by ANZ and is subject to the privacy policy of the Third Party web site operator. ANZ is not responsible for any loss, damage or inconvenience suffered by you as a result of providing information on the Third Party web site.  Do you wish to continue?";

	if (windowURL != null)
		{
		if (confirm(msg))
			newWin = window.open(windowURL);

		return;
		}
	else
		return (confirm(msg));
	}

function cpl_openPopupWindow(url, name, width, height, returnWindow)
{
	var horizontalOffset, verticalOffset, offsetAmount, windowToReturn;
		
	offsetAmount = 20;

	if(width == -1)
	{
		width = screen.availWidth;
	}
	
	if(height == -1)
	{
		height = screen.availHeight;
	}
	
	if(navigator.appName == "Microsoft Internet Explorer")
	{
		horizontalOffset = window.screenLeft + offsetAmount;
		verticalOffset = window.screenTop + offsetAmount;
	}
	else
	{
		horizontalOffset = window.screenX + offsetAmount;
		verticalOffset = window.screenY + offsetAmount;
	}
	
	if(horizontalOffset + width > screen.availWidth || verticalOffset + height > screen.availHeight)
	{
		horizontalOffset = 0;
		verticalOffset = 0;
	}
		
	windowToReturn = window.open(url, name, "toolbar=yes,location=yes,directories=0,status=yes,menubar=yes,scrollbars=1,resizable=yes,screenX=" + horizontalOffset + ",screenY=" + verticalOffset + ",left=" + horizontalOffset + ",top=" + verticalOffset + ",width=" + width + ",height=" + height);
		
	if(returnWindow == true)
		return windowToReturn;
}


function OpenWindow(s) {
  if ((screen.Height >= 0) && (screen.Width >= 0))
  {
      var height = screen.Height - 75;
      var width = screen.Width - 10;
  }
  else if ((screen.availHeight >= 0) && (screen.availWidth >= 0)) {
     
      var height = screen.availHeight - 45;
      var width = screen.availWidth - 10;
  }
     newWin = window.open(s, "newANZWeblink", "toolbar=0,status=1,location=no,menubar=no,directories=no,scrollbars=yes,resizable=yes,screenX=0,screen=0,left=0,top=0,width=" + width + ",height=" + height);
}

function OpenWindow1(s) {
       newWin = window.open(s, "Markets");
}


//********************************************************
// ANZ ONLINE SERVICES section - Log on Application & Registration
//********************************************************




function doValidate(action)
{	
		//if (document.frm01.ANZOnlineServices[document.frm01.ANZOnlineServices.selectedIndex].value!="empty")
		//{
			if (action == "LogIn") 
			{
				switch (document.frm01.ANZOnlineServices[document.frm01.ANZOnlineServices.selectedIndex].value)
					{
						case "empty":
									return(alert("Please select a service."));
						case "WebLink":
									//return(window.open('LogRedirect.asp?RedirectURL=https://anzweblink.online.anz.com/ANZWeblink/VerifyServlet', 'Weblink',"toolbar=no,location=no,directories=0,status=yes,menubar=no,scrollbars=1,resizable=yes,screenX=0,screenY=0,left=0,top=0,width=800,height=600").focus());
									return(OpenWindow('LogRedirect.asp?RedirectURL=https://anzweblink.online.anz.com/ANZWeblink/VerifyServlet'));
						case "FXOnline":
									return(window.open('LogRedirect.asp?RedirectURL=http://www.anz.com/fxonline/default.asp', 'FXOnline').focus());
						case "FXResearch":
									return(window.open('LogRedirect.asp?RedirectURL=http://www.anz.com/Markets/Research/Research.asp?setID=0,1,1', 'FXResearch').focus());					
						case "CMResearch":
									return(window.open('LogRedirect.asp?RedirectURL=http://www.anz.com/Markets/Research/Research.asp?setID=0,1,1', 'CMResearch').focus());	
						case "ANZMarkets":
									return(window.open('LogRedirect.asp?RedirectURL=http://www.anz.com/Markets/default.asp?setID=0,1', 'ANZMarkets').focus());	
						case "CMNewIssues":
									return(window.open('LogRedirect.asp?RedirectURL=http://www.anz.com/business/bonds/login.asp ', 'CMNewIssues').focus());
						case "OLS":
									return(window.open('LogRedirect.asp?RedirectURL=http://www.aolls.com/', 'OLS').focus());
						case "OnlineTradeServices":
     								//Development
     								//location = 'https://www.online.ecom.anz/trade/tradeanzlogin.asp';
     								
     								//Production
     								//location = 'https://www.online.anz.com/trade/tradeanzlogin.asp';
     								
     								//return(window.open('LogRedirect.asp?RedirectURL=https://www.online.anz.com/trade/tradeanzlogin.asp', 'OnlineTradeServices').focus());	
     								return(cpl_openPopupWindow('LogRedirect.asp?RedirectURL=https://www.online.anz.com/trade/tradeanzlogin.asp', 'OnlineTradeServices',780,500,true).focus());
						case "CTAS":
									location = 'https://www.online.anz.com/corporate/ctas/controlledmonies/CMHomePage1.asp';
									return(location);
						case "CAE":
									//Development
									//location = 'https://www.online.ecom.anz/carbe/default.asp';
									
									//Production
									//location = 'https://www.online.anz.com/carbe/default.asp';
									
									//return(window.open('LogRedirect.asp?RedirectURL=https://www.online.anz.com/carbe/default.asp', 'CAE').focus());	
									return(cpl_openPopupWindow('LogRedirect.asp?RedirectURL=https://www.online.anz.com/carbe/default.asp', 'CAE',780,500,true).focus());
						case "EPL":
									//Development
									//location = 'https://www.online.ecom.anz/epl/';
									
									//Production
									//location = 'https://www.online.anz.com/epl/';
									return(cpl_openPopupWindow('LogRedirect.asp?RedirectURL=https://www.online.anz.com/epl/', 'EPL',780,500,true).focus());
									//return(window.open('LogRedirect.asp?RedirectURL=https://www.online.anz.com/epl/', 'EPL').focus());	
						case "ANZImpact":
									return(window.open('LogRedirect.asp?RedirectURL=https://www.online.anz.com/anzimpact/internetlogin.asp', 'ANZImpact').focus());
						case "ANZConnect":
									return(window.open('LogRedirect.asp?RedirectURL=http://www.anz.com/connect/vst_select.asp', 'ANZConnect').focus());
						case "CMOnline": 	
						            return(window.open('LogRedirect.asp?RedirectURL=https://www.anz.com/gcmonline', 'CMOnline').focus());
						case "Supplier": 	
						            return(window.open('LogRedirect.asp?RedirectURL=https://www.online.anz.com/corporate/tradeportal/SP/home.asp', 'CMOnline').focus());	            
				}//end switch						
			}	
			
			else if (action == "Reg")
			{
				switch (document.frm01.ANZOnlineServices[document.frm01.ANZOnlineServices.selectedIndex].value)
					{
						case "empty":
									return(alert("Please select a service."));
						case "WebLink":
									return(window.open('LogRedirect.asp?RedirectURL=http://www.anz.com/aus/corporate/Contactus.asp#5', 'WebLink_Reg').focus());
						case "FXOnline":
									return(window.open('LogRedirect.asp?RedirectURL=http://www.anz.com/fxonline/contact.asp', 'FXOnline_Reg').focus());
						case "FXResearch":
									return(window.open('LogRedirect.asp?RedirectURL=http://www.anz.com/Markets/Research/Research.asp?setID=0,1,1', 'FXResearch_Reg').focus());			
						case "CMResearch":
									return(window.open('LogRedirect.asp?RedirectURL=http://www.anz.com/Markets/Research/Research.asp?setID=0,1,1', 'CMResearch_Reg').focus());			
						case "ANZMarkets":
									return(window.open('LogRedirect.asp?RedirectURL=http://www.anz.com/Markets/default.asp?setID=0,1', 'ANZMarkets_Reg').focus());			
						case "CMNewIssues":
									location.href="mailto:anzmarkets@anz.com";
									return;
						case "OLS":
									return(window.open('LogRedirect.asp?RedirectURL=http://www.anz.com/ols/ContactUs.asp', 'OLS_Reg').focus());
						case "OnlineTradeServices":
									//return(window.open('LogRedirect.asp?RedirectURL=http://anz.dev.anz/aus/corporate/Trade/Online.asp', 'OnlineTradeServices_Reg').focus());
									location.href='http://www.anz.com/aus/corporate/Trade/Online.asp';
									return;
						case "CTAS":
									return(window.open('LogRedirect.asp?RedirectURL=http://www.anz.com/Business/transaction_banking/customised_accounts/CA_ctas.asp', 'CTAS_Reg').focus());
						case "CAE":	
									//Development
									//return(window.open('LogRedirect.asp?RedirectURL=http://devanz.ecom.anz/ANZInternetAccess/default.asp', 'CAE_Reg').focus());
									
									//Production
									return(window.open('LogRedirect.asp?RedirectURL=http://www.anz.com/ANZInternetAccess/default.asp', 'CAE_Reg').focus());									
						case "EPL":
									//Development
									//return(window.open('LogRedirect.asp?RedirectURL=http://devanz.ecom.anz/business/corporatebanking/', 'EPL_Reg').focus());			
									
									//Production
									//return(window.open('LogRedirect.asp?RedirectURL=http://anz.dev.anz/aus/corporate/CMTS/ElectronicBanking/portal.asp', 'EPL_Reg').focus());
									location.href='http://www.anz.com/aus/corporate/CMTS/ElectronicBanking/portal.asp';
									return;
						case "ANZImpact":
									return(window.open('LogRedirect.asp?RedirectURL=Example.htm', 'ANZImpact_Reg').focus());
						case "ANZConnect":
									return(window.open('LogRedirect.asp?RedirectURL=http://www.anz.com/connect/vst_select.asp', 'ANZConnect').focus());	
						case "CMOnline": 	
						            //return(window.open('LogRedirect.asp?RedirectURL=http://www.anz.com/Business/investment_banking/global_capital_markets/ANZGCMOnline.asp', 'CMOnline_reg').focus());	
						            location.href='mailto:CapitalMarketsOnline@anz.com';
						            return;
						case "Supplier": 	
						            location.href = "http://www.online.anz.com/Corporate/";
									return;   
					
					}
					
			}
			
			
			else if (action == "Demo")
			{
				switch (document.frm01.ANZOnlineServices[document.frm01.ANZOnlineServices.selectedIndex].value)
					{
						case "empty":
									//Development
									//return(window.open('LogRedirect.asp?RedirectURL=http://www.anz.com/aus/corporate/CMTS/ElectronicBanking/Demos.asp', 'general_Demo').focus());
									
									//Production
									return(window.open('LogRedirect.asp?RedirectURL=http://www.anz.com/aus/corporate/CMTS/ElectronicBanking/Demos.asp') .focus());
						case "WebLink":
									return(cpl_openPopupWindow('LogRedirect.asp?RedirectURL=http://www.anz.com/Business/investment_banking/ANZWebLink/display.asp', 'Weblink_Demo',780,500,true).focus());
						case "FXOnline":
									//return(cpl_openPopupWindow('LogRedirect.asp?RedirectURL=http://www.anz.com/Business/Investment_Banking/Global_Foreign_Exchange/Stream/', 'FXOnline_Demo',780,500,true).focus());
									
									return(window.open('LogRedirect.asp?RedirectURL=http://demo.fxonline.anz.com/', 'CMResearch_Demo').focus());
									
						case "FXResearch":
									return(window.open('LogRedirect.asp?RedirectURL=http://www.anz.com/Markets/Research/Research.asp?setID=0,1,1', 'FXResearch_Demo').focus());
						case "CMResearch":
									return(window.open('LogRedirect.asp?RedirectURL=http://www.anz.com/Markets/Research/Research.asp?setID=0,1,1', 'CMResearch_Demo').focus());			
						case "ANZMarkets":
									return(window.open('LogRedirect.asp?RedirectURL=http://www.anz.com/Markets/default.asp?setID=0,1', 'ANZMarkets_Demo').focus());	
						case "CMNewIssues":
									return(window.open('LogRedirect.asp?RedirectURL=http://www.anz.com/business/investment_banking/global_capital_markets/GCM_newissuesite.asp', 'CMNewIssues_Demo').focus());
						case "OLS":
									return(cpl_openPopupWindow('LogRedirect.asp?RedirectURL=http://www.anz.com/ols/presentation.htm', 'OLS_Demo', 556, 324,"").focus());
						case "OnlineTradeServices":				
									//Development
									//return(window.open('LogRedirect.asp?RedirectURL=http://devanz.ecom.anz/aus/promo/TradeServices/TradeServices.asp', 'OnlineTradeServices_Demo', 'toolbar=no,scrollbars=yes,resize=yes,width=800,height=600').focus());
									//Production
									return(window.open('LogRedirect.asp?RedirectURL=http://www.anz.com/aus/promo/TradeServices/TradeServices.asp', 'OnlineTradeServices_Demo', 'location=yes,menubar=yes,toolbar=yes,scrollbars=yes,resize=yes,width=800,height=600').focus());									
						case "CTAS":
									return(window.open('LogRedirect.asp?RedirectURL=http://www.anz.com/Business/transaction_banking/customised_accounts/CTAS.asp', 'CTAS_Demo').focus());
						case "CAE":
									//Development
									//return(window.open('LogRedirect.asp?RedirectURL=http://devanz.ecom.anz/ANZInternetAccess/default.asp', 'CAE_Demo').focus());
									
									//Production
									return(window.open('LogRedirect.asp?RedirectURL=http://www.anz.com/ANZInternetAccess/default.asp', 'CAE_Demo').focus());
									
						case "EPL":
									//Development
									//return(window.open('LogRedirect.asp?RedirectURL=http://devanz.ecom.anz/business/corporatebanking/', 'EPL_Demo').focus());			
									
									//Production
									//return(window.open('LogRedirect.asp?RedirectURL=http://anz.dev.anz/aus/corporate/CMTS/ElectronicBanking/portal.asp', 'EPL_Demo').focus());
									location.href='http://www.anz.com/aus/corporate/CMTS/ElectronicBanking/portal.asp';
									return;
						case "ANZImpact":
									return(window.open('LogRedirect.asp?RedirectURL=Example.htm', 'ANZImpact_Demo').focus());
						case "ANZConnect":
									return(window.open('LogRedirect.asp?RedirectURL=http://www.anz.com/connect/vst_select.asp', 'ANZConnect').focus());									
						//case "CMOnline":  
						            //production
						          //  return(cpl_openPopupWindow('LogRedirect.asp?RedirectURL=http://www.anz.com/Business/investment_banking/global_capital_markets/stream/default.asp ', 'CMOnline_Demo',766,500,true).focus());
						case "Supplier": 	
						            location.href = "http://www.online.anz.com/Corporate/";
									return;           
				} //end switch
			          
	         }		
			else if (action == "FlashDemo")
			{
				switch (document.frm01.ANZOnlineServices[document.frm01.ANZOnlineServices.selectedIndex].value)
					{
						
						case "empty":
									location.href = "http://www.online.anz.com/corporate/";
									return;
						case "FXOnline":
									//Development
									//return(cpl_openPopupWindow('LogRedirect.asp?RedirectURL=http://anz.dev.anz/Business/Investment_Banking/Foreign_Exchange/Stream/', 'FXOnline_Demo',780,500,true).focus());
									
									//Production
									return(cpl_openPopupWindow('LogRedirect.asp?RedirectURL=http://www.anz.com/Business/Investment_Banking/Foreign_Exchange/Stream/', 'FXOnline_Demo',780,500,true).focus());
									
						case "CMOnline":  
						            //production
						            return(cpl_openPopupWindow('LogRedirect.asp?RedirectURL=http://www.anz.com/Business/investment_banking/global_capital_markets/stream/default.asp ', 'CMOnline_Demo',766,500,true).focus());			
						
					} //end switch
			          
	         }
	document.frm01.submit();
	//	}
	//	else
	//	{
	//		alert("Please select a service.");	
	//	}
}







function Tradeanz_openWindow(url) 
{
	window.open(url,"","width=725,height=550,toolbar=yes,menubar=yes,status=no,resizable=yes,scrollbars=yes,location=yes");
}

//*************************************
//rollover menu bar
//*************************************

if (document.images) { 
  
  img1on = new Image(); 
  img1on.src = "/common/img/pics/au/cfs/CorporatePortal/header/btn_cashmngt01_over.gif"; 
  
  img1off = new Image(); 
  img1off.src = "/common/img/pics/au/cfs/CorporatePortal/header/btn_cashmngt01.gif"; 
  
  img2on = new Image(); 
  img2on.src = "/common/img/pics/au/cfs/CorporatePortal/header/btn_finsoln01_over.gif"; 
  
  img2off = new Image(); 
  img2off.src = "/common/img/pics/au/cfs/CorporatePortal/header/btn_finsoln01.gif"; 
  
  img3on = new Image(); 
  img3on.src = "/common/img/pics/au/cfs/CorporatePortal/header/btn_trdfin01_over.gif"; 
  
  img3off = new Image(); 
  img3off.src = "/common/img/pics/au/cfs/CorporatePortal/header/btn_trdfin01.gif"; 
  
  img4on = new Image(); 
  img4on.src = "/common/img/pics/au/cfs/CorporatePortal/header/btn_bizemp01_over.gif"; 
  
  img4off = new Image(); 
  img4off.src = "/common/img/pics/au/cfs/CorporatePortal/header/btn_bizemp01.gif";
  
  img5on = new Image(); 
  img5on.src = "/common/img/pics/au/cfs/CorporatePortal/header/btn_markets01_over.gif"; 
  
  img5off = new Image(); 
  img5off.src = "/common/img/pics/au/cfs/CorporatePortal/header/btn_markets01.gif"; 
  
  img6on = new Image(); 
  img6on.src = "/common/img/pics/au/cfs/CorporatePortal/header/btn_corpstr01_over.gif"; 
  
  img6off = new Image(); 
  img6off.src = "/common/img/pics/au/cfs/CorporatePortal/header/btn_corpstr01.gif"; 
  
} 

function imgOn(imgName) { 
  if (document.images) { 
    document.images[imgName].src = eval(imgName + "on.src"); 
  } 
}
 
function imgOff(imgName) { 
  if (document.images) { 
    document.images[imgName].src = eval(imgName + "off.src"); 
  } 
} 



//**************************
// The following functions are used to determine if a flash compatible browser 
// is installed & if flash is installed.
//**************************
// browser detection variables
//
//

var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,thestring;

// flash detection variables
//
//

var flashInstalled, flashVersion, MSDetect;

// browser detection functions
//
//

function getBrowserInfo()
{ 
  
   

	if (checkIt('konqueror'))
	{
		browser = "Konqueror";
		OS = "Linux";
	}
	else if (checkIt('omniweb')) browser = "OmniWeb"
	else if (checkIt('opera')) browser = "Opera";
	else if (checkIt('webtv')) browser = "WebTV";
	else if (checkIt('icab')) browser = "iCab";
	else if (checkIt('msie')) browser = "Internet Explorer";
	else if (!checkIt('compatible'))
	{
		browser = "Netscape Navigator";
		version = detect.charAt(8);
	}
	else browser = "An unknown browser";

	if (!version) version = detect.charAt(place + thestring.length);

	if (!OS)
	{
		if (checkIt('linux')) OS = "Linux";
		else if (checkIt('x11')) OS = "Unix";
		else if (checkIt('mac')) OS = "Mac";
		else if (checkIt('win')) OS = "Windows";
		else OS = "an unknown operating system";
	}
}

function checkIt(string)
{
    
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}

// flash detection functions
//
//

function getFlashInfo ()
{
	if(navigator.plugins && navigator.plugins.length)
	{
		var x = navigator.plugins["Shockwave Flash"];
		if (x)
		{
			flashInstalled = 2;
			if (x.description)
			{
				var y = x.description;
				flashVersion = y.charAt(y.indexOf('.') - 1);
			}
			else
				flashInstalled = false;

			if (navigator.plugins["Shockwave Flash 2.0"])
			{
				flashInstalled = true;
				flashVersion = 2;
			}
		}
		else if (navigator.mimeTypes && navigator.mimeTypes.length)
		{
			var x = navigator.mimeTypes['application/x-shockwave-flash'];
   
			if (x && x.enabledPlugin)
				flashInstalled = true;
			else
				flashInstalled = false;
		}
	}
}

	

