var resize='';
var titlebar='';
var wvalue=screen.width-7;
var hvalue=screen.height-75;
var agt=navigator.userAgent.toLowerCase();
var is_major=parseInt(navigator.appVersion);
var is_ie=((agt.indexOf("msie")!=-1) && (agt.indexOf("opera")==-1));
var isNT=agt.indexOf("windows nt")!=-1;
var IE=(document.all);
var IE4=(is_ie && (is_major==4) && (agt.indexOf("msie 4")!=-1));
var IE5=(is_ie && (is_major==4) && (agt.indexOf("msie 5")!=-1));
var NS=(document.layers);
var DOM=(document.getElementById);
var isMac=(navigator.appVersion.indexOf("Mac")==-1);
var allString="document.";
allString += (IE)?"all.":(DOM)?"getElementById(\"":"";
var styleString=(IE)?".style":(DOM)?"\").style":"";
var endAllString=(DOM && !IE)?"\")":"";
var px=(DOM)?"px":"";

var beforeload=0;

function fixAlignment() {
	beforeload=1;
	var RightOffset=(IE)?185:(DOM)?188:190;
	if (IE4){RightOffset=190;}
	var siteNS6=(DOM && !IE)?3:0;
	var offTop=(NS)?".top":".offsetTop";
	var offLeft=(NS)?".left":".offsetLeft";
	var offWidth=(NS)?".clip.width":".offsetWidth";
	var offHeight=(NS)?".clip.height":".offsetHeight";
	var pageWidth=(IE)?parseInt(document.body.clientWidth):parseInt(window.innerWidth);
	var leftMenuHeight=eval(allString+"LeftMenusDiv"+endAllString+offHeight);
	if(pageWidth<780){
		pageWidth=780;
		if(!isMac){
			pageWidth=765;	//this really is for the mac, the checking at the top of this file is incorrect
		}
	}
	leftMenuHeight=512+px;

	eval(allString+"SiteMap"+styleString).left=(pageWidth-RightOffset-180)+px;



	if(isMac){
		eval(allString+"RightMenuDiv"+styleString).left=(pageWidth-RightOffset+5)+px;
		eval(allString+"SearchSite"+styleString).left=(pageWidth-RightOffset)+px;
		eval(allString+"SearchSite2"+styleString).left=(pageWidth-RightOffset)+px;		
	} else {
		eval(allString+"RightMenuDiv"+styleString).left=(pageWidth-RightOffset+25)+px;
		eval(allString+"SearchSite"+styleString).left=(pageWidth-RightOffset+5)+px;
		eval(allString+"SearchSite2"+styleString).left=(pageWidth-RightOffset+5)+px;		
	}

	eval(allString+"SiteTrack"+styleString).width=parseInt(eval(allString+"SearchSite"+styleString).left)-parseInt(eval(allString+"SiteTrack"+endAllString+offLeft))-siteNS6+px;	

	// This statement causes some anchored text not to be displayed when a page renders.

	
//	var requestanchor = document.URL.indexOf("#") != -1;
//	alert("URL: " + document.URL + "\nAnchor? " + requestanchor + "\nHash: " + window.location.hash + "\nX= " + self.pageXOffset);

	if(DOM && !IE) eval(allString+"Content"+styleString).width=parseInt(pageWidth)-parseInt(eval(allString+"Content"+endAllString).offsetLeft)-parseInt(eval(allString+"SearchSite"+endAllString+offWidth))-20+px;
	else if(IE5)   eval(allString+"Content"+styleString).width=parseInt(pageWidth)-parseInt(eval(allString+"Content"+endAllString).offsetLeft)-parseInt(eval(allString+"SearchSite"+endAllString+offWidth))-26+px;
	else           eval(allString+"Content"+styleString).width=parseInt(pageWidth)-parseInt(eval(allString+"Content"+endAllString).offsetLeft)-parseInt(eval(allString+"SearchSite"+endAllString+offWidth))-10+px;
		
	if(eval(allString+"PCHome"+endAllString)) eval(allString+"PCHome"+styleString).width=(pageWidth-RightOffset+5)+px;
	if(eval(allString+"PCElse"+endAllString)) eval(allString+"Content"+styleString).top=parseInt(eval(allString+"PCElse"+endAllString+offTop))+parseInt(eval(allString+"PCElse"+endAllString+offHeight))+px;

	var GreaterHeight=0;
	var rightHeight=parseInt(eval(allString+"RightMenuDiv"+endAllString+offHeight))+parseInt(eval(allString+"RightMenuDiv"+endAllString+offTop));
	var contentHeight=parseInt(eval(allString+"Content"+endAllString+offHeight))+parseInt(eval(allString+"Content"+endAllString+offTop));
	var menuHeight=parseInt(eval(allString+"LeftMenusDiv"+endAllString+offHeight))+parseInt(eval(allString+"LeftMenusDiv"+endAllString+offTop));


	if (IE4){
		if (contentHeight > menuHeight) contentHeight=parseInt(eval(allString+"Content"+endAllString+offHeight))+parseInt(eval(allString+"Content"+endAllString+offTop)) + 60;
	}
	if (rightHeight>GreaterHeight) GreaterHeight=rightHeight;
	if (menuHeight>GreaterHeight) GreaterHeight=menuHeight;
	if (contentHeight>GreaterHeight) GreaterHeight=contentHeight;

	eval(allString+"PageFooter"+styleString).top=parseInt(GreaterHeight + 10)+px;

	if(DOM && !IE) 	eval(allString+"PageFooter"+styleString).top=parseInt(GreaterHeight + 70)+px;
	
	var nsDrill = (NS)?"LeftMenusDiv.document.":"";

	if (menuHeight<GreaterHeight){
		var srchHeight=parseInt(eval(allString+"SearchSite2"+endAllString+offHeight));		
		var HeightDiff = GreaterHeight - menuHeight;
		var currTop = parseInt(eval(allString+nsDrill+"OptionsDiv"+endAllString+offTop));
		var NSSide	= (DOM && !IE)?60:0;
		newHeight = HeightDiff + srchHeight;
		blockHeight = eval(allString+nsDrill+"LeftBackMenuBlock"+endAllString+offHeight)
		if (!NS){
			eval(allString+"OptionsDiv"+styleString).height = (GreaterHeight + NSSide - 60) - currTop +px;
		}else{
			eval(allString+nsDrill+"LeftBackMenuBlock"+styleString).visibility = "hidden";
			eval(allString+nsDrill+"LeftBackMenuBlock"+styleString).top = (GreaterHeight-blockHeight) + px;
			eval(allString+nsDrill+"LeftBackMenuBlock"+styleString).visibility = "visible";
		}
	}

	if(NS){
		eval(allString+"SearchSite"+styleString).visibility = "visible";
		eval(allString+"SearchSite2"+styleString).visibility = "visible";
	}
	eval(allString+"Content"+styleString).visibility = "visible";
	eval(allString+"PageFooter"+styleString).visibility = "visible";
	eval(allString+"separator"+styleString).visibility = "visible";

}

var resizeWidth = (NS)?parseInt(window.innerWidth):0;
var resizeHeight = (NS)?parseInt(window.innerHeight):0;


function checkReload(){
	if(NS && (resizeWidth != parseInt(window.innerWidth) || resizeHeight != parseInt(window.innerHeight))) location.reload();
	else fixAlignment();

	
}
var hide = 1;
var hideEvent = 0;
var newposition = ""
function SFO(whichmenu) {	
	if(beforeload == 1){
		if (!NS){
			hideAllFlyOuts();
			hideSposo();
			if (whichmenu >= 6 || whichmenu > 8){			
				if (eval(allString+"quickfind"+endAllString)) eval(allString +"quickfind"+styleString).visibility="hidden";
				if(IE && eval(allString+"qf"))eval(allString+"qf"+styleString).visibility="hidden";
			}
			if (whichmenu > 0 && whichmenu < 12){			
				if (eval(allString+"ddlb1"+endAllString)) eval(allString +"ddlb1"+styleString).visibility="hidden";
			}
			if (whichmenu == 6 || whichmenu == 9){			
				if (eval(allString+"ddlb2"+endAllString)) {
					eval(allString +"ddlb2"+styleString).visibility="hidden";
					eval(allString +"ddlb3"+styleString).visibility="hidden";
				}
			}
			eval(allString +"mg"+whichmenu+styleString).visibility="visible";
			eval(allString +"SN"+whichmenu+styleString).backgroundColor="#FDEFAA";
			hideEvent = setInterval("startHide()", 1200);
			//if(IE && eval(allString+"qf"))eval(allString+"qf"+styleString).visibility="hidden";
			hide=0;
		}
	}
}
function hideAllFlyOuts() {
	if (!NS){
		for (i = 1; i < 16; i++) {
			eval(allString +"mg"+i+styleString).visibility="hidden";	
			eval(allString +"SN"+i+styleString).backgroundColor="#FFCC00";
			if (eval(allString+"quickfind"+endAllString)) eval(allString +"quickfind"+styleString).visibility="visible";
		}
		if(IE && eval(allString+"qf")) eval(allString+"qf"+styleString).visibility="visible";
		clearInterval(hideEvent);
	}
}
function startHide() {
	if (hide==1) {
		hideAllFlyOuts();
		hideSposo();
		showDDLBS();
	}
}
function showDDLBS() {
	if (eval(allString+"ddlb1"+endAllString)) {
		for (i = 1; i < 4; i++) eval(allString +"ddlb"+i+styleString).visibility="visible";	
	}
}
function sBlk(whichlayer, subLayer) {
	var whichmenu = "";
	whichmenu = "mg";
	var nsDrill = (NS)?whichmenu+whichlayer+".document.":"";
	eval(allString+nsDrill+whichmenu+whichlayer+subLayer+styleString).backgroundColor="#000000";
	hide = 0;
}
function hBlk(whichlayer, subLayer) {
	var whichmenu = "";
	whichmenu = "mg";
	var nsDrill = (NS)?whichmenu+whichlayer+".document.":"";
	eval(allString+nsDrill+whichmenu+whichlayer+subLayer+styleString).backgroundColor="#666666";
	hide = 1;
}
function showSposo() {
	hideAllFlyOuts();
	hideSposo();
	eval(allString+"SP"+styleString).visibility="visible";
	hideEvent = setInterval("startHide()", 2000);
}
function hideSposo() {
	eval(allString+"SP"+styleString).visibility="hidden";
	clearInterval(hideEvent);
}
function sBlu(subLayer) {
	if (!NS) {
		eval(allString+"SP"+subLayer+styleString).backgroundColor="#000080";
		eval(allString+"SP"+subLayer+styleString).color="#FFFFFF";
		eval(allString+"sp"+subLayer+styleString).color="#FFFFFF";
		hide = 0;
	}
}
function hBlu(subLayer) {
	if (!NS) {
		eval(allString+"SP"+subLayer+styleString).backgroundColor="#FFFFFF";
		eval(allString+"SP"+subLayer+styleString).color="#000000";
		eval(allString+"sp"+subLayer+styleString).color="#000000";
		hide = 1;
	}
}
var da = (document.all) ? 1 : 0;
var pr = (window.print) ? 1 : 0;
var mac = (navigator.userAgent.indexOf("Mac") != -1); 
function printPage() {
	hideAllFlyOuts();
	if (pr)	window.print();
	else if (da && !mac) vbPrintPage();
	else alert("Sorry, your browser doesn't support this feature.");
	return false;
}
if (da && !pr && !mac) with (document) {
	writeln('<OBJECT ID="WB" WIDTH="0" HEIGHT="0" CLASSID="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>');
	writeln('<' + 'SCRIPT LANGUAGE="VBScript">');
	writeln('Sub window_onunload');
	writeln('  On Error Resume Next');
	writeln('  Set WB = nothing');
	writeln('End Sub');
	writeln('Sub vbPrintPage');
	writeln('  OLECMDID_PRINT = 6');
	writeln('  OLECMDEXECOPT_DONTPROMPTUSER = 2');
	writeln('  OLECMDEXECOPT_PROMPTUSER = 1');
	writeln('  On Error Resume Next');
	writeln('  WB.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER');
	writeln('End Sub');
	writeln('<' + '/SCRIPT>');
}
function GoToPages1(form) {
	if (form.dest2a.options[form.dest2a.selectedIndex].value != "") {
		if (form.dest2a.options[form.dest2a.selectedIndex].value == "default.asp") {
			window.location = "default.asp";
			return true;
		}
		else {
			form.action =window.open( form.dest2a.options[form.dest2a.selectedIndex].value);
			window.location = "default.asp";
			return true;
		}
	}
	else {
		return false;
	}
}

//function GoToPages1(form){
//	var sDest = form.dest2a.options[form.dest2a.selectedIndex].value;
//	if (sDest.indexOf("http") >= 0) window.open(sDest);
//	else if (sDest.indexOf("/tools/") >= 0)	window.open(sDest, 'winCalc', 'scrollbars=yes,status=yes,width=660,height=650,resizable=yes,titlebar=no');
//	else location.href = sDest;
//}
function stripSpaces(strString){
	var returnStr="";
	for(i=0; i<strString.length; i++){
		if (!(strString.charAt(i) == ' ')) returnStr = returnStr + strString.charAt(i)
	}
	return returnStr;
}
function IsNumeric(strString){
	var strValidChars = "0123456789";
	var strChar;
	var blnResult = true;
	for (i = 0; i < strString.length && blnResult == true; i++)	{
		strChar = strString.charAt(i);
		if (strValidChars.indexOf(strChar) == -1) blnResult = false;
	}
	return blnResult;
}
function vf_sw_open() {
	pointer=window.open('/Today/Competition/voda/vodafone_mobilebanking_popup.htm', 'vf_pands_sw', 'width=635,height=420,toolbar=no,directories=no,menubar=no,status=no,resizable=no,location=no,scrollbars=1,copyhistory=no');
	pointer.focus();
	return pointer;
}
function NewWindow() {
	OpenWin = window.open("", "new", "toolbar=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes,width=785, height=580,status=yes");
}

//
// POPUPONEXIT.JS
// Popup-on-exit script library
//
// Ron MacNeil
// July 2004
//


// -- Settings ----------------------------------------------------------------

//  This CR's existance was during that of CR4049 - Personal Centre Redesign.
//  It was decided to decommission this Survey, the probability was to be set to 0 as too many files are currently impacted by CR4049.

// URL to pop up when user leaves the site or closes the browser
POPUPONEXIT_URL = "http://survey.acnielsenonline.com/OurWeb/CBA/OP3721intro.htm";
//POPUPONEXIT_URL = "http://survey.acnielsenonline.com/wi/p39630763/i.asp";

// Probability (number between 0 and 1) of popup occurring
POPUPONEXIT_PROBABILITY = 0.0;

// Further restrict the "local site" to a subpath of the site
// ie. Navigating outside of this subpath will trigger the popup
// eg. "/some/subdirectory"
POPUPONEXIT_PATHRESTRICTION = "/personal";

// Popup window options (consult a javascript reference for more info)
POPUPONEXIT_WINDOWOPTIONS = "width=600,height=440,top=20,left=20,resizable=1,scrollbars=yes,status=yes,menubar=yes";

// URL of 'popuponexit.htm' monitoring page (change if not in the same dir as other files)
POPUPONEXIT_MONITORURL = "/personal/includes/popuponexit.htm";

// Monitoring page polling interval (in milliseconds)
POPUPONEXIT_MONITORINTERVAL = 1000;

// Name of monitoring cookie
POPUPONEXIT_MONITORCOOKIE = "poemonitoring";

// Name of popup-shown cookie
POPUPONEXIT_SHOWNCOOKIE = "poeshown";

// Lifetime (in months) of cookies
POPUPONEXIT_COOKIELIFETIME = 12;

// ----------------------------------------------------------------------------


function POPUPONEXIT_Trim( s )
{
	var i = 0;
	while( true ) {
		if( s.charAt(0) == " " ) {
			s = s.substring(1,s.length);
		} else {
			break;
		}
	}
	while( true ) {
		if( s.charAt(s.length-1) == " " ) {
			s = s.substring(0,s.length-1);
		} else {
			break;
		}
	}
	return s;
}


function POPUPONEXIT_SetCookie( name, value, expires, path )
{
	if( name == null ) name = "defaultcookie";
	if( value == null ) value = "defaultvalue";
	if( expires == null ) expires = new Date();
	if( path == null ) path = "/";
	var s =
		escape( name ) + "=" + escape( value ) + ";" +
		"EXPIRES=" + expires.toGMTString() + ";" +
		"PATH=" + path + ";" +
		"HttpOnly";
	document.cookie = s;
	// "name=value;EXPIRES=Sun, 01-Feb-04 00:00:00 GMT;PATH=/";
}


function POPUPONEXIT_GetCookies()
{
	var cookiedata = new Object();
	var s = ( document.cookie || "" ) + "";
	var a = s.split( ";" );
	var a2, key, value;
	for( var i = 0; i < a.length; i++ ) {
		a2 = a[i].split( "=" );
		key = POPUPONEXIT_Trim( ( a2[0] || "" ) + "" );
		value = POPUPONEXIT_Trim( ( a2[1] || "" ) + "" );
		if( key != "" && value != "" ) {
			cookiedata[key] = value;
		}
	}
	return cookiedata;
}


function POPUPONEXIT_Initialize()
{
//	alert("POPUP_Survey");
//CR5346 - Remove Survey - code commented out to ensure survey does not display (prob. set to 0 but still displays)
//	var cookiejar = POPUPONEXIT_GetCookies();
//	if( cookiejar[POPUPONEXIT_MONITORCOOKIE] != "true" && cookiejar[POPUPONEXIT_SHOWNCOOKIE] != "true" ) {
//		window.open( POPUPONEXIT_MONITORURL, "", "width=1,height=1,top=3000,left=3000" );
//		self.focus();
//	}
}


function POPUPONEXIT_InitializeMonitor()
{
	var cookiejar = POPUPONEXIT_GetCookies();
	if( cookiejar[POPUPONEXIT_MONITORCOOKIE] == "true" || cookiejar[POPUPONEXIT_SHOWNCOOKIE] == "true" ) {
		window.close();
		return;
	}
	var expires = new Date();
	expires.setMonth( expires.getMonth() + POPUPONEXIT_COOKIELIFETIME );
	POPUPONEXIT_SetCookie( POPUPONEXIT_MONITORCOOKIE, "true", expires );
	setTimeout( "POPUPONEXIT_MonitorTick()", POPUPONEXIT_MONITORINTERVAL );
}


function POPUPONEXIT_Popup()
{
	var expires = new Date();
	expires.setMonth( expires.getMonth() + POPUPONEXIT_COOKIELIFETIME );
	POPUPONEXIT_SetCookie( POPUPONEXIT_SHOWNCOOKIE, "true", expires );
	if( Math.random() < POPUPONEXIT_PROBABILITY ) {
		window.open( POPUPONEXIT_URL, "", POPUPONEXIT_WINDOWOPTIONS );
	}
	window.close();
}


function POPUPONEXIT_MonitorTick()
{
	while( true ) {
		if( top.opener ) {
			var oldonerror = window.onerror;
			window.onerror = POPUPONEXIT_Popup;
			if( top.opener.document.domain == top.document.domain ) {
				if( top.opener.location.pathname.substr( 0,POPUPONEXIT_PATHRESTRICTION.length ).toUpperCase() == POPUPONEXIT_PATHRESTRICTION.toUpperCase() ) {
					window.onerror = oldonerror;
					setTimeout( "POPUPONEXIT_MonitorTick()", POPUPONEXIT_MONITORINTERVAL );
					break;
				}
			}
		}
		POPUPONEXIT_Popup();
		break;
	}
}

