/*********************************************************************************//*  GLOBAL VARIABLES                                                                                            *//*********************************************************************************/var global_domain, global_db, global_location, global_string;/* Function used to initialize global variables on the first load */function initializeGlobalVars() {	global_domain = "http://" + window.location.hostname;	global_db = "/" + document.getElementById('currentdb').innerHTML;	global_location = global_domain + global_db;	global_string = new Object();	global_string["empty_content_02"] = true;	global_string["attachments_type"] = "";}/* Used on event load */function loadDocumentsTable() {  initializeGlobalVars();  eval(this.fun + "(\"" + this.par1 + "\", \"" + this.par2 + "\" )" );}/* Work-around to load table from Lotus CMS pages */function loadDocumentsTable_Lotus(funType, siteDiv) {  initializeGlobalVars();  showRows(funType, siteDiv);}/* Function used only inside Web-Site to adjust columns height */function setSiteColumns() {	var currurl = window.location.pathname;	if (currurl.indexOf(global_db + "/") == -1) {		setSameHeight();	}}/* QUICK SORT functions  */function partition(args, begin, end, pivot) {	var array = args[0];	var piv=array[pivot];	array.swap(args, pivot, end-1);	var store=begin;	var ix;	for(ix=begin; ix<end-1; ++ix) {		if(array[ix].toLowerCase()<=piv.toLowerCase()) {			array.swap(args, store, ix);			++store;		}	}	array.swap(args, end-1, store);	return store;}Array.prototype.swap=function(args, a, b) {	var numargs = args.length;	var tmp_array;	var i0;	var tmp=this[a];	this[a]=this[b];	this[b]=tmp;		for (i0 = 1; i0<numargs; i0++ ) {		tmp_array = args[i0];		tmp = tmp_array[a];		tmp_array[a] = tmp_array[b];		tmp_array[b] = tmp;	}}function qsort(args, begin, end) {	if(end-1>begin) {		var pivot=begin+Math.floor(Math.random()*(end-begin));		pivot=partition(args, begin, end, pivot);		qsort(args, begin, pivot);		qsort(args, pivot+1, end);	}}function quick_sort(args) {	qsort(args, 0, args[0].length);}/*********************************************************************************//*  CREATE TABLE                                                                                                     *//*********************************************************************************//* Function which switch among different case and call the related function.	funType : if "view_most_recent" then show the last documents modified, if "view_all" then show all documents.	currdiv_id : name of the current div	Example:		<a href="javascript:void(0);" class="row01" onclick="showRows('simple', 'cat0201');" id="cat0201" userclasses="2" children="76">Technical Notes</a>  */function showRows(funType, target_id) {	// This is a workaround to make files extesions request synchronous	getAttachmentsType(funType, target_id);}function showRows_aux(funType, target_id) {	var targetdivObj = document.getElementById(target_id); // Element matching the ID passed 	var currdivObj; // Element matching the current div ID	var prev_active = YAHOO.util.Dom.getElementsByClassName("active"); // Element matching the link active before THIS call		funType == "view_most_recent" ? currdivObj = document.getElementById("most_recent_id") : currdivObj = targetdivObj;		/* funType == "view_site_categories" only ONLOAD to load all libraries */	if (funType != "view_site_categories") {		/* Set the current link as active */		if (prev_active.length != 0) {			/* Reset the style of the previous active link */			YAHOO.util.Dom.removeClass(prev_active[0], "active");		}		YAHOO.util.Dom.addClass(currdivObj, "active");	}		switch (funType) {		case "view_most_recent": 			perform_Documents_Request(funType, target_id, 30);			break;		case "view_all":			perform_General_Request(funType, target_id);			break;		case "view_search_documents":			perform_General_Request(funType, target_id);			break;		case "view_site_categories" :			perform_Libraries_Request(target_id);			break;		case "view_category_documents":			loadDocuments(target_id);			break;		default:			document.getElementById('pagelog').innerHTML = document.getElementById('pagelog').innerHTML + "FUNCTION : showRows(" + funType + ","  +  target_id + ")";			break;	}}/* Function that fill "content_02": if documents are in cache then use them else make an HTTP request */function loadDocuments(currdiv_id) {		/* Define variables */	var currdivObj = document.getElementById(currdiv_id); // Element matching the ID passed	var contentdivObj = document.getElementById("content_02"); // Element matching the ID of the DIV where create the table	var usecache = false; // Boolean - if false then HTTP request else global variable	/* A welcome msg is shown the first time that the table is loading */		if (global_string["empty_content_02"] == true) {		contentdivObj.innerHTML = "Select a library from the list on the left.";		global_string["empty_content_02"] = false;	}		if ((currdivObj != null) && (currdivObj.getAttribute("children") == 0)) {		/* Category children are 0 so show a msg */		contentdivObj.innerHTML = "No documents available for this library.";		usecache = true;	} else if ((global_string[currdiv_id]) != null) {		/* CACHE - HTML of this DIV - documents content - is saved in cache */		contentdivObj.innerHTML = global_string[currdiv_id];		usecache = true;	}	/* Perform HTTP Request */	if (	usecache == false) {		perform_Documents_Request("view_category_documents", currdiv_id);	}		/* CMS - resize columns */	setSiteColumns();}/* Function that fill the DIV  "siteDiv" with the names of the libraries 	siteDiv : name of the DIV	libraryName : array of libraries name	lib_numorder : order number of the categories	userclassesNum : number of userclasses - used when parsing	childrenNum : number of children - used when parsing */function fillRowsLibraries(siteDiv, libraryName, lib_numorder, userclassesNum, childrenNum) {	var currdiv = document.getElementById(siteDiv); 	var libstr = "";			for (var i = 0; i < libraryName.length; i++) {		libstr = libstr + "\n<a href=\"javascript:void(0);\" class=\"row01\" onclick=\"showRows('view_category_documents', 'cat" + siteDiv.slice(-2) + lib_numorder[i]  + "');\" id=\"cat" + siteDiv.slice(-2) + lib_numorder[i] + "\" userclasses=\"" + userclassesNum[i] + "\" children=\"" + childrenNum[i] +  "\">";		libstr = libstr  + libraryName[i] + "</a></div>\n";	}	currdiv.innerHTML = libstr;	setSiteColumns();	if ((global_string[siteDiv]) == null ) {		global_string[siteDiv] = libstr;	}}/* Function that fill the DIV  "libraryDiv" with the info of the attachments  */function fillRowsDocuments(libraryDiv, modification_date, parentUID, docName, docTitle, attName, attNotes) {	var contentdivObj = document.getElementById("content_02"); // Element matching the ID of the DIV where create the table	var currdiv = document.getElementById(libraryDiv);	var docstr_c02 = ""; // String - hold HTML code of the "content_02"	var attachment_type = []; // pdf, zip, txt, ...	var datestr; // String - date added in "view_most_recent" case	var filelink; // ------------------- It is the link at the first attachment to use in the name of the document		var icons_folder_div = document.getElementById("icons_folder");	var icons_folder = ( ( icons_folder_div == undefined) || (icons_folder_div.innerHTML == "") ) ? "web/" : icons_folder_div.innerHTML + "/";		/* There are not documents */		if (parentUID.length == 0) {		docstr_c02 = "Empty library.";	}	for (var i = 0; i < parentUID.length; i++) {		datestr = "";			/* Set arrays elements empty to "non-breaking space" */		if ((docName[i] == "") || (docName[i] == undefined)  || (docName[i] == null)) {			docName[i] = "&nbsp;";		}		if ((docTitle[i] == "") || (docTitle[i] == undefined)  || (docTitle[i] == null)) {			docTitle[i] = "&nbsp;";		}		if ((attNotes[i] == "") || (attNotes[i] == undefined)  || (attNotes[i] == null)) {			attNotes[i] = "&nbsp;";		}				for (var i0 = 0; i0 < attName[i].length; i0++) {			/* Set type of icon */			attachment_type[i0] = ((attName[i][i0]).split("."))[((attName[i][i0]).split(".")).length - 1];			if (global_string["attachments_type"].indexOf(">" + attachment_type[i0].toLowerCase() + "<" ) == -1 ) {				attachment_type[i0] = "txt";				}		}				/* Last modified case */		if (modification_date != "") {			//datestr = modification_date[i].substring(6,8) + "/" + modification_date[i].substring(4,6) + "/" + modification_date[i].substring(0,4) + " " + modification_date[i].substring(9,11)  + "." + modification_date[i].substring(11,13)  + "." + modification_date[i].substring(13,15) + " - ";			datestr = modification_date[i].substring(6,8) + "/" + modification_date[i].substring(4,6) + "/" + modification_date[i].substring(0,4)  + " - ";		}					docstr_c02 = docstr_c02 + "\n<div class=\"row02";		/* Set class on rows pair to display alternate color */		if ((i%2) == 0) {			docstr_c02 = docstr_c02 + " row02pair";		}		filelink = attName[i][0];		docstr_c02 = docstr_c02 + "\">\n";		docstr_c02 = docstr_c02 + "<div class=\"c01\"><a href=\"" + global_db + "/vw121/" + parentUID[i] + "/$file/" + filelink + "\" target=\"_blank\">" + docName[i] + "</a></div>\n";		docstr_c02 = docstr_c02 + "<div class=\"c02\"><a href=\"" + global_db + "/vw121/" + parentUID[i] + "/$file/" + filelink + "\" target=\"_blank\">" + docTitle[i] + "</a></div>\n";		docstr_c02 = docstr_c02 + "<div class=\"c03\">"; "</div>\n";		for (var i0 = 0; i0 < attName[i].length; i0++) { 			docstr_c02 = docstr_c02 + "<a href=\"" + global_db + "/vw121/" + parentUID[i] + "/$file/" + attName[i][i0] + "\" target=\"_blank\"><img src=\"" + global_db + "/" + icons_folder + attachment_type[i0] + ".gif\" alt=\"Link\" border=\"0\" /></a>";		}		docstr_c02 = docstr_c02 + "</div>\n";		docstr_c02 = docstr_c02 + "<div class=\"c04\">" + datestr + attNotes[i] + "</div>\n";		docstr_c02 = docstr_c02 + "</div>\n";		docstr_c02 = docstr_c02 + "<div style=\"clear:both;\"></div>\n";	}	contentdivObj.innerHTML = docstr_c02;	/* Store HTML code */	if ((global_string[libraryDiv]) == null) {		global_string[libraryDiv] = docstr_c02;	}		setSiteColumns();}/*********************************************************************************//*  HTTP Requests                                                                                                     *//*********************************************************************************//*---------------- Get documents libraries --------------------------------------------------------*/var handleSuccess_01 = function(o){	if(o.responseXML !== undefined){		var objXML = o.responseXML;		var siteDiv = o.argument[0];		var libraryCode = [];		var childrenNum = [];		var userclassesNum = [];		var viewentryOBJ, textOBJ;				// Create an array including the libraries codes of the document attachments		viewentryOBJ = objXML.getElementsByTagName("viewentry");		textOBJ = objXML.getElementsByTagName("text");			for (var i = 0; i < textOBJ.length; i++) {			// Library Code			libraryCode[i] = textOBJ[i].childNodes[0].nodeValue;			// Node children			childrenNum[i] = viewentryOBJ[i].getAttribute("descendants");			userclassesNum[i] = viewentryOBJ[i].getAttribute("children");		}		getLibraries(siteDiv, libraryCode, userclassesNum, childrenNum);	}}var handleSuccess_06 = function(o){	if(o.responseXML !== undefined){		var objXML = o.responseXML;		var siteDiv = o.argument[0];		var libraryName = [];		var userclassesNum = [];		var childrenNum = [];		var numorder = []; // Integer - order of categories index		var catOBJ;		var logstr="";				// Create an array including the libraries codes of the document attachments		catOBJ = objXML.getElementsByTagName("category");		for (var i = 0; i < catOBJ.length; i++) {			libraryName[i] = catOBJ[i].getAttribute("name");			childrenNum[i] = catOBJ[i].getAttribute("children");			userclassesNum[i] = 1;			numorder[i] = ((catOBJ[i].getAttribute("position")).split("."))[1];  /* 2.3.1 --> 2, 3, 1 --> 3  where position 2 is site, 3 is category and 1 is entry*/			numorder[i] = ((100 + parseInt(numorder[i])).toString()).substr(1); /* 3 --> 03 */					}				var args = [libraryName, numorder, userclassesNum, childrenNum];		quick_sort(args);				fillRowsLibraries(siteDiv, libraryName, numorder, userclassesNum, childrenNum);	}}var handleFailure = function(o){	if(o.responseXML !== undefined){		var div = document.getElementById(o.argument[0]);		div.innerHTML = "<li>Transaction id: " + o.tId + "</li>";		div.innerHTML += "<li>HTTP status: " + o.status + "</li>";		div.innerHTML += "<li>Status code message: " + o.statusText + "</li>";	}}/* Function that parse all entries of the attachments view and get code librearies.*/function perform_Libraries_Request(siteDiv) {	var siteType = document.getElementById("siteType").innerHTML;	// Get the index of  the site//	var siteIndex = siteDiv.slice(-2);  <------------------------------------------------------------------- Only SiteSage	var siteIndex = siteType + "-" + siteDiv.slice(-2);	var args =[siteDiv];		if (siteType == "Lotus") {		var urlViewDocs = global_location + "/ag205?Openagent&sitecode=" + siteDiv.slice(-2);		var callback = { cache: false, success:handleSuccess_06, failure: handleFailure, argument: args }	} else {		// Site documents view		/*-------------*/		switch (document.getElementById('userclasses').innerHTML) { // tmp - related to SiteSage			case "none" :				var urlViewDocs = global_location + "/vw403?ReadViewEntries&collapseView&RestrictToCategory=" + siteIndex;				break;			case "distributorclass:none" :				var urlViewDocs = global_location + "/vw402?ReadViewEntries&collapseView&RestrictToCategory=" + siteIndex;				break;			case "signupclass:none" :				var urlViewDocs = global_location + "/vw403?ReadViewEntries&collapseView&RestrictToCategory=" + siteIndex;				break;			default:				document.getElementById('pagelog').innerHTML = document.getElementById('pagelog').innerHTML + "FUNCTION : perform_Libraries_Request(" + siteDiv + ")";				break;		}		/*-------------*/		var callback = { cache: false, success:handleSuccess_01, failure: handleFailure, argument: args }	}	var request = YAHOO.util.Connect.asyncRequest('GET', urlViewDocs, callback);}/* Check view of all Libraries */var handleSuccess_02 = function(o){	if(o.responseXML !== undefined){		var objXML = o.responseXML;		var siteDiv = o.argument[0];		var libraryCode = o.argument[1];		var userclassesNum = o.argument[2];		var childrenNum = o.argument[3];		var libraryName = [];		var textOBJ;		var res = [];		var numorder = []; // Integer - order of categories index				/* Create the array of ALL libraries names */		viewentryOBJ = objXML.getElementsByTagName("viewentry");			for (var i = 0; i < viewentryOBJ.length; i++) {			textOBJ = viewentryOBJ[i].getElementsByTagName("text");			libraryName[i] = textOBJ[1].childNodes[0].nodeValue;		}				/* Create the array of the CURRENT libraries names matching the libraries codes  */		for (var i = 0; i < libraryCode.length; i++) {			numorder[i] = ((100 + i + 1).toString()).substr(1);			res[i] = libraryName[parseInt(libraryCode[i],10)-1];		}				var args = [res, numorder, userclassesNum, childrenNum];		quick_sort(args);				fillRowsLibraries(siteDiv, res, numorder, userclassesNum, childrenNum);	}}function getLibraries(siteDiv, libraryCode, userclassesNum, childrenNum) {	var urlLibraries = global_location + "/vw105?ReadViewEntries&CollapseView";	var args =[siteDiv, libraryCode,userclassesNum, childrenNum];	var req = YAHOO.util.Connect.asyncRequest('GET', urlLibraries, { cache: false, success:handleSuccess_02, failure: handleFailure, argument: args } );}/*---------------- Get documents attachments --------------------------------------------------------*/var handleSuccess_03 = function(o){	if(o.responseXML !== undefined){		var objXML = o.responseXML;		var currDiv = o.argument[0]; // String - if "view_all" then currDiv is siteDiv else if "view_category_documents" then libraryDiv		var funType = o.argument[1]; // String - Exists only on "view_search_documents"		var parentUID = [];		var docName = [];		var docTitle = [];		var attName = [];		var attNotes = [];		var args = [parentUID, docName, docTitle, attName, attNotes];		var viewentryOBJ, entrydataOBJ, textOBJ;		var userclasses = (document.getElementById("userclasses").innerHTML).split(":");		var flag_jump = true;		var i = 0;				if (funType == "view_search_documents") {			var searchStr = document.getElementById("search_docs_string").value;		}				// Create an array including the libraries codes of the document attachments		viewentryOBJ = objXML.getElementsByTagName("viewentry");			for (var i0 = 0; i0 < viewentryOBJ.length; i0++) {			flag_jump = true;			entrydataOBJ = viewentryOBJ[i0].getElementsByTagName("entrydata");  // Used to manage multiple attachment files			/* If multiple attachment then <ENTRYDATA><TEXTLIST><TEXT></TEXT>	<TEXT></TEXT></TEXTLIST></ENTRYDATA> 				else <ENTRYDATA><TEXT></TEXT></ENTRYDATA>	*/			textOBJ = entrydataOBJ[0].getElementsByTagName("text"); 						if (entrydataOBJ.length == 1) {				for (var j = 0; j < userclasses.length; j++) {					if ((textOBJ[0].childNodes[0] == undefined) || (textOBJ[0].childNodes[0].nodeValue == userclasses[j])) {						 flag_jump = false;					}				}				if (flag_jump == true) {					i0 = i0 + parseInt((viewentryOBJ[i0].getAttribute("children")));				}			} else if ((funType == undefined) ||   // <-- Most case on which this function isa called						((funType != undefined) &&  // <-- Case funtype = "view_search_documents" ...						( ( ( ((entrydataOBJ[1].getElementsByTagName("text"))[0].childNodes[0].nodeValue).toLowerCase()).indexOf(searchStr.toLowerCase()) != -1 ) ||  // <-- ... and SezSigla = search_docs_string ...						   ( ( ((entrydataOBJ[2].getElementsByTagName("text"))[0].childNodes[0].nodeValue).toLowerCase()).indexOf(searchStr.toLowerCase()) != -1 ) ) ) ) {  // <-- or Subject = search_docs_string				parentUID[i], docName[i], docTitle[i], attName[i], attNotes[i] = "";								for (var i1 = 0; i1 < entrydataOBJ.length; i1++)  {					textOBJ = entrydataOBJ[i1].getElementsByTagName("text");					if (textOBJ.length > 1) { 	// Theoretically only attName can have more than 1 element						for (var i2 = 0; i2 < textOBJ.length; i2++) {							if (textOBJ[i2].childNodes[0] != undefined) {								if (args[i1][i] == undefined) {									args[i1][i] = [textOBJ[i2].childNodes[0].nodeValue]								} else {									args[i1][i] = (args[i1][i]).concat([textOBJ[i2].childNodes[0].nodeValue]);								}							}							}						} else {						if (textOBJ[0].childNodes[0] != undefined) {							args[i1][i] = [textOBJ[0].childNodes[0].nodeValue];						} else {							if (entrydataOBJ[i1].getAttribute("name") == "SezSigla") {								args[i1][i] = "-- No document name --";							}						}						}				}								i = i + 1;			}		}		//quick_sort(args);		fillRowsDocuments(currDiv, "", parentUID, docName, docTitle, attName, attNotes);	}}/*---------------- Requests on all documents : search or viewAll ----------------------------------------------------------*/var handleSuccess_04 = function(o){	if(o.responseXML !== undefined){		var objXML = o.responseXML;		var siteName = o.argument[0];		var funType = o.argument[1];		var attachments_num;		var siteCat = document.getElementById("siteType").innerHTML + "-"  + siteName.slice(-2);				var log;				if (funType != undefined) {			var searchStr = document.getElementById("search_docs_string").value;		}		/* Get the number of documents for each sites  */		entryOBJ = objXML.getElementsByTagName("viewentry");			textOBJ = objXML.getElementsByTagName("text");					for (var i = 0; i < entryOBJ.length; i++) {			if (textOBJ[i].childNodes[0].nodeValue == siteCat) {				attachments_num = parseInt(parseInt(entryOBJ[i].getAttribute("children"), 10) + parseInt(entryOBJ[i].getAttribute("descendants"), 10), 10);			}		}				if (searchStr == undefined) {			perform_Documents_Request("view_all", siteName, attachments_num);		} else {			perform_Documents_Request("view_search_documents", siteName, attachments_num);		}	}}function perform_General_Request(funType, siteName) {	// Site documents view	var urlViewDocs = urlViewDocs = global_location + "/vw405?ReadViewEntries&CollapseView";	var args =[siteName, funType];	var request = YAHOO.util.Connect.asyncRequest('GET', urlViewDocs, { cache: false, success:handleSuccess_04, failure: handleFailure,	argument: args });}/*---------------- Get last modified attachments --------------------------------------------------------*/var handleSuccess_05 = function(o){	if(o.responseXML !== undefined){		var objXML = o.responseXML;		var siteName = o.argument[0];		var modification_date = [];		var parentUID = [];		var docName = [];		var docTitle = [];		var attName = [];		var attNotes = [];		var args = [docName, parentUID, docTitle, attName, attNotes];		var viewentryOBJ, entrydataOBJ, textOBJ, dateOBJ;		var userclasses = (document.getElementById("userclasses").innerHTML).split(":");		var flag_jump = true;		var i = 0;						// Create an array including the libraries codes of the document attachments		viewentryOBJ = objXML.getElementsByTagName("viewentry");			for (var i0 = 0; i0 < viewentryOBJ.length; i0++) {			flag_jump = true;			entrydataOBJ = viewentryOBJ[i0].getElementsByTagName("entrydata");  // Used to manage multiple attachment files			textOBJ = entrydataOBJ[1].getElementsByTagName("text"); // Value of first text tag (0 is type datetime) --> none, distributorclass, signupclass 			dateOBJ = viewentryOBJ[i0].getElementsByTagName("datetime");			for (var j = 0; j < userclasses.length; j++) {				if ((textOBJ[0].childNodes[0] == undefined) || (textOBJ[0].childNodes[0].nodeValue == userclasses[j])) {					 flag_jump = false;				}			}			if (flag_jump == false) {				modification_date[i], parentUID[i], docName[i], docTitle[i], attName[i], attNotes[i] = "";								if (dateOBJ[0].childNodes[0] != undefined) {					modification_date[i] = dateOBJ[0].childNodes[0].nodeValue;				}				for (var i1 = 0; i1 < args.length; i1++)  {					textOBJ = entrydataOBJ[i1+2].getElementsByTagName("text"); // + 2 because 0 is datetime and 1 still checked					if (textOBJ.length > 1) { // Theoretically only attName can have more than 1 element						for (var i2 = 0; i2 < textOBJ.length; i2++) {							if (textOBJ[i2].childNodes[0] != undefined) {								if (args[i1][i] == undefined) {									args[i1][i] = [textOBJ[i2].childNodes[0].nodeValue]								} else {									args[i1][i] = (args[i1][i]).concat([textOBJ[i2].childNodes[0].nodeValue]);								}							}							}						} else {						if (textOBJ[0].childNodes[0] != undefined) {							args[i1][i] = [textOBJ[0].childNodes[0].nodeValue];						} else {							if (entrydataOBJ[i1].getAttribute("name") == "SezSigla") {								args[i1][i] = "-- No document name --";							}						}						}				}								i = i +1;			}		}				fillRowsDocuments("", modification_date, parentUID, docName, docTitle, attName, attNotes);	}}function perform_Documents_Request(funType, currdiv, attachments_num) {	document.getElementById('content_02').innerHTML = "Please wait while loading ...";	// Site documents view	var urlViewDocs;	var callback		switch (funType) {	     case "view_all"://	     	var siteIndex = currdiv.slice(-2);       <------------------------------------------------------------------------------ Only SiteSage	     	var siteIndex = document.getElementById("siteType").innerHTML + "-" + currdiv.slice(-2);		     urlViewDocs = global_location + "/vw405?ReadViewEntries&RestrictToCategory=" + siteIndex + "&count=" + attachments_num;			callback = { cache: false, success:handleSuccess_03, failure: handleFailure, argument: [currdiv] }			break;		case "view_search_documents"://	     	var siteIndex = currdiv.slice(-2);       <------------------------------------------------------------------------------ Only SiteSage	     	var siteIndex = document.getElementById("siteType").innerHTML + "-" + currdiv.slice(-2);	     	urlViewDocs = global_location + "/vw405?ReadViewEntries&RestrictToCategory=" + siteIndex + "&count=" + attachments_num;			callback = { cache: false, success:handleSuccess_03, failure: handleFailure, argument: [currdiv, "view_search_documents"] }			break;	     case "view_most_recent"://	     	var siteIndex = currdiv.slice(-2);       <------------------------------------------------------------------------------ Only SiteSage	     	var siteIndex = document.getElementById("siteType").innerHTML + "-" + currdiv.slice(-2);	     	urlViewDocs = global_location + "/vw406?ReadViewEntries&RestrictToCategory=" + siteIndex + "&count=" + attachments_num;			callback = { cache: false, success:handleSuccess_05, failure: handleFailure, argument: [currdiv] }			break;		case "view_category_documents":			var libraryIndex = currdiv.slice(-2);//			var siteIndex = (currdiv.slice(-4)).substring(2,-2);      <---------------------------------------------------------------------- Only SiteSage			var siteIndex = document.getElementById("siteType").innerHTML + "-" +  (currdiv.slice(-4)).substring(2,-2);			var userclassesNum = document.getElementById(currdiv).getAttribute("userclasses");			var childrenNum = document.getElementById(currdiv).getAttribute("children");			/*-------------*/			switch (document.getElementById('userclasses').innerHTML) { // tmp - related to SiteSage				case "none" :					urlViewDocs = global_location + "/vw403?ReadViewEntries&RestrictToCategory=" + siteIndex + "&start=" + parseInt(libraryIndex,10) + ".1&count=" + (parseInt(childrenNum,10) + parseInt(userclassesNum,10));					break;				case "distributorclass:none" :					urlViewDocs = global_location + "/vw402?ReadViewEntries&RestrictToCategory=" + siteIndex + "&start=" + parseInt(libraryIndex,10) + ".1&count=" + (parseInt(childrenNum,10) + parseInt(userclassesNum,10));					break;				case "signupclass:none" :					urlViewDocs = global_location + "/vw403?ReadViewEntries&RestrictToCategory=" + siteIndex + "&start=" + parseInt(libraryIndex,10) + ".1&count=" + (parseInt(childrenNum,10) + parseInt(userclassesNum,10));					break;			}			/*-------------*/			callback = { cache: false, success:handleSuccess_03, failure: handleFailure, argument: [currdiv] }			break;	     default:			document.getElementById('pagelog').innerHTML = document.getElementById('pagelog').innerHTML + "FUNCTION : perform_Documents_Request(" + funType + "," + currdiv + "," + attachments_num + ")";			break;	}	var request = YAHOO.util.Connect.asyncRequest('GET', urlViewDocs, callback);}/*---------------- Get list of Attachments type --------------------------------------------------------*/var handleSuccess_07 = function(o){	if(o.responseText !== undefined){		var objText = o.responseText;		var funType = o.argument[0];		var target_id = o.argument[1];		global_string["attachments_type"] = "<>" + (objText.split('<body text="#000000" bgcolor="#FFFFFF">')[1]).split("</body>")[0];		showRows_aux(funType, target_id);	}}function getAttachmentsType(funType, target_id) {	var urlLibraries = global_location + "/web-vw102?OpenView";	var args =[funType, target_id]	var req = YAHOO.util.Connect.asyncRequest('GET', urlLibraries, { cache: false, success:handleSuccess_07, failure: handleFailure, argument: args } );}