  <!--
function addToFavorites() {
    var sName = '';
	if (arguments.length > 0) {
	    sName = arguments[0];
	} else {
	    if (window.document.title) {
		    sName = window.document.title; 
	    } else { 
		    alert("Sorry! Your browser doesn't support this function.");
		    return;
	    }
	}
	var sURL = '';
	if (arguments.length > 1) {
	    sURL = arguments[1];
	} else {
	    if (window.document.location) {
		    sURL = window.document.location.href; 
	    } else { 
		    alert("Sorry! Your browser doesn't support this function.");
		    return;
	    }
	}
	/*
	
	if (window.sidebar) 
	{ // Mozilla Firefox Bookmark		
	    window.sidebar.addPanel(window.document.title, window.document.location.href,"");	
        return true;
	}    
	*/
    var sCtlKey = 'CTRL-D';
    var sUserAgent = navigator.userAgent.toLowerCase();
    //alert (sUserAgent);
    if(sUserAgent.indexOf('opera') > 0) {
        sCtlKey = 'CTRL-T';
    }
    //Lightstone - fault#1371 - when using Safari, check OS as different commands are used for Windows and Mac OS X
    if(sUserAgent.indexOf('safari') > 0) {
        if((sUserAgent.indexOf('macintosh') > 0) || (sUserAgent.indexOf('os x') > 0))
            sCtlKey = 'CMD-D';
        else
            sCtlKey = 'CTRL-D';
    }
    if(sUserAgent.indexOf('msie') > 0) {
        sCtlKey = '';
    }

    switch (sCtlKey) {
        case '' :
	        if (window.external) { 
		        window.external.AddFavorite(sURL,sName) 
	        } else { 
		        alert("Sorry! Your browser doesn't support this function.");
		    }
		    break;
		default :
		    alert('Press ' + sCtlKey + ' to bookmark this page.');
		    break;
    }
	return;
}

function openPopupWindow(mypage,myname,w,h,scroll){ //opens pop-up window 

  var sABTestIds = '';
  if (arguments.length > 5) {   // AB test id.(s) supplied
    sABTestIds = arguments[5];
  }
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  var settings = 'height='+h+',';
  
  settings +='scrollbars='+scroll+',';
  settings +='resizable=yes,';
  settings +='width='+w+',';
  settings +='top='+wint+',';
  settings +='left='+winl;
  
  var sOpener = 'myWindow=window.open("' + addABTestValues(mypage, sABTestIds) + '","' + myname + '","' + settings + '");';
  //alert('sOpener - ' + sOpener);
  if(window.myWindow) myWindow.close();
  eval(sOpener);
  myWindow.focus();
}

function addABTestValues(sURL, sABTestIds) {

//  AB test value capture for multivariant testing

if (sURL.indexOf('aspx#') > 0) return sURL;

var bMVTests = false;
var oMVTests = document.getElementById('multivariant_test_on_page');
if (oMVTests) {
    if (oMVTests.getAttribute('value').toUpperCase() == 'Y') {
        bMVTests = true;
    }
}
if (sABTestIds != '') {
    bMVTests = true;
}
var oPrevTests = document.getElementById('abTestValueContainer');
if (oPrevTests) {
    if (oPrevTests.getAttribute('value').length > 0) {
        bMVTests = true;
    }
}
//if (!bMVTests) {
//    return sURL;  // No multivariant testing on this page
//}

var sTests = getABTestValues(sABTestIds);
if (oPrevTests) {
    sTests += oPrevTests.value;     // Add previous page tests
}
if (0 == sTests.length) {
    return sURL;  // No multivariant testing on this page
}

return sURL +((sURL.indexOf('?') == -1) ? '?' : '&') + 'abtests=' + sTests;
}


function getABTestValues(sABTestIds) {
var sTests = '';
var sTest = '';
var colTests = document.getElementsByName('multivariant_test_AB_value');
for (var iTestIx = 0; iTestIx < colTests.length; iTestIx++) {
    sTest = colTests[iTestIx].value;
    if (sABTestIds == '') {     // If no test selection take all
        sTests += sTest + ',';
    } else {
        if (sABTestIds.indexOf(sTest.substring(0, 3)) > -1) {
            sTests+= sTest + ',';
        }
    }    
}
return sTests;
}

// 8390 ~

function linkWithABTests(sURL, sABTestIds) {

//  Link to the url passed after adding AB test settings

window.location.href = addABTestValues(sURL, sABTestIds)
return false;

}
// ~ 8390


function expandCollapse(pPanelId) {
    var oPlus = document.getElementById('plus' + pPanelId);
    var oMinus = document.getElementById('minus' + pPanelId);
    var oFindOutMore = document.getElementById('fom' + pPanelId);
    var oDetails = document.getElementById('tp' + pPanelId);
    if (oPlus.style.display == 'none') {
        oPlus.style.display = '';
        oMinus.style.display = 'none';
        oFindOutMore.style.display = '';
        oDetails.style.display = 'none';
    } else {
        oPlus.style.display = 'none';
        oMinus.style.display = '';
        oFindOutMore.style.display = 'none';
        oDetails.style.display = '';
    }
    return false;
}

function FireButton(event) 
{
    var returnValue = true;
    
    if (EnterPressed(event))
    {
        var srcEl = (event.srcElement? event.srcElement : event.target); 
        var tagName = srcEl.tagName.toLowerCase();
        if(srcEl.type != null)
        {
            var type = srcEl.type.toLowerCase();
            var allowedElements = new Array("txtSearchAutoComplete", "BalanceTextBox", "InterestFrequencyList",
                "BorrowAmountValue", "RepaymentTermValue", "txtCSSearchAutoComplete", "txtAverageBalance",
                "txtOverdraftDays", "txtOverdraftAmount", "txtOverdraftRate", "txtCreditCard",
                "txtApplicant1GrossIncome", "txtApplicant2GrossIncome", "txtApplicant1OtherRegularIncome",
                "txtApplicant2OtherRegularIncome", "txtApplicant1MonthlyLoanPayment", "txtApplicant2MonthlyLoanPayment",
                "txtApplicant1CreditCardBalance", "txtApplicant2CreditCardBalance", "txtTerm", "txtPropertyPostcode",
                "txtNumberOfDependants", "txtDepositValue", "txtPropertyValue", "txtLoanAmountRequired",
                "txtLoansBalance", "txtLoansMonthly", "txtCCSCBalance", "txtCCSCMonthly", "txtCarFinanceBalance",
                "txtCarFinanceMonthly", "txtHPBalance", "txtHPMonthly", "txtOverdraftBalance", "txtOverdraftMonthly",
                "txtOtherBalance", "txtOtherMonthly", "txtReviewTitle", "txtReview", "txtFirstName", "txtLocation",
                "ddlHowLong", "toolpanel-branchlocator-input");

            var found = false;
            for (i = 0; i < allowedElements.length; i++)
            {
                if (srcEl.id.indexOf(allowedElements[i]) != -1)
                {
                    found = true;
                    break;
                }
            }
            if (!found)
            {
                if (!(srcEl && (tagName == "textarea" || (tagName == "input" && type != "text") || tagName == "a")))
                    returnValue = false;
            }
        }
    }
    
    return returnValue;
}

function WebForm_FireDefaultButtonAlternative(event, controlName) {
        var element = event.target || event.srcElement;
        if (EnterPressed(event) && !(element && (element.tagName.toLowerCase() == "textarea"))) {
        
        if (document.getElementsByName)
        {
            var defaultButton = document.getElementsByName(controlName)[0];
            if (defaultButton && typeof(defaultButton.click) != "undefined") {
                defaultButton.click();
                event.cancelBubble = true;
                if (event.stopPropagation) event.stopPropagation();
                return false;
            }
        }
    }
    return true;
}

function EnterPressed(e)
{
    return (e.which && e.which == 13) || (e.keyCode && e.keyCode == 13);
}


//	Function to check whether the control have valid number
	function validateInteger(e)
	{
		var key;
		var keychar;
		
		if(window.event) {
			// for IE, e.keyCode or window.event.keyCode can be used
			key = window.event.keyCode; 
		}
		else if(e.which) {
			// netscape
			key = e.which; 
		}
		else {
			// no event, so pass through
			return true;
		}

		if ( key != 37 &&
			key != 39 &&
			key != 8  &&
			key != 9  &&
			key != 46 &&
			key != 35 &&
			key != 36 &&
			key != 96 &&
			key != 97 &&
			key != 98 &&
			key != 99  &&
			key != 100 &&
			key != 101 &&
			key != 102 && 
			key != 103 &&
			key != 104 &&
			key != 105 
			)
		{
			keychar = String.fromCharCode(key);

			if ( keychar.match(/[0-9]/) )
			{
				return true;
			}
			else
			{
				return false;
			}

		}
		else
		{
				return true;
		}
	}
	
	//	Function to check whether the control have valid number
	function validateDecimal(e)
	{
		var key;
		var keychar;
		
		if(window.event) {
			// for IE, e.keyCode or window.event.keyCode can be used
			key = window.event.keyCode; 
		}
		else if(e.which) {
			// netscape
			key = e.which; 
		}
		else {
			// no event, so pass through
			return true;
		}

		if ( key != 37 &&
			key != 39 &&
			key != 8  &&
			key != 9  &&
			key != 46 &&
			key != 35 &&
			key != 36 &&
			key != 96 &&
			key != 97 &&
			key != 98 &&
			key != 99  &&
			key != 100 &&
			key != 101 &&
			key != 102 && 
			key != 103 &&
			key != 104 &&
			key != 105 && 
			key != 110 && 
			key != 190
			)
		{
			keychar = String.fromCharCode(key);

			if ( keychar.match(/[0-9]/) )
			{
				return true;
			}
			else
			{
				return false;
			}

		}
		else
		{
				return true;
		}
	}
	
	
    function IsNumeric(sText)
    {
       var ValidChars = "0123456789.";
       var IsNumber=true;
       var Char;
    	
	    if (sText.length == 0 || sText == null)
		    return IsNumber;
     
       for (i = 0; i < sText.length && IsNumber == true; i++) 
          { 
          Char = sText.charAt(i); 
          if (ValidChars.indexOf(Char) == -1) 
             {
             IsNumber = false;
             }
          }
       return IsNumber;
       
    }
    
    function IsValidChar(event, regularExpression) {
        if ( String.fromCharCode(((navigator.appVersion.indexOf('MSIE') != (-1)) ? event.keyCode : event.charCode)).search(regularExpression) != (-1)
             || ( navigator.appVersion.indexOf('MSIE') == (-1)
             && ( event.keyCode.toString().search(/^(8|9|13|45|46|35|36|37|39)$/) != (-1)
             || event.ctrlKey || event.metaKey ) ) ) 
        {
            return true;
        } 
        else 
        {
            return false;
        }
    }

    //isNaN does not work in 1.1, so IsNaN is a workaround
    function IsNaN(numberToTest) { 
	    return (numberToTest != ((numberToTest - 0) + '')); 
    }


//Lightstone [SN] : opens a fixed size, non-resizeable popup window
    function openFixedSizePopup(mypage,myname,w,h,scroll){ //opens pop-up window 


      var winl = (screen.width-w)/2;
      var wint = (screen.height-h)/2;
      var settings = 'height='+h+',';
      
      //alert('settings ' + settings);
      
          settings +='width='+w+',';
          settings +='top='+wint+',';
          settings +='left='+winl+',';
          settings +='scrollbars='+scroll+',';
          settings +='toolbar=no';
          settings +='resizable=no';
      win=window.open(mypage,myname,settings);
      //window.open(mypage,myname,settings);
      if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
     
    }
    
    function resizeWindowAndLoad(height,width)
    {
        var thisWindow;
    	
	    var LeftPosition;
	    var TopPosition;
    	
	    LeftPosition = (screen.width - width) / 2;
	    TopPosition = (screen.height - height) / 2;

        //Must move the window first, then resize...

        thisWindow = window.moveTo(LeftPosition,TopPosition);	
	    thisWindow = window.resizeTo(width,height);
    }
    
    //  8446 Add MM AB Test values to the session cookie ~
    
    var c_COOKIE_ABSESSIONNAME = "ABSessionCookie";

    function saveABTestValuesToCookie() {
    
        var sABTestIds = '082083084085086091092093099104109110101102103105111058059060061117118119';
        var sABTests = '';
        var sNewABTests = getABTestValues(sABTestIds);
        
        //  Remove existing values, if in list and on page
        
        var sCurrentAB = RFSGetCookie(c_COOKIE_ABSESSIONNAME);
        var sThisABTest = '';
        if (sCurrentAB) {
            if (sCurrentAB.length > 0) {
                var iCurrentABABTestCt = parseInt(sCurrentAB.length / 5 + 1);
                for (var iCurrentABABTestIx = 0; iCurrentABABTestIx < iCurrentABABTestCt; iCurrentABABTestIx++) {
                    sThisABTest = sCurrentAB.substring(iCurrentABABTestIx * 5, iCurrentABABTestIx * 5 + 4);
                    if (sABTestIds.indexOf(sThisABTest.substring(0,3)) == -1) {
                        sABTests += sThisABTest + ',';
                    } else {
                        if (sNewABTests.indexOf(sThisABTest.substring(0,3)) == -1) {
                            sABTests += sThisABTest + ',';
                        }
                    }
                }
            }
        }
        
        //  Add new values
        
        sABTests += sNewABTests;
        RFSSetCookie(c_COOKIE_ABSESSIONNAME, sABTests, null, '/', 'alliance-leicester.co.uk');
    }
    
    //  ~ 8446