/* *		Description * *		Author: Mauro C. (Exor International) *		Date: Jan/2009 * *//* *		Function: getURLParameter(strParamName, urltype)  * *		Return: *		the value of the requested parameter (that must be lowercase).  * *		Input: *		urltype = "parent" | "" - Specifies if catch current iframe url or parent url. *		----------------------------------------------------------------------------------------------------------------------------------------   */ function getURLParameter(paramName, urltype) {	var paramValue = "";	var strHref = ""; 		if (urltype == "parent") {		strHref = parent.document.location.href;	} else { 		strHref = window.location.href;				}		if ( strHref.indexOf("&") > -1 ) {		var strQueryString = strHref.substr(strHref.indexOf("&")).toLowerCase();		var aQueryString = strQueryString.split("&");		for ( var iParam = 0; iParam < aQueryString.length; iParam++ ) {			if ( aQueryString[iParam].indexOf(paramName + "=") > -1 ) {				var aParam = aQueryString[iParam].split("=");				paramValue = aParam[1];				break;			}		}	}		return paramValue;}/* *		Function: encodeString * *		Return:  *		replace '&', '?', '=', ':', '/' in a given string with Hex values   *		---------------------------------------------------------------------------------------------------------------------------------------- */		function encodeString (str) {	var res = str;		res = res.replace(/\&/g,"%26");	res = res.replace(/\?/g,"%3F");	res = res.replace(/\=/g,"%3D");	res = res.replace(/\:/g,"%3A");	res = res.replace(/\//g,"%2F");    	return res;}/* *		Function: szRand * *		Return:  *		a random number *		---------------------------------------------------------------------------------------------------------------------------------------- */ function szRand(separatore) {		// This is a random number to append at the end of the url to avoid caching	var random = new Date().getTime() ;	return separatore + random;	}/* *		Function: getWebsiteAddress( ruletype ) * *		Return:  *		check if substitution rules are used, and return address * *      	Input (ruletype):  *       - sys 		Return: http://WebsiteDomain/sys 	(http://mauro.exorint.net/sys) *					or:			/sitek/doc-bloky.nsf *		- page	Return: http://WebsiteDomain/ 		(http://mauro.exorint.net/) *					or: 		/sitek/doc-bloky.nsf/Web-Page?ReadForm&wPageName= *		---------------------------------------------------------------------------------------------------------------------------------------- */function getWebsiteAddress(ruletype) {	var res = document.getElementById('WebsiteDomain').innerHTML;        if (res != "") {            // http://sitek.exorint.net/it/            if (ruletype == "page") {                 // none            }            // http://sitek.exorint.net/it/sys            if (ruletype == "sys") {                 res = res + "sys";            }        } else {            var domain = window.location.hostname;            var db = document.getElementById('WebsiteDB').innerHTML;            res = "/" + db;            // /sitek/doc-bloky.nsf/Web-Page?ReadForm&wPageName=            if (ruletype == "page") {                 res = res + "/Web-Page?ReadForm&wPageName="            }            // /sitek/doc-bloky.nsf            if (ruletype == "sys") {                 // none            }        }	return res;}/* *		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);//					setTimeout(callback, 1000);					}							},		failure:function(o) {//			alert("Ajax Loading Error");		},		cache:false	};		var transaction = YAHOO.util.Connect.asyncRequest('GET', url, ajaxResponse);}/* *		Function: setSameHeight *		---------------------------------------------------------------------------------------------------------------------------------------- */function setSameHeight() {}/* *		Function:  LoadContent *		---------------------------------------------------------------------------------------------------------------------------------------- */ function LoadContent(URL, container) {var loadContainer;	if (typeof(container) == "undefined") {		loadContainer = "pageCol2";	} else {		loadContainer = container;	}	YAHOO.util.Dom.setStyle(['pageCol1', 'pageCol2', 'pageCol3'], 'height', '500px');	ajaxpage(URL, loadContainer);}/* *		Function:  pageDone *		This function is executed after loading a page. *		---------------------------------------------------------------------------------------------------------------------------------------- */ function pageDone(URL) {	if (window.pageInit != undefined) {	    pageInit();	    };	if (window.runCode != undefined) {	    runCode();	    };	    	setSameHeight();}/* *		Function: setSignInAddr(historyAddressurl)  *		Set the address in the Sign-In link of the Control Panel if historyAddressurl is NULL else set  *		the address of private page specified. *		---------------------------------------------------------------------------------------------------------------------------------------- */function setSignInAddr(historyAddressURL) {	//Check whether the user is in product catalog section. Here we don't use .html extension	var inProductPage = window.location.href.toLowerCase().indexOf("&wpagename=products&") !== -1? true:false;		var loc = "";	if (historyAddressURL == "") {		loc = encodeString (window.location.href);	} else {		loc = encodeString (historyAddressURL);	}		// Patch to manage www.naviop.com without /home.html	if (inProductPage === false && (loc.slice(loc.length-5) != ".html") && (document.getElementById('WebsiteDomain').innerHTML != "")) {			loc = loc + "home.html";	}		if (loc.search("wPageName=login") == -1)	{		location.replace( getWebsiteAddress('page') + "login.html&historyAddress=" + loc  );	}}/* *  		Function: setLogoutAddr() *		---------------------------------------------------------------------------------------------------------------------------------------- */function setLogoutAddr() {	//	window.location = getWebsiteAddress('sys') + '?Logout&RedirectTo=' + encodeString (getWebsiteAddress('page'));//	window.location = getWebsiteAddress('sys') + '?Logout&RedirectTo=' + encodeString (window.location.href) ;	window.location = getWebsiteAddress('sys') + '?Logout';	}/* *  		Function: setMyProfileAddr() *		---------------------------------------------------------------------------------------------------------------------------------------- */function setMyProfileAddr() {		if (document.getElementById('WebsiteDomain').innerHTML != "") {		window.location = getWebsiteAddress('page') + 'My-Profile.html';	}	else {		window.location = getWebsiteAddress('page') + 'My-Profile';	}	}/* *  		Function: openLotusDB() *		---------------------------------------------------------------------------------------------------------------------------------------- */function openLotusDB() {	var lotusServer = document.getElementById('LotusServer').innerHTML;	var db = document.getElementById('WebsiteDB').innerHTML;	window.location = 'notes://' + lotusServer + '/' + db ;}/* *  		Function: editPage() *		---------------------------------------------------------------------------------------------------------------------------------------- */function editPage() {	if (document.getElementById('EditWiki') == null) {		// Edit document inside cms		var page = document.getElementById('PageUID').innerHTML;		if (document.getElementById('noWebEdit').innerHTML == 'True')			alert('Locked! This page can be changed through Lotus Client only.');		else			window.location = getWebsiteAddress('sys') + '/View-03/' + page + '?EditDocument'	}	else {		// Edit document inside bloky		var page = document.getElementById('EditWiki').innerHTML ;		window.location =  page.replace( /\&amp;/g,		"&");	}}/* *		Function: openProtectPage() *		Open the Login page and then redirect to the protect page *		---------------------------------------------------------------------------------------------------------------------------------------- */function openProtectPage(domain) {var url, urlSplit, urlNew;var urlHistory;	url = location.href ;	if (domain == "") { 	   urlSplit = url.search("Web-Page");    }	urlHistory = encodeString(url);		if (domain != "") {		urlNew = domain + "Login&historyAddress=" + urlHistory;	} else {		urlNew = url.slice(0, urlSplit) + "Web-Page?ReadForm&wPageName=Login&historyAddress=" + urlHistory;	}		window.location = urlNew;}/* *  		Function: getUserID() * * 		Return  *		a json variable with user name and user mail. *		---------------------------------------------------------------------------------------------------------------------------------------- */function getUserID(callback) {	var url = getWebsiteAddress('sys') + "/getUserID?OpenAgent&Callback=" + callback + szRand('&') ;	var script = document.createElement('script');	script.setAttribute('src', url);	document.body.appendChild(script);	}/* *  		Function: checkUserRights() * * 		Return  *		a json variable with user name and user mail. *		---------------------------------------------------------------------------------------------------------------------------------------- */function checkUserRights(callback, group) {	var url = getWebsiteAddress('sys') + "/checkUserRights?OpenAgent&Callback=" + callback + "&Group=" + group + szRand('&') ;	var script = document.createElement('script');	script.setAttribute('src', url);	document.body.appendChild(script);	}/* *		Function: hiddenSignIn()  *		---------------------------------------------------------------------------------------------------------------------------------------- */function hiddenSignIn(username, password) {	location.replace( getWebsiteAddress('sys') + "?Login" 							+ "&username=" 	+ username 							+ "&password=" 		+ password 							+ "&RedirectTo=" 	+ encodeString (window.location.href)  );}/* *		Function: signUp()  *		---------------------------------------------------------------------------------------------------------------------------------------- */function signUp() {	location.replace( getWebsiteAddress('sys') + "/Web-Page?ReadForm&wPageName=registration" ) ;	}