/*Start of Global js Functions*/
function OpenHelpURLinNewWin(URL) {
var vday = new Date();
var id = vday.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=900,height=700,left = 62,top = 34');");
}
function OpenPrintableinNewWin(URL) {
var vday = new Date();
var id = vday.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=1000,height=500,left = 62,top = 34');");
}
function OpenURLinNewWin(URL) {
var vday = new Date();
var id = vday.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=900,height=700,left = 62,top = 34');");
}
/*End of Global js functions*/
sfHover = function() {
if(document.getElementById("bannerlinksmenu")) {
// alert(window.bannerlinksmenu.innerHTML);
var sfEls = document.getElementById("bannerlinksmenu").getElementsByTagName("LI");
if (navigator.appVersion.substr(22,3)!="5.0") window.bannerlinksmenu.innerHTML=('' + window.bannerlinksmenu.innerHTML);
for (var i=0; i' + arrEachMenu[2] + '';
//strHTML = arrEachMenu[1];
// alert(strcurrTop + " " + strHTML);
if ((strcurrTop != strLastTop && strLastTop != "") || (strLastTop == "")) {
//new top menu
if (countSubMenu > 0 ) strTempMenuHTML = strTempMenuHTML + ""; //close tag for the last set of menus
else strTempMenuHTML = strTempMenuHTML + "";
countSubMenu = 0; //reset count
strLastTop = strcurrTop; //remember the new top menu name
if (strHTML != "" && strHTML != null && strHTML != "undefined" && strHTML != "$$MenuItemHTML$$" ) { //if field MenuItemHTML is empty then domisphere returns the $$MenuItemHTML name
idName = strcurrTop.toLowerCase(); //translate the topmenu name to lower case
idName = idName.replace(/\s/gi, ''); //trim any white spaces in the name
strTempMenuHTML = strTempMenuHTML + '' + strcurrTop + '' + strHTML;
countSubMenu++; countTotSubMenus++;
} else {
//all we do is whip clear the strLastTop so to force it think it is a new top menu even it is the the same top menu
strLastTop = "";
}
} else {
if (strTempMenuHTML == "") {
// alert("Error: submenu with out TopMenuName" + arrAllMenuItems[k]);
// do nothing
} else {
if (strHTML != "" && strHTML != null && strHTML != "undefined" && strHTML != "$$MenuItemHTML$$" ) {
strTempMenuHTML = strTempMenuHTML + strHTML;
countSubMenu++; countTotSubMenus++;
}
}
}
}
function GetDDMenuHTML() {
if (arrAllMenuItems.length) {
countTotSubMenus = 0;
var strThisMenuHTML="";
var strThisMenuTopHTML = "";
for (var k=0; k < arrAllMenuItems.length; k++) {
strTemp = arrAllMenuItems[k];
if (strTemp != null && strTemp != "undefined") { //if this element is null then skip it complete, move on to the next one
arrEachMenu = strTemp.split(strDilimeter);
//if user have a pots configuration doc, then the first element will be text PotsConfig, and we need to skip it while generate ddmenu
if (arrEachMenu[0] == ConfigDoc || arrEachMenu[0] == PotsOnly || arrEachMenu[0] == "$$TopMenuName$$") continue;
//DDMenu
GenerateDDMenuHTML();
} //check if new top menu or not
}//for loop
//close the last - tag for top menu
if (countTotSubMenus > 0) strTempMenuHTML = strTempMenuHTML + "
";
else strTempMenuHTML = 'There is no menu available to you.';
} else {
//no sub menu is found in collection doc, so just populate top menus
strTempMenuHTML = 'There is no menu available to you.';
strPotsHTML = "";
}
}
/*For Pots*/
/*this is the default pots in order for user that don't have a config document set up*/
/*var arrTargetPots = ["ClaimsTrac", "US Oil Declarations", "Charter and Consortium Decls", "Online Services Tour", "Underwriting Online", "Loss Prevention", "Renewal Online", "Club Circulars"];*/
/*above line should be put live when US and Chart is live*/
/*var arrTargetPots = ["ClaimsTrac", "US Oil Declarations", "Underwriting Online", "Loss Prevention", "Renewal Online", "Club Circulars", "Environmental Encyclopedia", "Miller Encyclopedia"];*/
/*var arrTargetPots = ["ClaimsTrac", "US Oil Declarations", "Underwriting Online", "Loss Prevention", "List of Correspondents", "Club Circulars", "Environmental Encyclopedia", "Miller Encyclopedia"]; */
/*var arrTargetPots = ["ClaimsTrac", "US Oil Declarations", "Underwriting Online", "Loss Prevention", "Club Circulars", "Environmental Encyclopedia", "Miller Encyclopedia", "Quality And Feedback"];*/
var arrTargetPots = ["ClaimsTrac", "US Oil Declarations", "Underwriting Online", "Loss Prevention YQA", "Directors Meetings", "Benchmarking", "C2C Committee", "Directors Area"];
var startTable = '';
var strPotsHTML;
var countPotsPerRow =0;
var countTotPots = 0;
var countOtherPots = 0;
var arrTH = new Array;
var arrImg = new Array;
var arrDesc = new Array;
var arrFOM = new Array;
var arrURL = new Array;
var arrTHSorted = new Array;
var arrImgSorted = new Array;
var arrDescSorted = new Array;
var arrFOMSorted = new Array;
var arrURLSorted = new Array;
/*for all other menus user have access to but not included in the defualt setting or config doc setting*/
var arrTHOther = new Array;
var arrImgOther = new Array;
var arrDescOther = new Array;
var arrFOMOther = new Array;
var arrURLOther = new Array;
var stourTHClass="becomingamemeber selected";
function GeneratePOTSHTMLArrays() {
for (var t = 0; tstartElemNum) {
for (var j=startElemNum; j < actualPotsLength; j++){
//check if we need to start new table row
if (j == startElemNum) {
strPotsHTML = strPotsHTML + ''
} else if (j > (startElemNum + 3)) { //only load 4 pots per row
break;
}
/*Updated to make each pots title link to the application as well start, and now all pots title cell uses a div with fixwidth to allow auto text wrap with no text-indent*/
if (arrTHSorted[j] == "ClaimsTrac") {
// strPotsHTML = strPotsHTML + '' + arrTHSorted[j] + '™ | '
strPotsHTML = strPotsHTML + ' | '
} else if (arrTHSorted[j] == "Online Services Tour") {
// alert("arrURLSorted[" + j + "]=" + arrURLSorted[j]);
// strPotsHTML = strPotsHTML + '' + arrTHSorted[j] + ' | ';
strPotsHTML = strPotsHTML + ' | ';
} else {
// strPotsHTML = strPotsHTML + '' + arrTHSorted[j] + ' | ';
strPotsHTML = strPotsHTML + ' | ';
} /*else {
strPotsHTML = strPotsHTML + '' + arrTHSorted[j] + ' | '
strPotsHTML = strPotsHTML + '' + arrTHSorted[j] + ' | '
}*/
/*Updated to make each pots title link to the application as well end*/
}
if (actualPotsLength < (startElemNum + 4)) { //work out if we need to build any ampty pots in the same row?
countDifference = (startElemNum + 4) - actualPotsLength;
buildEmptyPots("", "", emptyTH ,countDifference);
}
strPotsHTML = strPotsHTML + '
' //close this table row
//alert(strPotsHTML);
j=startElemNum;
}
//now build the img row for the same pots
if (arrImgSorted.length && actualPotsLength >startElemNum) {
for (j=startElemNum; j < actualPotsLength; j++){
if (j == startElemNum) {
strPotsHTML = strPotsHTML + ''
} else if (j > (startElemNum + 3)) break;
strPotsHTML = strPotsHTML + ' | ';
}
if (actualPotsLength < (startElemNum + 4)) { //work out if we need to build any ampty pots in the same row?
countDifference = (startElemNum + 4) - actualPotsLength;
buildEmptyPots("", "", emptyImg ,countDifference);
}
strPotsHTML = strPotsHTML + '
' //close this table row
j=startElemNum;
}
//now build the app desc row for the same pots
if (arrDescSorted.length && actualPotsLength >startElemNum) {
for (j=startElemNum; j < actualPotsLength; j++){
if (j == startElemNum) {
strPotsHTML = strPotsHTML + ''
} else if (j > (startElemNum + 3)) break;
strPotsHTML = strPotsHTML + '' + arrDescSorted[j] + ' | ';
}
if (actualPotsLength < (startElemNum + 4)) { //work out if we need to build any ampty pots in the same row?
countDifference = (startElemNum + 4) - actualPotsLength;
buildEmptyPots("", "", emptyDesc ,countDifference);
}
strPotsHTML = strPotsHTML + '
' //close this table row
j=startElemNum;
}
//finally append find out more row on the pots
if (arrFOMSorted.length && actualPotsLength >startElemNum) {
for (j=startElemNum; j < actualPotsLength; j++){
if (j == startElemNum) {
strPotsHTML = strPotsHTML + ''
} else if (j > (startElemNum + 3)) break;
//strPotsHTML = strPotsHTML + '' + arrFOMSorted[j] + ' | ';
//strPotsHTML = strPotsHTML + '' + arrFOMSorted[j] + ' | '; //arrFOMSorted has the href tag in it from DDMenu doc
//after user loged in instead of show findoutmore rows, now we show click here and url is pointing to the corresponding apps
strPotsHTML = strPotsHTML + 'Click Here | ';
}
if (actualPotsLength < (startElemNum + 4)) { //work out if we need to build any ampty pots in the same row?
countDifference = (startElemNum + 4) - actualPotsLength;
buildEmptyPots("", "", emptyOtherPotsCell ,countDifference);
}
strPotsHTML = strPotsHTML + '
' //close this table row
}
}
function reOrderPotsHTMLArray() {
// alert(arrTargetPots.length);
if (arrTargetPots.length) {
var countSort =0;
var k=0;
var j=0;
for (k=0; k < arrTargetPots.length; k++) {
for (j =0; j < arrTH.length; j++) {
if (arrTargetPots[k] == arrTH[j]) {
arrTHSorted[countSort] = arrTH[j];
arrImgSorted[countSort] = arrImg[j];
arrDescSorted[countSort] = arrDesc[j];
arrFOMSorted[countSort] = arrFOM[j];
arrURLSorted[countSort] = arrURL[j];
countSort ++;
break;
}
} //arrTH loop
} //arrTargetPots loop
//look here
/* for debug only
for ( j = 0; j < arrTHOther.length; j++) {
alert("arrTHOther[" + j +" ]=" + arrTHOther[j]);
}
j=0;
for ( j = 0; j < arrTHSorted.length; j++) {
alert("arrTHSorted[" + j +" ]=" + arrTHSorted[j]);
}
*/
if (arrTHSorted.length < arrTargetPots.length) {
// alert("arrTHSorted is short than arrTargetPots");
j = 0;
baseindex = arrTHSorted.length;
// alert("baseindex=" + baseindex + " arrTHOther.length=" + arrTHOther.length);
for (j = 0; j < arrTHOther.length && arrTHSorted.length < arrTargetPots.length; j++) {
// alert("arrTHOther[" + j + "]=" + arrTHOther[j]);
if (arrTHOther[j] == "Online Services Tour" || arrTHOther[j]== "Directors Area" || arrTHOther[j]== "Rules and Byelaws") {
//do nothing temporary fix
} else {
arrTHSorted[arrTHSorted.length] = arrTHOther[j];
arrImgSorted[arrImgSorted.length] = arrImgOther[j];
arrDescSorted[arrDescSorted.length] = arrDescOther[j];
arrFOMSorted[arrFOMSorted.length] = arrFOMOther[j];
arrURLSorted[arrURLSorted.length] = arrURLOther[j];
}
}
}
}
}
var HasPotsConfig = false;
function GetPotsHTML() {
strPotsHTML = startTable;
if (typeof arrAllMenuItems.length != "undefined") {
for (var k=0; k < arrAllMenuItems.length; k++) {
strTemp = arrAllMenuItems[k];
if (strTemp != null && strTemp != "undefined") { //if this element is null then skip it complete, move on to the next one
arrEachMenu = strTemp.split(strDilimeter);
/*if user have a pots configuration doc, then the first element will be text PotsConfig,
and we need set the arrTargetPots to use this config and then skip this element*/
if (arrEachMenu[0] == ConfigDoc) {
// alert("got config doc=" + arrEachMenu[0] + " "+ arrEachMenu[7]);
if (HasPotsConfig==false) { //skip this code if we have already got the potscofig doc
if (curruser != "" && curruser != "Anonymous" && arrEachMenu[7] != "$$Remote_User$$" && curruser == arrEachMenu[7]) { //check if this is the current user's pots config doc
if (arrEachMenu[1] != "$$PotsNames$$") { //in case the field PotsNames is empty
arrTargetPots = eval("[" + arrEachMenu[1] + "];");
HasPotsConfig = true;
}
/* for (tc = 0; tc < arrTargetPots.length; tc++) {
alert(tc + " " + arrTargetPots[tc]);
}*/
}
}
continue;
}
GeneratePOTSHTMLArrays();
} //check if new top menu or not
}//for loop
if (arrTH.length) { //if there is any pots availabe to this user
//Now Resort the pots arrays in the order of target pots array
reOrderPotsHTMLArray();
//Now generate HTML for Pots useing array generated already
BuildPotsHTML(0);
if (arrTHSorted.length > 4) { //only generate the second row if user have more than 4 pots available to them
BuildPotsHTML(4);
}
// alert(strPotsHTML);
} else { //when there is no pots available to the current user, just show online services tour pot only
//leave pots empty
}
} else { //no menu to this user at all
//leave pots empty
}
// alert(strPotsHTML);
strPotsHTML += '
';
idonlineservicesid.innerHTML = idonlineservicesid.innerHTML + strPotsHTML;
}
//function to build all other 3 empty pots when user have no other pots available to them
function buildEmptyPots(STourCell, EndCell, semptyCell, cell2generate) {
var tempHTML= "";
for (var ec = 0; ec < cell2generate; ec++) {
tempHTML += semptyCell;
}
if (STourCell != "") strPotsHTML = strPotsHTML + STourCell + tempHTML + EndCell;
else strPotsHTML += tempHTML;
}