function buildReportToolbar( prodMenuList, outputType, showSaveButton, altPrintText, showImageButton, showMultiplePrintOptions ){
if( arguments.length < 6 ){
showMultiplePrintOptions=false;
}
if( arguments.length < 5 ){
showImageButton=false;
}
altPrintText = ( arguments.length < 4 ) ? "\'Print Report\'" : "\'" + altPrintText +"\'";
if( arguments.length < 3 ){
showSaveButton=true;
}
if( ! prodMenuList ){
prodMenuList=readCookie( 'prodMenuMajor' );
if( ! prodMenuList )prodMenuList = "MENU|";
}
var printReportFunctionText = showMultiplePrintOptions ? "printReportMultipleOptions( \'PageContent\', REPORT_PRINT_MODE )\" " : "printReport( \'PageContent\' )\" ";
var HTML_text = '<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#7f8dcc">' +
'<tr>' +
'<td width="10" height="10" border="0">&nbsp;</td>' +
'<td width="52"><a href="javascript:' + printReportFunctionText +
'onMouseOut="MM_swapImgRestore();" ' +
'onMouseOver="MM_swapImage(\'PrintButton\',\'\',\'images/btn2_prn_ovr.gif\',1)"> ' +
'<img alt=' + altPrintText + ' name="PrintButton" src="images/btn2_prn_up.gif" ' +
'border="0"></a></td>';
if( showMultiplePrintOptions ){
HTML_text +=
'<td width="230">' +
'<input id="as_onscreen" checked class="radioselect" type="radio" ' +
'name="REPORT_PRINT_MODE" value="as_onscreen" > ' +
'<label for="basic">As seen</label> ' +
'<input id="expanded" class="radioselect" type="radio" ' +
'name="REPORT_PRINT_MODE" value="expanded" > ' +
'<label for="basic">Fully Expanded</label><br> ' +
'<input id="summary" class="radioselect" type="radio" ' +
'name="REPORT_PRINT_MODE" value="summary" > ' +
'<label for="basic">Summary</label> ' +
'</td>';
}
if( showSaveButton && navigator.appName != "Netscape" ){
HTML_text += '<td width="52"><a href="javascript:top.PageContent.saveReport();" ' +
'onMouseOut="MM_swapImgRestore();" ' +
'onMouseOver="MM_swapImage(\'SaveButton\',\'\',\'images/btn2_save_ovr.gif\',1)"> ' +
'<img alt="View in mailable format" name="SaveButton" src="images/btn2_save_up.gif" ' +
'border="0"></a></td>';
}
var func=( outputType!='sample' ) ? 'top.PageContent.imageRequest( top.PageContent.frmImageRequest.DL01_REGNUMBER.value, top.PageContent.frmImageRequest )' :
'function dummy(){ return;}';
if( showImageButton ){
HTML_text += '<td width="52">' +
'<a href="javascript: ' + func + ';" ' +
'onMouseOut="MM_swapImgRestore();" ' +
'onMouseOver="MM_swapImage(\'ImagesButton\',\'\',\'images/btn2_images_ovr.gif\',1)"> ' +
'<img alt="Order Images" name="ImagesButton" src="images/btn2_images_up.gif" ' +
'border="0"></a></td>';
}
var prodMenuListMinor=readCookie( 'prodMenuMinor' );
var isUsingBusTargeter = prodMenuListMinor ? readCookie( 'prodMenuMinor' ).indexOf( "BTAR" ) != -1 : false;
var isUsingLegacyTargeting = prodMenuListMinor ? readCookie( 'prodMenuMinor' ).indexOf( "LTAR" ) != -1 : false;
var hideProductMenuLinks = readCookie( 'prodMenuMinor' ) ? readCookie( 'prodMenuMinor' ).indexOf( "HMPM" ) != -1 : false;
if( prodMenuList&&( outputType!='sample' )&& ( ! hideProductMenuLinks ) ){
var menuItems = prodMenuList.split( "|" );
for( var i=0;i!=menuItems.length;++i ){
if( isUsingBusTargeter&&i==0 ){
menuLines = getProdMenuParams( "BTAR" );
if( menuLines[ 0 ]!="" ){
HTML_text += '<td  align="center"><a class="menulink" href="' +
menuLines[ 0 ] + '" target="PageContent" title="' +
menuLines[ 1 ]+'">'+menuLines[ 1 ]+'</a><br></td>';
}
}
if( ( ! isUsingLegacyTargeting )&& ( menuItems[ i ] == "LMTD" || menuItems[ i ] == "NLTD" ) ) continue;
menuLines=getProdMenuParams( menuItems[ i ] );
if( menuLines[ 0 ]!="" ){
HTML_text += '<td  align="center"><a class="menulink" href="' +
menuLines[ 0 ] + '" target="PageContent" title="' +
menuLines[ 1 ]+'">'+menuLines[ 1 ]+'</a><br></td>';
}
}
}
if( outputType!='sample' ){
var hasAccessToLedger360 = readCookie( "prodMenuMinor" ) ? readCookie( "prodMenuMinor" ).indexOf( "L360" ) != -1 : false;
if( hasAccessToLedger360 ){
var URL = GetServerPath( "Ledger360" ) + "ledger360/default.aspx";
} else {
var URL = GetServerPath( "NonSecureHTTP" ) + "bi/Ledger360/landing_page.html";
}
HTML_text += '<td  align="center"><a class="menulink" href="' +
URL + '" target="_blank" title="Ledger360">Ledger360</a><br></td>';
}
HTML_text += '<td valign="bottom" align="right">&nbsp;</td>' +
'</tr></table>';
return HTML_text;
}
function getFactivaCompanyURL( companyCodesArray, companyName ){
var FACTIVA_IP_ADDRESS = "194.60.170.190";
var URL_BEGIN = "http://" + FACTIVA_IP_ADDRESS + "/companysearch.aspx?companyCode=";
var compNameString = ( companyName ? "&companyName=\"" + companyName + "\"" : "" );
var urlCompCodes = "(";
var urlString="";
if( companyCodesArray.length==1 ){
urlString = URL_BEGIN + companyCodesArray[0] + compNameString + "%20and%20re=UK";
}
else if( companyCodesArray.length > 1 ){
for( var i=0;i!=companyCodesArray.length;++i ){
urlCompCodes+=companyCodesArray[i]
if( i < companyCodesArray.length - 1 )urlCompCodes += "%20or%20";
if( i == companyCodesArray.length - 1 )urlCompCodes += ")";
}
urlString=URL_BEGIN+urlCompCodes+compNameString;
}
return urlString;
}
function getFactivaIndustryURL( indusryCodesArray ){
var FACTIVA_IP_ADDRESS = "194.60.170.190";
var URL_BEGIN = "http://" + FACTIVA_IP_ADDRESS + "/companysearch.aspx?companyCode=&companyName=";
var URL_END = "%20and%20re=UK";
var urlIndCodes = "in=";
if( indusryCodesArray&&indusryCodesArray.length ){
urlIndCodes+=indusryCodesArray[0];
}
if( indusryCodesArray&&indusryCodesArray.length > 1 ){
for( var i=1;i!=indusryCodesArray.length;++i ){
urlIndCodes = urlIndCodes + ( "%20or%20in=" + indusryCodesArray[i] );
}
}
return URL_BEGIN+urlIndCodes+URL_END;
}
function submitCompanyNewsRequest( companyCode, companyName ){
submitFactivaRequest();
var URL_String=getFactivaCompanyURL( companyCode, companyName );
window.open( URL_String );
}
function submitIndustryNewsRequest( indusryCodesArray ){
submitFactivaRequest();
var URL_String=getFactivaIndustryURL( indusryCodesArray )
window.open( URL_String );
}
function submitFactivaRequest(){
document.frmFactivaRequest.target = "PageHelp";
document.frmFactivaRequest.submit();
}
function restoreHelpFrame(){
if( top.frames["PageHelp"] )top.frames["PageHelp"].location.href = GetServerPath( "SecureHTTP" ) + getSecureProductDirectory() + "/sp2_fieldhelp.html";
}
function saveReport(){
var teststyle = document.getElementById("eseriesStyle");
if(teststyle==null)
{style1="";}
else
{style1 = parent.PageContent.document.styleSheets("eseriesStyle").cssText}
var biStyle = "<style>\n" +
style1 +
parent.PageContent.document.styleSheets("productStyle").cssText +
"\n</style>\n" +
"<style media='print'>\n" +
parent.PageContent.document.styleSheets("eseriesPrintStyle").cssText +
parent.PageContent.document.styleSheets("productPrintStyle").cssText +
"\n</style><style>" +
"\tIMG{display:none}\n" +
"\t.displayonlyinline{display:none}\n" +
"\t.CAISButtonActive{BORDER:0;MARGIN: 0px 0px 2px;WIDTH: 125px;COLOR: #000000;BACKGROUND-COLOR: #00ff00}\n" +
"\t.CAISButtonDefault{BORDER:0;MARGIN: 0px 0px 2px;WIDTH: 125px;COLOR: #ffffff;BACKGROUND-COLOR: #ff0000}\n" +
"\t.CAISButtonSettled{BORDER:0;MARGIN: 0px 0px 2px;WIDTH: 125px;COLOR: #000000;BACKGROUND-COLOR: #ffff66}\n" +
"\t.CAISButtonUnknown{BORDER:0;MARGIN: 0px 0px 2px;WIDTH: 125px;COLOR: #000000;BACKGROUND-COLOR: #ffff66}\n" +
"\t.CAISRecNumber,.nosave,.nocdatalabel{display:none}\n" +
"\t.divOn, .divOff{display:block}\n" +
"\t.nocBtn{BORDER:0;margin:0;width:125px;background-color:#00ff00;margin-bottom:2px}\n"+
"\t.imgreplace{display:block;FONT-WEIGHT:bold;}\n" +
"\t.printandsave{display:block;}" +
"\t.sectionspacing{display: none}" +
"\t.ctreelive{width:20px;font-weight:bold;text-align:center;background-color:#33cc00;color:#ffffff;}" +
"\t.ctreedormant{width:20px;font-weight:bold;text-align:center;background-color:#999999;color:#ffffff;}" +
"\t.ctreedissolved{width:20px;font-weight:bold;text-align:center;background-color:#990033;color:#ffffff;}" +
"\t.ctreelive2{width:20px;font-weight:bold;text-align:center;background-color:#0064f3;color:#ffffff;}" +
"\t.ctreedormant2{width:20px;font-weight:bold;text-align:center;background-color:#c0c0c0;color:#ffffff;}" +
"\t.ctreedissolved2{width:20px;font-weight:bold;text-align:center;background-color:#d21312;color:#ffffff;}" +
"\t.displayonly{display:none;}" +
"\t.saveonly{display:block;}" +
"\t.saveonlyinline{display:inline;}" +
"\tTR.nestedDisplayed{display:block;}" +
"\tTR.nestedHidden{display:block;}" +
"</style>";
var bisavedReport = new CustomSavedDocument("sp2_blank.html",top.PageContent.document.documentElement.outerHTML,biStyle);
bisavedReport.customiseReport();
bisavedReport.removeHyperlinks();
bisavedReport.reportHTML = bisavedReport.reportHTML.replace( /onclick/gi,"x" )
bisavedReport.openSaveableReport();
}
function CustomSavedDocument(defaultPage, originalHTML, productCSS, filename){
CustomSavedDocument.prototype=new SavedDocument(defaultPage, originalHTML, productCSS, filename );
CustomSavedDocument.prototype.constructor=CustomSavedDocument;
CustomSavedDocument.prototype.superclass=SavedDocument.prototype;
this.windowProperties =CustomSavedDocument.prototype.windowProperties;
this.reportHTML =CustomSavedDocument.prototype.reportHTML;
this.defaultPage =CustomSavedDocument.prototype.defaultPage;
this.defaultFilename=CustomSavedDocument.prototype.defaultFilename;
this.removeHyperlinks=CustomSavedDocument.prototype.removeHyperlinks;
this.customiseReport =_customiseReport;
this.openSaveableReport=CustomSavedDocument.prototype.openSaveableReport;
this.getReportHTML=CustomSavedDocument.prototype.getReportHTML;
function _customiseReport(){
this.reportHTML = this.reportHTML.replace( /<IMG[^>]*ctree_space.gif\"[^>]*>/gi, "&nbsp;&nbsp;&nbsp;" );
this.reportHTML = this.reportHTML.replace( /<IMG[^>]*ctree_L.gif\"[^>]*>/gi, "&nbsp;&nbsp;&nbsp;" );
this.reportHTML = this.reportHTML.replace( /<IMG[^>]*ctree_LMinus.gif\"[^>]*>/gi, "&nbsp;&nbsp;&nbsp;" );
this.reportHTML = this.reportHTML.replace( /<IMG[^>]*ctree_I.gif\"[^>]*>/gi, "&nbsp;&nbsp;&nbsp;" );
this.reportHTML = this.reportHTML.replace( /<IMG[^>]*ctree_T.gif\"[^>]*>/gi, "&nbsp;&nbsp;&nbsp;" );
this.reportHTML = this.reportHTML.replace( /<IMG[^>]*ctree_TMinus.gif\"[^>]*>/gi, "&nbsp;&nbsp;&nbsp;" );
this.reportHTML = this.reportHTML.replace( /<IMG[^>]*ctree_topminus.gif\"[^>]*>/gi, "&nbsp;&nbsp;&nbsp;" );
this.reportHTML = this.reportHTML.replace( /<IMG[^>]*ctree_live.gif\"[^>]*>/gi, "<span class='ctreelive'>&nbsp;L&nbsp;</span>&nbsp;" );
this.reportHTML = this.reportHTML.replace( /<IMG[^>]*ctree_dormant.gif\"[^>]*>/gi, "<span class='ctreedormant'>&nbsp;D&nbsp;</span>&nbsp;" );
this.reportHTML = this.reportHTML.replace( /<IMG[^>]*ctree_dissolved.gif\"[^>]*>/gi, "<span class='ctreedissolved'>&nbsp;X&nbsp;</span>&nbsp;" );
this.reportHTML = this.reportHTML.replace( /<IMG[^>]*ctree_key_live.gif\"[^>]*>/gi, "<span class='ctreelive'>&nbsp;L&nbsp;</span>&nbsp;" );
this.reportHTML = this.reportHTML.replace( /<IMG[^>]*ctree_key_dormant.gif\"[^>]*>/gi, "<span class='ctreedormant'>&nbsp;D&nbsp;</span>&nbsp;" );
this.reportHTML = this.reportHTML.replace( /<IMG[^>]*ctree_key_dissolved.gif\"[^>]*>/gi, "<span class='ctreedissolved'>&nbsp;X&nbsp;</span>&nbsp;" );
this.reportHTML = this.reportHTML.replace( /<IMG[^>]*ctree_live2.gif\"[^>]*>/gi, "<span class='ctreelive2'>&nbsp;L&nbsp;</span>&nbsp;" );
this.reportHTML = this.reportHTML.replace( /<IMG[^>]*ctree_dormant2.gif\"[^>]*>/gi, "<span class='ctreedormant2'>&nbsp;D&nbsp;</span>&nbsp;" );
this.reportHTML = this.reportHTML.replace( /<IMG[^>]*ctree_dissolved2.gif\"[^>]*>/gi, "<span class='ctreedissolved2'>&nbsp;X&nbsp;</span>&nbsp;" );
this.reportHTML = this.reportHTML.replace( /<IMG[^>]*ctree_key_live2.gif\"[^>]*>/gi, "<span class='ctreelive2'>&nbsp;L&nbsp;</span>&nbsp;" );
this.reportHTML = this.reportHTML.replace( /<IMG[^>]*ctree_key_dormant2.gif\"[^>]*>/gi, "<span class='ctreedormant2'>&nbsp;D&nbsp;</span>&nbsp;" );
this.reportHTML = this.reportHTML.replace( /<IMG[^>]*ctree_key_dissolved2.gif\"[^>]*>/gi, "<span class='ctreedissolved2'>&nbsp;X&nbsp;</span>&nbsp;" );
this.reportHTML = this.reportHTML.replace( /<IMG[^>]*ctree_band1.gif\"[^>]*>/gi, "<b>(91 - 100)&nbsp;</b>" );
this.reportHTML = this.reportHTML.replace( /<IMG[^>]*ctree_band2.gif\"[^>]*>/gi, "<b>(81 - 90)&nbsp;</b>" );
this.reportHTML = this.reportHTML.replace( /<IMG[^>]*ctree_band3.gif\"[^>]*>/gi, "<b>(51 - 80)&nbsp;</b>" );
this.reportHTML = this.reportHTML.replace( /<IMG[^>]*ctree_band4.gif\"[^>]*>/gi, "<b>(26 - 50)&nbsp;</b>" );
this.reportHTML = this.reportHTML.replace( /<IMG[^>]*ctree_band5.gif\"[^>]*>/gi, "<b>(16 - 25)&nbsp;</b>" );
this.reportHTML = this.reportHTML.replace( /<IMG[^>]*ctree_band6.gif\"[^>]*>/gi, "<b>(0 - 15)&nbsp;</b>" );
this.reportHTML = this.reportHTML.replace( /<IMG[^>]*ctree_band7.gif\"[^>]*>/gi, "<b>(No Score)&nbsp;</b>" );
this.reportHTML = this.reportHTML.replace( /<IMG[^>]*fr_spacer.gif\"[^>]*>/gi, "&nbsp;&nbsp;&nbsp;" );
this.reportHTML = this.reportHTML.replace( /<IMG[^>]*fr_plus.gif\"[^>]*>/gi, "&nbsp;&nbsp;&nbsp;" );
this.reportHTML = this.reportHTML.replace( /<IMG[^>]*fr_minus.gif\"[^>]*>/gi, "&nbsp;&nbsp;&nbsp;" );
this.reportHTML = this.reportHTML.replace( /<NOSCRIPT>/gi, "<!-- <NOSCRIPT>" );
this.reportHTML = this.reportHTML.replace( /<\/NOSCRIPT>/gi, "</NOSCRIPT> -->" );
this.reportHTML=this.reportHTML.replace( /folderExpand\(('[a-zA-Z0-9]+')(,( )*'[a-zA-Z0-9]+')?\)/gi, "" );
this.reportHTML=this.reportHTML.replace( /return( )*!top.PageHeader.submitting(;)?/gi, "" );
this.reportHTML = this.reportHTML.replace( /\(top.PageHeader.submitting\)/gi, "(false)" );
this.reportHTML=this.reportHTML.replace( /Purchase limited company report/gi, "" );
this.reportHTML = this.reportHTML.replace( /type=checkbox/gi, "type=checkbox disabled" );
this.reportHTML = this.reportHTML.replace( /onmouseout="this.style.textDecoration='none';this.style.cursor='default'" onmouseover="this.style.textDecoration='underline';this.style.cursor='hand'"/gi, "" );
this.reportHTML = this.reportHTML.replace( /onunload=".*"/gi, "" );
}
}
function subsidiarySearch( deptNumber, regNumber ){
top.PageHeader.submitting=true;
top.PageHeader.MM_swapImage("processing","","images/processing.gif",1);
var form=document.frmSubsidSearch;
setCompID( deptNumber );
form.DL01_REGNUMBER.value=regNumber;
form.ESERIES_FORM_ID.value = "LIMITED";
if( ! form.INS1_UNITTEST.value )form.ESERIES_STYLESHEET.value = GetServerPath( "SecureUnix" ) + getSecureProductDirectory() + "/sp2_ltd_rptconfirm.xsl";
form.submit();
}
function directorReport(uniqueRef,frm){
top.PageHeader.submitting=true;
top.PageHeader.MM_swapImage("processing","","images/processing.gif",1);
frm.DD02_UNIQREFNUM.value=uniqueRef;
frm.submit();
}
function ctreeReport(form){
form.ESERIES_STYLESHEET.value = GetServerPath( "SecureUnix" ) + getSecureProductDirectory() + "/sp2_ltd_corptree.xsl";
form.VER1_VERSION.value='0201';
top.PageHeader.submitting=true;
top.PageHeader.MM_swapImage("processing","","images/processing.gif",1);
form.submit();
}
function ctreeEnhancedReport(form){
form.ESERIES_STYLESHEET.value = GetServerPath( "SecureUnix" ) + getSecureProductDirectory() + "/sp2_ltd_corptree2.xsl";
form.DK03_MESSAGESUBTYPE.value='0013';
form.VER1_VERSION.value='0301';
top.PageHeader.submitting=true;
top.PageHeader.MM_swapImage("processing","","images/processing.gif",1);
form.submit();
}
function stripeTable(tableid,doNotShadow,noGreyBG){
var table=document.getElementById(tableid);
var rows = table.getElementsByTagName("tr");
for( i=0;i!=rows.length;++i ){
if(!doNotShadow){
rows[i].className = ( i % 2 ) ? "rowOdd" : "rowEven";
}
else {
rows[i].className = ( i % 2 ) ? "rowEven" : "rowOdd";
}
}
if(doNotShadow){
rows[0].className = rows[0].className + " underGrad";
if(!noGreyBG){
rows[1].className = "greyBG";
}
}
else {
if(!noGreyBG){
rows[0].className = "greyBG";
}
}
}
function sortcolumn(which,tableid,divid,direction){
var table=document.getElementById(tableid);
var rows = table.getElementsByTagName("tr");
var a=new Array();
for( var i=0;i!=rows.length;++i ){
var rowID=rows[i].id;
if(rowID!='HEAD'){
var rowIDa=rowID.split('_');
var sortstring =rowIDa[which];
var ss=sortstring.replace(/,/g,"");
a[i-1]=ss;
}
}
a.sort(function(a,b){return a-b;});
if(direction=='dec'){
a.reverse()
}
var b=new Array();
b[0]=a[0];
if(a.length > 1){
var u=1;
for( var t=1;t!=a.length;++t ){
if(a[t]!=a[t-1]){
b[u]=a[t];
u=u+1;
}
}
}
var tableHTML ="";
tableHTML += '<table id="dshareholderssort" name="dshareholderssort" summary="Detailed Shareholder" width="100%" cellpadding="1" cellspacing="0" border="0">';
var headrowHTML = '<tr id="HEAD">';
headrowHTML+=document.getElementById('HEAD').innerHTML;
headrowHTML+='</tr>';
tableHTML+= headrowHTML;
for( var x=0;x!=b.length;++x ){
var sortstr= b[x];
for( var z=0;z!=rows.length;++z ){
var rID=rows[z].id;
if(rID!='HEAD'){
var rIDa=rID.split('_');
var rsplitID =rIDa[which];
var rsID=rsplitID.replace(/,/g,"");
var tablerowHTML="";
if(sortstr==rsID){
tablerowHTML = '<tr id="' + rID + '">';
tablerowHTML+=rows[z].innerHTML;
tablerowHTML+='</tr>';
tableHTML+= tablerowHTML;
}
}
}
}
tableHTML+='</table>';
document.getElementById(divid).innerHTML=tableHTML;
stripeTableCity(tableid);
}
function stripeTableCity(tableid){
var table=document.getElementById(tableid);
var rows = table.getElementsByTagName("tr");
for( i=0;i!=rows.length;++i ){
rows[i].className = ( i % 2 ) ? "listlight" : "";
}
}


