var CONTACT_TEL_NUM = "0115&nbsp;901&nbsp;6000";
var bNavDisplayed=true;
function stringReplace(originalString, findText, replaceText){
var pos=originalString.indexOf(findText);
if(pos==-1||! findText)return originalString;
var lastpos=0;
var len=findText.length;
while (pos!=-1){
preString=originalString.substring(0, pos);
postString=originalString.substring(pos+len, originalString.length);
originalString=preString+replaceText+postString;
lastpos=pos;
pos=originalString.indexOf(findText,lastpos+1)
}
return originalString;
}
function goToPage(s){
var re=/ /g;
var sField=s.replace( re,"%20" );
location.href=sField
}
function isTextEmpty(textObj){
if(textObj){
return (trim(textObj.value)=="");
} else {
return false;
}
}
function ltrim(argvalue){
while (1){
if(argvalue.substring(0, 1)!= " ")
break;
argvalue=argvalue.substring(1, argvalue.length);
}
return argvalue;
}
function rtrim(argvalue){
while (1){
if(argvalue.substring(argvalue.length - 1, argvalue.length)!= " ")
break;
argvalue=argvalue.substring(0, argvalue.length-1);
}
return argvalue;
}
function trim(argvalue){
if(argvalue){
var tmpstr=ltrim(argvalue);
return rtrim(tmpstr);
} else {
return "";
}
}
function isEmailAddress( address ){
var validRegEx=/^([\w\.\-\'])+\@((\[?(\d{1,3}\.){3}(\d{1,3}){1}\]?)|(([\w-])+\.)+([\a-zA-Z]{2,4}))$/;
return ( validRegEx.test( address ) );
}
function valPostcode( postCode ){
var masks=new Array();
masks[0]='ANNANAA';
masks[1]='ANNNAA';
masks[2]='AANANAA';
masks[3]='AANNAA';
masks[4]='ANANAA';
masks[5]='ANNAA';
masks[6]='AANNNAA';
var isCodeValid=false;
if( postCode ){
var regex=/ /g;
postCode=postCode.replace( regex,'' );
postCode=postCode.toUpperCase();
var codeMatches=new Array();
for( var x=0;x < masks.length;++x ){
codeMatches[ x ]=true;
if( postCode.length==masks[ x ].length ){
for( var i=0;i < postCode.length;++i ){
if( masks[ x ].substr( i, 1 )== 'A' ){
if( ("0123456789").indexOf( postCode.substr( i, 1 ) ) != -1 ){
codeMatches[ x ]=false;
break;
}
} else {
if( ("ABCDEFGHIJKLMNOPQRSTUVWXYZ").indexOf( postCode.substr( i, 1 ) ) != -1 ){
codeMatches[ x ]=false;
break;
}
}
}
} else {
codeMatches[ x ]=false;
}
if( codeMatches[ x ] ){
isCodeValid=true;
break;
}
}
}
return isCodeValid;
}
function valPartPostcode( postCode ){
if( postCode.length > 0 ){
postCode=postCode.replace( / /g, '' );
}
switch ( postCode.length ){
case 0:
return true;
case 1:
return false;
case 2:
return ( postCode.search( /[a-zA-Z]\d/ )!=-1 );
case 3:
var oneLetter=postCode.search( /[a-zA-Z][0-9]{2}/ );
var twoLetter=postCode.search( /[a-zA-Z]{2}[0-9]/ );
var digitInMid=postCode.search( /[a-zA-Z][0-9][a-zA-Z]/ );
return ( ( oneLetter!=-1 )||( twoLetter!=-1 )||( digitInMid!=-1 ) );
case 4: case 5: case 6: case 7:
var startsWithLetter=postCode.search( /^[a-zA-Z]/ );
var hasDigit =postCode.search( /\d/ );
return ( ( startsWithLetter!=-1 )&&( hasDigit!=-1 ) );
default:
return false;
}
}
function validateFormFields(form, fields, msg){
var fieldsArray = fields.split(",");
for( var i=0;i < fieldsArray.length;++i ){
if( trim(form[trim(fieldsArray[i])].value)=="" ){
if( msg ){ alert(msg) };
return false;
}
}
return true;
}
function buildBIHeader( pageTitle, pageSubTitle, productImageFileName, isReport, isPlatinum ){
var html='';
top.PageHeader.MM_swapImage("processing","","images/processing_base.gif",1);
top.PageHeader.submitting=false;
if( top.PageHeader.getElement("hd")){
top.PageHeader.getElement("hd").style.display = isReport ? "block" : "none";
} else {
if( isPlatinum ){
var isPlatinumStyle=true;
} else {
var isPlatinumStyle=false;
}
if(isPlatinumStyle){
for( i=0;i < top.PageHeader.document.styleSheets.length;i++ ){
if( top.PageHeader.document.styleSheets[i].title == "eseries"){top.PageHeader.document.styleSheets[i].disabled = true;}
if( top.PageHeader.document.styleSheets[i].title == "sp2nonsecure"){top.PageHeader.document.styleSheets[i].disabled = true;}
if( top.PageHeader.document.styleSheets[i].title == "platinum"){top.PageHeader.document.styleSheets[i].disabled = false;}
}
}
else
{
for( i=0;i < top.PageHeader.document.styleSheets.length;i++ ){
if( top.PageHeader.document.styleSheets[i].title == "eseries"){top.PageHeader.document.styleSheets[i].disabled = false;}
if( top.PageHeader.document.styleSheets[i].title == "sp2nonsecure"){top.PageHeader.document.styleSheets[i].disabled = false;}
if( top.PageHeader.document.styleSheets[i].title == "platinum"){top.PageHeader.document.styleSheets[i].disabled = true;}
}
}
top.PageHeader.getElement("hdrtop").style.display = isPlatinumStyle ? "none" : "block";
top.PageHeader.getElement("hdrcontent").style.display = isPlatinumStyle ? "none" : "block";
top.PageHeader.getElement("hdrplatinum").style.display = isPlatinumStyle ? "block" : "none";
top.PageHeader.getElement("hdrcontentplat").style.display = isPlatinumStyle ? "block" : "none";
if(isPlatinumStyle==true){
if(isPlatinum=='YL'){
top.PageHeader.getElement("tabsplatinum").style.display = "block";
top.PageHeader.getElement("subplatinum").style.display = "block";
top.PageHeader.getElement("NLtabsplatinum").style.display = "none";
top.PageHeader.getElement("subplatinumNL").style.display = "none";
top.PageHeader.getElement( "imagesHyperlink" ).style.display = "inline";
top.PageHeader.getElement( "imagesButton" ).style.display = "inline";
}else{
top.PageHeader.getElement("tabsplatinum").style.display = "none";
top.PageHeader.getElement("subplatinum").style.display = "none";
top.PageHeader.getElement("NLtabsplatinum").style.display = "block";
top.PageHeader.getElement("subplatinumNL").style.display = "block";
top.PageHeader.getElement( "imagesHyperlink" ).style.display = "none";
top.PageHeader.getElement( "imagesButton" ).style.display = "none";
}
}else{
top.PageHeader.getElement("tabsplatinum").style.display = "none";
top.PageHeader.getElement("subplatinum").style.display = "none";
top.PageHeader.getElement("NLtabsplatinum").style.display = "none";
top.PageHeader.getElement("subplatinumNL").style.display = "none";
}
top.PageHeader.getElement("tabsplatinumCF").style.display = "none";
top.PageHeader.getElement("tabsplatinumAC").style.display = "none";
top.PageHeader.getElement("tabsplatinumLP").style.display = "none";
top.PageHeader.getElement("tabsplatinumCI").style.display = "none";
top.PageHeader.getElement("tabsplatinumDI").style.display = "none";
top.PageHeader.getElement("tabsplatinumDO").style.display = "none";
top.PageHeader.getElement("tabsplatinumAL").style.display = "none";
top.PageHeader.getElement("summary").style.display = 'block';
top.PageHeader.getElement("summaryNL").style.display = 'block';
top.PageHeader.getElement("NLtabsplatinumCF").style.display = 'none';
top.PageHeader.getElement("NLtabsplatinumAC").style.display = 'none';
top.PageHeader.getElement("NLtabsplatinumLP").style.display = 'none';
top.PageHeader.getElement("NLtabsplatinumBI").style.display = 'none';
top.PageHeader.getElement("NLtabsplatinumPR").style.display = 'none';
top.PageHeader.getElement("NLtabsplatinumAL").style.display = 'none';
}
ApplyNewHTML("divTitle", pageTitle, "PageHeader");
ApplyNewHTML("divInstructions", pageSubTitle, "PageHeader");
parent.PageHeader.getElement('divImage').innerHTML = productImageFileName ? '<img border="0" alt="Product Logo" src="' + productImageFileName + '">' : '';
}
function populateRadio(radioObject, cookiename){
if( radioObject ){
if( radioObject.length ){
var isButtonSet=false;
var radioValue=readCookie( cookiename );
for( var i=radioObject.length-1;i>=0;--i ){
if( radioValue==radioObject[i].value ){
radioObject[i].checked=true;
radioObject[i].click();
isButtonSet=true;
break;
}
}
if( ! isButtonSet ){
if( document.frmConfirmRpt&&document.frmConfirmRpt.pricefighter ){
radioValue='0020';
for( var i=radioObject.length-1;i>=0;--i ){
if( radioValue==radioObject[i].value ){
radioObject[i].checked=true;
radioObject[i].click();
isButtonSet=true;
break;
}
}
}
}
if( ! isButtonSet ){
for(var i=0;i < radioObject.length;i++){
if( radioObject[i].value!='0013'&&radioObject[i].value!='0019' ){
if(!radioObject[i].disabled){
radioObject[i].checked=true;
radioObject[i].click();
isButtonSet=true;
break;
}
}
}
}
if( ! isButtonSet ){
for(var i=0;i < radioObject.length;i++){
if(!radioObject[i].disabled){
radioObject[i].checked=true;
radioObject[i].click();
isButtonSet=true;
break;
}
}
}
} else {
radioObject.checked=true;
radioObject.click();
}
}
}
function getRadioValue(radioObject){
var radiovalue=null;
for(var x=0;x < radioObject.length;x++){
if(radioObject[x].checked){
radiovalue=radioObject[x].value;
}
}
return radiovalue;
}
function showInvoiceRef( isStaticPage, isMultiLine, numColSpan  ){
if( typeof isStaticPage == "undefined" )isStaticPage = false;
if( typeof isMultiLine == "undefined" )isMultiLine = false;
if( typeof numColSpan == "undefined" )numColSpan = "0";
var prodPath = isStaticPage ? "" : getSecureProductDirectory() + "/";
var refMandatory = ( readCookie('RefMandatory') == "true" && navigator.appName != "Netscape" );
var labelText = "Invoice Reference";
if( refMandatory ){
var idText = "MAN_DK02_INVOICEREF";
} else {
labelText += " (opt)";
var idText = "OPT_DK02_INVOICEREF";
}
document.write( '<tr><td class="inputdatalabel"  colspan="' + numColSpan + '"><label for="DK02_INVOICEREF">' + labelText + '</label></td>' );
if( isMultiLine )document.write( '</tr><tr>' );
document.write( '<td colspan="' + numColSpan + '">' );
var fieldHTML = '<input type="text" maxlength="20" name="DK02_INVOICEREF" id="' + idText + '"' +
'onfocus="displayhelp(\'focus\',\'h102\');"' +
'onblur="self.status=\'\';"' +
'onkeypress="return IfHelpkey(event,\'h102\')"/>' +
'<a href="javascript:displayhelp(\'click\',\'h102\');" tabindex="-1"' +
'onMouseOver="MM_swapImage(\'btn2_h102\',\'\',\' ' + prodPath + 'images/btn2_fieldhelp_ovr.gif\',1);"' +
'onMouseOut="MM_swapImgRestore();">' +
'<img src="' + prodPath + 'images/btn2_fieldhelp_up.gif" border="0"' +
'alt="Show Help" id="btn2_h102" align="top"/></a>';
document.write( fieldHTML );
document.write( '</td></tr>' );
}
function getProdMenuParams( accessType ){
var menuParams = [ "", "" ];
switch ( accessType ){
case "BTAR":
menuParams[ 0 ] = "sp2_bt_search.html";
menuParams[ 1 ] = "Business Reports";
break;
case "LMTD":
menuParams[ 0 ] = "sp2_ltd_search.html";
menuParams[ 1 ] = "Limited Company";
break;
case "LTDF":
menuParams[ 0 ] = "sp2_ft_search.html";
menuParams[ 1 ] = "Fast Track";
break;
case "NLTD":
menuParams[ 0 ] = "sp2_nltd_search.html";
menuParams[ 1 ] = "Non-ltd Business";
break;
case "DDIR":
menuParams[ 0 ] = "sp2_dir_search.html";
menuParams[ 1 ] = "Directors";
break;
case "LCRV":
menuParams[ 0 ] = "sp2_ltdmon_retrieval.html";
if( getProduct().toUpperCase() == "CITY" ){
menuParams[ 1 ] = "Ltd Monitoring";
} else {
menuParams[ 1 ] = "Monitoring";
}
break;
case "INTR":
menuParams[ 0 ] = "sp2_int_search.html";
menuParams[ 1 ] = "International";
break;
case "MENU":
menuParams[ 0 ] = "sp2_request.html";
menuParams[ 1 ] = "Product Menu";
break;
default:
menuParams[ 0 ]="";
menuParams[ 1 ]="";
}
return menuParams;
}
function openCDELHelp( loc ){
if( !top.PageHeader.submitting ){
var features = "height=450, width=430, top=50, left=500, scrollbars=yes";
var path = GetServerPath( "NonSecureHTTP" ) + getNonSecureProductDirectory() + "/sp_ltd_commdelphi_info.html";
openNewWindow( path, "CreditSum_Help", loc, features );
}
}
function openNltdCDELHelp( loc ){
if( ! top.PageHeader.submitting ){
var features = "height=450, width=430, top=50, left=500, scrollbars=yes";
var path = GetServerPath( "NonSecureHTTP" ) + getNonSecureProductDirectory() + "/sp_nltd_commdelphi_info.html";
openNewWindow( path, "CreditSum_Help", loc, features );
}
}
function openPrevSearchesHelp( loc ){
if( ! top.PageHeader.submitting ){
var features = "height=450, width=430, top=50, left=500, scrollbars=yes";
var path = GetServerPath( "NonSecureHTTP" ) + getNonSecureProductDirectory() + "/sp_ltd_prevsearches_info.html";
openNewWindow( path, "Previous_Search_Help", loc, features );
}
}
function openInfoText( context ){
if( ! top.PageHeader.submitting ){
var features = "height=450, width=430, top=50, left=500, scrollbars=yes";
var path = GetServerPath( "NonSecureHTTP" ) + getNonSecureProductDirectory() + "/sp_info_text_version2.html";
if(context)
{
path = path + "?" + context;
}
openNewWindow( path, "Info_Text", "", features );
}
}
function openNewWindow( fileName, windowName, location, features ){
newWindow=window.open( fileName, windowName, features );
if( location ){
newWindow.location.hash=location;
}
}
function getAcrobatHTML(phrase){
var HTML="";
HTML = '<table width="90%" border="0" cellspacing="0" cellpadding="0" class="inputlist">';
HTML += '<tr><td width="10px" rowspan="5" valign="top">&nbsp;</td>';
HTML += '<td style="font-size:5px">&nbsp;</td>';
HTML += '<td width="10px" rowspan="5" valign="bottom">&nbsp;</td></tr>';
HTML += '<tr><td style="font-size:5px">&nbsp;</td></tr>';
HTML += '<tr><td class="cmdboxtext">';
HTML+=phrase;
HTML+='<br><br></td></tr>';
HTML += '<tr><td align="center"><a href="http://www.adobe.com/products/acrobat/readstep.html" target="_blank"><img alt="Get Adobe Acrobat Reader" border="0" src="images/getacro.gif"></a>';
HTML += '</td></tr><tr><td style="font-size:5px">&nbsp;</td></tr></table>';
return HTML;
}
function formatMonthLong( monthNum ){
months = [ "January", "February", "March",
"April", "May", "June", "July",
"August", "September", "October",
"November", "December" ]
return ( ( -1 < monthNum ) && ( monthNum  < 12 ) ) ? months[ monthNum ] : "Month undetermined";
}
function getFormArgs(queryString){
var query;
if( arguments[0] ){
query=queryString;
} else {
query=location.search.substring(1);
}
var args=new Object();
var pairs = query.split(";");
for( var i=0;i < pairs.length;++i ){
var pos=pairs[i].indexOf('=');
if(pos==-1)continue;
var argname=pairs[i].substring(0, pos);
var value=pairs[i].substring(pos+1);
args[argname]=unescape(value);
args[i]=unescape(argname);
args.totelements=pairs.length;
}
return args;
}
function checkIfTPD_OptingOut( form ){
var isOptingOut=form.TPD_opt_out&&form.TPD_opt_out.checked;
if( isOptingOut ){
if(  form.chkTPD&&! form.chkTPD.checked ){
alert( "You must obtain the applicant's declaration that their " + "\n" +
"financial associates have no adverse financial data" );
return false;
}
}
return true;
}
function isTPD_Compliant(){
var cookieVal=readCookie( 'KPTD_settings' );
if( cookieVal ){
return cookieVal.slice( 0, 1 ) == "Y";
} else {
return false;
}
}
function isTPD_OptOutAllowed(){
var cookieVal=get_KPTD_settings();
if( cookieVal ){
return cookieVal.slice( 2, 3 ) == "Y";
} else {
return false;
}
}
function isTPD_OptOutForcedToYes(){
var cookieVal=get_KPTD_settings();
if( cookieVal ){
return cookieVal.slice( 2, 3 ) == "P";
} else {
return false;
}
}
function isTPD_OptOutForcedToNo(){
var cookieVal=readCookie( 'KPTD_settings' );
if( cookieVal ){
return cookieVal.slice( 2, 3 ) == "N";
} else {
return false;
}
}
function get_KPTD_settings(){
var cookieVal=readCookie( 'KPTD_settings' );
if( cookieVal ){
return cookieVal;
} else {
return "";
}
}
function storeDbValue( dbValue ){
storeCookie( "dbValue", dbValue.toUpperCase(), null, "/", null, null );
}
function showOrHideDiv( divObject, shouldBeDisplayed ){
divObject.style.display = ( shouldBeDisplayed ? "block" : "none" );
}
function SearchDirector(){
alert( "Please select 'Directors' from the menu above." );
return;
}
function clearInvoiceRefAndLengthOfOwnership(){
storeCookie( "invoiceRef", "", null, "/", null, null );
storeCookie( "ownShipYears", "", null, "/", null, null );
storeCookie( "ownShipMonths", "", null, "/", null, null );
}
function printReportMultipleOptions( nameOfPage, radioButtonSet ){
for( var i=0;i!=radioButtonSet.length-1;i++ ){
if( radioButtonSet[i].checked )break;
}
var checkedButtonNum=i;
switch ( checkedButtonNum ){
case 0:
break;
case 1:
if( top.PageContent.expandAll_1&&! top.PageContent.expandAll_1.checked )top.PageContent.expandAll_1.click();
break;
case 2:
alert( "What is a Summary?" );
break;
}
if( checkedButtonNum==1 )top.PageContent.restoreExpandedAndCollapsedRows()
}
function printReportSummary(){
document.getElementById('ReportBody').className = "displayonly";
printReport('PageContent');
document.getElementById('ReportBody').className="";
}


