﻿var isIE=document.all&&document.getElementById&&navigator.appName.indexOf("Opera")==-1;function callExp(linkID,obsvName,expName,existingFunction){var pathArray=[];pathArray=location.pathname.split("/");var qs=[],displayLang,cCode,errorCode;qs=location.search.substr(1).split("&");for(var i=0;i<qs.length;i++){if(qs[i].split("=")[0]=="cCode")cCode=qs[i];if(qs[i].split("=")[0]=="Error")errorCode=qs[i];if(qs[i].split("=")[0]=="displaylang")displayLang=qs[i]}var obj=document.getElementById(linkID);if(obj){var imgURL;imgURL=location.protocol+"//";imgURL+=location.host+"/";imgURL+=pathArray[1];imgURL+="/common/GFFObserver.aspx?";imgURL+="linkURI="+OutputEncoder_EncodeUrl(obj.href)+"&";if(obj.innerText)imgURL+="linkTitle="+OutputEncoder_EncodeUrl(obj.innerText.replace(/^\s*|\s*$|\r|\n|\r\n/g,""))+"&";else if(obj.textContent)imgURL+="linkTitle="+OutputEncoder_EncodeUrl(obj.textContent.replace(/^\s*|\s*$|\r|\n|\r\n/g,""))+"&";imgURL+="sId="+obj.id+"&";if(displayLang!=null)imgURL+="displayLang="+displayLang.split("=")[1]+"&";if(cCode!=null)imgURL+="cCode="+cCode.split("=")[1]+"&";if(errorCode!=null)imgURL+="GenuineErrorCode="+errorCode.split("=")[1]+"&";if(obsvName!=null)imgURL+="obsvName="+obsvName+"&";if(expName!=null)imgURL+="expName="+expName+"&";imgURL+="sequenceNumber="+Math.floor(Math.random()*1e3);var httpRequest;if(window.XMLHttpRequest)httpRequest=new XMLHttpRequest;else if(window.ActiveXObject)httpRequest=new ActiveXObject("Microsoft.XMLHTTP");if(httpRequest!=null){httpRequest.open("GET",imgURL,true);if(existingFunction!=null)httpRequest.onreadystatechange=function(){if(httpRequest.readyState==2)existingFunction()};httpRequest.send(null)}else if(existingFunction!=null)existingFunction()}if(isIE)window.event.cancel=true}function AttachGFFHandler(linkID,observationName,experimentName){var linkObject=document.getElementById(linkID);if(linkObject!=null){var existingFunction=linkObject.onclick;linkObject.onclick=function(){callExp(linkID,observationName,experimentName,existingFunction)}}}function OutputEncoder_TwoByteHex(charC){var TwoByteHex=charC.toString(16);for(var cnt=TwoByteHex.length;cnt<4;cnt++)TwoByteHex="0"+TwoByteHex;return TwoByteHex}function OutputEncoder_SingleByteHex(charC){var SingleByteHex=charC.toString(16);for(var cnt=SingleByteHex.length;cnt<2;cnt++)SingleByteHex="0"+SingleByteHex;return SingleByteHex}function OutputEncoder_EncodeUrl(strInput){var EncodeUrl="empty";if(typeof strInput!="undefined"){EncodeUrl="";strInput=strInput.toString();var c;for(var cnt=0;cnt<strInput.length;cnt++){c=strInput.charCodeAt(cnt);if(c>96&&c<123||c>64&&c<91||c>47&&c<58||c==46||c==45||c==95)EncodeUrl=EncodeUrl+strInput.charAt(cnt);else if(c>127)EncodeUrl=EncodeUrl+"%u"+OutputEncoder_TwoByteHex(c);else EncodeUrl=EncodeUrl+"%"+OutputEncoder_SingleByteHex(c)}}return EncodeUrl}