/** * attach an event to an object. * @param obj Object or Node to attach the event * @param type Event type to attach * @param fn Function name to trigger * @version 1.0 build 10.3.2009 * @author Witali Ott, SP Integration GmbH */function addEvent( obj, type, fn ) {  if ( obj.attachEvent ) {    obj['e'+type+fn] = fn;    obj[type+fn] = function(){obj['e'+type+fn]( window.event );}    obj.attachEvent( 'on'+type, obj[type+fn] );  } else    obj.addEventListener( type, fn, false );};/** * detach an event from an object. * @param obj Object or Node to detach the event * @param type Event type to detach * @param fn Function name to detach * @version 1.0 build 10.3.2009 * @author Witali Ott, SP Integration GmbH */function removeEvent( obj, type, fn ) {  if ( obj.detachEvent ) {    obj.detachEvent( 'on'+type, obj[type+fn] );    obj[type+fn] = null;  } else    obj.removeEventListener( type, fn, false );}/** * Removes the protocol and hostname from the URL (if present). * @param strURL URL to be processed * @return strURL without the protocol and host name (starting with the first slash after the //) or simply strURL if no // was found. * @version 1.0 build 10.3.2009 * @author Witali Ott, SP Integration GmbH */function processWebUrl(strURL){	var pos1 = strURL.indexOf("://");	if (pos1 > -1) {		var pos2 = strURL.indexOf("/", pos1 + 3);		if (pos2 > -1) {			return strURL.substring(pos2, strURL.length);		}else{			return strURL.substring(pos1 + 3, strURL.length);		}	}	else {		return strURL	}}/** * Attach events to all download links in the body tag. * This is required to track user activities (WiredMinds, WebTrends, Google Analytics etc.) * @version 1.0 build 10.3.2009 * @author Witali Ott, SP Integration GmbH */function attachAnalyseCode(){	var objBody = document.getElementsByTagName('body')[0];		if (objBody) {		// get all a-tags nodes and store it in an array		var arrBodyLinks = objBody.getElementsByTagName('a');		// loop through all a-tag nodes		for (var i = 0; i < arrBodyLinks.length; i++) {			//get download link URI			var strHref = "";			strHref = arrBodyLinks[i].getAttribute('href');			if (strHref != null && strHref.length > 0) {				// remove protocol and hostname if present				strHref = processWebUrl(strHref);				// attach onclick event only to downloads stored in the vwLookupDownloads view				if (strHref.toLowerCase().indexOf("/vwlookupdownloads/") != -1) {					if (isWMenabled) {						// attach WiredMinds tracking code						addEvent(arrBodyLinks[i], "click", function(){							this.processedUrl = this.href;							this.strDLFileName = this.processedUrl.substring(this.processedUrl.lastIndexOf("/") + 1);							this.strDLFileNameDecoded = decodeURI(this.strDLFileName);							wiredminds.count(this.strDLFileNameDecoded);						});					};				}			}		}	}}/** * Triggered by the DomContentLoaded event  * IE uses defered loading of a separate script that triggers the autoLoadAnalyseEvent function from "sfrmWebAnalysisWiredMinds" subform * @version 1.0 build 11.3.2009 * @author Witali Ott, SP Integration GmbH */function autoLoadAnalyseEvent(){	// quit if this function has already been called	if (arguments.callee.done) return;	// flag this function so we don't do the same thing twice	arguments.callee.done = true;		//List any additional functions that should fire on window.onload.	try{		attachAnalyseCode();	}catch(e){}}/** * This needs to be at the bottom of the lib so that everything else has loaded!  * For mozilla browsers, so script doesn't have to wait for all resources to load and can start processing instantly. * IE uses defered loading of a separate script that triggers the autoLoadAnalyseEvent function directly from the webpage header * @version 1.0 build 11.3.2009 * @author Witali Ott, SP Integration GmbH */if (document.addEventListener) {	document.addEventListener("DOMContentLoaded", autoLoadAnalyseEvent, false);}/* For all other browsers that doesn't support this. (Non IE/Mozilla/Opera/Safari) */window.onload=autoLoadAnalyseEvent;