/*  *		Description:	 *		Javascript used from the Web pages (API) * *		Author: Mauro C. (Exor International) *		Date: Jan/2009 * *		Sample: *		st001Init('/sitek/ML-ExorInt-KB.nsf', 'tagsTitle', 'tags', 'docList', 'docContainer', 'setSameHeight()'); *		st001LoadTags('Website', 'UniOP', 'FAQ'); *		st001LoadDocList('WebsiteAll', 'UniOP', 'News', ''); *		st001ShowDocuments('UniOP', 'News', 5, 'hiddenContainer', 'docContainer'); * *//* *		Function: ajaxpage *		Asynchronous loading a page using Yahoo library * *		Include files: *		<script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/utilities/utilities.js"></script> * *		Reference: *		http://developer.yahoo.com/yui/connection/ *		---------------------------------------------------------------------------------------------------------------------------------------- */function ajaxpage (url, container, callback) {			var ajaxResponse = {		success:function(o) {			document.getElementById(container).innerHTML = o.responseText ;			if (typeof(callback) != "undefined")				eval(callback);		},		failure:function(o) {//			alert("Ajax Loading Error");		},		cache:false	};		var transaction = YAHOO.util.Connect.asyncRequest('GET', url, ajaxResponse);}/* *		Function: Init *		Set Container IDs *		---------------------------------------------------------------------------------------------------------------------------------------- */var idTagsTitle, idTagsList, idDocList, idDocument;var selFilterValue, selDocType;var idDatabase;var idCallBack;function st001Dummy() {} ;	function st001Init(Database, TagsTitleContainer, TagsListContainer, DocListContainer, DocumentContainer, CallBack){	idTagsTitle = TagsTitleContainer;	idTagsList = TagsListContainer;	idDocList = DocListContainer;	idDocument = DocumentContainer;		if (Database==null) {		idDatabase = location.href.substring(0,location.href.indexOf(".nsf")) + ".nsf" ;	} else {		idDatabase = Database;	};	if (typeof(CallBack) != "undefined") {		idCallBack = CallBack;	} else {		idCallBack = 'st001Dummy()';	}}/* *		Function: LoadTags *		Load tags and tags title inside the appropriate container * *		Input: *		filterType = 'Product' | 'Website' *		---------------------------------------------------------------------------------------------------------------------------------------- */function st001LoadTags(filterType, filterValue, docType, tagsTitle){	selFilterValue = filterValue ;	selDocType = docType ;	if (tagsTitle!=null) {		document.getElementById(idTagsTitle).innerHTML = tagsTitle ;		}	ajaxpage(idDatabase + "/tagList" + filterType + "?openpage&Filter=" + filterValue + "." + docType, idTagsList, idCallBack);	document.getElementById(idDocList).innerHTML = "";		document.getElementById(idDocument).innerHTML = "" ;	}/* *		Function: LoadDocList *		Load document inside the appropriate container * *		Input: *		filterType = 'Product' | 'Website' | 'WebsiteAll' *		---------------------------------------------------------------------------------------------------------------------------------------- */function st001LoadDocList(filterType, filterValue, docType, docTag){//	ajaxpage(idDatabase + "/docListProduct?openview&start=1&count=10&RestrictToCategory=" + idProduct + "." + idDocType + "." + Tag, idDocList, idCallBack);	ajaxpage(idDatabase + "/docList" + filterType +"?openview&RestrictToCategory=" + filterValue + "." + docType + "." + docTag, idDocList, idCallBack);	document.getElementById(idDocument).innerHTML = "" ;	}/* *		Function: LoadDocument *		Load document inside the appropriate container and go to "st001DocContainer" bookmark * *		Tips: *		<a name="st001DocContainer"> *		---------------------------------------------------------------------------------------------------------------------------------------- */function st001LoadDocument(DocumentUniqueID){	ajaxpage(idDatabase + "/byCode/" + DocumentUniqueID + "?opendocument", idDocument, idCallBack);}/* *		Function: showDocuments *		 * *		Input: *		 *		---------------------------------------------------------------------------------------------------------------------------------------- */var tmp_hiddenContainer, tmp_visibleContainer ;var tmp_pageCollection = new Array(), tmp_nPages ;function addDocument(index) {	tmp_pageCollection[index] = document.getElementById(tmp_hiddenContainer).innerHTML ;	document.getElementById(tmp_visibleContainer).innerHTML = ""	for (i=0;	i<tmp_nPages; i=i+1) {	if ( (typeof(tmp_pageCollection[i])) != "undefined") {		document.getElementById(tmp_visibleContainer).innerHTML = document.getElementById(tmp_visibleContainer).innerHTML + tmp_pageCollection[i];		}	}			if (typeof(idCallBack) != "undefined") {		eval(idCallBack);	}	} ;function showDocsInternal() {var pages=new Array(tmp_nPages);var pageList = document.getElementById(tmp_hiddenContainer).innerHTML ;     pageList = pageList.substring( pageList.indexOf("DocMARK=")+8 );	pages = pageList.split(",", tmp_nPages) ;		for (i=0; i<tmp_nPages; i=i+1) {		if (pages[i].length != 32) {			break;			}		ajaxpage(idDatabase + "/docList-01/" + pages[i] + "?opendocument", tmp_hiddenContainer, 'addDocument('+i+')');			}}	function st001ShowDocuments(filterValue, docType, nPages, hiddenContainer, visibleContainer) {	tmp_hiddenContainer  = hiddenContainer ;	tmp_visibleContainer  = visibleContainer;	tmp_nPages = nPages;		ajaxpage(idDatabase + "/docList-01?openview&RestrictToCategory=" + filterValue + "." + docType, hiddenContainer, 'showDocsInternal()');}