var t=this;
var ajaxSending=0;
var aqueue=new Array();
function callAjax(sendQuery) {
if(ajaxSending) {
aqueue.push(sendQuery);
}
else {
doAjax(sendQuery);
}
}
function doAjax(query) {
ajaxSending=1;
var url='/ajax';
if(query.overrideUrl) {
url=query.overrideUrl;
}
var sendQuery='';
if(typeof(query)=='object') {
query['ajax']=1;
var r=Math.floor(Math.random()*1000000000);
query['noCache']=r;
for(var i in query) {
var sToChange=String(query[i]);
var re=/\;/g;
var changed=sToChange.replace(re, "0x3B");
query[i]=changed;
sendQuery+="&"+i+"="+query[i];
}
}
else if(typeof(query)=='string') {
var sToChange=String(query);
var re=/\;/;
var changed=sToChange.replace(re, "0x3B");
query=changed;
sendQuery+="&"+query+"&ajax=1";
}
myRequest.open("POST",url,true);
myRequest.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
myRequest.send(sendQuery);
myRequest.onreadystatechange=responseHandler;
}
function getXMLHttpRequest() {
var request=false;
try {
request=new XMLHttpRequest();
}
catch(err1) {
try {
request=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(err2) {
try {
request=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(err3) {
request=false;
}
}
}
return request;
}
function responseHandler() {
if(myRequest.readyState == 4) {
if(myRequest.status == 200) {
ajaxSending=0;
var myXML=myRequest.responseXML;
if(myXML.childNodes[0]) {
var myAtt=myXML.childNodes[0].getAttribute('feature');
var myHandler=myXML.childNodes[0].getAttribute('handler');
if(myHandler) {
if(w[myHandler]) {
w[myHandler](myXML);
}
}
else if(myAtt) {
if(t[myAtt+'_Event']) {
t[myAtt+'_Event'](myXML);
}
}
}
if(aqueue.length) {
callAjax(aqueue[0]);
aqueue.shift();
}
}
}
}
var myRequest=getXMLHttpRequest();var FunTags=0;
var fta=new Array();
function AIR_FunTag(e) {
var pieces=e.innerHTML.split(" ");
var appName='';
var url=pieces[0];
for(var i=0;i0) {
appName+=pieces[i];
if(i<(pieces.length-1)) {
appName+=' ';
}
}
}
while(e.firstChild) {
e.removeChild(e.firstChild);
}
appName=encodeURIComponent(appName);
url=encodeURIComponent(url);
var ilf=document.createElement('iframe');
if(isIE) {
ilf.style.height='168px';
ilf.style.width='245px';
e.style.height='168px';
e.style.width='245px';
}
else {
ilf.style.height='138px';
ilf.style.width='215px';
e.style.height='168px';
e.style.width='245px';
}
ilf.setAttribute('src','http://www.airapps.net/badge.pl?appname='+appName+'&appurl='+url+'&airversion=1.0.M4&fColor=FFFFFF');
ilf.style.borderStyle='none';
ilf.setAttribute('frameborder','no');
ilf.setAttribute('overflow','hidden');
ilf.style.overflow='hidden';
e.appendChild(ilf);
}
function AudioPlay_FunTag(e) {
var sound=e.innerHTML.split(" ");
var s='';
var uid=sound[0];
for(var i=0;i0) {
s+=sound[i];
if(i<(sound.length-1)) {
s+=' ';
}
}
}
e.innerHTML='';
}
function AudioRecord_FunTag(e) {
e.innerHTML='';
}
function DoFunTags(e) {
if(!e) {
e=document;
}
fta=[];
var ft=new Object();
ft["About"]=1;
ft["Actor"]=1;
ft["AIR"]=2;
ft["Amazon"]=1;
ft["AIRApps"]=1;
ft["AudioPlay"]=2;
ft["AudioRecord"]=2;
ft["Blogger"]=1;
ft["Calculator"]=1;
ft["Dictionary"]=1;
ft["Extension"]=1;
ft["Film"]=1;
ft["Flickr"]=1;
ft["Forecast"]=1;
ft["Google"]=1;
ft["GoogleImages"]=1;
ft["GoogleMaps"]=2;
ft["GoogleNews"]=1;
ft["GoogleVideo"]=1;
ft["IP"]=1;
ft["Merlot"]=1;
ft["Odeo"]=1;
ft["Register"]=2;
ft["SpellCheck"]=1;
ft["Stock"]=1;
ft["Technorati"]=1;
ft["Telephone"]=2;
ft["VideoPlay"]=2;
ft["VideoRecord"]=2;
ft["Weather"]=1;
ft["WebMD"]=1;
ft["Wikipedia"]=1;
ft["YouTube"]=1;
ft["Zap2It"]=1;
ft["Spanish"]=1;
ft["French"]=1;
ft["German"]=1;
ft["Italian"]=1;
ft["Dutch"]=1;
ft["Portuguese"]=1;
var ftx='';
var tags=e.getElementsByTagName('div');
var matchTags=0;
for(var i=0;i';
fta[matchTags]=tags[i];
tags[i].style.visibility='hidden';
matchTags++;
}
else if(ft[tags[i].className]==2) {
t[tags[i].className+'_FunTag'](tags[i]);
}
}
ftx+='';
if(matchTags) {
var query=new Object();
query['feature']='Search';
query['module']='FunTags';
query['method']='doFunTags';
query['funTags']=escape(ftx);
query['handler']='DoFunTags_handler';
callWebService(query);
}
}
function DoFunTags_handler(xmlObject) {
var result=getXPath(xmlObject,"//FunTag");
for(var i=0;i'+result[i].childNodes[0].childNodes[j].childNodes[0].nodeValue+'';
}
}
else if(result[i].childNodes[0].childNodes[j].nodeName=='a') {
xhtml+=''+result[i].childNodes[0].childNodes[j].childNodes[0].nodeValue+'';
}
else {
xhtml+=createStringFromXml(result[i].childNodes[0].childNodes[j]);
}
}
}
if((tagType) && (fta[i])) {
fta[i].innerHTML=xhtml;
fta[i].style.visibility='visible';
}
}
}
function DoRegister() {
var uid=document.getElementById('Register_Email').value;
var password=document.getElementById('Register_Password').value;
if((!uid) || (!password)) {
alert('Enter an e-mail address and password');
}
else {
var a=uid.split("@");
if(!a[1]) {
alert('Enter a valid e-mail address');
}
else {
var query=new Object();
query['feature']='Search';
query['method']='preRegister';
query['uid']=uid;
query['password']=password;
query['makeSecure']=1;
query['handler']='DoRegister_handler';
callWebService(query);
}
}
}
function DoRegister_handler(xmlObject) {
var result=getXPath(xmlObject,"//uid");
var error=Number(result[0].getAttribute("error"));
alert(result[0].getAttribute("message"));
if(!error) {
var a=document.getElementsByTagName("DIV");
for(var i=0;i';
}
function VideoPlay_FunTag(e) {
var sound=e.innerHTML.split(" ");
var s='';
var uid=sound[0];
for(var i=0;i0) {
s+=sound[i];
if(i<(sound.length-1)) {
s+=' ';
}
}
}
e.innerHTML='';
}
function VideoRecord_FunTag(e) {
e.innerHTML='';
}var doAuth=function() {
if(!getCookie("S_uid")) {
var d=document.createElement('div');
d.setAttribute('id','Auth_div');
d.style.position='absolute';
d.className='S_RegularText';
d.style.width='300px';
d.style.padding='5px';
d.style.backgroundColor='#2677B6';
d.style.color='#FFFFFF';
d.style.zIndex=1000030;
d.style.borderColor='#FFFFFF';
d.style.borderStyle='solid';
d.style.borderWidth='1px';
var b=getBrowserObject();
d.style.left=(b.clientWidth/2) - 150 + 'px';
d.style.top=(b.clientHeight/2) - 50 + 'px';
var s=document.createElement('span');
s.innerHTML='Enter your Enrich Username and Password:YOUR INFORMATION IS STRONGLY ENCRYPTED FOR YOUR PROTECTION';
s.innerHTML+='Email
';
s.innerHTML+='Password
';
s.innerHTML+=' ';
d.appendChild(s);
document.body.appendChild(d);
var i=document.getElementById('Auth_uid');
i.onkeypress=function() {
var event=EventUtil.getEvent();
if ((event && event.which == 13) || (event && event.keyCode == 13)) {
document.getElementById('Auth_password').focus();
}
else {
return true;
}
}
var i=document.getElementById('Auth_password');
i.onkeypress=function() {
var event=EventUtil.getEvent();
if ((event && event.which == 13) || (event && event.keyCode == 13)) {
Auth_sendUID();
}
else {
return true;
}
}
return -1;
}
else {
if(S_searchDevicesObject[module].doAuth) {
S_searchDevicesObject[module].doAuth(getCookie("S_uid"));
return -1;
}
else {
var thisObject=new Object();
thisObject['uid']=getCookie("S_uid");
return thisObject;
}
}
}
function Auth_sendUID() {
var email=document.getElementById('Auth_uid').value;
var password=document.getElementById('Auth_password').value;
if((!email) || (!password)) {
alert('Enter your Enrich E-Mail/Username and Password!');
}
else {
var query=new Object();
query['feature']='Search';
query['method']='authenticate';
query['uid']=email;
query['password']=password;
query['handler']='AuthInitialize_Event';
query['moduleNamespace']='Auth';
callWebService(query);
}
}
function Auth_cancelUID() {
var e=document.getElementById('Auth_div');
e.parentNode.removeChild(e);
}
function AuthInitialize_Event(xmlObject) {
var result=getXPath(xmlObject,"//uid");
var uid=Number(result[0].getAttribute('value'));
if(uid<1) {
alert('Invalid Enrich E-Mail/Username and/or Password!');
}
else {
Auth_cancelUID();
setCookie("S_uid",uid);
if(S_searchDevicesObject[module].doAuth) {
S_searchDevicesObject[module].doAuth(uid);
}
else {
S_startSearch(S_cachedSearch,0,1);
}
}
}var sUserAgent=navigator.userAgent;
var fAppVersion=parseFloat(navigator.appVersion);
var isSafari;
function compareVersions(sVersion1, sVersion2) {
var aVersion1=sVersion1.split(".");
var aVersion2=sVersion2.split(".");
if (aVersion1.length > aVersion2.length) {
for (var i=0; i < aVersion1.length - aVersion2.length; i++) {
aVersion2.push("0");
}
} else if (aVersion1.length < aVersion2.length) {
for (var i=0; i < aVersion2.length - aVersion1.length; i++) {
aVersion1.push("0");
}
}
for (var i=0; i < aVersion1.length; i++) {
if (aVersion1[i] < aVersion2[i]) {
return -1;
} else if (aVersion1[i] > aVersion2[i]) {
return 1;
}
}
return 0;
}
var isOpera=sUserAgent.indexOf("Opera") > -1;
var isMinOpera4=isMinOpera5=isMinOpera6=isMinOpera7=isMinOpera7_5=false;
if (isOpera) {
var fOperaVersion;
if(navigator.appName == "Opera") {
fOperaVersion=fAppVersion;
} else {
var reOperaVersion=new RegExp("Opera (\\d+\\.\\d+)");
reOperaVersion.test(sUserAgent);
fOperaVersion=parseFloat(RegExp["$1"]);
}
isMinOpera4=fOperaVersion >= 4;
isMinOpera5=fOperaVersion >= 5;
isMinOpera6=fOperaVersion >= 6;
isMinOpera7=fOperaVersion >= 7;
isMinOpera7_5=fOperaVersion >= 7.5;
}
var isKHTML=sUserAgent.indexOf("KHTML") > -1
|| sUserAgent.indexOf("Konqueror") > -1
|| sUserAgent.indexOf("AppleWebKit") > -1;
var isMinSafari1=isMinSafari1_2=false;
var isMinKonq2_2=isMinKonq3=isMinKonq3_1=isMinKonq3_2=false;
if (isKHTML) {
isSafari=sUserAgent.indexOf("AppleWebKit") > -1;
isKonq=sUserAgent.indexOf("Konqueror") > -1;
if (isSafari) {
var reAppleWebKit=new RegExp("AppleWebKit\\/(\\d+(?:\\.\\d*)?)");
reAppleWebKit.test(sUserAgent);
var fAppleWebKitVersion=parseFloat(RegExp["$1"]);
isMinSafari1=fAppleWebKitVersion >= 85;
isMinSafari1_2=fAppleWebKitVersion >= 124;
} else if (isKonq) {
var reKonq=new RegExp("Konqueror\\/(\\d+(?:\\.\\d+(?:\\.\\d)?)?)");
reKonq.test(sUserAgent);
isMinKonq2_2=compareVersions(RegExp["$1"], "2.2") >= 0;
isMinKonq3=compareVersions(RegExp["$1"], "3.0") >= 0;
isMinKonq3_1=compareVersions(RegExp["$1"], "3.1") >= 0;
isMinKonq3_2=compareVersions(RegExp["$1"], "3.2") >= 0;
}
}
var isIE=sUserAgent.indexOf("compatible") > -1
&& sUserAgent.indexOf("MSIE") > -1
&& !isOpera;
var isMinIE4=isMinIE5=isMinIE5_5=isMinIE6=false;
var fIEVersion;
if (isIE) {
var reIE=new RegExp("MSIE (\\d+\\.\\d+);");
reIE.test(sUserAgent);
fIEVersion=parseFloat(RegExp["$1"]);
isMinIE4=fIEVersion >= 4;
isMinIE5=fIEVersion >= 5;
isMinIE5_5=fIEVersion >= 5.5;
isMinIE6=fIEVersion >= 6.0;
}
var isMoz=sUserAgent.indexOf("Gecko") > -1
&& !isKHTML;
var isMinMoz1=sMinMoz1_4=isMinMoz1_5=false;
if (isMoz) {
var reMoz=new RegExp("rv:(\\d+\\.\\d+(?:\\.\\d+)?)");
reMoz.test(sUserAgent);
isMinMoz1=compareVersions(RegExp["$1"], "1.0") >= 0;
isMinMoz1_4=compareVersions(RegExp["$1"], "1.4") >= 0;
isMinMoz1_5=compareVersions(RegExp["$1"], "1.5") >= 0;
}
var isNS4=!isIE && !isOpera && !isMoz && !isKHTML
&& (sUserAgent.indexOf("Mozilla") == 0)
&& (navigator.appName == "Netscape")
&& (fAppVersion >= 4.0 && fAppVersion < 5.0);
var isMinNS4=isMinNS4_5=isMinNS4_7=isMinNS4_8=false;
if (isNS4) {
isMinNS4=true;
isMinNS4_5=fAppVersion >= 4.5;
isMinNS4_7=fAppVersion >= 4.7;
isMinNS4_8=fAppVersion >= 4.8;
}
var isWin=(navigator.platform == "Win32") || (navigator.platform == "Windows");
var isMac=(navigator.platform == "Mac68K") || (navigator.platform == "MacPPC")
|| (navigator.platform == "Macintosh");
var isUnix=(navigator.platform == "X11") && !isWin && !isMac;
var isWin95=isWin98=isWinNT4=isWin2K=isWinME=isWinXP=false;
var isMac68K=isMacPPC=false;
var isSunOS=isMinSunOS4=isMinSunOS5=isMinSunOS5_5=false;
if (isWin) {
isWin95=sUserAgent.indexOf("Win95") > -1
|| sUserAgent.indexOf("Windows 95") > -1;
isWin98=sUserAgent.indexOf("Win98") > -1
|| sUserAgent.indexOf("Windows 98") > -1;
isWinME=sUserAgent.indexOf("Win 9x 4.90") > -1
|| sUserAgent.indexOf("Windows ME") > -1;
isWin2K=sUserAgent.indexOf("Windows NT 5.0") > -1
|| sUserAgent.indexOf("Windows 2000") > -1;
isWinXP=sUserAgent.indexOf("Windows NT 5.1") > -1
|| sUserAgent.indexOf("Windows XP") > -1;
isWinNT4=sUserAgent.indexOf("WinNT") > -1
|| sUserAgent.indexOf("Windows NT") > -1
|| sUserAgent.indexOf("WinNT4.0") > -1
|| sUserAgent.indexOf("Windows NT 4.0") > -1
&& (!isWinME && !isWin2K && !isWinXP);
}
if (isMac) {
isMac68K=sUserAgent.indexOf("Mac_68000") > -1
|| sUserAgent.indexOf("68K") > -1;
isMacPPC=sUserAgent.indexOf("Mac_PowerPC") > -1
|| sUserAgent.indexOf("PPC") > -1;
}
if (isUnix) {
isSunOS=sUserAgent.indexOf("SunOS") > -1;
if (isSunOS) {
var reSunOS=new RegExp("SunOS (\\d+\\.\\d+(?:\\.\\d+)?)");
reSunOS.test(sUserAgent);
isMinSunOS4=compareVersions(RegExp["$1"], "4.0") >= 0;
isMinSunOS5=compareVersions(RegExp["$1"], "5.0") >= 0;
isMinSunOS5_5=compareVersions(RegExp["$1"], "5.5") >= 0;
}
}
var EventUtil=new Object;
EventUtil.addEventHandler=function (oTarget, sEventType, fnHandler) {
if (oTarget.addEventListener) {
oTarget.addEventListener(sEventType, fnHandler, false);
} else if (oTarget.attachEvent) {
oTarget.attachEvent("on" + sEventType, fnHandler);
} else {
oTarget["on" + sEventType]=fnHandler;
}
};
EventUtil.removeEventHandler=function (oTarget, sEventType, fnHandler) {
if (oTarget.removeEventListener) {
oTarget.removeEventListener(sEventType, fnHandler, false);
} else if (oTarget.detachEvent) {
oTarget.detachEvent("on" + sEventType, fnHandler);
} else {
oTarget["on" + sEventType]=null;
}
};
EventUtil.formatEvent=function (oEvent) {
if (isIE && isWin) {
oEvent.charCode=(oEvent.type == "keypress") ? oEvent.keyCode : 0;
oEvent.eventPhase=2;
oEvent.isChar=(oEvent.charCode > 0);
oEvent.pageX=oEvent.clientX + document.body.scrollLeft;
oEvent.pageY=oEvent.clientY + document.body.scrollTop;
oEvent.preventDefault=function () {
this.returnValue=false;
};
if (oEvent.type == "mouseout") {
oEvent.relatedTarget=oEvent.toElement;
} else if (oEvent.type == "mouseover") {
oEvent.relatedTarget=oEvent.fromElement;
}
oEvent.stopPropagation=function () {
this.cancelBubble=true;
};
oEvent.target=oEvent.srcElement;
oEvent.time=(new Date).getTime();
}
return oEvent;
};
EventUtil.getEvent=function() {
if (window.event) {
return this.formatEvent(window.event);
} else {
return EventUtil.getEvent.caller.arguments[0];
}
};
function addRoundedTop(e,fgColor) {
var bgColor='#FFFFFF';
if(document.body.getAttribute('bgcolor')) {
bgColor=document.body.getAttribute('bgcolor');
}
else {
bgColor='#FFFFFF';
}
var d=document.createElement("b");;
d.style.display='block';
d.style.backgroundColor=bgColor;
for(var i=1;i<=4;i++) {
var x=document.createElement("b");
x.style.display='block';
x.style.height='1px';
x.style.overflow='hidden';
if(i==1) {
x.style.margin='0px 5px';
}
else if(i==2) {
x.style.margin='0px 3px';
}
else if(i==3) {
x.style.margin='0px 2px';
}
else if(i==4) {
x.style.margin='0px 1px';
x.style.height='2px';
}
x.style.backgroundColor=fgColor;
d.appendChild(x);
}
e.insertBefore(d,e.firstChild);
}
function createStringFromXml(thisXml) {
var thisString='';
if(isIE) {
thisString=thisXml.xml;
}
else {
thisString=(new XMLSerializer()).serializeToString(thisXml);
}
return thisString;
}
function createXmlObject(thisStr) {
var thisXml;
if (typeof DOMParser == "undefined") {
DOMParser=function () {}
DOMParser.prototype.parseFromString=function (str, contentType) {
if (typeof ActiveXObject != "undefined") {
var d=new ActiveXObject("MSXML.DomDocument");
d.loadXML(str);
return d;
}
else if (typeof XMLHttpRequest != "undefined") {
var req=new XMLHttpRequest;
req.open("GET", "data:" + (contentType || "application/xml") + ";charset=utf-8," + encodeURIComponent(str), false);
if (req.overrideMimeType) {
req.overrideMimeType(contentType);
}
req.send(null);
return req.responseXML;
}
}
var xo=new DOMParser();
thisXml=xo.parseFromString(thisStr,"text/xml");
}
else {
thisXml=(new DOMParser()).parseFromString(thisStr, "text/xml");
}
return thisXml;
}
function debug(value) {
var e=document.getElementById('debug');
if(!e) {
e=document.createElement('p');
e.setAttribute('id','debug');
document.body.appendChild(e);
}
e.innerHTML+=''+value;
}
function deleteCookie(sName, sPath, sDomain) {
setCookie(sName, "", new Date(0), sPath, sDomain);
}
function determineAbsolutePosition(obj) {
var curleft=curtop=0;
if (obj.offsetParent) {
curleft=obj.offsetLeft
curtop=obj.offsetTop
while (obj=obj.offsetParent) {
curleft += obj.offsetLeft
curtop += obj.offsetTop
}
}
var returnObject=new Object();
returnObject['eL']=curleft;
returnObject['eT']=curtop;
return returnObject;
}
function getBrowserObject() {
var browserObject=new Object();
if (window.pageYOffset) {
yOffset=window.pageYOffset
xOffset=window.pageXOffset
browserObject.scrollTop=yOffset;
browserObject.scrollLeft=xOffset;
}
else if (document.documentElement && document.documentElement.scrollTop) {
browserObject.scrollTop=document.documentElement.scrollTop;
browserObject.scrollLeft=document.documentElement.scrollLeft;
}
else if (document.body) {
browserObject.scrollTop=document.body.scrollTop;
browserObject.scrollLeft=document.body.scrollLeft;
}
if (window.innerWidth) {
browserObject.clientWidth=window.innerWidth;
browserObject.clientHeight=window.innerHeight;
}
else if (document.documentElement && document.documentElement.clientWidth) {
browserObject.clientWidth=document.documentElement.clientWidth;
browserObject.clientHeight=document.documentElement.clientHeight;
}
else if (document.body) {
browserObject.clientWidth=document.body.clientWidth;
browserObject.clientHeight=document.body.clientHeight;
}
return browserObject;
}
function getCookie(sName) {
var sRE="(?:; )?" + sName + "=([^;]*);?";
var oRE=new RegExp(sRE);
if(oRE.test(document.cookie)) {
return decodeURIComponent(RegExp["$1"]);
}
else {
return null;
}
}
function getSelectedText() {
var selectedText;
if(isIE) {
selectedText=document.selection.createRange().text;
}
else if((isMoz) || (isMinSafari1)) {
selectedText=window.getSelection();
}
else {
selectedText=document.getSelection();
}
return selectedText;
}
function getTextNode(node) {
var textNode;
try {
textNode=node.childNodes[0].nodeValue;
}
catch(error) {
}
if(textNode==undefined) {
textNode='';
}
return textNode;
}
function removeAPIContent() {
var myAPI=document.getElementById('myAPI');
while(myAPI.firstChild) {
myAPI.removeChild(myAPI.firstChild);
}
}
function setCookie(sName, sValue, oExpires, sPath, sDomain, bSecure) {
if(!sValue) {
sValue=0;
}
if(!sPath) {
sPath="/";
}
var sCookie=sName + "=" + encodeURIComponent(sValue);
if(oExpires) {
sCookie += "; expires=" + oExpires;
}
if(sPath) {
sCookie += "; path=" + sPath;
}
if(sDomain) {
sCookie += "; domain=" + sDomain;
}
if(bSecure) {
sCookie += "; secure";
}
document.cookie=sCookie;
}
XPathParser.prototype=new Object();
XPathParser.prototype.constructor=XPathParser;
XPathParser.superclass=Object.prototype;
function XPathParser() {
this.init();
}
XPathParser.prototype.init=function() {
this.reduceActions=[];
this.reduceActions[3]=function(rhs) {
return new OrOperation(rhs[0], rhs[2]);
};
this.reduceActions[5]=function(rhs) {
return new AndOperation(rhs[0], rhs[2]);
};
this.reduceActions[7]=function(rhs) {
return new EqualsOperation(rhs[0], rhs[2]);
};
this.reduceActions[8]=function(rhs) {
return new NotEqualOperation(rhs[0], rhs[2]);
};
this.reduceActions[10]=function(rhs) {
return new LessThanOperation(rhs[0], rhs[2]);
};
this.reduceActions[11]=function(rhs) {
return new GreaterThanOperation(rhs[0], rhs[2]);
};
this.reduceActions[12]=function(rhs) {
return new LessThanOrEqualOperation(rhs[0], rhs[2]);
};
this.reduceActions[13]=function(rhs) {
return new GreaterThanOrEqualOperation(rhs[0], rhs[2]);
};
this.reduceActions[15]=function(rhs) {
return new PlusOperation(rhs[0], rhs[2]);
};
this.reduceActions[16]=function(rhs) {
return new MinusOperation(rhs[0], rhs[2]);
};
this.reduceActions[18]=function(rhs) {
return new MultiplyOperation(rhs[0], rhs[2]);
};
this.reduceActions[19]=function(rhs) {
return new DivOperation(rhs[0], rhs[2]);
};
this.reduceActions[20]=function(rhs) {
return new ModOperation(rhs[0], rhs[2]);
};
this.reduceActions[22]=function(rhs) {
return new UnaryMinusOperation(rhs[1]);
};
this.reduceActions[24]=function(rhs) {
return new BarOperation(rhs[0], rhs[2]);
};
this.reduceActions[25]=function(rhs) {
return new PathExpr(undefined, undefined, rhs[0]);
};
this.reduceActions[27]=function(rhs) {
rhs[0].locationPath=rhs[2];
return rhs[0];
};
this.reduceActions[28]=function(rhs) {
rhs[0].locationPath=rhs[2];
rhs[0].locationPath.steps.unshift(new Step(Step.DESCENDANTORSELF, new NodeTest(NodeTest.NODE, undefined), []));
return rhs[0];
};
this.reduceActions[29]=function(rhs) {
return new PathExpr(rhs[0], [], undefined);
};
this.reduceActions[30]=function(rhs) {
if (Utilities.instance_of(rhs[0], PathExpr)) {
if (rhs[0].filterPredicates == undefined) {
rhs[0].filterPredicates=[];
}
rhs[0].filterPredicates.push(rhs[1]);
return rhs[0];
} else {
return new PathExpr(rhs[0], [rhs[1]], undefined);
}
};
this.reduceActions[32]=function(rhs) {
return rhs[1];
};
this.reduceActions[33]=function(rhs) {
return new XString(rhs[0]);
};
this.reduceActions[34]=function(rhs) {
return new XNumber(rhs[0]);
};
this.reduceActions[36]=function(rhs) {
return new FunctionCall(rhs[0], []);
};
this.reduceActions[37]=function(rhs) {
return new FunctionCall(rhs[0], rhs[2]);
};
this.reduceActions[38]=function(rhs) {
return [ rhs[0] ];
};
this.reduceActions[39]=function(rhs) {
rhs[2].unshift(rhs[0]);
return rhs[2];
};
this.reduceActions[43]=function(rhs) {
return new LocationPath(true, []);
};
this.reduceActions[44]=function(rhs) {
rhs[1].absolute=true;
return rhs[1];
};
this.reduceActions[46]=function(rhs) {
return new LocationPath(false, [ rhs[0] ]);
};
this.reduceActions[47]=function(rhs) {
rhs[0].steps.push(rhs[2]);
return rhs[0];
};
this.reduceActions[49]=function(rhs) {
return new Step(rhs[0], rhs[1], []);
};
this.reduceActions[50]=function(rhs) {
return new Step(Step.CHILD, rhs[0], []);
};
this.reduceActions[51]=function(rhs) {
return new Step(rhs[0], rhs[1], rhs[2]);
};
this.reduceActions[52]=function(rhs) {
return new Step(Step.CHILD, rhs[0], rhs[1]);
};
this.reduceActions[54]=function(rhs) {
return [ rhs[0] ];
};
this.reduceActions[55]=function(rhs) {
rhs[1].unshift(rhs[0]);
return rhs[1];
};
this.reduceActions[56]=function(rhs) {
if (rhs[0] == "ancestor") {
return Step.ANCESTOR;
} else if (rhs[0] == "ancestor-or-self") {
return Step.ANCESTORORSELF;
} else if (rhs[0] == "attribute") {
return Step.ATTRIBUTE;
} else if (rhs[0] == "child") {
return Step.CHILD;
} else if (rhs[0] == "descendant") {
return Step.DESCENDANT;
} else if (rhs[0] == "descendant-or-self") {
return Step.DESCENDANTORSELF;
} else if (rhs[0] == "following") {
return Step.FOLLOWING;
} else if (rhs[0] == "following-sibling") {
return Step.FOLLOWINGSIBLING;
} else if (rhs[0] == "namespace") {
return Step.NAMESPACE;
} else if (rhs[0] == "parent") {
return Step.PARENT;
} else if (rhs[0] == "preceding") {
return Step.PRECEDING;
} else if (rhs[0] == "preceding-sibling") {
return Step.PRECEDINGSIBLING;
} else if (rhs[0] == "self") {
return Step.SELF;
}
return -1;
};
this.reduceActions[57]=function(rhs) {
return Step.ATTRIBUTE;
};
this.reduceActions[59]=function(rhs) {
if (rhs[0] == "comment") {
return new NodeTest(NodeTest.COMMENT, undefined);
} else if (rhs[0] == "text") {
return new NodeTest(NodeTest.TEXT, undefined);
} else if (rhs[0] == "processing-instruction") {
return new NodeTest(NodeTest.PI, undefined);
} else if (rhs[0] == "node") {
return new NodeTest(NodeTest.NODE, undefined);
}
return new NodeTest(-1, undefined);
};
this.reduceActions[60]=function(rhs) {
return new NodeTest(NodeTest.PI, rhs[2]);
};
this.reduceActions[61]=function(rhs) {
return rhs[1];
};
this.reduceActions[63]=function(rhs) {
rhs[1].absolute=true;
rhs[1].steps.unshift(new Step(Step.DESCENDANTORSELF, new NodeTest(NodeTest.NODE, undefined), []));
return rhs[1];
};
this.reduceActions[64]=function(rhs) {
rhs[0].steps.push(new Step(Step.DESCENDANTORSELF, new NodeTest(NodeTest.NODE, undefined), []));
rhs[0].steps.push(rhs[2]);
return rhs[0];
};
this.reduceActions[65]=function(rhs) {
return new Step(Step.SELF, new NodeTest(NodeTest.NODE, undefined), []);
};
this.reduceActions[66]=function(rhs) {
return new Step(Step.PARENT, new NodeTest(NodeTest.NODE, undefined), []);
};
this.reduceActions[67]=function(rhs) {
return new VariableReference(rhs[1]);
};
this.reduceActions[68]=function(rhs) {
return new NodeTest(NodeTest.NAMETESTANY, undefined);
};
this.reduceActions[69]=function(rhs) {
var prefix=rhs[0].substring(0, rhs[0].indexOf(":"));
return new NodeTest(NodeTest.NAMETESTPREFIXANY, prefix);
};
this.reduceActions[70]=function(rhs) {
return new NodeTest(NodeTest.NAMETESTQNAME, rhs[0]);
};
};
XPathParser.actionTable=[
" s s sssssssss s ss s ss",
" s ",
"r rrrrrrrrr rrrrrrr rr r ",
" rrrrr ",
" s s sssssssss s ss s ss",
"rs rrrrrrrr s sssssrrrrrr rrs rs ",
" s s sssssssss s ss s ss",
" s ",
" s ",
"r rrrrrrrrr rrrrrrr rr rr ",
"r rrrrrrrrr rrrrrrr rr rr ",
"r rrrrrrrrr rrrrrrr rr rr ",
"r rrrrrrrrr rrrrrrr rr rr ",
"r rrrrrrrrr rrrrrrr rr rr ",
" s ",
" s ",
" s s sssss s s ",
"r rrrrrrrrr rrrrrrr rr r ",
"a ",
"r s rr r ",
"r sr rr r ",
"r s rr s rr r ",
"r rssrr rss rr r ",
"r rrrrr rrrss rr r ",
"r rrrrrsss rrrrr rr r ",
"r rrrrrrrr rrrrr rr r ",
"r rrrrrrrr rrrrrs rr r ",
"r rrrrrrrr rrrrrr rr r ",
"r rrrrrrrr rrrrrr rr r ",
"r srrrrrrrr rrrrrrs rr sr ",
"r srrrrrrrr rrrrrrs rr r ",
"r rrrrrrrrr rrrrrrr rr rr ",
"r rrrrrrrrr rrrrrrr rr rr ",
"r rrrrrrrrr rrrrrrr rr rr ",
"r rrrrrrrr rrrrrr rr r ",
"r rrrrrrrr rrrrrr rr r ",
"r rrrrrrrrr rrrrrrr rr r ",
"r rrrrrrrrr rrrrrrr rr r ",
" sssss ",
"r rrrrrrrrr rrrrrrr rr sr ",
"r rrrrrrrrr rrrrrrr rr r ",
"r rrrrrrrrr rrrrrrr rr rr ",
"r rrrrrrrrr rrrrrrr rr rr ",
" s ",
"r srrrrrrrr rrrrrrs rr r ",
"r rrrrrrrr rrrrr rr r ",
" s ",
" s ",
" rrrrr ",
" s s sssssssss s sss s ss",
"r srrrrrrrr rrrrrrs rr r ",
" s s sssssssss s ss s ss",
" s s sssssssss s ss s ss",
" s s sssssssss s ss s ss",
" s s sssssssss s ss s ss",
" s s sssssssss s ss s ss",
" s s sssssssss s ss s ss",
" s s sssssssss s ss s ss",
" s s sssssssss s ss s ss",
" s s sssssssss s ss s ss",
" s s sssssssss s ss s ss",
" s s sssssssss s ss s ss",
" s s sssssssss s ss s ss",
" s s sssssssss s ss s ss",
" s s sssssssss ss s ss",
" s s sssssssss s ss s ss",
" s s sssss s s ",
" s s sssss s s ",
"r rrrrrrrrr rrrrrrr rr rr ",
" s s sssss s s ",
" s s sssss s s ",
"r rrrrrrrrr rrrrrrr rr sr ",
"r rrrrrrrrr rrrrrrr rr sr ",
"r rrrrrrrrr rrrrrrr rr r ",
"r rrrrrrrrr rrrrrrr rr rr ",
" s ",
"r rrrrrrrrr rrrrrrr rr rr ",
"r rrrrrrrrr rrrrrrr rr rr ",
" rr ",
" s ",
" rs ",
"r sr rr r ",
"r s rr s rr r ",
"r rssrr rss rr r ",
"r rssrr rss rr r ",
"r rrrrr rrrss rr r ",
"r rrrrr rrrss rr r ",
"r rrrrr rrrss rr r ",
"r rrrrr rrrss rr r ",
"r rrrrrsss rrrrr rr r ",
"r rrrrrsss rrrrr rr r ",
"r rrrrrrrr rrrrr rr r ",
"r rrrrrrrr rrrrr rr r ",
"r rrrrrrrr rrrrr rr r ",
"r rrrrrrrr rrrrrr rr r ",
" r ",
" s ",
"r srrrrrrrr rrrrrrs rr r ",
"r srrrrrrrr rrrrrrs rr r ",
"r rrrrrrrrr rrrrrrr rr r ",
"r rrrrrrrrr rrrrrrr rr r ",
"r rrrrrrrrr rrrrrrr rr r ",
"r rrrrrrrrr rrrrrrr rr r ",
"r rrrrrrrrr rrrrrrr rr rr ",
"r rrrrrrrrr rrrrrrr rr rr ",
" s s sssssssss s ss s ss",
"r rrrrrrrrr rrrrrrr rr rr ",
" r "
];
XPathParser.actionTableNumber=[
" 1 0 /.-,+*)(' & %$ # \"!",
" J ",
"a aaaaaaaaa aaaaaaa aa a ",
" YYYYY ",
" 1 0 /.-,+*)(' & %$ # \"!",
"K1 KKKKKKKK . +*)('KKKKKK KK# K\" ",
" 1 0 /.-,+*)(' & %$ # \"!",
" N ",
" O ",
"e eeeeeeeee eeeeeee ee ee ",
"f fffffffff fffffff ff ff ",
"d ddddddddd ddddddd dd dd ",
"B BBBBBBBBB BBBBBBB BB BB ",
"A AAAAAAAAA AAAAAAA AA AA ",
" P ",
" Q ",
" 1 . +*)(' # \" ",
"b bbbbbbbbb bbbbbbb bb b ",
" ",
"! S !! ! ",
"\" T\" \"\" \" ",
"$ V $$ U $$ $ ",
"& &ZY&& &XW && & ",
") ))))) )))\\[ )) ) ",
". ....._^] ..... .. . ",
"1 11111111 11111 11 1 ",
"5 55555555 55555` 55 5 ",
"7 77777777 777777 77 7 ",
"9 99999999 999999 99 9 ",
": c:::::::: ::::::b :: a: ",
"I fIIIIIIII IIIIIIe II I ",
"= ========= ======= == == ",
"? ????????? ??????? ?? ?? ",
"C CCCCCCCCC CCCCCCC CC CC ",
"J JJJJJJJJ JJJJJJ JJ J ",
"M MMMMMMMM MMMMMM MM M ",
"N NNNNNNNNN NNNNNNN NN N ",
"P PPPPPPPPP PPPPPPP PP P ",
" +*)(' ",
"R RRRRRRRRR RRRRRRR RR aR ",
"U UUUUUUUUU UUUUUUU UU U ",
"Z ZZZZZZZZZ ZZZZZZZ ZZ ZZ ",
"c ccccccccc ccccccc cc cc ",
" j ",
"L fLLLLLLLL LLLLLLe LL L ",
"6 66666666 66666 66 6 ",
" k ",
" l ",
" XXXXX ",
" 1 0 /.-,+*)(' & %$m # \"!",
"_ f________ ______e __ _ ",
" 1 0 /.-,+*)(' & %$ # \"!",
" 1 0 /.-,+*)(' & %$ # \"!",
" 1 0 /.-,+*)(' & %$ # \"!",
" 1 0 /.-,+*)(' & %$ # \"!",
" 1 0 /.-,+*)(' & %$ # \"!",
" 1 0 /.-,+*)(' & %$ # \"!",
" 1 0 /.-,+*)(' & %$ # \"!",
" 1 0 /.-,+*)(' & %$ # \"!",
" 1 0 /.-,+*)(' & %$ # \"!",
" 1 0 /.-,+*)(' & %$ # \"!",
" 1 0 /.-,+*)(' & %$ # \"!",
" 1 0 /.-,+*)(' & %$ # \"!",
" 1 0 /.-,+*)(' & %$ # \"!",
" 1 0 /.-,+*)(' %$ # \"!",
" 1 0 /.-,+*)(' & %$ # \"!",
" 1 . +*)(' # \" ",
" 1 . +*)(' # \" ",
"> >>>>>>>>> >>>>>>> >> >> ",
" 1 . +*)(' # \" ",
" 1 . +*)(' # \" ",
"Q QQQQQQQQQ QQQQQQQ QQ aQ ",
"V VVVVVVVVV VVVVVVV VV aV ",
"T TTTTTTTTT TTTTTTT TT T ",
"@ @@@@@@@@@ @@@@@@@ @@ @@ ",
" \x87 ",
"[ [[[[[[[[[ [[[[[[[ [[ [[ ",
"D DDDDDDDDD DDDDDDD DD DD ",
" HH ",
" \x88 ",
" F\x89 ",
"# T# ## # ",
"% V %% U %% % ",
"' 'ZY'' 'XW '' ' ",
"( (ZY(( (XW (( ( ",
"+ +++++ +++\\[ ++ + ",
"* ***** ***\\[ ** * ",
"- ----- ---\\[ -- - ",
", ,,,,, ,,,\\[ ,, , ",
"0 00000_^] 00000 00 0 ",
"/ /////_^] ///// // / ",
"2 22222222 22222 22 2 ",
"3 33333333 33333 33 3 ",
"4 44444444 44444 44 4 ",
"8 88888888 888888 88 8 ",
" ^ ",
" \x8a ",
"; f;;;;;;;; ;;;;;;e ;; ; ",
"< f<<<<<<<< <<<<<?@ AB CDEFGH IJ ",
" ",
" ",
" ",
"L456789:;<=>?@ AB CDEFGH IJ ",
" M EFGH IJ ",
" N;<=>?@ AB CDEFGH IJ ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" S EFGH IJ ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" e ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" h J ",
" i j ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
"o456789:;<=>?@ ABpqCDEFGH IJ ",
" ",
" r6789:;<=>?@ AB CDEFGH IJ ",
" s789:;<=>?@ AB CDEFGH IJ ",
" t89:;<=>?@ AB CDEFGH IJ ",
" u89:;<=>?@ AB CDEFGH IJ ",
" v9:;<=>?@ AB CDEFGH IJ ",
" w9:;<=>?@ AB CDEFGH IJ ",
" x9:;<=>?@ AB CDEFGH IJ ",
" y9:;<=>?@ AB CDEFGH IJ ",
" z:;<=>?@ AB CDEFGH IJ ",
" {:;<=>?@ AB CDEFGH IJ ",
" |;<=>?@ AB CDEFGH IJ ",
" };<=>?@ AB CDEFGH IJ ",
" ~;<=>?@ AB CDEFGH IJ ",
" \x7f=>?@ AB CDEFGH IJ ",
"\x80456789:;<=>?@ AB CDEFGH IJ\x81",
" \x82 EFGH IJ ",
" \x83 EFGH IJ ",
" ",
" \x84 GH IJ ",
" \x85 GH IJ ",
" i \x86 ",
" i \x87 ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
"o456789:;<=>?@ AB\x8cqCDEFGH IJ ",
" ",
" "
];
XPathParser.productions=[
[1, 1, 2],
[2, 1, 3],
[3, 1, 4],
[3, 3, 3, -9, 4],
[4, 1, 5],
[4, 3, 4, -8, 5],
[5, 1, 6],
[5, 3, 5, -22, 6],
[5, 3, 5, -5, 6],
[6, 1, 7],
[6, 3, 6, -23, 7],
[6, 3, 6, -24, 7],
[6, 3, 6, -6, 7],
[6, 3, 6, -7, 7],
[7, 1, 8],
[7, 3, 7, -25, 8],
[7, 3, 7, -26, 8],
[8, 1, 9],
[8, 3, 8, -12, 9],
[8, 3, 8, -11, 9],
[8, 3, 8, -10, 9],
[9, 1, 10],
[9, 2, -26, 9],
[10, 1, 11],
[10, 3, 10, -27, 11],
[11, 1, 12],
[11, 1, 13],
[11, 3, 13, -28, 14],
[11, 3, 13, -4, 14],
[13, 1, 15],
[13, 2, 13, 16],
[15, 1, 17],
[15, 3, -29, 2, -30],
[15, 1, -15],
[15, 1, -16],
[15, 1, 18],
[18, 3, -13, -29, -30],
[18, 4, -13, -29, 19, -30],
[19, 1, 20],
[19, 3, 20, -31, 19],
[20, 1, 2],
[12, 1, 14],
[12, 1, 21],
[21, 1, -28],
[21, 2, -28, 14],
[21, 1, 22],
[14, 1, 23],
[14, 3, 14, -28, 23],
[14, 1, 24],
[23, 2, 25, 26],
[23, 1, 26],
[23, 3, 25, 26, 27],
[23, 2, 26, 27],
[23, 1, 28],
[27, 1, 16],
[27, 2, 16, 27],
[25, 2, -14, -3],
[25, 1, -32],
[26, 1, 29],
[26, 3, -20, -29, -30],
[26, 4, -21, -29, -15, -30],
[16, 3, -33, 30, -34],
[30, 1, 2],
[22, 2, -4, 14],
[24, 3, 14, -4, 23],
[28, 1, -35],
[28, 1, -2],
[17, 2, -36, -18],
[29, 1, -17],
[29, 1, -19],
[29, 1, -18]
];
XPathParser.DOUBLEDOT=2;
XPathParser.DOUBLECOLON=3;
XPathParser.DOUBLESLASH=4;
XPathParser.NOTEQUAL=5;
XPathParser.LESSTHANOREQUAL=6;
XPathParser.GREATERTHANOREQUAL=7;
XPathParser.AND=8;
XPathParser.OR=9;
XPathParser.MOD=10;
XPathParser.DIV=11;
XPathParser.MULTIPLYOPERATOR=12;
XPathParser.FUNCTIONNAME=13;
XPathParser.AXISNAME=14;
XPathParser.LITERAL=15;
XPathParser.NUMBER=16;
XPathParser.ASTERISKNAMETEST=17;
XPathParser.QNAME=18;
XPathParser.NCNAMECOLONASTERISK=19;
XPathParser.NODETYPE=20;
XPathParser.PROCESSINGINSTRUCTIONWITHLITERAL=21;
XPathParser.EQUALS=22;
XPathParser.LESSTHAN=23;
XPathParser.GREATERTHAN=24;
XPathParser.PLUS=25;
XPathParser.MINUS=26;
XPathParser.BAR=27;
XPathParser.SLASH=28;
XPathParser.LEFTPARENTHESIS=29;
XPathParser.RIGHTPARENTHESIS=30;
XPathParser.COMMA=31;
XPathParser.AT=32;
XPathParser.LEFTBRACKET=33;
XPathParser.RIGHTBRACKET=34;
XPathParser.DOT=35;
XPathParser.DOLLAR=36;
XPathParser.prototype.tokenize=function(s1) {
var types=[];
var values=[];
var s=s1 + '\0';
var pos=0;
var c=s.charAt(pos++);
while (1) {
while (c == ' ' || c == '\t' || c == '\r' || c == '\n') {
c=s.charAt(pos++);
}
if (c == '\0' || pos >= s.length) {
break;
}
if (c == '(') {
types.push(XPathParser.LEFTPARENTHESIS);
values.push(c);
c=s.charAt(pos++);
continue;
}
if (c == ')') {
types.push(XPathParser.RIGHTPARENTHESIS);
values.push(c);
c=s.charAt(pos++);
continue;
}
if (c == '[') {
types.push(XPathParser.LEFTBRACKET);
values.push(c);
c=s.charAt(pos++);
continue;
}
if (c == ']') {
types.push(XPathParser.RIGHTBRACKET);
values.push(c);
c=s.charAt(pos++);
continue;
}
if (c == '@') {
types.push(XPathParser.AT);
values.push(c);
c=s.charAt(pos++);
continue;
}
if (c == ',') {
types.push(XPathParser.COMMA);
values.push(c);
c=s.charAt(pos++);
continue;
}
if (c == '|') {
types.push(XPathParser.BAR);
values.push(c);
c=s.charAt(pos++);
continue;
}
if (c == '+') {
types.push(XPathParser.PLUS);
values.push(c);
c=s.charAt(pos++);
continue;
}
if (c == '-') {
types.push(XPathParser.MINUS);
values.push(c);
c=s.charAt(pos++);
continue;
}
if (c == '=') {
types.push(XPathParser.EQUALS);
values.push(c);
c=s.charAt(pos++);
continue;
}
if (c == '$') {
types.push(XPathParser.DOLLAR);
values.push(c);
c=s.charAt(pos++);
continue;
}
if (c == '.') {
c=s.charAt(pos++);
if (c == '.') {
types.push(XPathParser.DOUBLEDOT);
values.push("..");
c=s.charAt(pos++);
continue;
}
if (c >= '0' && c <= '9') {
var number="." + c;
c=s.charAt(pos++);
while (c >= '0' && c <= '9') {
number += c;
c=s.charAt(pos++);
}
types.push(XPathParser.NUMBER);
values.push(number);
continue;
}
types.push(XPathParser.DOT);
values.push('.');
continue;
}
if (c == '\'' || c == '"') {
var delimiter=c;
var literal="";
while ((c=s.charAt(pos++)) != delimiter) {
literal += c;
}
types.push(XPathParser.LITERAL);
values.push(literal);
c=s.charAt(pos++);
continue;
}
if (c >= '0' && c <= '9') {
var number=c;
c=s.charAt(pos++);
while (c >= '0' && c <= '9') {
number += c;
c=s.charAt(pos++);
}
if (c == '.') {
if (s.charAt(pos) >= '0' && s.charAt(pos) <= '9') {
number += c;
number += s.charAt(pos++);
c=s.charAt(pos++);
while (c >= '0' && c <= '9') {
number += c;
c=s.charAt(pos++);
}
}
}
types.push(XPathParser.NUMBER);
values.push(number);
continue;
}
if (c == '*') {
if (types.length > 0) {
var last=types[types.length - 1];
if (last != XPathParser.AT
&& last != XPathParser.DOUBLECOLON
&& last != XPathParser.LEFTPARENTHESIS
&& last != XPathParser.LEFTBRACKET
&& last != XPathParser.AND
&& last != XPathParser.OR
&& last != XPathParser.MOD
&& last != XPathParser.DIV
&& last != XPathParser.MULTIPLYOPERATOR
&& last != XPathParser.SLASH
&& last != XPathParser.DOUBLESLASH
&& last != XPathParser.BAR
&& last != XPathParser.PLUS
&& last != XPathParser.MINUS
&& last != XPathParser.EQUALS
&& last != XPathParser.NOTEQUAL
&& last != XPathParser.LESSTHAN
&& last != XPathParser.LESSTHANOREQUAL
&& last != XPathParser.GREATERTHAN
&& last != XPathParser.GREATERTHANOREQUAL) {
types.push(XPathParser.MULTIPLYOPERATOR);
values.push(c);
c=s.charAt(pos++);
continue;
}
}
types.push(XPathParser.ASTERISKNAMETEST);
values.push(c);
c=s.charAt(pos++);
continue;
}
if (c == ':') {
if (s.charAt(pos) == ':') {
types.push(XPathParser.DOUBLECOLON);
values.push("::");
pos++;
c=s.charAt(pos++);
continue;
}
}
if (c == '/') {
c=s.charAt(pos++);
if (c == '/') {
types.push(XPathParser.DOUBLESLASH);
values.push("//");
c=s.charAt(pos++);
continue;
}
types.push(XPathParser.SLASH);
values.push('/');
continue;
}
if (c == '!') {
if (s.charAt(pos) == '=') {
types.push(XPathParser.NOTEQUAL);
values.push("!=");
pos++;
c=s.charAt(pos++);
continue;
}
}
if (c == '<') {
if (s.charAt(pos) == '=') {
types.push(XPathParser.LESSTHANOREQUAL);
values.push("<=");
pos++;
c=s.charAt(pos++);
continue;
}
types.push(XPathParser.LESSTHAN);
values.push('<');
c=s.charAt(pos++);
continue;
}
if (c == '>') {
if (s.charAt(pos) == '=') {
types.push(XPathParser.GREATERTHANOREQUAL);
values.push(">=");
pos++;
c=s.charAt(pos++);
continue;
}
types.push(XPathParser.GREATERTHAN);
values.push('>');
c=s.charAt(pos++);
continue;
}
if (c == '_' || Utilities.isLetter(c.charCodeAt(0))) {
var name=c;
c=s.charAt(pos++);
while (Utilities.isNCNameChar(c.charCodeAt(0))) {
name += c;
c=s.charAt(pos++);
}
if (types.length > 0) {
var last=types[types.length - 1];
if (last != XPathParser.AT
&& last != XPathParser.DOUBLECOLON
&& last != XPathParser.LEFTPARENTHESIS
&& last != XPathParser.LEFTBRACKET
&& last != XPathParser.AND
&& last != XPathParser.OR
&& last != XPathParser.MOD
&& last != XPathParser.DIV
&& last != XPathParser.MULTIPLYOPERATOR
&& last != XPathParser.SLASH
&& last != XPathParser.DOUBLESLASH
&& last != XPathParser.BAR
&& last != XPathParser.PLUS
&& last != XPathParser.MINUS
&& last != XPathParser.EQUALS
&& last != XPathParser.NOTEQUAL
&& last != XPathParser.LESSTHAN
&& last != XPathParser.LESSTHANOREQUAL
&& last != XPathParser.GREATERTHAN
&& last != XPathParser.GREATERTHANOREQUAL) {
if (name == "and") {
types.push(XPathParser.AND);
values.push(name);
continue;
}
if (name == "or") {
types.push(XPathParser.OR);
values.push(name);
continue;
}
if (name == "mod") {
types.push(XPathParser.MOD);
values.push(name);
continue;
}
if (name == "div") {
types.push(XPathParser.DIV);
values.push(name);
continue;
}
}
}
if (c == ':') {
if (s.charAt(pos) == '*') {
types.push(XPathParser.NCNAMECOLONASTERISK);
values.push(name + ":*");
pos++;
c=s.charAt(pos++);
continue;
}
if (s.charAt(pos) == '_' || Utilities.isLetter(s.charCodeAt(pos))) {
name += ':';
c=s.charAt(pos++);
while (Utilities.isNCNameChar(c.charCodeAt(0))) {
name += c;
c=s.charAt(pos++);
}
if (c == '(') {
types.push(XPathParser.FUNCTIONNAME);
values.push(name);
continue;
}
types.push(XPathParser.QNAME);
values.push(name);
continue;
}
if (s.charAt(pos) == ':') {
types.push(XPathParser.AXISNAME);
values.push(name);
continue;
}
}
if (c == '(') {
if (name == "comment" || name == "text" || name == "node") {
types.push(XPathParser.NODETYPE);
values.push(name);
continue;
}
if (name == "processing-instruction") {
if (s.charAt(pos) == ')') {
types.push(XPathParser.NODETYPE);
} else {
types.push(XPathParser.PROCESSINGINSTRUCTIONWITHLITERAL);
}
values.push(name);
continue;
}
types.push(XPathParser.FUNCTIONNAME);
values.push(name);
continue;
}
types.push(XPathParser.QNAME);
values.push(name);
continue;
}
throw new Error("Unexpected character " + c);
}
types.push(1);
values.push("[EOF]");
return [types, values];
};
XPathParser.SHIFT='s';
XPathParser.REDUCE='r';
XPathParser.ACCEPT='a';
XPathParser.prototype.parse=function(s) {
var types;
var values;
var res=this.tokenize(s);
if (res == undefined) {
return undefined;
}
types=res[0];
values=res[1];
var tokenPos=0;
var state=[];
var tokenType=[];
var tokenValue=[];
var s;
var a;
var t;
state.push(0);
tokenType.push(1);
tokenValue.push("_S");
a=types[tokenPos];
t=values[tokenPos++];
while (1) {
s=state[state.length - 1];
switch (XPathParser.actionTable[s].charAt(a - 1)) {
case XPathParser.SHIFT:
tokenType.push(-a);
tokenValue.push(t);
state.push(XPathParser.actionTableNumber[s].charCodeAt(a - 1) - 32);
a=types[tokenPos];
t=values[tokenPos++];
break;
case XPathParser.REDUCE:
var num=XPathParser.productions[XPathParser.actionTableNumber[s].charCodeAt(a - 1) - 32][1];
var rhs=[];
for (var i=0; i < num; i++) {
tokenType.pop();
rhs.unshift(tokenValue.pop());
state.pop();
}
var s_=state[state.length - 1];
tokenType.push(XPathParser.productions[XPathParser.actionTableNumber[s].charCodeAt(a - 1) - 32][0]);
if (this.reduceActions[XPathParser.actionTableNumber[s].charCodeAt(a - 1) - 32] == undefined) {
tokenValue.push(rhs[0]);
} else {
tokenValue.push(this.reduceActions[XPathParser.actionTableNumber[s].charCodeAt(a - 1) - 32](rhs));
}
state.push(XPathParser.gotoTable[s_].charCodeAt(XPathParser.productions[XPathParser.actionTableNumber[s].charCodeAt(a - 1) - 32][0] - 2) - 33);
break;
case XPathParser.ACCEPT:
return new XPath(tokenValue.pop());
default:
throw new Error("XPath parse error");
}
}
};
XPath.prototype=new Object();
XPath.prototype.constructor=XPath;
XPath.superclass=Object.prototype;
function XPath(e) {
this.expression=e;
}
XPath.prototype.toString=function() {
return this.expression.toString();
};
XPath.prototype.evaluate=function(c) {
c.contextNode=c.expressionContextNode;
c.contextSize=1;
c.contextPosition=1;
c.caseInsensitive=false;
if (c.contextNode != null) {
var doc=c.contextNode;
if (doc.nodeType != 9 ) {
doc=doc.ownerDocument;
}
try {
c.caseInsensitive=doc.implementation.hasFeature("HTML", "2.0");
} catch (e) {
c.caseInsensitive=true;
}
}
return this.expression.evaluate(c);
};
XPath.XML_NAMESPACE_URI="http://www.w3.org/XML/1998/namespace";
XPath.XMLNS_NAMESPACE_URI="http://www.w3.org/2000/xmlns/";
Expression.prototype=new Object();
Expression.prototype.constructor=Expression;
Expression.superclass=Object.prototype;
function Expression() {
}
Expression.prototype.init=function() {
};
Expression.prototype.toString=function() {
return "";
};
Expression.prototype.evaluate=function(c) {
throw new Error("Could not evaluate expression.");
};
UnaryOperation.prototype=new Expression();
UnaryOperation.prototype.constructor=UnaryOperation;
UnaryOperation.superclass=Expression.prototype;
function UnaryOperation(rhs) {
if (arguments.length > 0) {
this.init(rhs);
}
}
UnaryOperation.prototype.init=function(rhs) {
this.rhs=rhs;
};
UnaryMinusOperation.prototype=new UnaryOperation();
UnaryMinusOperation.prototype.constructor=UnaryMinusOperation;
UnaryMinusOperation.superclass=UnaryOperation.prototype;
function UnaryMinusOperation(rhs) {
if (arguments.length > 0) {
this.init(rhs);
}
}
UnaryMinusOperation.prototype.init=function(rhs) {
UnaryMinusOperation.superclass.init.call(this, rhs);
};
UnaryMinusOperation.prototype.evaluate=function(c) {
return this.rhs.evaluate(c).number().negate();
};
UnaryMinusOperation.prototype.toString=function() {
return "-" + this.rhs.toString();
};
BinaryOperation.prototype=new Expression();
BinaryOperation.prototype.constructor=BinaryOperation;
BinaryOperation.superclass=Expression.prototype;
function BinaryOperation(lhs, rhs) {
if (arguments.length > 0) {
this.init(lhs, rhs);
}
}
BinaryOperation.prototype.init=function(lhs, rhs) {
this.lhs=lhs;
this.rhs=rhs;
};
OrOperation.prototype=new BinaryOperation();
OrOperation.prototype.constructor=OrOperation;
OrOperation.superclass=BinaryOperation.prototype;
function OrOperation(lhs, rhs) {
if (arguments.length > 0) {
this.init(lhs, rhs);
}
}
OrOperation.prototype.init=function(lhs, rhs) {
OrOperation.superclass.init.call(this, lhs, rhs);
};
OrOperation.prototype.toString=function() {
return "(" + this.lhs.toString() + " or " + this.rhs.toString() + ")";
};
OrOperation.prototype.evaluate=function(c) {
var b=this.lhs.evaluate(c).bool();
if (b.booleanValue()) {
return b;
}
return this.rhs.evaluate(c).bool();
};
AndOperation.prototype=new BinaryOperation();
AndOperation.prototype.constructor=AndOperation;
AndOperation.superclass=BinaryOperation.prototype;
function AndOperation(lhs, rhs) {
if (arguments.length > 0) {
this.init(lhs, rhs);
}
}
AndOperation.prototype.init=function(lhs, rhs) {
AndOperation.superclass.init.call(this, lhs, rhs);
};
AndOperation.prototype.toString=function() {
return "(" + this.lhs.toString() + " and " + this.rhs.toString() + ")";
};
AndOperation.prototype.evaluate=function(c) {
var b=this.lhs.evaluate(c).bool();
if (!b.booleanValue()) {
return b;
}
return this.rhs.evaluate(c).bool();
};
EqualsOperation.prototype=new BinaryOperation();
EqualsOperation.prototype.constructor=EqualsOperation;
EqualsOperation.superclass=BinaryOperation.prototype;
function EqualsOperation(lhs, rhs) {
if (arguments.length > 0) {
this.init(lhs, rhs);
}
}
EqualsOperation.prototype.init=function(lhs, rhs) {
EqualsOperation.superclass.init.call(this, lhs, rhs);
};
EqualsOperation.prototype.toString=function() {
return "(" + this.lhs.toString() + "=" + this.rhs.toString() + ")";
};
EqualsOperation.prototype.evaluate=function(c) {
return this.lhs.evaluate(c).equals(this.rhs.evaluate(c));
};
NotEqualOperation.prototype=new BinaryOperation();
NotEqualOperation.prototype.constructor=NotEqualOperation;
NotEqualOperation.superclass=BinaryOperation.prototype;
function NotEqualOperation(lhs, rhs) {
if (arguments.length > 0) {
this.init(lhs, rhs);
}
}
NotEqualOperation.prototype.init=function(lhs, rhs) {
NotEqualOperation.superclass.init.call(this, lhs, rhs);
};
NotEqualOperation.prototype.toString=function() {
return "(" + this.lhs.toString() + " != " + this.rhs.toString() + ")";
};
NotEqualOperation.prototype.evaluate=function(c) {
return this.lhs.evaluate(c).notequal(this.rhs.evaluate(c));
};
LessThanOperation.prototype=new BinaryOperation();
LessThanOperation.prototype.constructor=LessThanOperation;
LessThanOperation.superclass=BinaryOperation.prototype;
function LessThanOperation(lhs, rhs) {
if (arguments.length > 0) {
this.init(lhs, rhs);
}
}
LessThanOperation.prototype.init=function(lhs, rhs) {
LessThanOperation.superclass.init.call(this, lhs, rhs);
};
LessThanOperation.prototype.evaluate=function(c) {
return this.lhs.evaluate(c).lessthan(this.rhs.evaluate(c));
};
LessThanOperation.prototype.toString=function() {
return "(" + this.lhs.toString() + " < " + this.rhs.toString() + ")";
};
GreaterThanOperation.prototype=new BinaryOperation();
GreaterThanOperation.prototype.constructor=GreaterThanOperation;
GreaterThanOperation.superclass=BinaryOperation.prototype;
function GreaterThanOperation(lhs, rhs) {
if (arguments.length > 0) {
this.init(lhs, rhs);
}
}
GreaterThanOperation.prototype.init=function(lhs, rhs) {
GreaterThanOperation.superclass.init.call(this, lhs, rhs);
};
GreaterThanOperation.prototype.evaluate=function(c) {
return this.lhs.evaluate(c).greaterthan(this.rhs.evaluate(c));
};
GreaterThanOperation.prototype.toString=function() {
return "(" + this.lhs.toString() + " > " + this.rhs.toString() + ")";
};
LessThanOrEqualOperation.prototype=new BinaryOperation();
LessThanOrEqualOperation.prototype.constructor=LessThanOrEqualOperation;
LessThanOrEqualOperation.superclass=BinaryOperation.prototype;
function LessThanOrEqualOperation(lhs, rhs) {
if (arguments.length > 0) {
this.init(lhs, rhs);
}
}
LessThanOrEqualOperation.prototype.init=function(lhs, rhs) {
LessThanOrEqualOperation.superclass.init.call(this, lhs, rhs);
};
LessThanOrEqualOperation.prototype.evaluate=function(c) {
return this.lhs.evaluate(c).lessthanorequal(this.rhs.evaluate(c));
};
LessThanOrEqualOperation.prototype.toString=function() {
return "(" + this.lhs.toString() + " <= " + this.rhs.toString() + ")";
};
GreaterThanOrEqualOperation.prototype=new BinaryOperation();
GreaterThanOrEqualOperation.prototype.constructor=GreaterThanOrEqualOperation;
GreaterThanOrEqualOperation.superclass=BinaryOperation.prototype;
function GreaterThanOrEqualOperation(lhs, rhs) {
if (arguments.length > 0) {
this.init(lhs, rhs);
}
}
GreaterThanOrEqualOperation.prototype.init=function(lhs, rhs) {
GreaterThanOrEqualOperation.superclass.init.call(this, lhs, rhs);
};
GreaterThanOrEqualOperation.prototype.evaluate=function(c) {
return this.lhs.evaluate(c).greaterthanorequal(this.rhs.evaluate(c));
};
GreaterThanOrEqualOperation.prototype.toString=function() {
return "(" + this.lhs.toString() + " >= " + this.rhs.toString() + ")";
};
PlusOperation.prototype=new BinaryOperation();
PlusOperation.prototype.constructor=PlusOperation;
PlusOperation.superclass=BinaryOperation.prototype;
function PlusOperation(lhs, rhs) {
if (arguments.length > 0) {
this.init(lhs, rhs);
}
}
PlusOperation.prototype.init=function(lhs, rhs) {
PlusOperation.superclass.init.call(this, lhs, rhs);
};
PlusOperation.prototype.evaluate=function(c) {
return this.lhs.evaluate(c).number().plus(this.rhs.evaluate(c).number());
};
PlusOperation.prototype.toString=function() {
return "(" + this.lhs.toString() + " + " + this.rhs.toString() + ")";
};
MinusOperation.prototype=new BinaryOperation();
MinusOperation.prototype.constructor=MinusOperation;
MinusOperation.superclass=BinaryOperation.prototype;
function MinusOperation(lhs, rhs) {
if (arguments.length > 0) {
this.init(lhs, rhs);
}
}
MinusOperation.prototype.init=function(lhs, rhs) {
MinusOperation.superclass.init.call(this, lhs, rhs);
};
MinusOperation.prototype.evaluate=function(c) {
return this.lhs.evaluate(c).number().minus(this.rhs.evaluate(c).number());
};
MinusOperation.prototype.toString=function() {
return "(" + this.lhs.toString() + " - " + this.rhs.toString() + ")";
};
MultiplyOperation.prototype=new BinaryOperation();
MultiplyOperation.prototype.constructor=MultiplyOperation;
MultiplyOperation.superclass=BinaryOperation.prototype;
function MultiplyOperation(lhs, rhs) {
if (arguments.length > 0) {
this.init(lhs, rhs);
}
}
MultiplyOperation.prototype.init=function(lhs, rhs) {
MultiplyOperation.superclass.init.call(this, lhs, rhs);
};
MultiplyOperation.prototype.evaluate=function(c) {
return this.lhs.evaluate(c).number().multiply(this.rhs.evaluate(c).number());
};
MultiplyOperation.prototype.toString=function() {
return "(" + this.lhs.toString() + " * " + this.rhs.toString() + ")";
};
DivOperation.prototype=new BinaryOperation();
DivOperation.prototype.constructor=DivOperation;
DivOperation.superclass=BinaryOperation.prototype;
function DivOperation(lhs, rhs) {
if (arguments.length > 0) {
this.init(lhs, rhs);
}
}
DivOperation.prototype.init=function(lhs, rhs) {
DivOperation.superclass.init.call(this, lhs, rhs);
};
DivOperation.prototype.evaluate=function(c) {
return this.lhs.evaluate(c).number().div(this.rhs.evaluate(c).number());
};
DivOperation.prototype.toString=function() {
return "(" + this.lhs.toString() + " div " + this.rhs.toString() + ")";
};
ModOperation.prototype=new BinaryOperation();
ModOperation.prototype.constructor=ModOperation;
ModOperation.superclass=BinaryOperation.prototype;
function ModOperation(lhs, rhs) {
if (arguments.length > 0) {
this.init(lhs, rhs);
}
}
ModOperation.prototype.init=function(lhs, rhs) {
ModOperation.superclass.init.call(this, lhs, rhs);
};
ModOperation.prototype.evaluate=function(c) {
return this.lhs.evaluate(c).number().mod(this.rhs.evaluate(c).number());
};
ModOperation.prototype.toString=function() {
return "(" + this.lhs.toString() + " mod " + this.rhs.toString() + ")";
};
BarOperation.prototype=new BinaryOperation();
BarOperation.prototype.constructor=BarOperation;
BarOperation.superclass=BinaryOperation.prototype;
function BarOperation(lhs, rhs) {
if (arguments.length > 0) {
this.init(lhs, rhs);
}
}
BarOperation.prototype.init=function(lhs, rhs) {
BarOperation.superclass.init.call(this, lhs, rhs);
};
BarOperation.prototype.evaluate=function(c) {
return this.lhs.evaluate(c).nodeset().union(this.rhs.evaluate(c).nodeset());
};
BarOperation.prototype.toString=function() {
return this.lhs.toString() + " | " + this.rhs.toString();
};
PathExpr.prototype=new Expression();
PathExpr.prototype.constructor=PathExpr;
PathExpr.superclass=Expression.prototype;
function PathExpr(filter, filterPreds, locpath) {
if (arguments.length > 0) {
this.init(filter, filterPreds, locpath);
}
}
PathExpr.prototype.init=function(filter, filterPreds, locpath) {
PathExpr.superclass.init.call(this);
this.filter=filter;
this.filterPredicates=filterPreds;
this.locationPath=locpath;
};
PathExpr.prototype.evaluate=function(c) {
var nodes;
var xpc=new XPathContext();
xpc.variableResolver=c.variableResolver;
xpc.functionResolver=c.functionResolver;
xpc.namespaceResolver=c.namespaceResolver;
xpc.expressionContextNode=c.expressionContextNode;
xpc.virtualRoot=c.virtualRoot;
xpc.caseInsensitive=c.caseInsensitive;
if (this.filter == null) {
nodes=[ c.contextNode ];
} else {
var ns=this.filter.evaluate(c);
if (!Utilities.instance_of(ns, XNodeSet)) {
if (this.filterPredicates != null && this.filterPredicates.length > 0 || this.locationPath != null) {
throw new Error("Path expression filter must evaluate to a nodset if predicates or location path are used");
}
return ns;
}
nodes=ns.toArray();
if (this.filterPredicates != null) {
for (var j=0; j < this.filterPredicates.length; j++) {
var pred=this.filterPredicates[j];
var newNodes=[];
xpc.contextSize=nodes.length;
for (xpc.contextPosition=1; xpc.contextPosition <= xpc.contextSize; xpc.contextPosition++) {
xpc.contextNode=nodes[xpc.contextPosition - 1];
if (this.predicateMatches(pred, xpc)) {
newNodes.push(xpc.contextNode);
}
}
nodes=newNodes;
}
}
}
if (this.locationPath != null) {
if (this.locationPath.absolute) {
if (nodes[0].nodeType != 9 ) {
if (xpc.virtualRoot != null) {
nodes=[ xpc.virtualRoot ];
} else {
if (nodes[0].ownerDocument == null) {
var n=nodes[0];
while (n.parentNode != null) {
n=n.parentNode;
}
nodes=[ n ];
} else {
nodes=[ nodes[0].ownerDocument ];
}
}
} else {
nodes=[ nodes[0] ];
}
}
for (var i=0; i < this.locationPath.steps.length; i++) {
var step=this.locationPath.steps[i];
var newNodes=[];
for (var j=0; j < nodes.length; j++) {
xpc.contextNode=nodes[j];
switch (step.axis) {
case Step.ANCESTOR:
if (xpc.contextNode === xpc.virtualRoot) {
break;
}
var m;
if (xpc.contextNode.nodeType == 2 ) {
m=this.getOwnerElement(xpc.contextNode);
} else {
m=xpc.contextNode.parentNode;
}
while (m != null) {
if (step.nodeTest.matches(m, xpc)) {
newNodes.push(m);
}
if (m === xpc.virtualRoot) {
break;
}
m=m.parentNode;
}
break;
case Step.ANCESTORORSELF:
for (var m=xpc.contextNode; m != null; m=m.nodeType == 2 ? this.getOwnerElement(m) : m.parentNode) {
if (step.nodeTest.matches(m, xpc)) {
newNodes.push(m);
}
if (m === xpc.virtualRoot) {
break;
}
}
break;
case Step.ATTRIBUTE:
var nnm=xpc.contextNode.attributes;
if (nnm != null) {
for (var k=0; k < nnm.length; k++) {
var m=nnm.item(k);
if (step.nodeTest.matches(m, xpc)) {
newNodes.push(m);
}
}
}
break;
case Step.CHILD:
for (var m=xpc.contextNode.firstChild; m != null; m=m.nextSibling) {
if (step.nodeTest.matches(m, xpc)) {
newNodes.push(m);
}
}
break;
case Step.DESCENDANT:
var st=[ xpc.contextNode.firstChild ];
while (st.length > 0) {
for (var m=st.pop(); m != null; ) {
if (step.nodeTest.matches(m, xpc)) {
newNodes.push(m);
}
if (m.firstChild != null) {
st.push(m.nextSibling);
m=m.firstChild;
} else {
m=m.nextSibling;
}
}
}
break;
case Step.DESCENDANTORSELF:
if (step.nodeTest.matches(xpc.contextNode, xpc)) {
newNodes.push(xpc.contextNode);
}
var st=[ xpc.contextNode.firstChild ];
while (st.length > 0) {
for (var m=st.pop(); m != null; ) {
if (step.nodeTest.matches(m, xpc)) {
newNodes.push(m);
}
if (m.firstChild != null) {
st.push(m.nextSibling);
m=m.firstChild;
} else {
m=m.nextSibling;
}
}
}
break;
case Step.FOLLOWING:
if (xpc.contextNode === xpc.virtualRoot) {
break;
}
var st=[];
if (xpc.contextNode.firstChild != null) {
st.unshift(xpc.contextNode.firstChild);
} else {
st.unshift(xpc.contextNode.nextSibling);
}
for (var m=xpc.contextNode.parentNode; m != null && m.nodeType != 9 && m !== xpc.virtualRoot; m=m.parentNode) {
st.unshift(m.nextSibling);
}
do {
for (var m=st.pop(); m != null; ) {
if (step.nodeTest.matches(m, xpc)) {
newNodes.push(m);
}
if (m.firstChild != null) {
st.push(m.nextSibling);
m=m.firstChild;
} else {
m=m.nextSibling;
}
}
} while (st.length > 0);
break;
case Step.FOLLOWINGSIBLING:
if (xpc.contextNode === xpc.virtualRoot) {
break;
}
for (var m=xpc.contextNode.nextSibling; m != null; m=m.nextSibling) {
if (step.nodeTest.matches(m, xpc)) {
newNodes.push(m);
}
}
break;
case Step.NAMESPACE:
var n={};
if (xpc.contextNode.nodeType == 1 ) {
n["xml"]=XPath.XML_NAMESPACE_URI;
n["xmlns"]=XPath.XMLNS_NAMESPACE_URI;
for (var m=xpc.contextNode; m != null && m.nodeType == 1 ; m=m.parentNode) {
for (var k=0; k < m.attributes.length; k++) {
var attr=m.attributes.item(k);
var nm=String(attr.name);
if (nm == "xmlns") {
if (n[""] == undefined) {
n[""]=attr.value;
}
} else if (nm.length > 6 && nm.substring(0, 6) == "xmlns:") {
var pre=nm.substring(6, nm.length);
if (n[pre] == undefined) {
n[pre]=attr.value;
}
}
}
}
for (var pre in n) {
var nsn=new NamespaceNode(pre, n[pre], xpc.contextNode);
if (step.nodeTest.matches(nsn, xpc)) {
newNodes.push(nsn);
}
}
}
break;
case Step.PARENT:
m=null;
if (xpc.contextNode !== xpc.virtualRoot) {
if (xpc.contextNode.nodeType == 2 ) {
m=this.getOwnerElement(xpc.contextNode);
} else {
m=xpc.contextNode.parentNode;
}
}
if (m != null && step.nodeTest.matches(m, xpc)) {
newNodes.push(m);
}
break;
case Step.PRECEDING:
var st;
if (xpc.virtualRoot != null) {
st=[ xpc.virtualRoot ];
} else {
st=xpc.contextNode.nodeType == 9
? [ xpc.contextNode ]
: [ xpc.contextNode.ownerDocument ];
}
outer: while (st.length > 0) {
for (var m=st.pop(); m != null; ) {
if (m == xpc.contextNode) {
break outer;
}
if (step.nodeTest.matches(m, xpc)) {
newNodes.unshift(m);
}
if (m.firstChild != null) {
st.push(m.nextSibling);
m=m.firstChild;
} else {
m=m.nextSibling;
}
}
}
break;
case Step.PRECEDINGSIBLING:
if (xpc.contextNode === xpc.virtualRoot) {
break;
}
for (var m=xpc.contextNode.previousSibling; m != null; m=m.previousSibling) {
if (step.nodeTest.matches(m, xpc)) {
newNodes.push(m);
}
}
break;
case Step.SELF:
if (step.nodeTest.matches(xpc.contextNode, xpc)) {
newNodes.push(xpc.contextNode);
}
break;
default:
}
}
nodes=newNodes;
for (var j=0; j < step.predicates.length; j++) {
var pred=step.predicates[j];
var newNodes=[];
xpc.contextSize=nodes.length;
for (xpc.contextPosition=1; xpc.contextPosition <= xpc.contextSize; xpc.contextPosition++) {
xpc.contextNode=nodes[xpc.contextPosition - 1];
if (this.predicateMatches(pred, xpc)) {
newNodes.push(xpc.contextNode);
} else {
}
}
nodes=newNodes;
}
}
}
var ns=new XNodeSet();
ns.addArray(nodes);
return ns;
};
PathExpr.prototype.predicateMatches=function(pred, c) {
var res=pred.evaluate(c);
if (Utilities.instance_of(res, XNumber)) {
return c.contextPosition == res.numberValue();
}
return res.booleanValue();
};
PathExpr.prototype.toString=function() {
if (this.filter != undefined) {
var s=this.filter.toString();
if (Utilities.instance_of(this.filter, XString)) {
s="'" + s + "'";
}
if (this.filterPredicates != undefined) {
for (var i=0; i < this.filterPredicates.length; i++) {
s=s + "[" + this.filterPredicates[i].toString() + "]";
}
}
if (this.locationPath != undefined) {
if (!this.locationPath.absolute) {
s += "/";
}
s += this.locationPath.toString();
}
return s;
}
return this.locationPath.toString();
};
PathExpr.prototype.getOwnerElement=function(n) {
if (n.ownerElement) {
return n.ownerElement;
}
try {
if (n.selectSingleNode) {
return n.selectSingleNode("..");
}
} catch (e) {
}
var doc=n.nodeType == 9
? n
: n.ownerDocument;
var elts=doc.getElementsByTagName("*");
for (var i=0; i < elts.length; i++) {
var elt=elts.item(i);
var nnm=elt.attributes;
for (var j=0; j < nnm.length; j++) {
var an=nnm.item(j);
if (an === n) {
return elt;
}
}
}
return null;
};
LocationPath.prototype=new Object();
LocationPath.prototype.constructor=LocationPath;
LocationPath.superclass=Object.prototype;
function LocationPath(abs, steps) {
if (arguments.length > 0) {
this.init(abs, steps);
}
}
LocationPath.prototype.init=function(abs, steps) {
this.absolute=abs;
this.steps=steps;
};
LocationPath.prototype.toString=function() {
var s;
if (this.absolute) {
s="/";
} else {
s="";
}
for (var i=0; i < this.steps.length; i++) {
if (i != 0) {
s += "/";
}
s += this.steps[i].toString();
}
return s;
};
Step.prototype=new Object();
Step.prototype.constructor=Step;
Step.superclass=Object.prototype;
function Step(axis, nodetest, preds) {
if (arguments.length > 0) {
this.init(axis, nodetest, preds);
}
}
Step.prototype.init=function(axis, nodetest, preds) {
this.axis=axis;
this.nodeTest=nodetest;
this.predicates=preds;
};
Step.prototype.toString=function() {
var s;
switch (this.axis) {
case Step.ANCESTOR:
s="ancestor";
break;
case Step.ANCESTORORSELF:
s="ancestor-or-self";
break;
case Step.ATTRIBUTE:
s="attribute";
break;
case Step.CHILD:
s="child";
break;
case Step.DESCENDANT:
s="descendant";
break;
case Step.DESCENDANTORSELF:
s="descendant-or-self";
break;
case Step.FOLLOWING:
s="following";
break;
case Step.FOLLOWINGSIBLING:
s="following-sibling";
break;
case Step.NAMESPACE:
s="namespace";
break;
case Step.PARENT:
s="parent";
break;
case Step.PRECEDING:
s="preceding";
break;
case Step.PRECEDINGSIBLING:
s="preceding-sibling";
break;
case Step.SELF:
s="self";
break;
}
s += "::";
s += this.nodeTest.toString();
for (var i=0; i < this.predicates.length; i++) {
s += "[" + this.predicates[i].toString() + "]";
}
return s;
};
Step.ANCESTOR=0;
Step.ANCESTORORSELF=1;
Step.ATTRIBUTE=2;
Step.CHILD=3;
Step.DESCENDANT=4;
Step.DESCENDANTORSELF=5;
Step.FOLLOWING=6;
Step.FOLLOWINGSIBLING=7;
Step.NAMESPACE=8;
Step.PARENT=9;
Step.PRECEDING=10;
Step.PRECEDINGSIBLING=11;
Step.SELF=12;
NodeTest.prototype=new Object();
NodeTest.prototype.constructor=NodeTest;
NodeTest.superclass=Object.prototype;
function NodeTest(type, value) {
if (arguments.length > 0) {
this.init(type, value);
}
}
NodeTest.prototype.init=function(type, value) {
this.type=type;
this.value=value;
};
NodeTest.prototype.toString=function() {
switch (this.type) {
case NodeTest.NAMETESTANY:
return "*";
case NodeTest.NAMETESTPREFIXANY:
return this.value + ":*";
case NodeTest.NAMETESTRESOLVEDANY:
return "{" + this.value + "}*";
case NodeTest.NAMETESTQNAME:
return this.value;
case NodeTest.NAMETESTRESOLVEDNAME:
return "{" + this.namespaceURI + "}" + this.value;
case NodeTest.COMMENT:
return "comment()";
case NodeTest.TEXT:
return "text()";
case NodeTest.PI:
if (this.value != undefined) {
return "processing-instruction(\"" + this.value + "\")";
}
return "processing-instruction()";
case NodeTest.NODE:
return "node()";
}
return "";
};
NodeTest.prototype.matches=function(n, xpc) {
switch (this.type) {
case NodeTest.NAMETESTANY:
if (n.nodeType == 2
|| n.nodeType == 1
|| n.nodeType == XPathNamespace.XPATH_NAMESPACE_NODE) {
return true;
}
return false;
case NodeTest.NAMETESTPREFIXANY:
if ((n.nodeType == 2 || n.nodeType == 1 )) {
var ns=xpc.namespaceResolver.getNamespace(this.value, xpc.expressionContextNode);
if (ns == null) {
throw new Error("Cannot resolve QName " + this.value);
}
return true;
}
return false;
case NodeTest.NAMETESTQNAME:
if (n.nodeType == 2
|| n.nodeType == 1
|| n.nodeType == XPathNamespace.XPATH_NAMESPACE_NODE) {
var test=Utilities.resolveQName(this.value, xpc.namespaceResolver, xpc.expressionContextNode, false);
if (test[0] == null) {
throw new Error("Cannot resolve QName " + this.value);
}
test[0]=String(test[0]);
test[1]=String(test[1]);
if (test[0] == "") {
test[0]=null;
}
var node=Utilities.resolveQName(n.nodeName, xpc.namespaceResolver, n, n.nodeType == 1 );
node[0]=String(node[0]);
node[1]=String(node[1]);
if (node[0] == "") {
node[0]=null;
}
if (xpc.caseInsensitive) {
return test[0] == node[0] && String(test[1]).toLowerCase() == String(node[1]).toLowerCase();
}
return test[0] == node[0] && test[1] == node[1];
}
return false;
case NodeTest.COMMENT:
return n.nodeType == 8 ;
case NodeTest.TEXT:
return n.nodeType == 3 || n.nodeType == 4 ;
case NodeTest.PI:
return n.nodeType == 7
&& (this.value == null || n.nodeName == this.value);
case NodeTest.NODE:
return n.nodeType == 9
|| n.nodeType == 1
|| n.nodeType == 2
|| n.nodeType == 3
|| n.nodeType == 4
|| n.nodeType == 8
|| n.nodeType == 7 ;
}
return false;
};
NodeTest.NAMETESTANY=0;
NodeTest.NAMETESTPREFIXANY=1;
NodeTest.NAMETESTQNAME=2;
NodeTest.COMMENT=3;
NodeTest.TEXT=4;
NodeTest.PI=5;
NodeTest.NODE=6;
VariableReference.prototype=new Expression();
VariableReference.prototype.constructor=VariableReference;
VariableReference.superclass=Expression.prototype;
function VariableReference(v) {
if (arguments.length > 0) {
this.init(v);
}
}
VariableReference.prototype.init=function(v) {
this.variable=v;
};
VariableReference.prototype.toString=function() {
return "$" + this.variable;
};
VariableReference.prototype.evaluate=function(c) {
return c.variableResolver.getVariable(this.variable, c);
};
FunctionCall.prototype=new Expression();
FunctionCall.prototype.constructor=FunctionCall;
FunctionCall.superclass=Expression.prototype;
function FunctionCall(fn, args) {
if (arguments.length > 0) {
this.init(fn, args);
}
}
FunctionCall.prototype.init=function(fn, args) {
this.functionName=fn;
this.arguments=args;
};
FunctionCall.prototype.toString=function() {
var s=this.functionName + "(";
for (var i=0; i < this.arguments.length; i++) {
if (i > 0) {
s += ", ";
}
s += this.arguments[i].toString();
}
return s + ")";
};
FunctionCall.prototype.evaluate=function(c) {
var f=c.functionResolver.getFunction(this.functionName, c);
if (f == undefined) {
throw new Error("Unknown function " + this.functionName);
}
var a=[c].concat(this.arguments);
return f.apply(c.functionResolver.thisArg, a);
};
XString.prototype=new Expression();
XString.prototype.constructor=XString;
XString.superclass=Expression.prototype;
function XString(s) {
if (arguments.length > 0) {
this.init(s);
}
}
XString.prototype.init=function(s) {
this.str=s;
};
XString.prototype.toString=function() {
return this.str;
};
XString.prototype.evaluate=function(c) {
return this;
};
XString.prototype.string=function() {
return this;
};
XString.prototype.number=function() {
return new XNumber(this.str);
};
XString.prototype.bool=function() {
return new XBoolean(this.str);
};
XString.prototype.nodeset=function() {
throw new Error("Cannot convert string to nodeset");
};
XString.prototype.stringValue=function() {
return this.str;
};
XString.prototype.numberValue=function() {
return this.number().numberValue();
};
XString.prototype.booleanValue=function() {
return this.bool().booleanValue();
};
XString.prototype.equals=function(r) {
if (Utilities.instance_of(r, XBoolean)) {
return this.bool().equals(r);
}
if (Utilities.instance_of(r, XNumber)) {
return this.number().equals(r);
}
if (Utilities.instance_of(r, XNodeSet)) {
return r.compareWithString(this, Operators.equals);
}
return new XBoolean(this.str == r.str);
};
XString.prototype.notequal=function(r) {
if (Utilities.instance_of(r, XBoolean)) {
return this.bool().notequal(r);
}
if (Utilities.instance_of(r, XNumber)) {
return this.number().notequal(r);
}
if (Utilities.instance_of(r, XNodeSet)) {
return r.compareWithString(this, Operators.notequal);
}
return new XBoolean(this.str != r.str);
};
XString.prototype.lessthan=function(r) {
if (Utilities.instance_of(r, XNodeSet)) {
return r.compareWithNumber(this.number(), Operators.greaterthanorequal);
}
return this.number().lessthan(r.number());
};
XString.prototype.greaterthan=function(r) {
if (Utilities.instance_of(r, XNodeSet)) {
return r.compareWithNumber(this.number(), Operators.lessthanorequal);
}
return this.number().greaterthan(r.number());
};
XString.prototype.lessthanorequal=function(r) {
if (Utilities.instance_of(r, XNodeSet)) {
return r.compareWithNumber(this.number(), Operators.greaterthan);
}
return this.number().lessthanorequal(r.number());
};
XString.prototype.greaterthanorequal=function(r) {
if (Utilities.instance_of(r, XNodeSet)) {
return r.compareWithNumber(this.number(), Operators.lessthan);
}
return this.number().greaterthanorequal(r.number());
};
XNumber.prototype=new Expression();
XNumber.prototype.constructor=XNumber;
XNumber.superclass=Expression.prototype;
function XNumber(n) {
if (arguments.length > 0) {
this.init(n);
}
}
XNumber.prototype.init=function(n) {
this.num=Number(n);
};
XNumber.prototype.toString=function() {
return this.num;
};
XNumber.prototype.evaluate=function(c) {
return this;
};
XNumber.prototype.string=function() {
return new XString(this.num);
};
XNumber.prototype.number=function() {
return this;
};
XNumber.prototype.bool=function() {
return new XBoolean(this.num);
};
XNumber.prototype.nodeset=function() {
throw new Error("Cannot convert number to nodeset");
};
XNumber.prototype.stringValue=function() {
return this.string().stringValue();
};
XNumber.prototype.numberValue=function() {
return this.num;
};
XNumber.prototype.booleanValue=function() {
return this.bool().booleanValue();
};
XNumber.prototype.negate=function() {
return new XNumber(-this.num);
};
XNumber.prototype.equals=function(r) {
if (Utilities.instance_of(r, XBoolean)) {
return this.bool().equals(r);
}
if (Utilities.instance_of(r, XString)) {
return this.equals(r.number());
}
if (Utilities.instance_of(r, XNodeSet)) {
return r.compareWithNumber(this, Operators.equals);
}
return new XBoolean(this.num == r.num);
};
XNumber.prototype.notequal=function(r) {
if (Utilities.instance_of(r, XBoolean)) {
return this.bool().notequal(r);
}
if (Utilities.instance_of(r, XString)) {
return this.notequal(r.number());
}
if (Utilities.instance_of(r, XNodeSet)) {
return r.compareWithNumber(this, Operators.notequal);
}
return new XBoolean(this.num != r.num);
};
XNumber.prototype.lessthan=function(r) {
if (Utilities.instance_of(r, XNodeSet)) {
return r.compareWithNumber(this, Operators.greaterthanorequal);
}
if (Utilities.instance_of(r, XBoolean) || Utilities.instance_of(r, XString)) {
return this.lessthan(r.number());
}
return new XBoolean(this.num < r.num);
};
XNumber.prototype.greaterthan=function(r) {
if (Utilities.instance_of(r, XNodeSet)) {
return r.compareWithNumber(this, Operators.lessthanorequal);
}
if (Utilities.instance_of(r, XBoolean) || Utilities.instance_of(r, XString)) {
return this.greaterthan(r.number());
}
return new XBoolean(this.num > r.num);
};
XNumber.prototype.lessthanorequal=function(r) {
if (Utilities.instance_of(r, XNodeSet)) {
return r.compareWithNumber(this, Operators.greaterthan);
}
if (Utilities.instance_of(r, XBoolean) || Utilities.instance_of(r, XString)) {
return this.lessthanorequal(r.number());
}
return new XBoolean(this.num <= r.num);
};
XNumber.prototype.greaterthanorequal=function(r) {
if (Utilities.instance_of(r, XNodeSet)) {
return r.compareWithNumber(this, Operators.lessthan);
}
if (Utilities.instance_of(r, XBoolean) || Utilities.instance_of(r, XString)) {
return this.greaterthanorequal(r.number());
}
return new XBoolean(this.num >= r.num);
};
XNumber.prototype.plus=function(r) {
return new XNumber(this.num + r.num);
};
XNumber.prototype.minus=function(r) {
return new XNumber(this.num - r.num);
};
XNumber.prototype.multiply=function(r) {
return new XNumber(this.num * r.num);
};
XNumber.prototype.div=function(r) {
return new XNumber(this.num / r.num);
};
XNumber.prototype.mod=function(r) {
return new XNumber(this.num % r.num);
};
XBoolean.prototype=new Expression();
XBoolean.prototype.constructor=XBoolean;
XBoolean.superclass=Expression.prototype;
function XBoolean(b) {
if (arguments.length > 0) {
this.init(b);
}
}
XBoolean.prototype.init=function(b) {
this.b=Boolean(b);
};
XBoolean.prototype.toString=function() {
return this.b.toString();
};
XBoolean.prototype.evaluate=function(c) {
return this;
};
XBoolean.prototype.string=function() {
return new XString(this.b);
};
XBoolean.prototype.number=function() {
return new XNumber(this.b);
};
XBoolean.prototype.bool=function() {
return this;
};
XBoolean.prototype.nodeset=function() {
throw new Error("Cannot convert boolean to nodeset");
};
XBoolean.prototype.stringValue=function() {
return this.string().stringValue();
};
XBoolean.prototype.numberValue=function() {
return this.num().numberValue();
};
XBoolean.prototype.booleanValue=function() {
return this.b;
};
XBoolean.prototype.not=function() {
return new XBoolean(!this.b);
};
XBoolean.prototype.equals=function(r) {
if (Utilities.instance_of(r, XString) || Utilities.instance_of(r, XNumber)) {
return this.equals(r.bool());
}
if (Utilities.instance_of(r, XNodeSet)) {
return r.compareWithBoolean(this, Operators.equals);
}
return new XBoolean(this.b == r.b);
};
XBoolean.prototype.notequal=function(r) {
if (Utilities.instance_of(r, XString) || Utilities.instance_of(r, XNumber)) {
return this.notequal(r.bool());
}
if (Utilities.instance_of(r, XNodeSet)) {
return r.compareWithBoolean(this, Operators.notequal);
}
return new XBoolean(this.b != r.b);
};
XBoolean.prototype.lessthan=function(r) {
if (Utilities.instance_of(r, XNodeSet)) {
return r.compareWithNumber(this.number(), Operators.greaterthanorequal);
}
return this.number().lessthan(r.number());
};
XBoolean.prototype.greaterthan=function(r) {
if (Utilities.instance_of(r, XNodeSet)) {
return r.compareWithNumber(this.number(), Operators.lessthanorequal);
}
return this.number().greaterthan(r.number());
};
XBoolean.prototype.lessthanorequal=function(r) {
if (Utilities.instance_of(r, XNodeSet)) {
return r.compareWithNumber(this.number(), Operators.greaterthan);
}
return this.number().lessthanorequal(r.number());
};
XBoolean.prototype.greaterthanorequal=function(r) {
if (Utilities.instance_of(r, XNodeSet)) {
return r.compareWithNumber(this.number(), Operators.lessthan);
}
return this.number().greaterthanorequal(r.number());
};
AVLTree.prototype=new Object();
AVLTree.prototype.constructor=AVLTree;
AVLTree.superclass=Object.prototype;
function AVLTree(n) {
this.init(n);
}
AVLTree.prototype.init=function(n) {
this.left=null;
this.right=null;
this.node=n;
this.depth=1;
};
AVLTree.prototype.balance=function() {
var ldepth=this.left == null ? 0 : this.left.depth;
var rdepth=this.right == null ? 0 : this.right.depth;
if (ldepth > rdepth + 1) {
var lldepth=this.left.left == null ? 0 : this.left.left.depth;
var lrdepth=this.left.right == null ? 0 : this.left.right.depth;
if (lldepth < lrdepth) {
this.left.rotateRR();
}
this.rotateLL();
} else if (ldepth + 1 < rdepth) {
var rrdepth=this.right.right == null ? 0 : this.right.right.depth;
var rldepth=this.right.left == null ? 0 : this.right.left.depth;
if (rldepth > rrdepth) {
this.right.rotateLL();
}
this.rotateRR();
}
};
AVLTree.prototype.rotateLL=function() {
var nodeBefore=this.node;
var rightBefore=this.right;
this.node=this.left.node;
this.right=this.left;
this.left=this.left.left;
this.right.left=this.right.right;
this.right.right=rightBefore;
this.right.node=nodeBefore;
this.right.updateInNewLocation();
this.updateInNewLocation();
};
AVLTree.prototype.rotateRR=function() {
var nodeBefore=this.node;
var leftBefore=this.left;
this.node=this.right.node;
this.left=this.right;
this.right=this.right.right;
this.left.right=this.left.left;
this.left.left=leftBefore;
this.left.node=nodeBefore;
this.left.updateInNewLocation();
this.updateInNewLocation();
};
AVLTree.prototype.updateInNewLocation=function() {
this.getDepthFromChildren();
};
AVLTree.prototype.getDepthFromChildren=function() {
this.depth=this.node == null ? 0 : 1;
if (this.left != null) {
this.depth=this.left.depth + 1;
}
if (this.right != null && this.depth <= this.right.depth) {
this.depth=this.right.depth + 1;
}
};
AVLTree.prototype.order=function(n1, n2) {
if (n1 === n2) {
return 0;
}
var d1=0;
var d2=0;
for (var m1=n1; m1 != null; m1=m1.parentNode) {
d1++;
}
for (var m2=n2; m2 != null; m2=m2.parentNode) {
d2++;
}
if (d1 > d2) {
while (d1 > d2) {
n1=n1.parentNode;
d1--;
}
if (n1 == n2) {
return 1;
}
} else if (d2 > d1) {
while (d2 > d1) {
n2=n2.parentNode;
d2--;
}
if (n1 == n2) {
return -1;
}
}
while (n1.parentNode != n2.parentNode) {
n1=n1.parentNode;
n2=n2.parentNode;
}
while (n1.previousSibling != null && n2.previousSibling != null) {
n1=n1.previousSibling;
n2=n2.previousSibling;
}
if (n1.previousSibling == null) {
return -1;
}
return 1;
};
AVLTree.prototype.add=function(n) {
if (n === this.node) {
return false;
}
var o=this.order(n, this.node);
var ret=false;
if (o == -1) {
if (this.left == null) {
this.left=new AVLTree(n);
ret=true;
} else {
ret=this.left.add(n);
if (ret) {
this.balance();
}
}
} else if (o == 1) {
if (this.right == null) {
this.right=new AVLTree(n);
ret=true;
} else {
ret=this.right.add(n);
if (ret) {
this.balance();
}
}
}
if (ret) {
this.getDepthFromChildren();
}
return ret;
};
XNodeSet.prototype=new Expression();
XNodeSet.prototype.constructor=XNodeSet;
XNodeSet.superclass=Expression.prototype;
function XNodeSet() {
this.init();
}
XNodeSet.prototype.init=function() {
this.tree=null;
this.size=0;
};
XNodeSet.prototype.toString=function() {
var p=this.first();
if (p == null) {
return "";
}
return this.stringForNode(p);
};
XNodeSet.prototype.evaluate=function(c) {
return this;
};
XNodeSet.prototype.string=function() {
return new XString(this.toString());
};
XNodeSet.prototype.stringValue=function() {
return this.toString();
};
XNodeSet.prototype.number=function() {
return new XNumber(this.string());
};
XNodeSet.prototype.numberValue=function() {
return Number(this.string());
};
XNodeSet.prototype.bool=function() {
return new XBoolean(this.tree != null);
};
XNodeSet.prototype.booleanValue=function() {
return this.tree != null;
};
XNodeSet.prototype.nodeset=function() {
return this;
};
XNodeSet.prototype.stringForNode=function(n) {
if (n.nodeType == 9 ) {
n=n.documentElement;
}
if (n.nodeType == 1 ) {
return this.stringForNodeRec(n);
}
if (n.isNamespaceNode) {
return n.namespace;
}
return n.nodeValue;
};
XNodeSet.prototype.stringForNodeRec=function(n) {
var s="";
for (var n2=n.firstChild; n2 != null; n2=n2.nextSibling) {
if (n2.nodeType == 3 ) {
s += n2.nodeValue;
} else if (n2.nodeType == 1 ) {
s += this.stringForNodeRec(n2);
}
}
return s;
};
XNodeSet.prototype.first=function() {
var p=this.tree;
if (p == null) {
return null;
}
while (p.left != null) {
p=p.left;
}
return p.node;
};
XNodeSet.prototype.add=function(n) {
var added;
if (this.tree == null) {
this.tree=new AVLTree(n);
added=true;
} else {
added=this.tree.add(n);
}
if (added) {
this.size++;
}
};
XNodeSet.prototype.addArray=function(ns) {
for (var i=0; i < ns.length; i++) {
this.add(ns[i]);
}
};
XNodeSet.prototype.toArray=function() {
var a=[];
this.toArrayRec(this.tree, a);
return a;
};
XNodeSet.prototype.toArrayRec=function(t, a) {
if (t != null) {
this.toArrayRec(t.left, a);
a.push(t.node);
this.toArrayRec(t.right, a);
}
};
XNodeSet.prototype.compareWithString=function(r, o) {
var a=this.toArray();
for (var i=0; i < a.length; i++) {
var n=a[i];
var l=new XString(this.stringForNode(n));
var res=o(l, r);
if (res.booleanValue()) {
return res;
}
}
return new XBoolean(false);
};
XNodeSet.prototype.compareWithNumber=function(r, o) {
var a=this.toArray();
for (var i=0; i < a.length; i++) {
var n=a[i];
var l=new XNumber(this.stringForNode(n));
var res=o(l, r);
if (res.booleanValue()) {
return res;
}
}
return new XBoolean(false);
};
XNodeSet.prototype.compareWithBoolean=function(r, o) {
return o(this.bool(), r);
};
XNodeSet.prototype.compareWithNodeSet=function(r, o) {
var a=this.toArray();
for (var i=0; i < a.length; i++) {
var n=a[i];
var l=new XString(this.stringForNode(n));
var b=r.toArray();
for (var j=0; j < b.length; j++) {
var n2=b[j];
var r=new XString(this.stringForNode(n2));
var res=o(l, r);
if (res.booleanValue()) {
return res;
}
}
}
return new XBoolean(false);
};
XNodeSet.prototype.equals=function(r) {
if (Utilities.instance_of(r, XString)) {
return this.compareWithString(r, Operators.equals);
}
if (Utilities.instance_of(r, XNumber)) {
return this.compareWithNumber(r, Operators.equals);
}
if (Utilities.instance_of(r, XBoolean)) {
return this.compareWithBoolean(r, Operators.equals);
}
return this.compareWithNodeSet(r, Operators.equals);
};
XNodeSet.prototype.notequal=function(r) {
if (Utilities.instance_of(r, XString)) {
return this.compareWithString(r, Operators.notequal);
}
if (Utilities.instance_of(r, XNumber)) {
return this.compareWithNumber(r, Operators.notequal);
}
if (Utilities.instance_of(r, XBoolean)) {
return this.compareWithBoolean(r, Operators.notequal);
}
return this.compareWithNodeSet(r, Operators.notequal);
};
XNodeSet.prototype.lessthan=function(r) {
if (Utilities.instance_of(r, XString)) {
return this.compareWithNumber(r.number(), Operators.lessthan);
}
if (Utilities.instance_of(r, XNumber)) {
return this.compareWithNumber(r, Operators.lessthan);
}
if (Utilities.instance_of(r, XBoolean)) {
return this.compareWithBoolean(r, Operators.lessthan);
}
return this.compareWithNodeSet(r, Operators.lessthan);
};
XNodeSet.prototype.greaterthan=function(r) {
if (Utilities.instance_of(r, XString)) {
return this.compareWithNumber(r.number(), Operators.greaterthan);
}
if (Utilities.instance_of(r, XNumber)) {
return this.compareWithNumber(r, Operators.greaterthan);
}
if (Utilities.instance_of(r, XBoolean)) {
return this.compareWithBoolean(r, Operators.greaterthan);
}
return this.compareWithNodeSet(r, Operators.greaterthan);
};
XNodeSet.prototype.lessthanorequal=function(r) {
if (Utilities.instance_of(r, XString)) {
return this.compareWithNumber(r.number(), Operators.lessthanorequal);
}
if (Utilities.instance_of(r, XNumber)) {
return this.compareWithNumber(r, Operators.lessthanorequal);
}
if (Utilities.instance_of(r, XBoolean)) {
return this.compareWithBoolean(r, Operators.lessthanorequal);
}
return this.compareWithNodeSet(r, Operators.lessthanorequal);
};
XNodeSet.prototype.greaterthanorequal=function(r) {
if (Utilities.instance_of(r, XString)) {
return this.compareWithNumber(r.number(), Operators.greaterthanorequal);
}
if (Utilities.instance_of(r, XNumber)) {
return this.compareWithNumber(r, Operators.greaterthanorequal);
}
if (Utilities.instance_of(r, XBoolean)) {
return this.compareWithBoolean(r, Operators.greaterthanorequal);
}
return this.compareWithNodeSet(r, Operators.greaterthanorequal);
};
XNodeSet.prototype.union=function(r) {
var ns=new XNodeSet();
ns.tree=this.tree;
ns.size=this.size;
ns.addArray(r.toArray());
return ns;
};
XPathNamespace.prototype=new Object();
XPathNamespace.prototype.constructor=XPathNamespace;
XPathNamespace.superclass=Object.prototype;
function XPathNamespace(pre, ns, p) {
this.isXPathNamespace=true;
this.ownerDocument=p.ownerDocument;
this.nodeName="#namespace";
this.prefix=pre;
this.localName=pre;
this.namespaceURI=ns;
this.nodeValue=ns;
this.ownerElement=p;
this.nodeType=XPathNamespace.XPATH_NAMESPACE_NODE;
}
XPathNamespace.prototype.toString=function() {
return "{ \"" + this.prefix + "\", \"" + this.namespaceURI + "\" }";
};
var Operators=new Object();
Operators.equals=function(l, r) {
return l.equals(r);
};
Operators.notequal=function(l, r) {
return l.notequal(r);
};
Operators.lessthan=function(l, r) {
return l.lessthan(r);
};
Operators.greaterthan=function(l, r) {
return l.greaterthan(r);
};
Operators.lessthanorequal=function(l, r) {
return l.lessthanorequal(r);
};
Operators.greaterthanorequal=function(l, r) {
return l.greaterthanorequal(r);
};
XPathContext.prototype=new Object();
XPathContext.prototype.constructor=XPathContext;
XPathContext.superclass=Object.prototype;
function XPathContext(vr, nr, fr) {
this.variableResolver=vr != null ? vr : new VariableResolver();
this.namespaceResolver=nr != null ? nr : new NamespaceResolver();
this.functionResolver=fr != null ? fr : new FunctionResolver();
}
VariableResolver.prototype=new Object();
VariableResolver.prototype.constructor=VariableResolver;
VariableResolver.superclass=Object.prototype;
function VariableResolver() {
}
VariableResolver.prototype.getVariable=function(vn, c) {
var parts=Utilities.splitQName(vn);
if (parts[0] != null) {
parts[0]=c.namespaceResolver.getNamespace(parts[0], c.expressionContextNode);
if (parts[0] == null) {
throw new Error("Cannot resolve QName " + fn);
}
}
return this.getVariableWithName(parts[0], parts[1], c.expressionContextNode);
};
VariableResolver.prototype.getVariableWithName=function(ns, ln, c) {
return null;
};
FunctionResolver.prototype=new Object();
FunctionResolver.prototype.constructor=FunctionResolver;
FunctionResolver.superclass=Object.prototype;
function FunctionResolver(thisArg) {
this.thisArg=thisArg != null ? thisArg : Functions;
this.functions=new Object();
this.addStandardFunctions();
}
FunctionResolver.prototype.addStandardFunctions=function() {
this.functions["{}last"]=Functions.last;
this.functions["{}position"]=Functions.position;
this.functions["{}count"]=Functions.count;
this.functions["{}id"]=Functions.id;
this.functions["{}local-name"]=Functions.localName;
this.functions["{}namespace-uri"]=Functions.namespaceURI;
this.functions["{}name"]=Functions.name;
this.functions["{}string"]=Functions.string;
this.functions["{}concat"]=Functions.concat;
this.functions["{}starts-with"]=Functions.startsWith;
this.functions["{}contains"]=Functions.contains;
this.functions["{}substring-before"]=Functions.substringBefore;
this.functions["{}substring-after"]=Functions.substringAfter;
this.functions["{}substring"]=Functions.substring;
this.functions["{}string-length"]=Functions.stringLength;
this.functions["{}normalize-space"]=Functions.normalizeSpace;
this.functions["{}translate"]=Functions.translate;
this.functions["{}boolean"]=Functions.boolean_;
this.functions["{}not"]=Functions.not;
this.functions["{}true"]=Functions.true_;
this.functions["{}false"]=Functions.false_;
this.functions["{}lang"]=Functions.lang;
this.functions["{}number"]=Functions.number;
this.functions["{}sum"]=Functions.sum;
this.functions["{}floor"]=Functions.floor;
this.functions["{}ceiling"]=Functions.ceiling;
this.functions["{}round"]=Functions.round;
};
FunctionResolver.prototype.addFunction=function(ns, ln, f) {
this.functions["{" + ns + "}" + ln]=f;
};
FunctionResolver.prototype.getFunction=function(fn, c) {
var parts=Utilities.resolveQName(fn, c.namespaceResolver, c.contextNode, false);
if (parts[0] == null) {
throw new Error("Cannot resolve QName " + fn);
}
return this.getFunctionWithName(parts[0], parts[1], c.contextNode);
};
FunctionResolver.prototype.getFunctionWithName=function(ns, ln, c) {
return this.functions["{" + ns + "}" + ln];
};
NamespaceResolver.prototype=new Object();
NamespaceResolver.prototype.constructor=NamespaceResolver;
NamespaceResolver.superclass=Object.prototype;
function NamespaceResolver() {
}
NamespaceResolver.prototype.getNamespace=function(prefix, n) {
if (prefix == "xml") {
return XPath.XML_NAMESPACE_URI;
} else if (prefix == "xmlns") {
return XPath.XMLNS_NAMESPACE_URI;
}
if (n.nodeType == 9 ) {
n=n.documentElement;
} else if (n.nodeType == 2 ) {
n=PathExpr.prototype.getOwnerElement(n);
} else if (n.nodeType != 1 ) {
n=n.parentNode;
}
while (n != null && n.nodeType == 1 ) {
var nnm=n.attributes;
for (var i=0; i < nnm.length; i++) {
var a=nnm.item(i);
var aname=a.nodeName;
if (aname == "xmlns" && prefix == ""
|| aname == "xmlns:" + prefix) {
return String(a.nodeValue);
}
}
n=n.parentNode;
}
return null;
};
Functions=new Object();
Functions.last=function() {
var c=arguments[0];
if (arguments.length != 1) {
throw new Error("Function last expects ()");
}
return new XNumber(c.contextSize);
};
Functions.position=function() {
var c=arguments[0];
if (arguments.length != 1) {
throw new Error("Function position expects ()");
}
return new XNumber(c.contextPosition);
};
Functions.count=function() {
var c=arguments[0];
var ns;
if (arguments.length != 2 || !Utilities.instance_of(ns=arguments[1].evaluate(c), XNodeSet)) {
throw new Error("Function count expects (node-set)");
}
return new XNumber(ns.size);
};
Functions.id=function() {
var c=arguments[0];
var id;
if (arguments.length != 2) {
throw new Error("Function id expects (object)");
}
id=arguments[1].evaluate(c);
if (Utilities.instance_of(id, XNodeSet)) {
id=id.toArray().join(" ");
} else {
id=id.stringValue();
}
var ids=id.split(/[\x0d\x0a\x09\x20]+/);
var count=0;
var ns=new XNodeSet();
var doc=c.contextNode.nodeType == 9
? c.contextNode
: c.contextNode.ownerDocument;
for (var i=0; i < ids.length; i++) {
var n;
if (doc.getElementById) {
n=doc.getElementById(ids[i]);
} else {
n=Utilities.getElementById(doc, ids[i]);
}
if (n != null) {
ns.add(n);
count++;
}
}
return ns;
};
Functions.localName=function() {
var c=arguments[0];
var n;
if (arguments.length == 1) {
n=c.contextNode;
} else if (arguments.length == 2) {
n=arguments[1].evaluate(c).first();
} else {
throw new Error("Function local-name expects (node-set?)");
}
if (n == null) {
return new XString("");
}
return new XString(n.localName ? n.localName : n.baseName);
};
Functions.namespaceURI=function() {
var c=arguments[0];
var n;
if (arguments.length == 1) {
n=c.contextNode;
} else if (arguments.length == 2) {
n=arguments[1].evaluate(c).first();
} else {
throw new Error("Function namespace-uri expects (node-set?)");
}
if (n == null) {
return new XString("");
}
return new XString(n.namespaceURI);
};
Functions.name=function() {
var c=arguments[0];
var n;
if (arguments.length == 1) {
n=c.contextNode;
} else if (arguments.length == 2) {
n=arguments[1].evaluate(c).first();
} else {
throw new Error("Function name expects (node-set?)");
}
if (n == null) {
return new XString("");
}
if (n.nodeType == 1 || n.nodeType == 2 ) {
return new XString(n.nodeName);
} else if (n.localName == null) {
return new XString("");
} else {
return new XString(n.localName);
}
};
Functions.string=function() {
var c=arguments[0];
if (arguments.length == 1) {
return XNodeSet.prototype.stringForNode(c.contextNode);
} else if (arguments.length == 2) {
return arguments[1].evaluate(c).string();
}
throw new Error("Function string expects (object?)");
};
Functions.concat=function() {
var c=arguments[0];
if (arguments.length < 3) {
throw new Error("Function concat expects (string, string, string*)");
}
var s="";
for (var i=1; i < arguments.length; i++) {
s += arguments[i].evaluate(c).stringValue();
}
return new XString(s);
};
Functions.startsWith=function() {
var c=arguments[0];
if (arguments.length != 3) {
throw new Error("Function startsWith expects (string, string)");
}
var s1=arguments[1].evaluate(c).stringValue();
var s2=arguments[2].evaluate(c).stringValue();
return new XBoolean(s1.substring(0, s2.length) == s2);
};
Functions.contains=function() {
var c=arguments[0];
if (arguments.length != 3) {
throw new Error("Function contains expects (string, string)");
}
var s1=arguments[1].evaluate(c).stringValue();
var s2=arguments[2].evaluate(c).stringValue();
return new XBoolean(s1.indexOf(s2) != -1);
};
Functions.substringBefore=function() {
var c=arguments[0];
if (arguments.length != 3) {
throw new Error("Function substring-before expects (string, string)");
}
var s1=arguments[1].evaluate(c).stringValue();
var s2=arguments[2].evaluate(c).stringValue();
return new XString(s1.substring(0, s1.indexOf(s2)));
};
Functions.substringAfter=function() {
var c=arguments[0];
if (arguments.length != 3) {
throw new Error("Function substring-after expects (string, string)");
}
var s1=arguments[1].evaluate(c).stringValue();
var s2=arguments[2].evaluate(c).stringValue();
if (s2.length == 0) {
return new XString(s1);
}
var i=s1.indexOf(s2);
if (i == -1) {
return new XString("");
}
return new XString(s1.substring(s1.indexOf(s2) + 1));
};
Functions.substring=function() {
var c=arguments[0];
if (!(arguments.length == 3 || arguments.length == 4)) {
throw new Error("Function substring expects (string, number, number?)");
}
var s=arguments[1].evaluate(c).stringValue();
var n1=Math.round(arguments[2].evaluate(c).numberValue()) - 1;
var n2=arguments.length == 4 ? n1 + Math.round(arguments[3].evaluate(c).numberValue()) : undefined;
return new XString(s.substring(n1, n2));
};
Functions.stringLength=function() {
var c=arguments[0];
var s;
if (arguments.length == 1) {
s=XNodeSet.prototype.stringForNode(c.contextNode);
} else if (arguments.length == 2) {
s=arguments[1].evaluate(c).stringValue();
} else {
throw new Error("Function string-length expects (string?)");
}
return new XNumber(s.length);
};
Functions.normalizeSpace=function() {
var c=arguments[0];
var s;
if (arguments.length == 1) {
s=XNodeSet.prototype.stringForNode(c.contextNode);
} else if (arguments.length == 2) {
s=arguments[1].evaluate(c).stringValue();
} else {
throw new Error("Function normalize-space expects (string?)");
}
var i=0;
var j=s.length - 1;
while (Utilities.isSpace(s.charCodeAt(j))) {
j--;
}
var t="";
while (i <= j && Utilities.isSpace(s.charCodeAt(i))) {
i++;
}
while (i <= j) {
if (Utilities.isSpace(s.charCodeAt(i))) {
t += " ";
while (i <= j && Utilities.isSpace(s.charCodeAt(i))) {
i++;
}
} else {
t += s.charAt(i);
i++;
}
}
return new XString(t);
};
Functions.translate=function() {
var c=arguments[0];
if (arguments.length != 4) {
throw new Error("Function translate expects (string, string, string)");
}
var s1=arguments[1].evaluate(c).stringValue();
var s2=arguments[2].evaluate(c).stringValue();
var s3=arguments[3].evaluate(c).stringValue();
var map=[];
for (var i=0; i < s2.length; i++) {
var j=s2.charCodeAt(i);
if (map[j] == undefined) {
var k=i > s3.length ? "" : s3.charAt(i);
map[j]=k;
}
}
var t="";
for (var i=0; i < s1.length; i++) {
var c=s1.charCodeAt(i);
var r=map[c];
if (r == undefined) {
t += s1.charAt(i);
} else {
t += r;
}
}
return new XString(t);
};
Functions.boolean_=function() {
var c=arguments[0];
if (arguments.length != 2) {
throw new Error("Function boolean expects (object)");
}
return arguments[1].evaluate(c).bool();
};
Functions.not=function() {
var c=arguments[0];
if (arguments.length != 2) {
throw new Error("Function not expects (object)");
}
return arguments[1].evaluate(c).bool().not();
};
Functions.true_=function() {
if (arguments.length != 1) {
throw new Error("Function true expects ()");
}
return new XBoolean(true);
};
Functions.false_=function() {
if (arguments.length != 1) {
throw new Error("Function false expects ()");
}
return new XBoolean(false);
};
Functions.lang=function() {
var c=arguments[0];
if (arguments.length != 2) {
throw new Error("Function lang expects (string)");
}
var lang;
for (var n=c.contextNode; n != null && n.nodeType != 9 ; n=n.parentNode) {
var a=n.getAttributeNS(XPath.XML_NAMESPACE_URI, "lang");
if (a != null) {
lang=String(a);
break;
}
}
if (lang == null) {
return new XBoolean(false);
}
var s=arguments[1].evaluate(c).stringValue();
return new XBoolean(lang.substring(0, s.length) == s
&& (lang.length == s.length || lang.charAt(s.length) == '-'));
};
Functions.number=function() {
var c=arguments[0];
if (!(arguments.length == 1 || arguments.length == 2)) {
throw new Error("Function number expects (object?)");
}
if (arguments.length == 1) {
return new XNumber(XNodeSet.prototype.stringForNode(c.contextNode));
}
return arguments[1].evaluate(c).number();
};
Functions.sum=function() {
var c=arguments[0];
var ns;
if (arguments.length != 2 || !Utilities.instance_of((ns=arguments[1].evaluate(c)), XNodeSet)) {
throw new Error("Function sum expects (node-set)");
}
ns=ns.toArray();
var n=0;
for (var i=0; i < ns.length; i++) {
n += new XNumber(XNodeSet.prototype.stringForNode(ns[i])).numberValue();
}
return new XNumber(n);
};
Functions.floor=function() {
var c=arguments[0];
if (arguments.length != 2) {
throw new Error("Function floor expects (number)");
}
return new XNumber(Math.floor(arguments[1].evaluate(c).numberValue()));
};
Functions.ceiling=function() {
var c=arguments[0];
if (arguments.length != 2) {
throw new Error("Function ceiling expects (number)");
}
return new XNumber(Math.ceil(arguments[1].evaluate(c).numberValue()));
};
Functions.round=function() {
var c=arguments[0];
if (arguments.length != 2) {
throw new Error("Function round expects (number)");
}
return new XNumber(Math.round(arguments[1].evaluate(c).numberValue()));
};
Utilities=new Object();
Utilities.splitQName=function(qn) {
var i=qn.indexOf(":");
if (i == -1) {
return [ null, qn ];
}
return [ qn.substring(0, i), qn.substring(i + 1) ];
};
Utilities.resolveQName=function(qn, nr, n, useDefault) {
var parts=Utilities.splitQName(qn);
if (parts[0] != null) {
parts[0]=nr.getNamespace(parts[0], n);
} else {
if (useDefault) {
parts[0]=nr.getNamespace("", n);
if (parts[0] == null) {
parts[0]="";
}
} else {
parts[0]="";
}
}
return parts;
};
Utilities.isSpace=function(c) {
return c == 0x9 || c == 0xd || c == 0xa || c == 0x20;
};
Utilities.isLetter=function(c) {
return c >= 0x0041 && c <= 0x005A ||
c >= 0x0061 && c <= 0x007A ||
c >= 0x00C0 && c <= 0x00D6 ||
c >= 0x00D8 && c <= 0x00F6 ||
c >= 0x00F8 && c <= 0x00FF ||
c >= 0x0100 && c <= 0x0131 ||
c >= 0x0134 && c <= 0x013E ||
c >= 0x0141 && c <= 0x0148 ||
c >= 0x014A && c <= 0x017E ||
c >= 0x0180 && c <= 0x01C3 ||
c >= 0x01CD && c <= 0x01F0 ||
c >= 0x01F4 && c <= 0x01F5 ||
c >= 0x01FA && c <= 0x0217 ||
c >= 0x0250 && c <= 0x02A8 ||
c >= 0x02BB && c <= 0x02C1 ||
c == 0x0386 ||
c >= 0x0388 && c <= 0x038A ||
c == 0x038C ||
c >= 0x038E && c <= 0x03A1 ||
c >= 0x03A3 && c <= 0x03CE ||
c >= 0x03D0 && c <= 0x03D6 ||
c == 0x03DA ||
c == 0x03DC ||
c == 0x03DE ||
c == 0x03E0 ||
c >= 0x03E2 && c <= 0x03F3 ||
c >= 0x0401 && c <= 0x040C ||
c >= 0x040E && c <= 0x044F ||
c >= 0x0451 && c <= 0x045C ||
c >= 0x045E && c <= 0x0481 ||
c >= 0x0490 && c <= 0x04C4 ||
c >= 0x04C7 && c <= 0x04C8 ||
c >= 0x04CB && c <= 0x04CC ||
c >= 0x04D0 && c <= 0x04EB ||
c >= 0x04EE && c <= 0x04F5 ||
c >= 0x04F8 && c <= 0x04F9 ||
c >= 0x0531 && c <= 0x0556 ||
c == 0x0559 ||
c >= 0x0561 && c <= 0x0586 ||
c >= 0x05D0 && c <= 0x05EA ||
c >= 0x05F0 && c <= 0x05F2 ||
c >= 0x0621 && c <= 0x063A ||
c >= 0x0641 && c <= 0x064A ||
c >= 0x0671 && c <= 0x06B7 ||
c >= 0x06BA && c <= 0x06BE ||
c >= 0x06C0 && c <= 0x06CE ||
c >= 0x06D0 && c <= 0x06D3 ||
c == 0x06D5 ||
c >= 0x06E5 && c <= 0x06E6 ||
c >= 0x0905 && c <= 0x0939 ||
c == 0x093D ||
c >= 0x0958 && c <= 0x0961 ||
c >= 0x0985 && c <= 0x098C ||
c >= 0x098F && c <= 0x0990 ||
c >= 0x0993 && c <= 0x09A8 ||
c >= 0x09AA && c <= 0x09B0 ||
c == 0x09B2 ||
c >= 0x09B6 && c <= 0x09B9 ||
c >= 0x09DC && c <= 0x09DD ||
c >= 0x09DF && c <= 0x09E1 ||
c >= 0x09F0 && c <= 0x09F1 ||
c >= 0x0A05 && c <= 0x0A0A ||
c >= 0x0A0F && c <= 0x0A10 ||
c >= 0x0A13 && c <= 0x0A28 ||
c >= 0x0A2A && c <= 0x0A30 ||
c >= 0x0A32 && c <= 0x0A33 ||
c >= 0x0A35 && c <= 0x0A36 ||
c >= 0x0A38 && c <= 0x0A39 ||
c >= 0x0A59 && c <= 0x0A5C ||
c == 0x0A5E ||
c >= 0x0A72 && c <= 0x0A74 ||
c >= 0x0A85 && c <= 0x0A8B ||
c == 0x0A8D ||
c >= 0x0A8F && c <= 0x0A91 ||
c >= 0x0A93 && c <= 0x0AA8 ||
c >= 0x0AAA && c <= 0x0AB0 ||
c >= 0x0AB2 && c <= 0x0AB3 ||
c >= 0x0AB5 && c <= 0x0AB9 ||
c == 0x0ABD ||
c == 0x0AE0 ||
c >= 0x0B05 && c <= 0x0B0C ||
c >= 0x0B0F && c <= 0x0B10 ||
c >= 0x0B13 && c <= 0x0B28 ||
c >= 0x0B2A && c <= 0x0B30 ||
c >= 0x0B32 && c <= 0x0B33 ||
c >= 0x0B36 && c <= 0x0B39 ||
c == 0x0B3D ||
c >= 0x0B5C && c <= 0x0B5D ||
c >= 0x0B5F && c <= 0x0B61 ||
c >= 0x0B85 && c <= 0x0B8A ||
c >= 0x0B8E && c <= 0x0B90 ||
c >= 0x0B92 && c <= 0x0B95 ||
c >= 0x0B99 && c <= 0x0B9A ||
c == 0x0B9C ||
c >= 0x0B9E && c <= 0x0B9F ||
c >= 0x0BA3 && c <= 0x0BA4 ||
c >= 0x0BA8 && c <= 0x0BAA ||
c >= 0x0BAE && c <= 0x0BB5 ||
c >= 0x0BB7 && c <= 0x0BB9 ||
c >= 0x0C05 && c <= 0x0C0C ||
c >= 0x0C0E && c <= 0x0C10 ||
c >= 0x0C12 && c <= 0x0C28 ||
c >= 0x0C2A && c <= 0x0C33 ||
c >= 0x0C35 && c <= 0x0C39 ||
c >= 0x0C60 && c <= 0x0C61 ||
c >= 0x0C85 && c <= 0x0C8C ||
c >= 0x0C8E && c <= 0x0C90 ||
c >= 0x0C92 && c <= 0x0CA8 ||
c >= 0x0CAA && c <= 0x0CB3 ||
c >= 0x0CB5 && c <= 0x0CB9 ||
c == 0x0CDE ||
c >= 0x0CE0 && c <= 0x0CE1 ||
c >= 0x0D05 && c <= 0x0D0C ||
c >= 0x0D0E && c <= 0x0D10 ||
c >= 0x0D12 && c <= 0x0D28 ||
c >= 0x0D2A && c <= 0x0D39 ||
c >= 0x0D60 && c <= 0x0D61 ||
c >= 0x0E01 && c <= 0x0E2E ||
c == 0x0E30 ||
c >= 0x0E32 && c <= 0x0E33 ||
c >= 0x0E40 && c <= 0x0E45 ||
c >= 0x0E81 && c <= 0x0E82 ||
c == 0x0E84 ||
c >= 0x0E87 && c <= 0x0E88 ||
c == 0x0E8A ||
c == 0x0E8D ||
c >= 0x0E94 && c <= 0x0E97 ||
c >= 0x0E99 && c <= 0x0E9F ||
c >= 0x0EA1 && c <= 0x0EA3 ||
c == 0x0EA5 ||
c == 0x0EA7 ||
c >= 0x0EAA && c <= 0x0EAB ||
c >= 0x0EAD && c <= 0x0EAE ||
c == 0x0EB0 ||
c >= 0x0EB2 && c <= 0x0EB3 ||
c == 0x0EBD ||
c >= 0x0EC0 && c <= 0x0EC4 ||
c >= 0x0F40 && c <= 0x0F47 ||
c >= 0x0F49 && c <= 0x0F69 ||
c >= 0x10A0 && c <= 0x10C5 ||
c >= 0x10D0 && c <= 0x10F6 ||
c == 0x1100 ||
c >= 0x1102 && c <= 0x1103 ||
c >= 0x1105 && c <= 0x1107 ||
c == 0x1109 ||
c >= 0x110B && c <= 0x110C ||
c >= 0x110E && c <= 0x1112 ||
c == 0x113C ||
c == 0x113E ||
c == 0x1140 ||
c == 0x114C ||
c == 0x114E ||
c == 0x1150 ||
c >= 0x1154 && c <= 0x1155 ||
c == 0x1159 ||
c >= 0x115F && c <= 0x1161 ||
c == 0x1163 ||
c == 0x1165 ||
c == 0x1167 ||
c == 0x1169 ||
c >= 0x116D && c <= 0x116E ||
c >= 0x1172 && c <= 0x1173 ||
c == 0x1175 ||
c == 0x119E ||
c == 0x11A8 ||
c == 0x11AB ||
c >= 0x11AE && c <= 0x11AF ||
c >= 0x11B7 && c <= 0x11B8 ||
c == 0x11BA ||
c >= 0x11BC && c <= 0x11C2 ||
c == 0x11EB ||
c == 0x11F0 ||
c == 0x11F9 ||
c >= 0x1E00 && c <= 0x1E9B ||
c >= 0x1EA0 && c <= 0x1EF9 ||
c >= 0x1F00 && c <= 0x1F15 ||
c >= 0x1F18 && c <= 0x1F1D ||
c >= 0x1F20 && c <= 0x1F45 ||
c >= 0x1F48 && c <= 0x1F4D ||
c >= 0x1F50 && c <= 0x1F57 ||
c == 0x1F59 ||
c == 0x1F5B ||
c == 0x1F5D ||
c >= 0x1F5F && c <= 0x1F7D ||
c >= 0x1F80 && c <= 0x1FB4 ||
c >= 0x1FB6 && c <= 0x1FBC ||
c == 0x1FBE ||
c >= 0x1FC2 && c <= 0x1FC4 ||
c >= 0x1FC6 && c <= 0x1FCC ||
c >= 0x1FD0 && c <= 0x1FD3 ||
c >= 0x1FD6 && c <= 0x1FDB ||
c >= 0x1FE0 && c <= 0x1FEC ||
c >= 0x1FF2 && c <= 0x1FF4 ||
c >= 0x1FF6 && c <= 0x1FFC ||
c == 0x2126 ||
c >= 0x212A && c <= 0x212B ||
c == 0x212E ||
c >= 0x2180 && c <= 0x2182 ||
c >= 0x3041 && c <= 0x3094 ||
c >= 0x30A1 && c <= 0x30FA ||
c >= 0x3105 && c <= 0x312C ||
c >= 0xAC00 && c <= 0xD7A3 ||
c >= 0x4E00 && c <= 0x9FA5 ||
c == 0x3007 ||
c >= 0x3021 && c <= 0x3029;
};
Utilities.isNCNameChar=function(c) {
return c >= 0x0030 && c <= 0x0039
|| c >= 0x0660 && c <= 0x0669
|| c >= 0x06F0 && c <= 0x06F9
|| c >= 0x0966 && c <= 0x096F
|| c >= 0x09E6 && c <= 0x09EF
|| c >= 0x0A66 && c <= 0x0A6F
|| c >= 0x0AE6 && c <= 0x0AEF
|| c >= 0x0B66 && c <= 0x0B6F
|| c >= 0x0BE7 && c <= 0x0BEF
|| c >= 0x0C66 && c <= 0x0C6F
|| c >= 0x0CE6 && c <= 0x0CEF
|| c >= 0x0D66 && c <= 0x0D6F
|| c >= 0x0E50 && c <= 0x0E59
|| c >= 0x0ED0 && c <= 0x0ED9
|| c >= 0x0F20 && c <= 0x0F29
|| c == 0x002E
|| c == 0x002D
|| c == 0x005F
|| Utilities.isLetter(c)
|| c >= 0x0300 && c <= 0x0345
|| c >= 0x0360 && c <= 0x0361
|| c >= 0x0483 && c <= 0x0486
|| c >= 0x0591 && c <= 0x05A1
|| c >= 0x05A3 && c <= 0x05B9
|| c >= 0x05BB && c <= 0x05BD
|| c == 0x05BF
|| c >= 0x05C1 && c <= 0x05C2
|| c == 0x05C4
|| c >= 0x064B && c <= 0x0652
|| c == 0x0670
|| c >= 0x06D6 && c <= 0x06DC
|| c >= 0x06DD && c <= 0x06DF
|| c >= 0x06E0 && c <= 0x06E4
|| c >= 0x06E7 && c <= 0x06E8
|| c >= 0x06EA && c <= 0x06ED
|| c >= 0x0901 && c <= 0x0903
|| c == 0x093C
|| c >= 0x093E && c <= 0x094C
|| c == 0x094D
|| c >= 0x0951 && c <= 0x0954
|| c >= 0x0962 && c <= 0x0963
|| c >= 0x0981 && c <= 0x0983
|| c == 0x09BC
|| c == 0x09BE
|| c == 0x09BF
|| c >= 0x09C0 && c <= 0x09C4
|| c >= 0x09C7 && c <= 0x09C8
|| c >= 0x09CB && c <= 0x09CD
|| c == 0x09D7
|| c >= 0x09E2 && c <= 0x09E3
|| c == 0x0A02
|| c == 0x0A3C
|| c == 0x0A3E
|| c == 0x0A3F
|| c >= 0x0A40 && c <= 0x0A42
|| c >= 0x0A47 && c <= 0x0A48
|| c >= 0x0A4B && c <= 0x0A4D
|| c >= 0x0A70 && c <= 0x0A71
|| c >= 0x0A81 && c <= 0x0A83
|| c == 0x0ABC
|| c >= 0x0ABE && c <= 0x0AC5
|| c >= 0x0AC7 && c <= 0x0AC9
|| c >= 0x0ACB && c <= 0x0ACD
|| c >= 0x0B01 && c <= 0x0B03
|| c == 0x0B3C
|| c >= 0x0B3E && c <= 0x0B43
|| c >= 0x0B47 && c <= 0x0B48
|| c >= 0x0B4B && c <= 0x0B4D
|| c >= 0x0B56 && c <= 0x0B57
|| c >= 0x0B82 && c <= 0x0B83
|| c >= 0x0BBE && c <= 0x0BC2
|| c >= 0x0BC6 && c <= 0x0BC8
|| c >= 0x0BCA && c <= 0x0BCD
|| c == 0x0BD7
|| c >= 0x0C01 && c <= 0x0C03
|| c >= 0x0C3E && c <= 0x0C44
|| c >= 0x0C46 && c <= 0x0C48
|| c >= 0x0C4A && c <= 0x0C4D
|| c >= 0x0C55 && c <= 0x0C56
|| c >= 0x0C82 && c <= 0x0C83
|| c >= 0x0CBE && c <= 0x0CC4
|| c >= 0x0CC6 && c <= 0x0CC8
|| c >= 0x0CCA && c <= 0x0CCD
|| c >= 0x0CD5 && c <= 0x0CD6
|| c >= 0x0D02 && c <= 0x0D03
|| c >= 0x0D3E && c <= 0x0D43
|| c >= 0x0D46 && c <= 0x0D48
|| c >= 0x0D4A && c <= 0x0D4D
|| c == 0x0D57
|| c == 0x0E31
|| c >= 0x0E34 && c <= 0x0E3A
|| c >= 0x0E47 && c <= 0x0E4E
|| c == 0x0EB1
|| c >= 0x0EB4 && c <= 0x0EB9
|| c >= 0x0EBB && c <= 0x0EBC
|| c >= 0x0EC8 && c <= 0x0ECD
|| c >= 0x0F18 && c <= 0x0F19
|| c == 0x0F35
|| c == 0x0F37
|| c == 0x0F39
|| c == 0x0F3E
|| c == 0x0F3F
|| c >= 0x0F71 && c <= 0x0F84
|| c >= 0x0F86 && c <= 0x0F8B
|| c >= 0x0F90 && c <= 0x0F95
|| c == 0x0F97
|| c >= 0x0F99 && c <= 0x0FAD
|| c >= 0x0FB1 && c <= 0x0FB7
|| c == 0x0FB9
|| c >= 0x20D0 && c <= 0x20DC
|| c == 0x20E1
|| c >= 0x302A && c <= 0x302F
|| c == 0x3099
|| c == 0x309A
|| c == 0x00B7
|| c == 0x02D0
|| c == 0x02D1
|| c == 0x0387
|| c == 0x0640
|| c == 0x0E46
|| c == 0x0EC6
|| c == 0x3005
|| c >= 0x3031 && c <= 0x3035
|| c >= 0x309D && c <= 0x309E
|| c >= 0x30FC && c <= 0x30FE;
};
Utilities.coalesceText=function(n) {
for (var m=n.firstChild; m != null; m=m.nextSibling) {
if (m.nodeType == 3 || m.nodeType == 4 ) {
var s=m.nodeValue;
var first=m;
m=m.nextSibling;
while (m != null && (m.nodeType == 3 || m.nodeType == 4 )) {
s += m.nodeValue;
var del=m;
m=m.nextSibling;
del.parentNode.removeChild(del);
}
if (first.nodeType == 4 ) {
var p=first.parentNode;
if (first.nextSibling == null) {
p.removeChild(first);
p.appendChild(p.ownerDocument.createTextNode(s));
} else {
var next=first.nextSibling;
p.removeChild(first);
p.insertBefore(p.ownerDocument.createTextNode(s), next);
}
} else {
first.nodeValue=s;
}
if (m == null) {
break;
}
} else if (m.nodeType == 1 ) {
Utilities.coalesceText(m);
}
}
};
Utilities.instance_of=function(o, c) {
while (o != null) {
if (o.constructor === c) {
return true;
}
if (o === Object) {
return false;
}
o=o.constructor.superclass;
}
return false;
};
Utilities.getElementById=function(n, id) {
if (n.nodeType == 1 ) {
if (n.getAttribute("id") == id
|| n.getAttributeNS(null, "id") == id) {
return n;
}
}
for (var m=n.firstChild; m != null; m=m.nextSibling) {
var res=Utilities.getElementById(m, id);
if (res != null) {
return res;
}
}
return null;
};
XPathException.prototype={};
XPathException.prototype.constructor=XPathException;
XPathException.superclass=Object.prototype;
function XPathException(c, e) {
this.code=c;
this.exception=e;
}
XPathException.prototype.toString=function() {
var msg=this.exception ? ": " + this.exception.toString() : "";
switch (this.code) {
case XPathException.INVALID_EXPRESSION_ERR:
return "Invalid expression" + msg;
case XPathException.TYPE_ERR:
return "Type error" + msg;
}
};
XPathException.INVALID_EXPRESSION_ERR=51;
XPathException.TYPE_ERR=52;
XPathExpression.prototype={};
XPathExpression.prototype.constructor=XPathExpression;
XPathExpression.superclass=Object.prototype;
function XPathExpression(e, r, p) {
this.xpath=p.parse(e);
this.context=new XPathContext();
this.context.namespaceResolver=new XPathNSResolverWrapper(r);
}
XPathExpression.prototype.evaluate=function(n, t, res) {
this.context.expressionContextNode=n;
var result=this.xpath.evaluate(this.context);
return new XPathResult(result, t);
}
XPathNSResolverWrapper.prototype={};
XPathNSResolverWrapper.prototype.constructor=XPathNSResolverWrapper;
XPathNSResolverWrapper.superclass=Object.prototype;
function XPathNSResolverWrapper(r) {
this.xpathNSResolver=r;
}
XPathNSResolverWrapper.prototype.getNamespace=function(prefix, n) {
if (this.xpathNSResolver == null) {
return null;
}
return this.xpathNSResolver.lookupNamespaceURI(prefix);
};
NodeXPathNSResolver.prototype={};
NodeXPathNSResolver.prototype.constructor=NodeXPathNSResolver;
NodeXPathNSResolver.superclass=Object.prototype;
function NodeXPathNSResolver(n) {
this.node=n;
this.namespaceResolver=new NamespaceResolver();
}
NodeXPathNSResolver.prototype.lookupNamespaceURI=function(prefix) {
return this.namespaceResolver.getNamespace(prefix, this.node);
};
XPathResult.prototype={};
XPathResult.prototype.constructor=XPathResult;
XPathResult.superclass=Object.prototype;
function XPathResult(v, t) {
if (t == XPathResult.ANY_TYPE) {
if (v.constructor === XString) {
t=XPathResult.STRING_TYPE;
} else if (v.constructor === XNumber) {
t=XPathResult.NUMBER_TYPE;
} else if (v.constructor === XBoolean) {
t=XPathResult.BOOLEAN_TYPE;
} else if (v.constructor === XNodeSet) {
t=XPathResult.UNORDERED_NODE_ITERATOR_TYPE;
}
}
this.resultType=t;
switch (t) {
case XPathResult.NUMBER_TYPE:
this.numberValue=v.numberValue();
return;
case XPathResult.STRING_TYPE:
this.stringValue=v.stringValue();
return;
case XPathResult.BOOLEAN_TYPE:
this.booleanValue=v.booleanValue();
return;
case XPathResult.ANY_UNORDERED_NODE_TYPE:
case XPathResult.FIRST_UNORDERED_NODE_TYPE:
if (v.constructor === XNodeSet) {
this.singleNodeValue=v.first();
return;
}
break;
case XPathResult.UNORDERED_NODE_ITERATOR_TYPE:
case XPathResult.ORDERED_NODE_ITERATOR_TYPE:
if (v.constructor === XNodeSet) {
this.invalidIteratorState=false;
this.nodes=v.toArray();
this.iteratorIndex=0;
return;
}
break;
case XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE:
case XPathResult.ORDERED_NODE_SNAPSHOT_TYPE:
if (v.constructor === XNodeSet) {
this.nodes=v.toArray();
this.snapshotLength=this.nodes.length;
return;
}
break;
}
throw new XPathException(XPathException.TYPE_ERR);
};
XPathResult.prototype.iterateNext=function() {
if (this.resultType != XPathResult.UNORDERED_NODE_ITERATOR_TYPE
&& this.resultType != XPathResult.ORDERED_NODE_ITERATOR_TYPE) {
throw new XPathException(XPathException.TYPE_ERR);
}
return this.nodes[this.iteratorIndex++];
};
XPathResult.prototype.snapshotItem=function(i) {
if (this.resultType != XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE
&& this.resultType != XPathResult.ORDERED_NODE_SNAPSHOT_TYPE) {
throw new XPathException(XPathException.TYPE_ERR);
}
return this.nodes[i];
};
XPathResult.ANY_TYPE=0;
XPathResult.NUMBER_TYPE=1;
XPathResult.STRING_TYPE=2;
XPathResult.BOOLEAN_TYPE=3;
XPathResult.UNORDERED_NODE_ITERATOR_TYPE=4;
XPathResult.ORDERED_NODE_ITERATOR_TYPE=5;
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE=6;
XPathResult.ORDERED_NODE_SNAPSHOT_TYPE=7;
XPathResult.ANY_UNORDERED_NODE_TYPE=8;
XPathResult.FIRST_ORDERED_NODE_TYPE=9;
function installDOM3XPathSupport(doc, p) {
doc.createExpression=function(e, r) {
try {
return new XPathExpression(e, r, p);
} catch (e) {
throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, e);
}
};
doc.createNSResolver=function(n) {
return new NodeXPathNSResolver(n);
};
doc.evaluate=function(e, cn, r, t, res) {
if (t < 0 || t > 9) {
throw { code: 0, toString: function() { return "Request type not supported"; } };
}
return doc.createExpression(e, r, p).evaluate(cn, t, res);
};
};
try {
var shouldInstall=true;
try {
if (document.implementation
&& document.implementation.hasFeature
&& document.implementation.hasFeature("XPath", null)) {
shouldInstall=false;
}
} catch (e) {
}
if (shouldInstall) {
installDOM3XPathSupport(document, new XPathParser());
}
} catch (e) {
}
var parser=new XPathParser();
var context=new XPathContext();
function getXPath(myXML,xPathExpression) {
var parser=new XPathParser();
var xpath=parser.parse(xPathExpression);
var context=new XPathContext();
context.expressionContextNode=myXML;
var result=xpath.evaluate(context).toArray();
return result;
}var S_debugger=0;
var S_Initialized=0;
var S_allTerms=new Array();
var S_noWelcome=0;
var S_uids=new Object();
var S_numberOfSearchDevices=0;
var S_cachedExtra='';
var S_X=0;
var S_Y=0;
var S_W=448;
var S_H=400;
var S_OPEN=0;
var S_OFFSET=0;
var S_stackIndex=0;
var S_cachedSearch='';
var S_offsetUse=-1;
var t=this;
var S_InitInterval=setInterval(S_Initialize,100);
var S_stackLimit=15;
var S_savedSearchResultElement;
var S_iDiffX=0;
var S_iDiffY=0;
var S_extraOver=0;
var S_mouseX=null;
var S_mouseY=null;
var S_quadrant='';
var S_isFullScreen=new Object();
var S_searchDevicesObject=new Object();
var S_lastScrollX=0;
var S_lastScrollY=0;
var S_ctrlX=0;
var S_RecycleBin=new Object();
var S_Extensions=new Object();
var S_cancelInitialization=0;
var S_Minimize_Extensions=new Object();
var S_srcObj;
if(isIE) {
window.onscroll=function() {
var searchResult=document.getElementById('S_searchResult');
var dragElement=document.getElementById('S_dragElement');
var browserObject=getBrowserObject();
if(searchResult) {
var dx=browserObject.scrollLeft - S_lastScrollX;
var dy=browserObject.scrollTop - S_lastScrollY;
var x=parseInt(searchResult.style.left);
var y=parseInt(searchResult.style.top);
searchResult.style.left=x+dx+'px';
searchResult.style.top=y+dy+'px';
x=parseInt(dragElement.style.left);
y=parseInt(dragElement.style.top);
dragElement.style.left=x+dx+'px';
dragElement.style.top=y+dy+'px';
}
S_lastScrollX=browserObject.scrollLeft;
S_lastScrollY=browserObject.scrollTop;
}
}
document.onmouseup=function() {
var oEvent;
if(window.event) {
oEvent=window.event;
}
else {
oEvent=arguments[0];
}
S_mouseX=oEvent.clientX;
S_mouseY=oEvent.clientY;
var oTarget;
if(oEvent.srcElement) {
oTarget=oEvent.srcElement;
}
else if(oEvent.target) {
oTarget=oEvent.target;
}
if(oTarget) {
selectedText=getSelectedText();
if(selectedText!='') {
if(S_ctrlX==1) {
if(!oTarget.isTextEdit) {
var c=SpecialHandling(selectedText);
if(c) {
S_startSearch(selectedText,0,0);
}
}
}
}
}
if((S_extraOver==0) && (oTarget!=document.getElementById('S_selectedSearchDevice')) && (oTarget!=document.getElementById('S_searchDeviceOptionsContainer')) ) {
S_closeSearchDevices();
}
}
function S_addAPIContent(str,func) {
var myAPI=document.getElementById('S_myAPI');
if(myAPI) {
myAPI.appendChild(document.createTextNode(str));
myAPI.onclick=func;
}
}
function S_addSearchDeviceOptions(relocate) {
var eName='S_searchDeviceOptionsContainer';
var x=document.getElementById(eName);
if(x) {
x.parentNode.removeChild(x);
}
var sd=document.getElementById('S_searchDevices');
var ss=document.getElementById('S_smallSearch');
var sdo=document.createElement('div');
sdo.setAttribute('id',eName);
sdo.style.visibility='hidden';
sdo.style.overflow='hidden';
var sDisplay=document.getElementById('S_searchDisplay');
var counter=0;
var panelCount=0;
for(var i in S_searchDevicesObject) {
panelCount++;
if((panelCount==1) && (relocate)) {
addPanel(module,-1);
}
addPanel(i);
}
function addPanel(i,ud) {
if( ((i!=module) || (ud)) && ( ((!S_searchDevicesObject[i].noSearch) && (relocate)) || (!relocate)) ) {
counter++;
var newElement=document.createElement('div');
newElement.setAttribute('id', i);
newElement.style.backgroundColor='#FFFFFF';
newElement.style.position='absolute';
newElement.style.width='225px';
newElement.style.height='18px';
newElement.style.left='0px';
newElement.style.padding='1px';
newElement.style.borderStyle='solid';
newElement.style.borderWidth='1px';
newElement.style.borderColor=haloColor1;
newElement.style.cursor='pointer';
var tElement=document.createElement("img");
tElement.setAttribute("src",pilotFishGateway+"/Features/Search/images/"+i+".gif");
tElement.setAttribute("border",0);
tElement.style.position='absolute';
tElement.style.left='3px';
newElement.appendChild(tElement);
if(S_searchDevicesObject[i].link) {
tElement=document.createElement("span");
tElement.style.color=haloColor1;
tElement.style.position='absolute';
tElement.style.left=S_searchDevicesObject[i].fromLeft+"px";
if(S_searchDevicesObject[i].title) {
var tN=document.createTextNode(S_searchDevicesObject[i].title);
tElement.appendChild(tN);
}
if(S_searchDevicesObject[i].textInput) {
var sElement=document.createElement("input");
sElement.className='S_Input';
sElement.setAttribute('id','textInput'+i);
sElement.setAttribute('searchDevice',i);
sElement.style.position="absolute";
sElement.style.width='65px';
sElement.style.left='135px';
var c=getCookie(S_searchDevicesObject[i].textInput);
if(c) {
sElement.setAttribute('value',c);
}
sElement.onfocus=function() { S_extraOver=1; this.select();};
sElement.onkeypress=function() {
var event=EventUtil.getEvent();
if ((event && event.which == 13) || (event && event.keyCode == 13)) {
if(S_searchDevicesObject[i].validate) {
var validate=S_searchDevicesObject[i].validate(this.value);
if(validate) {
alert(validate);
return false;
}
}
setCookie(S_searchDevicesObject[i].textInput,this.value);
S_extraOver=0;
module=this.getAttribute('searchDevice');
S_changeSearchDevice(this.getAttribute('searchDevice'),1);
S_labelSelectedSearchDevice();
S_closeSearchDevices();
}
else {
return true;
}
}
newElement.appendChild(sElement);
}
else if(S_searchDevicesObject[i].doExtras==1) {
var sElement=document.createElement("span");
sElement.setAttribute("id","S_extraSelection"+i);
sElement.style.position='absolute';
sElement.style.fontSize='8px';
sElement.style.height='16px';
sElement.style.width='105px';
sElement.style.left='95px';
sElement.style.overflow='hidden';
sElement.style.backgroundColor='transparent';
var slElement=document.createElement("select");
slElement.style.fontSize='9px';
slElement.style.height='16px';
sElement.setAttribute('searchDevice',i);
slElement.onmouseover=function() { S_extraOver=1; };
slElement.onmouseout=function() { S_extraOver=0; };
slElement.onchange=function() { S_extraOver=0; S_changeExtra(this.value,this.parentNode.getAttribute('searchDevice')); };
for(var j in S_searchDevicesObject[i].extras) {
var oElement=document.createElement("option");
oElement.setAttribute("value",S_searchDevicesObject[i].extras[j]);
if(S_cachedExtra==S_searchDevicesObject[i].extras[j]) {
oElement.setAttribute("selected",1);
}
oElement.appendChild(document.createTextNode(j));
slElement.appendChild(oElement);
}
sElement.appendChild(slElement);
newElement.appendChild(sElement);
}
newElement.appendChild(tElement);
}
if(isIE) {
newElement.style.top=((counter-1)*18)+'px';
}
else {
newElement.style.top=((counter-1)*22)+'px';
}
newElement.onmouseover=function() { if(ss) { ss.setAttribute('active',1); }; S_setSearchDeviceOptionBorder(this,true);};
newElement.onmouseout=function() {S_setSearchDeviceOptionBorder(this,false);};
newElement.onclick=function() {
var force=0;
if(relocate) {
S_cachedSearch=relocate;
force=1;
};
S_changeSearchDevice(this.getAttribute('id'),force);
if(S_extraOver==0) {
var e=document.getElementById('S_smallSearch');
if(e) {
e.parentNode.removeChild(e);
}
}
};
sdo.appendChild(newElement);
if(ud) {
S_setSearchDeviceOptionBorder(newElement,true);
}
}
}
sdo.style.position='absolute';
sdo.style.width='245px';
if(relocate) {
return sdo;
}
if(sDisplay) {
sdo.style.left='70px';
var sDisplayHeight=parseInt(sDisplay.style.height);
var sR=sDisplayHeight%22;
sDisplayHeight-=sR;
var sC=(S_numberOfSearchDevices-1)*22;
var sCr=sC%22;
sC-=sCr;
if(sC1) && (stackObject['stackLength']>1)) {
backImage='backButton.gif';
}
var forwardImage='forwardButtonLight.gif';
if(S_stackIndex<(stackObject['stackLength']-1)) {
forwardImage='forwardButton.gif';
}
var backForward=document.createElement('span');
backForward.style.position='absolute';
backForward.style.right='5px';
backForward.style.top='5px';
var backButton=document.createElement('img');
backButton.setAttribute('id','S_backButton');
backButton.setAttribute('src',pilotFishGateway+'/Features/Search/images/'+backImage);
backButton.style.position='absolute';
backButton.style.right='90px';
backButton.style.cursor='pointer';
backButton.onmouseover=function() { S_swapImage(this,'backButtonLight.gif'); };
backButton.onmouseout=function() {
stackObject=S_getStackObject();
if((stackObject['stackIndex']>1) && (stackObject['stackLength']>1)) {
S_swapImage(this,'backButton.gif');
}
};
backButton.onclick=function() {
S_retrieveTextContent();
stackObject=S_getStackObject();
if((stackObject['stackIndex']>1) && (stackObject['stackLength']>1)) {
S_goBackwardOrForward(-1);
}
}
var forwardButton=document.createElement('img');
forwardButton.setAttribute('id','S_forwardButton');
forwardButton.setAttribute('src',pilotFishGateway+'/Features/Search/images/'+forwardImage);
forwardButton.style.position='absolute';
forwardButton.style.right='60px';
forwardButton.style.cursor='pointer';
forwardButton.onmouseover=function() { S_swapImage(this,'forwardButtonLight.gif'); };
forwardButton.onmouseout=function() {
stackObject=S_getStackObject();
if(stackObject['stackIndex']<=(stackObject['stackLength']-1)) {
S_swapImage(this,'forwardButton.gif');
}
};
forwardButton.onclick=function() {
stackObject=S_getStackObject();
if(stackObject['stackIndex']<=(stackObject['stackLength']-1)) {
S_goBackwardOrForward(1);
}
}
backForward.appendChild(backButton);
backForward.appendChild(forwardButton);
var stopButton=document.createElement('img');
stopButton.setAttribute('id','S_stopButton');
stopButton.setAttribute('src',pilotFishGateway+'/Features/Search/images/stopButtonLight.gif');
stopButton.style.position='absolute';
stopButton.style.right='30px';
stopButton.style.cursor='pointer';
stopButton.onclick=function() { S_stopLoading(); }
backForward.appendChild(stopButton);
var helpButton=document.createElement('img');
helpButton.setAttribute('id','S_helpButton');
helpButton.setAttribute('src',pilotFishGateway+'/Features/Search/images/questionMark.gif');
helpButton.style.position='absolute';
helpButton.style.right='0px';
helpButton.style.cursor='pointer';
helpButton.onmouseover=function() { S_swapImage(this,'questionMarkLight.gif'); };
helpButton.onmouseout=function() { S_swapImage(this,'questionMark.gif'); };
helpButton.onclick=function() {
var nw=window.open('http://enrich.ucompass.com','Enrich');
}
backForward.appendChild(helpButton);
searchInterface.appendChild(backForward);
newElement=document.createElement('div');
newElement.setAttribute('id','S_searchBrowseResults');
newElement.style.position='absolute';
newElement.style.top='37px';
newElement.style.left='5px';
newElement.style.width=Number(S_W) - 12 + 'px';
newElement.style.height='14px';
newElement.style.padding='2px';
newElement.style.fontSize='9px';
searchInterface.appendChild(newElement);
thisElement.appendChild(searchInterface);
formElement.appendChild(thisElement);
document.body.appendChild(formElement);
document.forms['S_searchResultForm'].onsubmit=function() { return false; };
thisElement.style.left='300px';
thisElement.style.top='300px';
var browserObject=getBrowserObject();
var bWidth=browserObject.clientWidth;
var bHeight=browserObject.clientHeight;
var startX=Number(S_X);
var startY=Number(S_Y);
var startW=parseInt(thisElement.style.width);
var startH=parseInt(thisElement.style.height);
if((startX<1) && (startY<1)) {
if( (S_mouseX<(bWidth/2)) && (S_mouseY<(bHeight/2))) {
startX=bWidth - startW - 50;
startY=bHeight - startH - 50;
}
else if((S_mouseX<(bWidth/2)) && (S_mouseY>(bHeight/2))) {
startX=bWidth - startW - 50;
startY=50;
}
else if((S_mouseX>(bWidth/2)) && (S_mouseY>(bHeight/2))) {
startX=50;
startY=50;
}
else {
startX=50;
startY=bHeight - startH - 50;
}
}
if(startX<0) {
startX=0;
}
if(startY<0) {
startY=0;
}
document.getElementById('S_searchResult').style.left=startX + S_lastScrollX+'px';
document.getElementById('S_searchResult').style.top=startY + S_lastScrollY+'px';
var msr=document.getElementById('S_minimizedSearchResult');
if(!msr) {
msr=document.createElement('div');
msr.setAttribute('id','S_minimizedSearchResult');
msr.style.width='248px';
msr.style.height='20px';
if(isIE) {
msr.style.position='absolute';
}
else {
msr.style.position='fixed';
msr.style.bottom='0px';
}
msr.style.borderColor=haloColor1;
msr.style.borderStyle='solid';
msr.style.borderWidth='1px';
msr.style.backgroundColor='#FFFFFF';
msr.style.borderLeft='none';
msr.style.borderBottom='none';
msr.style.left='0px';
msr.style.visibility='hidden';
msr.style.bottom='0px';
msr.style.zIndex=1000001;
newElement=document.createElement('div');
newElement.setAttribute('id','S_minimizedSearchResultTitle');
newElement.style.fontSize='10px';
newElement.style.top='2px';
newElement.style.backgroundColor=haloColor1;
newElement.style.width='248px';
newElement.style.height='18px';
msr.appendChild(newElement);
document.body.appendChild(msr);
}
var dragElement=document.getElementById('S_dragElement');
if(!dragElement) {
dragElement=document.createElement('span');
dragElement.setAttribute('id','S_dragElement');
dragElement.onmousedown=function() { var event=EventUtil.getEvent(); S_handleMouseDown(event); };
dragElement.style.left='0px';
dragElement.style.top='0px';
dragElement.style.width='100px';
dragElement.style.height='100px';
dragElement.style.backgroundColor='transparent';
dragElement.style.zIndex=1000002;
dragElement.style.visibility='hidden';
if(isIE) {
dragElement.style.position='absolute';
}
else {
dragElement.style.position='fixed';
}
document.body.appendChild(dragElement);
}
S_labelSelectedSearchDevice();
S_addSearchDeviceOptions();
}
return thisElement;
}
function S_createSearchTitle() {
var newElement=document.createElement('div');
newElement.setAttribute('id','S_searchTitle');
newElement.onmousedown=function() { var event=EventUtil.getEvent(); S_handleMouseDown(event); };
newElement.style.position='absolute';
newElement.style.top='0px';
newElement.style.width=Number(S_W)+'px';
newElement.style.height='24px';
newElement.style.backgroundColor=haloColor1;
newElement.style.fontSize='12px';
newElement.style.cursor='move';
addRoundedTop(newElement,haloColor1);
var dElement=document.createElement('div');
dElement.setAttribute('id','S_searchTitleText');
dElement.style.position='absolute';
dElement.style.width=Number(S_W) - 44 + 'px';
dElement.style.overflow='hidden';
dElement.style.height='16px';
dElement.style.top='5px';
dElement.style.left='4px';
dElement.style.fontSize='10px';
dElement.style.color='#000000';
dElement.appendChild(document.createTextNode("Lookup"));
newElement.appendChild(dElement);
var inElement=document.createElement('input');
inElement.className='S_Input';
inElement.setAttribute('id','S_lookup');
inElement.setAttribute('name','S_lookup');
inElement.setAttribute('type','text');
inElement.onkeypress=function() {var event=EventUtil.getEvent(); S_submitSearch(event,this.value);};
inElement.onblur=function() {S_changeCachedSearch(this.value);};
inElement.setAttribute('value','');
inElement.style.width=Number(S_W)-148+'px';
inElement.style.position='absolute';
inElement.style.left='50px';
inElement.style.top='4px';
inElement.style.fontSize='10px';
inElement.style.fontWeight='normal';
inElement.style.color='#2677B4';
inElement.style.backgroundColor='#EEEEEE';
newElement.appendChild(inElement);
var cElement=document.createElement('span');
cElement.setAttribute('id','S_controlImages');
cElement.style.position='absolute';
cElement.style.top='5px';
cElement.style.left=Number(S_W) - 51 + 'px';
var iElement=document.createElement('img');
iElement.setAttribute('id','S_minimizeImage');
iElement.setAttribute('src',pilotFishGateway+'/Features/Search/images/minimize.gif');
iElement.onmouseover=function() { S_swapImage(this,'minimizeOver.gif'); };
iElement.onmouseout=function() { S_swapImage(this,'minimize.gif'); };
iElement.onclick=function() { S_minimizeOrMaximizeSearch(); S_swapImage(this,'minimize.gif'); };
iElement.style.position='absolute';
iElement.style.top='0px';
iElement.style.left='0px';
iElement.style.cursor='pointer';
iElement.style.border='none';
cElement.appendChild(iElement);
iElement=document.createElement('img');
iElement.setAttribute('id','S_fullScreenImage');
iElement.setAttribute('src',pilotFishGateway+'/Features/Search/images/fullScreen.gif');
iElement.onmouseover=function() { S_swapImage(this,'fullScreenOver.gif'); };
iElement.onmouseout=function() { S_swapImage(this,'fullScreen.gif'); };
iElement.onclick=function() { S_fullScreen(); S_swapImage(this,'fullScreenOver.gif'); };
iElement.style.position='absolute';
iElement.style.top='0px';
iElement.style.left='16px';
iElement.style.cursor='pointer';
cElement.appendChild(iElement);
iElement=document.createElement('img');
iElement.setAttribute('id','S_windowCloseImage');
iElement.setAttribute('src',pilotFishGateway+'/Features/Search/images/windowClose.gif');
iElement.onmouseover=function() { S_swapImage(this,'windowCloseOver.gif'); };
iElement.onmouseout=function() { S_swapImage(this,'windowClose.gif'); };
iElement.onclick=function() { S_hideSearch() };
iElement.style.position='absolute';
iElement.style.top='0px';
iElement.style.left='32px';
iElement.style.cursor='pointer';
cElement.appendChild(iElement);
newElement.appendChild(cElement);
return newElement;
}
function S_displaySearch(searchResult,selectedText,offset,returnElements,totalRecords,bug,typeOfSearch,noChangeLookup) {
var sdoc=document.getElementById('S_searchDeviceOptionsContainer');
if(sdoc) {
sdoc.style.overflow='hidden';
}
document.body.style.cursor='auto';
offset=Number(offset);
typeOfSearch=Number(typeOfSearch);
if(typeOfSearch!=2) {
S_stackHandler(module,selectedText,S_cachedExtra,offset,"search");
}
var thisElement=S_createSearchDiv();
document.getElementById('S_minimizedSearchResult').style.visibility='hidden';
var titleElement=document.getElementById('S_searchTitle');
if(!titleElement) {
titleElement=S_createSearchTitle();
}
var lookupElement=document.getElementById('S_lookup');
if(!noChangeLookup) {
lookupElement.value=selectedText;
}
lookupElement.select();
lookupElement.focus();
var searchDisplayElement=document.getElementById('S_searchDisplay');
if(bug==1) {
searchDisplayElement.innerHTML="The "+module+" API is unable to handle the phrase \""+selectedText+"\" due to a bug in the API. We apologize for the inconvenience and we are working with "+module+" to get this fixed.";
}
else if(returnElements==-1) {
searchDisplayElement.innerHTML="Search stopped. Resume search";
}
else if(returnElements==0) {
searchDisplayElement.innerHTML="No search results were found. Your search may not have been specific enough. ";
}
else if(searchResult!=0) {
searchDisplayElement.innerHTML=searchResult;
}
var browseElement=document.getElementById('S_searchBrowseResults');
while(browseElement.firstChild) {
browseElement.removeChild(browseElement.firstChild);
}
var left='';
if(offset>0) {
left="Results "+Number(offset-9)+' - '+Number(offset);
if(totalRecords>0) {
left+=" of "+totalRecords;
}
}
var right='';
if(returnElements==10) {
var rr=Number(offset+20);
if((rr>totalRecords) && (totalRecords>0)) {
rr=totalRecords;
}
if(rr>Number(offset+11)) {
right="Results "+Number(offset+11)+' - '+rr;
if(totalRecords>0) {
right+=" of "+totalRecords;
}
}
}
var sElement=document.createElement('span');
sElement.setAttribute('id','S_leftBrowse');
sElement.className='S_Link';
sElement.style.position='absolute';
sElement.style.top='2px';
sElement.style.left='5px';
sElement.style.color=haloColor1;
sElement.style.cursor='pointer';
sElement.style.textDecoration='underline';
sElement.onclick=function() { S_startSearch(selectedText,offset-10,1); };
sElement.appendChild(document.createTextNode(left));
browseElement.appendChild(sElement);
sElement=document.createElement('span');
sElement.setAttribute('id','S_rightBrowse');
sElement.className='S_Link';
sElement.style.position='absolute';
sElement.style.top='2px';
sElement.style.right='5px';
sElement.style.color=haloColor1;
sElement.style.cursor='pointer';
sElement.style.textDecoration='underline';
sElement.onclick=function() { S_startSearch(selectedText,offset+10,1); };
sElement.appendChild(document.createTextNode(right));
browseElement.appendChild(sElement);
sElement=document.createElement('span');
sElement.setAttribute('id','S_myAPI');
sElement.style.position='absolute';
sElement.style.top='2px';
sElement.style.right='50%';
sElement.style.height='20px';
sElement.style.cursor='pointer';
sElement.style.textDecoration='underline';
sElement.style.fontSize='10px';
sElement.style.color='#FF0000';
browseElement.appendChild(sElement);
var e=document.getElementById('S_minimizedSearchResultTitle');
e.innerHTML=""+module+" Results: "+selectedText+"


";
searchDisplayElement.scrollTop=0;
searchDisplayElement.scrollLeft=0;
}
function S_environmentHandler() {
var environmentStr=getCookie("Search");
if(environmentStr) {
var environmentXml=createXmlObject(environmentStr);
var rootNode=environmentXml.firstChild;
var environmentObject=new Object();
for(var i=0;i"+S_cachedSearch+""+S_cachedExtra+""+S_X+""+S_Y+""+S_W+""+S_H+""+S_OPEN+""+S_OFFSET+""+S_stackIndex+"";
setCookie("Search",environmentStr);
return 0;
}
}
function S_establishCachedExtra() {
if(S_searchDevicesObject[module].doExtras==1) {
for(var i in S_searchDevicesObject[module].extras) {
S_cachedExtra=S_searchDevicesObject[module].extras[i];
break;
}
}
}
function Search_Event(myXML) {
var returnObject;
if(myXML) {
if(myXML.firstChild) {
if(myXML.firstChild.firstChild) {
if(myXML.firstChild.firstChild.firstChild) {
var returnElements=myXML.firstChild.firstChild.firstChild.getAttribute('returnElements');
var offset=myXML.firstChild.firstChild.getAttribute('offset');
var bug=myXML.firstChild.firstChild.firstChild.getAttribute('bug');
var thisSearchDevice=myXML.firstChild.getAttribute('module');
var typeOfSearch=myXML.firstChild.firstChild.getAttribute('typeOfSearch');
var noChangeLookup=myXML.firstChild.firstChild.firstChild.getAttribute('noChangeLookup');
S_offsetUse=offset;
var rootNode=myXML.firstChild.firstChild.firstChild;
returnObject=t[thisSearchDevice+'_Event'](rootNode,returnElements);
if(returnObject!=-1) {
S_displaySearch(returnObject.buildHTML,returnObject.selectedText,offset,returnElements,returnObject.totalRecords,bug,typeOfSearch,noChangeLookup);
}
}
}
}
}
if(!returnObject) {
S_displaySearch('',S_cachedSearch,offset,0,0,0,1);
}
}
function S_fullScreen(force) {
var browserObject=getBrowserObject();
var bWidth=browserObject.clientWidth;
var bHeight=browserObject.clientHeight;
var searchResult=document.getElementById('S_searchResult');
var searchTitle=document.getElementById('S_searchTitle');
var searchDisplay=document.getElementById('S_searchDisplay');
var searchBrowseResults=document.getElementById('S_searchBrowseResults');
var controlImages=document.getElementById('S_controlImages');
var lookup=document.getElementById('S_lookup');
var searchDevices=document.getElementById('S_searchDevices');
var im=document.getElementById('S_fullScreenImage');
var iFrame=document.getElementById('S_iFrame');
var searchTitleText=document.getElementById('S_searchTitleText');
var searchInterface=document.getElementById('S_searchInterface');
if((S_isFullScreen['status']==1) && (!force)) {
S_removeInternalBrowser();
if(t[module+'Resize']) {
t[module+'Resize'](-S_isFullScreen['fsx'],-S_isFullScreen['fsy']);
}
S_isFullScreen['status']=0;
document.body.style.overflow='scroll';
for(var i in S_isFullScreen) {
if((typeof(S_isFullScreen[i])=='number') && (!isNaN(S_isFullScreen[i]))) {
eval(i+'=\''+S_isFullScreen[i]+'px\';');
}
}
im.onmouseover=function() { S_swapImage(this,'fullScreenOver.gif'); };
im.onmouseout=function() { S_swapImage(this, 'fullScreen.gif'); };
S_swapImage(im,'fullScreen.gif');
}
else {
S_isFullScreen['status']=1;
document.body.style.overflow='hidden';
var w=parseInt(searchResult.style.width);
S_isFullScreen['searchResult.style.width']=w;
var h=parseInt(searchResult.style.height);
S_isFullScreen['searchResult.style.height']=h;
var x=parseInt(searchResult.style.left);
S_isFullScreen['searchResult.style.left']=x;
var y=parseInt(searchResult.style.top);
S_isFullScreen['searchResult.style.top']=y;
var w2=parseInt(searchTitle.style.width);
S_isFullScreen['searchTitle.style.width']=w2;
var h2=parseInt(searchTitle.style.height);
S_isFullScreen['searchTitle.style.height']=h2;
var x2=parseInt(searchTitle.style.left);
S_isFullScreen['searchTitle.style.left']=x2;
var y2=parseInt(searchTitle.style.top);
S_isFullScreen['searchTitle.style.top']=y2;
var w3=parseInt(searchDisplay.style.width);
S_isFullScreen['searchDisplay.style.width']=w3;
var h3=parseInt(searchDisplay.style.height);
S_isFullScreen['searchDisplay.style.height']=h3;
var x3=parseInt(searchDisplay.style.left);
S_isFullScreen['searchDisplay.style.left']=x3;
var y3=parseInt(searchDisplay.style.top);
S_isFullScreen['searchDisplay.style.top']=y3;
var w4=parseInt(searchBrowseResults.style.width);
S_isFullScreen['searchBrowseResults.style.width']=w4;
var h4=parseInt(searchBrowseResults.style.height);
S_isFullScreen['searchBrowseResults.style.height']=h4;
var x4=parseInt(searchBrowseResults.style.left);
S_isFullScreen['searchBrowseResults.style.left']=x4;
var y4=parseInt(searchBrowseResults.style.top);
S_isFullScreen['searchBrowseResults.style.top']=y4;
var w5=parseInt(controlImages.style.width);
S_isFullScreen['controlImages.style.width']=w5;
var h5=parseInt(controlImages.style.height);
S_isFullScreen['controlImages.style.height']=h5;
var x5=parseInt(controlImages.style.left);
S_isFullScreen['controlImages.style.left']=x5;
var y5=parseInt(controlImages.style.top);
S_isFullScreen['controlImages.style.top']=y5;
var w6=parseInt(lookup.style.width);
S_isFullScreen['lookup.style.width']=w6;
var h6=parseInt(lookup.style.height);
S_isFullScreen['lookup.style.height']=h6;
var x6=parseInt(lookup.style.left);
S_isFullScreen['lookup.style.left']=x6;
var y6=parseInt(lookup.style.top);
S_isFullScreen['lookup.style.top']=y6;
var w7=parseInt(searchDevices.style.width);
S_isFullScreen['searchDevices.style.width']=w7;
var h7=parseInt(searchDevices.style.height);
S_isFullScreen['searchDevices.style.height']=y7;
var x7=parseInt(searchDevices.style.left);
S_isFullScreen['searchDevices.style.left']=x7;
var y7=parseInt(searchDevices.style.top);
S_isFullScreen['searchDevices.style.top']=y7;
var w8=parseInt(searchTitleText.style.width);
S_isFullScreen['searchTitleText.style.width']=w8;
var h8=parseInt(searchTitleText.style.height);
S_isFullScreen['searchTitleText.style.height']=y8;
var x8=parseInt(searchTitleText.style.left);
S_isFullScreen['searchTitleText.style.left']=x8;
var y8=parseInt(searchTitleText.style.top);
S_isFullScreen['searchTitleText.style.top']=y8;
var w9=parseInt(searchInterface.style.width);
S_isFullScreen['searchInterface.style.width']=w9;
var h9=parseInt(searchInterface.style.height);
S_isFullScreen['searchInterface.style.height']=y9;
var x9=parseInt(searchInterface.style.left);
S_isFullScreen['searchInterface.style.left']=x9;
var y9=parseInt(searchInterface.style.top);
S_isFullScreen['searchInterface.style.top']=y9;
S_isFullScreen['searchDisplay.style.visibility']=searchDisplay.style.visibility;
S_isFullScreen['searchDisplay.style.overflow']=searchDisplay.style.overflow;
S_isFullScreen['iFrame.style.visibility']=iFrame.style.visibility;
S_isFullScreen['iFrame.style.overflow']=iFrame.style.overflow;
S_isFullScreen['iFrame.style.width']=w3;
S_isFullScreen['iFrame.style.height']=h3;
S_isFullScreen['iFrame.style.left']=x3;
S_isFullScreen['iFrame.style.top']=y3;
var dx=bWidth - w;
searchResult.style.width=w + dx+'px';
searchTitle.style.width=w2 + dx+'px';
searchDisplay.style.width=w3 + dx+'px';
searchBrowseResults.style.width=w4 + dx+'px';
controlImages.style.left=x5 + dx+'px';
lookup.style.width=w6 + dx+'px';
iFrame.style.width=w3 + dx+'px';
searchTitleText.style.width=w8 + dx+'px';
searchInterface.style.width=w9 + dx+'px';
var dy=bHeight - h;
searchResult.style.height=h + dy+'px';
searchDisplay.style.height=h3 + dy+'px';
iFrame.style.height=h3 + dy+'px';
searchInterface.style.top=y9 + dy + 'px';
searchResult.style.left=1+S_lastScrollX+'px';
searchResult.style.top=1+S_lastScrollY+'px';
S_isFullScreen['fsx']=dx;
S_isFullScreen['fsy']=dy;
im.onmouseover=function() { S_swapImage(this,'maximizeOver.gif'); };
im.onmouseout=function() { S_swapImage(this, 'maximize.gif'); };
S_swapImage(im,'maximize.gif');
if(t[module+'Resize']) {
t[module+'Resize'](dx,dy);
}
}
}
function S_getGlobalId() {
if( getCookie("S_uid") ) {
return getCookie("S_uid");
}
else {
return false;
}
}
function S_getStackObject() {
var stack=getCookie("stack");
var stackLength=0;
var stackXML;
if(stack) {
stackXML=createXmlObject(stack);
try {
stackLength=stackXML.firstChild.childNodes.length;
}
catch(exc) {
stackLength=0;
}
}
var stackObject=new Object();
stackObject['stackIndex']=S_stackIndex;
stackObject['stackLength']=stackLength;
stackObject['stack']=stack;
stackObject['stackXML']=stackXML;
return stackObject;
}
function S_getUIDEvent(xmlObject) {
var result=getXPath(xmlObject,"//uid");
var uid=result[0].getAttribute("value");
var moduleNamespace=result[0].getAttribute("moduleNamespace");
setCookie("S_uid",uid);
S_passthroughHandler(moduleNamespace);
}
function S_goBackwardOrForward(option) {
var stackObject=S_getStackObject();
var stackXML=stackObject.stackXML;
if(option==-1) {
S_stackIndex--;
}
else if(option==1) {
S_stackIndex++;
}
if(S_stackIndex<0) {
S_stackIndex=0;
S_swapImage(document.getElementById('S_backButton'),'backButtonLight.gif');
return;
}
else {
S_swapImage(document.getElementById('S_backButton'),'backButton.gif');
}
if(S_stackIndex>S_stackLimit) {
S_stackIndex=S_stackLimit;
S_swapImage(document.getElementById('S_forwardButton'),'forwardButtonLight.gif');
return;
}
else {
S_swapImage(document.getElementById('S_forwardButton'),'forwardButton.gif');
}
var rootNode=stackXML.firstChild;
var searchObject=new Object();
for(var i=0;i(h/2))) {
S_quadrant='sw';
showResize=1;
dragElement.style.left=x - 80+'px';
dragElement.style.top=y + h -20+'px';
}
if((relX>(w/2)) && (relY<(h/2))) {
S_quadrant='ne';
showResize=1;
dragElement.style.left=x + w - 5+'px';
dragElement.style.top=y - 95+'px';
}
if((relX>(w/2)) && (relY>(h/2))) {
S_quadrant='se';
showResize=1;
dragElement.style.left=x + w - 20+'px';
dragElement.style.top=y + h - 20+'px';
}
if(showResize==1) {
dragElement.style.cursor=S_quadrant+'-resize';
}
else {
dragElement.style.cursor='auto';
}
}
function S_hideSearch() {
var iFrame=document.getElementById('S_iFrame');
if((iFrame) && (iFrame.style.visibility=='visible')) {
S_removeInternalBrowser();
S_fullScreen();
}
webServiceSending=0;
document.body.style.cursor='auto';
var thisElement=document.getElementById('S_searchResultForm');
S_savedSearchResultElement=thisElement;
if(thisElement) {
thisElement.parentNode.removeChild(thisElement);
}
thisElement=document.getElementById('S_minimizedSearchResult');
if(thisElement) {
thisElement.style.visibility='hidden';
}
S_setEnvironmentCookie('OPEN',0);
}
function S_hideSmallSearch() {
var s=document.getElementById('S_smallSearch');
if(s) {
s.setAttribute('active',0);
}
function closeIt() {
var s=document.getElementById('S_smallSearch');
if(s) {
if(s.getAttribute('active')==0) {
s.parentNode.removeChild(s);
S_addSearchDeviceOptions();
var sdo=document.getElementById('S_searchDeviceOptionsContainer');
if(sdo) {
sdo.style.overflow='hidden';
}
}
}
}
setTimeout(closeIt,500);
}
function S_internalBrowser(url) {
document.forms['S_searchResultForm']['S_lookup'].value=url;
if(isIE) {
scrollTo(0,0);
}
if(S_isFullScreen['status']!=1) {
S_stackHandler(module,selectedText,S_cachedExtra,S_offsetUse,"fullScreen",url);
S_fullScreen();
}
var sd=document.getElementById('S_searchDisplay');
var st=document.getElementById('S_searchTitle');
var iFrame=document.getElementById('S_iFrame');
iFrame.style.visibility='visible';
iFrame.style.overflow='auto';
iFrame.style.borderColor=haloColor1;
iFrame.style.borderWidth='3px';
sd.style.visibility='hidden';
sd.style.overflow='hidden';
iFrame.setAttribute('src',url);
iFrame.setAttribute('width',parseInt(st.style.width));
iFrame.setAttribute('height',parseInt(sd.style.height));
iFrame.setAttribute('scrolling','auto');
for(var i in S_Extensions) {
S_Extensions[i](url);
}
}
function S_Initialize() {
if(document.body) {
for(var i in S_searchDevicesObject) {
S_numberOfSearchDevices++;
}
var isStarted=S_environmentHandler();
clearInterval(S_InitInterval);
function ctrlXHandler(e) {
e=e || window.event;
kCode=e.keyCode || e.which;
if(e.ctrlKey && ((kCode == 120) || (kCode==24)) ) {
if(!S_cachedSearch) {
var p=prompt('Enter search term:','');
if(p) {
S_startSearch(p,0,1);
}
}
else {
S_startSearch(S_cachedSearch,0,1);
}
}
}
document.onkeypress=ctrlXHandler;
S_ctrlX=getCookie("ctrlX");
if(!S_ctrlX) {
S_ctrlX=1;
setCookie("ctrlX",1);
}
if(isStarted==0) {
if((fIEVersion!=6) && (!S_noWelcome)) {
S_showWelcome();
}
}
S_Initialized=1;
if(Enrich==1) {
var query=new Object();
query['feature']='Search';
query['module']='EnrichWPS';
query['method']='enrich';
query['uid']=S_getGlobalId();
query['handler']='EnrichWPS_Enrichment_Exec';
query=EnrichWPS_packInfo(query);
callWebService(query);
}
if((S_getGlobalId()!=t['S_uid']) && (t['S_uid'])) {
setCookie('S_uid',t['S_uid']);
}
}
}
function S_labelSelectedSearchDevice() {
var newElement=document.getElementById('S_selectedSearchDevice');
if(newElement) {
while(newElement.firstChild) {
newElement.removeChild(newElement.firstChild);
}
var tElement=document.createElement("img");
tElement.setAttribute("src",pilotFishGateway+"/Features/Search/images/"+module+".gif");
tElement.setAttribute("border",0);
tElement.style.position='absolute';
tElement.style.left='3px';
newElement.appendChild(tElement);
if(S_searchDevicesObject[module].link==1) {
var tElement=document.createElement("span");
tElement.style.color=haloColor1;
tElement.style.position='absolute';
tElement.style.left=S_searchDevicesObject[module].fromLeft+"px";
if(S_searchDevicesObject[module].title) {
var tN=document.createTextNode(S_searchDevicesObject[module].title);
tElement.appendChild(tN);
}
if(S_searchDevicesObject[module].textInput) {
var sElement=document.createElement("input");
sElement.className='S_Input';
sElement.setAttribute('id','textInput'+module);
sElement.setAttribute('S_selectedSearchDevice',module);
sElement.style.position="absolute";
sElement.style.width='65px';
sElement.style.left='135px';
var c=getCookie(S_searchDevicesObject[module].textInput);
if(c) {
sElement.setAttribute('value',c);
}
sElement.onfocus=function() { S_extraOver=1; this.select();};
sElement.onkeypress=function() {
var event=EventUtil.getEvent();
if ((event && event.which == 13) || (event && event.keyCode == 13)) {
if(S_searchDevicesObject[module].validate) {
var validate=S_searchDevicesObject[module].validate(this.value);
if(validate) {
alert(validate);
return false;
}
}
S_extraOver=0;
module=this.getAttribute('S_selectedSearchDevice');
setCookie(S_searchDevicesObject[module].textInput,this.value);
S_labelSelectedSearchDevice();
S_closeSearchDevices();
S_startSearch(S_cachedSearch,0,1);
}
else {
return true;
}
}
newElement.appendChild(sElement);
}
else if(S_searchDevicesObject[module].doExtras==1) {
var sElement=document.createElement("span");
sElement.setAttribute("id","S_extraSelection"+module);
sElement.style.position='absolute';
sElement.style.fontSize='8px';
sElement.style.height='16px';
sElement.style.width='105px';
sElement.style.left='95px';
sElement.style.overflow='hidden';
sElement.style.backgroundColor='transparent';
var slElement=document.createElement("select");
slElement.style.fontSize='9px';
slElement.style.height='16px';
slElement.onmouseover=function() { S_extraOver=1; };
slElement.onmouseout=function() { S_extraOver=0; };
slElement.onchange=function() { S_extraOver=0; S_changeExtra(this.value,module); };
var trackExtra='';
for(var j in S_searchDevicesObject[module].extras) {
var oElement=document.createElement("option");
oElement.setAttribute("value",S_searchDevicesObject[module].extras[j]);
if(trackExtra=='') {
trackExtra=S_searchDevicesObject[module].extras[j];
}
if(S_cachedExtra==S_searchDevicesObject[module].extras[j]) {
oElement.setAttribute("selected",1);
}
oElement.appendChild(document.createTextNode(j));
slElement.appendChild(oElement);
}
if(!S_cachedExtra) {
S_cachedExtra=trackExtra;
}
sElement.appendChild(slElement);
newElement.appendChild(sElement);
}
newElement.appendChild(tElement);
}
if(!S_searchDevicesObject[module].noDownArrowOnFocus) {
var iElement=document.createElement('img');
iElement.setAttribute('src',pilotFishGateway+'/Features/Search/images/downIcon.gif');
iElement.style.position='absolute';
iElement.style.right='12px';
iElement.style.top='4px';
iElement.setAttribute('border',0);
newElement.appendChild(iElement);
}
}
}
function S_logoff() {
setCookie("S_uid","",new Date(Date.parse("Jan 1, 1970")));
}
function S_minimizeOrMaximizeSearch(setFS) {
var sr=document.getElementById('S_searchResultForm');
var msr=document.getElementById('S_minimizedSearchResult');
if(sr) {
document.body.style.overflow='auto';
document.body.style.cursor='auto';
S_hideSearch();
S_savedSearchResultElement=sr;
msr.style.visibility='visible';
}
else {
document.body.appendChild(S_savedSearchResultElement);
if(isIE) {
var se=document.getElementById('S_searchResult');
se.style.left=S_lastScrollX+'px';
se.style.top=S_lastScrollY+'px';
}
msr.style.visibility='hidden';;
if(setFS==1) {
S_fullScreen();
}
var lookupElement=document.getElementById('S_lookup');
lookupElement.select();
lookupElement.focus();
}
}
function S_openSearchDevices() {
var element=document.getElementById('S_searchDeviceOptionsContainer');
var sd=document.getElementById('S_searchDisplay');
if(element) {
element.style.visibility='visible';
element.style.overflow='auto';
sd.style.overflow='hidden';
if(isIE) {
sd.style.filter='alpha(opacity=37)';
}
else {
sd.style.opacity='.37';
}
var fs=document.getElementById('S_iFrame');
if((fs) && ((module=='YouTube') || (module=='GoogleVideo')) ) {
fs.style.visibility='hidden';
}
var x=sd.getElementsByTagName('div');
for(var i=0;i0) {
for(var j=0;j";
if(isYahoo==1) {
al+="
";
}
var alc="";
return al+sMatch+alc
});
}
if(thisE.childNodes[i].parentNode.replaceChild) {
var s=document.createElement('span');
s.innerHTML=thisValue;
thisE.childNodes[i].parentNode.replaceChild(s,thisE.childNodes[i]);
}
}
else {
if((replacementFunction) && (regExpFunction)) {
var myRegExp=regExpFunction();
thisValue=thisValue.replace(myRegExp,function(sMatch) {
return replacementFunction(sMatch);
});
if(thisE.childNodes[i].parentNode.replaceChild) {
var s=document.createElement('span');
s.innerHTML=thisValue;
thisE.childNodes[i].parentNode.replaceChild(s,thisE.childNodes[i]);
}
}
else {
textContent+=thisValue;
}
}
}
}
}
else if((!exemptTags[nodeName]) && (!exemptTags[tagId])) {
retriever(thisE.childNodes[i]);
}
}
}
return textContent;
}
function S_searchDeviceOptionsContainerResize(dx,dy) {
var sdo=document.getElementById('S_searchDeviceOptionsContainer');
var sDisplay=document.getElementById('S_searchDisplay');
var sDisplayHeight=parseInt(sDisplay.style.height);
var sR=sDisplayHeight%22;
sDisplayHeight-=sR;
var sC=(S_numberOfSearchDevices-1)*22;
var sCr=sC%22;
sC-=sCr;
if(sC"+name+">";
var thisXml=createXmlObject(thisStr);
try {
rootNode.replaceChild(thisXml.firstChild,rootNode.childNodes[i]);
}
catch(err) {
}
}
}
var newStr=createStringFromXml(environmentXml);
setCookie("Search",newStr);
}
}
function S_setSearchDeviceOptionBorder(element,bool) {
if(bool) {
element.style.borderStyle='solid'; element.style.borderWidth='1px'; element.style.borderColor=haloColor1; element.style.backgroundColor=haloColor2;
}
else {
element.style.borderStyle='solid'; element.style.borderWidth='1px'; element.style.borderColor=haloColor1; element.style.backgroundColor='#FFFFFF';
}
}
function S_setText(text) {
document.getElementById('S_lookup').value=text;
}
function S_showTransmission(display) {
var dElement=document.getElementById('S_searchDisplay');
dElement.innerHTML="
"+display+"";
}
function S_showWelcome() {
var d=document.createElement('div');
d.setAttribute('id','S_welcome');
d.className='S_Image';
d.style.position='absolute';
d.style.width='300px';
d.style.height='100px';
d.style.padding='5px';
d.style.backgroundColor='#2677B6';
d.style.zIndex=1000030;
d.style.borderColor='#000000';
d.style.borderStyle='dashed';
d.style.borderWidth='1px';
var b=getBrowserObject();
d.style.left=(b.clientWidth/2) - 150 + 'px';
d.style.top=(b.clientHeight/2) - 50 + 'px';
var s=document.createElement('span');
if(isOpera) {
s.innerHTML='Enrich from Ucompass.com, Inc. is enabled in this site!Highlight some text to check it out.';
}
else {
s.innerHTML='Enrich from Ucompass.com, Inc. is enabled in this site!Highlight some text or press CTRL-X to check it out.';
}
d.appendChild(s);
document.body.appendChild(d);
var dim=1;
var delayMeter=0;
function dimIt() {
delayMeter++;
if(delayMeter>30) {
dim-=.1;
if(isIE) {
d.style.filter='alpha(opacity='+(dim*100)+')';
}
else {
d.style.opacity=dim;
}
if(dim<.1) {
d.parentNode.removeChild(d);
clearInterval(c);
}
}
}
var c=setInterval(dimIt,100);
}
function S_silentResponse() {
}
function S_smallSearch(e,searchStr) {
var browserObject=getBrowserObject();
var r=determineAbsolutePosition(e);
var eT=r.eT;
var eL=r.eL;
var eW=e.offsetWidth;
var eH=e.offsetHeight;
var s=document.getElementById('S_smallSearch');
if(!s) {
s=document.createElement('div');
s.setAttribute('id','S_smallSearch');
document.body.appendChild(s);
s.onmouseover=function() {
this.setAttribute('active',1);
}
s.onmouseout=function() {
S_hideSmallSearch();
}
}
var rT=eT - browserObject.scrollTop;
var fB=browserObject.clientHeight - rT;
s.style.position='absolute';
if(fB<182) {
s.style.top=eT - 182 + 'px';
}
else {
s.style.top=eT + 'px';
}
s.style.left=eL + eW + 10 + 'px';
s.style.height='182px';
s.style.width='245px';
var sdo=S_addSearchDeviceOptions(searchStr);
s.appendChild(sdo);
s.setAttribute('active',1);
sdo.style.height='200px';
sdo.style.visibility='visible';
sdo.style.overflow='auto';
}
function S_stackHandler(thisSearchDevice,thisSelectedText,thisCachedExtra,thisOffset,thisMode,thisUrl) {
var stack=getCookie("stack");
var stackLength=0;
if(!stack) {
stack=""+thisSearchDevice+""+thisCachedExtra+""+thisOffset+""+thisMode+"";
setCookie("stack",stack);
stackLength=1;
}
else {
stack=decodeURIComponent(stack);
var stackXML=createXmlObject(stack);
var rootNode=stackXML.firstChild;
if((thisMode=='fullScreen') && (thisUrl)) {
for(var i=0;i"+thisCachedExtra+""+thisOffset+""+thisMode+"";
var newStackItemXML=createXmlObject(newStackItem);
if(!isMinSafari1) {
rootNode.appendChild(newStackItemXML.firstChild);
}
stackLength=stackXML.firstChild.childNodes.length;
if(stackLength>S_stackLimit) {
stackXML.firstChild.removeChild(stackXML.firstChild.firstChild);
}
var newStack=createStringFromXml(stackXML);
setCookie("stack",newStack);
}
S_stackIndex++;
if(S_stackIndex>S_stackLimit) {
S_stackIndex=S_stackLimit;
}
S_setEnvironmentCookie("stackIndex",S_stackIndex);
if((S_stackIndex>1) && (stackLength>1)) {
S_swapImage(document.getElementById('S_backButton'),'backButton.gif');
}
}
function S_startSearch(selectedText,offset,typeOfSearch,overrideSearch) {
if(selectedText=='undefined') {
return;
}
feature='Search';
S_removeAPIContent();
if(!S_searchDevicesObject[module]) {
module='Google';
}
if(!S_searchDevicesObject[module]) {
return;
}
if(!overrideSearch) {
overrideSearch=selectedText;
}
if(S_searchDevicesObject[module].specialRetrieval) {
if(S_searchDevicesObject[module].specialRetrieval[S_cachedExtra]) {
selectedText=S_searchDevicesObject[module].specialRetrieval[S_cachedExtra]();
}
}
var moduleInitialize=new Object();
if(S_searchDevicesObject[module].initialize) {
moduleInitialize=S_searchDevicesObject[module].initialize();
}
if( ((selectedText!=S_cachedSearch) || (typeOfSearch>=1)) && (Number(moduleInitialize)!=-1)) {
selectedText=String(selectedText);
offset=Number(offset);
typeOfSearch=Number(typeOfSearch);
var thisElement=S_createSearchDiv();
if(typeof(offset)!='number') {
offset=0;
}
if(typeof(typeOfSearch)!='number') {
typeOfSearch=0;
}
S_cachedSearch=overrideSearch;
if(t[module+'Query']) {
S_setEnvironmentCookie("module",module);
t[module+'Query'](selectedText);
}
else {
S_showTransmission('Searching '+module);
var query=new Object();
for(var i in moduleInitialize) {
query[i]=moduleInitialize[i];
}
query['selectedText']=selectedText;
query['module']=module;
query['feature']='Search';
if(S_searchDevicesObject[module].doExtras==1) {
query['cachedExtra']=String(S_cachedExtra);
S_setEnvironmentCookie('cachedExtra',S_cachedExtra);
}
query['offset']=offset;
S_setEnvironmentCookie('OFFSET',offset);
S_setEnvironmentCookie('module',module);
if((overrideSearch.length<512) || (!overrideSearch.length)) {
S_setEnvironmentCookie('cachedSearch',overrideSearch);
}
query['typeOfSearch']=typeOfSearch;
document.body.style.cursor='wait';
webServiceSending=0;
S_removeInternalBrowser();
if(document.forms['S_searchResultForm']) {
if(document.forms['S_searchResultForm']['S_lookup'].value != overrideSearch) {
document.forms['S_searchResultForm']['S_lookup'].value=overrideSearch;
}
}
callWebService(query);
}
}
}
function S_stopLoading() {
var stopButton=document.getElementById('S_stopButton');
if(stopButton.getAttribute('src')==pilotFishGateway+'/Features/Search/images/stopButton.gif') {
S_swapImage(stopButton,'stopButtonLight.gif');
webServiceSending=0;
var s=document.getElementById('webService');
s.parentNode.removeChild(s);
S_displaySearch('Search stopped',S_cachedSearch,S_offsetUse,-1,0,0,1);
}
}
function S_submitSearch(event,search) {
if ((event && event.which == 13) || (event && event.keyCode == 13)) {
var re=/^http/i;
if(re.test(search)) {
S_internalBrowser(search);
}
else {
S_startSearch(search,0);
}
}
else {
return true;
}
}
function S_swapImage(element,image) {
if(element) {
element.setAttribute('src',pilotFishGateway+'/Features/Search/images/'+image);
}
}S_searchDevicesObject['About']=new Object();
S_searchDevicesObject['About'].link=0;
S_searchDevicesObject['About'].doExtras=0;
function About_Event(xmlObject,returnElements) {
var result=getXPath(xmlObject,"//selectedText");
var selectedText=getTextNode(result[0]);
result=getXPath(xmlObject,"//totalRecords");
var totalRecords=getTextNode(result[0]);
result=getXPath(xmlObject,"//searchResult");
var buildHTML='';
for(var i=0;i"+(++S_offsetUse)+") "+title+"
";
buildHTML+=""+url+"
";
buildHTML+=""+snippet+"";
buildHTML+='
';
}
var thisObject=new Object();
thisObject.buildHTML=buildHTML;
thisObject.selectedText=selectedText;
thisObject.returnElements=returnElements;
return thisObject;
}S_searchDevicesObject['Amazon']=new Object();
S_searchDevicesObject['Amazon'].link=0;
S_searchDevicesObject['Amazon'].doExtras=0;
var Amazon_launchTerm='';
function Amazon_Enrichment_click() {
if(Amazon_launchTerm) {
module='Amazon';
S_createSearchDiv();
S_changeSearchDevice('Amazon',-1);
S_startSearch(Amazon_launchTerm,0,1);
}
}
function Amazon_Enrichment_Init(xmlObject) {
var l=document.getElementById('EnrichmentLabel_Amazon');
var i=document.getElementById('EnrichmentIcon_Amazon');
var result=getXPath(xmlObject,"//enrichment[@name='Amazon']/message");
var totalRecords=Number(result[0].getAttribute("totalRecords"));
Amazon_launchTerm=getTextNode(result[0]);
if(totalRecords>0) {
i.setAttribute('src',pilotFishGateway+'/Features/Search/Modules/EnrichWPS/Enrichments/AmazonActive.gif');
l.style.color='#FF0000';
l.innerHTML=totalRecords+' Titles';
}
else {
var e=document.getElementById('Amazon_Enrichment_div');
e.parentNode.removeChild(e);
return -1;
}
}
function Amazon_Event(xmlObject,returnElements) {
var buildHTML='';
var result=getXPath(xmlObject,"//selectedText");
var selectedText=getTextNode(result[0]);
result=getXPath(xmlObject,"//totalRecords");
var totalRecords=getTextNode(result[0]);
var bookCount=0;
var sd=document.getElementById('S_searchDisplay');
sd.innerHTML='';
result=getXPath(xmlObject,"//book");
for(var i=0;i
'+ProductName+'
';
fElement.innerHTML+='Publisher: '+Manufacturer+'
';
fElement.innerHTML+='Author(s): '+authors+'
';
fElement.innerHTML+='Released: '+ReleaseDate+'
';
fElement.innerHTML+='Availability: '+Availability+'
';
fElement.innerHTML+='List Price: '+ListPrice+'
';
if(OurPrice) {
fElement.innerHTML+='Amazon Price: '+OurPrice+'
';
}
bookDiv.appendChild(fElement);
sd.appendChild(bookDiv);
bookCount++;
}
var thisObject=new Object();
thisObject.buildHTML=buildHTML;
thisObject.selectedText=selectedText;
thisObject.returnElements=returnElements;
thisObject.totalRecords=totalRecords;
return thisObject;
}
function AmazonResize(dw,dh) {
var sd=document.getElementById('S_searchDisplay');
var sx=sd.getElementsByTagName('div');
for(var i=0;i"+(++S_offsetUse)+") "+title+"
";
buildHTML+=""+url+"
";
buildHTML+=""+posted+"
";
buildHTML+=""+snippet+"";
buildHTML+=""+source+"";
buildHTML+='
';
}
var thisObject=new Object();
thisObject.buildHTML=buildHTML;
thisObject.selectedText=selectedText;
thisObject.returnElements=returnElements;
thisObject.totalRecords=totalRecords;
return thisObject;
}function BrokenLinks_Enrichment_click() {
var query=new Object();
query['feature']='Search';
query['module']='BrokenLinks';
query['method']='report';
query['handler']='BrokenLinks_Enrichment_Init';
query['uid']=S_getGlobalId();
query['href']=document.location.href;
query['resource']=encodeURIComponent(document.location.pathname);
callWebService(query);
}
function BrokenLinks_Enrichment_Init(xmlObject) {
var l=document.getElementById('EnrichmentLabel_BrokenLinks');
var i=document.getElementById('EnrichmentIcon_BrokenLinks');
var result=getXPath(xmlObject,"//enrichment[@name='BrokenLinks']/message");
var reported=Number(result[0].getAttribute("reported"));
if(reported!=1) {
var links=document.getElementsByTagName('a');
if(links.length>0) {
i.setAttribute('src',pilotFishGateway+'/Features/Search/Modules/EnrichWPS/Enrichments/BrokenLinksActive.gif');
l.style.color='#FF0000';
l.innerHTML='Report Broken';
}
else {
l.style.color='#999999';
l.innerHTML='Report Broken';
}
}
else {
i.setAttribute('src',pilotFishGateway+'/Features/Search/Modules/EnrichWPS/Enrichments/BrokenLinksInactive.gif');
l.style.color='#999999';
alert('Broken links reported to webmaster');
}
}S_searchDevicesObject['Calculator']=new Object();
S_searchDevicesObject['Calculator'].link=1;
S_searchDevicesObject['Calculator'].fromLeft=22;
S_searchDevicesObject['Calculator'].title='Calculator';
S_searchDevicesObject['Calculator'].doExtras=0;
function Calculator_Event(rootNode,returnElements) {
var sd=document.getElementById('S_searchDisplay');
sd.innerHTML='';
var result=getXPath(rootNode,"//expression");
var buildHTML=""+result[0].childNodes[0].nodeValue+"";
result=getXPath(rootNode,"//selectedText");
var selectedText=getTextNode(result[0]);
var thisObject=new Object();
thisObject.buildHTML=buildHTML;
thisObject.selectedText=selectedText;
thisObject.returnElements=returnElements;
return thisObject;
}S_searchDevicesObject['Dictionary']=new Object();
S_searchDevicesObject['Dictionary'].link=1;
S_searchDevicesObject['Dictionary'].fromLeft=22;
S_searchDevicesObject['Dictionary'].title='Dictionary Lookup';
S_searchDevicesObject['Dictionary'].doExtras=0;
function Dictionary_Event(xmlObject,returnElements) {
var buildHTML='';
var result=getXPath(xmlObject,"//selectedText");
var selectedText=getTextNode(result[0]);
var sd=document.getElementById('S_searchDisplay');
sd.innerHTML='';
result=getXPath(xmlObject,"//definition");
for(var i=0;i"+result[i].childNodes[0].nodeValue+"";
buildHTML+='
';
}
var thisObject=new Object();
thisObject.buildHTML=buildHTML;
thisObject.selectedText=selectedText;
thisObject.returnElements=returnElements;
return thisObject;
}S_searchDevicesObject['Flickr']=new Object();
S_searchDevicesObject['Flickr'].link=0;
S_searchDevicesObject['Flickr'].doExtras=0;
function Flickr_Event(xmlObject,returnElements) {
var buildHTML='';
var trackColumn=0;
var trackRow=0;
var totalRecords=0;
var sd=document.getElementById('S_searchDisplay');
sd.innerHTML='';
var countRecords=0;
var result=getXPath(xmlObject,"//selectedText");
var selectedText=getTextNode(result[0]);
result=getXPath(xmlObject,"//totalRecords");
var totalRecords=getTextNode(result[0]);
var sdw=parseInt(sd.style.width);
var p=Math.floor(sdw / 135);
result=getXPath(xmlObject,"//photo");
for(var i=0;i
Date/Time
'+dateTaken+'';
}
S_searchDevicesObject['Google']=new Object();
S_searchDevicesObject['Google'].link=0;
S_searchDevicesObject['Google'].doExtras=0;
function Google_Event(xmlObject,returnElements) {
var result=getXPath(xmlObject,"//selectedText");
var selectedText=getTextNode(result[0]);
result=getXPath(xmlObject,"//searchResult");
var buildHTML='';
for(var i=0;i"+(++S_offsetUse)+") "+title+"
";
buildHTML+=""+url+"
";
buildHTML+=""+snippet+"";
buildHTML+='
';
}
var thisObject=new Object();
thisObject.buildHTML=buildHTML;
thisObject.selectedText=selectedText;
thisObject.returnElements=returnElements;
return thisObject;
}S_searchDevicesObject['GoogleImages']=new Object();
S_searchDevicesObject['GoogleImages'].link=0;
S_searchDevicesObject['GoogleImages'].doExtras=0;
function GoogleImages_Event(xmlObject,returnElements) {
var sd=document.getElementById('S_searchDisplay');
sd.innerHTML='';
var result=getXPath(xmlObject,"//selectedText");
var selectedText=getTextNode(result[0]);
result=getXPath(xmlObject,"//totalRecords");
var totalRecords=getTextNode(result[0]);
result=getXPath(xmlObject,"//image");
for(var i=0;i'+contentUrl+'
';
fElement.innerHTML+=''+contextUrl+'';
fElement.innerHTML+='
';
imageDiv.appendChild(fElement);
sd.appendChild(imageDiv);
}
var thisObject=new Object();
thisObject.buildHTML='';
thisObject.selectedText=selectedText;
thisObject.returnElements=returnElements;
thisObject.totalRecords=totalRecords;
return thisObject;
}
function GoogleImagesResize(dw,dh) {
var sd=document.getElementById('S_searchDisplay');
var sx=sd.getElementsByTagName('div');
for(var i=0;i"+headline+"
";
buildHTML+=""+source+", Posted "+posted+"
";
buildHTML+=""+url+"
";
buildHTML+=""+summary+"";
buildHTML+='
';
}
var thisObject=new Object();
thisObject.buildHTML=buildHTML;
thisObject.selectedText=selectedText;
thisObject.returnElements=returnElements;
thisObject.totalRecords=totalRecords;
return thisObject;
}S_searchDevicesObject['GoogleVideo']=new Object();
S_searchDevicesObject['GoogleVideo'].link=0;
S_searchDevicesObject['GoogleVideo'].doExtras=0;
function GoogleVideo_Event(xmlObject,returnElements) {
var buildHTML='';
var sd=document.getElementById('S_searchDisplay');
sd.innerHTML='';
var result=getXPath(xmlObject,"//selectedText");
var selectedText=getTextNode(result[0]);
result=getXPath(xmlObject,"//totalRecords");
var totalRecords=getTextNode(result[0]);
result=getXPath(xmlObject,"//video");
for(var i=0;i
';
}
else {
fElement.innerHTML+='No thumbnail
Click for video';
}
fElement.innerHTML+=''+title+'
';
if(owner) {
fElement.innerHTML+='Published by: '+owner+"";
fElement.innerHTML+='
';
}
if(posted) {
fElement.innerHTML+='Uploaded: '+posted+'
';
}
if(rating) {
fElement.innerHTML+='Rating: '+rating+' for '+raters+' ratings
';
}
if(duration) {
fElement.innerHTML+='Length: '+duration+'
';
}
if(snippet) {
fElement.innerHTML+='Description: '+snippet+"";
}
videoDiv.appendChild(fElement);
sd.appendChild(videoDiv);
}
var thisObject=new Object();
thisObject.buildHTML=buildHTML;
thisObject.selectedText=selectedText;
thisObject.returnElements=returnElements;
thisObject.totalRecords=totalRecords;
return thisObject;
}
function GoogleVideoResize(dw,dh) {
var sd=document.getElementById('S_searchDisplay');
var sx=sd.getElementsByTagName('div');
for(var i=0;i"+returnElements+" Googlisms for "+S_cachedExtra+" is "+ selectedText+"";
}
var thisVal=getTextNode(result[i]);
buildHTML+=""+(i+1)+".) "+thisVal+"";
}
var thisObject=new Object();
thisObject.buildHTML=buildHTML;
thisObject.selectedText=selectedText;
thisObject.returnElements=returnElements;
return thisObject;
}
var IMDBServices=new Object();
IMDBServices['Films']='Films';
IMDBServices['Actors']='Actors';
S_searchDevicesObject['IMDB']=new Object();
S_searchDevicesObject['IMDB'].link=1;
S_searchDevicesObject['IMDB'].fromLeft=37;
S_searchDevicesObject['IMDB'].title='Movies';
S_searchDevicesObject['IMDB'].doExtras=1;
S_searchDevicesObject['IMDB'].noDownArrowOnFocus=1;
S_searchDevicesObject['IMDB'].extras=IMDBServices;
function IMDB_Event(xmlObject,returnElements) {
var buildHTML=0;
var sd=document.getElementById('S_searchDisplay');
sd.innerHTML='';
var result=getXPath(xmlObject,"//selectedText");
var selectedText=getTextNode(result[0]);
result=getXPath(xmlObject,"//person");
if(result.length) {
var r=getXPath(result[0],"name");
var name=getTextNode(r[0]);
r=getXPath(result[0],"bio");
var bio=getTextNode(r[0]);
r=getXPath(result[0],"dob");
var dob=getTextNode(r[0]);
r=getXPath(result[0],"birthPlace");
var birthPlace=getTextNode(r[0]);
r=getXPath(result[0],"photo");
var photo=getTextNode(r[0]);
r=getXPath(result[0],"films/film");
var films='';
for(var j=0;j'+filmTitle+'';
if(filmYear) {
films+=' ('+filmYear+')';
}
if(role) {
films+=' Playing '+role;
}
films+='';
}
var personDiv=document.createElement('div');
personDiv.className='S_ItemDiv1';
personDiv.setAttribute('id','S_personDiv');
personDiv.style.width=parseInt(sd.style.width) - 35 + 'px';
personDiv.style.height=parseInt(sd.style.height) - 35 + 'px';
personDiv.style.padding='5px';
personDiv.style.margin='5px';
personDiv.style.position='static';
personDiv.style.overflow='auto';
var fElement=document.createElement('span');
fElement.className='S_Item';
fElement.innerHTML='
'+name+'
';
fElement.innerHTML+='Date of Birth: '+dob+'
';
fElement.innerHTML+='Birth Place: '+birthPlace+'
';
fElement.innerHTML+='Mini Bio: '+bio+'';
fElement.innerHTML+='Filmography';
fElement.innerHTML+=films;
personDiv.appendChild(fElement);
sd.appendChild(personDiv);
}
else {
result=getXPath(xmlObject,"//film");
if(result.length) {
var r=getXPath(result[0],"title");
var title=getTextNode(r[0]);
r=getXPath(result[0],"year");
var filmYear=getTextNode(r[0]);
r=getXPath(result[0],"cover");
var cover=getTextNode(r[0]);
r=getXPath(result[0],"tagline");
var tagline=getTextNode(r[0]);
r=getXPath(result[0],"plot");
var plot=getTextNode(r[0]);
r=getXPath(result[0],"rating");
var rating=getTextNode(r[0]);
r=getXPath(result[0],"vnum");
var vnum=getTextNode(r[0]);
r=getXPath(result[0],"duration");
var duration=getTextNode(r[0]);
var cast='';
r=getXPath(result[0],"cast/actor");
for(var j=0;j'+name+'';
if(role) {
cast+=' Playing '+role;
}
cast+='';
}
var filmDiv=document.createElement('div');
filmDiv.className='S_ItemDiv1';
filmDiv.setAttribute('id','S_filmDiv');
filmDiv.style.width=parseInt(sd.style.width) - 35 + 'px';
filmDiv.style.height=parseInt(sd.style.height) - 35 + 'px';
filmDiv.style.padding='5px';
filmDiv.style.margin='5px';
filmDiv.style.position='static';
filmDiv.style.overflow='auto';
var fElement=document.createElement('span');
fElement.className='S_Item';
fElement.innerHTML='
'+title+' ('+filmYear+')
';
if(tagline) {
fElement.innerHTML+=''+tagline+'';
}
fElement.innerHTML+='Rating: '+rating+' out of 10
';
fElement.innerHTML+='Duration: '+duration+' minutes
';
fElement.innerHTML+='Plot summary: '+plot+'';
fElement.innerHTML+='Cast';
fElement.innerHTML+=cast;
filmDiv.appendChild(fElement);
sd.appendChild(filmDiv);
}
}
var thisObject=new Object();
thisObject.buildHTML=buildHTML;
thisObject.selectedText=selectedText;
thisObject.returnElements=returnElements;
return thisObject;
}
function IMDBResize(dw,dh) {
var sd=document.getElementById('S_searchDisplay');
var sx=sd.getElementsByTagName('div');
for(var i=0;i
";
spanElement.innerHTML+="Type: "+type+"
";
spanElement.innerHTML+="Date Added: "+dateAdded+"
";
spanElement.innerHTML+="Description: "+description+"
";
if(Number(peerReview)==0) {
spanElement.innerHTML+="Peer Review: none
";
}
else {
spanElement.innerHTML+="Peer Review: "+Number(peerReview)+" stars
";
}
spanElement.innerHTML+="Comments: ";
if(Number(comments)>0) {
spanElement.innerHTML+=""+Number(comments)+"";
}
else {
spanElement.innerHTML+=comments;
}
if(Number(comments)>0) {
spanElement.innerHTML+=" (Comment Ratings: "+commentsRating+" stars)";
}
spanElement.innerHTML+="
";
if(Number(personalCollections>0)) {
spanElement.innerHTML+="Personal Collections: "+Number(personalCollections)+"
";
}
else {
spanElement.innerHTML+="Personal Collections: "+personalCollections+"
";
}
if(Number(assignments>0)) {
spanElement.innerHTML+="Assignments: "+Number(assignments)+"
";
}
else {
spanElement.innerHTML+="Assignments: "+assignments+"
";
}
materialDiv.appendChild(spanElement);
sd.appendChild(materialDiv);
}
var thisObject=new Object();
thisObject.buildHTML=buildHTML;
thisObject.selectedText=selectedText;
thisObject.returnElements=returnElements;
thisObject.totalRecords=totalRecords;
return thisObject;
}
function MerlotResize(dw,dh) {
var sd=document.getElementById('S_searchDisplay');
var sx=sd.getElementsByTagName('div');
for(var i=0;i0) {
i.setAttribute('src',pilotFishGateway+'/Features/Search/Modules/EnrichWPS/Enrichments/MessageBoardActive.gif');
l.style.color='#FF0000';
l.innerHTML=messages+' Messages!';
}
else {
i.setAttribute('src',pilotFishGateway+'/Features/Search/Modules/EnrichWPS/Enrichments/MessageBoardInactive.gif');
l.style.color='#999999';
l.innerHTML='0 Messages';
}
}
function MessageBoard_getMessages_Event(xmlObject) {
var sd=document.getElementById('S_searchDisplay');
sd.className='S_RegularText';
sd.innerHTML='Leave a message about:
'+document.location.href+'';
sd.innerHTML+='Message subject
';
sd.innerHTML+='';
sd.innerHTML+='
';
sd.innerHTML+='';
document.getElementById('MessageBoard_text').focus();
var result=getXPath(xmlObject,"//messages");
var owner=Number(result[0].getAttribute("owner"));
result=getXPath(xmlObject,"//message");
if(result.length>0) {
sd.innerHTML+='Previous messages
';
for(var i=0;i'+title+' posted by '+username+', '+time+''+message;
if(owner==1) {
sd.innerHTML+='Remove message';
}
sd.innerHTML+='
';
}
}
}
function MessageBoard_removeMessage(messageId) {
var query=new Object();
query['feature']='Search';
query['module']='MessageBoard';
query['method']='removeMessage';
query['handler']='MessageBoard_removeMessage_Event';
query['messageId']=messageId;
query['resource']=encodeURIComponent(document.location.pathname);
callWebService(query);
}
function MessageBoard_removeMessage_Event(xmlObject) {
var result=getXPath(xmlObject,"//message");
var messageId=result[0].getAttribute("id");
var e=document.getElementById('MessageBoard_Message_'+messageId);
e.parentNode.removeChild(e);
e=document.getElementById('MessageBoard_Remove_'+messageId);
e.parentNode.removeChild(e);
MessageBoard_Enrichment_Init(xmlObject);
}
function MessageBoard_submitMessage() {
var subject=document.getElementById('MessageBoard_subject').value;
var text=document.getElementById('MessageBoard_text').value;
if(!subject) {
subject='No subject';
}
if(!text) {
alert("You can't submit an empty message");
}
else {
var query=new Object();
query['feature']='Search';
query['module']='MessageBoard';
query['method']='submitMessage';
query['handler']='MessageBoard_submitMessage_Event';
query['title']=subject;
query['message']=text;
query['resource']=encodeURIComponent(document.location.pathname);
callAjax(query);
}
}
function MessageBoard_submitMessage_Event(xmlObject) {
alert('Message submitted');
S_hideSearch();
MessageBoard_Enrichment_Init(xmlObject);
}S_searchDevicesObject['Odeo']=new Object();
S_searchDevicesObject['Odeo'].link=0;
S_searchDevicesObject['Odeo'].doExtras=0;
function Odeo_Event(xmlObject,returnElements) {
var buildHTML=0;
var sd=document.getElementById('S_searchDisplay');
sd.innerHTML='';
var result=getXPath(xmlObject,"//selectedText");
var selectedText=getTextNode(result[0]);
result=getXPath(xmlObject,"//totalRecords");
var totalRecords=getTextNode(result[0]);
result=getXPath(xmlObject,"//podcast");
for(var i=0;i
';
fElement.innerHTML+=tag+'';
if(audioImage) {
fElement.innerHTML+='
';
}
fElement.innerHTML+=''+plays+'
';
fElement.innerHTML+='Channel: '+channel+'
';
fElement.innerHTML+='Odeo URL: '+url+'
';
fElement.innerHTML+=''+description+'
';
podcastDiv.appendChild(fElement);
sd.appendChild(podcastDiv);
}
var thisObject=new Object();
thisObject.buildHTML=buildHTML;
thisObject.selectedText=selectedText;
thisObject.returnElements=returnElements;
thisObject.totalRecords=totalRecords;
return thisObject;
}
function OdeoResize(dw,dh) {
var sd=document.getElementById('S_searchDisplay');
var sx=sd.getElementsByTagName('div');
for(var i=0;i";
result=getXPath(rootNode,"//selectedText");
var selectedText=getTextNode(result[0]);
var thisObject=new Object();
thisObject.buildHTML=buildHTML;
thisObject.selectedText=selectedText;
thisObject.returnElements=returnElements;
return thisObject;
}S_searchDevicesObject['Technorati']=new Object();
S_searchDevicesObject['Technorati'].link=0;
S_searchDevicesObject['Technorati'].doExtras=0;
function Technorati_Event(rootNode,returnElements) {
var buildHTML='';
var result=getXPath(rootNode,"//totalRecords");
var totalRecords=getTextNode(result[0]);
result=getXPath(rootNode,"//selectedText");
var selectedText=getTextNode(result[0]);
result=getXPath(rootNode,"//item");
for(var i=0;i"+(++S_offsetUse)+") "+title+"
";
buildHTML+=""+permalink+"
";
buildHTML+=""+created+"
";
buildHTML+=""+excerpt+"";
buildHTML+=""+name+"";
buildHTML+='
';
}
var thisObject=new Object();
thisObject.buildHTML=buildHTML;
thisObject.selectedText=selectedText;
thisObject.returnElements=returnElements;
thisObject.totalRecords=totalRecords;
return thisObject;
}
var languageMap=new Object();
languageMap['Spanish']='en_es';
languageMap['French']='en_fr';
languageMap['German']='en_de';
languageMap['Italian']='en_it';
languageMap['Dutch']='en_nl';
languageMap['Portuguese']='en_pt';
languageMap['Sp. to Eng.']='es_en';
languageMap['Fr. to Eng.']='fr_en';
languageMap['Ger. to Eng.']='de_en';
S_searchDevicesObject['Translate']=new Object();
S_searchDevicesObject['Translate'].link=1;
S_searchDevicesObject['Translate'].fromLeft=25;
S_searchDevicesObject['Translate'].title='Translate to';
S_searchDevicesObject['Translate'].doExtras=1;
S_searchDevicesObject['Translate'].noDownArrowOnFocus=1;
S_searchDevicesObject['Translate'].extras=languageMap;
function Translate_Event(xmlObject,returnElements) {
var buildHTML='';
var result=getXPath(xmlObject,"//selectedText");
var selectedText=getTextNode(result[0]);
result=getXPath(xmlObject,"//translation");
for(var i=0;i"+getTextNode(result[i])+"";
buildHTML+='
';
}
var thisObject=new Object();
thisObject.buildHTML=buildHTML;
thisObject.selectedText=selectedText;
thisObject.returnElements=returnElements;
return thisObject;
}S_searchDevicesObject['Weather']=new Object();
S_searchDevicesObject['Weather'].link=0;
S_searchDevicesObject['Weather'].doExtras=0;
function Weather_Event(rootNode,returnElements,sd) {
var buildHTML='';
var selectedText='';
if(!sd) {
sd=document.getElementById('S_searchDisplay');
}
sd.innerHTML='';
var totalRecords=0;
var dayCount=0;
var count=0;
for(var i=0;iGet weather conditions and forecasts from:";
}
buildHTML+=''+location+'
';
}
else if(nodeName=='observation') {
var weatherObject=new Object();
for(var j=0;j";
fElement.innerHTML+="Current Local Time: "+weatherObject['time']+"
";
fElement.innerHTML+="Time of Report: "+weatherObject['lastUpdated']+"
";
fElement.innerHTML+="Current Conditions: "+weatherObject.weather+"
";
fElement.innerHTML+="Temperature: "+weatherObject.temperature+"
";
fElement.innerHTML+="Dew Point: "+weatherObject.dewPoint+"
";
fElement.innerHTML+="Wind: ";
if(Number(weatherObject.windSpeed)>0) {
fElement.innerHTML+=weatherObject.windSpeed+" mph";
if(Number(weatherObject.gust)>0) {
fElement.innerHTML+=" with gusts to "+weatherObject.gust+" mph";
}
fElement.innerHTML==" out of the "+weatherObject.windDir;
}
else {
fElement.innerHTML+="Calm";
}
fElement.innerHTML+="
";
fElement.innerHTML+="Pressure: "+weatherObject.bar;
if(weatherObject.barTendency) {
fElement.innerHTML+=" "+weatherObject.barTendency;
}
fElement.innerHTML+="
";
fElement.innerHTML+="Humidity: "+weatherObject.humidity+" \%
";
fElement.innerHTML+="Sunrise: "+weatherObject.sunrise+"
";
fElement.innerHTML+="Sunset: "+weatherObject.sunset+"
";
fElement.innerHTML+="Moon: "+weatherObject.moonPhase;
weatherDiv.appendChild(fElement);
sd.appendChild(weatherDiv);
}
else if(nodeName=='forecast') {
var weatherDiv=document.getElementById('S_weatherDiv');
var w=Math.floor((parseInt(weatherDiv.style.width) - 60) / 5);
var dayDiv=document.createElement('span');
dayDiv.style.borderColor='#000000';
dayDiv.style.borderStyle='solid';
dayDiv.style.borderWidth='1px';
dayDiv.style.backgroundColor='#FFFFFF';
dayDiv.style.position='absolute';
dayDiv.style.width=w+'px';
dayDiv.style.height='80px';
dayDiv.style.bottom='30px';
dayDiv.style.left=(10*(dayCount+1)) + (dayCount*w)+15+'px';
dayCount++;
var weatherObject=new Object();
for(var j=0;j

"+weatherObject.hi+" / "+weatherObject.low+"";
dayDiv.appendChild(fElement);
weatherDiv.appendChild(dayDiv);
}
else if(nodeName=='selectedText') {
selectedText=String(rootNode.childNodes[i].firstChild.nodeValue);
}
}
if(buildHTML!=0) {
buildHTML+="";
}
var thisObject=new Object();
thisObject.buildHTML=buildHTML;
thisObject.selectedText=selectedText;
thisObject.returnElements=returnElements;
return thisObject;
}
function WeatherResize(dw,dh) {
var sd=document.getElementById('S_searchDisplay');
var sx=sd.getElementsByTagName('div');
for(var i=0;i"+(++S_offsetUse)+") "+title+"
";
buildHTML+="Source: "+source+"
";
buildHTML+=""+url+"
";
buildHTML+=""+snippet+"";
buildHTML+='
';
}
var thisObject=new Object();
thisObject.buildHTML=buildHTML;
thisObject.selectedText=selectedText;
thisObject.returnElements=returnElements;
thisObject.totalRecords=totalRecords;
return thisObject;
}S_searchDevicesObject['Wikipedia']=new Object();
S_searchDevicesObject['Wikipedia'].link=0;
S_searchDevicesObject['Wikipedia'].doExtras=0;
function Wikipedia_Event(xmlObject,returnElements) {
var buildHTML='';
var relatedEntries=0;
var result=getXPath(xmlObject,"//selectedText");
var selectedText=getTextNode(result[0]);
result=getXPath(xmlObject,"//definition");
var definition=getTextNode(result[0]);
if(returnElements>1) {
buildHTML+=""+returnElements+" Related Entries for "+selectedText+"";
}
buildHTML+=""+definition+"";
result=getXPath(xmlObject,"//relatedEntry");
for(var i=0;iRelated Entries";
}
var relatedEntry=getTextNode(result[i]);
buildHTML+=""+relatedEntry+"
";
}
var thisObject=new Object();
thisObject.buildHTML=buildHTML;
thisObject.selectedText=selectedText;
thisObject.returnElements=returnElements;
return thisObject;
}var keywordsOptions=new Object();
keywordsOptions['Selection']='Selection';
keywordsOptions['Page']='Page';
var specialRetrieval=new Object();
specialRetrieval['Page']=function() {
if(Enrich==0) {
return S_retrieveTextContent();
}
else {
return document.location;
}
}
S_searchDevicesObject['YahooKeywords']=new Object();
S_searchDevicesObject['YahooKeywords'].link=1;
S_searchDevicesObject['YahooKeywords'].fromLeft=37;
S_searchDevicesObject['YahooKeywords'].doExtras=1;
S_searchDevicesObject['YahooKeywords'].noDownArrowOnFocus=1;
S_searchDevicesObject['YahooKeywords'].extras=keywordsOptions;
S_searchDevicesObject['YahooKeywords'].specialRetrieval=specialRetrieval;
function YahooKeywords_Event(xmlObject,returnElements) {
var buildHTML='';
var selectedText;
var keywords=new Array();
var relatedKeywords=new Array();
var sd=document.getElementById('S_searchDisplay');
sd.innerHTML='';
if(!xmlObject) {
buildHTML="No keyword matches";
}
else {
var result=getXPath(xmlObject,"//selectedText");
selectedText=getTextNode(result[0]);
var option=xmlObject.getAttribute('cachedExtra');
var typeOfSearch=xmlObject.getAttribute('typeOfSearch');
result=getXPath(xmlObject,"//keyword");
for(var i=0;i";
var alc="";
return al+sMatch+alc
});
}
buildHTML=""+selectedTextSub+"
";
}
if(relatedKeywords.length>0) {
buildHTML+="Other Related Keywords";
for(var i=0;i"+relatedKeywords[i]+"
";
}
}
if(option=='Page') {
S_retrieveTextContent(keywords,'',1);
S_displaySearch(buildHTML,document.getElementsByTagName('title').item(0).childNodes[0].nodeValue,0,returnElements,0,0,1);
S_minimizeOrMaximizeSearch();
return -1;
}
}
var thisObject=new Object();
thisObject.buildHTML=buildHTML;
thisObject.selectedText=selectedText;
thisObject.returnElements=returnElements;
return thisObject;
}
function YahooKeywords_Enrichment(filePath) {
var query=new Object();
query['feature']='Search';
query['module']='YahooKeywords';
query['handler']='YahooKeywords_Enrichment_Event';
query['filePath']=filePath;
callWebService(query);
}
function YahooKeywords_Enrichment_click() {
S_retrieveTextContent(EnrichWPS_keywordLinks['YahooKeywords'],'',1);
}
function YahooKeywords_Enrichment_Init() {
if(!module) {
module='Google';
}
if(EnrichWPS_keywordLinks['YahooKeywords'].length>0) {
var i=document.getElementById('EnrichmentIcon_YahooKeywords');
i.setAttribute('src',pilotFishGateway+'/Features/Search/Modules/EnrichWPS/Enrichments/YahooKeywordsActive.gif');
var l=document.getElementById('EnrichmentLabel_YahooKeywords');
l.style.color='#FF0000';
l.appendChild(document.createTextNode(EnrichWPS_keywordLinks['YahooKeywords'].length+' Terms!'));
}
}S_searchDevicesObject['YouTube']=new Object();
S_searchDevicesObject['YouTube'].link=0;
S_searchDevicesObject['YouTube'].doExtras=0;
function YouTube_Event(rootNode,returnElements) {
var buildHTML=0;
var selectedText='';
var sd=document.getElementById('S_searchDisplay');
sd.innerHTML='';
var videoCount=0;
var totalRecords=0;
var countRecords=0;
for(var i=0;i'+videoObject.title+'
';
if(videoObject.author) {
fElement.innerHTML+='Author: '+videoObject.author;
fElement.innerHTML+='
';
}
var thisDate=new Date(Number(videoObject['upload_time'])*1000);
fElement.innerHTML+='Uploaded: '+thisDate.toLocaleDateString()+' '+thisDate.toLocaleTimeString()+'
';
if(Number(videoObject['rating_count'])>0) {
fElement.innerHTML+='Average Rating: '+videoObject['rating_avg']+' for '+videoObject['rating_count']+' ratings
';
}
if(Number(videoObject['comment_count'])>0) {
fElement.innerHTML+='Comments: '+videoObject['comment_count']+'
';
}
if(Number(videoObject['view_count'])>0) {
fElement.innerHTML+='Views: '+videoObject['view_count']+'
';
}
fElement.innerHTML+='Length: '+videoObject['length_seconds']+' seconds
';
fElement.innerHTML+='Description: '+videoObject['description'];
videoDiv.appendChild(iElement);
videoDiv.appendChild(fElement);
sd.appendChild(videoDiv);
videoCount++;
}
else if(nodeName=='selectedText') {
selectedText=String(rootNode.childNodes[i].firstChild.nodeValue);
}
else if(nodeName=='totalRecords') {
totalRecords=rootNode.childNodes[i].childNodes[0].nodeValue;
}
}
var thisObject=new Object();
thisObject.buildHTML=buildHTML;
thisObject.selectedText=selectedText;
thisObject.returnElements=returnElements;
thisObject.totalRecords=totalRecords;
return thisObject;
}
function YouTubeResize(dw,dh) {
var sd=document.getElementById('S_searchDisplay');
var sx=sd.getElementsByTagName('div');
for(var i=0;i99999)) {
return "Invalid zip code";
}
else {
if(str!=getCookie("Zap2ItZipCode")) {
setCookie("Zap2ItHeadend","",new Date(Date.parse("Jan 1, 1970")));
}
}
}
var Zap2ItInitialize=function() {
var c=getCookie('Zap2ItZipCode');
if(c) {
var h=getCookie('Zap2ItHeadend');
if(h) {
var o=new Object();
o['zipCode']=c;
o['headendId']=h;
return o;
}
else {
var query=new Object();
query['feature']='Search';
query['module']='Zap2It';
query['method']='getHeadendList';
query['zipCode']=c;
query['handler']='Zap2It_getHeadendList_Event';
callWebService(query);
return -1;
}
}
}
function Zap2It_getHeadendList_Event(xmlObject) {
var result=getXPath(xmlObject,"//headends");
var option=result[0].getAttribute("option");
result=getXPath(xmlObject,"//headend");
if(result.length==1) {
setCookie("Zap2ItHeadend",result[0].getAttribute("id"),'','','.ucompass.com');
var d;
function delayThis() {
S_startSearch(S_cachedSearch,0,1);
clearInterval(d);
}
d=setInterval(delayThis,1000);
}
else {
var d=document.createElement('div');
d.setAttribute('id','Zap2It_div');
d.style.position='absolute';
d.className='S_RegularText';
d.style.width='300px';
d.style.padding='5px';
d.style.backgroundColor='#2677B6';
d.style.color='#FFFFFF';
d.style.zIndex=1000030;
d.style.borderColor='#FFFFFF';
d.style.borderStyle='solid';
d.style.borderWidth='1px';
var b=getBrowserObject();
d.style.left=(b.clientWidth/2) - 150 + 'px';
d.style.top=(b.clientHeight/2) - 50 + 'px';
var s=document.createElement('span');
s.innerHTML='Check your cable provider:';
for(var i=0;i '+result[i].getAttribute("name")+' ('+result[i].getAttribute("community")+')
';
}
d.appendChild(s);
document.body.appendChild(d);
}
}
function Zap2It_sendHeadend(headendId,option) {
setCookie("Zap2ItHeadend",headendId,'','','.ucompass.com');
var d;
function delayThis() {
S_startSearch(S_cachedSearch,0,1);
clearInterval(d);
}
d=setInterval(delayThis,1000);
var e=document.getElementById('Zap2It_div');
if(e) {
e.parentNode.removeChild(e);
}
}
S_searchDevicesObject['Zap2It']=new Object();
S_searchDevicesObject['Zap2It'].link=1;
S_searchDevicesObject['Zap2It'].title='Zip code';
S_searchDevicesObject['Zap2It'].fromLeft=85;
S_searchDevicesObject['Zap2It'].textInput='Zap2ItZipCode';
S_searchDevicesObject['Zap2It'].initialize=Zap2ItInitialize;
S_searchDevicesObject['Zap2It'].validate=Zap2ItValidate;
S_searchDevicesObject['Zap2It'].noDownArrowOnFocus=1;
function Zap2It_Event(myXML,returnElements) {
var method=myXML.getAttribute('method');
if(t[method+'_Event']) {
t[method+'_Event'](myXML);
return -1;
}
var buildHTML=0;
var sd=document.getElementById('S_searchDisplay');
sd.innerHTML='';
var result=getXPath(myXML,"//totalRecords");
var totalRecords=getTextNode(result[0]);
result=getXPath(myXML,"//selectedText");
selectedText=getTextNode(result[0]);
var programs=new Array();
result=getXPath(myXML,"//program");
for(var i=0;i=2400) {
mTime-=2400;
thisDate++;
dayDigit++;
var nMonth=thisMonth - 1;
if(thisDate>monthDays[nMonth]) {
thisMonth++;
thisDate=1;
if(thisMonth>12) {
thisMonth=1;
thisYear++;
}
}
}
if(dayDigit<0) {
dayDigit+=7;
}
else if(dayDigit>6) {
dayDigit-=7;
}
var day=dayNames[dayDigit];
thisMonth--;
var myMonth=monthNames[thisMonth];
programObject.airTime=mTime;
var myTime=mTime.toString();
var noon;
if(myTime.length==3) {
myTime='0'+myTime;
}
else if(myTime.length==1) {
myTime='0000';
}
var hour=Number(myTime.slice(0,2));
var minute=Number(myTime.slice(2,4));
if(hour<12) {
noon="AM";
}
if(hour==12) {
noon="PM";
}
else if(hour==0) {
hour=12;
}
else if(hour>12) {
hour-=12;
noon="PM";
}
if(minute<10) {
minute='0'+minute;
}
var runTime=programObject.duration.toString();
var timeRef='';
if(runTime.length==3) {
var hours=runTime.charAt(0);
var minutes=Number(runTime.slice(1,3));
var hourRef='hours';
if(hours==1) {
hourRef='hour';
}
timeRef=hours + ' '+hourRef;
if(minutes>0) {
timeRef+=', '+minutes+' minutes';
}
}
else {
timeRef=runTime +' minutes';
}
var fElement=document.createElement('span');
fElement.style.position='absolute';
fElement.style.left='5px';
fElement.style.top='5px';
fElement.innerHTML=''+programObject.title+''; if(programObject.year) { fElement.innerHTML+='('+programObject.year+')'; } fElement.innerHTML+='
';
if(programObject.subTitle) {
fElement.innerHTML+='\"'+programObject.subTitle+'\"
';
}
fElement.innerHTML+='Will play: '+day+' '+myMonth+' '+thisDate+', '+thisYear+' at '+hour+':'+minute+' '+noon+'';
if(S_Calendar==1) {
var eventString=programObject.title+' is on '+programObject.stationName+' (Channel '+programObject.channel+') '+day+' '+myMonth+' '+thisDate+', '+thisYear+' at '+hour+':'+minute+' '+noon;
fElement.innerHTML+=' Add this to my calendar';
}
fElement.innerHTML+='
';
fElement.innerHTML+='Duration: '+timeRef+'
';
fElement.innerHTML+='Station: '+programObject.stationName+' (Channel '+programObject.channel+')
';
if(programObject.description) {
fElement.innerHTML+='Description: '+programObject.description+'
';
}
if(programObject.genre) {
fElement.innerHTML+='Genre: '+programObject.genre+'
';
}
if(programObject.advisories) {
fElement.innerHTML+='Advisories: '+programObject.advisories+'
';
}
if(programObject.credits) {
var credits=programObject.credits.toString();
var sArray=credits.split(" (");
var firstName=sArray[0];
var re=new RegExp(firstName,"gi");
var rep=""+firstName+"";
credits=credits.replace(re,rep);
for(var j=0;j"+nn+"";
credits=credits.replace(re,rep);
}
}
}
fElement.innerHTML+='Credits: '+credits+'';
}
programDiv.appendChild(fElement);
sd.appendChild(programDiv);
programCount++;
}
var thisObject=new Object();
thisObject.buildHTML=buildHTML;
thisObject.selectedText=selectedText;
thisObject.returnElements=returnElements;
thisObject.totalRecords=totalRecords;
return thisObject;
}
function Zap2It_IMDB(title,thisClass) {
S_cachedSearch=title;
S_changeExtra(thisClass,'IMDB');
}
function Zap2It_OpenCredits(progId) {
var e=document.getElementById('credits'+progId);
if(e.style.visibility=='visible') {
e.style.visibility='hidden';
}
else {
e.style.visibility='visible';
}
}
function Zap2ItResize(dw,dh) {
var sd=document.getElementById('S_searchDisplay');
var sx=sd.getElementsByTagName('div');
for(var i=0;i