if(!Array.prototype.indexOf){Array.prototype.indexOf=function(c,a){a||(a=0);var b=this.length;if(a<0){a=b+a;}for(;a<b;a++){if(this[a]===c){return a;}}return -1;};}if(!Array.prototype.indexOfMatch){Array.prototype.indexOfMatch=function(c,a){a||(a=0);var b=this.length;if(a<0){a=b+a;}for(;a<b;a++){if(new RegExp(this[a]).test(c)){return a;}}return -1;};}if(!Array.prototype.unique){Array.prototype.unique=function(){var c=[];var b=this.length;for(var e=0;e<b;e++){for(var d=e+1;d<b;d++){if(this[e]===this[d]){d=++e;}}c.push(this[e]);}return c;};}if(!String.prototype.startsWith){String.prototype.startsWith=function(a){return this.indexOf(a)===0;};}if(!String.prototype.endsWith){String.prototype.endsWith=function(a){var b=this.length-a.length;return b>=0&&this.lastIndexOf(a)===b;};}if(!String.prototype.trim){String.prototype.trim=function(){return this.replace(/^\s+/,"").replace(/\s+$/,"");};}if(!String.prototype.removeLastCharacter){String.prototype.removeLastCharacter=function(a){if(this.endsWith(a)){return this.substring(0,this.length-1);}else{return this;}};}function boldDomain(c,b){var a=b.substring(0,b.indexOf(c));a+="<b>";a+=c;a+="</b>";a+=b.substring(b.indexOf(c)+c.length);return a;}function imgErrorDisplayNone(a){log.warn(a.src+"needs to be hidden because broken");a.onerror="";a.style.display="none";return true;}function imgError(a,c){var b=a.src;a.src="images/icons/brokenPicture.png";a.onerror="";a.title="url ["+b+"] for this picture is broken";if(c){a.width=c;}log.warn("img src changed because original url ["+b+"] was broken");return true;}function imgLoad(c,h,g,b){log.info("imgLoad: Element type ["+c+"] imgLoad "+h+"  "+g+"   "+b);var f=parseInt(c.height,10);var e=parseInt(c.width,10);var d=jQuery(c).data("oryginalHeight");var a=jQuery(c).data("oryginalWidth");if(!d||!a){jQuery(c).data("oryginalHeight",f);jQuery(c).data("oryginalWidth",e);d=f;ow=e;}if(!h){h="width";}if(!g){g=600;}if(h==="width"&&(e>g||b)){c.width=g;c.height=Math.floor(f*g/e);log.warn("Change img width. Saved oryginal values using jQuery data");}else{if(h==="height"&&(f>g||b)){c.height=g;c.width=Math.floor(e*g/f);log.warn("Change img height. Save oryginal values using jQuery data");}else{if(h==="oryginal"){if(d&&a){c.height=d;c.width=a;}else{c.src=c.src+"?rand="+randomString();}log.warn("Restore img dim to oryginal "+a+"x"+d);}}}return true;}function randomString(){var d="ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";var e=16;var c="";for(var b=e-1;b>=0;b--){var a=Math.floor(Math.random()*d.length);c+=d.charAt(a);}return c;}function getCurrentTime(){return new Date().getTime();}function getURLParams(d){var a=[];var b=window.location.href.indexOf("?");if(b===-1){return null;}var f=window.location.href.substr(b+1);if(f.indexOf("#")>-1){f=f.substr(0,f.indexOf("#"));}var h=f.split("&");for(var c=0;c<h.length;c++){var g=h[c];var b=g.indexOf("=");if(b===-1||d!=g.substr(0,b)){continue;}var e=h[c].substr(b+1);a.push(decodeURIComponent(e.replace(/\+/g," ")));}return a;}function getURLParam(a){var b=getURLParams(a);if(b.length===0){return null;}return b[0];}function SigmaUtilities(){this.cache={};this.expando="SigmaUtilities"+this.now();this.uuid=0;this.windowData={};var a=this;this.queueForSlowBrowser={_timer:null,_queue:[],add:function(e,c,f){var b=function(g){a.queueForSlowBrowser._timer=setTimeout(function(){g=a.queueForSlowBrowser.add();if(a.queueForSlowBrowser._queue.length){b(g);}},g||10);};if(e){a.queueForSlowBrowser._queue.push([e,c,f]);if(a.queueForSlowBrowser._queue.length==1){b(f);}return;}var d=a.queueForSlowBrowser._queue.shift();if(!d){return 0;}d[0].call(d[1]||window);return d[2];},clear:function(){clearTimeout(a.queueForSlowBrowser._timer);a.queueForSlowBrowser._queue=[];}};}SigmaUtilities.prototype.now=function(){return +new Date();};SigmaUtilities.prototype.each=function(c,g,b){var a,d=0,e=c.length;if(b){if(e===undefined){for(a in c){if(g.apply(c[a],b)===false){break;}}}else{for(;d<e;){if(g.apply(c[d++],b)===false){break;}}}}else{if(e===undefined){for(a in c){if(g.call(c[a],a,c[a])===false){break;}}}else{for(var f=c[0];d<e&&g.call(f,d,f)!==false;f=c[++d]){}}}return c;};SigmaUtilities.prototype.isFunction=function(a){return Object.prototype.toString.call(a)==="[object Function]";};SigmaUtilities.prototype.makeArray=function(c){var a=[];if(c!==null){var b=c.length;if(b===null||typeof c==="string"||this.isFunction(c)||c.setInterval){a[0]=c;}else{while(b){a[--b]=c[b];}}}return a;};SigmaUtilities.prototype.map=function(a,f){var b=[];for(var c=0,d=a.length;c<d;c++){var e=f(a[c],c);if(e!==null){b[b.length]=e;}}return b.concat.apply([],b);};SigmaUtilities.prototype.data=function(b,a,c){b=b==window?this.windowData:b;var d=b[this.expando];if(!d){d=b[this.expando]=++this.uuid;}if(a&&!this.cache[d]){this.cache[d]={};}if(c!==undefined){this.cache[d][a]=c;}return a?this.cache[d][a]:d;};SigmaUtilities.prototype.extend=function(){var f=arguments[0]||{},d=1,e=arguments.length,a=false,c;if(typeof f==="boolean"){a=f;f=arguments[1]||{};d=2;}if(typeof f!=="object"&&!this.isFunction(f)){f={};}if(e==d){f=this;--d;}for(;d<e;d++){if((c=arguments[d])!==null){for(var b in c){var g=f[b],h=c[b];if(f===h){continue;}if(a&&h&&typeof h==="object"&&!h.nodeType){f[b]=this.extend(a,g||(h.length!==null?[]:{}),h);}else{if(h!==undefined){f[b]=h;}}}}}return f;};SigmaUtilities.prototype.inArray=function(c,d){for(var a=0,b=d.length;a<b;a++){if(d[a]===c){return a;}}return -1;};SigmaUtilities.prototype.map=function(a,f){var b=[];for(var c=0,d=a.length;c<d;c++){var e=f(a[c],c);if(e!==null){b[b.length]=e;}}return b.concat.apply([],b);};SigmaUtilities.prototype.grep=function(b,f,a){var c=[];for(var d=0,e=b.length;d<e;d++){if(!a!=!f(b[d],d)){c.push(b[d]);}}return c;};function toIntegersAtLease(a){return a<10?"0"+a:a;}Date.prototype.toJSON=function(a){return this.getUTCFullYear()+"-"+toIntegersAtLease(this.getUTCMonth())+"-"+toIntegersAtLease(this.getUTCDate());};SigmaUtilities.prototype.quoteString=function(b){var a=/["\\\x00-\x1f\x7f-\x9f]/g;var c={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};if(a.test(b)){return'"'+b.replace(a,function(d){var e=c[d];if(typeof e==="string"){return e;}e=d.charCodeAt();return"\\u00"+Math.floor(e/16).toString(16)+(e%16).toString(16);})+'"';}return'"'+b+'"';};SigmaUtilities.prototype.toJSON=function(h,f){var e=typeof(h);if(e=="undefined"){return"undefined";}else{if(e=="number"||e=="boolean"){return h+"";}else{if(h===null){return"null";}}}if(e=="string"){return this.quoteString(h);}if(e=="object"&&typeof h.toJSON=="function"){return h.toJSON(f);}if(e!="function"&&typeof(h.length)=="number"){var c=[];for(var d=0;d<h.length;d++){c.push(this.toJSON(h[d],f));}if(f){return"["+c.join(",")+"]";}else{return"["+c.join(", ")+"]";}}if(e=="function"){throw new TypeError("Unable to convert object of type 'function' to json.");}var c=[];for(var a in h){var b;e=typeof(a);if(e=="number"){b='"'+a+'"';}else{if(e=="string"){b=this.quoteString(a);}else{continue;}}var g=this.toJSON(h[a],f);if(typeof(g)!="string"){continue;}if(f){c.push(b+":"+g);}else{c.push(b+": "+g);}}return"{"+c.join(", ")+"}";};SigmaUtilities.prototype.compactJSON=function(a){return this.toJSON(a,true);};SigmaUtilities.prototype.randomString=function(){return randomString();};SigmaUtilities.prototype.isScrollBarExist=function(b,a){Object=document.getElementById(b);switch(a){case"x":Object.scrollLeft=1;if(Object.scrollLeft>0){Object.scrollLeft=0;return true;}else{return false;}break;case"y":Object.scrollTop=1;if(Object.scrollTop>0){Object.scrollTop=0;return true;}else{return false;}break;case"xy":Object.scrollTop=1;Object.scrollLeft=1;if(Object.scrollTop>0&&Object.scrollLeft>0){Object.scrollTop=0;Object.scrollLeft=0;return true;}else{return false;}break;default:Object.scrollTop=1;Object.scrollLeft=1;if(Object.scrollTop>0||Object.scrollLeft>0){Object.scrollTop=0;Object.scrollLeft=0;return true;}else{return false;}break;}};SigmaUtilities.prototype.popUpXHtml=function(h,g,b,k,l){if(!l){l="";}var c=(screen.width-b)/2;var f=(screen.height-k)/2;var d='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';d+='<html xmlns="http://www.w3.org/1999/xhtml">';d+="<head>";d+="<title>"+g+"</title>";d+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';d+=l;d+="</head><body>";d+='<div class="sigma-widget-preview-box">';d+=h;d+="</div>";d+="</body></html>";var e=Math.floor(Math.random()*1001);var a=window.open("","name"+e,"width="+b+",height="+k+",top="+f+",left="+c+"scrollbars=0,resizable=1,location=0,menubar=0,toolbar=0");a.document.open();a.document.write(d);a.document.close();return a;};SigmaUtilities.prototype.isEmpty=function(a){for(var b in a){return false;}return true;};SigmaUtilities.prototype.getBaseUrl=function(){var c=window.location.protocol;var a=window.location.host;var b=window.location.pathname;if(b.startsWith("/sigma")){return c+"//"+a+"/sigma";}return c+"//"+a;};SigmaUtilities.prototype.echeck=function(g){var a="@";var b=".";var e=g.indexOf(a);var c=g.length;var d=g.indexOf(b);var f="Not valid email ["+g+"]. Please fix it and try again";if(g.indexOf(a)==-1){alert(f);return false;}if(g.indexOf(a)==-1||g.indexOf(a)==0||g.indexOf(a)==c){alert(f);return false;}if(g.indexOf(b)==-1||g.indexOf(b)==0||g.indexOf(b)==c){alert(f);return false;}if(g.indexOf(a,(e+1))!=-1){alert(f);return false;}if(g.substring(e-1,e)==b||g.substring(e+1,e+2)==b){alert(f);return false;}if(g.indexOf(b,(e+2))==-1){alert(f);return false;}if(g.indexOf(" ")!=-1){alert(f);return false;}return true;};var sigmaUtilities=new SigmaUtilities();function isChrome(){var a=/chrome/;return a.test(navigator.userAgent.toLowerCase());}function isOpera(){var a=/opera/;return a.test(navigator.userAgent.toLowerCase());}function isSafari(){var b=/webkit/;var a=b.test(navigator.userAgent.toLowerCase());b=/chrome/;var c=b.test(navigator.userAgent.toLowerCase());return a&&!c;}function isIE8(){var d=navigator.userAgent.toLowerCase();var a=""+(d.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1];var c=/msie/;var b=/opera/;return c.test(d)&&!b.test(d)&&a=="8.0";}function isIE7(){var d=navigator.userAgent.toLowerCase();var a=""+(d.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1];var c=/msie/;var b=/opera/;return c.test(d)&&!b.test(d)&&a=="7.0";}function isIE(){return isIE7||isIE8();}function Map(a){this.current=undefined;this.size=0;if(a===false){this.disableLinking();}}Map.noop=function(){return this;};Map.illegal=function(){throw new Error("illegal operation for maps without linking");};Map.from=function(c,a){var b=new Map();for(var d in c){if(a||c.hasOwnProperty(d)){b.put(d,c[d]);}}return b;};Map.prototype.disableLinking=function(){this.link=Map.noop;this.unlink=Map.noop;this.disableLinking=Map.noop;this.next=Map.illegal;this.key=Map.illegal;this.value=Map.illegal;this.removeAll=Map.illegal;return this;};Map.prototype.hash=function(a){return(typeof a)+" "+(a instanceof Object?(a.__hash||(a.__hash=++arguments.callee.current)):a.toString());};Map.prototype.hash.current=0;Map.prototype.get=function(a){var b=this[this.hash(a)];return b===undefined?undefined:b.value;};Map.prototype.set=function(a,c){var d=this.hash(a);if(this[d]===undefined){var b={key:a,value:c};this[d]=b;this.link(b);++this.size;}else{this[d].value=c;}return this;};Map.prototype.remove=function(a){var c=this.hash(a);var b=this[c];if(b!==undefined){--this.size;this.unlink(b);delete this[c];}return this;};Map.prototype.removeAll=function(){while(this.size){this.remove(this.key());}return this;};Map.prototype.link=function(a){if(this.size===0){a.prev=a;a.next=a;this.current=a;}else{a.prev=this.current.prev;a.prev.next=a;a.next=this.current;this.current.prev=a;}};Map.prototype.unlink=function(a){if(this.size===0){this.current=undefined;}else{a.prev.next=a.next;a.next.prev=a.prev;if(a===this.current){this.current=a.next;}}};Map.prototype.next=function(){this.current=this.current.next;};Map.prototype.key=function(){return this.current.key;};Map.prototype.value=function(){return this.current.value;};function ActionTracker(){this.servletUrl="track";}ActionTracker.prototype.record=function(a){var b=this;jQuery.ajax({url:b.servletUrl,data:a,success:function(){log.debug("success when recording user action");log.debug(a);},error:function(){log.warn("error when recording user action");log.warn(a);}});};var actionTracker=new ActionTracker();function Observable(){}Observable.prototype.addObserver=function(a){if(!this.observers){this.observers=[];}this.observers.push(a);};Observable.prototype.notifyObservers=function(b){if(!this.observers){return;}var d=[];var c;for(c=1;c<arguments.length;c++){d.push(arguments[c]);}for(c=0;c<this.observers.length;c++){var a=this.observers[c];if(!a[b]){continue;}a[b].apply(a,d);}};var servicesJava;function Services(a,b){if(!a){this.serverSide=false;if(this.debug){this.sigmaBaseURI="http://localhost:8080/";}else{if(window.location.hostname=="localhost"||window.location.hostname=="apps.sindice.net"||window.location.hostname=="test.sindice.net"||window.location.hostname=="sigma.sindice.net"){this.sigmaBaseURI="";}else{this.sigmaBaseURI="http://sig.ma/";}}}else{this.serverSide=a;this.sigmaBaseURI="http://localhost:8080/";}if(!b){this.debug=false;}else{this.debug=b;}this.pendingRequests=0;this.jsonpTimeout=2*1000;this.consecutiveFailureCounts={sindice:0,sigma:0,okkam:0,yboss:0,alternativeIds:0};this.dieAfterConsecutiveFailures={sindice:1,sigma:10,okkam:-1,yboss:-1,alternativeIds:1};this.dead=false;this.errorMessages={sindice:"The Sindice service used by Sig.ma is currently unavailable. Please check back later.",sigma:"The Sig.ma server is temporarily unavailable. Please check back later.",okkam:"The OKKAM service used by Sig.ma is currently unavailable. Please check back later.",yboss:"The Sig.ma server is temporarily unavailable. Please check back later.",alternativeIds:"The OKKAM alternativeId service is down. Please check back later."};if(this.serverSide){Packages.ma.sig.rhino.RhinoServices;servicesJava=new Packages.ma.sig.rhino.RhinoServices();log.info(servicesJava.test());var c={jsonp:function(){},ajax:function(){}};}else{}}Services.prototype=new Observable();Services.prototype.setSigmaBaseURI=function(a){this.sigmaBaseURI=a;log.info("sigmaBaseURI set to  ["+this.baseURI+"]");};Services.prototype.registerServiceFailure=function(a){this.notifyObservers("ajaxError",a);this.consecutiveFailureCounts[a]++;if(this.dead){return;}if(this.consecutiveFailureCounts[a]<this.dieAfterConsecutiveFailures[a]){return;}if(this.dieAfterConsecutiveFailures[a]==-1){return;}if(this.errorMessages[a]){var b=this.errorMessages[a]+" (Services.registerServiceFailure)";}else{var b="Service error: "+a+" (Services.registerServiceFailure)";}this.notifyObservers("serviceNotAvailable",a,b);this.dead=true;};Services.prototype.registerServiceSuccess=function(a){this.consecutiveFailureCounts[a]=0;};Services.prototype.requestFinished=function(){this.pendingRequests--;if(this.serverSide){log.server("requestFinished with pendingRequests="+this.pendingRequests);}if(this.pendingRequests==0&&!this.dead){this.notifyObservers("allFinished");}};Services.prototype.doRequest=function(c,a,d,f,e){if(this.dead){log.debug("Services.service"+d+" aborted because application has been flagged as dead");f(null);return;}var b=this;e.success=function(g){log.debug("Services.service"+d+" successful, JSON response:");if(e.resultFilter){g=e.resultFilter(g);}log.debug(g);b.registerServiceSuccess(a);f(g);b.requestFinished();};e.error=function(){log.warn("Services.service"+d+" failed!");b.registerServiceFailure(a);f(null);b.requestFinished();};this.pendingRequests++;if(c=="jsonp"){if(e.url.indexOf("?")!=-1){e.url+="&callback=?";}else{e.url+="?callback=?";}if(e.timeout===undefined){e.timeout=this.jsonpTimeout;}if(a==="sindice"){e.timeout=20*1000;}log.debug("Services.service"+d+" invoked, data:");log.debug(e.data);log.debug(e.url);log.debug(e.timeout);if(this.serverSide){this.executeServerSide(e,a,d);}else{jQuery.jsonp(e);}}else{if(c=="ajax"){log.debug("Services.service"+d+" invoked, data:");log.debug(e.data);log.debug(e.url);log.debug(e.timeout);if(this.serverSide){this.executeServerSide(e,a,d);}else{jQuery.ajax(e);}}else{alert("Unknown request type in Services.prototype.doRequest: "+c);}}};Services.prototype.executeServerSide=function(options,service,operation){var url=options.url;if(operation=="LabelRequest"){var data={uris:options.data};}else{var data=options.data;}var type=options.type;if(!type){log.server("no type specified for service ["+service+"]["+operation+"]");type="get";}var queryString="";if(options.url.indexOf("?")===-1){queryString+="?";}for(var name in data){if(!data.hasOwnProperty(name)){continue;}var value=data[name];queryString=queryString+"&"+name+"="+encodeURIComponent(value);}log.server("REQUESTING servicesJava: with url["+url+"]["+queryString+"]");var ret=servicesJava.sendHttpRequest("get",url,queryString);log.server("RETURN FROM servicesJava: ["+ret+"]");if(ret==""||ret==null||ret==undefined){ret="[]";}log.server("RETURN FROM servicesJava: ["+ret+"]");var json=eval("("+ret+")");if(json.error){options.error();}else{options.success(json);}};Services.prototype.addToData=function(b,c){for(var a in c){if(!c.hasOwnProperty(a)){return;}if(c[a]!==undefined){b[a]=c[a];}}return b;};Services.prototype.serviceSindiceRequest=function(d,c,a,e){var b={page:c,count:a,format:"json"};b=this.addToData(b,d);this.doRequest("jsonp","sindice","SindiceRequest",e,{url:"http://api.sindice.com/v2/search",data:b,resultFilter:function(g){var h=[];for(var f=0;f<g.entries.length;f++){h.push(g.entries[f].link);}return h;}});};Services.prototype.serviceSindiceKeywordRequest=function(c,b,a,d){this.serviceSindiceRequest({q:c,qt:"term"},b,a,d);};Services.prototype.serviceSindiceKeywordRequestSourcesPingedAtDay=function(d,a,c,b,e){this.serviceSindiceRequest({q:d+" timestamp:"+a+"*",qt:"term"},c,b,e);};Services.prototype.serviceSindiceRequestLabelOnly=function(a,d,b,f){var e=a.replace(/"/g,"");var c='* <http://www.w3.org/2000/01/rdf-schema#label> "'+e+'"';this.serviceSindiceAdvancedRequest(c,d,b,f);};Services.prototype.serviceSindiceAdvancedRequest=function(c,b,a,d){this.serviceSindiceRequest({q:c,qt:"advanced"},b,a,d);};Services.prototype.serviceYBOSSRequest=function(c,b,a,d){if(!b){b=0;}if(!a){a=10;}this.doRequest("ajax","yboss","YBOSSRequest",d,{url:this.sigmaBaseURI+"yboss",data:{q:c,start:b,count:a},dataType:"json",resultFilter:function(f){var g=[];for(var e=0;e<f.length;e++){if(!f[e].metadata){continue;}g.push(f[e].url);}return g;}});};Services.prototype.serviceOKKAMAlternativeIdsRequest=function(c,b,a,d){if(!b){b=0;}if(!a){a=10;}this.doRequest("jsonp","alternativeIds","alternativeIds",d,{url:this.sigmaBaseURI+"alternativeIds",data:{uri:c,start:b,count:a},dataType:"json",resultFilter:function(e){if(e.urls&&e.status=="ok"){return e.urls;}else{return[];}}});};Services.prototype.serviceOKKAMRequest=function(a,b){this.doRequest("jsonp","okkam","OKKAMRequest",b,{url:"http://api.sindice.com/okkamS2R/search",dataType:"json",data:{q:a,format:"json"},resultFilter:function(c){if(!c[a]){return null;}if(!c[a][0]){return null;}return c[a][0].id;}});};Services.prototype.serviceOKKAMSameAsRequest=function(a,b){this.doRequest("jsonp","okkam","OKKAMSameAsRequest",b,{url:"http://api.sindice.com/okkamS2R/sameas",dataType:"json",data:{url:a,format:"json"},resultFilter:function(c){return c;}});};Services.prototype.serviceSourceRequestLimited=function(a,b,c){b.limit=10;this.serviceSourceRequest(a,b,c);};Services.prototype.servicePropertyValuesRequest=function(a,b,c,d){c.property=b;this.serviceSourceRequest(a,c,d);};Services.prototype.serviceSourceRequest=function(a,c,d){var b={source:a};b=this.addToData(b,c);this.doRequest("ajax","sigma","SourceRequest",d,{url:this.sigmaBaseURI+"source",data:b,dataType:"json"});};Services.prototype.serviceCreatePermalink=function(b,a){this.doRequest("ajax","sigma","CreatePermalink",a,{url:this.sigmaBaseURI+"create-permalink",type:"POST",contentType:"application/json",data:sigmaUtilities.compactJSON(b),dataType:"json",resultFilter:function(c){return c.id;}});};Services.prototype.signupToNotification=function(b,a){this.doRequest("ajax","sigma","SignupForNotifications",a,{url:this.sigmaBaseURI+"notifications",type:"POST",contentType:"application/json",data:sigmaUtilities.compactJSON(b),dataType:"json"});};Services.prototype.serviceConfigRequest=function(b,a){this.doRequest("jsonp","sindice","ConfigRequest",a,{url:this.sigmaBaseURI+"recipe",data:{id:b}});};Services.prototype.serviceLabelRequest=function(a,b){this.doRequest("ajax","sigma","LabelRequest",b,{url:this.sigmaBaseURI+"label",type:"POST",contentType:"application/json",data:sigmaUtilities.compactJSON(a),dataType:"json"});};function LabelFetcher(){this.queue=[];this.fetching=0;this.flushing=false;this.batchSize=10;this.parallelRequests=5;}LabelFetcher.prototype.requestLabel=function(a,b){if(!/http:/.test(a)){b(null);return;}log.info("Queueing label request for: "+a);this.queue.push({uri:a,callback:b});this.processQueue();};LabelFetcher.prototype.flush=function(){log.info("Flushing label queue ("+this.queue.length+" items)");this.flushing=true;this.processQueue();};LabelFetcher.prototype.processQueue=function(){if(this.fetching>=this.parallelRequests){return;}if(this.queue.length>=this.batchSize){this.sendBatchRequest(this.batchSize);}else{if(this.flushing){if(this.queue.length>0){this.sendBatchRequest(this.queue.length);}this.flushing=false;}}};LabelFetcher.prototype.sendBatchRequest=function(e){log.info("Batch label request for "+this.queue.length+" labels");var f=[];var d=[];for(var a=0;a<e;a++){var c=this.queue.shift();f.push(c.uri);d.push(c);}this.fetching+=1;var b=this;services.serviceLabelRequest(f,function(g){b.processBatchResult(g,d);});};LabelFetcher.prototype.processBatchResult=function(b,d){this.fetching-=1;if(!b){b={error:"batch request failed"};}for(var a=0;a<d.length;a++){var c=d[a].uri;var e=d[a].callback;if(b.error){log.debug("processing label for "+c+": general error: "+b.error);e({error:b.error});}else{if(!b[c]){log.debug("processing label for "+c+": no result for this URI");e({error:"No result"});}else{log.debug("processing label for "+c+": got a response");e(b[c]);}}}this.processQueue();};function ValueModel(b,a){this.property=b;this.label=a.label;this.value=a.value;if(a.uris){this.uris=a.uris;}else{this.uris=[];}if(a.uri){this.uris.push(a.uri);}this.tokens=a.tokens;this.error=null;this.sources=[];if(a.sources){this.sourcesNumbers=a.sources;}else{this.sourcesNumbers=[];}this.highlighted=false;this.rejected=false;this.confirmed=false;this.hidden=false;this.hiddenByDisplayMode=false;this.active=null;this.activeSourceCount=0;if(this.property.entity.alwaysRequestLabels){this.requestLabel();}this.elementID=randomString();}ValueModel.prototype=new Observable();ValueModel.prototype.getWebLink=function(){if(this.uris.length===0){return null;}if(this.uris.length===1){return this.uris[0];}var d={};var b=0;var a=null;for(var c=0;c<this.uris.length;c++){var e=this.uris[c];if(!d[e]){d[e]=0;}d[e]++;if(d[e]>b){b=d[e];a=e;}}return a;};ValueModel.prototype.getSigmaLink=function(){if(this.value&&(!this.uris||this.uris.length===0)){return null;}var b=[];if(this.label){b.push("q="+encodeURIComponent(this.label.replace(/[:,.]/g," ")));}for(var a=0;a<this.uris.length;a++){b.push("id="+encodeURIComponent(this.uris[a]));}if(b.length===0){return null;}return"search?"+b.join("&");};ValueModel.prototype.setAsSingleValue=function(){this.property.setSingleValue(this);};ValueModel.prototype.addSource=function(a){if(this.sources.indexOf(a)!=-1){return;}this.sources.push(a);this.sourcesNumbers.push(a.getIndex());this.updateActiveSourceCount();};ValueModel.prototype.requestLabel=function(){if(this.label){return false;}if(this.uris.length===0){return false;}this.notifyObservers("loading",true);var a=this;this.property.entity.labelFetcher.requestLabel(this.uris[0],function(b){log.debug(b);a.notifyObservers("loading",false);if(b&&b.error){log.warn("label request returned error: "+b.error);a.error="Failed to fetch label: "+b.error;a.notifyObservers("labelUpdateError",a.error);}else{if(b&&b.label&&b.label_tokens){log.info("label request successful");a.label=b.label;a.tokens=b.label_tokens;a.notifyObservers("labelUpdated",a.label);if(a.property.attemptConsolidation(a)){return;}}else{a.notifyObservers("labelUpdateError","No label");}}});};ValueModel.prototype.isMatchingValue=function(b){var c=false;for(var a=0;a<this.uris.length;a++){if(b.uris.indexOf(this.uris[a])>=0){c=true;break;}}if(c){return true;}if(this.value&&b.value&&this.value==b.value){return true;}if(this.label&&b.label&&this.label==b.label){return true;}if((this.label&&b.value&&this.label==b.value)||(this.value&&b.label&&this.value==b.label)){return true;}if(this.tokens&&b.tokens&&this.tokens==b.tokens){return true;}if(this.uris.length===0&&!this.value&&!this.label&&b.uris.length===0&&!b.value&&!b.label){return true;}return false;};ValueModel.prototype.merge=function(b,a){this.uris=this.uris.concat(b.uris).unique();if(!this.value&&b.value){this.value=b.value;}if(!this.label&&b.label){this.label=b.label;}if(!this.tokens&&b.tokens){this.tokens=b.tokens;}if(!this.hidden&&b.hidden){this.hide();}this.sources=this.sources.concat(b.sources).unique();this.sourcesNumbers=this.sourcesNumbers.concat(b.sourcesNumbers).unique();if(!a){this.notifyObservers("merged");this.updateHighlightState();this.updateActivityState();this.updateActiveSourceCount();this.notifyObservers("numberOfSourcesChanged",this.sources.length,"from merge");}};ValueModel.prototype.updateHighlightState=function(){var d=false;var c=this.sources;var a=this.sources.length;for(var b=a-1;b>=0;b--){d|=c[b].highlighted;}if(d!=this.highlighted){this.highlighted=d;this.notifyObservers("highlightChanged",this.highlighted);}};ValueModel.prototype.changeHighlightState=function(a){this.notifyObservers("highlightChanged",a);};ValueModel.prototype.updateActivityState=function(){var g=this.active;var n=this.rejected;var k=this.confirmed;var h=false;var b=true;var a=false;var d=false;var l=this.sources;var c=this.sources.length;var f=0;for(f=c-1;f>=0;f--){h=h||l[f].isActive();b=b&&l[f].rejected;a=a||l[f].confirmed;d=d||l[f].solo;}var e=this.property.entity.isInSoloMode();log.info("updateActivityState: \n prop: "+this.property.name+"\n newActivityState: "+h+"\n hidden: "+this.hidden+"\n hiddenByDisplayMode: "+this.hiddenByDisplayMode+"\n this.property.hidden: "+this.property.hidden+"\n soloState: "+d+"\n inSoloMode: "+e+"");h=h&&!this.hidden&&!this.property.hidden&&(!e||d);log.info("updateActivityState: "+h);log.info("this.property.inSingleMode: "+this.property.inSingleMode);if(this.property.inSingleMode===true){var m=false;if(this.property.inSingleMode&&this.property.singleModeValue==this){m=true;}log.info("isSingleValue: "+m);h=h&&m;}this.active=h;this.rejected=b;this.confirmed=a;if(h!==g){this.notifyObservers("activityChanged",this.active);}if(this.hiddenByDisplayMode===true){this.notifyObservers("activityChanged",false);}if(b!=n){this.notifyObservers("rejected",this.rejected);}if(a!=k){this.notifyObservers("confirmed",this.confirmed);}this.updateActiveSourceCount();this.notifyObservers("numberOfSourcesChanged");};ValueModel.prototype.updateActiveSourceCount=function(){var d=0;var b=0;var c=this.sources;var a=this.sources.length;for(d=a-1;d>=0;d--){if(!c[d].rejected){b++;}}if(b!=this.activeSourceCount){this.activeSourceCount=b;this.property.sourceCountChanged(this,b);}};ValueModel.prototype.toString=function(){var a="";if(this.value){a+='"'+this.value+'"';}else{if(this.uris.length>0){a+="<"+this.uris.join("><")+">";}else{a+="[]";}}if(this.label){a+='(label:"'+this.label+'")';}return a;};ValueModel.prototype.hide=function(){this.hidden=true;this.notifyObservers("hidden",true);this.updateActivityState();this.property.updateActivityState(false);};ValueModel.prototype.show=function(){this.hidden=false;this.notifyObservers("hidden",false);};ValueModel.prototype.toJSON=function(){var a={};if(this.value){a.value=this.value;}if(this.tokens){a.tokens=this.tokens;}if(this.label){a.label=this.label;}if(this.error){a.error=this.error;}if(this.uris){a.uris=this.uris;}if(this.sourcesNumbers){a.sources=this.sourcesNumbers;}return a;};function PropertyModel(b,a){this.entity=b;this.name=a;var c=this.name.match(/^is (.*) of$/);if(c){this.inverse=true;this.sortName=c[1];}else{this.inverse=false;this.sortName=this.name;}this.values=[];this.unfetchedValues=[];this.automaticallyFetchValues=false;this.currentUnfetchedValueCount=0;this.sources=[];this.hidden=false;this.weight=0+"z".charCodeAt(0)-this.sortName.toLowerCase().charCodeAt(0)+1;if(this.weight<0||this.weight>27){this.weight=0;}this.originalWeight=this.weight;this.topValue=null;this.topSourceCount=0;this.active=null;this.inSingleMode=false;this.singleModeValue=null;this.displayMode=this.getDefaultPropertyDisplayMode();this.stickToPreviousMode=this.entity.getDefaultPropertyStickyModeForLayout();this.elementID=randomString();}PropertyModel.prototype=new Observable();PropertyModel.prototype.getDefaultPropertyStickyMode=function(){return this.entity.getDefaultPropertyStickyModeForLayout();};PropertyModel.prototype.getDefaultPropertyDisplayMode=function(){if(this.name==="picture"){return"compact";}return this.entity.getDefaultPropertyDisplayModeForLayout();};PropertyModel.prototype.getStickToPreviousMode=function(){return this.stickToPreviousMode;};PropertyModel.prototype.setStickToPreviousMode=function(a){this.stickToPreviousMode=a;this.notifyObservers("stickToPreviousChange",this.stickToPreviousMode);};PropertyModel.prototype.getDisplayMode=function(){return this.displayMode;};PropertyModel.prototype.setDisplayMode=function(a){if(!a){this.displayMode=this.entity.getDefaultPropertyDisplayModeForLayout();}else{this.displayMode=a;}if(a==="compact"){this.inSingleMode=null;this.singleModeValue=null;this.updateActivityState(true);}else{if(a==="list"){this.inSingleMode=null;this.singleModeValue=null;this.updateActivityState(true);}else{if(a==="single"){this.singleModeValue=this.getSingleValue();this.inSingleMode=true;this.updateActivityState(true);}else{if(a==="hidden"){this.hide();}}}}this.notifyObservers("displayModeChanged",this.displayMode);};PropertyModel.prototype.getNumberOfHiddenByDisplayModeValues=function(){var d=0;var a=this.values;var c=a.length;for(var b=0;b<c;b++){if(a[b].hiddenByDisplayMode===true){d++;}}return d;};PropertyModel.prototype.getNumberOfActiveValues=function(){var d=0;var a=this.values;var c=a.length;for(var b=0;b<c;b++){if(a[b].active===true){d++;}}return d;};PropertyModel.prototype.registerUnfetchedValues=function(b,a){log.debug(a+" unfetched values for "+this.name+" from "+b.sourceURI);this.unfetchedValues.push({source:b,count:a});if(this.automaticallyFetchValues){this.fetchValues();}this.updateActivityState(false);};PropertyModel.prototype.countUnfetchedValues=function(){var a=0;for(var b=0;b<this.unfetchedValues.length;b++){if(!this.unfetchedValues[b].source.isActive()){continue;}if(this.entity.isInSoloMode()&&!this.unfetchedValues[b].source.solo){continue;}a+=this.unfetchedValues[b].count;}return a;};PropertyModel.prototype.fetchValues=function(){if(this.unfetchedValues.length===0){return;}this.automaticallyFetchValues=true;while(this.unfetchedValues.length>0){var a=this.unfetchedValues.shift().source;a.fetchValues(this);}this.updateActivityState(false);};PropertyModel.prototype.setSingleValue=function(a){if(!a){this.inSingleMode=false;this.singleModeValue=null;}else{if(a===true){this.inSingleMode=true;this.singleModeValue=null;}else{this.inSingleMode=true;this.singleModeValue=a;this.notifyObservers("topValueChanged",a);}}};PropertyModel.prototype.getSingleValue=function(){if(this.inSingleMode&&this.singleModeValue!==null){return this.singleModeValue;}else{if(this.inSingleMode!==true&&this.topValue!==null){this.inSingleMode=true;this.singleModeValue=this.topValue;return this.singleModeValue;}else{log.error("There is no value to return from getSingleValue");return null;}}};PropertyModel.prototype.addValue=function(f,g){var e;var h=new ValueModel(this,f);if(!g){log.error("no source specified, this should happen just for debugging");}else{if(g.length){for(e=0;e<f.sources.length;e++){var d=f.sources[e];if(!g[d]){return;}h.addSource(g[d]);this.addSource(g[d]);}}else{h.addSource(g);this.addSource(g);}}var c=this.values;var b=this.values.length;var a=false;for(e=b-1;e>=0;e--){if(c[e].isMatchingValue(h)){c[e].merge(h,this.entity.disableInitialNotifications);h=c[e];a=true;break;}}if(!a){this.values.push(h);this.notifyObservers("valueAdded",h);if(!this.entity.disableInitialNotifications){h.notifyObservers("numberOfSourcesChanged",h.sources.length,"from addSource");}}if(!this.entity.disableInitialNotifications){h.updateActivityState();this.updateActivityState(false);}return h;};PropertyModel.prototype.moveOnTop=function(){var a=this.entity.getPropertyOnTop().name;log.debug("called moveOnTop on property "+this.name);log.debug("top property name is "+a);this.moveBefore(a);};PropertyModel.prototype.moveBefore=function(a){if(a==this.name){return;}var b=this.entity.getPropertyAfter(this);this.entity.move(this,a);this.notifyObservers("movedBefore",a,"From property model");};PropertyModel.prototype.addSource=function(a){if(this.sources.indexOf(a)==-1){this.sources.push(a);}};PropertyModel.prototype.getValuesFromSource=function(e){var a=[];var c=this.values;var b=this.values.length;for(var d=b-1;d>=0;d--){if(c[d].sources.indexOf(e)!=-1){a.push(c[d]);}}return a;};PropertyModel.prototype.updateHighlightState=function(){this.notifyObservers("highlightChanged",this.highlighted);};PropertyModel.prototype.changeHighlightState=function(a){this.notifyObservers("highlightChanged",a);};PropertyModel.prototype.hasActiveValues=function(){var b=this.values;var a=this.values.length;for(var c=a-1;c>=0;c--){if(b[c].active===true){return true;}}return false;};PropertyModel.prototype.updateActivityState=function(e){var g=false;var a=this.countUnfetchedValues();var d=this.values;var c=this.values.length;for(var f=c-1;f>=0;f--){var h=d[f];if(e){h.updateActivityState();}}g=this.hasActiveValues()||(a>0);var b=g&&!this.hidden;if(this.active!==b){this.active=g;log.info("changing activity to "+this.active+" for prop ["+this.name+"]");this.notifyObservers("activityChanged",Boolean(this.active));}if(this.entity.propertyNamesToDisplay.length>0){if(this.entity.propertyNamesToDisplay.indexOfMatch(this.name)===-1){this.active=false;this.notifyObservers("activityChanged",this.active);}}if(this.currentUnfetchedValueCount!=a){this.notifyObservers("unfetchedValueCountChanged",a);this.currentUnfetchedValueCount=a;}};PropertyModel.prototype.hide=function(){this.notifyObservers("hidden",true);this.hidden=true;var a=this.values;var c=a.length;for(var b=0;b<c;b++){a[b].hide();}};PropertyModel.prototype.show=function(d){this.notifyObservers("hidden",false);this.hidden=false;if(d===true){var a=this.values;var c=a.length;for(var b=0;b<c;b++){a[b].show();}}this.updateActivityState(true);};PropertyModel.prototype.attemptConsolidation=function(d){var b=this.values;var a=this.values.length;for(var c=a-1;c>=0;c--){if(b[c]==d){continue;}if(d.isMatchingValue(b[c])){d.merge(b[c]);var e=b[c];b.splice(c,1);e.notifyObservers("removedByMerging",d);return true;}}return false;};PropertyModel.prototype.setWeight=function(b){this.weight=b;this.entity.rearrange(this);var a=this.entity.getPropertyAfter(this);if(a){this.notifyObservers("movedBefore",a.name,"From property model 2");}};PropertyModel.prototype.sourceCountChanged=function(e,d){if(e!=this.topValue&&d>this.topSourceCount){this.topValue=e;this.topSourceCount=d;if(this.inSingleMode!==true){this.notifyObservers("topValueChanged",e);}}else{if(e==this.topValue&&(d<this.topSourceCount||d===0)){this.topValue=null;this.topSourceCount=0;var b=this.values;var a=this.values.length;for(var c=a-1;c>=0;c--){if(b[c].activeSourceCount>this.topSourceCount){this.topValue=b[c];this.topSourceCount=d;}}if(!this.inSingleMode){this.notifyObservers("topValueChanged",this.topValue);}}}};function SourceModel(a,b){this.entity=a;this.sourceURI=b.source_uri;this.recordURI=b.record_uri;this.sourceLabel=b.source_label;this.domain=b.domain;this.date=b.date;this.valueCount=b.total_values;this.queryPhrase=b.query_phrase;this.queryIdentifier=b.query_identifier;this.isFromOKKAM=b.okkam;this.isFromYBOSS=b.yboss;this.highlighted=false;this.rejected=false;this.confirmed=false;this.solo=false;this.filteredOut=false;this.alternativeUrlsFromOkkam=null;this.alternativeUrlsFromOkkamFetched=false;}SourceModel.prototype=new Observable();SourceModel.prototype.fetchSameAsFromOkkam=function(){var a=this;if(a.alternativeUrlsFromOkkam==null){if(a.sourceURI.startsWith("http://dbpedia.org")||a.sourceURI.startsWith("http://freebase.com")||a.sourceURI.startsWith("http://geonames.org")){log.info("fetchSameAsFromOkkam got: dbpedia freebase or geonames ");services.serviceOKKAMSameAsRequest(a.sourceURI,function(b){if(b!=null&&b.length>0){a.alternativeUrlsFromOkkam=b;a.notifyObservers("urlsFromOkkamAdded",a.alternativeUrlsFromOkkam);}});}}else{a.notifyObservers("urlsFromOkkamAdded",a.alternativeUrlsFromOkkam);}};SourceModel.prototype.fetchValues=function(b){var a=this;log.debug('SourceModel.fetchValues: Requesting property "'+b.name+'" for <'+this.sourceURI+">");log.debug('    phrase: "'+this.queryPhrase+'", id: '+this.queryIdentifier);services.servicePropertyValuesRequest(this.sourceURI,b.name,{phrase:this.queryPhrase,id:this.queryIdentifier},function(e){if(!e){return;}log.debug(e);var c=e.properties[b.name];if(!c){return;}for(var d=0;d<c.length;d++){b.addValue(c[d],a);}a.entity.labelFetcher.flush();});};SourceModel.prototype.getIndex=function(){return this.entity.sources.indexOf(this)+1;};SourceModel.prototype.eachValue=function(e){for(var c=0;c<this.entity.propertyList.length;c++){var d=this.entity.propertyList[c];var a=d.getValuesFromSource(this);for(var b=0;b<a.length;b++){e(a[b]);}}};SourceModel.prototype.eachPropertyAndValueFromThisSource=function(e){for(var c=0;c<this.entity.propertyList.length;c++){var d=this.entity.propertyList[c];var a=d.getValuesFromSource(this);for(var b=0;b<a.length;b++){if(b===0){e(d);}e(a[b]);}}};SourceModel.prototype.highlightSource=function(a){this.highlighted=a;this.notifyObservers("highlightChanged",a);};SourceModel.prototype.highlightSourcePropertiesAndValues=function(a){this.eachPropertyAndValueFromThisSource(function(b){b.changeHighlightState(a);});};SourceModel.prototype.highlight=function(a){if(this.highlighted==a){return;}this.highlighted=a;this.notifyObservers("highlightChanged",a);this.eachValue(function(b){b.updateHighlightState();});};SourceModel.prototype.reject=function(a){if(a==this.rejected){return;}if(this.confirmed===true){this.confirmed=false;}this.rejected=a;this.notifyObservers("rejected",a);this.eachValue(function(b){b.updateActivityState();b.notifyObservers("numberOfSourcesChanged");});this.entity.updateActivityStateOfProperties(false);};SourceModel.prototype.confirm=function(a){if(a==this.confirmed){return;}if(this.rejected===true){this.rejected=false;}this.confirmed=a;this.notifyObservers("confirmed",a);this.eachValue(function(b){b.updateActivityState();b.notifyObservers("numberOfSourcesChanged");});this.entity.updateActivityStateOfProperties(false);};SourceModel.prototype.isActive=function(){if(!this.confirmed&&!this.rejected&&this.entity.newInformationVisible){return true;}if(this.confirmed&&this.entity.confirmedInformationVisible){return true;}if(this.rejected&&this.entity.rejectedInformationVisible){return true;}return false;};SourceModel.prototype.setSoloState=function(b){var c=this.entity.getSoloedSources();var a=c.indexOf(this);if(b){if(a==-1){c.push(this);this.entity.setSoloMode(c);}}else{if(a!=-1){c.splice(a,1);this.entity.setSoloMode(c);}}};function EntityModel(){this.properties={};this.propertyList=[];this.sources=[];this.newInformationVisible=true;this.confirmedInformationVisible=true;this.rejectedInformationVisible=false;this.confirmedDomains=[];this.rejectedDomains=[];this.soloedSources=[];this.labelFetcher=new LabelFetcher();this.embededMode=false;this.onServerSide=false;this.disableInitialNotifications=false;this.alwaysRequestLabels=false;this.pageLayout="layout1";this.propertyNamesToDisplay=[];this.okkamSuggestions=false;}EntityModel.prototype=new Observable();EntityModel.prototype.registerPropertyNamesToDisplay=function(b){this.propertyNamesToDisplay=b;for(var a=0;a<this.propertyList.length;a++){var c=this.propertyList[a];c.updateActivityState(true);}};EntityModel.prototype.getDefaultPropertyDisplayModeForLayout=function(c){var b;if(!c){b=this.pageLayout;}else{b=c;}var a;switch(b){case"layout1":a="list";break;case"layout2":a="compact";break;case"layout3":a="list";break;default:a="list";}return a;};EntityModel.prototype.getDefaultPropertyStickyModeForLayout=function(c){var a;if(!c){a=this.pageLayout;}else{a=c;}var b="2";switch(a){case"layout1":b="2";break;case"layout2":b="1";break;case"layout3":b="2";break;default:b="2";}log.info("Returning default sticky mode for layout["+a+"]["+b+"]");return b;};EntityModel.prototype.setPageLayout=function(a){if(this.pageLayout===a){return;}this.pageLayout=a;this.notifyObservers("pageLayoutChanged",this.pageLayout);this.setPropertyDisplayModeOnAllProperties();this.setStickToPreviousPropertyOnAllProperties();};EntityModel.prototype.setPropertyDisplayModeOnAllProperties=function(){for(var a=0;a<this.propertyList.length;a++){var b=this.propertyList[a];b.setDisplayMode(b.getDefaultPropertyDisplayMode());}};EntityModel.prototype.setStickToPreviousPropertyOnAllProperties=function(){for(var a=0;a<this.propertyList.length;a++){var b=this.propertyList[a];b.setStickToPreviousMode(b.getDefaultPropertyStickyMode());}};EntityModel.prototype.setOnServerSide=function(a){this.onServerSide=a;log.info("onServerSide set to  ["+this.onServerSide+"]");};EntityModel.prototype.setEmbededMode=function(a){this.embededMode=a;};EntityModel.prototype.confirmDomain=function(d){if(this.confirmedDomains.indexOf(d)==-1){this.confirmedDomains.push(d);}var c,a=this.sources.length;for(var b=a-1;b>=0;b--){c=this.sources[b];if(c.confirmed===true){continue;}if(c.domain==d){c.confirm(true);}}};EntityModel.prototype.rejectDomain=function(d){if(this.rejectedDomains.indexOf(d)==-1){this.rejectedDomains.push(d);}var c,a=this.sources.length;for(var b=a-1;b>=0;b--){c=this.sources[b];if(c.rejected===true){continue;}if(c.domain==d){c.reject(true);}}};EntityModel.prototype.getNumberOfNewSources=function(){var b=0;for(var a=0;a<this.sources.length;a++){if(!this.sources[a].rejected&&!this.sources[a].confirmed){b++;}}return b;};EntityModel.prototype.getNumberOfApprovedSources=function(){var b=0;for(var a=0;a<this.sources.length;a++){if(!this.sources[a].rejected&&this.sources[a].confirmed){b++;}}return b;};EntityModel.prototype.getNumberOfRejectedSources=function(){var b=0;for(var a=0;a<this.sources.length;a++){if(this.sources[a].rejected&&!this.sources[a].confirmed){b++;}}return b;};EntityModel.prototype.setNewInformationVisible=function(a){this.notifyObservers("setNewInformationVisible",a);if(this.newInformationVisible===a){return;}this.newInformationVisible=a;this.updateActivityStateOfProperties(true);};EntityModel.prototype.setConfirmedInformationVisible=function(a){this.notifyObservers("setConfirmedInformationVisible",a);if(this.confirmedInformationVisible===a){return;}this.confirmedInformationVisible=a;this.updateActivityStateOfProperties(true);};EntityModel.prototype.setRejectedInformationVisible=function(a){this.notifyObservers("setRejectedInformationVisible",a);if(this.rejectedInformationVisible===a){return;}this.rejectedInformationVisible=a;this.updateActivityStateOfProperties(true);};EntityModel.prototype.addProperty=function(a){log.debug("EntityModel.addProperty: "+a);if(this.properties[a]){return this.properties[a];}var b=new PropertyModel(this,a);this.properties[a]=b;this.insertIntoPropertyList(b);this.notifyObservers("propertyAdded",b,this.getPropertyAfter(b));return b;};EntityModel.prototype.getProperties=function(){return this.properties;};EntityModel.prototype.addSource=function(a){if(a.total_values===0&&(a.yboss||a.is_web_page)){a.total_values=1;a.properties["web page"]=[{uris:[a.source_uri]}];}if(this.hasSource(a.source_uri)){return this.getSource(a.source_uri);}var b=this.addSourceFromJSON(a);this.addPropertiesFromJSON(a.properties,b);this.addSkippedPropertiesFromJSON(a.skipped_properties,b);this.notifyObservers("finishedAddingNewSources");return b;};EntityModel.prototype.addMultiSource=function(c){var d=[];var g=[];var a=c.sources.length;for(var b=a-1;b>=0;b--){var f=c.sources[b];if(this.hasSource(f.source_uri)){d.push(this.getSource(f.source_uri));}else{var e=this.addSourceFromJSON(f);d.push(e);g.push(e);}}this.addPropertiesFromJSON(c.values,d);if(c.configuration){this.applyConfiguration(c.configuration);}this.notifyObservers("finishedAddingNewSources");this.labelFetcher.flush();};EntityModel.prototype.hasSource=function(a){return this.getSource(a)!==null;};EntityModel.prototype.getSource=function(c){var a=this.sources.length;for(var b=a-1;b>=0;b--){if(this.sources[b].sourceURI==c){return this.sources[b];}}return null;};EntityModel.prototype.addSourceFromJSON=function(a){var b=new SourceModel(this,a);this.sources.push(b);this.notifyObservers("sourceAdded",b);return b;};EntityModel.prototype.addPropertiesFromJSON=function(d,b){var a=this;sigmaUtilities.each(d,function(e){var f=function(){var l=a.addProperty(e);var k=d[e];var g=k.length;for(var h=g-1;h>=0;h--){l.addValue(k[h],b);}};if(a.onServerSide){f();}else{sigmaUtilities.queueForSlowBrowser.add(f,a);}});var c=function(){a.notifyObservers("finishedAddingProperties");a.labelFetcher.flush();};if(a.onServerSide){c();}else{sigmaUtilities.queueForSlowBrowser.add(c,a);}};EntityModel.prototype.addSkippedPropertiesFromJSON=function(b,e){for(var a in b){if(b.hasOwnProperty(a)){var c=b[a];var d=this.addProperty(a);d.registerUnfetchedValues(e,c);}}};EntityModel.prototype.getProperty=function(a){return this.properties[a];};EntityModel.prototype.getPropertyAfter=function(b){for(var a=0;a<this.propertyList.length-1;a++){if(this.propertyList[a]==b){return this.propertyList[a+1];}}return null;};EntityModel.prototype.getPropertyBefore=function(b){for(var a=1;a<this.propertyList.length;a++){if(this.propertyList[a]==b){return this.propertyList[a-1];}}return null;};EntityModel.prototype.__printPropertiesOrder=function(){var a=[];for(var b=0;b<this.propertyList.length;b++){var c=this.propertyList[b];if(c.active===true){a.push([c.name,c.weight]);}else{a.push([c.name,c.weight,"not active"]);}}log.debug("==================");log.debug(a);};EntityModel.prototype.getPropertyOnTop=function(){var b={weight:-1000};for(var a=0;a<this.propertyList.length;a++){var c=this.propertyList[a];if(c.weight>b.weight&&c.active===true){b=c;}}log.debug("Current property on top is "+b.name);return b;};EntityModel.prototype.move=function(b,a){if(a===null||a===""){b.weight=this.propertyList[this.propertyList.length-1].weight-0.005;}else{if(this.propertyList.indexOf(this.getProperty(a))==-1){return;}else{if(this.propertyList.indexOf(this.getProperty(a))===0){b.weight=this.propertyList[0].weight+0.005;}else{after=this.getProperty(a);before=this.getPropertyBefore(after);b.weight=(after.weight+before.weight)/2;}}}this.rearrange(b);};EntityModel.prototype.rearrange=function(a){this.propertyList.splice(this.propertyList.indexOf(a),1);this.insertIntoPropertyList(a);};EntityModel.prototype.insertIntoPropertyList=function(d){var b=-1;var a=this.propertyList.length;for(var c=0;c<a;c++){if(this.propertyList[c].weight<=d.weight){b=c;break;}if(this.propertyList[c].weight>d.weight){continue;}if(this.propertyList[c].sortName>d.sortName){b=c;break;}if(this.propertyList[c].sortName<d.sortName){continue;}if(this.propertyList[c].inverse>d.inverse){b=c;break;}}if(b==-1){this.propertyList.push(d);}else{this.propertyList.splice(b,0,d);}log.debug("++++++++ after inserting prop ["+d.name+"] ["+d.weight+"]");this.__printPropertiesOrder();};EntityModel.prototype.updateActivityStateOfProperties=function(a){for(var b=0;b<this.propertyList.length;b++){this.propertyList[b].updateActivityState(a);}};EntityModel.prototype.setSoloMode=function(a){this.soloedSources=a;for(var b=0;b<this.sources.length;b++){var c=this.sources[b];if(c.solo&&(a.indexOf(c)==-1)){c.solo=false;c.notifyObservers("updateSoloStatus",false);}else{if(!c.solo&&(a.indexOf(c)!=-1)){c.solo=true;c.notifyObservers("updateSoloStatus",true);}}}this.updateActivityStateOfProperties(true);log.info("isInSoloMode(): "+this.isInSoloMode());};EntityModel.prototype.isInSoloMode=function(){return this.soloedSources.length!==0;};EntityModel.prototype.getSoloedSources=function(){var a=[];for(var b=0;b<this.soloedSources.length;b++){a.push(this.soloedSources[b]);}return a;};function RecordOrder(){this.record=null;this.fetching=false;this.completed=false;this.failed=false;this.aborted=false;}RecordOrder.prototype.fetch=function(b,c,d){if(this.aborted){log.error("attempted to fetch an aborted order: "+b);return;}log.info("In RecordOrder.prototype.fetch requesting url["+b+"]");this.fetching=true;var a=this;services.serviceSourceRequestLimited(b,c,function(e){a.fetching=false;if(a.aborted){return;}if(e){log.info("fetching successful: "+b);a.record=e;a.completed=true;a.record.relevance=a.relevance;}else{log.info("fetching failed: "+b);a.failed=true;}d(a);});};RecordOrder.prototype.abort=function(){this.aborted=true;};function RecordStream(){}sigmaUtilities.extend(RecordStream.prototype,Observable.prototype);RecordStream.prototype.init=function(a,b){this.name=b;this.exhausted=false;this.closed=false;this.seen=a?a:[];this.nNext=1;this.orders=[];this.sourceQueue=[];this.sourceQueueState="idle";this.pending=0;this.maxParallelFetches=5;this.update();};RecordStream.prototype.nextRelevance=function(){if(this.sourceQueueState==="exhausted"&&this.sourceQueue.length===0){return 0;}return this.computeRelevance(this.nNext);};RecordStream.prototype.orderRecord=function(b){var a=new RecordOrder();a.relevance=this.computeRelevance(this.nNext);a.callback=b;this.orders.push(a);log.info("ordering from "+this.name+", relevance "+a.relevance);this.nNext++;this.update();return a;};RecordStream.prototype.close=function(){this.closed=true;this.update();};RecordStream.prototype.update=function(){if(this.sourceQueue.length===0&&this.sourceQueueState==="exhausted"){this.exhausted=true;}while(true){if(this.orders.length===0){break;}if(this.closed){var a=this.orders.shift();a.abort();this.failOrder(a);continue;}if(this.orders[0].fetching){break;}if(this.orders[0].completed){var a=this.orders.shift();if(a==null){log.error("!!!!!!! RecordStream.update: order is null");}this.modifyBeforeDelivery(a.record);this.notifyObservers("recordReady",a.record);a.callback(a.record,a.relevance);continue;}if(this.orders[0].failed){this.failOrder(this.orders.shift());continue;}if(!this.exhausted){break;}this.failOrder(this.orders.shift());}for(var c=0;c<this.orders.length;c++){if(this.orders[c].fetching||this.orders[c].completed){continue;}if(this.pending>=this.maxParallelFetches){break;}var b=this.dequeueNextSource();if(b===null){break;}this.fetchOrder(this.orders[c],b);}if(this.sourceQueue.length===0&&this.sourceQueueState==="idle"&&!this.closed){this.fillSourceQueue();}if((this.exhausted||this.closed)&&this.orders.length===0){this.notifyObservers("streamExhausted",this);}};RecordStream.prototype.computeRelevance=function(a){return 0;};RecordStream.prototype.fillSourceQueue=function(){this.sourceQueueState="refilling";var a=this;this.fetchSources(function(c){if(!c||c.length===0){a.sourceQueueState="exhausted";}else{a.sourceQueueState="idle";for(var b=0;b<c.length;b++){a.sourceQueue.push(c[b]);}}a.update();});};RecordStream.prototype.dequeueNextSource=function(){while(this.sourceQueue.length>0){var a=this.sourceQueue.shift();if(this.seen.indexOf(a)!=-1){log.info("skipping "+a);continue;}this.seen.push(a);return a;}return null;};RecordStream.prototype.fetchSources=function(a){a(null);};RecordStream.prototype.fetchOrder=function(a,b){this.pending++;var c=this;a.fetch(b,this.getQuerySpec(b),function(d){c.pending--;c.orderFetched(d);c.update();});};RecordStream.prototype.orderFetched=function(a){};RecordStream.prototype.failOrder=function(a){a.callback(null,a.relevance);};RecordStream.prototype.getQuerySpec=function(a){return this.getQuerySpecBase();};RecordStream.prototype.getQuerySpecBase=function(a){return{};};RecordStream.prototype.modifyBeforeDelivery=function(a){};function ArrayRecordStream(b,a){this.requests=b;this.hasFetchedSources=false;this.init(a,"List of "+b.length+" sources");}sigmaUtilities.extend(ArrayRecordStream.prototype,RecordStream.prototype);ArrayRecordStream.prototype.computeRelevance=function(a){return 1;};ArrayRecordStream.prototype.fetchSources=function(c){if(this.hasFetchedSources){c(null);return;}this.hasFetchedSources=true;var b=[];for(var a=0;a<this.requests.length;a++){b.push(this.requests[a].source_uri);}c(b);};ArrayRecordStream.prototype.getQuerySpec=function(b){var a=this.getQuerySpecBase(b);for(var c=0;c<this.requests.length;c++){if(this.requests[c].source_uri==b){a.phrase=this.requests[c].query_phrase;a.id=this.requests[c].query_identifier;return a;}}return null;};ArrayRecordStream.prototype.modifyBeforeDelivery=function(b){for(var a=0;a<this.requests.length;a++){if(this.requests[a].source_uri==b.source_uri){if(this.requests[a].fetched){this.requests[a].fetched(b);}}}};function SindiceKeywordRecordStream(b,a){this.query=b;this.page=1;this.perpage=50;this.init(a,'Sindice keyword search for "'+b+'"');this.doUseCaches=true;this.fetchers=null;}sigmaUtilities.extend(SindiceKeywordRecordStream.prototype,RecordStream.prototype);SindiceKeywordRecordStream.prototype.computeRelevance=function(a){return 0.75/Math.pow(a,0.22);};SindiceKeywordRecordStream.prototype.getQuerySpec=function(b){var a=this.getQuerySpecBase(b);a.phrase=this.query;if(this.doUseCaches==false){a.cache="0";}if(this.fetchers!=null){a.fetchers=this.fetchers;}return a;};SindiceKeywordRecordStream.prototype.fetchSources=function(a){log.info("refilling "+this.name+", page "+this.page);services.serviceSindiceKeywordRequest(this.query,this.page,this.perpage,a);this.page++;};SindiceKeywordRecordStream.prototype.orderFetched=function(a){if(a.failed){a.failed=false;}};function SindiceLabelRecordStream(b,a){this.query=b;this.page=1;this.perpage=50;this.init(a,'Sindice label search for "'+b+'"');this.doUseCaches=true;this.fetchers=null;}sigmaUtilities.extend(SindiceLabelRecordStream.prototype,RecordStream.prototype);SindiceLabelRecordStream.prototype.computeRelevance=function(a){return 0.5/Math.pow(a,0.3);};SindiceLabelRecordStream.prototype.getQuerySpec=function(b){var a=this.getQuerySpecBase(b);a.phrase=this.query;if(this.doUseCaches==false){a.cache="0";}if(this.fetchers!=null){a.fetchers=this.fetchers;}return a;};SindiceLabelRecordStream.prototype.fetchSources=function(a){log.info("refilling "+this.name+", page "+this.page);services.serviceSindiceRequestLabelOnly(this.query,this.page,this.perpage,a);this.page++;};SindiceLabelRecordStream.prototype.orderFetched=function(a){if(a.failed){a.failed=false;}};function SindiceIdentifierRecordStream(c,a,b){this.identifier=c;this.phrase=a;this.page=1;this.perpage=50;this.init(b,'Sindice identifier search for "'+c+'"');var d=c;if(d.indexOf("#")!=-1){d=d.substr(0,d.indexOf("#"));}this.sourceQueue.push(d);this.doUseCaches=true;this.fetchers=null;}sigmaUtilities.extend(SindiceIdentifierRecordStream.prototype,RecordStream.prototype);SindiceIdentifierRecordStream.prototype.computeRelevance=function(a){return 1/Math.pow(a,0.1);};SindiceIdentifierRecordStream.prototype.fetchSources=function(b){log.info("refilling "+this.name+", page "+this.page);var a="<"+this.identifier+"> * *";services.serviceSindiceAdvancedRequest(a,this.page,this.perpage,b);this.page++;};SindiceIdentifierRecordStream.prototype.getQuerySpec=function(b){var a=this.getQuerySpecBase(b);a.id=this.identifier;a.phrase=this.phrase;if(this.doUseCaches==false){a.cache="0";}if(this.fetchers!=null){a.fetchers=this.fetchers;}return a;};SindiceIdentifierRecordStream.prototype.orderFetched=function(a){if(a.failed){a.failed=false;}};function SindiceHomepageRecordStream(d,b,a,c){this.homepage=d;this.phrase=b;this.identifiers=a;this.page=1;this.perpage=50;this.init(c,"Sindice homepage search: <"+this.homepage+">");this.doUseCaches=true;this.fetchers=null;}sigmaUtilities.extend(SindiceHomepageRecordStream.prototype,RecordStream.prototype);SindiceHomepageRecordStream.prototype.computeRelevance=function(a){return 0.9/Math.pow(a,0.15);};SindiceHomepageRecordStream.prototype.fetchSources=function(b){log.info("refilling "+this.name+", page "+this.page);var a="* <http://xmlns.com/foaf/0.1/homepage> <"+this.homepage+">";services.serviceSindiceAdvancedRequest(a,this.page,this.perpage,b);this.page++;};SindiceHomepageRecordStream.prototype.getQuerySpec=function(b){var a=this.getQuerySpecBase(b);a.phrase=this.phrase;a.homepage=this.homepage;if(this.identifiers&&this.identifiers.length>0){a.id=this.identifiers[0];}if(this.doUseCaches==false){a.cache="0";}if(this.fetchers!=null){a.fetchers=this.fetchers;}return a;};SindiceHomepageRecordStream.prototype.orderFetched=function(a){if(a.failed){a.failed=false;}};function OKKAMRecordStream(b,a){this.query=b;this.okkamID=null;this.page=1;this.perpage=50;this.init(a,'OKKAM search for "'+b+'"');}sigmaUtilities.extend(OKKAMRecordStream.prototype,RecordStream.prototype);OKKAMRecordStream.prototype.computeRelevance=function(a){return 0.8/Math.pow(a,0.3);};OKKAMRecordStream.prototype.getQuerySpec=function(b){var a=this.getQuerySpecBase(b);a.phrase=this.query;a.id=this.okkamID;return a;};OKKAMRecordStream.prototype.fetchSources=function(c){if(this.okkamID===false){c(null);return;}if(this.okkamID===null){log.info("querying for OKKAM ID: "+this.query);var b=this;services.serviceOKKAMRequest(this.query,function(d){if(!d){b.okkamID=false;}else{b.okkamID=d;}b.fetchSources(c);});return;}log.info("refilling "+this.name+", page "+this.page);var a="<"+this.okkamID+"> * *";services.serviceSindiceAdvancedRequest(a,this.page,this.perpage,c);this.page++;};OKKAMRecordStream.prototype.modifyBeforeDelivery=function(a){a.okkam=true;};OKKAMRecordStream.prototype.orderFetched=function(a){if(a.failed){a.failed=false;}};function YahooBOSSRecordStream(b,a){this.query=b;this.offset=0;this.perpage=50;this.init(a,'Yahoo BOSS search for "'+b+'"');}sigmaUtilities.extend(YahooBOSSRecordStream.prototype,RecordStream.prototype);YahooBOSSRecordStream.prototype.computeRelevance=function(a){return 0.64/Math.pow(a,0.26);};YahooBOSSRecordStream.prototype.getQuerySpec=function(b){var a=this.getQuerySpecBase(b);a.phrase=this.query;return a;};YahooBOSSRecordStream.prototype.fetchSources=function(a){log.info("refilling "+this.name+", offset "+this.offset);services.serviceYBOSSRequest(this.query,this.offset,this.perpage,a);this.offset+=this.perpage;};YahooBOSSRecordStream.prototype.modifyBeforeDelivery=function(a){a.yboss=true;};YahooBOSSRecordStream.prototype.orderFetched=function(a){if(a.failed){a.failed=false;}};function AlternativeIdsRecordStream(b,a){this.query=b;this.offset=0;this.perpage=10;this.init(a,'AlternativeId search for "'+b+'"');}sigmaUtilities.extend(AlternativeIdsRecordStream.prototype,RecordStream.prototype);AlternativeIdsRecordStream.prototype.computeRelevance=function(a){return 1/Math.pow(a,0.1);};AlternativeIdsRecordStream.prototype.getQuerySpec=function(b){var a=this.getQuerySpecBase(b);a.phrase="";return a;};AlternativeIdsRecordStream.prototype.fetchSources=function(a){log.info("refilling "+this.name+", offset "+this.offset);services.serviceOKKAMAlternativeIdsRequest(this.query,this.offset,this.perpage,a);this.offset+=this.perpage;};AlternativeIdsRecordStream.prototype.modifyBeforeDelivery=function(a){a.okkam=true;};AlternativeIdsRecordStream.prototype.orderFetched=function(a){if(a.failed){a.failed=false;}};function SourceManager(a){this.entity=a;this.query=null;this.queryOriginal=null;this.queryPropertyParameters=null;this.outstandingOrders=0;this.streams=[];this.streamsForCurrentKeyword=[];this.seen=[];this.identifiersSeen=[];this.homepagesSeen=[];this.deliveredCount=0;this.readyOrders=[];this.useOKKAM=true;this.useYBOSS=true;this.useSindice=true;this.useIdentifierSearch=true;this.useIFPSearch=true;this.useSingleSource=false;this.doFetchFromWeb=true;this.doUseCaches=true;this.fetchers=null;var b=this;a.addProperty("identifier").addObserver({valueAdded:function(c){c.addObserver({confirmed:function(e){if(!e){return;}if(!b.useIdentifierSearch){return;}for(var d=0;d<c.uris.length;d++){b.addStreamForIdentifier(c.uris[d]);}}});}});a.addProperty("homepage").addObserver({valueAdded:function(c){c.addObserver({confirmed:function(e){if(!e){return;}if(!b.useIFPSearch){return;}for(var d=0;d<c.uris.length;d++){b.addStreamForHomepage(c.uris[d]);}}});}});}sigmaUtilities.extend(SourceManager.prototype,Observable.prototype);var okkamId=null;function onFunctionAvailable(){if(okkamId===null){log.info("wait 100");setTimeout(onFunctionAvailable,100);}}SourceManager.prototype.setQuery=function(e){if(this.queryOriginal==e){return;}this.queryOriginal=e;log.info('setting query to "'+this.queryOriginal+'"; stream count before: '+this.streams.length);this.notifyObservers("queryChanged",this.queryOriginal);if(this.hasPropertyParameters(e)){var a=this.extractPropertiesNames(e);this.entity.registerPropertyNamesToDisplay(a);e=this.extractQuery(e);}else{this.entity.registerPropertyNamesToDisplay([]);}var h=false;var d=this.streamsForCurrentKeyword;this.streamsForCurrentKeyword=[];if(this.isURI(e)){if(e.startsWith("http://www.okkam.org/ens/")||e.startsWith("http://www.okkam.org/entity/")){this.query=e;this.notifyObservers("okkamIDAsQuery",this.query);var g=new AlternativeIdsRecordStream(e,this.seen);if(this.doUseCaches==false){g.doUseCaches=false;}if(this.fetchers!=null){g.fetchers=this.fetchers;}this.streams.push(g);this.streamsForCurrentKeyword.push(g);g.addObserver(this);}this.query=null;var f=new SindiceIdentifierRecordStream(e,null,this.seen);if(this.doUseCaches==false){f.doUseCaches=false;}if(this.fetchers!=null){f.fetchers=this.fetchers;}this.streams.push(f);this.streamsForCurrentKeyword.push(f);f.addObserver(this);}else{this.query=e;var c=this;if(h){}else{if(this.useSindice){var f=new SindiceKeywordRecordStream(this.query,this.seen);if(this.doUseCaches==false){f.doUseCaches=false;}if(this.fetchers!=null){f.fetchers=this.fetchers;}this.streams.push(f);this.streamsForCurrentKeyword.push(f);f.addObserver(this);var f=new SindiceLabelRecordStream(this.query,this.seen);if(this.doUseCaches==false){f.doUseCaches=false;}if(this.fetchers!=null){f.fetchers=this.fetchers;}this.streams.push(f);this.streamsForCurrentKeyword.push(f);f.addObserver(this);}if(this.useYBOSS){var f=new YahooBOSSRecordStream(this.query,this.seen);this.streams.push(f);this.streamsForCurrentKeyword.push(f);f.addObserver(this);}if(this.useOKKAM){var f=new OKKAMRecordStream(this.query,this.seen);this.streams.push(f);this.streamsForCurrentKeyword.push(f);f.addObserver(this);}}}for(var b=0;b<d.length;b++){if(this.streams.indexOf(d[b])==-1){continue;}d[b].close();}};SourceManager.prototype.hasOkkamTypeParameter=function(a){res=/okkamtype/.test(a);if(res===true){log.info("Detected okkamtype parameter");}return res;};SourceManager.prototype.hasPropertyParameters=function(a){res=/@/.test(a);if(res===true){log.info("Detected @parameter");}return res;};SourceManager.prototype.extractQuery=function(a){return a.substring(a.indexOf("@")+1).trim();};SourceManager.prototype.removeOkkamType=function(d){var c="okkamtype:";var a=d.indexOf(c);var b=d.substring(0,a);return b.trim();};SourceManager.prototype.getOkkamType=function(d){var c="okkamtype:";var a=d.indexOf(c);var b=d.substring(a+c.length);return b.trim();};SourceManager.prototype.extractPropertiesNames=function(c){c=c.substring(0,c.indexOf("@")).trim();var a=c.split(",");for(var b=0;b<a.length;b++){a[b]=a[b].trim();}return a;};SourceManager.prototype.isURI=function(a){return(/^https?:/).test(a);};SourceManager.prototype.addSingleSource=function(b,e){this.outstandingOrders++;this.notifyObservers("pendingCountUpdated",this.outstandingOrders);var d=this;var a=new RecordOrder();var c={phrase:this.query};if(this.fetchers!=null){c.fetchers=this.fetchers;}if(!this.doFetchFromWeb){c.fetch=0;}if(!this.doUseCaches){c.cache=0;}a.fetch(b,c,function(f){d.outstandingOrders--;d.notifyObservers("pendingCountUpdated",d.outstandingOrders);if(f.failed){if(e){e(null);}return false;}var g=d.entity.addSource(f.record);if(e){e(g);}});};SourceManager.prototype.orderMoreSources=function(b){if(b===undefined){alert(true);b=1;}else{b=parseInt(b,10);}log.info("ordering "+b+" new sources");if(this.streams.length===0){this.notifyObservers("exhausted");return;}this.outstandingOrders+=b;this.notifyObservers("pendingCountUpdated",this.outstandingOrders);for(var a=0;a<b;a++){this.orderSource();}};SourceManager.prototype.orderSource=function(){var c=this.getBestOrderableStream();var b=(this.readyOrders.length>0)?this.readyOrders[0].relevance:null;if(b!==null&&(c===null||b>=c.nextRelevance())){var a=this.readyOrders.shift();if(a===null){log.error("!!!!!!! SourceManager.orderSource: order is null");}this.deliver(a.record);return;}if(c===null){this.outstandingOrders--;if(this.streams.length!==0){this.notifyObservers("pendingCountUpdated",this.outstandingOrders);}log.info("all streams exhausted, dropping one order");return;}var d=this;c.orderRecord(function(f,g){if(f===null){log.info("order failed");}else{log.info("record fetched; relevance: "+g);var e=0;while(e<d.readyOrders.length&&d.readyOrders[e].relevance>=g){e++;}d.readyOrders.splice(e,0,{record:f,relevance:g});}d.orderSource();});};SourceManager.prototype.getBestOrderableStream=function(){var a=null;var d=0;for(var b=0;b<this.streams.length;b++){var c=this.streams[b].nextRelevance();if(c>d){d=c;a=this.streams[b];}}return a;};SourceManager.prototype.streamExhausted=function(b){var a=this.streams.indexOf(b);if(a===-1){return;}this.streams.splice(a,1);log.info("stream exhausted: "+b.name+"; stream count: "+this.streams.length);if(this.streams.length===0){this.notifyObservers("pendingCountUpdated",0);this.notifyObservers("exhausted");if(this.deliveredCount===0){this.notifyObservers("noResults",this.query);}return;}};SourceManager.prototype.deliver=function(a){log.info("delivering "+a.source_uri+", relevance "+a.relevance);this.entity.addSource(a);this.outstandingOrders--;this.deliveredCount++;if(this.streams.length!==0){this.notifyObservers("pendingCountUpdated",this.outstandingOrders);}};SourceManager.prototype.addStreamForIdentifier=function(a){if(this.identifiersSeen.indexOf(a)!=-1){log.info("skipping identifier: "+a);return;}this.identifiersSeen.push(a);log.info("adding identifier stream for "+a+"; stream count: "+this.streams.length+1);var b=new SindiceIdentifierRecordStream(a,this.query,this.seen);b.addObserver(this);this.streams.push(b);};SourceManager.prototype.addStreamForHomepage=function(b){if(this.homepagesSeen.indexOf(b)!=-1){log.info("skipping homepage: "+b);return;}this.homepagesSeen.push(b);log.info("adding homepage stream for "+b+"; stream count: "+this.streams.length+1);var a=new SindiceHomepageRecordStream(b,this.query,this.identifiersSeen,this.seen);a.addObserver(this);this.streams.push(a);};function RecipeManager(a,b){this.entity=a;this.sourceManager=b;this.appliedRecipe=null;this.topLabel=null;this.topPicture=null;this.topComment=null;var d=this;var c=function(f,e){if(e&&e.label){d[f]=e.label;}else{d[f]=null;}};a.addProperty("label").addObserver({topValueChanged:function(e){c("topLabel",e);}});a.addProperty("comment").addObserver({topValueChanged:function(e){c("topComment",e);}});a.addProperty("picture").addObserver({topValueChanged:function(e){if(e&&e.uris&&e.uris.length>0){d.topPicture=e.uris[0];}else{d.topPicture=null;}}});}RecipeManager.prototype.getRecipe=function(){var g={recipe_version:"1.2",queries:[],sources:[],hidden_properties:[],property_weights:{},hidden_values:[],single_valued_properties:{},state_visibility:{unrated:false,confirmed:false,rejected:false},pageLayout:this.entity.pageLayout,propertiesWithChangedDisplayMode:[],propertiesWithChangedStickyMode:[]};if(this.sourceManager.queryOriginal){g.queries.push(this.sourceManager.queryOriginal);}if(this.entity.newInformationVisible){g.state_visibility.unrated=true;}if(this.entity.confirmedInformationVisible){g.state_visibility.confirmed=true;}if(this.entity.rejectedInformationVisible){g.state_visibility.rejected=true;}var e;var c=[];for(e=0;e<this.entity.sources.length;e++){var a=this.entity.sources[e];var f={};if(a.sourceURI){f.source_uri=a.sourceURI;}if(a.queryPhrase){f.query_phrase=a.queryPhrase;}if(a.queryIdentifier){f.query_identifier=a.queryIdentifier;}if(a.confirmed){f.confirmed=a.confirmed;}if(a.rejected){f.rejected=a.rejected;}if(a.isFromYBOSS){f.yboss=a.isFromYBOSS;}if(a.isFromOKKAM){f.okkam=a.isFromOKKAM;}g.sources.push(f);c.push(a.sourceURI);}if(this.appliedRecipe&&this.appliedRecipe.sources){for(e=0;e<this.appliedRecipe.sources.length;e++){var b=this.appliedRecipe.sources[e];if(c.indexOf(b.source_uri)!==-1){continue;}g.sources.push(b);c.push(b.source_uri);}}for(e=0;e<this.entity.propertyList.length;e++){var h=this.entity.propertyList[e];if(h.displayMode!==this.entity.getDefaultPropertyDisplayModeForLayout()){g.propertiesWithChangedDisplayMode.push({name:h.name,mode:h.displayMode});}if(h.stickToPreviousMode!==this.entity.getDefaultPropertyStickyModeForLayout()){g.propertiesWithChangedStickyMode.push({name:h.name,mode:h.stickToPreviousMode});}if(h.hidden){g.hidden_properties.push(h.name);}if(h.weight!=h.originalWeight){g.property_weights[h.name]=h.weight;}for(var d=0;d<h.values.length;d++){if(!h.values[d].hidden){continue;}var k=h.values[d].toJSON();k.property=h.name;g.hidden_values.push(k);}if(h.inSingleMode){if(h.singleModeValue===true){g.single_valued_properties[h.name]=true;}else{g.single_valued_properties[h.name]=h.singleModeValue.toJSON();}}}return g;};RecipeManager.prototype.applyRecipe=function(n){this.appliedRecipe=n;var k=n.queries[0];this.sourceManager.setQuery(k);this.entity.setNewInformationVisible(Boolean(n.state_visibility.unrated));this.entity.setConfirmedInformationVisible(Boolean(n.state_visibility.confirmed));this.entity.setRejectedInformationVisible(Boolean(n.state_visibility.rejected));var h=[];for(var c=0;c<n.sources.length;c++){var g=n.sources[c];h.push({source_uri:g.source_uri,query_phrase:g.query_phrase,query_identifier:g.query_identifier,yboss:g.yboss,okkam:g.okkam,fetched:function(q){if(this.yboss){q.yboss=true;}if(this.okkam){q.okkam=true;}}});}var p=new ArrayRecordStream(h,this.sourceManager.seen);var e=this;for(var c=0;c<h.length;c++){p.orderRecord(function(q,t){if(q==null){return;}var s=e.entity.addSource(q);for(var r=0;r<n.sources.length;r++){if(n.sources[r].source_uri!=s.sourceURI){continue;}if(n.sources[r].confirmed){s.confirm(true);}if(n.sources[r].rejected){s.reject(true);}break;}});}for(var c=0;c<n.hidden_properties.length;c++){this.entity.addProperty(n.hidden_properties[c]).hide();}for(var f in n.property_weights){if(!n.property_weights.hasOwnProperty(f)){continue;}var d=n.property_weights[f];if(isNaN(parseFloat(d))){continue;}var o=this.entity.addProperty(f);}for(var c=0;c<n.hidden_values.length;c++){var a=n.hidden_values[c];var o=this.entity.addProperty(a.property);var m=o.addValue(a);m.hide();}for(var f in n.single_valued_properties){if(!n.single_valued_properties.hasOwnProperty(f)){continue;}var a=n.single_valued_properties[f];var o=this.entity.addProperty(f);var m=o.addValue(a);o.setSingleValue(m);}this.entity.setPageLayout(n.pageLayout);this.entity.setPropertyDisplayModeOnAllProperties();for(var c=0;c<n.propertiesWithChangedDisplayMode.length;c++){var f=n.propertiesWithChangedDisplayMode[c].name;var b=n.propertiesWithChangedDisplayMode[c].mode;var o=this.entity.getProperty(f);if(!o){o=this.entity.addProperty(f);}o.setDisplayMode(b);}this.entity.setStickToPreviousPropertyOnAllProperties();for(var c=0;c<n.propertiesWithChangedStickyMode.length;c++){var f=n.propertiesWithChangedStickyMode[c].name;var l=n.propertiesWithChangedStickyMode[c].mode;var o=this.entity.getProperty(f);if(!o){o=this.entity.addProperty(f);}o.setStickToPreviousMode(l);}};RecipeManager.prototype.getSnapshot=function(){var a={sources:[],values:{}};if(this.topLabel){a.topLabel=this.topLabel;}if(this.topPicture){a.topPicture=this.topPicture;}if(this.topComment){a.topComment=this.topComment;}for(var c=0;c<this.entity.sources.length;c++){var f=this.entity.sources[c];if(!f.isActive()){continue;}a.sources.push({source_uri:f.sourceURI,source_label:f.sourceLabel,domain:f.domain,date:f.date,total_values:f.valueCount,index:f.getIndex()});}var g=[];for(var c=0;c<this.entity.propertyList.length;c++){var e=this.entity.propertyList[c];if(!e.active){continue;}g.push(e);}g.sort(function(k,h){return k.weight-h.weight;});for(var c=0;c<g.length;c++){var e=g[c];if(e.hasActiveValues()){a.values[e.name]={values:[],displayMode:e.getDisplayMode(),stickyMode:e.getStickToPreviousMode(),weight:e.weight};for(var b=0;b<e.values.length;b++){var d=e.values[b];if(!d.active){continue;}a.values[e.name].values.push(d.toJSON());}}}if(this.entity.pageLayout){a.pageLayout=this.entity.pageLayout;}return a;};RecipeManager.prototype.createPermalink=function(f){var e=this.getRecipe();var a=this.getSnapshot();var d=this.sourceManager.queryOriginal;var b="";var c={recipe:e,snapshot:a,queries:[d],email:b};services.serviceCreatePermalink(c,function(m){var k=sigmaUtilities.getBaseUrl();var h=getURLParam("q");var g=getURLParam("singlesource");var l="q="+encodeURIComponent(h);if(g){l+="&singlesource="+encodeURIComponent(g);}if(!m||typeof(f)!=="function"){return null;}return f(k+"/search?pid="+m,l,h);});};RecipeManager.prototype.loadPermalink=function(b){log.info("invoke loadPermalink with id:["+b+"]");var a=this;services.serviceConfigRequest(b,function(c){log.info("received config");log.info(c);if(!c){alert('Configuration request for PID "'+b+'" failed');return;}a.applyRecipe(c);});};function SigmaUIConfig(a){this.rawFlag=false;if(!a){a="ecsse";}this.sigmaContainerId=a;log.error("id is "+a);this.sigmaNewSourcesListId=a+"-new-sources-list";this.sigmaApprovedSourcesListId=a+"-approved-sources-list";this.sigmaRejectedSourcesListId=a+"-rejected-sources-list";this.sigmaNewSourcesListIdXPath="#"+a+"-new-sources-list";this.sigmaApprovedSourcesListIdXPath="#"+a+"-approved-sources-list";this.sigmaRejectedSourcesListIdXPath="#"+a+"-rejected-sources-list";this.ecsseProfileListId="";this.ecsseProfileListIdXPath="";this.ecsseSourcesContainerXPath="";this.ecsseProfileContainerXPath="";this.ecsseRightBoxXPath="";this.ecsseContainerIdXPath="";this.ecsseSourcesBoxInnerXPath="";this.embededMode=false;this.inReorderPropertiesMode=false;this.propertiesAndValuesRendering=true;this.sourcesFilteredLock=false;this.valuesFilteredLock=false;this.showHideSourcesNumbers=true;this.customRenderedProperties=["picture","identifier","homepage","web page","email","openID","okkamID"];this.filterButtonLabel="which sources";this.unfilterButtonLabel="remove filter";this.unfilterSoloButtonLabel="unsolo";this.pulsateDuration=400;this.pulsateStyle="pulsateStyle";this.pulsateOption={times:2,pulsateStart:function(){jQuery(this).addClass(this.pulsateStyle);},pulsateStop:function(){jQuery(this).removeClass(this.pulsateStyle);}};this.pictureFunctions={layout1:{single:{loadFunction:function(b){imgLoad(b,"oryginal");imgLoad(b,"width",600);},errorFunction:function(b){imgError(b,40);}},list:{loadFunction:function(b){imgLoad(b,"oryginal");imgLoad(b,"width",600);},errorFunction:function(b){imgError(b,40);}},compact:{loadFunction:function(b){imgLoad(b,"height",100,true);},errorFunction:function(b){imgError(b,40);}},hidden:{loadFunction:function(b){},errorFunction:function(b){}}},layout2:{single:{loadFunction:function(b){imgLoad(b,"oryginal");imgLoad(b,"width",40);},errorFunction:function(b){imgError(b,40);}},list:{loadFunction:function(b){imgLoad(b,"oryginal");imgLoad(b,"width",40);},errorFunction:function(b){imgError(b,40);}},compact:{loadFunction:function(b){imgLoad(b,"height",40,true);},errorFunction:function(b){imgError(b,40);}},hidden:{loadFunction:function(b){},errorFunction:function(b){}}},layout3:{single:{loadFunction:function(b){imgLoad(b,"width",600);},errorFunction:function(b){imgError(b,40);}},list:{loadFunction:function(b){imgLoad(b,"width",600);},errorFunction:function(b){imgError(b,40);}},compact:{loadFunction:function(b){imgLoad(b,"height",40);},errorFunction:function(b){imgError(b,40);}},hidden:{loadFunction:function(b){},errorFunction:function(b){}}}};this.viewsClasses={layout1:{list:{entityContainer:"fl clearLeft  bottomSeparator entityNotSticky",propertyContainer:"propertyInline propertyWidth",propertyLabelContainer:"fr propertyTextAlignRight propertyLabelContainerFixedWidth",valuesContainer:"valuesInline",valueContainer:"valueBlock",valueLabelContainer:"fl",separatorContainer:"thinSeparatorBlock",valueButtonsContainer:"valueButtons-layout1-list rctl rctr rcbr",propertyButtonsContainer:"propertyButtons-layout1-list rctl rctr rcbr"},compact:{entityContainer:"fl clearLeft bottomSeparator entityNotSticky",propertyContainer:"propertyInline propertyWidth ",propertyLabelContainer:"fr propertyTextAlignRight",valuesContainer:"valuesInline",valueContainer:"valueInline",valueLabelContainer:"",separatorContainer:"thinSeparatorBlock",valueButtonsContainer:"valueButtons-layout1-compact rctl rctr rcbr",propertyButtonsContainer:"propertyButtons-layout1-compact rctl rctr rcbr"}},layout2:{list:{entityContainer:"fl  smallerFont entitySticky",propertyContainer:"propertyBlock fl",propertyLabelContainer:"fr propertyTextAlignRight",valuesContainer:"fl",valueContainer:"valueBlock",valueLabelContainer:"fl",separatorContainer:"thinSeparatorInline",valueButtonsContainer:"valueButtons-layout2-list rctl rctr rcbr",propertyButtonsContainer:"propertyButtons-layout2-list rctl rctr rcbr"},compact:{entityContainer:"fl smallerFont entitySticky",propertyContainer:"propertyInline",propertyLabelContainer:"fr propertyTextAlignRight",valuesContainer:"valuesInline",valueContainer:"valueInline",valueLabelContainer:"",separatorContainer:"thinSeparatorInline",valueButtonsContainer:"valueButtons-layout2-compact rctl rctr rcbr",propertyButtonsContainer:"propertyButtons-layout2-compact rctl rctr rcbr"}},layout3:{list:{entityContainer:"fl clearLeft bottomSeparator entityNotSticky",propertyContainer:"propertyInline propertyWidth",propertyLabelContainer:"fl",valuesContainer:"valuesBlock valuesMargin",valueContainer:"valueBlock",valueLabelContainer:"fl",separatorContainer:"thinSeparatorBlock",valueButtonsContainer:"valueButtons-layout3-list rctl rctr rcbr",propertyButtonsContainer:"propertyButtons-layout3-list rctl rctr rcbr"},compact:{entityContainer:"fl clearLeft bottomSeparator entityNotSticky",propertyContainer:"propertyInline",propertyLabelContainer:"fl",valuesContainer:"valuesInline",valueContainer:"valueInline",valueLabelContainer:"",separatorContainer:"thinSeparatorBlock",valueButtonsContainer:"valueButtons-layout3-compact rctl rctr rcbr",propertyButtonsContainer:"propertyButtons-layout3-compact rctl rctr rcbr"}}};this.viewsClasses.layout1.hidden=this.viewsClasses.layout1.list;this.viewsClasses.layout2.hidden=this.viewsClasses.layout2.list;this.viewsClasses.layout3.hidden=this.viewsClasses.layout3.list;this.viewsClasses.layout1.single=this.viewsClasses.layout1.list;this.viewsClasses.layout2.single=this.viewsClasses.layout2.compact;this.viewsClasses.layout3.single=this.viewsClasses.layout3.list;this.propertyOrValueSideMargin=2;jQuery.fn.qtip.styles.sigmaTooltip1={width:300,padding:2,background:"#fff",color:"#000",textAlign:"center",border:{width:1,radius:5,color:"#4297D7"},tip:{corner:"bottomRight",size:{x:20,y:15}},name:"blue"};this.websnapr={domain:"http://images.websnapr.com/",key:"w0LZUS56kxN8"};this.websnapr;this.hideHeader=false;this.hideFooter=false;this.hideSearchbar=false;this.hideBottomMessage=false;this.showFakeSearchbar=false;this.disableHoverOverProperties=false;this.disableHoverOverValues=false;this.dragMode=true;this.showNotifications=false;}function SigmaUITemplates(a){if(!a){this.config={};}else{this.config=a;}var c=[],b=0;c[b++]='<div class="fl unrejectSourceButton buttonContainer" >';c[b++]='<a class="unrejectSource action-button ui-state-default action-button-icon-right ui-corner-all" ';c[b++]='href="javascript:void(0);" title="confirm">';c[b++]='<span class="ui-icon ui-icon-check"></span>unreject';c[b++]="</a>";c[b++]="</div>";this.unrejectSourceButtonTemplate=c.join("");c=[];b=0;c[b++]='<div class="fl unapproveButton buttonContainer" >';c[b++]='<a class="unconfirmSource action-button ui-state-default action-button-icon-right ui-corner-all" ';c[b++]='href="javascript:void(0);" title="unconfirm">';c[b++]='<span class="ui-icon ui-icon-check"></span>unapprove';c[b++]="</a>";c[b++]="</div>";this.unapproveButtonTemplate=c.join("");c=[];b=0;c[b++]='<div class="fl dehighlightButton buttonContainer buttonContainerFirst" >';c[b++]='<a class="dehighlightSource action-button ui-state-highlight action-button-icon-right ui-corner-all" ';c[b++]='href="javascript:void(0);" title="highlight values" style="display:none;">';c[b++]='<span class="ui-icon ui-icon-unlocked"></span>'+this.config.unfilterSoloButtonLabel;c[b++]="</a>";c[b++]="</div>";this.dehighlightButtonTemplate=c.join("");c=[];b=0;c[b++]='<div class="fl highlightButton buttonContainer" >';c[b++]='<a class="highlightSource action-button ui-state-default action-button-icon-right ui-corner-all" ';c[b++]='href="javascript:void(0);" title="highlight values">';c[b++]='<span class="ui-icon ui-icon-locked"></span>solo';c[b++]="</a>";c[b++]="</div>";this.highlightButtonTemplate=c.join("");c=[];b=0;c[b++]='<div class="fl approveButton buttonContainer" >';c[b++]='<a class="confirmSource action-button ui-state-default action-button-icon-right ui-corner-all" ';c[b++]='href="javascript:void(0);" title="confirm">';c[b++]='<span class="ui-icon ui-icon-check"></span>approve';c[b++]="</a>";c[b++]="</div>";this.approveButtonTemplate=c.join("");c=[];b=0;c[b++]='<div class="fl confirmSourceFromTheSameDomainButton buttonContainer" >';c[b++]='<a class="confirmSourceFromTheSameDomain action-button ui-state-default action-button-icon-right1 ui-corner-all" ';c[b++]='href="javascript:void(0);" title="confirm all from the same domain">';c[b++]='<span class="ui-icon ui-icon-check"></span>';c[b++]='<span class="ui-icon1 ui-icon-check"></span>&nbsp;';c[b++]="</a>";c[b++]="</div>";this.confirmSourceFromTheSameDomainButtonTemplate=c.join("");c=[];b=0;c[b++]='<div class="fl rejectButton buttonContainer" >';c[b++]='<a class="rejectSource action-button ui-state-default action-button-icon-right ui-corner-all" ';c[b++]='href="javascript:void(0);" title="reject">';c[b++]='<span class="ui-icon ui-icon-close"></span>reject';c[b++]="</a>";c[b++]="</div>";this.rejectButtonTemplate=c.join("");c=[];b=0;c[b++]='<div class="fl rejectSourceFromTheSameDomainButton buttonContainer buttonContainerLast" >';c[b++]='<a class="rejectSourceFromTheSameDomain action-button ui-state-default action-button-icon-right1 ui-corner-all" ';c[b++]='href="javascript:void(0);" title="reject all from the same domain">';c[b++]='<span class="ui-icon ui-icon-close"/>';c[b++]='<span class="ui-icon1 ui-icon-close"></span>&nbsp;';c[b++]="</a>";c[b++]="</div>";this.rejectSourceFromTheSameDomainButtonTemplate=c.join("");this.rejectPropertyButtonTemplate='<div class="fl buttonContainer buttonContainerLast" ><a class="rejectProperty action-button ui-state-default action-button-icon-right ui-corner-all" href="javascript:void(0);" title="hide property"><span class="ui-icon ui-icon-close"></span>&nbsp;</a></div>';this.allValuesPropertyButtonTemplate='<div class="fl buttonContainer" ><a class="allValuesProperty action-button ui-state-default action-button-icon-right ui-corner-all" style="display:none;" href="javascript:void(0);" title="all values"><span class="ui-icon ui-icon-arrowthickstop-1-e" ></span>show all</a></div>';this.topValuePropertyButtonTemplate='<div class="fl buttonContainer" ><a class="topValueProperty action-button ui-state-default action-button-icon-right ui-corner-all" href="javascript:void(0);" title="top value"><span class="ui-icon ui-icon-arrowthickstop-1-e" ></span>show top</a></div>';this.highlightPropertyButtonTemplate='<div class="fl buttonContainer" ><a class="highlightProperty action-button ui-state-default action-button-icon-right ui-corner-all" href="javascript:void(0);" title="filter sources"><span class="ui-icon ui-icon-locked"></span>&nbsp;</a></div>';this.dehighlightPropertyButtonTemplate='<div class="fl buttonContainer" ><a style="display:none;" class="dehighlightProperty action-button ui-state-error action-button-icon-right ui-corner-all" href="javascript:void(0);" title="filter sources"><span class="ui-icon ui-icon-unlocked"></span>&nbsp;</a></div>';this.singleViewPropertyButtonTemplate='<div class="fl buttonContainer buttonContainerFirst" ><a class="singleViewProperty action-button ui-state-default action-button-icon-right ui-corner-all" href="javascript:void(0);" title="show just top value"><span class="ui-icon ui-icon-bullet"></span>&nbsp;</a></div>';this.compactViewPropertyButtonTemplate='<div class="fl buttonContainer" ><a class="compactViewProperty action-button ui-state-default action-button-icon-right ui-corner-all" href="javascript:void(0);" title="show values inline"><span class="ui-icon ui-icon-grip-dotted-horizontal"></span>&nbsp;</a></div>';this.listViewPropertyButtonTemplate='<div class="fl buttonContainer" ><a class="listViewProperty action-button ui-state-default action-button-icon-right ui-corner-all" href="javascript:void(0);" title="show values as a list"><span class="ui-icon ui-icon-grip-dotted-vertical"></span>&nbsp;</a></div>';this.hideViewPropertyButtonTemplate='<div class="fl buttonContainer" ><a class="hideViewProperty action-button ui-state-default action-button-icon-right ui-corner-all" href="javascript:void(0);" title="remove property"><span class="ui-icon ui-icon-trash"></span>&nbsp;</a></div>';this.stickToPreviousOne1ButtonTemplate='<div class="fl buttonContainer" ><a class="stickToPreviousOne stickToPreviousOne1 action-button ui-state-default action-button-icon-right ui-corner-all" href="javascript:void(0);" title="stick to previous property"><span class="ui-icon ui-icon-arrowreturnthick-1-n"></span>&nbsp;</a></div>';this.stickToPreviousOne2ButtonTemplate='<div class="fl buttonContainer" ><a class="stickToPreviousOne stickToPreviousOne2 action-button ui-state-default action-button-icon-right ui-corner-all" style="display:none;" href="javascript:void(0);" title="disable stick to previous property"><span class="ui-icon ui-icon-arrowreturnthick-1-s"></span>&nbsp;</a></div>';this.stickToPreviousOne3ButtonTemplate='<div class="fl buttonContainer" ><a class="stickToPreviousOne stickToPreviousOne3 action-button ui-state-default action-button-icon-right ui-corner-all" style="display:none;" href="javascript:void(0);" title="disable stick to previous property"><span class="ui-icon ui-icon-arrowreturnthick-1-w"></span>&nbsp;</a></div>';this.moreValuesCompactViewButtonTemplate='<div class="fl moreButtonCompactView" ><a class="moreValuesInCompactView smallerFont" "href="javascript:void(0);">show @number@ more ...</a></div>';this.propertyButtonsTemplate='<div class="propertyButtonsContainer">'+this.stickToPreviousOne1ButtonTemplate+this.stickToPreviousOne2ButtonTemplate+this.stickToPreviousOne3ButtonTemplate+this.singleViewPropertyButtonTemplate+this.compactViewPropertyButtonTemplate+this.listViewPropertyButtonTemplate+this.hideViewPropertyButtonTemplate+"</div>";this.rejectValueButtonTemplate='<div class="fl buttonContainer buttonContainerFirst" ><a class="rejectValue action-button ui-state-default action-button-icon-right ui-corner-all" href="javascript:void(0);" title="hide value"><span class="ui-icon ui-icon-trash" ></span>hide value</a></div>';this.singleValueButtonTemplate='<div class="fl buttonContainer" ><a class="singleValue action-button ui-state-default action-button-icon-right ui-corner-all" href="javascript:void(0);" title="just this value"><span class="ui-icon ui-icon-bullet"></span>just this value</a></div>';this.highlightValueButtonTemplate='<div class="fl buttonContainer" ><a class="highlightValue action-button ui-state-default action-button-icon-right ui-corner-all" href="javascript:void(0);" title="filter sources"><span class="ui-icon ui-icon-locked"></span>'+this.config.filterButtonLabel+"</a></div>";this.dehighlightValueButtonTemplate='<div class="fl buttonContainer" ><a class="dehighlightValue action-button ui-state-error action-button-icon-right ui-corner-all" href="javascript:void(0);" title="filter sources" style="display:none;" ><span class="ui-icon ui-icon-unlocked"></span>'+this.config.unfilterButtonLabel+"</a></div>";this.smallValueSourcesFilterIndicator='<div class="fl smallValueSourcesFilterIndicator" ><div><a class="dehighlightValue small-button ui-state-error small-button-icon-right ui-corner-all" href="javascript:void(0);" title="filter sources"><span class="ui-icon ui-icon-unlocked"></span>&nbsp;</a></div></div>';this.rejectValueSourcesButtonTemplate='<div class="fl buttonContainer" ><a class="rejectValueSources action-button ui-state-default action-button-icon-right ui-corner-all" href="javascript:void(0);" title="filter sources" ><span class="ui-icon ui-icon-close"/></span>reject sources</a></div>';this.openDocumentSourceButtonTemplate='<div class="fl buttonContainer" ><a style="display:none;" class="openDocumentSource action-button ui-state-default action-button-icon-right ui-corner-all" href="javascript:void(0);" title="openDocumentSource" ><span class="ui-icon ui-icon-link"></span>&nbsp;</a></div>';this.valuesButtonsTemplate='<div class="valueButtonsContainer"><div>'+this.rejectValueButtonTemplate+this.singleValueButtonTemplate+'<div class="fl vertical-bar"></div>'+this.highlightValueButtonTemplate+this.dehighlightValueButtonTemplate+this.rejectValueSourcesButtonTemplate+this.openDocumentSourceButtonTemplate+"</div></div>";this.unfetchedValuesButtonTemplate='<div class="unfetchedValuesButton"><a class="unfetchedValuesButton action-button ui-state-default action-button-icon-right ui-corner-all" href="javascript:void(0);" title="fetch more values"><span class="ui-icon ui-icon-arrowthickstop-1-w"></span>show @n@</a></div>';this.soloIndicator='<div id="valueFilterIndicator" class="filtered"><div class="indicatorMsg" >Properties and values filtered for <b>source</b>:<span></span></div><div class="indicatorButtonRight" ><a class="removePropertyAndValueFilterBoxButton action-button ui-state-highlight action-button-icon-right ui-corner-all" href="javascript:void(0);"><span class="ui-icon ui-icon-unlocked"/>'+this.config.unfilterSoloButtonLabel+'</a></div><div class="br"></div></div>';this.noResultsIndicator='<div class="noResultsIndicator" style="display: none;"><div class="indicatorBorder"><div class="msg">There was no results for this query</div><div class="noResultsIndicatorButton">X</div></div></div>';this.reorderPropertiesIndicator='<div style="display:none;" class="reorderPropertiesModeIndicator"><div class="indicatorMsg">You can reorder properties by dragging them up and down. Click "Done" when finished.<br /><input id="inReorderPropertiesModeHideValues" type="checkbox" title="show/hide values when in reorder properties mode" />Hide values.<br /><input id="inReorderPropertiesModeDisableButtons" type="checkbox" title="show/hide values when in reorder properties mode" />Disable buttons.</div><div class="indicatorButtonRight" ><a class="reorderPropertiesOff action-button ui-state-default action-button-icon-right ui-corner-all"><span class="ui-icon ui-icon-arrow-4-diag"></span>Done</a></div><div class="br"></div></div>';this.howToLearnIndicator='<span class="big">Show your web data in Sigma, learn <a class="sigmaHelpLink" href="help.html" >how</a></span><br /><span class="small">Get this sigma <a class="openPermalink">embedded</a>, in <a class="openPermalink">rdf</a> or in <a class="openPermalink">json</a> format.</span>';this.howToLearnIndicatorSindice='<span class="big">This is a view of what seem to be the "main topic",</span><br /><span class="small">use the other tabs to see the full information contained in this document.<br />This view is based on </span><br /><a href="http://sig.ma"><img src="images/icons/sig.ma-about.gif" /></a>';c=[];b=0;c[b++]='<div class="viewsAndLayoutsDialog" title="Layouts and views" >';c[b++]='<div class="optionsText">';c[b++]="Click on image in order to choose a layout.";c[b++]="</div>";c[b++]='<div class="fl layoutImg">';c[b++]='<a href="javascript:void(0);"  title="layout1"><img src="images/layouts/layout-regular.png"/></a>';c[b++]="</div>";c[b++]='<div class="fl layoutImg marginLeft">';c[b++]='<a href="javascript:void(0);" title="layout2"><img src="images/layouts/layout-compact.png"  /></a>';c[b++]="</div>";c[b++]='<div class="fl" style="margin:4px;">';c[b++]='<label class="fl" for="hideShowSourcesNumbers">Check/Uncheck to show/hide sources numbers</label>';c[b++]='<input class="fl" id="hideShowSourcesNumbers" type="checkbox" title="show/hide sources reference numbers" />';c[b++]="</div>";c[b++]='<div style="clear:both;"></div>';c[b++]='<div class="fl" style="margin:4px;">';c[b++]='<label class="fl" for="okkamSugestions">okkam suggestions</label>';c[b++]='<input type="checkbox" id="okkamSugestions"/>';c[b++]="</div>";c[b++]="</div>";this.layoutSwitchDialogTemplate=c.join("");c=[];b=0;c[b++]='<div class="optionsText">';c[b++]="There are 3 ways of showing SIGMA. Permalink, Fresh and Widget.</div>";c[b++]="</div>";c[b++]='<div class="sigmaPermalinkTabs" style="border:none;" >';c[b++]="<ul>";c[b++]="<li>";c[b++]='<a href="#sigmaPermalinksTab-1">Permalink</a>';c[b++]="</li>";c[b++]="<li>";c[b++]='<a href="#sigmaPermalinksTab-2">Fresh</a>';c[b++]="</li>";c[b++]="<li>";c[b++]='<a href="#sigmaPermalinksTab-3">Embedded</a>';c[b++]="</li>";c[b++]="</ul>";c[b++]='<div id="sigmaPermalinksTab-1" class="sigmaPermalinksTabContainer" >';c[b++]='<span class="fl">To comeback to SIGMA as you see it now use <a href="@url@">link</a>:</span>';c[b++]='<textarea class="widgetUrlCode">@url@</textarea>';c[b++]='<span class="fl">To create raw version of this SIGMA use <a href="@urlRaw@">link</a>:</span>';c[b++]='<textarea class="widgetUrlCode">@urlRaw@</textarea>';c[b++]='<span class="fl">To get this SIGMA in RDF use <a class="sourceAsRdf" href="@urlRdf@">link</a>:</span>';c[b++]='<textarea class="widgetUrlCode">@urlRdf@</textarea>';c[b++]='<span class="fl">To get this SIGMA in JSON use <a class="sourceAsJson" href="@urlJson@">link</a>:</span>';c[b++]='<textarea class="widgetUrlCode">@urlJson@</textarea>';c[b++]="</div>";c[b++]='<div id="sigmaPermalinksTab-2" class="sigmaPermalinksTabContainer">';c[b++]='<span class="fl">To make FRESH SIGMA as you see it now use <a href="@freshUrl@">link</a>:</span>';c[b++]='<textarea class="widgetUrlCode">@freshUrl@</textarea>';c[b++]='<span class="fl">To create raw version of FRESH SIGMA use <a href="@freshUrlRaw@">link</a>:</span>';c[b++]='<textarea class="widgetUrlCode">@freshUrlRaw@</textarea>';c[b++]='<span class="fl">To get FRESH SIGMA in RDF use <a class="sourceAsRdf" href="@freshUrlRdf@">link</a>:</span>';c[b++]='<textarea class="widgetUrlCode">@freshUrlRdf@</textarea>';c[b++]='<span class="fl">To get FRESH SIGMA in JSON use <a class="sourceAsJson" href="@freshUrlJson@">link</a>:</span>';c[b++]='<textarea class="widgetUrlCode">@freshUrlJson@</textarea>';c[b++]="</div>";c[b++]='<div id="sigmaPermalinksTab-3" class="sigmaPermalinksTabContainer">';c[b++]="To display sigma widget on your page simply copy lines below and put them in your page html code in place where you want the widget.";c[b++]="<br />";c[b++]="<b>Sigma widget will use information only from approved sources !</b>";c[b++]='<textarea class="widgetCode">';c[b++]='<script src="@path@/js/sigma-widget.js"  type="text/javascript"><\/script>';c[b++]='\n<script type="text/javascript" sigma="true" >';c[b++]="\n       <!--";c[b++]='\n       createSigma("@id@",{width:600,height:400});';c[b++]="\n       // the config object (with dimensions) is optional";c[b++]="\n       //-->";c[b++]="\n<\/script>";c[b++]="</textarea>";c[b++]="<br />";c[b++]='<a class="sigma-widget-preview">Preview</a>';c[b++]="</div>";c[b++]='<div class="br"></div>';c[b++]="</div>";this.old_permalinkDialogTemplate=c.join("");c=[];b=0;c[b++]='<div class="optionsText">';c[b++]="There are 3 ways of showing SIGMA:</div>";c[b++]="</div>";c[b++]='<div class="permalinkOptions">';c[b++]='<div class="optionsTextLabel">Permalink based:</div>';c[b++]='<div class="fl">';c[b++]="<div>";c[b++]='<textarea class="widgetUrlCode fl" >@url@</textarea>';c[b++]='<div class="br"></div>';c[b++]="</div>";c[b++]='<div style="margin-top:2px;">';c[b++]='<a class="sourceAsRdf"  href="@urlRdf@"><span>RDF</span></a>';c[b++]='<a class="sourceAsJson" href="@urlJson@"><span>JSON</span></a>';c[b++]='<a class="urlRss" href="@urlRss@"><span>RSS FEED</span></a>';c[b++]='<a class="urlAtom" href="@urlAtom@"><span>ATOM FEED</span></a>';c[b++]='<a class="urlTwitter" title="@url@"><span>TINY URL</span></a>';c[b++]="</div>";c[b++]="</div>";c[b++]='<div class="widgetRDFJSONCode fl" title="Will contain information only from approved sources">';c[b++]="Information only from <b>approved</b> sources.";c[b++]="</div>";c[b++]='<div class="br"></div>';c[b++]="</div>";c[b++]='<div class="permalinkOptions">';c[b++]='<div class="optionsTextLabel">Query  based:</div>';c[b++]='<div class="fl">';c[b++]="<div>";c[b++]='<textarea class="fl widgetUrlCode" >@freshUrl@</textarea>';c[b++]='<div class="br"></div>';c[b++]="</div>";c[b++]='<div style="margin-top:2px;">';c[b++]='<a class="sourceAsRdf" href="@freshUrlRdf@"><span>RDF</span></a>';c[b++]='<a class="sourceAsJson" href="@freshUrlJson@"><span>JSON</span></a>';c[b++]='<a class="urlTwitter" title="@freshUrl@"><span>TINY URL</span></a>';c[b++]="</div>";c[b++]="</div>";c[b++]='<div class="widgetRDFJSONCode fl" title="Might contain information from new unapproved sources !" >';c[b++]='Information from new <b style="color:red;">unapproved</b> sources !';c[b++]="</div>";c[b++]='<div class="br"></div>';c[b++]="</div>";c[b++]='<div class="permalinkOptions">';c[b++]='<div class="optionsTextLabel">Widget:</div>';c[b++]='<textarea class="widgetCode fl">';c[b++]='<script src="@path@/js/sigma-widget.js"  type="text/javascript"><\/script>';c[b++]='\n<script type="text/javascript" sigma="true" >';c[b++]="\n       <!--";c[b++]='\n       createSigma("@id@",';c[b++]="\n       {width:600,height:400});";c[b++]="\n       // the config object (with dimensions) is optional";c[b++]="\n       //-->";c[b++]="\n<\/script>";c[b++]="</textarea>";c[b++]='<div class="widgetRDFJSONCode fl"><a class="sigma-widget-preview" title=" Click to see the preview of the widget.">Preview</a></div>';c[b++]='<div class="permalinkOptionsDesc">';c[b++]="To display sigma widget on your page simply copy lines below and put them in your page html code in place where you want the widget. ";c[b++]="Sigma widget will use information <b>only from approved</b> sources!";c[b++]="</div>";c[b++]='<div class="br"></div>';c[b++]="</div>";c[b++]='<div class="permalinkOptionsSeparator"></div>';c[b++]='<div class="permalinkOptions emailNotifications" style="display:none;">';c[b++]='<div class="optionsText">Permalink [@id@] based sigma alerts:</div>';c[b++]='<div class="optionsTextLabel">Email:</div>';c[b++]='<div class="fl">';c[b++]='<input type="text" class="fl widgetEmailBox pidEmail" style="margin:0 0 0 2px;" value="" />';c[b++]='<div class="fl" style="margin:2px 0 0 4px;">';c[b++]='<a style="padding-top:.3em; padding-bottom: .3em;" class="signupToPidNotifications action-button ui-state-default action-button-icon-right ui-corner-all"><span class="ui-icon ui-icon-mail-closed"/>Signup</a>';c[b++]="</div>";c[b++]="</div>";c[b++]='<div class="widgetRDFJSONCode fl" style="margin:2px 0 0 4px;">';c[b++]='<img class="signupToPidNotificationIndicator" style="display:none; width:22px;height:22px;" src="images/icons/ajax-loader.gif" />';c[b++]='<span class="signupToPidNotificationIndicatorMsg" style="display:none;" ></span>';c[b++]='<span class="signupToPidNotificationIndicatorMsgDetail" style="display:none;" ></span>';c[b++]="</div>";c[b++]='<div class="optionsText">Query [@query@] based sigma alerts:</div>';c[b++]='<div class="optionsTextLabel">Email:</div>';c[b++]='<div class="fl">';c[b++]='<input type="text" class="fl widgetEmailBox queryEmail" style="margin:0 0 0 2px;" value="" />';c[b++]='<div class="fl" style="margin:2px 0 0 4px;">';c[b++]='<a style="padding-top:.3em; padding-bottom: .3em;" class="signupToQueryNotifications action-button ui-state-default action-button-icon-right ui-corner-all"><span class="ui-icon ui-icon-mail-closed"/>Signup</a>';c[b++]="</div>";c[b++]="</div>";c[b++]='<div class="widgetRDFJSONCode fl" style="margin:2px 0 0 4px;">';c[b++]='<img class="signupToQueryNotificationIndicator" style="display:none; width:22px;height:22px;" src="images/icons/ajax-loader.gif" />';c[b++]='<span class="signupToQueryNotificationIndicatorMsg" style="display:none;" ></span>';c[b++]='<span class="signupToQueryNotificationIndicatorMsgDetail" style="display:none;" ></span>';c[b++]="</div>";c[b++]='<div class="permalinkOptionsDesc">';c[b++]="If you want to know when something change in your sigma provide an email address.";c[b++]="<br />We will send you an email every time when something change in your sigma";c[b++]="<br/>We WILL NOT use your email for any other purpose.";c[b++]="<br/>We WILL NOT give your email to anybody.";c[b++]="<br/>You can always disable this feature by single click at cancellation link attached to every email.</a>.";c[b++]="</div>";c[b++]="</div>";c[b++]='<div class="permalinkOptionsSeparator"></div>';c[b++]='<div class="permalinkOptions">';c[b++]='<div class="optionsText" >To find an info about some more advanced options see <a style="color:#2D8FB4;" class="helpLink" href="" >help</a>.</div>';c[b++]="</div>";this.permalinkDialogTemplate=c.join("");c=[];b=0;c[b++]='<div class="header sidesTopBorder">';c[b++]='<div id="sigma-logo">';c[b++]='<a href="/"><img src="images/icons/sigma-logo-h70.png" alt="Sindice" title="" /></a>';c[b++]="</div>";c[b++]='<div id="menuTop" class="column span-109 last">';c[b++]='<ul id="nav-left-piece" class="_">';c[b++]='<li class="_"><a href="help.html">Help</a></li>';c[b++]='<li class="_"><a href="about.html">About</a></li>';c[b++]='<li class="_" ><a href="http://sindice.com/main/forum" style="padding-right:18px;">Forum</a></li>';c[b++]="</ul>";c[b++]="<br />";c[b++]='<div id="sigmaVersion" style="float:right; margin-right:8px; font-size:11px; color:#A6C9E2; "></div>';c[b++]="</div>";c[b++]='<div class="cut">&nbsp;</div>';c[b++]="</div>";this.headerTemplate=c.join("");c=[];b=0;c[b++]='<div class="sigmaTrashBinDialog" title="Trash bin">';c[b++]='<div class="optionsText">';c[b++]="Click on value or property to restore it.";c[b++]="</div>";c[b++]='<ul class="properties"></ul>';c[b++]="</div>";this.sigmaTrashBinDialogTemplate=c.join("");c=[];b=0;c[b++]='<div id="sigmaOptionsDialog" >';c[b++]='<div id="sigmaOptionsTabs" >';c[b++]="<ul>";c[b++]="<li>";c[b++]='<a href="#sigmaOptionsTab-2">Layouts</a>';c[b++]="</li>";c[b++]="<li>";c[b++]='<a href="#sigmaOptionsTab-4">Deleted properties and values</a>';c[b++]="</li>";c[b++]='<li class="optionsTabClose" style="float:right;margin:4px 2px;">';c[b++]='<span class="ui-icon ui-icon-close">&nbsp;</span>';c[b++]="</li>";c[b++]="</ul>";c[b++]='<div id="sigmaOptionsTab-2" class="sigmaOptionsTabContainer">';c[b++]=this.layoutSwitchDialogTemplate;c[b++]="</div>";c[b++]='<div id="sigmaOptionsTab-4" class="sigmaOptionsTabContainer">';c[b++]=this.sigmaTrashBinDialogTemplate;c[b++]="</div>";c[b++]='<div class="br"></div>';c[b++]="</div>";c[b++]="</div>";this.sigmaOptionsDialogTemplate=c.join("");c=[];b=0;c[b++]='<div class="searchBar">';c[b++]='<div class="searchBarInner">';c[b++]='<form action="search" method="get" style="float:left;padding:0;margin:0;">';c[b++]='<input style="float:left; width:275px; border:1px solid #A1C98B; height:19px;" id="q" onfocus="this.select(); return true;" type="text" name="q" size="45" />';c[b++]="</form>";c[b++]='<div class="topButton" style="float:left;">';c[b++]='<a class="moreSources" ><span>Add More Info</span></a>';c[b++]="</div>";c[b++]='<div class="topButton" style="float:left;">';c[b++]='<a class="newSigma" ><span>Start New</span></a>';c[b++]="</div>";c[b++]='<div class="menuButton" style="float:right;margin-top:0.4em;" >';c[b++]='<a class="permLinkSourcesBoxButton action-button ui-state-default action-button-icon-right ui-corner-all"><span class="ui-icon ui-icon-link">&nbsp;</span>Use it</a>';c[b++]="</div>";c[b++]='<div class="menuButton" style="float:right;margin-top:0.4em; position:relative;" >';c[b++]='<a class="sigmaOptions action-button ui-state-default action-button-icon-right ui-corner-all"><span class="ui-icon ui-icon-gear"></span>Options</a>';c[b++]='<div style="display:none;" class="sigmaOptionsContainer">';c[b++]=this.sigmaOptionsDialogTemplate;c[b++]="</div>";c[b++]="</div>";c[b++]='<div class="menuButton" style="float:right;margin-top:0.4em;" >';c[b++]='<a class="reorderPropertiesOn action-button ui-state-default action-button-icon-right ui-corner-all"><span class="ui-icon ui-icon-arrow-4-diag"></span>Order</a>';c[b++]="</div>";c[b++]='<div style="clear:both;"></div>';c[b++]="</div>";c[b++]="</div>";this.searchTemplate=c.join("");c=[];b=0;c[b++]='<div class="searchBar">';c[b++]='<form action="search" method="get">';c[b++]='<input style="float:left; width:275px; border:2px solid #A1C98B;" id="q" onfocus="this.select(); return true;" type="text" name="q" size="45" />';c[b++]="</form>";c[b++]='<div class="topButton">';c[b++]='<a href="javascript:void(0);"><span>Search</span></a>';c[b++]="</div>";c[b++]='<div style="clear:both"></div>';c[b++]="</div>";this.fakeSearchTemplate=c.join("");c=[];b=0;c[b++]='<div class="fullBorder" >';c[b++]='<div  class="column span-6a">';c[b++]="<p>";c[b++]='<a href="">Home</a> |';c[b++]='<a href="help.html">Help</a> |';c[b++]='<a href="http://sindice.com/main/forum">Forum</a>';c[b++]="</p>";c[b++]="</div>";c[b++]='<div style="text-align: right" class="column span-6 last">';c[b++]='<div class="fl" style="margin-top:10px;">';c[b++]='<a href="http://blog.sindice.com">Blog</a> |';c[b++]='<a href="http://sindice.com/developers/feedback">Contact</a> |';c[b++]="Copyright &copy; 2009 - Powered by ";c[b++]="</div>";c[b++]='<div class="fl" style="margin:9px 4px 0 4px;">';c[b++]='<a href="http://sindice.com/"><img title="Sindice" src="images/logo/sindice.png" alt="sindice logo"/></a> ';c[b++]="</div>";c[b++]='<div class="fl" style="margin:10px 4px 0 0;">';c[b++]='and other services. See <a href="about.html">About</a>.';c[b++]="</div>";c[b++]="</div>";c[b++]='<div class="br"></div>';c[b++]="</div>";this.footerTemplate=c.join("");c=[];b=0;c[b++]='<div id="coverLight"><!-- --></div>';c[b++]='<div id="coverDark"><!-- --></div>';this.invisibleElementsTemplate=c.join("");c=[];b=0;c[b++]='<div class="ecsseProfileBox">';c[b++]='<div style="display:none;" class="expandToFullView">See all we know about "<span id="fullSigmaView"></span>" with the <a href="" target="_blank">Full Sigma Search</a></div>';c[b++]='<div class="ecsseProfileBoxInner">';c[b++]='<div class="ecsseProfile ecsseWidgetLoading">';c[b++]='<div class="br"></div>';c[b++]=this.reorderPropertiesIndicator;c[b++]='<div style="display:none;" class="layout1TopLabelContainer layout2TopLabelContainer  entityLabel entityLabelStyle" />';c[b++]='<div style="display:none;" class="layout1TopPictureContainer layout1TopCommentContainer entityPictureAndComment entityPictureAndCommentStyle">';c[b++]='<img style="display:none;" class="entityPicture entityPictureStyle" />';c[b++]='<p style="display:none;" class="entityComment entityCommentStyle"></p>';c[b++]='<div class="br"></div>';c[b++]='<div class="separator" />';c[b++]="</div>";c[b++]=this.noResultsIndicator;c[b++]=this.soloIndicator;c[b++]='<div class="br"></div>';c[b++]='<div class="profileLeft profileLeftInvisible">';c[b++]='<div style="display:none;" class="layout2TopPictureContainer  entityPictureAndComment entityPictureAndCommentStyle">';c[b++]='<img style="display:none;" class="entityPicture entityPictureStyle" />';c[b++]='<div class="br"></div>';c[b++]="</div>";c[b++]="</div>";c[b++]='<div class="profileRight profileRightStyle">';c[b++]="</div>";c[b++]='<div class="br"></div>';c[b++]='<div class="howToLearnMessage"></div>';c[b++]="</div>";c[b++]="</div>";c[b++]="</div>";this.profileBoxTemplate=c.join("");this.sigmaSourcesBoxTemplate='<div class="ecsseRightBox"><div id="ecsseRightBoxTabs" style="-moz-border-radius-bottomleft:0;-moz-border-radius-bottomright:0;-webkit-border-bottom-left-radius:0;-webkit-border-bottom-right-radius:0; "><ul><li><a href="#tabs-1">Sources</a><span class="tabNewSources">(<span id="tabs-1-no">0</span>)</span><input id="showHideSources" type="checkbox" checked="checked" /></li><li><a href="#tabs-2">Approved</a><span class="tabApprovedSources">(<span id="tabs-2-no">0</span>)</span><input id="showHideApproved" type="checkbox" checked="checked" /></li><li><a href="#tabs-3">Rejected</a><span class="tabRejectedSources">(<span id="tabs-3-no">0</span>)</span><input id="showHideRejected" type="checkbox" /></li><li class="sourcesTabClose" style="float:right;margin:4px 2px;"><span class="ui-icon ui-icon-close">&nbsp;</span></li></ul><div id="fetchingIndicator" >Pending <span id="pendingSources" /> sources<img src="images/icons/sources-ajax-loader.gif"></div><div id="filterIndicator" class="filtered">Sources filtered for <span></span>:<br /><span></span><div style="margin:0.2em;"><a class="removeSourcesFilterBoxButton action-button ui-state-error action-button-icon-right ui-corner-all" href="javascript:void(0);"><span class="ui-icon ui-icon-unlocked"/>'+this.config.unfilterButtonLabel+'</a></div></div><div class="br"></div><div id="tabs-1" class="ecsseSourcesBoxInner"><ul id="'+this.config.sigmaNewSourcesListId+'"></ul><div class="fl sigmaPaginationContainer"><div id="sourcesPagination" class="sigmaPagination"></div><div class="br"></div></div><div class="fr" style="margin-top:12px;"><div class="fr" style="margin-left:1px;"><a class="approveAllSources action-button ui-state-default action-button-icon-right ui-corner-all"><span class="ui-icon ui-icon-arrowthick-1-n"></span>approve all</a></div><div class="fr" ><a class="rejectAllSources action-button ui-state-default action-button-icon-right ui-corner-all"><span class="ui-icon ui-icon-arrowthick-1-n"></span>reject all</a></div><div class="br"></div></div><div class="br"></div><div style="margin-top:1px;"><div class="fl"><input type="text" id="addNewSourceFromUrlInput" value="http://example.loc/document.rdf" /></div><div class="fr"><a class="addNewSourceFromUrlButton action-button ui-state-default action-button-icon-right ui-corner-all"><span class="ui-icon ui-icon-circle-plus"></span>add source url</a></div><div class="br"></div></div></div><div id="tabs-2" class="ecsseSourcesBoxInner"><ul id="'+this.config.sigmaApprovedSourcesListId+'"></ul><div class="fl sigmaPaginationContainer"><div id="approvedSourcesPagination" class="sigmaPagination"></div><div class="br"></div></div></div><div id="tabs-3" class="ecsseSourcesBoxInner"><ul id="'+this.config.sigmaRejectedSourcesListId+'"></ul><div class="fl sigmaPaginationContainer"><div id="bannedSourcesPagination" class="sigmaPagination"></div><div class="br"></div></div></div></div></div>';c=[];b=0;c[b++]='<div id="fixedboxPanel" class="panelHide" >&nbsp;</div>';c[b++]='<div id="fixedbox" class="fullBorder">';c[b++]='<div id="sigmaRightBoxContainer" class="ecsse">';c[b++]=this.sigmaSourcesBoxTemplate;c[b++]="</div>";c[b++]="</div>";this.fixedBoxPanelTemplate=c.join("");}function SigmaUIValue(k,h){this.value=k;this.engine=h;this.engine.idToValueRender.set(this.value.elementID,this);this.containerIdXPath="#"+this.value.elementID;this.valuesContainerIdXPath="#"+this.value.property.elementID+"__";this.propertyName=this.value.property.name;this.pictureSrc=null;if(!this.engine.disableInitialNotifications){var c=null;var b=this.engine.config.customRenderedProperties.indexOf(this.value.property.name)!==-1&&this.value.property.name!="picture";this.html=[];this.I=0;var f=this.value.property.displayMode;var g=this.value.property.entity.pageLayout;var d="valueContainer "+this.engine.config.viewsClasses[g][f].valueContainer;var m="valueLabelContainer "+this.engine.config.viewsClasses[g][f].valueLabelContainer;this.html[this.I++]='<div id="'+this.value.elementID+'" class="'+d+'">';this.html[this.I++]='<div class="'+m+'">';if(this.value.property.name==="picture"){var a=this.value.uris[0]?this.value.uris[0]:this.value.value;this.pictureId=sigmaUtilities.randomString();this.pictureSrc=a;this.html[this.I++]='<img id="'+this.pictureId+'" class="imgValue" src="" />';}else{if(b){c=this.value.getWebLink();if(c==null){c=this.value.label?this.value.label:this.value.value;if(!c.startsWith("mailto:")){c="mailto:"+c;}}this.html[this.I++]='<a class="label" href="'+c+'">'+c.substring("mailto:".length).replace(/\[dot\]/gi,".").replace(/\[at\]/gi,"@")+"</a>";}else{this.html[this.I++]='<span class="label" />';}}if(this.engine.config.showHideSourcesNumbers===true){this.html[this.I++]='<span class="sourcesGraphicsIndicator" />';}else{this.html[this.I++]='<span style="display:none;" class="sourcesGraphicsIndicator" />';}this.html[this.I++]="</div>";this.html[this.I++]="</div>";jQuery(this.valuesContainerIdXPath).append(this.html.join(""));if(this.pictureSrc!=null){this.bindPictureFunction();}if(this.engine.config.customRenderedProperties.indexOf(this.value.property.name)===-1){this.updateLabel();}this.value.requestLabel();this.engine.fixValuesContainerWidth(this.value.property);this.engine.fixHeight();if(b&&c===null){log.warn("there was undefined href for value for property"+this.value.property.name+". Such value will be hidden");this.value.hide();}if(g==="layout2"&&f==="compact"){var e=this.value.property.getNumberOfActiveValues();if(e>=3){this.value.hiddenByDisplayMode=true;this.hiddenByDisplayMode(true);}var l=this.value.property.getNumberOfHiddenByDisplayModeValues();if(l>0){this.updateHiddenByCompactModeNumber(l);}}}}SigmaUIValue.prototype.triggerPictureLoadFunction=function(){var a=this.engine;var c=this.value.property.displayMode;var b=this.value.property.entity.pageLayout;jQuery("#"+this.pictureId).each(function(){log.error("layout][mode"+b+" "+c);a.config.pictureFunctions[b][c].loadFunction(this);});};SigmaUIValue.prototype.bindPictureFunction=function(){var a=this.engine;var c=this.value.property.displayMode;var b=this.value.property.entity.pageLayout;jQuery("#"+this.pictureId).load(function(){log.error("trigger load function for "+this.pictureSrc);a.config.pictureFunctions[b][c].loadFunction(this);}).error(function(){log.error("trigger error function for "+this.pictureSrc);a.config.pictureFunctions[b][c].errorFunction(this);}).attr("src",this.pictureSrc);};SigmaUIValue.prototype.updateHiddenByCompactModeNumber=function(b){log.info("updateHiddenByCompactModeNumber: ["+b+"]");var a=jQuery("#"+this.value.elementID).parent().parent();if(a.find("div.moreButtonCompactView").length===0){a.find("div.valuesContainer").append(this.engine.templates.moreValuesCompactViewButtonTemplate.replace("@number@",b));}else{a.find("div.moreButtonCompactView").replaceWith(this.engine.templates.moreValuesCompactViewButtonTemplate.replace("@number@",b));}};SigmaUIValue.prototype.updateLabel=function(){var a="";var b="";if(this.value.getSigmaLink()){a+='<a class="label" target="blank" href="'+this.value.getSigmaLink()+'">';}else{a+='<span class="label">';}if(this.value.label){b=this.value.label;}else{if(this.value.value){b=this.value.value;}else{if(this.value.getWebLink()){b=this.value.getWebLink();}else{b="[?]";}}}a+=b;if(this.value.getSigmaLink()){a+="</a>";}else{a+="</span>";}jQuery(this.containerIdXPath+" .label").replaceWith(a);if(b==="[?]"){this.value.hide();}};SigmaUIValue.prototype.loading=function(a){log.info("notify value loading observer with: "+a);if(a===true){jQuery(this.containerIdXPath+" img.loading").show();}else{jQuery(this.containerIdXPath+" img.loading").hide();}};SigmaUIValue.prototype.labelUpdated=function(a){this.loading(false);jQuery(this.containerIdXPath).attr("title","label updated with success");if(this.engine.config.customRenderedProperties.indexOf(this.value.property.name)===-1){log.info("call updateLabel from labelUpdated");this.updateLabel();}};SigmaUIValue.prototype.labelUpdateError=function(a){this.loading(false);jQuery(this.containerIdXPath+" div.valueLabelContainer").attr("title",a);if(this.engine.config.customRenderedProperties.indexOf(this.value.property.name)===-1){log.info("call updateLabel from labelUpdateErrror");this.updateLabel();}};SigmaUIValue.prototype.highlightChanged=function(a){log.info("highlightChanged ["+a+"]");if(a===true){jQuery(this.containerIdXPath+" div.valueLabelContainer").addClass("highlight rctl rctr rcbl rcbr");}else{jQuery(this.containerIdXPath+" div.valueLabelContainer").removeClass("highlight rctl rctr rcbl rcbr");}};SigmaUIValue.prototype.activityChanged=function(a){if(a===true){jQuery(this.containerIdXPath).show();}else{jQuery(this.containerIdXPath).hide();}};SigmaUIValue.prototype.confirmed=function(a){};SigmaUIValue.prototype.rejected=function(a){};SigmaUIValue.prototype.hidden=function(a){log.info("HIDDEN value for property ["+this.value.property.name+"]["+a+"]");if(a===true){jQuery("#"+this.value.elementID).hide();if(jQuery("div.sigmaTrashBinDialog ul.properties li[title='"+this.value.property.elementID+"']").length===0){jQuery("div.sigmaTrashBinDialog ul.properties").append('<li class="property" title="'+this.value.property.elementID+'" ><div class="name">'+this.value.property.name+':</div><div class="values"><ul class="values"></ul></div></li>');}if(jQuery("div.sigmaTrashBinDialog ul.values li[title='"+this.value.elementID+"']").length===0){var b=jQuery("#"+this.value.elementID+" div.valueLabelContainer").html();jQuery("div.sigmaTrashBinDialog ul.properties li[title='"+this.value.property.elementID+"'] ul.values").append('<li class="value" title="'+this.value.elementID+'" >'+b+"</li>");}}else{jQuery("#"+this.value.elementID).show();jQuery("div.sigmaTrashBinDialog ul.values li[title='"+this.value.elementID+"'] ").remove();if(jQuery("div.sigmaTrashBinDialog ul.properties li[title='"+this.value.property.elementID+"'] ul li").length===0){jQuery("div.sigmaTrashBinDialog ul.properties li[title='"+this.value.property.elementID+"']").remove();}}};SigmaUIValue.prototype.hiddenByDisplayMode=function(a){if(a===true){jQuery(this.containerIdXPath).hide();}else{jQuery(this.containerIdXPath).show();}};SigmaUIValue.prototype.numberOfSourcesChanged=function(a,b){html=this.engine.generateSourceNumbersString(this.value);jQuery(this.containerIdXPath+" span.sourcesGraphicsIndicator").html(html);};SigmaUIValue.prototype.merged=function(){if(this.engine.config.customRenderedProperties.indexOf(this.value.property.name)===-1){log.info("call updateLabel from merged");this.updateLabel();}};SigmaUIValue.prototype.removedByMerging=function(a){jQuery(this.containerIdXPath).remove();};function SigmaUIProperty(h,a,g){this.property=h;this.engine=g;this.engine.idToPropertyRender.set(this.property.elementID,this);this.containerIdXPath="#"+this.property.elementID;if(!this.engine.disableInitialNotifications){this.html=[];this.I=0;var c=this.property.displayMode;var d=this.property.entity.pageLayout;var b="entityContainer "+this.engine.config.viewsClasses[d][c].entityContainer;var e="propertyContainer "+this.engine.config.viewsClasses[d][c].propertyContainer;var f="propertyLabelContainer "+this.engine.config.viewsClasses[d][c].propertyLabelContainer;var l="valuesContainer "+this.engine.config.viewsClasses[d][c].valuesContainer;var k="separatorContainer "+this.engine.config.viewsClasses[d][c].separatorContainer;this.html[this.I++]='<div style="display:none;" id="'+this.property.elementID+'" class="'+b+'">';this.html[this.I++]='<div id="'+randomString()+'" class="'+e+'">';this.html[this.I++]='<div class="'+f+'" title="'+this.property.name+'">';this.html[this.I++]='<span class="name fr">'+decodeURIComponent(this.property.name).toLowerCase()+":</span>";if(g.config.dragMode==true){this.html[this.I++]='<span class="dragMeOn fr ui-icon ui-icon-arrow-4-diag"></span>';this.html[this.I++]='<span class="dragMeOff fr"></span>';}this.html[this.I++]="</div>";this.html[this.I++]="</div>";if(g.config.inReorderPropertiesMode===true){this.html[this.I++]='<div id="'+this.property.elementID+'__" class="'+l+'" style="display:none;">';}else{this.html[this.I++]='<div id="'+this.property.elementID+'__" class="'+l+'">';}this.html[this.I++]="</div>";this.html[this.I++]="</div>";if(a){jQuery("#"+a).before(this.html.join(""));}else{jQuery(".profileRight").append(this.html.join(""));}if(this.property.inSingleMode===true){jQuery(this.containerIdXPath+" a.allValuesProperty").show();}else{jQuery(this.containerIdXPath+" a.topValueProperty").show();}}}SigmaUIProperty.prototype.unfetchedValueCountChanged=function(b){if(b>0){var a="";if(jQuery("#"+this.property.elementID+"__ div.valueContainer:visible").length>0){if(b===1){a=" "+b+" more value ";}else{if(b>1&&b<10){a=" "+b+" more values";}else{a=b+" more values";}}}else{if(b===1){a=" "+b+" value ";}else{if(b>1&&b<10){a=" "+b+" values";}else{a=b+" values";}}}jQuery("#"+this.property.elementID+" div.valuesContainer div.unfetchedValuesButton").remove();jQuery("#"+this.property.elementID+" div.valuesContainer").append(this.engine.templates.unfetchedValuesButtonTemplate.replace("@n@",a));}else{jQuery("#"+this.property.elementID+" div.valuesContainer div.unfetchedValuesButton").remove();}};SigmaUIProperty.prototype.highlightChanged=function(a){log.info("property highlightChanged ["+a+"]");if(a===true){jQuery(this.containerIdXPath+" div.propertyLabelContainer").addClass("highlight rctl rctr rcbl rcbr").find("span.dragMeOff").hide().end().find("span.dragMeOn").show();}else{jQuery(this.containerIdXPath+" div.propertyLabelContainer").removeClass("highlight rctl rctr rcbl rcbr").find("span.dragMeOn").hide().end().find("span.dragMeOff").show();}};SigmaUIProperty.prototype.valueAdded=function(a){if(!a.rejected){jQuery(this.containerIdXPath).removeClass("rejected");}a.addObserver(new SigmaUIValue(a,this.engine));a.property.notifyObservers("unfetchedValueCountChanged",a.property.countUnfetchedValues());};SigmaUIProperty.prototype.lastValueRejected=function(){jQuery(this.containerIdXPath).addClass("rejected");};SigmaUIProperty.prototype.hidden=function(a){log.info("CALL hidden for property ["+this.property.name+"]["+a+"] ");if(a===true){jQuery("#"+this.property.elementID).hide();if(jQuery("div.sigmaTrashBinDialog ul.properties li[title='"+this.property.elementID+"']").length===0){jQuery("div.sigmaTrashBinDialog ul.properties").append('<li class="property" title="'+this.property.elementID+'" ><div class="name">'+this.property.name+':</div><div class="values"><ul class="values"></ul></div></li>');}}else{if(jQuery("div.sigmaTrashBinDialog ul.properties li[title='"+this.property.elementID+"'] ul.values li").length===0){log.error("removing property from the bin because there is no values ");jQuery("div.sigmaTrashBinDialog ul.properties li[title='"+this.property.elementID+"']").remove();}jQuery("#"+this.property.elementID).show();}};SigmaUIProperty.prototype.movedBefore=function(a,e){var c=this.engine.profile.getProperty(a);if(c){var b=c.elementID;log.debug("notification sent "+this.property.name+" before "+a+"withID: "+b);var d=jQuery("#"+this.property.elementID);d.clone(true).insertBefore("#"+b);d.remove();}};SigmaUIProperty.prototype.activityChanged=function(a){if(a===true){jQuery(this.containerIdXPath).show();}else{jQuery(this.containerIdXPath).hide();}};SigmaUIProperty.prototype.clearPropertyView=function(){var a={};var b;for(var c in this.engine.config.viewsClasses){if(this.engine.config.viewsClasses.hasOwnProperty(c)){var d=this.engine.config.viewsClasses[c];for(var f in d){if(d.hasOwnProperty(f)){var e=d[f];for(b in e){if(e.hasOwnProperty(b)){if(!a[b]){a[b]="";}a[b]+=" "+e[b];}}}}}}for(b in a){if(a.hasOwnProperty(b)){a[b]=a[b].split(" ").unique().join(" ");}}jQuery("#"+this.property.elementID).removeClass(a.entityContainer).find("div.valueButtonsContainer").removeClass(a.valueButtonsContainer).end().find("div.propertyButtonsContainer").removeClass(a.propertyButtonsContainer).end().find("div.propertyContainer").removeClass(a.propertyContainer).find("div.propertyLabelContainer").removeClass(a.propertyLabelContainer).end().end().find("div.valuesContainer").removeClass(a.valuesContainer).find("div.valueContainer").removeClass(a.valueContainer).find("div.valueLabelContainer").removeClass(a.valueLabelContainer);};SigmaUIProperty.prototype.displayModeChanged=function(d){var b=this.engine;var c=this.property.entity.pageLayout;this.clearPropertyView();var a=jQuery("#"+this.property.elementID);a.addClass(b.config.viewsClasses[c][d].entityContainer).find("div.propertyContainer").addClass(b.config.viewsClasses[c][d].propertyContainer).find("div.propertyLabelContainer").addClass(b.config.viewsClasses[c][d].propertyLabelContainer).end().end().find("div.valuesContainer").addClass(b.config.viewsClasses[c][d].valuesContainer).find("div.valueContainer").addClass(b.config.viewsClasses[c][d].valueContainer).find("div.valueLabelContainer").addClass(b.config.viewsClasses[c][d].valueLabelContainer);a.find("div.propertyButtonsContainer").addClass(b.config.viewsClasses[c][d].propertyButtonsContainer).end().find("div.valueButtonsContainer").addClass(b.config.viewsClasses[c][d].valueButtonsContainer);b.fixValuesContainerWidth(this.property);if(this.property.name==="picture"){a.find("div.valueContainer").each(function(){var e=jQuery(this).attr("id");var f=b.idToValueRender.get(e);f.triggerPictureLoadFunction();});}if(c==="layout1"){this.displayModeChangedLayout1(d);}else{if(c==="layout2"){this.displayModeChangedLayout2(d);}else{if(c==="layout3"){this.displayModeChangedLayout3(d);}else{log.error("WRONG LAYOUT ["+c+"]!!!");}}}};SigmaUIProperty.prototype.displayModeChangedLayout1=function(d){var b=this.engine;var a=jQuery("#"+this.property.elementID);var c=this.property.entity.pageLayout;if(d==="compact"){a.find("div.valueContainer").each(function(){valueID=jQuery(this).attr("id");render=b.idToValueRender.get(valueID);if(render.value.hiddenByDisplayMode===true){render.value.hiddenByDisplayMode=false;render.hiddenByDisplayMode(false);}});a.find("div.moreButtonCompactView").remove();}else{if(d==="list"){a.find("div.valueContainer").each(function(){valueID=jQuery(this).attr("id");render=b.idToValueRender.get(valueID);if(render.value.hiddenByDisplayMode===true){render.value.hiddenByDisplayMode=false;render.hiddenByDisplayMode(false);}});a.find("div.moreButtonCompactView").remove();}else{if(d==="single"){a.find("div.valueContainer").each(function(){valueID=jQuery(this).attr("id");render=b.idToValueRender.get(valueID);if(render.value.hiddenByDisplayMode===true){render.value.hiddenByDisplayMode=false;render.hiddenByDisplayMode(false);}});a.find("div.moreButtonCompactView").remove();}else{if(d==="hidden"){a.find("div.moreButtonCompactView").remove();}else{log.debug("displayModeChanged - wrong mode ["+d+"]");}}}}};SigmaUIProperty.prototype.displayModeChangedLayout2=function(g){var e=this.engine;var f=this.property.entity.pageLayout;var b=jQuery("#"+this.property.elementID);var c=0;var d,a;if(g==="compact"){c=0;b.find("div.valueContainer").each(function(){a=jQuery(this).attr("id");d=e.idToValueRender.get(a);if(d.value.active===true){c++;}if(c>3){d.value.hiddenByDisplayMode=true;d.hiddenByDisplayMode(true);}});if(c>3){log.info("there were ["+c+"] values 3 are displayed ["+(c-3)+"] was hidden");d.updateHiddenByCompactModeNumber(c-3);}}else{if(g==="list"){c=0;b.find("div.valueContainer").each(function(){a=jQuery(this).attr("id");d=e.idToValueRender.get(a);if(c>=3){d.value.hiddenByDisplayMode=false;d.hiddenByDisplayMode(false);}c++;});if(c>=3){b.find("div.moreButtonCompactView").remove();}}else{if(g==="single"){b.find("div.valueContainer").each(function(){a=jQuery(this).attr("id");d=e.idToValueRender.get(a);d.value.hiddenByDisplayMode=false;d.value.updateActivityState();});b.find("div.moreButtonCompactView").remove();}else{if(g==="hidden"){b.find("div.moreButtonCompactView").remove();}else{log.debug("displayModeChanged - wrong mode ["+g+"]");}}}}};SigmaUIProperty.prototype.displayModeChangedLayout3=function(d){var b=this.engine;var c=this.property.entity.pageLayout;var a=jQuery("#"+this.property.elementID);};SigmaUIProperty.prototype.stickToPreviousChange=function(a){if(!a){a=this.property.getStickToPreviousMode();}log.debug("stickToPreviousChange to "+a);if(a==1){jQuery("#"+this.property.elementID).removeClass("entityNotSticky").addClass("entitySticky");jQuery("#"+this.property.elementID).find("div.propertyContainer").width("auto");}else{if(a==2){jQuery("#"+this.property.elementID).removeClass("entitySticky").addClass("entityNotSticky");jQuery("#"+this.property.elementID).find("div.propertyContainer").width(140);}else{jQuery("#"+this.property.elementID).removeClass("entitySticky").addClass("entityNotSticky");jQuery("#"+this.property.elementID).find("div.propertyContainer").width("auto");}}this.engine.fixValuesContainerWidth(this.property);};function SigmaUISource(b,g){this.engine=g;this.containerId=randomString();this.engine.idToSourceRender.set(this.containerId,this);this.source=b;this.containerIdXPath="#"+this.containerId;this.source.elementId=this.containerId;this.source.elementIdXPath="#"+this.containerId;var k=this.source.sourceLabel?this.source.sourceLabel:this.source.sourceURI;var c='<li class="source sourceCss" id="'+this.containerId+'"><div class="sourceContainerRel" ><div class="sourceButtons">'+this.engine.templates.dehighlightButtonTemplate+this.engine.templates.highlightButtonTemplate+this.engine.templates.approveButtonTemplate+this.engine.templates.confirmSourceFromTheSameDomainButtonTemplate+this.engine.templates.rejectButtonTemplate+this.engine.templates.rejectSourceFromTheSameDomainButtonTemplate+"</div>";var d='<li class="source confirmed" id="'+this.containerId+'"><div class="sourceContainerRel" ><div class="sourceButtons">'+this.engine.templates.dehighlightButtonTemplate+this.engine.templates.highlightButtonTemplate+this.engine.templates.unapproveButtonTemplate+this.engine.templates.rejectButtonTemplate+"</div>";var a='<li class="source rejected" id="'+this.containerId+'"><div class="sourceContainerRel" ><div class="sourceButtons">'+this.engine.templates.dehighlightButtonTemplate+this.engine.templates.highlightButtonTemplate+this.engine.templates.unrejectSourceButtonTemplate+"</div>";var e='<div class="sourceInfo" ><div class="sourceLabel fl"><b title="'+this.source.getIndex()+'">'+this.source.getIndex()+'</b> <a href="'+this.source.sourceURI+'" class="link">';if(k.length>24){e+=k.substring(0,24)+"...";}else{e+=k;}e+='</a></div><div class="sourceDetails fl">';e+=this.source.valueCount+" facts | "+this.source.date+'</div><div class="br"></div></div><div class="fullURI">';var l=0;if(this.source.isFromOKKAM){e+='<a href="javascript:void(0);" class="okkam" />';l=10;}if(this.source.isFromYBOSS){e+='<a href="javascript:void(0);" class="yboss" />';l=10;}var f=boldDomain(this.source.domain,this.source.sourceURI);var h=58-l;if(f.length>h){f=f.substring(0,h)+"...";}e+='<small title="'+this.source.sourceURI+'">'+f+'</small> <a class="cachedSource link" href="http://sindice.com/search/page?url='+encodeURIComponent(this.source.sourceURI)+'" target="_blank">(cache)</a>';e+='<span class="altrnativeUrlsFromOkkam"</span>';e+="</div></div></li>";this.newHtml=c+e;this.confirmedHtml=d+e;this.rejectedHtml=a+e;this.engine.opts.itemsNo++;this.engine.renderNNewSources();}SigmaUISource.prototype.addOkkamLogo=function(){if(jQuery(this.containerIdXPath+" .fullURI a.okkam").length==0){jQuery(this.containerIdXPath+" .fullURI small").before('<a href="javascript:void(0);" class="okkam" />');}};SigmaUISource.prototype.urlsFromOkkamAdded=function(){var a=this.source.alternativeUrlsFromOkkam;if(this.source.alternativeUrlsFromOkkamFetched==true){jQuery(this.containerIdXPath+" span.altrnativeUrlsFromOkkam").html('<span class="okkamEnd">'+a.length+" sources via OKKAM fetched</span>").css("text-decoration","line-through").attr("title",a).show();}else{jQuery(this.containerIdXPath+" span.altrnativeUrlsFromOkkam").html('<a class="okkamEnd">'+a.length+" more sources via</a>").attr("title",a).show();jQuery(this.containerIdXPath+" span.altrnativeUrlsFromOkkam a.okkamEnd").click();}};SigmaUISource.prototype.showIndicator=function(a){jQuery("#indicator").toggle(a);};SigmaUISource.prototype.increaseSourcesNoOnTab=function(a){var b=parseInt(jQuery("#"+a).html(),10);jQuery("#"+a).html(b+1);};SigmaUISource.prototype.decreaseSourcesNoOnTab=function(a){var b=parseInt(jQuery("#"+a).html(),10);jQuery("#"+a).html(b-1);};SigmaUISource.prototype.highlightChanged=function(a){if(a){jQuery(this.containerIdXPath).closest("ul").find("li.highlighted").removeClass("highlighted").end().find("div.sourceButtons").hide();jQuery(this.containerIdXPath).addClass("highlighted").find("div.sourceButtons").show().end().find(".cachedSource").show();}else{jQuery(this.containerIdXPath).removeClass("highlighted").find("div.sourceButtons").hide().end().find(".cachedSource").hide();}};SigmaUISource.prototype.rejected=function(b){var a=this;this.showIndicator(true);this.engine.hideHighlighted();this.engine.removePropertyAndValueFilter();this.source.highlight(false);this.engine.opts.itemsNo=this.engine.profile.getNumberOfNewSources();this.engine.optsApproved.itemsNo=this.engine.profile.getNumberOfApprovedSources();this.engine.optsRejected.itemsNo=this.engine.profile.getNumberOfRejectedSources();this.engine.updatePaginationOnTab1();if(this.engine.checkAreThereAnyItemsOnCurrentPage(this.engine.opts)===true){this.engine.updatePaginationOnTab1();}this.engine.updatePaginationOnTab2();if(this.engine.checkAreThereAnyItemsOnCurrentPage(this.engine.optsApproved)===true){this.engine.updatePaginationOnTab2();}this.engine.updatePaginationOnTab3();if(this.engine.checkAreThereAnyItemsOnCurrentPage(this.engine.optsRejected)===true){this.engine.updatePaginationOnTab3();}this.showIndicator(false);};SigmaUISource.prototype.findSourceByIndex=function(a){return jQuery("#ecsse-sources-list-page li div div div b[title='"+a+"']").parent().parent().parent().parent();};SigmaUISource.prototype.confirmed=function(b){var a=this;this.showIndicator(true);this.engine.hideHighlighted();this.engine.removePropertyAndValueFilter();this.source.highlight(false);this.engine.opts.itemsNo=this.engine.profile.getNumberOfNewSources();this.engine.optsApproved.itemsNo=this.engine.profile.getNumberOfApprovedSources();this.engine.optsRejected.itemsNo=this.engine.profile.getNumberOfRejectedSources();this.engine.updatePaginationOnTab1();if(this.engine.checkAreThereAnyItemsOnCurrentPage(this.engine.opts)===true){this.engine.updatePaginationOnTab1();}this.engine.updatePaginationOnTab2();if(this.engine.checkAreThereAnyItemsOnCurrentPage(this.engine.optsApproved)===true){this.engine.updatePaginationOnTab2();}this.engine.updatePaginationOnTab3();if(this.engine.checkAreThereAnyItemsOnCurrentPage(this.engine.optsRejected)===true){this.engine.updatePaginationOnTab3();}this.showIndicator(false);};SigmaUISource.prototype.updateSoloStatus=function(){};function SigmaUIEngine(a){this.profile=null;this.config=new SigmaUIConfig(a);this.templates=new SigmaUITemplates(this.config);this.idToSourceRender=new Map();this.idToPropertyRender=new Map();this.idToValueRender=new Map();}SigmaUIEngine.prototype.setRawFlag=function(a){a=new Boolean(a).valueOf();if(this.config.rawFlag===a){return;}this.config.rawFlag=a;};SigmaUIEngine.prototype.setProfile=function(a){this.profile=a;};SigmaUIEngine.prototype.setEmbededMode=function(a){this.config.embededMode=a;};SigmaUIEngine.prototype.generateSourceNumbersString=function(h){var c=h.sources.length;var g=0;var d=0;for(d=0;d<c;d++){if(h.sources[d].isActive()){g++;}}var f=0;var b=[];var k=0;var a;b[k++]="[";for(d=0;d<c;d++){a=h.sources[d];if(a.isActive()){f++;var e=a.getIndex();if(a.rejected){b[k++]='<span class="rejected">'+e+"</span>";}else{if(a.confirmed){b[k++]='<span class="confirmed">'+e+"</span>";}else{b[k++]='<span class="new">'+e+"</span>";}}if(f!=g){b[k++]=",";}}}if(this.config.disableHoverOverValues==true){b[k++]='&nbsp; <a class="rejectValueSourcesEvaluation" title="'+h.elementID+'" href="" >reject sources</a>';}b[k++]="]";return b.join("");};SigmaUIEngine.prototype.enableOnResize=function(){var a=this;a.onResize(true);jQuery(window).resize(function(){a.onResize();});};SigmaUIEngine.prototype.hideHighlighted=function(){jQuery("div.highlight").removeClass("highlight");jQuery("div.propertyButtonsContainer").hide();jQuery("div.valueButtonsContainer").hide();};SigmaUIEngine.prototype.coverBorders=function(c,e){var a=jQuery(c).parent().attr("id");var d=jQuery(c).width();var f=jQuery(e).width();var b,l,h;var g,m,k;l=jQuery(c).offset().top-4;m=jQuery(c).offset().top-4;if(d>=f){h=jQuery(e).width();b=jQuery(e).offset().left+1;k=jQuery(c).width()-h;g=jQuery(c).offset().left+h;jQuery(c).removeClass("rctl");jQuery(e).removeClass("rcbr");}else{h=jQuery(c).width();b=jQuery(c).offset().left+1;k=jQuery(e).width()-h;g=jQuery(c).offset().left+h;h+=2*this.config.propertyOrValueSideMargin;jQuery(c).removeClass("rctl rctr");}jQuery("#coverLight").data("containerId",a).css({left:b,top:l,width:h}).show();};SigmaUIEngine.prototype.hideCovers=function(){jQuery("#coverLight").hide();jQuery("#coverDark").hide();};SigmaUIEngine.prototype.newPaginationCallback=function(c,a,d){var b=d.visibleListId;if(b==this.config.sigmaNewSourcesListId){this.opts.current_page=c;this.renderNNewSources();}else{if(b==this.config.sigmaApprovedSourcesListId){this.optsApproved.current_page=c;this.renderNApprovedSources();}else{if(b==this.config.sigmaRejectedSourcesListId){this.optsRejected.current_page=c;this.renderNRejectedSources();}else{log.error("Wrong listId");}}}return false;};SigmaUIEngine.prototype.renderNNewSources=function(c,e){var m=this;var f,a,g="",d,h=0,l=0;if(!e){e=this.opts.items_per_page;}if(!c){c=this.opts.current_page;}d=c*e;var k=[];for(f=0;f<this.profile.sources.length;f++){a=this.profile.sources[f];if(!a.confirmed&&!a.rejected&&!a.filteredOut){if(d>h){log.info("--- skipping one source skipped"+h);h++;continue;}else{l++;var b=m.idToSourceRender.get(a.elementId);g+=b.newHtml;k.push(f);}}if(l>=e){break;}}jQuery(this.config.sigmaNewSourcesListIdXPath).empty().append(g);this.appendOkkamLogo(k);};SigmaUIEngine.prototype.renderNApprovedSources=function(b,d){var l=this;var e,a,f="",c,g=0,k=0;if(!d){d=this.optsApproved.items_per_page;}if(!b){b=this.optsApproved.current_page;}c=b*d;var h=[];for(e=0;e<this.profile.sources.length;e++){a=this.profile.sources[e];if(a.confirmed&&!a.rejected&&!a.filteredOut){if(c>g){g++;continue;}else{k++;render=l.idToSourceRender.get(a.elementId);f+=render.confirmedHtml;h.push(e);}}if(k>=d){break;}}jQuery(this.config.sigmaApprovedSourcesListIdXPath).empty().html(f);this.appendOkkamLogo(h);};SigmaUIEngine.prototype.renderNRejectedSources=function(b,d){var l=this;var e,a,f="",c,g=0,k=0;if(!d){d=this.optsRejected.items_per_page;}if(!b){b=this.optsRejected.current_page;}c=b*d;var h=[];for(e=0;e<this.profile.sources.length;e++){a=this.profile.sources[e];if(!a.confirmed&&a.rejected&&!a.filteredOut){if(c>g){g++;continue;}else{k++;render=l.idToSourceRender.get(a.elementId);f+=render.rejectedHtml;h.push(e);}}if(k>=d){break;}}jQuery(this.config.sigmaRejectedSourcesListIdXPath).empty().html(f);this.appendOkkamLogo(h);};SigmaUIEngine.prototype.appendOkkamLogo=function(b){for(i=0;i<b.length;i++){var a=this.profile.sources[b[i]];a.fetchSameAsFromOkkam();if(a.isFromOKKAM==true){a.notifyObservers("addOkkamLogo");}}};SigmaUIEngine.prototype.setSigmaContainerId=function(){var b=this.config.sigmaContainerId;this.ecsseContainerId=b;this.ecsseProfileListId=b+"-profile-list-id";this.ecsseProfileListIdXPath="#"+this.ecsseProfileListId;this.ecsseSourcesContainerXPath="#"+b+" div.ecsseSources";this.ecsseProfileContainerXPath="#"+b+" div.ecsseProfile";this.ecsseContainerIdXPath="#"+b;this.ecsseRightBoxXPath="#"+b+" .ecsseRightBox";this.ecsseSourcesBoxInnerXPath="#"+b+" .ecsseSourcesBoxInner";this.hideSourcesBoxButtonXPath="#"+b+" .hideSourcesBoxButton";this.showSourcesBoxButtonXPath="#"+b+" .showSourcesBoxButton";this.removeSourcesFilterBoxButtonXPath="#"+b+" .removeSourcesFilterBoxButton";var a=this;this.opts={items_per_page:7,current_page:0,num_display_entries:3,num_edge_entries:1,link_to:"javascript:void(0);",prev_text:"<-",next_text:"->",ellipse_text:"...",prev_show_always:true,next_show_always:true,callback:function(d,c){a.newPaginationCallback(d,c,this);},invisibleListId:"ecsse-sources-list",visibleListId:a.config.sigmaNewSourcesListId,itemsNo:0};this.optsApproved={items_per_page:7,current_page:0,num_display_entries:3,num_edge_entries:1,link_to:"javascript:void(0);",prev_text:"<-",next_text:"->",ellipse_text:"...",prev_show_always:true,next_show_always:true,callback:function(d,c){a.newPaginationCallback(d,c,this);},invisibleListId:"ecsse-approved-sources-list",visibleListId:a.config.sigmaApprovedSourcesListId,itemsNo:0};this.optsRejected={items_per_page:7,current_page:0,num_display_entries:3,num_edge_entries:1,link_to:"javascript:void(0);",prev_text:"<-",next_text:"->",ellipse_text:"..",prev_show_always:true,next_show_always:true,callback:function(d,c){a.newPaginationCallback(d,c,this);},invisibleListId:"ecsse-banned-sources-list",visibleListId:a.config.sigmaRejectedSourcesListId,itemsNo:0};};SigmaUIEngine.prototype.getSigmaContainerIdXPath=function(a){return this.ecsseContainerIdXPath;};SigmaUIEngine.prototype.dynamicSourceHighlightAndFilter=function(d,b){if(!this.config.sourcesFilteredLock){if(d===true){var a=b.length;for(var c=a-1;c>=0;c--){jQuery("div.fullURI small[title='"+b[c].sourceURI+"']").parent().parent().parent().addClass("highlighted");}}else{jQuery("div.fullURI small[title]").parent().parent().parent().removeClass("highlighted");}}};SigmaUIEngine.prototype.unfilterSources=function(){var c=this;var d,b;for(var a=0;a<this.profile.sources.length;a++){d=this.profile.sources[a];d.filteredOut=false;}jQuery("#filterIndicator").hide();jQuery(".dehighlightValue").hide();this.config.sourcesFilteredLock=false;this.opts.itemsNo=this.profile.getNumberOfNewSources();this.optsApproved.itemsNo=this.profile.getNumberOfApprovedSources();this.optsRejected.itemsNo=this.profile.getNumberOfRejectedSources();this.updatePaginationOnTab1();this.updatePaginationOnTab2();this.updatePaginationOnTab3();};SigmaUIEngine.prototype.filterSources=function(b,a,g){var e=this;var h,d,c;for(c=0;c<this.profile.sources.length;c++){this.profile.sources[c].filteredOut=true;}for(c=0;c<b.length;c++){h=b[c];h.filteredOut=false;}if(!g){g="undefined";}var f=35;if(g.length>f){g=g.substring(0,f)+" ...";}if(a=="value"){jQuery("#filterIndicator span:eq(0)").html("<b>value</b>");jQuery("#filterIndicator span:eq(1)").html("<b>"+g+"</b>");}if(a=="property"){jQuery("#filterIndicator span:eq(0)").html("<b>property</b>");jQuery("#filterIndicator span:eq(1)").html("<b>"+g+"</b>");}jQuery("#filterIndicator").show();this.opts.current_page=0;this.opts.itemsNo=this.profile.getNumberOfNewSources();this.optsApproved.current_page=0;this.optsApproved.itemsNo=this.profile.getNumberOfApprovedSources();this.optsRejected.current_page=0;this.optsRejected.itemsNo=this.profile.getNumberOfRejectedSources();this.updatePaginationOnTab1();this.updatePaginationOnTab2();this.updatePaginationOnTab3();this.config.sourcesFilteredLock=true;};SigmaUIEngine.prototype.displayNoResultCase=function(a){jQuery("div.noResultsIndicator div.msg").html("There were no results for query:<br />"+a).closest(".noResultsIndicator").show();this.hideRightPanel();jQuery(".permLinkSourcesBoxButton").hide();jQuery(".reorderPropertiesOff").hide();jQuery("#fixedboxPanel").hide();};SigmaUIEngine.prototype.hideRightPanel=function(){log.info("hiding right panel");jQuery(".ecsseRightBox").hide("slow");jQuery("#fixedboxPanel").css({width:sigmaConfig.fixedboxPanelWidth,right:0}).removeClass("panelHide").addClass("panelShow");jQuery("#fixedbox").css({width:0}).removeClass("fullBorder");this.onResize(true);sigmaConfig.fixedboxPanel=true;};SigmaUIEngine.prototype.showRightPanel=function(){jQuery(".ecsseRightBox").show("slow");jQuery("#fixedboxPanel").css({width:0,right:404}).removeClass("panelShow").addClass("panelHide");jQuery("#fixedbox").css({width:400}).addClass("fullBorder");this.onResize(true);sigmaConfig.fixedboxPanel=false;};SigmaUIEngine.prototype.calculateNumberOfSourcesFitInRightWindow=function(){var e=jQuery(window).height();var c=40;var h=jQuery("#filterIndicator:visible").height();if(!h){h=0;}var f=0;var b=65;var d=e-c-b-h-f;var a=45;var g=Math.floor((d)/a);if(g<=0){g=1;}return g;};SigmaUIEngine.prototype.checkAreThereAnyItemsOnCurrentPage=function(a){var b=jQuery("#"+a.visibleListId+" li").size();if(b===0){log.info("detected that there is no more sources on page for "+a.visibleListId);if(a.current_page>0){a.current_page--;}return true;}else{log.info("detected that there is ["+b+"]sources on page for "+a.visibleListId);return false;}};SigmaUIEngine.prototype.updatePaginationOnTab1=function(){this.opts.items_per_page=this.calculateNumberOfSourcesFitInRightWindow();jQuery("#sourcesPagination").pagination(this.opts.itemsNo,this.opts);jQuery("#tabs-1-no").html(this.opts.itemsNo);jQuery("span.tabNewSources").effect("pulsateWithStyle",this.config.pulsateOption,this.pulsateDuration);};SigmaUIEngine.prototype.updatePaginationOnTab2=function(){this.optsApproved.items_per_page=this.calculateNumberOfSourcesFitInRightWindow();jQuery("#approvedSourcesPagination").pagination(this.optsApproved.itemsNo,this.optsApproved);jQuery("#tabs-2-no").html(this.optsApproved.itemsNo);jQuery(".tabApprovedSources").effect("pulsateWithStyle",this.config.pulsateOption,this.pulsateDuration);};SigmaUIEngine.prototype.updatePaginationOnTab3=function(){this.optsRejected.items_per_page=this.calculateNumberOfSourcesFitInRightWindow();jQuery("#bannedSourcesPagination").pagination(this.optsRejected.itemsNo,this.optsRejected);jQuery("#tabs-3-no").html(this.optsRejected.itemsNo);jQuery(".tabRejectedSources").effect("pulsateWithStyle",this.config.pulsateOption,this.pulsateDuration);};SigmaUIEngine.prototype.initContainers=function(){jQuery(this.ecsseContainerIdXPath).append(this.templates.profileBoxTemplate);if(this.config.hideBottomMessage==false){if(this.fromSindice==true){jQuery(this.ecsseContainerIdXPath+" div.howToLearnMessage").append(this.templates.howToLearnIndicatorSindice);}else{jQuery(this.ecsseContainerIdXPath+" div.howToLearnMessage").append(this.templates.howToLearnIndicator);}}if(this.config.rawFlag===false){jQuery("body").append(this.templates.invisibleElementsTemplate);if(this.config.hideHeader==false){jQuery("#header").append(this.templates.headerTemplate);jQuery("#sigmaVersion").attr("title","Published: "+sigmaPublished+" Revision: "+sigmaRevision).html('<a href="changes.jsp#'+sigmaVersion+'">Version: '+sigmaVersion+"</a>");}if(this.config.showFakeSearchbar==true){jQuery("#search-again-left-piece").append(this.templates.fakeSearchTemplate);}if(this.config.hideSearchbar==false){jQuery("#search-again-left-piece").append(this.templates.searchTemplate);}if(this.config.hideFooter==false){jQuery("#footer").append(this.templates.footerTemplate);}jQuery("#pageContent").after(this.templates.fixedBoxPanelTemplate);jQuery("#sigmaOptionsTabs").tabs();jQuery(this.ecsseContainerIdXPath).append('<div class="permLinkDialog" title="Permament link" />');jQuery("div.permLinkDialog").dialog({autoOpen:false,width:780,modal:true});jQuery("#ecsseRightBoxTabs").tabs();}else{jQuery("div.sidesBottomBorder").removeClass("sidesBottomBorder");var a=getURLParam("q");this.updateExpandToFullViewLink(a);this.showExpandToFullViewLink();}};SigmaUIEngine.prototype.showExpandToFullViewLink=function(){jQuery(this.ecsseContainerIdXPath+" div.expandToFullView").show();};SigmaUIEngine.prototype.updateExpandToFullViewLink=function(c){var b=window.location.host;var a="http://"+b+"/search?q="+c;jQuery(this.ecsseContainerIdXPath+" div.expandToFullView").find("a").attr("href",a).end().find("span").text(decodeURIComponent(c));};SigmaUIEngine.prototype.setShowHideSourcesNumbersFlag=function(a){jQuery("#hideShowSourcesNumbers").attr("checked",a);if(this.config.showHideSourcesNumbers===a){return;}this.config.showHideSourcesNumbers=a;if(a){this.config.showHideSourcesNumbers=true;jQuery("span.sourcesGraphicsIndicator").show();}else{this.config.showHideSourcesNumbers=false;jQuery("span.sourcesGraphicsIndicator").hide();}};SigmaUIEngine.prototype.getShowHideSourcesNumbersFlag=function(){return this.config.showHideSourcesNumbers;};SigmaUIEngine.prototype.showRightBox=function(){jQuery(this.ecsseRightBoxXPath).css({display:"block"});};SigmaUIEngine.prototype.setDragAndDropHandle=function(a){jQuery(this.ecsseProfileListIdXPath).sortable("option","handle","."+a);};SigmaUIEngine.prototype.enableDragAndDrop=function(a){log.info("called enableDragAndDrop with handle class ["+a+"]");var b=this;jQuery(".profileRight").sortable({handle:a,cursor:"move",opacity:0.6,update:function(e,g){log.error("this id"+g.item.attr("id")+" name: "+g.item.find("div.propertyLabelContainer:first span.name").html());log.error("before id"+g.item.next().attr("id")+" name: "+g.item.next().find("div.propertyLabelContainer:first span.name").html());var c=g.item.next().find("div.propertyLabelContainer:first span.name").html();if(c){c=c.removeLastCharacter(":");}var d=g.item.find("div.propertyLabelContainer:first span.name").html();d=d.removeLastCharacter(":");var f=b.profile.getProperty(d);b.profile.move(f,c);}});};SigmaUIEngine.prototype.disableDragAndDrop=function(){log.info("disableDragAndDrop");jQuery(".profileRight").sortable("destroy");};SigmaUIEngine.prototype.removePropertyAndValueFilter=function(){if(this.config.valuesFilteredLock===true){this.profile.setSoloMode([]);jQuery(".property .propertyContainer").removeClass("propertyHighlighted");jQuery(".value").removeClass("highlighted");jQuery(".source").removeClass("highlighted");jQuery("#valueFilterIndicator").hide();var a=jQuery("a.dehighlightSource:visible").parent().parent().parent();jQuery("a.dehighlightSource:visible").hide();a.find("a.highlightSource").show();jQuery(".sourceButtons").hide();this.config.valuesFilteredLock=false;}};SigmaUIEngine.prototype.checkThatAnySourcesLeftAndRemoveSourcesFilter=function(){if(this.config.sourcesFilteredLock===true){if(jQuery("#ecsse-sources-list-page li:visible").length===0){log.info("no more sources left removing source filter");this.unfilterSources();}}};SigmaUIEngine.prototype.hideSourceBox=function(){jQuery(this.ecsseRightBoxXPath).hide();};SigmaUIEngine.prototype.showSourceBox=function(){jQuery(this.ecsseRightBoxXPath).show();};SigmaUIEngine.prototype.renderSource=function(a){a.addObserver(new SigmaUISource(a,this));if(a.entity.confirmedDomains.indexOf(a.domain)!=-1){a.confirm(true);}if(a.entity.rejectedDomains.indexOf(a.domain)!=-1){a.reject(true);}if(a.entity.okkamSuggestions==true){a.confirm(true);}};SigmaUIEngine.prototype.renderProperty=function(b,a){b.addObserver(new SigmaUIProperty(b,a,this));};SigmaUIEngine.prototype.getPropertyWidth=function(b){var d=jQuery("#"+b.elementID);var a=d.is(":visible");if(!a){d.show();}var c=jQuery("#"+b.elementID+" div.propertyContainer").width();if(!a){d.hide();}if(c===0){c=140;}return c;};SigmaUIEngine.prototype.calculateProfileRightWidth=function(){var e=4+15;var c=this.calculateProfileBoxWidth();var d=jQuery(".profileLeft").width();var b=jQuery("#fixedbox").width();var a=0;if(d===0&&b===0){a=c-e;}else{if(d===0&&b!==0){a=c-e;}else{if(d!==0&&b!==0){a=c-e-d;}else{if(d!==0&&b===0){a=c-e-d;}}}}return a;};SigmaUIEngine.prototype.calculateProfileBoxWidth=function(){var b=jQuery(window).width();var a=jQuery("#fixedbox").width();log.info("sourcesWindowWidth:"+a);if(a===0){return b-a+6;}else{return b-a;}};SigmaUIEngine.prototype.fixHeight=function(){jQuery("#ecsse").css({height:"auto"});var k=jQuery(window).height();var d=jQuery("#header").height();var a=jQuery("#body").height();var c=jQuery("#search-again-left-piece").height();var g=jQuery("#footer").height();var e=d+a+g;if(e<k){a=k-d-g-c-8;jQuery("#ecsse").css({height:a});}};SigmaUIEngine.prototype.fixWidth=function(){log.info("Fix width called");var c=this;var b=c.calculateProfileBoxWidth();var d=jQuery(".profileLeft").width();var a=c.calculateProfileRightWidth();jQuery("#pageContent").width(b-6);jQuery("div.profileRight div.valuesContainer").each(function(){var f=jQuery(this).parent().attr("id");var e=c.idToPropertyRender.get(f);c.fixValuesContainerWidth(e.property,a);});};SigmaUIEngine.prototype.fixValuesContainerWidth=function(d,a){var c=this.profile.pageLayout;if(!a){a=this.calculateProfileRightWidth();}var f=this.getPropertyWidth(d);var e="auto";if(d.entity.pageLayout==="layout1"||d.entity.pageLayout==="layout2"){e=a-f-12-8;}else{e=a-12-50-8;}if(c==="layout1"||c==="layout3"){log.info("fixValuesContainerWidth for property: "+d.name+"["+f+"] to: "+e);jQuery("#"+d.elementID+"__").width(e);}else{log.debug("fixing values width in layout2 for "+d.name);jQuery("#"+d.elementID+"__").width("auto");var b=jQuery("#"+d.elementID+"__").width();log.debug("computedValuesContainerWidth: "+b);log.debug("actualValuesContainerWidth: "+e);if(b>e){log.debug("changing values width for "+d.name+"to: "+e);jQuery("#"+d.elementID+"__").width(e);}}};SigmaUIEngine.prototype.hideShowTopMenu=function(){var c=jQuery("#header").width();var b=jQuery("#header #sigma-logo").width();var a=jQuery("#header #menuTop").width();if((b+8+4+a)>c){jQuery("#menuTop").hide();}else{jQuery("#menuTop").show();}};SigmaUIEngine.prototype.onResize=function(a){log.info("on Resize flag"+a);if(this.config.propertiesAndValuesRendering===false||a===true){var c=jQuery("#fixedboxPanel").offset();if(c){panelLeft=c.left;}else{panelLeft=0;}this.fixWidth();this.fixHeight();this.hideShowTopMenu();var b=this.calculateNumberOfSourcesFitInRightWindow();this.opts.items_per_page=b;this.opts.current_page=0;this.optsApproved.items_per_page=b;this.optsApproved.current_page=0;this.optsRejected.items_per_page=b;this.optsRejected.current_page=0;this.updatePaginationOnTab1();this.updatePaginationOnTab2();this.updatePaginationOnTab3();}};SigmaUIEngine.prototype.buildValuesAndPropertiesPiece=function(){var d=this.profile.properties;this.sI=0;this.sA=[];this.sA[this.sI++]='<ul id="ecsse-profile-list-id">';for(var c=0;c++<d.size;d.next()){var g=d.value();this.addPropertyStart(g);log.info("============"+g.name+"============");var a=g.values;for(j=0;j<a.length;j++){var f=a[j];this.addValue(f);}this.addPropertyEnd(g);}this.sA[this.sI++]="</ul>";var h,e;h=getCurrentTime();var b=this.sA.join("");e=getCurrentTime();h=getCurrentTime();jQuery("#ecsse-profile-list-id").html(b);e=getCurrentTime();h=getCurrentTime();document.getElementById("ecsse-profile-list-id").innerHTML=b;e=getCurrentTime();this.fixWidth();};SigmaUIEngine.prototype.addPropertyStart=function(b){var a="";if(b.active===false){a='style="display:none"';}this.sA[this.sI++]="<li "+a+' class="property" id="'+b.elementID+'"><div class="fl propertyContainer propertyContainerRel propertyCss">';this.sA[this.sI++]='<div class="fr propertyName">'+b.name+"</div>";this.sA[this.sI++]='<div class="br"></div></div><div class="fl valuesContainer"><ul id="'+b.elementID+'__">';};SigmaUIEngine.prototype.addPropertyEnd=function(a){this.sA[this.sI++]='</ul></div><div class="br"></div></li>';};SigmaUIEngine.prototype.addValue=function(c){var a=c.uris[0]?c.uris[0]:c.value;var b="";if(a===undefined&&this.config.customRenderedProperties.indexOf(c.property.name)!==-1){log.warn("there was undefined href for value for property"+c.property.name+". Such value will be hidden");c.hide();b='style="display:none"';}if(c.active===false){b='style="display:none"';}this.sA[this.sI++]="<li "+b+' id="'+c.elementID+'" class="value valueCss"><div class="valueContainerRel">';if(c.property.name==="picture"){log.info("found value in picture property");var d=c.uris[0]?c.uris[0]:c.value;this.sA[this.sI++]='<div class="fl valueLabel">';this.sA[this.sI++]='<img class="imgValue" src="'+d+'"   onerror="javascript:imgError(this);" onload="javascript:imgLoad(this);" />';this.sA[this.sI++]='<span class="sourcesGraphicsIndicator" >';this.sA[this.sI++]=this.generateSourceNumbersString(c);this.sA[this.sI++]="</span>";this.sA[this.sI++]='<a style="display:none;" class="openDocumentSource" href="'+c.getWebLink()+'" title="open source document in new window"></a>';this.sA[this.sI++]="</div>";}else{if(this.config.customRenderedProperties.indexOf(c.property.name)!==-1){a=c.uris[0]?c.uris[0]:c.value;this.sA[this.sI++]='<div class="fl valueLabel">';this.sA[this.sI++]='<a class="label" href="'+a+'">'+a+"</a>";this.sA[this.sI++]='<span class="sourcesGraphicsIndicator" >';this.sA[this.sI++]=this.generateSourceNumbersString(c);this.sA[this.sI++]="</span>";this.sA[this.sI++]='<a style="display:none;" class="openDocumentSource" href="'+c.getWebLink()+'" title="open source document in new window"></a>';this.sA[this.sI++]="</div>";}else{this.sA[this.sI++]='<div class="fl valueLabel">';this.__updateLabel(c);this.sA[this.sI++]='<span class="sourcesGraphicsIndicator" >';this.sA[this.sI++]=this.generateSourceNumbersString(c);this.sA[this.sI++]="</span>";this.sA[this.sI++]='<a style="display:none;" class="openDocumentSource" href="'+c.getWebLink()+'" title="open source document in new window"></a></div>';}}this.sA[this.sI++]='<div class="br"></div></div></li>';};SigmaUIEngine.prototype.__updateLabel=function(a){if(a.uris.length>0){this.sA[this.sI++]='<a class="label" target="blank" href="'+a.getSigmaLink()+'">';}else{this.sA[this.sI++]='<span class="label">';}if(a.label){this.sA[this.sI++]=a.label;}else{if(a.value){this.sA[this.sI++]=a.value;}else{if(a.uris.length>0){this.sA[this.sI++]=decodeURIComponent(a.uris[0]);}else{this.sA[this.sI++]="[?]";}}}if(a.uris.length>0){this.sA[this.sI++]="</a>";}else{this.sA[this.sI++]="</span>";}};SigmaUIEngine.prototype.enableTrashBinClicks=function(){var a=this;jQuery("li.value").live("click",function(c){c.stopPropagation();var d=jQuery(this).attr("title");var b=a.idToValueRender.get(d);b.value.show();b.value.property.show();return false;});jQuery("li.property").live("click",function(c){c.stopPropagation();var d=jQuery(this).attr("title");var b=a.idToPropertyRender.get(d);b.property.show(true);return false;});};SigmaUIEngine.prototype.enableClickOnSourcesTabs=function(){var a=this;jQuery("#showHideRejected").click(function(){a.profile.setRejectedInformationVisible(jQuery(this).attr("checked"));});jQuery("#showHideApproved").click(function(){a.profile.setConfirmedInformationVisible(jQuery(this).attr("checked"));});jQuery("#showHideSources").click(function(){a.profile.setNewInformationVisible(jQuery(this).attr("checked"));});};SigmaUIEngine.prototype.setNewInformationVisible=function(a){jQuery("#showHideSources").attr("checked",a);};SigmaUIEngine.prototype.setConfirmedInformationVisible=function(a){jQuery("#showHideApproved").attr("checked",a);};SigmaUIEngine.prototype.setRejectedInformationVisible=function(a){jQuery("#showHideRejected").attr("checked",a);};SigmaUIEngine.prototype.enableClickAddMoreSourcesFromUrl=function(a){jQuery(".addNewSourceFromUrlButton").click(function(){var b=jQuery("#addNewSourceFromUrlInput").val();if(b!==""&&b.startsWith("http://")){a.addSingleSource(b,function(c){if(!c){}});}else{alert("Wrong url - correct one should start with http:// ");}return false;});};SigmaUIEngine.prototype.enableClickViewsAndLayouts=function(){jQuery(".viewsAndLayoutsButton").click(function(){jQuery(".viewsAndLayoutsDialog").dialog("open");});};SigmaUIEngine.prototype.getProperty=function(a,b){for(i=0;i<b.length;i++){if(b[i].startsWith(a+":")){return b[i].substring(b[i].indexOf(":")+1);}}return false;};SigmaUIEngine.prototype.enableClickCreatePermalink=function(b){var a=this;jQuery("a.permLinkSourcesBoxButton").click(function(){a.createPermalink(b);return false;});jQuery("a.openPermalink").click(function(){if(a.config.rawFlag){jQuery(this).attr("href","http://sig.ma/help.html").attr("target","_blank");return true;}else{a.createPermalink(b);}return false;});jQuery("a.urlTwitter").live("click",function(){a.getShortUrl(jQuery(this).attr("title"));return false;});jQuery("a.sigma-widget-preview").live("click",function(){var e=jQuery("textarea.widgetCode").val();var d=e.substring(e.indexOf("{")+1,e.indexOf("}"));var h=d.trim().split(",");var f=parseInt(a.getProperty("width",h),10);var c=parseInt(a.getProperty("height",h),10);var g='<style type="text/css"> body {margin:0px; padding:0px;}.sigma-widget-preview-box{ position:absolute;left:50%;width:'+f+"px;margin-top:20px;margin-left:-"+Math.floor(f/2)+"px;}</style>";sigmaUtilities.popUpXHtml(e,"Sigma widget preview",f+40,c+40,g);});};SigmaUIEngine.prototype.createPermalink=function(b){var a=this;b.createPermalink(function(k,f,l){log.error("queryString ["+f+"]");var s=k.substring(k.indexOf("=")+1);var o=document.location.port;if(!o){o="";}else{o=":"+o;}var n=document.location.hostname;var d=document.location.protocol+"//";var r=d+n+o;if(n==="apps.sindice.net"||n==="test.sindice.net"){r+="/sigma";}var t=k+"&raw=1";var c=r+"/entity/"+s+".rdf#this";var h=r+"/entity/"+s+".json";var m=r+"/feed/"+s+"/atom_0.3";var v=r+"/feed/"+s+"/rss_2.0";var w=r+"/search?"+f;var u=w+"&raw=1";var e=w+"&format=rdf";var g=w+"&format=json";var q=a.templates.permalinkDialogTemplate;q=q.replace(/@url@/g,k);q=q.replace(/@urlRaw@/g,t);q=q.replace(/@urlRdf@/g,c);q=q.replace(/@urlJson@/g,h);q=q.replace(/@urlRss@/g,v);q=q.replace(/@urlAtom@/g,m);q=q.replace(/@freshUrl@/g,w);q=q.replace(/@freshUrlRaw@/g,u);q=q.replace(/@freshUrlRdf@/g,e);q=q.replace(/@freshUrlJson@/g,g);q=q.replace(/@path@/g,r);q=q.replace(/@id@/g,s);q=q.replace(/@query@/g,l);var p="div.permLinkDialog";jQuery(p).html(q);jQuery(p+" .helpLink").attr("href",sigmaUtilities.getBaseUrl()+"/help.html");if(a.config.showNotifications==true){jQuery(p+" a.signupToPidNotifications").click(function(){var z=s;var y=jQuery(p+" .pidEmail").val();if(!sigmaUtilities.echeck(y)){return;}jQuery("img.signupToPidNotificationIndicator").show();var x={action:"addEmailToPidBasedNotifications",id:z,email:y};services.signupToNotification(x,function(A){if(A.status=="ok"){jQuery("img.signupToPidNotificationIndicator").attr("src","images/icons/ok.png");jQuery("span.signupToPidNotificationIndicatorMsg").text("Done").show();jQuery("span.signupToPidNotificationIndicatorMsgDetail").text("").hide();}else{jQuery("img.signupToPidNotificationIndicator").attr("src","images/icons/nok.png");jQuery("span.signupToPidNotificationIndicatorMsg").text(A.error).show();jQuery("span.signupToPidNotificationIndicatorMsgDetail").text(A.errorDetail).show();}});});jQuery(p+" a.signupToQueryNotifications").click(function(){var y=jQuery(p+" .queryEmail").val();if(!sigmaUtilities.echeck(y)){return;}jQuery("img.signupToQueryNotificationIndicator").show();var x={action:"addEmailToQueryBasedNotifications",query:l,email:y};services.signupToNotification(x,function(z){if(z.status=="ok"){jQuery("img.signupToQueryNotificationIndicator").attr("src","images/icons/ok.png");jQuery("span.signupToQueryNotificationIndicatorMsg").text("Done").show();jQuery("span.signupToQueryNotificationIndicatorMsgDetail").text("").hide();}else{jQuery("img.signupToQueryNotificationIndicator").attr("src","images/icons/nok.png");jQuery("span.signupToQueryNotificationIndicatorMsg").text(z.error).show();jQuery("span.signupToQueryNotificationIndicatorMsgDetail").text(z.errorDetail).show();}});});jQuery(p+" .emailNotifications").show();}jQuery(p+" .sigmaPermalinkTabs").tabs();jQuery(p).dialog("open");jQuery(p).find("span.tooltip.t3").qtip({position:{corner:{target:"topLeft",tooltip:"bottomRight"}},content:'<span class="tolltipText">SIGMA created in such way might contain unapproved information !<span>',style:"sigmaTooltip1"});});};SigmaUIEngine.prototype.getShortUrl=function(a){window.open("http://is.gd/api.php?longurl="+a,"name"+randomString(),"width=350,height=20,top=100,left=100, scrollbars=0,resizable=1,location=0,menubar=0,toolbar=0");};SigmaUIEngine.prototype.enableClickNewSigma=function(){jQuery(".newSigma").click(function(){jQuery(this).parent().parent().find("form").trigger("submit");});};SigmaUIEngine.prototype.enableClickMoreSources=function(a){jQuery(".moreSources").click(function(){var b=jQuery("#q").val();if(b!==""&&b.length>3){a.setQuery(b);}a.orderMoreSources(10);return false;});};SigmaUIEngine.prototype.enableValueButtonsClicks=function(){var a=this;jQuery("a.moreValuesInCompactView").live("click",function(){jQuery(this).closest("div.entityContainer").find("div.valueContainer").each(function(){var c=jQuery(this).attr("id");var b=a.idToValueRender.get(c);if(b.value.hiddenByDisplayMode===true){b.value.hiddenByDisplayMode=false;b.hiddenByDisplayMode(false);}});jQuery(this).remove();});jQuery("a.unfetchedValuesButton").live("click",function(){var c=jQuery(this).closest("div.entityContainer").attr("id");var b=a.idToPropertyRender.get(c);b.property.fetchValues();});jQuery("a.rejectValueSources").live("click",function(){var e=jQuery(this).closest("div.valueContainer").attr("id");var c=a.idToValueRender.get(e);for(var b=0;b<c.value.sources.length;b++){var d=c.value.sources[b];d.reject(true);}});jQuery("a.rejectValueSourcesEvaluation").live("click",function(){var e=jQuery(this).attr("title");var c=a.idToValueRender.get(e);for(var b=0;b<c.value.sources.length;b++){var d=c.value.sources[b];d.reject(true);}return false;});jQuery("a.singleValue").live("click",function(c){var d=jQuery(this).closest("div.valueContainer").attr("id");var b=a.idToValueRender.get(d);b.value.setAsSingleValue();b.value.property.updateActivityState(true);jQuery(this).hide();jQuery(this).parent().parent().parent().parent().parent().parent().parent().find("a.topValueProperty").hide().end().find("a.allValuesProperty").show();return false;});jQuery("a.rejectValue").live("click",function(c){var d=jQuery(this).closest("div.valueContainer").attr("id");var b=a.idToValueRender.get(d);b.value.hide();a.unfilterSources();return false;});jQuery("a.highlightValue").live("click",function(c){var e=jQuery(this).closest("div.valueContainer").attr("id");var b=a.idToValueRender.get(e);jQuery("a.dehighlightValue").hide();jQuery("a.dehighlightSource").hide();jQuery("a.highlightSource").show();jQuery("div.lockedIndicator").hide();a.unfilterSources();jQuery(b.containerIdXPath+" a.highlightValue").hide();jQuery(b.containerIdXPath+" a.dehighlightValue").show();jQuery(b.containerIdXPath+" div.lockedIndicator").show();var d=b.value.label?b.value.label:b.value.value;if(!d){d=b.value.uris[0];}a.filterSources(b.value.sources,"value",d);log.info("Going to append small indicator to  "+b.containerIdXPath+" ["+a.smallValueSourcesFilterIndicator+"]");jQuery(b.containerIdXPath+" div.valueContainerRel div.br").remove();jQuery(b.containerIdXPath+" div.valueContainerRel").append(a.smallValueSourcesFilterIndicator);jQuery(b.containerIdXPath+" div.valueContainerRel").append('<div class="br">');return false;});jQuery("a.dehighlightValue").live("click",function(c){var d=jQuery(this).closest("div.valueContainer").attr("id");var b=a.idToValueRender.get(d);b.engine.unfilterSources();jQuery(b.containerIdXPath+" a.dehighlightValue").hide();jQuery("div.lockedIndicator").hide();jQuery(b.containerIdXPath+" a.highlightValue").show();jQuery(b.containerIdXPath+" .smallValueSourcesFilterIndicator").remove();return false;});jQuery("img.sigmaThis").live("click",function(e){var g=jQuery(e.target);var f=jQuery(this).closest("div.valueContainer").attr("id");var d=a.idToValueRender.get(f);var c=""+window.location;c=c.substring(0,c.indexOf("?")+1);var b=d.value.label;if(!b){b=d.value.uris[0];}b=b.replace(/:|;|\\|\(|\)|\[|\]|\{|\}|\^|\$|\*/g," ");c+="q="+encodeURIComponent(b);window.location.href=c;});};var reEscape=new RegExp("(\\"+["/",".","*","+","?","|","(",")","[","]","{","}","\\"].join("|\\")+")","g");SigmaUIEngine.prototype.enableOkkamSuggestions=function(a){this.a.enable();jQuery("#okkamSugestions").attr("checked","checked");};SigmaUIEngine.prototype.enableOkkamClicks=function(a){var b=this;this.a=jQuery("#q").autocomplete({serviceUrl:"http://api.sindice.com/okkamS2R/search",minChars:2,delimiter:/(,|;)\s*/,maxHeight:400,width:500,zIndex:9999,deferRequestBy:0,params:{format:"json"},onSelect:function(d,c){document.location.href="?q="+c.id+"&okkamSuggestion=1";},fnFormatResult:function(f,e,c){var d="("+c.replace(reEscape,"\\$1")+")";return f.replace(new RegExp(d,"gi"),"<strong>$1</strong>");}});this.a.disable();jQuery("#okkamSugestions").change(function(){if(jQuery(this).is(":checked")){b.profile.okkamSugestions=true;b.a.enable();}else{b.profile.okkamSugestions=false;b.a.disable();}});jQuery("a.okkamEnd").live("click",function(h){var l=jQuery(this).closest("li").attr("id");var f=b.idToSourceRender.get(l);var g=f.source.alternativeUrlsFromOkkam;for(var d=0;d<g.length;d++){var c=g[d];a.addSingleSource(c,function(e){e.isFromOKKAM=true;e.confirm(true);e.notifyObservers("addOkkamLogo");});}f.source.alternativeUrlsFromOkkamFetched=true;f.source.notifyObservers("urlsFromOkkamAdded");var k=h.target;h.stopImmediatePropagation();});};SigmaUIEngine.prototype.enableSourceButtonsClicks=function(){var a=this;jQuery(this.config.sigmaNewSourcesListIdXPath+" a.rejectSource").live("click",function(){var c=jQuery(this).parent().parent().parent().parent().attr("id");var b=a.idToSourceRender.get(c);b.source.reject(true);b.source.setSoloState(false);a.config.valuesFilteredLock=false;a.checkThatAnySourcesLeftAndRemoveSourcesFilter();return false;});jQuery(this.config.sigmaApprovedSourcesListIdXPath+" a.rejectSource").live("click",function(){var c=jQuery(this).parent().parent().parent().parent().attr("id");var b=a.idToSourceRender.get(c);b.source.reject(true);b.source.setSoloState(false);a.config.valuesFilteredLock=false;a.checkThatAnySourcesLeftAndRemoveSourcesFilter();return false;});jQuery(this.config.sigmaRejectedSourcesListIdXPath+" a.unrejectSource").live("click",function(){var c=jQuery(this).parent().parent().parent().parent().attr("id");var b=a.idToSourceRender.get(c);log.info("unreject source");b.source.reject(false);b.source.setSoloState(false);a.config.valuesFilteredLock=false;a.checkThatAnySourcesLeftAndRemoveSourcesFilter();return false;});jQuery(this.config.sigmaNewSourcesListIdXPath+" a.confirmSource").live("click",function(){var c=jQuery(this).parent().parent().parent().parent().attr("id");var b=a.idToSourceRender.get(c);b.source.confirm(true);b.source.setSoloState(false);a.config.valuesFilteredLock=false;a.checkThatAnySourcesLeftAndRemoveSourcesFilter();return false;});jQuery(this.config.sigmaApprovedSourcesListIdXPath+" a.unconfirmSource").live("click",function(){var c=jQuery(this).parent().parent().parent().parent().attr("id");var b=a.idToSourceRender.get(c);log.info("unconfirm source");b.source.confirm(false);b.source.setSoloState(false);a.config.valuesFilteredLock=false;a.checkThatAnySourcesLeftAndRemoveSourcesFilter();return false;});jQuery(this.config.sigmaNewSourcesListIdXPath+" a.confirmSourceFromTheSameDomain").live("click",function(){var d=jQuery(this).parent().parent().parent().parent().attr("id");var b=a.idToSourceRender.get(d);var c=b.source.domain;b.engine.profile.confirmDomain(c);b.source.setSoloState(false);a.config.valuesFilteredLock=false;a.checkThatAnySourcesLeftAndRemoveSourcesFilter();return false;});jQuery(this.config.sigmaNewSourcesListIdXPath+" a.rejectSourceFromTheSameDomain").live("click",function(){var d=jQuery(this).parent().parent().parent().parent().attr("id");var b=a.idToSourceRender.get(d);var c=b.source.domain;b.engine.profile.rejectDomain(c);b.source.setSoloState(false);a.config.valuesFilteredLock=false;a.checkThatAnySourcesLeftAndRemoveSourcesFilter();return false;});jQuery(this.config.sigmaNewSourcesListIdXPath+" a.highlightSource, "+this.config.sigmaApprovedSourcesListIdXPath+" a.highlightSource, "+this.config.sigmaRejectedSourcesListIdXPath+" a.highlightSource").live("click",function(){var c=jQuery(this).parent().parent().parent().parent().attr("id");var b=a.idToSourceRender.get(c);jQuery(this).hide();jQuery(b.containerIdXPath+" a.dehighlightSource").show();b.source.setSoloState(true);a.config.valuesFilteredLock=true;jQuery("#valueFilterIndicator span").html("<b>"+b.source.sourceURI+"</b>");jQuery("#valueFilterIndicator").show();return false;});jQuery(this.config.sigmaNewSourcesListIdXPath+" a.dehighlightSource, "+this.config.sigmaApprovedSourcesListIdXPath+" a.dehighlightSource, "+this.config.sigmaRejectedSourcesListIdXPath+" a.dehighlightSource").live("click",function(){var c=jQuery(this).parent().parent().parent().parent().attr("id");var b=a.idToSourceRender.get(c);b.source.setSoloState(false);jQuery(this).hide();jQuery(b.containerIdXPath+" a.highlightSource").show();a.removePropertyAndValueFilter();return false;});jQuery(".rejectAllSources").click(function(){var b,c;jQuery(a.config.sigmaNewSourcesListIdXPath+" li").each(function(){c=jQuery(this).attr("id");b=a.idToSourceRender.get(c);b.source.reject(true);});a.checkThatAnySourcesLeftAndRemoveSourcesFilter();return false;});jQuery(".approveAllSources").click(function(){var b,c;jQuery(a.config.sigmaNewSourcesListIdXPath+" li").each(function(){c=jQuery(this).attr("id");b=a.idToSourceRender.get(c);b.source.confirm(true);});a.checkThatAnySourcesLeftAndRemoveSourcesFilter();return false;});};SigmaUIEngine.prototype.enableOptionsClicks=function(b){var a=this;jQuery(document).ready(function(){jQuery("a.sigmaOptions").click(function(){a.toggleOptionsContainer(0,b);return false;});jQuery("li.optionsTabClose").click(function(){jQuery("div.sigmaOptionsContainer").hide("slow");return false;});});};SigmaUIEngine.prototype.toggleOptionsContainer=function(a,c){var b=jQuery("div.sigmaOptionsContainer");if(b.is(":visible")){b.hide("slow");return false;}else{jQuery("#sigmaOptionsTabs").tabs("select",a);b.show("slow");return true;}};SigmaUIEngine.prototype.enableClickReorderPropertiesMode=function(){var a=this;jQuery(document).ready(function(){jQuery("a.reorderPropertiesOn").click(function(){if(jQuery(".reorderPropertiesModeIndicator").is(":visible")){jQuery("a.reorderPropertiesOff").click();}else{jQuery(".reorderPropertiesModeButton").hide();jQuery(".reorderPropertiesModeIndicator").show();jQuery("div.propertyContainer").css("cursor","move");}return false;});jQuery("a.reorderPropertiesOff").click(function(){a.disableDragAndDrop();a.enableHoverOverProperty();a.enableHoverOverValue();jQuery(".reorderPropertiesModeButton").show();jQuery(".reorderPropertiesModeIndicator").hide();jQuery("div.propertyContainer").css("cursor","pointer");jQuery("#inReorderPropertiesMode").attr("checked",false);a.config.inReorderPropertiesMode=false;jQuery(".entityLabel").show();jQuery(".entityPicture").show();jQuery(".valuesContainer").show();return false;});jQuery("#inReorderPropertiesMode").attr("checked",a.config.inReorderPropertiesMode);jQuery("#inReorderPropertiesModeHideValues").click(function(){var b=jQuery(this).attr("checked");if(b){a.config.inReorderPropertiesMode=true;jQuery(".entityLabel").hide();jQuery(".entityPicture").hide();jQuery(".valuesContainer").hide();}else{a.config.inReorderPropertiesMode=false;jQuery(".entityLabel").show();jQuery(".entityPicture").show();jQuery(".valuesContainer").show();}});jQuery("#inReorderPropertiesModeDisableButtons").click(function(){var b=jQuery(this).attr("checked");if(b){a.disableHoverOverValue();}else{a.enableHoverOverValue();}});});};SigmaUIEngine.prototype.enableLayoutSwitch=function(){var a=this;jQuery("div.layoutImg a").click(function(){var b=jQuery(this).attr("title");a.profile.setPageLayout(b);a.fixWidth();a.fixHeight();jQuery(".viewsAndLayoutsDialog").dialog("close");});};SigmaUIEngine.prototype.enablePropertyButtonsClicks=function(){var a=this;jQuery("a.stickToPreviousOne1").live("click",function(c){if(jQuery(this).hasClass("ui-state-default")){jQuery(this).hide();jQuery(this).closest("div.propertyButtonsContainer").find("a.stickToPreviousOne2").show();jQuery(this).closest("div.propertyButtonsContainer").find("a.stickToPreviousOne3").hide();var d=jQuery(this).closest("div.entityContainer").attr("id");var b=a.idToPropertyRender.get(d);b.property.setStickToPreviousMode(2);}return false;});jQuery("a.stickToPreviousOne2").live("click",function(c){if(jQuery(this).hasClass("ui-state-default")){jQuery(this).hide();jQuery(this).closest("div.propertyButtonsContainer").find("a.stickToPreviousOne3").show();jQuery(this).closest("div.propertyButtonsContainer").find("a.stickToPreviousOne1").hide();var d=jQuery(this).closest("div.entityContainer").attr("id");var b=a.idToPropertyRender.get(d);b.property.setStickToPreviousMode(3);}return false;});jQuery("a.stickToPreviousOne3").live("click",function(c){if(jQuery(this).hasClass("ui-state-default")){jQuery(this).hide();jQuery(this).closest("div.propertyButtonsContainer").find("a.stickToPreviousOne1").show();jQuery(this).closest("div.propertyButtonsContainer").find("a.stickToPreviousOne2").hide();var d=jQuery(this).closest("div.entityContainer").attr("id");var b=a.idToPropertyRender.get(d);b.property.setStickToPreviousMode(1);}return false;});jQuery("a.singleViewProperty").live("click",function(c){if(jQuery(this).hasClass("ui-state-default")){jQuery(this).parent().parent().find("a").removeClass("ui-state-error");jQuery(this).addClass("ui-state-error");var d=jQuery(this).closest("div.entityContainer").attr("id");var b=a.idToPropertyRender.get(d);b.property.setDisplayMode("single");}return false;});jQuery("a.compactViewProperty").live("click",function(c){if(jQuery(this).hasClass("ui-state-default")){jQuery(this).parent().parent().find("a").removeClass("ui-state-error");jQuery(this).addClass("ui-state-error");var d=jQuery(this).closest("div.entityContainer").attr("id");var b=a.idToPropertyRender.get(d);b.property.setDisplayMode("compact");}return false;});jQuery("a.listViewProperty").live("click",function(c){if(jQuery(this).hasClass("ui-state-default")){jQuery(this).parent().parent().find("a").removeClass("ui-state-error");jQuery(this).addClass("ui-state-error");var d=jQuery(this).closest("div.entityContainer").attr("id");var b=a.idToPropertyRender.get(d);b.property.setDisplayMode("list");}return false;});jQuery("a.hideViewProperty").live("click",function(c){if(jQuery(this).hasClass("ui-state-default")){jQuery(this).parent().parent().find("a").removeClass("ui-state-error");jQuery(this).addClass("ui-state-error");var d=jQuery(this).closest("div.entityContainer").attr("id");var b=a.idToPropertyRender.get(d);a.unfilterSources();b.property.setDisplayMode("hidden");a.hideCovers();}return false;});};SigmaUIEngine.prototype.enableNoResultsClicks=function(){jQuery(".noResultsIndicatorButton").click(function(){jQuery(this).closest("div.noResultsIndicator").hide();});};SigmaUIEngine.prototype.enableShowHideSourcesNumbers=function(){var a=this;if(this.config.rawFlag===false){jQuery(document).ready(function(){var b=a.getShowHideSourcesNumbersFlag();a.setShowHideSourcesNumbersFlag(b);jQuery("#hideShowSourcesNumbers").click(function(){var c=jQuery(this).attr("checked");a.setShowHideSourcesNumbersFlag(c);});});}else{a.setShowHideSourcesNumbersFlag(false);}};SigmaUIEngine.prototype.enableClickRemoveFilterButtons=function(){var a=this;jQuery(".removeSourcesFilterBoxButton").click(function(){a.unfilterSources();});jQuery(".removePropertyAndValueFilterBoxButton").click(function(){a.removePropertyAndValueFilter();});};SigmaUIEngine.prototype.enableFixedboxPanelEvents=function(){var d=jQuery("#fixedboxPanel");var b=jQuery("#fixedboxPanel").offset();var a=0;if(b){a=b.left;}log.debug("panelLeft offset:"+a);jQuery("body").mousemove(function(f){if(sigmaConfig.fixedboxPanel===false){if(Math.abs(f.clientX-a)<250){d.css({width:sigmaConfig.fixedboxPanelWidth});}else{d.css({width:0});}}});var c=this;jQuery("#fixedboxPanel").click(function(){if(sigmaConfig.fixedboxPanel===false){c.hideRightPanel();}else{c.showRightPanel();}});jQuery("li.sourcesTabClose").click(function(){c.hideRightPanel();});};SigmaUIEngine.prototype.enableHover=function(){if(this.config.rawFlag===false){if(this.config.disableHoverOverProperties==false){this.enableHoverOverProperty();}this.enableHoverOverValue();this.enableHoverOverSource();this.enableHoverOverButtons();}};SigmaUIEngine.prototype.enableHoverOverButtons=function(){jQuery("a.action-button").live("mouseover",function(){jQuery(this).addClass("ui-state-hover");}).live("mouseout",function(){jQuery(this).removeClass("ui-state-hover");});};SigmaUIEngine.prototype.enableHoverOverCovers=function(){jQuery("#coverLight").live("mouseover",function(){var a=jQuery(this).data("containerId");jQuery("#"+a).mouseover();}).live("mouseout",function(){jQuery(this).hide();});};SigmaUIEngine.prototype.enableHoverOverValue=function(){var a=this;jQuery("div.profileRight div.valueContainer").live("mouseover",function(m){a.hideHighlighted();var f=m.currentTarget;log.info("enter on value");var g=jQuery(this).attr("id");var c=a.idToValueRender.get(g);var b=c.value.sources;var h=c.value.property.displayMode;var k=c.value.property.entity.pageLayout;if(a.config.disableHoverOverValues==false){c.value.changeHighlightState(true);if(jQuery(f).find(".valueButtonsContainer").length===0){jQuery(f).append(a.templates.valuesButtonsTemplate);jQuery(f).find("div.valueButtonsContainer").addClass(a.config.viewsClasses[k][h].valueButtonsContainer);}jQuery(f).find(".valueButtonsContainer").addClass("highlight").show();var l=jQuery(f).find("div.valueButtonsContainer");var d=jQuery(f).find("div.valueLabelContainer");a.coverBorders(d,l);if(c.value.getWebLink()){jQuery(f).find("a.openDocumentSource").attr("href",c.value.getWebLink()).show();}}if(a.config.valuesFilteredLock===false){if(a.config.disableHoverOverValues==false){jQuery(c.containerIdXPath+" a.openDocumentSourceStyleInvisible").removeClass("openDocumentSourceStyleInvisible").addClass("openDocumentSourceStyleVisible");if(jQuery(c.containerIdXPath+" a.dehighlightValue").css("display")=="none"){jQuery(c.containerIdXPath+" a.rejectValue, "+c.containerIdXPath+" a.highlightValue").show();}else{jQuery(c.containerIdXPath+" a.rejectValue").show();}}a.dynamicSourceHighlightAndFilter(true,b);}}).live("mouseout",function(c){a.hideHighlighted();a.hideCovers();var f=c.currentTarget;jQuery(f).find(".valueButtonsContainer").hide();var d=jQuery(this).attr("id");var b=a.idToValueRender.get(d);log.info("leave value");b.value.changeHighlightState(false);if(a.config.valuesFilteredLock===false){jQuery(this).removeClass("highlighted");jQuery(b.containerIdXPath+" a.openDocumentSourceStyleVisible").removeClass("openDocumentSourceStyleVisible").addClass("openDocumentSourceStyleInvisible");jQuery(b.containerIdXPath+" a.highlightValue, "+b.containerIdXPath+" a.rejectValue").hide();a.dynamicSourceHighlightAndFilter(false);}});jQuery(".valueButtonsContainer").live("mouseover",function(b){if(isIE()){return;}var c=b.target;b.stopImmediatePropagation();jQuery(c).parent().addClass("highlight");}).live("mouseout",function(b){if(isIE()){return;}var c=b.target;b.stopImmediatePropagation();jQuery(c).parent().removeClass("highlight");});};SigmaUIEngine.prototype.disableHoverOverValue=function(){jQuery("#ecsse-profile-list-id li.value").die("mouseover").die("mouseout");};SigmaUIEngine.prototype.enableHoverOverProperty=function(){var a=this;jQuery("div.profileRight div.propertyContainer").live("mouseover",function(n){a.hideHighlighted();log.info("enter on property");var f=n.currentTarget;n.stopImmediatePropagation();var g=jQuery(this).parent().attr("id");var d=a.idToPropertyRender.get(g);var b=d.property.sources;var k=d.property.displayMode;var l=d.property.entity.pageLayout;d.property.changeHighlightState(true);var p=jQuery(f).find(".propertyLabelContainer").width();var o=jQuery(f).width();if(jQuery(f).find(".propertyButtonsContainer").length===0){jQuery(f).append(a.templates.propertyButtonsTemplate);jQuery(f).find("div.propertyButtonsContainer").addClass(a.config.viewsClasses[l][k].propertyButtonsContainer);}var h=jQuery(f).find("div.propertyButtonsContainer");if(l==="layout3"){h.css({left:0});}else{h.css({left:(o-p-2*a.config.propertyOrValueSideMargin-2)});}h.addClass("highlight").show().find("a").removeClass("ui-state-error");if(l==="layout2"){var c=d.property.getStickToPreviousMode();if(c==1){h.find("a.stickToPreviousOne1").show();h.find("a.stickToPreviousOne2").hide();h.find("a.stickToPreviousOne3").hide();}else{if(c==2){h.find("a.stickToPreviousOne1").hide();h.find("a.stickToPreviousOne2").show();h.find("a.stickToPreviousOne3").hide();}else{h.find("a.stickToPreviousOne1").hide();h.find("a.stickToPreviousOne2").hide();h.find("a.stickToPreviousOne3").show();}}}else{h.find("a.stickToPreviousOne").hide();}if(k=="list"){h.find("a.listViewProperty").addClass("ui-state-error");}else{if(k=="single"){h.find("a.singleViewProperty").addClass("ui-state-error");}else{if(k=="compact"){h.find("a.compactViewProperty").addClass("ui-state-error");}else{log.error("Not supported display mode ["+k+"]");}}}var m=jQuery(f).find(".propertyLabelContainer");a.coverBorders(m,h);if(a.config.valuesFilteredLock===false){a.dynamicSourceHighlightAndFilter(true,b);}}).live("mouseout",function(c){a.hideHighlighted();a.hideCovers();var f=c.currentTarget;c.stopImmediatePropagation();jQuery(f).find(".propertyButtonsContainer").hide();if(a.config.valuesFilteredLock===false){a.dynamicSourceHighlightAndFilter(false);}var d=jQuery(this).parent().attr("id");var b=a.idToPropertyRender.get(d);b.property.changeHighlightState(false);});jQuery(".propertyButtonsContainer").live("mouseover",function(b){if(isIE()){return;}var c=b.target;b.stopImmediatePropagation();jQuery(c).parent().addClass("highlight");}).live("mouseout",function(b){if(isIE()){return;}var c=b.target;b.stopImmediatePropagation();jQuery(c).parent().removeClass("highlight");});};SigmaUIEngine.prototype.disableHoverOverProperty=function(){jQuery("div.profileRight div.propertyContainer").die("mouseover").die("mouseout");};SigmaUIEngine.prototype.enableHoverOverSource=function(){var a=this;jQuery(this.config.sigmaNewSourcesListIdXPath+" li.source, "+this.config.sigmaApprovedSourcesListIdXPath+" li.source, "+this.config.sigmaRejectedSourcesListIdXPath+" li.source").live("mouseover",function(){var c=jQuery(this).attr("id");var b=a.idToSourceRender.get(c);if(b.engine.config.valuesFilteredLock===false){b.source.highlightSource(true);b.source.highlightSourcePropertiesAndValues(true);}}).live("mouseout",function(){var c=jQuery(this).attr("id");var b=a.idToSourceRender.get(c);if(b.engine.config.valuesFilteredLock===false){b.source.highlightSource(false);b.source.highlightSourcePropertiesAndValues(false);}});};SigmaUIEngine.prototype.disableHoverOverSource=function(){jQuery(this.config.sigmaNewSourcesListIdXPath+" li.source, "+this.config.sigmaAprovedSourcesListIdXPath+" li.source, "+this.config.sigmaRejectedSourcesListIdXPath+" li.source").die("mouseover").die("mouseout");};var services=new Services();function EntityRenderer(a){this.engine=a;}EntityRenderer.prototype.setNewInformationVisible=function(a){this.engine.setNewInformationVisible(a);};EntityRenderer.prototype.setConfirmedInformationVisible=function(a){this.engine.setConfirmedInformationVisible(a);};EntityRenderer.prototype.setRejectedInformationVisible=function(a){this.engine.setRejectedInformationVisible(a);};EntityRenderer.prototype.sourceAdded=function(a){this.engine.renderSource(a);};EntityRenderer.prototype.propertyAdded=function(c,a){var b=false;if(a){b=a.elementID;log.info("CALLED propertyAdded for ["+c.name+"]with insertBefore = ["+a.name+"] with id ["+b+"]");}else{log.info("CALLED propertyAdded for ["+c.name+"]with insertBefore = ["+a+"]");}this.engine.renderProperty(c,b);c.setStickToPreviousMode(c.getStickToPreviousMode());};EntityRenderer.prototype.finishedAddingNewSources=function(){this.engine.updatePaginationOnTab1();log.info("finishedAddingNewSources");};EntityRenderer.prototype.finishedAddingProperties=function(){this.engine.config.propertiesAndValuesRendering=false;this.engine.sourceToFetched--;if(this.engine.sourceToFetched===0){log.info("FINISH ADDING SOURCES AND ALL VALUES");if(this.engine.profile.disableInitialNotifications===true){log.info("finishedAddingProperties when disableInitialNotifications=true");this.engine.buildValuesAndPropertiesPiece();}}this.__moveProperty("picture","top",null);this.__moveProperty("title","after","picture");this.__moveProperty("given name","after","title");this.__moveProperty("family name","after","given name");this.__moveProperty("comment","after","family name");this.__moveProperty("is creator of","after","comment");};EntityRenderer.prototype.__moveProperty=function(b,e,a){var c;if(e==="top"){c=this.engine.profile.getPropertyOnTop();}else{c=this.engine.profile.getProperty(a);if(!c){c=this.engine.profile.getPropertyOnTop();}}if(c){property=this.engine.profile.getProperty(b);if(!property){property=this.engine.profile.addProperty(b);}if(e==="after"){var d=this.engine.profile.getPropertyAfter(c);if(d){property.moveBefore(d.name);}}else{property.moveBefore(c.name);}}};EntityRenderer.prototype.pageLayoutChanged=function(a){log.info("pageLayoutChanged to:"+a);if(a==="layout1"){this.engine.setShowHideSourcesNumbersFlag(true);}else{if(a==="layout2"){this.engine.setShowHideSourcesNumbersFlag(false);}else{if(a==="layout3"){this.engine.setShowHideSourcesNumbersFlag(true);}}}};function TopLabelObserver(a){this.engine=a;jQuery(this.engine.getSigmaContainerIdXPath()+" div.entityLabel").hide();}TopLabelObserver.prototype.propertyAdded=function(a){if(a.name=="label"){a.addObserver(this);}};TopLabelObserver.prototype.topValueChanged=function(a){if(a){jQuery(this.engine.getSigmaContainerIdXPath()+" .entityLabel").show().text(a.label);this.engine.updateExpandToFullViewLink(a.label);jQuery("."+this.engine.profile.pageLayout+"TopLabelContainer").show();}else{jQuery(this.engine.getSigmaContainerIdXPath()+" .entityLabel").hide();}};function TopPictureObserver(a){this.engine=a;jQuery(this.engine.getSigmaContainerIdXPath()+" .entityPicture").hide();}TopPictureObserver.prototype.propertyAdded=function(a){if(a.name=="picture"){a.addObserver(this);}};TopPictureObserver.prototype.topValueChanged=function(b){return;if(b){var a;if(!b.uris.length){if(b.label){a=b.label;}else{a=b.value;}}else{a=b.uris[0];}jQuery(this.engine.getSigmaContainerIdXPath()+" .entityPicture").replaceWith('<img class="entityPicture entityPictureStyle" src="'+a+'" onerror="javascript:imgErrorDisplayNone(this);" />').show();jQuery("."+this.engine.profile.pageLayout+"TopPictureContainer").show();}else{jQuery(this.engine.getSigmaContainerIdXPath()+" .entityPicture").hide();}};function TopCommentObserver(a){this.engine=a;jQuery(this.engine.getSigmaContainerIdXPath()+" .entityComment").hide();}TopCommentObserver.prototype.propertyAdded=function(a){if(a.name=="comment"){a.addObserver(this);}};TopCommentObserver.prototype.topValueChanged=function(a){return;if(a){jQuery(this.engine.getSigmaContainerIdXPath()+" .entityComment").show().html(a.label);jQuery("."+this.engine.profile.pageLayout+"TopCommentContainer").show();}else{jQuery(this.engine.getSigmaContainerIdXPath()+" .entityComment").hide();}};function SourcesFetchedObserver(a){this.engine=a;jQuery("#fetchingIndicator").hide();}SourcesFetchedObserver.prototype.exhausted=function(){log.warn("exhausted");};SourcesFetchedObserver.prototype.pendingCountUpdated=function(a){jQuery("#pendingSources").html(a);if(a===0){jQuery("#fetchingIndicator").hide();}else{jQuery("#fetchingIndicator").show();}};SourcesFetchedObserver.prototype.noResults=function(a){this.engine.displayNoResultCase(a);};function initialize(o,h,c,k,g){services.addObserver({serviceNotAvailable:function(n,a){}});c.addObserver({queryChanged:function(a){log.info("Setting query #q to ["+a+"]");jQuery("#q").val(a);}});c.addObserver({okkamIDAsQuery:function(a){}});log.info("initialize with i: ["+k+"]");var d=getURLParam("q");var b=getURLParams("id");var l=getURLParam("pid");var m=getURLParam("singlesource");log.info("There is no json from servlet - going to sigmaget one with ajax");if(l){log.info("found pid in location");g.loadPermalink(l);}else{if(getURLParam("okkam")=="0"){c.useOKKAM=false;}if(getURLParam("yboss")=="0"){c.useYBOSS=false;}if(getURLParam("sindice")=="0"){c.useSindice=false;}if(getURLParam("idsearch")=="0"){c.useIdentifierSearch=false;}if(getURLParam("ifpsearch")=="0"){c.useIFPSearch=false;}if(getURLParam("fetchers")){c.fetchers=getURLParam("fetchers");log.info("Setting fetchersString to ["+getURLParam("fetchers")+"]");}if(getURLParam("fetch")=="0"){c.doFetchFromWeb=false;}if(getURLParam("cache")=="0"){c.doUseCaches=false;}if(getURLParam("singlesource")){c.useSingleSource=true;c.useYBOSS=false;c.useOKKAM=false;}if(d){log.info("found query in location");c.setQuery(d);}else{if(b.length>0){}}for(var p=0;p<b.length;p++){c.addStreamForIdentifier(b[p]);}if(m){c.addSingleSource(m,function(a){if(!a){}else{if(a!=null&&a.valueCount==0&&d!=""){href=sigmaUtilities.getBaseUrl()+"/search?singlesource="+encodeURIComponent(m)+"&q=";if(getURLParam("fetchers")){href+="&fetchers="+getURLParam("fetchers");}if(getURLParam("cache")){href+="&cache="+getURLParam("cache");}if(getURLParam("fetch")){href+="&fetch="+getURLParam("fetch");}if(getURLParam("raw")){href+="&raw="+getURLParam("raw");}if(getURLParam("fromsindice")){href+="&fromsindice="+getURLParam("fromsindice");}window.location.href=href;}else{if(a!=null&&a.valueCount==0&&d==""){}}}});}else{var f=20;var e=getURLParam("sources");if(e&&e!==""){f=parseInt(e,10);}o.sourceToFetched=f;c.orderMoreSources(f);}}}var profile;var uiEngine;function startSigma(c){if(isIE7()){alert("Sorry we are currently not able to fully support all browsers. \nWhen using SIGMA on Internet Explorer 7 you might experience some difficulties. \nPlease upgrade to version Internet Explorer 8.\nOur team is working to fix this in near future. Sorry  for any inconvenience.");}var b=getURLParam("raw");profile=new EntityModel();profile.setEmbededMode(sigmaConfig.embededMode);uiEngine=new SigmaUIEngine(sigmaConfig.containerIds[c]);uiEngine.setSigmaContainerId();uiEngine.setRawFlag(b);uiEngine.sourceToFetched=0;uiEngine.setEmbededMode(sigmaConfig.embededMode);uiEngine.setProfile(profile);if(getURLParam("fromsindice")=="1"){uiEngine.fromSindice=true;}if(getURLParam("hideHeader")=="1"){uiEngine.config.hideHeader=true;}if(getURLParam("hideSearchbar")=="1"){uiEngine.config.hideSearchbar=true;}if(getURLParam("hideFooter")=="1"){uiEngine.config.hideFooter=true;}if(getURLParam("hideBottomMessage")=="1"){uiEngine.config.hideBottomMessage=true;}if(getURLParam("showFakeSearchbar")=="1"){uiEngine.config.showFakeSearchbar=true;}if(getURLParam("disableHoverOverProperties")=="1"){uiEngine.config.disableHoverOverProperties=true;}if(getURLParam("disableHoverOverValues")=="1"){uiEngine.config.disableHoverOverValues=true;}if(getURLParam("showHideSourcesNumbers")=="false"){uiEngine.config.showHideSourcesNumbers=false;}if(getURLParam("disableDragMode")=="1"){uiEngine.config.dragMode=false;}if(getURLParam("showNotifications")=="1"){uiEngine.config.showNotifications=true;}uiEngine.initContainers();profile.addObserver(new EntityRenderer(uiEngine));profile.addObserver(new TopLabelObserver(uiEngine));profile.addObserver(new TopPictureObserver(uiEngine));profile.addObserver(new TopCommentObserver(uiEngine));var a=new SourceManager(profile);a.addObserver(new SourcesFetchedObserver(uiEngine));var d=new RecipeManager(profile,a);initialize(uiEngine,profile,a,c,d);uiEngine.enableFixedboxPanelEvents();uiEngine.enableValueButtonsClicks();uiEngine.enablePropertyButtonsClicks();uiEngine.enableSourceButtonsClicks();uiEngine.enableHover();uiEngine.enableTrashBinClicks();uiEngine.enableOkkamClicks(a);if(getURLParam("okkamSuggestion")=="1"){uiEngine.enableOkkamSuggestions();profile.okkamSuggestions=true;}uiEngine.enableClickOnSourcesTabs();uiEngine.enableClickRemoveFilterButtons();uiEngine.enableClickReorderPropertiesMode();uiEngine.fixWidth();uiEngine.enableOnResize();uiEngine.enableClickAddMoreSourcesFromUrl(a);uiEngine.enableClickNewSigma();uiEngine.enableClickMoreSources(a);uiEngine.enableLayoutSwitch();uiEngine.enableHoverOverCovers();uiEngine.enableClickViewsAndLayouts();uiEngine.enableShowHideSourcesNumbers();uiEngine.enableOptionsClicks(d);uiEngine.enableClickCreatePermalink(d);uiEngine.enableNoResultsClicks();if(uiEngine.config.dragMode==true){uiEngine.enableDragAndDrop(".dragMeOn");}}jQuery(document).ready(function(){for(var a=0;a<sigmaConfig.containerIds.length;a++){startSigma(a);}});var sigmaLoaded3=true;