// Path of the Master database:
var DBNameHTML = "/clients/sensire/sensire-internet.nsf";
// Path of the current database:
var DBNameHTML_C = "";
var sPathName = document.location.pathname;
var iNSFPos = sPathName.toUpperCase().indexOf( ".NSF" );
if( iNSFPos == -1 ){
var iSlashPos = sPathName.indexOf( "/", 1 );
DBNameHTML_C = sPathName.substring( 0, iSlashPos );
} else {
DBNameHTML_C = sPathName.substring( 0, iNSFPos + 4 );
}
var dAll = document.all;
var iCountGlobal = 0;
// View entry objects array
var aVE = new Array();
// Array with pointer to the view entry objects array
var aVI = new Array();
var sKeyword_M_1 = "";
var sKeyword_M_2 = "";
var sKeyword_M_1_block = false;
var sKeyword_M_2_block = false;
var wtcnt="0";
var spcnt="0";
function Left(str, n){
if (n <= 0)
return "";
else if (n > String(str).length)
return str;
else
return String(str).substring(0,n);
}
function replaceSubstring (sourceString, oldString, newString, caseSensitive ) {
/* Replaces specific words or phrases in a string with new words or phrases that you specify. Case sensitive.
Parameters
sourceString
Text. The string whose contents you want to modify.
oldString
Text. A list containing the words or phrases that you want to replace.
newString
Text. A list containing the replacement words or phrases.
Return value
newSourceString
Text. The sourceString, with any values from oldString replaced by the corresponding value to newString. If none of the values in oldString matched the values in sourceString, then sourceString is returned unaltered. */
fixedReplace = "";
UI = sourceString;
UB = oldString;
if ((caseSensitive != 1) && (caseSensitive != true)) {
UI = sourceString.toUpperCase();
UB = oldString.toUpperCase();
}
badEnd = -1;
badLoc = UI.indexOf(UB);
if (badLoc != -1) {
for (x=1; (badLoc != -1); x++) {
fixedReplace = fixedReplace + sourceString.substring((badEnd + 1), badLoc) + newString;
badEnd = badLoc + UB. length - 1;
badLoc = UI.indexOf(UB, (badLoc + 1));
}
fixedReplace = fixedReplace + sourceString.substring((badEnd + 1), sourceString.length);
} else {
fixedReplace = sourceString;
}
return fixedReplace;
}
function TDB( className ) { document.write( "
" ) }
function TDE() { document.write( " | " ) }
function TRB( className) { document.write( "" ) }
function TRE() { document.write( "
" ) }
function openDoc( docID ) {
// Opens the document given by DocumentUniqueID in read mode. First it checks for the correct DBNameHTML.
var sSlash = "";
if( DBNameHTML.charAt(0) != "/" ) {
sSlash = "/";
}
document.location = sSlash + DBNameHTML + "/0/" + docID + "?OpenDocument";
}
function viewEntry( v1 , v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20 ) {
// Object constructor
this.v1 = v1; this.v2 = v2; this.v3 = v3; this.v4 = v4; this.v5 = v5; this.v6 = v6; this.v7 = v7; this.v8 = v8; this.v9 = v9; this.v10 = v10;
this.v11 = v11; this.v12 = v12; this.v13 = v13; this.v14 = v14; this.v15 = v15; this.v16 = v16; this.v17 = v17; this.v18 = v18; this.v19 = v19; this.v20 = v20;
}
function viewIndex( iPtr, sortItem ) {
// Object constructor
this.iPtr = iPtr;
this.sortItem = sortItem;
}
function findIndex( sSortItem ) {
if( iCountGlobal == 0 ) return 0;
for( var i=0; i < iCountGlobal; i++ ) {
if( sSortItem < aVI[i].sortItem ) {
return i;
}
}
return iCountGlobal;
}
function vE( v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20 ) {
// Create an object instance in the array
// 1=docTitle, 2=docID, 3=docAddress, 4=docPC, 5=docCity, 6=docCountry, 7=docPhone, 8=docFax, 9=docWWW, 10=docEmail, 11=docImageStoreDoc, 12=docImageName, 13=docPDate ) {
//alert ("VE wtcnt " + wtcnt)
if ( wtcnt == 0)
{
if ( sKeyword_M_1_block )
{
//alert (wtcnt +" block 1");
return true
}
}
else
{
if ( sKeyword_M_2_block )
{
//alert (wtcnt +" block 2");
return true
}
//alert ("ve" + v1);
}
oViewEntry = new viewEntry( v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20 );
oViewIndex = new viewIndex( iCountGlobal, v1 );
if (aVE.push ) {
pushed = aVE.push( oViewEntry );
aVI.splice( findIndex( oViewIndex.sortItem ), 0, oViewIndex );
} else {
// push method is not supported, using concat
aVE = aVE.concat( oViewEntry );
if( aVE.splice ) {
aVI.splice( findIndex( oViewIndex.sortItem), 0, oViewIndex );
} else {
// splice method is not supported, using slice to construct the new array.
var iIndex = findIndex( oViewIndex.sortItem );
aStart = aVI.slice( 0, iIndex );
aEnd = aVI.slice( iIndex );
aVI = aStart.concat( oViewIndex, aEnd );
}
}
iCountGlobal++;
}
function writeTable() {
// Write out the final HTML
var sRowClass;
var sDTitle;
wtcnt ++;
// Enable the next line to reverse the views' sorting:
// aVI.reverse();
// Check if there are any documents
if( aVE.length == 0 && wtcnt==0) {
TRB('');
TDB( 'Even' );
document.write( '-' );
TDE()
TRE();
} else {
// Documents found; loop through all documents and write them out
for( var i=0; i < aVE.length; i++ ) {
// alert(i)
if( i&1 ) {
sRowClass = "Odd"
} else {
sRowClass = "Even"
}
// Only include the document in the list if it is not the current document
if( sDocID != aVE[aVI[i].iPtr].v2){
TRB('');
TDB( sRowClass );
var szTitle= aVE[aVI[i].iPtr].v1;
if(szTitle.length>20)
{
szTitle=Left(szTitle,18)+"...";
}
document.write( '
' + szTitle + '');
//document.write( '
' + aVE[aVI[i].iPtr].v1 + '');
TDE();
TRE();
}
}
// Last line: write the "Print documents" link
if (spcnt == 0 && i> 1)
//TRB('');
//TDB( sRowClass );
//document.write( '
');
//TDE();
//TRE();
spcnt++;
}
}
//function UpdatePC() {
// Automatically reposition the Passage_CrossRefs DIV; only works in IE
//oPC = dAll.Passage_CrossRefs;
//if( oPC ) {
//oPC.style.position = 'absolute';
// Set the vertical position of the Cross-references
//oPC.style.top = document.body.scrollTop - 50;
// Set the horizontal position of the Cross-references
//oPC.style.left = document.body.scrollLeft + 555;
//}
//setTimeout( "UpdatePC()", 200 );
//}
// Initialize the automatic repositioner if the browser is IE
// If you don't want to use automatic repositioning, REM the following three lines
//if( dAll ) {
//UpdatePC();
//}
function initMeta1and2 ( smeta1, smeta2, ResKeyM1, ResKeyM2, ResKeyM3, ResKeyM4, ResKeyM5)
{
wtcnt=0;
sKeyword_M_1 = smeta1;
sKeyword_M_2 = smeta2;
var ResKey1 = ResKeyM1;
var ResKey2 = ResKeyM2;
var ResKey3 = ResKeyM3;
var ResKey4 = ResKeyM4;
var ResKey5 = ResKeyM5;
if (sKeyword_M_1 == ResKey1 || sKeyword_M_1 == ResKey2 || sKeyword_M_1 == ResKey3 || sKeyword_M_1 == ResKey4 || sKeyword_M_1 == ResKey5)
{
sKeyword_M_1_block = true;
}
if (sKeyword_M_2 == ResKey1 || sKeyword_M_2 == ResKey2 || sKeyword_M_2 == ResKey3 || sKeyword_M_2 == ResKey4 || sKeyword_M_2 == ResKey5)
{
sKeyword_M_2_block = true;
}
}