var bitsWiOnLoadInit = true;var bitsWiGenInfo = '{"TermColor":"ff0000", "TermBGColor":"00ff00", "TermMouseoverColor":"99ff99", "TermMouseoverBGColor":"ff0000", "Tooltip":"0", "AutoMode":"0", "ShowPanelMinimized":"0", "StyleDefinition":"#bitsWiUIMainDiv{ background-image:url(http://www.wired-icon.com/wi_webpart/ui_back.gif); position:absolute; border:1px solid #ff3354; z-index:500;}#bitsWiUIDragBarDiv{ border:6px solid #ff3354;}#bitsWiUILogoAnchor{ text-decoration:none; margin:0px;}#bitsWiUIGUIContainerDiv{ /* padding:5px;*/ /* width:160px;*/ width:100%;}#bitsWiUIGUIContainerMinimizeDiv{}#bitsWiUILogoImg{ border:0px; margin-bottom:5px;}#bitsWiUIExecBtn{ padding:0px;}#bitsWiUIExecBtnImg{}#bitsWiUIClearBtn{ padding:0px;}#bitsWiUIClearBtnImg{}#bitsWiUIHeadBtn{ padding:0px;}#bitsWiUIHeadBtnImg{}#bitsWiUIHighlightBtn{ padding:0px;}#bitsWiUIHighlightBtnImg{}#bitsWiUIListBtn{ padding:0px;}#bitsWiUIListBtnImg{}#bitsWiUIQuestionBtn{ padding:0px;}#bitsWiUIQuestionBtnImg{}#bitsWiUIMinimizeBtn{ padding:0px;}#bitsWiUIMinimizeBtnImg{}#bitsWiUIReopenBtn{ padding:0px;}#bitsWiUIReopenBtnImg{}#bitsWiUIDicBtn{ padding:0px;}#bitsWiUIDicImg{}#bitsWiUIDicSelect{ width:120px; margin-top:10px;}.bitsWiUIDicSelOpt{}#bitsWiUIFctBtn{ padding:0px;}#bitsWiUIFctImg{}#bitsWiUIFctSelect{ width:120px; margin-top:10px;}.bitsWiUIFctSelOpt{}#bitsWiUIMultiSelDiv{ position:absolute; border:1px solid #ff3354; background-color:#ffa899; padding:5px; visibility:visible;}#bitsWiUISearchResListDiv{ position:absolute; border:1px solid #ff0000; padding:5px; background-image:url(http://www.wired-icon.com/wi_webpart/ui_back.gif);}#bitsWiUISearchResListTable{ border-collapse:collapse; background-color:#ffffff;}.bitsWiUISearchResListCells{ border:1px solid #777777;}.bitsWiFacetIMAGE{ border:0px;}#bitsWiUITable{ border-collapse:collapse; border:0; padding:0; margin:5px; cellspacing:0;}#bitsWiUITop{ height:0px; width:0px; border:0; padding:0; margin:0; cellspacing:0;}#bitsWiUITopLeft{ height:0px; width:0px; border:0; padding:0; margin:0; cellspacing:0;}#bitsWiUITopCenter{ height:0px; width:0px; border:0; padding:0; margin:0; cellspacing:0;}#bitsWiUITopRight{ height:0px; width:0px; border:0; padding:0; margin:0; cellspacing:0;}#bitsWiUIMid{ border:0; padding:0; margin:0; cellspacing:0;}#bitsWiUIMidLeft{ border:0; padding:1px; margin:0; cellspacing:0;}#bitsWiUIMidCenter{ border:0; padding:1px; margin:0; cellspacing:0;}#bitsWiUIMidRight{ border:0; padding:1px; margin:0; cellspacing:0;}#bitsWiUIBottom{ height:0px; width:0px; border:0; padding:0; margin:0; cellspacing:0;}#bitsWiUIBottomLeft{ height:0px; width:0px; border:0; padding:0; margin:0; cellspacing:0;}#bitsWiUIBottomCenter{ height:0px; width:0px; border:0; padding:0; margin:0; cellspacing:0;}#bitsWiUIBottomRight{ height:0px; width:0px; border:0; padding:0; margin:0; cellspacing:0;}#bitsWiSelBox { position:absolute; z-index:10000;}#bitsWiSelSubBox { position:absolute; z-index:10001;}.bitsWiSelBox { background-image:url(http://www.wired-icon.com/wi_webpart/ui_back.gif); padding:2px; border:1px solid #ff3354;}.bitsWiSelBox ul{ margin:2px 0; padding:0; list-style-type:none;}.bitsWiSelBox li{ margin:2px; padding:0 4px; background:#fff; text-align:left;}.bitsWiSelBox li:hover{ background:#ea618e; color:#fff;}.bitsWiSelBox a{ text-decoration:none; color:#666;}.bitsWiSelBox a:hover{ text-decoration:none; background:#ea618e; color:#fff;}", "PanelPosition":"UpperRight", "AttachDivID":"", "DefaultDicID":"wi_dicid_20080509_0001", "DefaultFctIDs":"wi_fctid_20080509_0006", "HeadOnURL":"http://www.wired-icon.com/wi_webpart/icon_head_on.gif", "HeadOffURL":"http://www.wired-icon.com/wi_webpart/icon_head_off.gif", "HighlightOnURL":"http://www.wired-icon.com/wi_webpart/icon_highlight_on.gif", "HighlightOffURL":"http://www.wired-icon.com/wi_webpart/icon_highlight_off.gif", "MarkerPopupShow":"hide", "MarkerPopupPos":"", "MarkerPopup1stFacetCnt":"5"}';
var bitsWiDicInfo = new Array();bitsWiDicInfo[0] = '{"property":{"id":"wi_dicid_20080509_0001","name":"digital camera","idsid":"wi_idsid_20071212_0001","match_algorithm":"Term List","id_split":";","desc_prefix":"http://www.wired-icon.com/wi_asp/wi_gdesc.cgi?dic=wi_dicid_20080509_0001&wiuid=wi_usrid_20071016_0001"},"term2ID":{"BDC-200EX":"BDC-200EX","DiSu120T":"DiSu120T","DiSu120X":"DiSu120X","GE220":"GE220","MoonFx200":"MoonFx200","BDC-200":"BDC-200"}}';
var bitsWiFctInfo = new Array();bitsWiFctInfo[0] = '{"property":{"id":"wi_fctid_20080509_0002","name":"manufacturer","idsid":"wi_idsid_20071212_0001","fct_type":"IMAGE","fct_prefix":"http://www.wired-icon.com/wi_asp/wi_gfct.cgi?gftype=TEXTIMAGE&fct=wi_fctid_20080509_0002&wiuid=wi_usrid_20071016_0001&fcd=wi_fcdid_20080509_0004&termid=","lnk_prefix":""}}';
bitsWiFctInfo[1] = '{"property":{"id":"wi_fctid_20080509_0003","name":"pixel count","idsid":"wi_idsid_20071212_0001","fct_type":"IMAGE","fct_prefix":"http://www.wired-icon.com/wi_asp/wi_gfct.cgi?gftype=TEXTIMAGE&fct=wi_fctid_20080509_0003&wiuid=wi_usrid_20071016_0001&fcd=wi_fcdid_20080509_0005&termid=","lnk_prefix":""}}';
bitsWiFctInfo[2] = '{"property":{"id":"wi_fctid_20080509_0004","name":"optical zoom","idsid":"wi_idsid_20071212_0001","fct_type":"IMAGE","fct_prefix":"http://www.wired-icon.com/wi_asp/wi_gfct.cgi?gftype=TEXTIMAGE&fct=wi_fctid_20080509_0004&wiuid=wi_usrid_20071016_0001&fcd=wi_fcdid_20080509_0006&termid=","lnk_prefix":""}}';
bitsWiFctInfo[3] = '{"property":{"id":"wi_fctid_20080509_0005","name":"digital zoom","idsid":"wi_idsid_20071212_0001","fct_type":"IMAGE","fct_prefix":"http://www.wired-icon.com/wi_asp/wi_gfct.cgi?gftype=TEXTIMAGE&fct=wi_fctid_20080509_0005&wiuid=wi_usrid_20071016_0001&fcd=wi_fcdid_20080509_0007&termid=","lnk_prefix":""}}';
bitsWiFctInfo[4] = '{"property":{"id":"wi_fctid_20080509_0006","name":"price shift","idsid":"wi_idsid_20071212_0001","fct_type":"IMAGE","fct_prefix":"http://www.wired-icon.com/wi_asp/wi_gfct.cgi?gftype=LINE&fct=wi_fctid_20080509_0006&wiuid=wi_usrid_20071016_0001&fcd=wi_fcdid_20080509_0008&termid=","lnk_prefix":""}}';
bitsWiFctInfo[5] = '{"property":{"id":"wi_fctid_20080509_0007","name":"evaluation (5 stars)","idsid":"wi_idsid_20071212_0001","fct_type":"IMAGE","fct_prefix":"http://www.wired-icon.com/wi_asp/wi_gfct.cgi?gftype=STAR&fct=wi_fctid_20080509_0007&wiuid=wi_usrid_20071016_0001&fcd=wi_fcdid_20080509_0009&termid=","lnk_prefix":""}}';
bitsWiFctInfo[6] = '{"property":{"id":"wi_fctid_20080509_0008","name":"evaluation (5 rating criteria)","idsid":"wi_idsid_20071212_0001","fct_type":"IMAGE","fct_prefix":"http://www.wired-icon.com/wi_asp/wi_gfct.cgi?gftype=RADAR&fct=wi_fctid_20080509_0008&wiuid=wi_usrid_20071016_0001&fcd=wi_fcdid_20080509_0010&termid=","lnk_prefix":""}}';
bitsWiFctInfo[7] = '{"property":{"id":"wi_fctid_20080509_0009","name":"sales","idsid":"wi_idsid_20071212_0001","fct_type":"IMAGE","fct_prefix":"http://www.wired-icon.com/wi_asp/wi_gfct.cgi?gftype=BAR&fct=wi_fctid_20080509_0009&wiuid=wi_usrid_20071016_0001&fcd=wi_fcdid_20080509_0011&termid=","lnk_prefix":""}}';
bitsWiFctInfo[8] = '{"property":{"id":"wi_fctid_20080509_0010","name":"customer base","idsid":"wi_idsid_20071212_0001","fct_type":"IMAGE","fct_prefix":"http://www.wired-icon.com/wi_asp/wi_gfct.cgi?gftype=BAR&fct=wi_fctid_20080509_0010&wiuid=wi_usrid_20071016_0001&fcd=wi_fcdid_20080509_0012&termid=","lnk_prefix":""}}';
var bitsWiTemplateHTML="
| | |
| | |
| | |
";
var bitsWiUIMultiSelDivHTML="
Dictionary
Facet
";
/*--------------------------------------------------------------------------
* WIREDiCON JavaScript Version 0.9.6
* (c) 2007 - 2008 BITS Co., Ltd.
* WIREDiCON JavaScript is not redistributable for both commercial and
* non-commercial purpose.
/*--------------------------------------------------------------------------*/
var bitsWi;
var bitsWiBrowser;
var bitsWiDragBar;
var bitsWiDragBarOffsetX;
var bitsWiDragBarOffsetY;
var bitsWiDragBarClientX;
var bitsWiDragBarClientY;
var bitsWiInitializing;
var bitsWiTargetIDs = new Array();
var bitsWiExcludeIDs = new Array();
var bitsWiInTargetF = new Array();
var bitsWiInExcludeF = new Array();
var bitsWiFirstAutoF = "0";
var bitsWiSelBoxListCnt = 5;
var bitsWiOnMouseSelBox;
var bitsWiShowSelBoxTimer = null;
var bitsWiHideSelBoxTimer = null;
var bitsWiOnMouseSelSubBox;
var bitsWiShowSelSubBoxTimer = null;
var bitsWiHideSelSubBoxTimer = null;
var bitsWiScrollingTimer = null;
var bitsWiDispTooltip = 0;
var bitsWiMouseOverWaitID = null;
var bitsWiRequestTooltipTimer = null;
var bitsWiShowTooltipTimer = null;
var bitsWiHideTooltipTimer = null;
//bitsWIaddEvent(window, 'load', bitsWiInit);
if(bitsWiOnLoadInit){
bitsWIaddEvent(window, 'load', bitsWiInit);
}else{
bitsWiInit ();
}
function bitsWiInit () {
bitsWiInitializing = true;
bitsWiBrowserCheck();
bitsWi = new bitsWIREDiCON();
bitsWi.init();
bitsWi.showUI();
if (bitsWi.property["DefaultDicID"] != null && bitsWi.property["DefaultDicID"].length > 0) {
var dicList = document.getElementById("bitsWiUIDicSelect");
for (var selIdx = 0; selIdx < dicList.childNodes.length; selIdx++) {
if (dicList.childNodes[selIdx].getAttribute("value") == bitsWi.property["DefaultDicID"]) {
dicList.selectedIndex = selIdx;
bitsWiOnChangeDic(bitsWi.property["DefaultDicID"]);
}
}
}
if (bitsWi.property["DefaultFctIDs"] != null && bitsWi.property["DefaultFctIDs"].length > 0) {
var fctList = document.getElementById("bitsWiUIFctSelect");
var fctIDs = bitsWi.property["DefaultFctIDs"].split(";");
var selCnt = 0;
for (var selIdx = 0; selIdx < fctList.childNodes.length; selIdx++) {
for (var fctIdx = 0; fctIdx < fctIDs.length; fctIdx++) {
if (fctList.childNodes[selIdx].getAttribute("value") == fctIDs[fctIdx]) {
selCnt++;
fctList[selIdx].setAttribute("selected", "true");
if (selCnt == 1) {
bitsWi.selectFctById(fctIDs[fctIdx]);
} else {
bitsWi.addSelectFctById(fctIDs[fctIdx]);
}
}
}
}
}
bitsWIaddEvent(window, 'resize', function() {
bitsWiAdjustPanelPos();
bitsWiAdjustMultiSelPos();
bitsWiAdjustSearchResPos();
});
bitsWIaddEvent(window, 'scroll', function() {
if(bitsWiScrollingTimer) clearTimeout(bitsWiScrollingTimer);
bitsWiScrollingTimer = setTimeout(function() {
bitsWiAdjustPanelPos();
bitsWiAdjustMultiSelPos();
bitsWiAdjustSearchResPos();
}, 500);
// bitsWiAdjustPanelPos();
// bitsWiAdjustMultiSelPos();
// bitsWiAdjustSearchResPos();
});
bitsWiSelBoxListCnt = bitsWi.property["MarkerPopup1stFacetCnt"];
bitsWiInitializing = false;
if (bitsWi.property["TargetIDs"] != null) {
bitsWiTargetIDs = bitsWi.property["TargetIDs"].split(";");
for (var i = 0; i < bitsWiTargetIDs.length; i++) {
bitsWiInTargetF.push(0);
}
}
if (bitsWi.property["ExcludeIDs"] != null) {
bitsWiExcludeIDs = bitsWi.property["ExcludeIDs"].split(";");
for (var i = 0; i < bitsWiExcludeIDs.length; i++) {
bitsWiInExcludeF.push(0);
}
}
if (bitsWi.property["AutoMode"] != null && bitsWi.property["AutoMode"] == "1") {
bitsWiFirstAutoF = "1";
bitsWiExecSearch();
bitsWiFirstAutoF = "0";
}
}
function bitsWiAdjustPanelPos () {
if (bitsWi.property["UIIsAttached"] != null && bitsWi.property["UIIsAttached"] == "1") {
return;
}
var bitsWiUIMainDiv = document.getElementById("bitsWiUIMainDiv");
if (document.compatMode && document.compatMode != "BackCompat") {
if (bitsWi.property["PanelPosition"] != null) {
if (bitsWi.property["PanelPosition"] == "UpperRight") {
bitsWiUIMainDiv.style.top = (document.documentElement.scrollTop + 1) + 'px';
bitsWiUIMainDiv.style.left = (document.body.clientWidth + document.documentElement.scrollLeft - bitsWiUIMainDiv.clientWidth - 4) + 'px';
} else if (bitsWi.property["PanelPosition"] == "UpperLeft") {
bitsWiUIMainDiv.style.top = (document.documentElement.scrollTop + 1) + 'px';
bitsWiUIMainDiv.style.left = document.documentElement.scrollLeft + 'px';
} else if (bitsWi.property["PanelPosition"] == "LowerRight") {
bitsWiUIMainDiv.style.top = (document.documentElement.scrollTop + document.documentElement.clientHeight - bitsWiUIMainDiv.clientHeight - 4) + 'px';
bitsWiUIMainDiv.style.left = (document.body.clientWidth + document.documentElement.scrollLeft - bitsWiUIMainDiv.clientWidth - 4) + 'px';
} else if (bitsWi.property["PanelPosition"] == "LowerLeft") {
bitsWiUIMainDiv.style.top = (document.documentElement.scrollTop + document.documentElement.clientHeight - bitsWiUIMainDiv.clientHeight - 4) + 'px';
bitsWiUIMainDiv.style.left = document.documentElement.scrollLeft + 'px';
} else if (bitsWi.property["PanelPosition"] == "Floating") {
if (bitsWiDragBarClientY > document.documentElement.clientHeight - bitsWiUIMainDiv.clientHeight) {
bitsWiDragBarClientY = document.documentElement.clientHeight - bitsWiUIMainDiv.clientHeight - 4;
}
if (bitsWiDragBarClientX > document.documentElement.clientWidth - bitsWiUIMainDiv.clientWidth) {
bitsWiDragBarClientX = document.documentElement.clientWidth - bitsWiUIMainDiv.clientWidth -4;
}
if (bitsWiDragBarClientY < 0) {
bitsWiDragBarClientY = 0;
}
if (bitsWiDragBarClientX < 0) {
bitsWiDragBarClientX = 0;
}
bitsWiUIMainDiv.style.top = (document.documentElement.scrollTop + bitsWiDragBarClientY) + 'px';
bitsWiUIMainDiv.style.left = (document.documentElement.scrollLeft + bitsWiDragBarClientX) + 'px';
} else {
bitsWiUIMainDiv.style.top = (document.documentElement.scrollTop + 1);
bitsWiUIMainDiv.style.left = (document.documentElement.clientWidth - bitsWiUIMainDiv.clientWidth - 4) + 'px';
}
} else {
bitsWiUIMainDiv.style.top = (document.documentElement.scrollTop) + 'px';
bitsWiUIMainDiv.style.left = (document.documentElement.clientWidth - bitsWiUIMainDiv.clientWidth - 4) + 'px';
}
} else {
if (bitsWi.property["PanelPosition"] != null) {
if (bitsWi.property["PanelPosition"] == "UpperRight") {
bitsWiUIMainDiv.style.top =( document.body.scrollTop + 1) + 'px';
bitsWiUIMainDiv.style.left = (document.body.clientWidth + document.body.scrollLeft - bitsWiUIMainDiv.clientWidth - 4) + 'px';
} else if (bitsWi.property["PanelPosition"] == "UpperLeft") {
bitsWiUIMainDiv.style.top = (document.body.scrollTop + 1) + 'px';
bitsWiUIMainDiv.style.left = document.body.scrollLeft + 'px';
} else if (bitsWi.property["PanelPosition"] == "LowerRight") {
bitsWiUIMainDiv.style.top = (document.body.scrollTop + document.body.clientHeight - bitsWiUIMainDiv.clientHeight - 4) + 'px';
bitsWiUIMainDiv.style.left = (document.body.clientWidth + document.body.scrollLeft - bitsWiUIMainDiv.clientWidth - 4) + 'px';
} else if (bitsWi.property["PanelPosition"] == "LowerLeft") {
bitsWiUIMainDiv.style.top = (document.body.scrollTop + document.body.clientHeight - bitsWiUIMainDiv.clientHeight - 4) + 'px';
bitsWiUIMainDiv.style.left = document.body.scrollLeft + 'px';
} else if (bitsWi.property["PanelPosition"] == "Floating") {
if (bitsWiDragBarClientY > document.body.clientHeight - bitsWiUIMainDiv.clientHeight) {
bitsWiDragBarClientY = document.body.clientHeight - bitsWiUIMainDiv.clientHeight - 4;
}
if (bitsWiDragBarClientX > document.body.clientWidth - bitsWiUIMainDiv.clientWidth) {
bitsWiDragBarClientX = document.body.clientWidth - bitsWiUIMainDiv.clientWidth -4;
}
if (bitsWiDragBarClientY < 0) {
bitsWiDragBarClientY = 0;
}
if (bitsWiDragBarClientX < 0) {
bitsWiDragBarClientX = 0;
}
bitsWiUIMainDiv.style.top = (document.body.scrollTop + bitsWiDragBarClientY) + 'px';
bitsWiUIMainDiv.style.left = (document.body.scrollLeft + bitsWiDragBarClientX) + 'px';
} else {
bitsWiUIMainDiv.style.top = (document.body.scrollTop + 1) + 'px';
bitsWiUIMainDiv.style.left = (document.body.clientWidth - bitsWiUIMainDiv.clientWidth - 4) + 'px';
}
} else {
bitsWiUIMainDiv.style.top = (document.body.scrollTop + 1) + 'px';
bitsWiUIMainDiv.style.left = (document.body.clientWidth - bitsWiUIMainDiv.clientWidth - 4) + 'px';
}
}
}
function bitsWiAdjustMultiSelPos () {
var bitsWiUIMultiSelDiv = document.getElementById("bitsWiUIMultiSelDiv");
if (bitsWiUIMultiSelDiv == null) {
return;
}
if (document.compatMode && document.compatMode != "BackCompat") {
bitsWiUIMultiSelDiv.style.top = (document.documentElement.scrollTop + 50) + 'px';
bitsWiUIMultiSelDiv.style.left = (document.documentElement.scrollLeft + 50) + 'px';
} else {
bitsWiUIMultiSelDiv.style.top = (document.body.scrollTop + 50) + 'px';
bitsWiUIMultiSelDiv.style.left = (document.body.scrollLeft + 50) + 'px';
}
}
function bitsWiAdjustSearchResPos () {
var bitsWiUISearchResListDiv = document.getElementById("bitsWiUISearchResListDiv");
if (bitsWiUISearchResListDiv == null) {
return;
}
if (document.compatMode && document.compatMode != "BackCompat") {
bitsWiUISearchResListDiv.style.top = (document.documentElement.scrollTop + 50) + 'px';
bitsWiUISearchResListDiv.style.left = (document.documentElement.scrollLeft + 50) + 'px';
} else {
bitsWiUISearchResListDiv.style.top = (document.body.scrollTop + 50) + 'px';
bitsWiUISearchResListDiv.style.left = (document.body.scrollLeft + 50) + 'px';
}
}
function bitsWiOnMouseDown(e) {
bitsWiDragBar = this;
var bitsWiUIMainDiv = document.getElementById("bitsWiUIMainDiv");
if (document.all) {
bitsWiDragBarOffsetX = event.offsetX;
bitsWiDragBarOffsetY = event.offsetY;
} else {
bitsWiDragBarOffsetX = e.pageX - parseInt(bitsWiUIMainDiv.style.left);
bitsWiDragBarOffsetY = e.pageY - parseInt(bitsWiUIMainDiv.style.top);
}
return false;
}
function bitsWiOnMouseMove(e) {
if (!bitsWiDragBar) {
return true;
}
var bitsWiUIMainDiv = document.getElementById("bitsWiUIMainDiv");
if (document.all) {
if (document.compatMode && document.compatMode != "BackCompat") {
bitsWiUIMainDiv.style.left = (event.clientX - bitsWiDragBarOffsetX + document.documentElement.scrollLeft) + 'px';
bitsWiUIMainDiv.style.top = (event.clientY - bitsWiDragBarOffsetY + document.documentElement.scrollTop) + 'px';
} else {
bitsWiUIMainDiv.style.left = (event.clientX - bitsWiDragBarOffsetX + document.body.scrollLeft) + 'px';
bitsWiUIMainDiv.style.top = (event.clientY - bitsWiDragBarOffsetY + document.body.scrollTop) + 'px';
}
bitsWiDragBarClientX = event.clientX - bitsWiDragBarOffsetX;
bitsWiDragBarClientY = event.clientY - bitsWiDragBarOffsetY;
} else {
bitsWiUIMainDiv.style.left = (e.pageX - bitsWiDragBarOffsetX) + 'px';
bitsWiUIMainDiv.style.top = (e.pageY - bitsWiDragBarOffsetY) + 'px';
bitsWiDragBarClientX = e.pageX - bitsWiDragBarOffsetX - document.body.scrollLeft;
bitsWiDragBarClientY = e.pageY - bitsWiDragBarOffsetY - document.body.scrollTop;
}
try {
e.preventDefault();
} catch (ex) {
}
try {
e.stopPropagation();
} catch (ex) {
}
try {
e.returnValue = false;
} catch (ex) {
}
return false;
}
function bitsWiOnMouseUp(e) {
bitsWiDragBar = null;
}
function bitsWiBrowserCheck () {
var ua=navigator.userAgent;
if (ua.indexOf("Firefox") >= 0) {
bitsWiBrowser = "Firefox";
} else if (ua.indexOf("Chrome") >= 0) {
bitsWiBrowser = "Chrome";
} else if (ua.indexOf("Safari") >= 0) {
bitsWiBrowser = "Safari";
} else if (ua.indexOf("opera") >= 0) {
bitsWiBrowser = "Opera";
} else if (ua.indexOf("MSIE 5") >= 0) {
bitsWiBrowser = "IE5";
} else if (ua.indexOf("MSIE 6") >= 0) {
bitsWiBrowser = "IE6";
} else if (ua.indexOf("MSIE 7") >= 0) {
bitsWiBrowser = "IE7";
} else if (ua.indexOf("MSIE 8") >= 0) {
bitsWiBrowser = "IE8";
} else if (ua.indexOf("MSIE") >= 0) {
bitsWiBrowser = "IE";
} else if (ua.indexOf("Netscape") >= 0) {
bitsWiBrowser = "Netscape";
} else {
bitsWiBrowser = "Other";
}
}
function bitsWiOnChangeDic (dic_id) {
bitsWi.selectDicById(dic_id);
var seldic = bitsWi.getSelectedDictionary();
var bitsWiUIFctSelect = document.getElementById("bitsWiUIFctSelect");
while(bitsWiUIFctSelect.hasChildNodes()) {
bitsWiUIFctSelect.removeChild(bitsWiUIFctSelect.firstChild);
}
bitsWiUpdateDicPairHTML();
var opt;
var txt;
var fFirstFct = true;
for (var i = 0; i < bitsWi.fctArray.length; i++) {
if (seldic.property["idsid"] == bitsWi.fctArray[i].property["idsid"]) {
if (fFirstFct) {
bitsWi.selectFctById(bitsWi.fctArray[i].property["id"]);
fFirstFct = false;
}
opt = document.createElement("option");
opt.setAttribute("class", "bitsWiUIFctSelOpt");
opt.className = "bitsWiUIFctSelOpt";
opt.setAttribute("value", bitsWi.fctArray[i].property["id"]);
txt = document.createTextNode(bitsWi.fctArray[i].property["name"]);
opt.appendChild(txt);
bitsWiUIFctSelect.appendChild(opt);
}
}
if (fFirstFct) {
bitsWi.clearFctSelection();
}
if (bitsWi.property["FctIsMultiple"] != null && bitsWi.property["FctIsMultiple"] == "1") {
opt = document.createElement("option");
opt.setAttribute("class", "bitsWiUIFctSelOpt");
opt.className = "bitsWiUIFctSelOpt";
opt.setAttribute("value", "MULTI");
txt = document.createTextNode("MULTI");
opt.appendChild(txt);
bitsWiUIFctSelect.appendChild(opt);
}
bitsWiUpdateFctPairHTML();
if (bitsWi.property["AutoMode"] != null && bitsWi.property["AutoMode"] == "1") {
bitsWiExecSearch();
}
}
function bitsWiUpdateDicPairHTML () {
var seldic = bitsWi.getSelectedDictionary();
var div = document.getElementById("bitsWiUIDicPairDiv");
if(div){
if (seldic.property["pair_html"]) {
div.style.overflow = "visible";
div.style.height = "";
div.innerHTML = seldic.property["pair_html"];
} else {
div.style.overflow = "hidden";
div.innerHTML = "";
if(document.compatMode == "BackCompat"){
div.style.height = "auto";
}else{
div.style.height = "0%";
}
}
}
}
function bitsWiExecSearch() {
if (bitsWiInitializing) {
return;
}
bitsWiClearIcons();
bitsWiHideTooltip(null);
bitsWiHideSelBox();
bitsWi.property["TermCountPerPage"] = new Array();
var node = document;
bitsWiTraverse(node);
for (var i = 0; i < bitsWi.descURLs.length; i++) {
var scr = document.createElement("script");
scr.setAttribute("src", bitsWi.descURLs[i]);
document.body.appendChild(scr);
}
}
function bitsWiClearIcons() {
var bitsWiSpanNode = bitsWiGetElementsByTagClass("span", "bitsWiWIREDiCONSpan");
for (var i = 0; i < bitsWiSpanNode.length; i++) {
var txtNodeValue = "";
if(bitsWiSpanNode[i].nextSibling && bitsWiSpanNode[i].nextSibling.nodeType == "3"){
txtNodeValue = bitsWiSpanNode[i].nextSibling.nodeValue;
bitsWiSpanNode[i].parentNode.removeChild(bitsWiSpanNode[i].nextSibling);
}
txtNodeValue = bitsWiSpanNode[i].firstChild.firstChild.nodeValue + txtNodeValue;
if(bitsWiSpanNode[i].previousSibling && bitsWiSpanNode[i].previousSibling.nodeType == "3"){
txtNodeValue = bitsWiSpanNode[i].previousSibling.nodeValue + txtNodeValue;
bitsWiSpanNode[i].parentNode.removeChild(bitsWiSpanNode[i].previousSibling);
}
var txtNode = document.createTextNode(txtNodeValue);
bitsWiSpanNode[i].parentNode.insertBefore(txtNode, bitsWiSpanNode[i]);
bitsWiSpanNode[i].parentNode.removeChild(bitsWiSpanNode[i]);
}
bitsWi.searchRes = new Array();
bitsWi.descURLs = new Array();
}
function bitsWiToggleHead() {
var btn = document.getElementById("bitsWiUIHeadBtn");
var img = btn.firstChild;
if (bitsWi.property["InsertHeadOnly"] == "1") {
img.setAttribute("src", bitsWi.property["HeadOffURL"]);
bitsWi.property["InsertHeadOnly"] = "0";
var nodes = bitsWiGetElementsByTagClass("img", "bitsWiFacetIMAGE");
for (var i = 0; i < nodes.length; i++) {
nodes[i].style.display = "";
}
nodes = bitsWiGetElementsByTagClass("span", "bitsWiFacetTEXT");
for (var i = 0; i < nodes.length; i++) {
nodes[i].style.display = "";
}
nodes = bitsWiGetElementsByTagClass("span", "bitsWiFacetHTML");
for (var i = 0; i < nodes.length; i++) {
nodes[i].style.display = "";
}
} else {
img.setAttribute("src", bitsWi.property["HeadOnURL"]);
bitsWi.property["InsertHeadOnly"] = "1";
var nodes = bitsWiGetElementsByTagClass("img", "bitsWiFacetIMAGE");
for (var i = 0; i < nodes.length; i++) {
if (nodes[i].getAttribute("bitsWiIndexOfEachTerm") != "1") {
nodes[i].style.display = "none";
}
}
nodes = bitsWiGetElementsByTagClass("span", "bitsWiFacetTEXT");
for (var i = 0; i < nodes.length; i++) {
if (nodes[i].getAttribute("bitsWiIndexOfEachTerm") != "1") {
nodes[i].style.display = "none";
}
}
nodes = bitsWiGetElementsByTagClass("span", "bitsWiFacetHTML");
for (var i = 0; i < nodes.length; i++) {
if (nodes[i].getAttribute("bitsWiIndexOfEachTerm") != "1") {
nodes[i].style.display = "none";
}
}
}
}
function bitsWiToggleHighlight() {
var btn = document.getElementById("bitsWiUIHighlightBtn");
var img = btn.firstChild;
if (bitsWi.property["TermHighlight"] == "1") {
img.setAttribute("src", bitsWi.property["HighlightOffURL"]);
bitsWi.property["TermHighlight"] = "0";
var stylesheets = document.styleSheets[bitsWi.property["CSSIndex"]].rules || document.styleSheets[bitsWi.property["CSSIndex"]].cssRules;
for (var i = 0, len = stylesheets.length; i < len; i++) {
var css = stylesheets[i];
if (css.selectorText == ".bitsWiWIREDiCONSpan") {
css.style["color"] = "";
css.style["backgroundColor"] = "";
}
}
} else {
img.setAttribute("src", bitsWi.property["HighlightOnURL"]);
bitsWi.property["TermHighlight"] = "1";
var stylesheets = document.styleSheets[bitsWi.property["CSSIndex"]].rules || document.styleSheets[bitsWi.property["CSSIndex"]].cssRules;
var color = "";
var backColor = "";
for (var i = 0, len = stylesheets.length; i < len; i++) {
var css = stylesheets[i];
if (css.selectorText == ".bitsWiWIREDiCONSpan_ORIGINAL") {
if (css.style["color"]) {
color = css.style["color"];
}
if (css.style["backgroundColor"]) {
backColor = css.style["backgroundColor"];
}
}
}
for (var i = 0, len = stylesheets.length; i < len; i++) {
var css = stylesheets[i];
if (css.selectorText == ".bitsWiWIREDiCONSpan") {
css.style["color"] = color;
css.style["backgroundColor"] = backColor;
}
}
}
}
function bitsWiShowList() {
var bitsWiUIMainDiv = document.getElementById("bitsWiUIMainDiv");
bitsWiUIMainDiv.style.display = "none";
var bitsWiUISearchResListDiv = document.getElementById("bitsWiUISearchResListDiv");
if (bitsWiUISearchResListDiv == null) {
bitsWiUISearchResListDiv = bitsWiUIMakeSearchResListDiv();
}
bitsWiAdjustSearchResPos();
bitsWiUISearchResListDiv.style.display = "";
bitsWiShowListUpdate();
}
function bitsWiShowListUpdate() {
var bitsWiUISearchResListDiv = document.getElementById("bitsWiUISearchResListDiv");
var tbody = document.getElementById("bitsWiUISearchResListTbody");
var count_per_page = parseInt(bitsWiUISearchResListDiv.getAttribute("count_per_page"));
var baseindex = parseInt(bitsWiUISearchResListDiv.getAttribute("baseindex"));
var tr;
var th;
var td;
var txt;
var br;
while (tbody.hasChildNodes()) {
tbody.removeChild(tbody.firstChild);
}
var span = document.getElementById("bitsWiUISearcResListCounterSpan");
if (baseindex + count_per_page < bitsWi.searchRes.length) {
span.innerHTML = "(" + (baseindex + 1) + "-" + (baseindex + count_per_page) + "/" + bitsWi.searchRes.length + ")";
} else {
span.innerHTML = "(" + (baseindex + 1) + "-" + bitsWi.searchRes.length + "/" + bitsWi.searchRes.length + ")";
}
tr = document.createElement("tr");
th = document.createElement("th");
th.setAttribute("class", "bitsWiUISearchResListCells");
th.className = "bitsWiUISearchResListCells";
txt = document.createTextNode("TERM");
th.appendChild(txt);
tr.appendChild(th);
th = document.createElement("th");
th.setAttribute("class", "bitsWiUISearchResListCells");
th.className = "bitsWiUISearchResListCells";
txt = document.createTextNode("ID");
th.appendChild(txt);
tr.appendChild(th);
th = document.createElement("th");
th.setAttribute("class", "bitsWiUISearchResListCells");
th.className = "bitsWiUISearchResListCells";
txt = document.createTextNode("DESCRIPTION");
th.appendChild(txt);
tr.appendChild(th);
tbody.appendChild(tr);
for (var i = baseindex; i < baseindex + count_per_page; i++) {
if (i >= bitsWi.searchRes.length) {
break;
}
for (var j = 0; j < bitsWi.searchRes[i].length; j++) {
tr = document.createElement("tr");
if (j == 0) {
td = document.createElement("td");
td.setAttribute("class", "bitsWiUISearchResListCells");
td.className = "bitsWiUISearchResListCells";
txt = document.createTextNode(bitsWi.searchRes[i][0].term);
td.setAttribute("rowspan", bitsWi.searchRes[i].length);
td.rowSpan = bitsWi.searchRes[i].length;
td.appendChild(txt);
tr.appendChild(td);
}
td = document.createElement("td");
td.setAttribute("class", "bitsWiUISearchResListCells");
td.className = "bitsWiUISearchResListCells";
var chk = document.createElement("input");
chk.setAttribute("type", "checkbox");
chk.setAttribute("class", "bitsWiUISearchResListChecks");
chk.className = "bitsWiUISearchResListChecks";
chk.setAttribute("term_index", i);
chk.setAttribute("term_subindex", j);
if (bitsWi.searchRes[i][j].show) {
chk.defaultChecked = true;
}
td.appendChild(chk);
txt = document.createTextNode(bitsWi.searchRes[i][j].id);
td.appendChild(txt);
tr.appendChild(td);
td = document.createElement("td");
td.setAttribute("class", "bitsWiUISearchResListCells");
td.className = "bitsWiUISearchResListCells";
txt = document.createTextNode(bitsWi.searchRes[i][j].desc);
td.appendChild(txt);
tr.appendChild(td);
tbody.appendChild(tr);
}
}
}
function bitsWiUIMakeSearchResListDiv() {
var div = document.createElement("div");
div.setAttribute("id", "bitsWiUISearchResListDiv");
div.setAttribute("count_per_page", "10");
div.setAttribute("baseindex", "0");
var img = document.createElement("img");
img.setAttribute("src", document.getElementById("bitsWiUILogoImg").getAttribute("src"));
div.appendChild(img);
var br = document.createElement("br");
div.appendChild(br);
var txt = document.createTextNode("Found Terms ");
div.appendChild(txt);
var span = document.createElement("span");
span.setAttribute("id", "bitsWiUISearcResListCounterSpan");
div.appendChild(span);
var btn = document.createElement("button");
btn.setAttribute("type", "button");
btn.setAttribute("id", "bitsWiUISearchResListPrevBtn");
if(bitsWiBrowser.match(/^IE/)){
if (bitsWiBrowser == "IE8" && document.compatMode && document.compatMode != "BackCompat") {
btn.setAttribute("onclick", "bitsWiUISearchResListPrevBtn();");
}else{
btn.setAttribute("onclick", new Function("bitsWiUISearchResListPrevBtn();"));
}
} else {
btn.setAttribute("onclick", "bitsWiUISearchResListPrevBtn();");
}
txt = document.createTextNode("<");
btn.appendChild(txt);
div.appendChild(btn);
btn = document.createElement("button");
btn.setAttribute("type", "button");
btn.setAttribute("id", "bitsWiUISearchResListNextBtn");
if(bitsWiBrowser.match(/^IE/)){
if (bitsWiBrowser == "IE8" && document.compatMode && document.compatMode != "BackCompat") {
btn.setAttribute("onclick", "bitsWiUISearchResListNextBtn();");
}else{
btn.setAttribute("onclick", new Function("bitsWiUISearchResListNextBtn();"));
}
} else {
btn.setAttribute("onclick", "bitsWiUISearchResListNextBtn();");
}
txt = document.createTextNode(">");
btn.appendChild(txt);
div.appendChild(btn);
br = document.createElement("br");
div.appendChild(br);
var tbl = document.createElement("table");
tbl.setAttribute("id", "bitsWiUISearchResListTable");
var tbody = document.createElement("tbody");
tbody.setAttribute("id", "bitsWiUISearchResListTbody");
tbl.appendChild(tbody);
div.appendChild(tbl);
btn = document.createElement("button");
btn.setAttribute("id", "bitsWiUISearchResListOKBtn");
btn.setAttribute("type", "button");
txt = document.createTextNode("OK");
btn.appendChild(txt);
if(bitsWiBrowser.match(/^IE/)){
if (bitsWiBrowser == "IE8" && document.compatMode && document.compatMode != "BackCompat") {
btn.setAttribute("onclick", "bitsWiUISearchResListOKBtn();");
}else{
btn.setAttribute("onclick", new Function("bitsWiUISearchResListOKBtn();"));
}
} else {
btn.setAttribute("onclick", "bitsWiUISearchResListOKBtn();");
}
div.appendChild(btn);
document.body.appendChild(div);
return div;
}
function bitsWiUISearchResListOKBtn() {
var tbody = document.getElementById("bitsWiUISearchResListTbody");
var checks = bitsWiGetElementsByTagClass("input", "bitsWiUISearchResListChecks");
for (var chk_i = 0; chk_i < checks.length; chk_i++) {
bitsWi.searchRes[checks[chk_i].getAttribute("term_index")][checks[chk_i].getAttribute("term_subindex")].show = checks[chk_i].checked;
}
bitsWiUpdateTermIDSelection();
while (tbody.hasChildNodes()) {
tbody.removeChild(tbody.firstChild);
}
var bitsWiUISearchResListDiv = document.getElementById("bitsWiUISearchResListDiv");
bitsWiUISearchResListDiv.style.display = "none";
var bitsWiUIMainDiv = document.getElementById("bitsWiUIMainDiv");
bitsWiUIMainDiv.style.display = "";
}
function bitsWiUISearchResListPrevBtn() {
var bitsWiUISearchResListDiv = document.getElementById("bitsWiUISearchResListDiv");
var count_per_page = parseInt(bitsWiUISearchResListDiv.getAttribute("count_per_page"));
var span = document.getElementById("bitsWiUISearcResListCounterSpan");
var indexes = span.innerHTML.substring(1, span.innerHTML.length - 1).split("-");
var baseindex = parseInt(indexes[0]) - 1 - count_per_page;
if (baseindex >= 0) {
var checks = bitsWiGetElementsByTagClass("input", "bitsWiUISearchResListChecks");
for (var chk_i = 0; chk_i < checks.length; chk_i++) {
bitsWi.searchRes[checks[chk_i].getAttribute("term_index")][checks[chk_i].getAttribute("term_subindex")].show = checks[chk_i].checked;
}
bitsWiUISearchResListDiv.setAttribute("baseindex", baseindex);
bitsWiShowListUpdate();
}
}
function bitsWiUISearchResListNextBtn() {
var bitsWiUISearchResListDiv = document.getElementById("bitsWiUISearchResListDiv");
var count_per_page = parseInt(bitsWiUISearchResListDiv.getAttribute("count_per_page"));
var span = document.getElementById("bitsWiUISearcResListCounterSpan");
var indexes = span.innerHTML.substring(1, span.innerHTML.length - 1).split("-");
var baseindex = parseInt(indexes[0]) - 1 + count_per_page;
if (baseindex < bitsWi.searchRes.length) {
var checks = bitsWiGetElementsByTagClass("input", "bitsWiUISearchResListChecks");
for (var chk_i = 0; chk_i < checks.length; chk_i++) {
bitsWi.searchRes[checks[chk_i].getAttribute("term_index")][checks[chk_i].getAttribute("term_subindex")].show = checks[chk_i].checked;
}
bitsWiUISearchResListDiv.setAttribute("baseindex", baseindex);
bitsWiShowListUpdate();
}
}
function bitsWiUpdateTermIDSelection() {
var facetNodes;
facetNodes = bitsWiGetElementsByTagClass("span", "bitsWiFacetTEXT");
for (var node_index = 0; node_index < facetNodes.length; node_index++) {
if (bitsWi.searchRes[facetNodes[node_index].getAttribute("bitsWiTermIDIndex")][facetNodes[node_index].getAttribute("bitsWiTermIDSubIndex")].show) {
facetNodes[node_index].style.display = "";
} else {
facetNodes[node_index].style.display = "none";
}
}
facetNodes = bitsWiGetElementsByTagClass("span", "bitsWiFacetHTML");
for (var node_index = 0; node_index < facetNodes.length; node_index++) {
if (bitsWi.searchRes[facetNodes[node_index].getAttribute("bitsWiTermIDIndex")][facetNodes[node_index].getAttribute("bitsWiTermIDSubIndex")].show) {
facetNodes[node_index].style.display = "";
} else {
facetNodes[node_index].style.display = "none";
}
}
facetNodes = bitsWiGetElementsByTagClass("img", "bitsWiFacetIMAGE");
for (var node_index = 0; node_index < facetNodes.length; node_index++) {
if (bitsWi.searchRes[facetNodes[node_index].getAttribute("bitsWiTermIDIndex")][facetNodes[node_index].getAttribute("bitsWiTermIDSubIndex")].show) {
facetNodes[node_index].style.display = "";
} else {
facetNodes[node_index].style.display = "none";
}
}
}
function bitsWiOnMultiSelBtn() {
var bitsWiUIMainDiv = document.getElementById("bitsWiUIMainDiv");
bitsWiUIMainDiv.style.display = "none";
var bitsWiUIMultiSelDiv = document.getElementById("bitsWiUIMultiSelDiv");
if (bitsWiUIMultiSelDiv == null) {
bitsWiUIMultiSelDiv = bitsWiMakeMultiSelDiv();
}
var dicSel = document.getElementById("bitsWiUIMultiSelDicSel");
var seldic = bitsWi.getSelectedDictionary();
for (var i = 0; i < dicSel.childNodes.length; i++) {
if (seldic.property["id"] == dicSel.childNodes[i].getAttribute("value")) {
dicSel.selectedIndex = i;
break;
}
}
bitsWiUIMultiSelUpdateFctSel();
var fctSel = document.getElementById("bitsWiUIMultiSelFctSel");
var selfcts = bitsWi.getSelectedFacets();
for (var i = 0; i < fctSel.childNodes.length; i++) {
for (var j = 0; j < selfcts.length; j++) {
if (fctSel.childNodes[i].getAttribute("value") == selfcts[j].property["id"]) {
fctSel.childNodes[i].selected = true;
}
}
}
bitsWiUIMultiSelDiv.style.display = "";
setTimeout(function() {
bitsWiUIMultiSelDiv.style.visibility = "visible";
}, 100);
bitsWiAdjustMultiSelPos();
}
function bitsWiUIMultiSelUpdateFctSel() {
var dicSel = document.getElementById("bitsWiUIMultiSelDicSel");
var fctSel = document.getElementById("bitsWiUIMultiSelFctSel");
while (fctSel.childNodes.length > 0) {
fctSel.removeChild(fctSel.firstChild);
}
var seldicid = dicSel.childNodes[dicSel.selectedIndex].getAttribute("value");
var seldic;
for (var i = 0; i < bitsWi.dicArray.length; i++) {
if (bitsWi.dicArray[i].property["id"] == seldicid) {
seldic = bitsWi.dicArray[i];
break;
}
}
var opt;
var txt;
for (var i = 0; i < bitsWi.fctArray.length; i++) {
if (bitsWi.fctArray[i].property["idsid"] == seldic.property["idsid"]) {
opt = document.createElement("option");
txt = document.createTextNode(bitsWi.fctArray[i].property["name"]);
opt.appendChild(txt);
opt.setAttribute("value", bitsWi.fctArray[i].property["id"]);
fctSel.appendChild(opt);
}
}
}
function bitsWiUIMultiSelOKBtn() {
var dicSel = document.getElementById("bitsWiUIMultiSelDicSel");
var fctSel = document.getElementById("bitsWiUIMultiSelFctSel");
if (dicSel.selectedIndex == -1) {
alert ("Please select dictionary.");
return;
}
if (fctSel.selectedIndex == -1) {
alert("Please select at least one facet.");
return;
}
var seldicid = dicSel.childNodes[dicSel.selectedIndex].getAttribute("value");
bitsWi.selectDicById(seldicid);
var bitsWiUIDicSelect = document.getElementById("bitsWiUIDicSelect");
for (var i = 0; i < bitsWiUIDicSelect.childNodes.length; i++) {
if (bitsWiUIDicSelect.childNodes[i].getAttribute("value") == seldicid) {
bitsWiUIDicSelect.childNodes[i].selected = true;
bitsWiOnChangeDic(seldicid);
break;
}
}
bitsWi.clearFctSelection();
for (var i = 0; i < fctSel.childNodes.length; i++) {
if (fctSel.childNodes[i].selected == true) {
bitsWi.addSelectFctById(fctSel.childNodes[i].getAttribute("value"));
}
}
var selDicFctDiv = document.getElementById("bitsWiUIMultiSelDiv");
selDicFctDiv.style.display = "none";
var bitsWiUIMainDiv = document.getElementById("bitsWiUIMainDiv");
bitsWiUIMainDiv.style.display = "";
var bitsWiUIFctSelect = document.getElementById("bitsWiUIFctSelect");
var selfcts = bitsWi.getSelectedFacets();
if (selfcts.length > 1) {
var opt = document.createElement("option");
opt.setAttribute("value", "MULTI");
var txt = document.createTextNode("MULTI");
opt.appendChild(txt);
bitsWiUIFctSelect.appendChild(opt);
setTimeout(function() {
for (var i = 0; i < bitsWiUIFctSelect.length; i++) {
if (bitsWiUIFctSelect.childNodes[i].getAttribute("value") == "MULTI") {
bitsWiUIFctSelect.childNodes[i].selected = true;
}
}
bitsWiOnChangeFct("MULTI");
}, 100);
} else {
setTimeout(function() {
for (var i = 0; i < bitsWiUIFctSelect.childNodes.length; i++) {
if (bitsWiUIFctSelect.childNodes[i].getAttribute("value") == selfcts[0].property["id"]) {
bitsWiUIFctSelect.childNodes[i].selected = true;
bitsWiOnChangeFct(selfcts[0].property["id"]);
}
}
}, 100);
}
}
function bitsWiUIMultiSelCancelBtn() {
var selDicFctDiv = document.getElementById("bitsWiUIMultiSelDiv");
selDicFctDiv.style.display = "none";
var bitsWiUIMainDiv = document.getElementById("bitsWiUIMainDiv");
bitsWiUIMainDiv.style.display = "";
}
function bitsWiMakeMultiSelDiv(){
var div = document.createElement("div");
div.setAttribute("id", "bitsWiUIMultiSelDiv");
div.innerHTML = bitsWiUIMultiSelDivHTML;
document.body.appendChild(div);
return div;
}
function bitsWiMakeMultiSelDiv_() {
var div = document.createElement("div");
div.setAttribute("id", "bitsWiUIMultiSelDiv");
div.style.display = "none";
div.style.visibility = "hidden";
var img = document.createElement("img");
img.setAttribute("src", document.getElementById("bitsWiUILogoImg").getAttribute("src"));
div.appendChild(img);
var br = document.createElement("br");
div.appendChild(br);
img = document.createElement("img");
img.setAttribute("src", "http://www.wired-icon.com/wi_webpart/icon_dictionary.gif");
div.appendChild(img);
var txt = document.createTextNode("Dictionary");
div.appendChild(txt);
br = document.createElement("br");
div.appendChild(br);
var dicSel = document.createElement("select");
dicSel.setAttribute("id", "bitsWiUIMultiSelDicSel");
dicSel.setAttribute("size", "5");
dicSel.style.width = "200";
var opt;
var txt;
for (var i = 0; i < bitsWi.dicArray.length; i++) {
opt = document.createElement("option");
txt = document.createTextNode(bitsWi.dicArray[i].property["name"]);
opt.appendChild(txt);
opt.setAttribute("value", bitsWi.dicArray[i].property["id"]);
dicSel.appendChild(opt);
}
if(bitsWiBrowser.match(/^IE/)){
if (bitsWiBrowser == "IE8" && document.compatMode && document.compatMode != "BackCompat") {
btn.setAttribute("onclick", "bitsWiUIMultiSelUpdateFctSel();");
}else{
btn.setAttribute("onclick", new Function("bitsWiUIMultiSelUpdateFctSel();"));
}
} else {
dicSel.setAttribute("onchange", "bitsWiUIMultiSelUpdateFctSel();");
}
div.appendChild(dicSel);
var txtArea = document.createElement("textarea");
txtArea.rows=5;
txtArea.cols=20;
txtArea.setAttribute("id", "bitsWiUIMultiSelDicDescArea");
txtArea.style.display="none";
div.appendChild(txtArea);
br = document.createElement("br");
div.appendChild(br);
img = document.createElement("img");
img.setAttribute("src", "http://www.wired-icon.com/wi_webpart/icon_facet.gif");
div.appendChild(img);
txt = document.createTextNode("Facet");
div.appendChild(txt);
var br = document.createElement("br");
div.appendChild(br);
var fctSel = document.createElement("select");
fctSel.setAttribute("id", "bitsWiUIMultiSelFctSel");
fctSel.setAttribute("size", "5");
fctSel.setAttribute("multiple", "multiple");
fctSel.style.width = "200";
div.appendChild(fctSel);
txtArea = document.createElement("textarea");
txtArea.rows=5;
txtArea.cols=20;
txtArea.setAttribute("id", "bitsWiUIMultiSelFctDescArea");
txtArea.style.display="none";
div.appendChild(txtArea);
br = document.createElement("br");
div.appendChild(br);
var OKBtn = document.createElement("button");
OKBtn.setAttribute("type", "button");
txt = document.createTextNode("OK");
OKBtn.appendChild(txt);
if(bitsWiBrowser.match(/^IE/)){
if (bitsWiBrowser == "IE8" && document.compatMode && document.compatMode != "BackCompat") {
btn.setAttribute("onclick", "bitsWiUIMultiSelOKBtn();");
}else{
btn.setAttribute("onclick", new Function("bitsWiUIMultiSelOKBtn();"));
}
} else {
OKBtn.setAttribute("onclick", "bitsWiUIMultiSelOKBtn();");
}
div.appendChild(OKBtn);
var CancelBtn = document.createElement("button");
CancelBtn.setAttribute("type", "button");
txt = document.createTextNode("Cancel");
CancelBtn.appendChild(txt);
if(bitsWiBrowser.match(/^IE/)){
if (bitsWiBrowser == "IE8" && document.compatMode && document.compatMode != "BackCompat") {
btn.setAttribute("onclick", "bitsWiUIMultiSelCancelBtn();");
}else{
btn.setAttribute("onclick", new Function("bitsWiUIMultiSelCancelBtn();"));
}
} else {
CancelBtn.setAttribute("onclick", "bitsWiUIMultiSelCancelBtn();");
}
div.appendChild(CancelBtn);
document.body.appendChild(div);
return div;
}
function bitsWiGetElementsByClass(searchClass) {
var classElements = new Array();
var allElements = document.getElementsByTagName("*");
for (i = 0, j = 0; i < allElements.length; i++) {
if (( allElements[i].getAttribute("class") || allElements[i].getAttribute("className") ) == searchClass) {
classElements[j] = allElements[i];
j++;
}
}
return classElements;
}
function bitsWiGetElementsByTagClass(searchTag, searchClass) {
var classElements = new Array();
var allElements = document.getElementsByTagName(searchTag);
for (i = 0, j = 0; i < allElements.length; i++) {
if (( allElements[i].getAttribute("class") || allElements[i].getAttribute("className") ) == searchClass) {
classElements[j] = allElements[i];
j++;
}
}
return classElements;
}
function bitsWiTraverse (node) {
if (node.hasChildNodes()) {
if (bitsWiTargetIDs.length > 0) {
for (var i = 0; i < bitsWiTargetIDs.length; i++) {
if (node.getAttribute && node.getAttribute("id") == bitsWiTargetIDs[i]) {
bitsWiInTargetF[i]++;
}
}
}
if (bitsWiExcludeIDs.length > 0) {
for (var i = 0; i < bitsWiExcludeIDs.length; i++) {
if (node.getAttribute && node.getAttribute("id") == bitsWiExcludeIDs[i]) {
bitsWiInExcludeF[i]++;
}
}
}
var tname = node.tagName;
if (tname) {
tname = tname.toLowerCase();
if (tname == "span" && ((node.getAttribute("class") == "bitsWiWIREDiCONSpan") || (node.getAttribute("className") == "bitsWiWIREDiCONSpan"))) {
return;
} else if (tname == "script") {
return;
} else if (tname == "style") {
return;
} else if (tname == "head") {
return;
} else {
var children = node.childNodes;
for (var i = 0; i < children.length; i++) {
bitsWiTraverse(children[i]);
}
}
} else {
var children = node.childNodes;
for (var i = 0; i < children.length; i++) {
bitsWiTraverse(children[i]);
}
}
if (bitsWiTargetIDs.length > 0) {
for (var i = 0; i < bitsWiTargetIDs.length; i++) {
if (node.getAttribute && node.getAttribute("id") == bitsWiTargetIDs[i]) {
bitsWiInTargetF[i]--;
}
}
}
if (bitsWiExcludeIDs.length > 0) {
for (var i = 0; i < bitsWiExcludeIDs.length; i++) {
if (node.getAttribute && node.getAttribute("id") == bitsWiExcludeIDs[i]) {
bitsWiInExcludeF[i]--;
}
}
}
} else {
var fExec;
if (bitsWiInTargetF.length == 0) {
fExec = true;
} else {
fExec = false;
}
for (var i = 0; i < bitsWiInTargetF.length; i++) {
if (bitsWiInTargetF[i] > 0) {
fExec = true;
break;
}
}
for (var i = 0; i < bitsWiInExcludeF.length; i++) {
if (bitsWiInExcludeF[i] > 0) {
fExec = false;
break;
}
}
if (fExec == false) {
return;
}
if (node.nodeType == "3") {
bitsWiHandleText(node);
} else {
}
}
}
function bitsWiHandleText(node) {
var retValues;
if (bitsWi.getSelectedDictionary().property["match_algorithm"] != null && bitsWi.getSelectedDictionary().property["match_algorithm"] == "Regular Expression") {
retValues = bitsWiSearchTermRegExp(node);
} else {
retValues = bitsWiSearchTermHash(node);
}
if (retValues == "") {
return;
}
var preText = retValues[0];
var term = retValues[1];
var dicTerm = retValues[2];
var idstr = retValues[3];
var desc = retValues[4];
if (typeof bitsWi.property["TermCountPerPage"][term] == "undefined") {
bitsWi.property["TermCountPerPage"][term] = 0;
}
bitsWi.property["TermCountPerPage"][term]++;
var span = document.createElement("span");
span.setAttribute("class", "bitsWiWIREDiCONSpan");
span.className = "bitsWiWIREDiCONSpan";
var termSpan = document.createElement("span");
termSpan.setAttribute("class", "bitsWiTermSpan");
termSpan.className = "bitsWiTermSpan";
var txt = document.createTextNode(term);
termSpan.appendChild(txt);
span.appendChild(termSpan);
if(bitsWi.property["MarkerPopupShow"] == "show"){
bitsWIaddEvent(span, 'mouseover', function (e) {
var eventInfo = new Array();
if(e.srcElement){
eventInfo.targetElement = e.srcElement;
for(var i = 0; i < 100, eventInfo.targetElement; i++){
var className = eventInfo.targetElement.getAttribute("class");
if(className && className == "bitsWiWIREDiCONSpan"){
break;
}
eventInfo.targetElement = eventInfo.targetElement.parentNode;
}
}else{
eventInfo.targetElement = e.currentTarget;
}
bitsWiClearSelBoxTimer(1);
bitsWiClearSelSubBoxTimer(1);
if(bitsWiShowSelBoxTimer) clearTimeout(bitsWiShowSelBoxTimer);
bitsWiShowSelBoxTimer = setTimeout(function(){bitsWiShowSelBox(eventInfo);},250);
});
bitsWIaddEvent(span, 'mouseout', function (e) {
bitsWiClearSelBoxTimer();
});
}
var idstrs = idstr.split(bitsWi.getSelectedDictionary().property["id_split"]);
if (bitsWi.searchRes[bitsWi.searchRes.length] == null) {
bitsWi.searchRes[bitsWi.searchRes.length] = new Array();
}
for (var idindex = 0; idindex < idstrs.length; idindex++) {
var searchResObj = new bitsWISearchResClass(dicTerm, idstrs[idindex]);
bitsWi.searchRes[bitsWi.searchRes.length - 1].push(searchResObj);
if (bitsWi.getSelectedDictionary().property["desc_prefix"] != null && bitsWi.getSelectedDictionary().property["desc_prefix"].length > 0) {
bitsWi.descURLs.push(bitsWi.getSelectedDictionary().property["desc_prefix"] + "&termid=" + idstrs[idindex] + "&index=" + (bitsWi.searchRes.length - 1) + "&subindex=" + idindex);
}
if(idindex == 0){
if (bitsWi.property["Tooltip"] != null && bitsWi.property["Tooltip"] == "1") {
if (bitsWi.getSelectedDictionary().property["tooltip_prefix"] != null && bitsWi.getSelectedDictionary().property["tooltip_prefix"].length > 0) {
var waitID = bitsWi.getSelectedDictionary().property["id"] + idstrs[idindex] + bitsWi.searchRes.length;
termSpan.setAttribute("bitsWiTooltipWaitID", waitID);
var tooltipURL = bitsWi.getSelectedDictionary().property["tooltip_prefix"] + encodeURIComponent(idstr) + "&split=" + encodeURIComponent(bitsWi.getSelectedDictionary().property["id_split"]) + "&waitid=" + waitID;
termSpan.setAttribute("bitsWiTooltipURL", tooltipURL);
bitsWIaddEvent(termSpan, 'mouseover', function (e) {
if (bitsWi.property["TermMouseoverColor"] != null && bitsWi.property["TermMouseoverColor"].length > 0) {
termSpan.style.color = "#" + bitsWi.property["TermMouseoverColor"];
}
if (bitsWi.property["TermMouseoverBGColor"] != null && bitsWi.property["TermMouseoverBGColor"].length > 0) {
termSpan.style.backgroundColor = "#" + bitsWi.property["TermMouseoverBGColor"];
}
var this_ = this;
bitsWiMouseOverWaitID = this_.getAttribute("bitsWiTooltipWaitID");
bitsWiRequestTooltipTimer = setTimeout(function(){bitsWiRequestTooltip(this_);},500);
});
bitsWIaddEvent(termSpan, 'mouseout', function (e) {
termSpan.style.color = "";
termSpan.style.backgroundColor = "";
bitsWiMouseOverWaitID = null;
if(bitsWiRequestTooltipTimer) clearTimeout(bitsWiRequestTooltipTimer);
bitsWiRequestTooltipTimer = null;
if(bitsWiDispTooltip == 2){
bitsWiClearTooltipTimer(250);
}
});
}
}
}
var facets = bitsWi.getSelectedFacets();
for (var i = 0; i < facets.length; i++) {
var waitID = facets[i].property["id"] + idstrs[idindex] + bitsWi.searchRes.length;
if (facets[i].property["highlight_color"] != null && facets[i].property["highlight_color"].length > 0) {
span.style.backgroundColor = '#' + facets[i].property["hightlight_color"];
}
if (facets[i].property["character_color"] != null && facets[i].property["character_color"].length > 0) {
span.style.color = '#' + facets[i].property["character_color"];
}
if (facets[i].property["fct_prefix"] != null && facets[i].property["fct_prefix"].length > 0) {
var facetNode;
if (facets[i].property["fct_type"] == "TEXT") {
facetNode = document.createElement("span");
facetNode.setAttribute("bitsWiTextFacetWaitID", waitID);
var scr = document.createElement("script");
scr.setAttribute("src", facets[i].property["fct_prefix"] + idstrs[idindex] + "&dic=" + bitsWi.getSelectedDictionary().property["id"] + "&waitid=" + waitID + "&fa=" + bitsWiFirstAutoF);
document.body.appendChild(scr);
facetNode.setAttribute("class", "bitsWiFacetTEXT");
facetNode.className = "bitsWiFacetTEXT";
} else if (facets[i].property["fct_type"] == "HTML") {
facetNode = document.createElement("span");
facetNode.setAttribute("bitsWiHtmlFacetWaitID", waitID);
var scr = document.createElement("script");
scr.setAttribute("src", facets[i].property["fct_prefix"] + idstrs[idindex] + "&dic=" + bitsWi.getSelectedDictionary().property["id"] + "&waitid=" + waitID + "&fa=" + bitsWiFirstAutoF);
document.body.appendChild(scr);
facetNode.setAttribute("class", "bitsWiFacetHTML");
facetNode.className = "bitsWiFacetHTML";
} else {
facetNode = document.createElement("img");
if(bitsWiBrowser.match(/^IE/)){
facetNode.setAttribute("src", facets[i].property["fct_prefix"] + idstrs[idindex] + "&dic=" + bitsWi.getSelectedDictionary().property["id"] + "&wirnd=" + Math.floor(Math.random() * 1000) + "&fa=" + bitsWiFirstAutoF);
} else {
facetNode.setAttribute("src", facets[i].property["fct_prefix"] + idstrs[idindex] + "&dic=" + bitsWi.getSelectedDictionary().property["id"] + "&fa=" + bitsWiFirstAutoF);
}
facetNode.setAttribute("class", "bitsWiFacetIMAGE");
facetNode.className = "bitsWiFacetIMAGE";
}
facetNode.setAttribute("bitsWiIndexOfEachTerm", bitsWi.property["TermCountPerPage"][term]);
facetNode.setAttribute("bitsWiTermIDIndex", (bitsWi.searchRes.length - 1));
facetNode.setAttribute("bitsWiTermIDSubIndex", idindex);
if (bitsWi.property["InsertHeadOnly"] == "1") {
if (bitsWi.property["TermCountPerPage"][term] > 1) {
facetNode.style.display = "none";
}
}
if (facets[i].property["tooltip_prefix"] != null && facets[i].property["tooltip_prefix"].length > 0) {
facetNode.setAttribute("bitsWiTooltipWaitID", waitID);
var tooltipURL = "";
if (facets[i].property["gfct_tooltip"] == "true") {
tooltipURL = facets[i].property["tooltip_prefix"] + idstrs[idindex] + "&dic=" + bitsWi.getSelectedDictionary().property["id"] + "&waitid=" + waitID;
} else {
tooltipURL = facets[i].property["tooltip_prefix"] + idstrs[idindex] + "&waitid=" + waitID;
}
facetNode.setAttribute("bitsWiTooltipURL", tooltipURL);
bitsWIaddEvent(facetNode, 'mouseover', function (e) {
var this_ = this;
bitsWiMouseOverWaitID = this_.getAttribute("bitsWiTooltipWaitID");
bitsWiRequestTooltipTimer = setTimeout(function(){bitsWiRequestTooltip(this_);},500);
});
bitsWIaddEvent(facetNode, 'mouseout', function (e) {
bitsWiMouseOverWaitID = null;
if(bitsWiRequestTooltipTimer) clearTimeout(bitsWiRequestTooltipTimer);
bitsWiRequestTooltipTimer = null;
if(bitsWiDispTooltip == 2){
bitsWiClearTooltipTimer(250);
}
});
}
if (facets[i].property["lnk_prefix"] != null && facets[i].property["lnk_prefix"].length > 0) {
var aNode = document.createElement("a");
aNode.setAttribute("href", facets[i].property["lnk_prefix"] + idstrs[idindex] + "&dic=" + bitsWi.getSelectedDictionary().property["id"]);
aNode.setAttribute("target", "_blank");
// prevent default CSS
aNode.style.display = "inline";
aNode.style.padding = "0";
aNode.style.margin = "0";
aNode.style.background = "";
aNode.appendChild(facetNode);
span.appendChild(aNode);
} else {
span.appendChild(facetNode);
}
}
}
}
if (preText.length > 0) {
var preNode = document.createTextNode(preText);
node.parentNode.insertBefore(preNode, node);
}
node.parentNode.insertBefore(span, node);
if (node.nodeValue.length > preText.length + term.length) {
var postNode = document.createTextNode(node.nodeValue.substr(preText.length + term.length));
node.parentNode.insertBefore(postNode, node);
}
node.parentNode.removeChild(node);
}
function bitsWiAddTextFacetCallback (waitid, text) {
var nodes = bitsWiGetElementsByTagClass("span", "bitsWiFacetTEXT");
for (var i = 0; i < nodes.length; i++) {
if (nodes[i].getAttribute("bitsWiTextFacetWaitID") != null && nodes[i].getAttribute("bitsWiTextFacetWaitID") == waitid) {
if(bitsWiBrowser.match(/^IE/)){
nodes[i].innerText = decodeURIComponent(text);
} else {
nodes[i].innerHTML = decodeURIComponent(text);
}
nodes[i].setAttribute("bitsWiTextFacetWaitID", "");
return;
}
}
}
function bitsWiAddHtmlFacetCallback (waitid, text) {
var nodes = bitsWiGetElementsByTagClass("span", "bitsWiFacetHTML");
for (var i = 0; i < nodes.length; i++) {
if (nodes[i].getAttribute("bitsWiHtmlFacetWaitID") != null && nodes[i].getAttribute("bitsWiHtmlFacetWaitID") == waitid) {
try {
nodes[i].innerHTML = decodeURIComponent(text);
} catch (ex) {
}
nodes[i].setAttribute("bitsWiHtmlFacetWaitID", "");
return;
}
}
}
function bitsWiAddRuletCallback (text) {
var cssData = decodeURIComponent(text).split("}");
document.body.appendChild(document.createElement('style'));
var CSS = document.styleSheets[document.styleSheets.length -1];
for(var i=0; i 0) && (data.length > 0) ){
if(CSS.insertRule) {
CSS.insertRule(selector+'{'+data+'}', 0);
} else {//IE
CSS.addRule(selector, data);
}
}
}
}
function bitsWiRequestTooltip (elem) {
var scr = document.createElement("script");
if (elem.getAttribute("bitsWiTooltipURL")) {
bitsWiShowTooltipLoading(elem);
scr.setAttribute("src", elem.getAttribute("bitsWiTooltipURL"));
elem.setAttribute("bitsWiTooltipURL", "");
document.body.appendChild(scr);
} else {
return;
}
}
function bitsWiAddTermTooltipCallback (waitid, tooltipstr) {
var nodes = bitsWiGetElementsByTagClass("span", "bitsWiTermSpan");
for (var i = 0; i < nodes.length; i++) {
if (nodes[i].getAttribute("bitsWiTooltipWaitID") != null && nodes[i].getAttribute("bitsWiTooltipWaitID") == waitid) {
nodes[i].setAttribute("bitsWiTooltipWaitID", "");
if (tooltipstr && tooltipstr.length > 0) {
nodes[i].setAttribute("bitsWiTermTooltipContent", decodeURIComponent(tooltipstr));
if (bitsWiMouseOverWaitID != null && bitsWiMouseOverWaitID == waitid) {
//bitsWiShowTooltip(nodes[i]);
bitsWiShowTermTooltip(nodes[i]);
}else{
bitsWiHideTooltip();
}
bitsWIaddEvent(nodes[i], 'mouseover', function (e) {
if(bitsWiHideTooltipTimer) clearTimeout(bitsWiHideTooltipTimer);
bitsWiHideTooltipTimer = null;
var elem = bitsWIcurrentTarget(e,"bitsWiTermTooltipContent");
if(bitsWiShowTooltipTimer) clearTimeout(bitsWiShowTooltipTimer);
//bitsWiShowTooltipTimer = setTimeout(function(){bitsWiShowTooltip(elem);},500);
bitsWiShowTooltipTimer = setTimeout(function(){bitsWiShowTermTooltip(elem);},500);
});
bitsWIaddEvent(nodes[i], 'mouseout', function (e) {
if(bitsWiDispTooltip == 1){
bitsWiClearTooltipTimer();
}else{
bitsWiClearTooltipTimer(1);
}
});
}
return;
}
}
}
function bitsWiAddTooltipCallback (waitid, tooltipstr) {
var nodes = bitsWiGetElementsByTagClass("img", "bitsWiFacetIMAGE");
for (var i = 0; i < nodes.length; i++) {
if (nodes[i].getAttribute("bitsWiTooltipWaitID") != null && nodes[i].getAttribute("bitsWiTooltipWaitID") == waitid) {
nodes[i].setAttribute("bitsWiTooltipWaitID", "");
if (tooltipstr && tooltipstr.length > 0) {
nodes[i].setAttribute("bitsWiTooltipContent", decodeURIComponent(tooltipstr));
if (bitsWiMouseOverWaitID != null && bitsWiMouseOverWaitID == waitid) {
bitsWiShowTooltip(nodes[i]);
}else{
bitsWiHideTooltip();
}
bitsWIaddEvent(nodes[i], 'mouseover', function (e) {
if(bitsWiHideTooltipTimer) clearTimeout(bitsWiHideTooltipTimer);
bitsWiHideTooltipTimer = null;
var elem = bitsWIcurrentTarget(e,"bitsWiTooltipContent");
if(bitsWiShowTooltipTimer) clearTimeout(bitsWiShowTooltipTimer);
bitsWiShowTooltipTimer = setTimeout(function(){bitsWiShowTooltip(elem);},500);
});
bitsWIaddEvent(nodes[i], 'mouseout', function (e) {
if(bitsWiDispTooltip == 1){
bitsWiClearTooltipTimer();
}else{
bitsWiClearTooltipTimer(1);
}
});
}
return;
}
}
nodes = bitsWiGetElementsByTagClass("span", "bitsWiFacetTEXT");
for (var i = 0; i < nodes.length; i++) {
if (nodes[i].getAttribute("bitsWiTooltipWaitID") != null && nodes[i].getAttribute("bitsWiTooltipWaitID") == waitid) {
nodes[i].setAttribute("bitsWiTooltipWaitID", "");
if (tooltipstr && tooltipstr.length > 0) {
nodes[i].setAttribute("bitsWiTooltipContent", decodeURIComponent(tooltipstr));
if (bitsWiMouseOverWaitID != null && bitsWiMouseOverWaitID == waitid) {
bitsWiShowTooltip(nodes[i]);
}else{
bitsWiHideTooltip();
}
bitsWIaddEvent(nodes[i], 'mouseover', function (e) {
if(bitsWiHideTooltipTimer) clearTimeout(bitsWiHideTooltipTimer);
bitsWiHideTooltipTimer = null;
var elem = bitsWIcurrentTarget(e,"bitsWiTooltipContent");
if(bitsWiShowTooltipTimer) clearTimeout(bitsWiShowTooltipTimer);
bitsWiShowTooltipTimer = setTimeout(function(){bitsWiShowTooltip(elem);},500);
});
bitsWIaddEvent(nodes[i], 'mouseout', function (e) {
if(bitsWiDispTooltip == 1){
bitsWiClearTooltipTimer();
}else{
bitsWiClearTooltipTimer(1);
}
});
}
return;
}
}
nodes = bitsWiGetElementsByTagClass("span", "bitsWiFacetHTML");
for (var i = 0; i < nodes.length; i++) {
if (nodes[i].getAttribute("bitsWiTooltipWaitID") != null && nodes[i].getAttribute("bitsWiTooltipWaitID") == waitid) {
nodes[i].setAttribute("bitsWiTooltipWaitID", "");
if (tooltipstr && tooltipstr.length > 0) {
nodes[i].setAttribute("bitsWiTooltipContent", decodeURIComponent(tooltipstr));
if (bitsWiMouseOverWaitID != null && bitsWiMouseOverWaitID == waitid) {
bitsWiShowTooltip(nodes[i]);
}else{
bitsWiHideTooltip();
}
bitsWIaddEvent(nodes[i], 'mouseover', function (e) {
if(bitsWiHideTooltipTimer) clearTimeout(bitsWiHideTooltipTimer);
bitsWiHideTooltipTimer = null;
var elem = bitsWIcurrentTarget(e,"bitsWiTooltipContent");
if(bitsWiShowTooltipTimer) clearTimeout(bitsWiShowTooltipTimer);
bitsWiShowTooltipTimer = setTimeout(function(){bitsWiShowTooltip(elem);},500);
});
bitsWIaddEvent(nodes[i], 'mouseout', function (e) {
if(bitsWiDispTooltip == 1){
bitsWiClearTooltipTimer();
}else{
bitsWiClearTooltipTimer(1);
}
});
}
return;
}
}
}
function bitsWiShowTooltip (obj) {
bitsWiDispTooltip = 1;
var tooltip = document.getElementById("bitsWiTooltipDiv");
if (tooltip == null) {
tooltip = document.createElement("div");
tooltip.setAttribute("id", "bitsWiTooltipDiv");
document.body.appendChild(tooltip);
}
tooltip.style.position = 'absolute';
tooltip.style.backgroundColor = 'ivory';
tooltip.style.border = '1px solid #333';
tooltip.style.padding = '1px 3px 1px 3px';
tooltip.style.font = '500 11px arial';
tooltip.style.zIndex = 10000;
var scrollLeft = document.body.scrollLeft || document.documentElement.scrollLeft;
var scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
var pos = bitsWIelemPos(obj);
tooltip.style.left = 0 + pos.x + 'px';
tooltip.style.top = 3 + pos.y + obj.offsetHeight + 'px';
bitsWIaddEvent(tooltip, 'mouseover', function (e) {
if(bitsWiHideTooltipTimer) clearTimeout(bitsWiHideTooltipTimer);
});
bitsWIaddEvent(tooltip, 'mouseout', function (e) {
bitsWiClearTooltipTimer();
});
var closebutton = "";
if (obj.getAttribute("bitsWiTooltipContent")) {
tooltip.innerHTML = closebutton + obj.getAttribute("bitsWiTooltipContent");
}
}
function bitsWiShowTermTooltip (obj) {
bitsWiDispTooltip = 1;
var tooltip = document.getElementById("bitsWiTooltipDiv");
if (tooltip == null) {
tooltip = document.createElement("div");
tooltip.setAttribute("id", "bitsWiTooltipDiv");
document.body.appendChild(tooltip);
}
//tooltip.style.position = 'absolute';
//tooltip.style.backgroundColor = 'ivory';
//tooltip.style.border = '1px solid #333';
//tooltip.style.padding = '1px 3px 1px 3px';
tooltip.style.backgroundColor = '';
tooltip.style.position = 'absolute';
tooltip.style.padding = '0px';
tooltip.style.border = '';
tooltip.style.font = '500 11px arial';
tooltip.style.zIndex = 10000;
// var scrollLeft = document.body.scrollLeft || document.documentElement.scrollLeft;
// var scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
// var closebutton = "";
var closebutton = "";
if (obj.getAttribute("bitsWiTermTooltipContent")) {
tooltip.innerHTML = closebutton + obj.getAttribute("bitsWiTermTooltipContent");
}
// var pos = bitsWIelemPos(obj);
// tooltip.style.left = 0 + pos.x + 'px';
// tooltip.style.top = 3 + pos.y + obj.offsetHeight + 'px';
var offsetMap = bitsWITermTooltipPos(obj, "auto", tooltip, 0);
tooltip.style.top = offsetMap["top"] + 'px';
tooltip.style.left = offsetMap["left"] + 'px';
bitsWIaddEvent(tooltip, 'mouseover', function (e) {
if(bitsWiHideTooltipTimer) clearTimeout(bitsWiHideTooltipTimer);
});
bitsWIaddEvent(tooltip, 'mouseout', function (e) {
bitsWiClearTooltipTimer();
});
if(typeof bitsWiShowTermTooltipAfter == "function"){
bitsWiShowTermTooltipAfter(offsetMap);
}
}
function bitsWiHideTooltip (e) {
var tooltip = document.getElementById("bitsWiTooltipDiv");
if (tooltip == null) {
return;
}
bitsWiDispTooltip = 0;
tooltip.style.top = '-1000px';
tooltip.style.left = '-1000px';
while (tooltip.childNodes.length > 0) {
tooltip.removeChild(tooltip.firstChild);
}
}
function bitsWiShowTooltipLoading (obj) {
bitsWiDispTooltip = 2;
var pos = bitsWIelemPos(obj);
clientX = pos.x;
clientY = pos.y + obj.offsetHeight;
var tooltip = document.getElementById("bitsWiTooltipDiv");
if (tooltip == null) {
tooltip = document.createElement("div");
tooltip.setAttribute("id", "bitsWiTooltipDiv");
document.body.appendChild(tooltip);
}
tooltip.style.position = 'absolute';
tooltip.style.backgroundColor = 'ivory';
tooltip.style.border = '1px solid #333';
tooltip.style.padding = '1px 3px 1px 3px';
tooltip.style.font = '500 11px arial';
tooltip.style.zIndex = 10000;
var scrollLeft = document.body.scrollLeft || document.documentElement.scrollLeft;
var scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
tooltip.style.left = 0 + clientX + 'px';
tooltip.style.top = 3 + clientY + 'px';
tooltip.innerHTML = "Loading...
";
}
function bitsWiShowSelBox (e) {
var selBox = document.getElementById("bitsWiSelBox");
if (selBox == null) {
selBox = document.createElement("div");
selBox.setAttribute("id", "bitsWiSelBox");
selBox.setAttribute("class", "bitsWiSelBox");
selBox.className = "bitsWiSelBox";
document.body.appendChild(selBox);
bitsWIaddEvent(selBox, 'mouseover', function (e) {
bitsWiOnMouseSelBox = true;
});
bitsWIaddEvent(selBox, 'mouseout', function (e) {
bitsWiClearSelBoxTimer();
});
}
var seldic = bitsWi.getSelectedDictionary();
var selfctsMap = bitsWi.getSelectedFacetsMap();
var fctAry = bitsWi.getSortedFacets();
var fctCnt = 0;
for (var i = 0; i < fctAry.length; i++) {
if (seldic.property["idsid"] != fctAry[i].property["idsid"]) continue;
fctCnt++;
}
var fctList = '';
selBox.innerHTML = fctList;
// Display Position Setting.
var offsetMap = bitsWiGetSelBoxDispPos(e.targetElement, bitsWi.property["MarkerPopupPos"], selBox);
selBox.style.top = offsetMap["top"] + 'px';
selBox.style.left = offsetMap["left"] + 'px';
var elem = document.getElementById("bitsWiFctMore");
if(elem){
bitsWIaddEvent(elem, 'mouseover', function (e) {
bitsWiOnMouseSelSubBox = true;
var eventInfo = new Array();
if(e.srcElement){
eventInfo.targetElement = e.srcElement;
}else{
eventInfo.targetElement = e.currentTarget;
}
if(bitsWiShowSelSubBoxTimer) clearTimeout(bitsWiShowSelSubBoxTimer);
bitsWiShowSelSubBoxTimer = setTimeout(function(){bitsWiShowSelSubBox(eventInfo);},250);
});
bitsWIaddEvent(elem, 'mouseout', function (e) {
bitsWiClearSelSubBoxTimer();
});
}
}
function bitsWiGetSelBoxDispPos(targetElement, pos, selBoxElem) {
var offsetElem = targetElement;
var offsetLeft = 0;
var offsetTop = 0;
while(offsetElem) {
offsetLeft += offsetElem.offsetLeft;
offsetTop += offsetElem.offsetTop;
offsetElem = offsetElem.offsetParent;
}
var offsetMap = new Array();
if(pos == "upper"){
offsetMap["top"] = offsetTop - selBoxElem.offsetHeight;
offsetMap["left"] = offsetLeft;
}else if(pos == "left"){
offsetMap["top"] = offsetTop;
offsetMap["left"] = offsetLeft - selBoxElem.offsetWidth ;
}else if(pos == "right"){
offsetMap["top"] = offsetTop;
offsetMap["left"] = offsetLeft + targetElement.offsetWidth;
}else if(pos == "lower"){
offsetMap["top"] = offsetTop + targetElement.offsetHeight;
offsetMap["left"] = offsetLeft;
}
return offsetMap;
}
function bitsWiClearSelBoxTimer(time) {
time = time ? time : 1000;
bitsWiOnMouseSelBox = false;
if(bitsWiShowSelBoxTimer) clearTimeout(bitsWiShowSelBoxTimer);
bitsWiShowSelBoxTimer = null;
if(bitsWiHideSelBoxTimer) clearTimeout(bitsWiHideSelBoxTimer);
bitsWiHideSelBoxTimer = setTimeout(function(){bitsWiHideSelBox();},time);
}
function bitsWiHideSelBox() {
var selBox = document.getElementById("bitsWiSelBox");
if (selBox == null || bitsWiOnMouseSelBox) {
return;
}
selBox.style.top = '-1000px';
selBox.style.left = '-1000px';
while (selBox.childNodes.length > 0) {
selBox.removeChild(selBox.firstChild);
}
}
function bitsWiMovePanelPos(left, top) {
var bitsWiUIMainDiv = document.getElementById("bitsWiUIMainDiv");
bitsWiUIMainDiv.style.left = left + 'px';
bitsWiUIMainDiv.style.top = top + 'px';
}
function bitsWiMinimizePanel() {
var bitsWiUIMainDiv = document.getElementById("bitsWiUIMainDiv");
var bitsWiUIGUIContainerDiv = document.getElementById("bitsWiUIGUIContainerDiv");
bitsWiUIGUIContainerDiv.style.display = "none";
var bitsWiUIGUIContainerMinimizeDiv = document.getElementById("bitsWiUIGUIContainerMinimizeDiv");
bitsWiUIGUIContainerMinimizeDiv.style.display = "";
bitsWiUIGUIContainerMinimizeDiv.style.height = "";
bitsWiUIMainDiv.style.height = "1%";
bitsWiUIMainDiv.style.height = "auto";
bitsWiAdjustPanelPos();
}
function bitsWiReopenPanel() {
var bitsWiUIGUIContainerDiv = document.getElementById("bitsWiUIGUIContainerDiv");
bitsWiUIGUIContainerDiv.style.display = "";
var bitsWiUIGUIContainerMinimizeDiv = document.getElementById("bitsWiUIGUIContainerMinimizeDiv");
bitsWiUIGUIContainerMinimizeDiv.style.display = "none";
bitsWiAdjustPanelPos();
}
function bitsWiShowSelSubBox (e) {
var selBox = document.getElementById("bitsWiSelSubBox");
if (selBox == null) {
selBox = document.createElement("div");
selBox.setAttribute("id", "bitsWiSelSubBox");
selBox.setAttribute("class", "bitsWiSelBox");
selBox.className = "bitsWiSelBox";
document.body.appendChild(selBox);
bitsWIaddEvent(selBox, 'mouseover', function (e) {
bitsWiOnMouseSelBox = true;
bitsWiOnMouseSelSubBox = true;
});
bitsWIaddEvent(selBox, 'mouseout', function (e) {
bitsWiClearSelSubBoxTimer();
bitsWiClearSelBoxTimer();
});
}
var seldic = bitsWi.getSelectedDictionary();
var selfctsMap = bitsWi.getSelectedFacetsMap();
var fctAry = bitsWi.getSortedFacets();
var fctList = '';
selBox.innerHTML = fctList;
// Display Position Setting.
var offsetElem = e.targetElement;
var offsetLeft = 0;
var offsetTop = 0;
while(offsetElem) {
offsetLeft += offsetElem.offsetLeft;
offsetTop += offsetElem.offsetTop;
offsetElem = offsetElem.offsetParent;
}
selBox.style.left = 0 + offsetLeft + e.targetElement.offsetWidth + 5 + 'px';
selBox.style.top = 0 + offsetTop + 'px';
}
function bitsWiClearSelSubBoxTimer(time) {
time = time ? time : 1000;
bitsWiOnMouseSelSubBox = false;
if(bitsWiShowSelSubBoxTimer) clearTimeout(bitsWiShowSelSubBoxTimer);
bitsWiShowSelSubBoxTimer = null;
if(bitsWiHideSelSubBoxTimer) clearTimeout(bitsWiHideSelSubBoxTimer);
bitsWiHideSelSubBoxTimer = setTimeout(function(){bitsWiHideSelSubBox();},time);
}
function bitsWiHideSelSubBox() {
var selBox = document.getElementById("bitsWiSelSubBox");
if (selBox == null || bitsWiOnMouseSelSubBox) {
return;
}
selBox.style.top = '-1000px';
selBox.style.left = '-1000px';
while (selBox.childNodes.length > 0) {
selBox.removeChild(selBox.firstChild);
}
}
function bitsWiClearTooltipTimer(time) {
time = time ? time : 500;
if(bitsWiShowTooltipTimer) clearTimeout(bitsWiShowTooltipTimer);
bitsWiShowTooltipTimer = null;
if(bitsWiHideTooltipTimer) clearTimeout(bitsWiHideTooltipTimer);
bitsWiHideTooltipTimer = setTimeout(function(){bitsWiHideTooltip();},time);
}
function bitsWiFctSelectionUpdate(fctId) {
var bitsWiUIFctSelect = document.getElementById("bitsWiUIFctSelect");
for (var i = 0; i < bitsWiUIFctSelect.length; i++) {
if (bitsWiUIFctSelect.childNodes[i].getAttribute("value") == fctId) {
bitsWiUIFctSelect.childNodes[i].selected = true;
}
}
}
function bitsWiSearchTermRegExp(node) {
var text = node.nodeValue;
var minIndex = text.length;
var maxLen = -1;
var matchRes = "";
var matchTerm = "";
var matchDicTerm = "";
var matchID = "";
var matchDesc = "";
var preText = "";
var selectedDic = bitsWi.getSelectedDictionary();
for (key in selectedDic.term2ID) {
var re = new RegExp(key);
var matchRes = text.search(re);
if (text.search(re) != -1) {
if (bitsWiBrowser == "Safari") {
if ((matchRes <= minIndex) && (RegExp.$0.length > maxLen)) {
matchDicTerm = key;
matchTerm = RegExp.$0;
preText = text.slice(0,matchRes);
if (matchRes.length == 1) {
matchID = matchTerm;
} else {
matchID = selectedDic.term2ID[key];
var repCnt = 0;
var kakkoCnt = 0;
for (var i = 0; i < matchID.length; i++) {
if (matchID.substr(i, 1) == "(") {
kakkoCnt++;
}
}
for (var i = 1; i <= kakkoCnt; i++) {
var tmpStr = "(" + i + ")";
for (var j = matchID.length - tmpStr.length; j >= 0; j--) {
if (matchID.substr(j, tmpStr.length) == tmpStr) {
if (i == 1) {
matchID = matchID.substr(0, j) + RegExp.$1 + matchID.substr(j + tmpStr.length);
} else if (i == 2) {
matchID = matchID.substr(0, j) + RegExp.$2 + matchID.substr(j + tmpStr.length);
} else if (i == 3) {
matchID = matchID.substr(0, j) + RegExp.$3 + matchID.substr(j + tmpStr.length);
} else if (i == 4) {
matchID = matchID.substr(0, j) + RegExp.$4 + matchID.substr(j + tmpStr.length);
} else if (i == 5) {
matchID = matchID.substr(0, j) + RegExp.$5 + matchID.substr(j + tmpStr.length);
}
repCnt++;
}
if (repCnt >= 100) {
break;
}
}
if (repCnt >= 100) {
break;
}
}
}
matchDesc = selectedDic.term2ID[key];
minIndex = matchRes;
maxLen = matchTerm.length;
}
} else {
if ((RegExp.leftContext.length <= minIndex) && (RegExp.lastMatch.length > maxLen)) {
matchDicTerm = key;
matchTerm = RegExp.lastMatch;
preText = RegExp.leftContext;
if (matchRes.length == 1) {
matchID = matchTerm;
} else {
matchID = selectedDic.term2ID[key];
var repCnt = 0;
var kakkoCnt = 0;
for (var i = 0; i < matchID.length; i++) {
if (matchID.substr(i, 1) == "(") {
kakkoCnt++;
}
}
for (var i = 1; i <= kakkoCnt; i++) {
var tmpStr = "(" + i + ")";
for (var j = matchID.length - tmpStr.length; j >= 0; j--) {
if (matchID.substr(j, tmpStr.length) == tmpStr) {
if (i == 1) {
matchID = matchID.substr(0, j) + RegExp.$1 + matchID.substr(j + tmpStr.length);
} else if (i == 2) {
matchID = matchID.substr(0, j) + RegExp.$2 + matchID.substr(j + tmpStr.length);
} else if (i == 3) {
matchID = matchID.substr(0, j) + RegExp.$3 + matchID.substr(j + tmpStr.length);
} else if (i == 4) {
matchID = matchID.substr(0, j) + RegExp.$4 + matchID.substr(j + tmpStr.length);
} else if (i == 5) {
matchID = matchID.substr(0, j) + RegExp.$5 + matchID.substr(j + tmpStr.length);
}
repCnt++;
}
if (repCnt >= 100) {
break;
}
}
if (repCnt >= 100) {
break;
}
}
}
matchDesc = selectedDic.term2ID[key];
minIndex = RegExp.leftContext.length;
maxLen = matchTerm.length;
}
}
}
}
if (maxLen > 0) {
return new Array(preText, matchTerm, matchDicTerm, matchID, matchDesc);
}
return "";
}
function bitsWiSearchTermHash(node) {
var text = node.nodeValue;
var startlen = 50;
var len;
var term = "";
var pos = 0;
var preText = "";
var matchTerm = "";
var matchDicTerm = "";
var matchID = "";
var matchDesc = "";
var seldic = bitsWi.getSelectedDictionary();
for (pos = 0; pos < text.length; pos++) {
startlen = 50;
if (startlen > text.length - pos) {
startlen = text.length - pos;
}
for (len = startlen; len >= 2; len--) {
term = text.substr(pos, len);
if (seldic.term2ID[term] != null) {
matchTerm = term;
matchDicTerm = term;
matchID = seldic.term2ID[term];
matchDesc = seldic.term2ID[term];
return new Array(preText, matchTerm, matchDicTerm, matchID, matchDesc);
}
}
preText += text.substr(pos, 1);
}
return "";
}
function bitsWiOnChangeFct (fct_id, force_mode) {
if (fct_id == "MULTI") {
} else {
bitsWi.selectFctById(fct_id);
var bitsWiUIFctSelect = document.getElementById("bitsWiUIFctSelect");
if (bitsWiUIFctSelect.lastChild.getAttribute("value") == "MULTI") {
bitsWiUIFctSelect.removeChild(bitsWiUIFctSelect.lastChild);
}
}
bitsWiUpdateFctPairHTML();
if ((bitsWi.property["AutoMode"] != null && bitsWi.property["AutoMode"] == "1") || force_mode) {
bitsWiExecSearch();
}
}
function bitsWiUpdateFctPairHTML () {
var selFcts = bitsWi.getSelectedFacets();
var div = document.getElementById("bitsWiUIFctPairDiv");
if(div){
if (selFcts[0].property["pair_html"]) {
div.style.overflow = "visible";
div.style.height = "";
div.innerHTML = selFcts[0].property["pair_html"];
} else {
div.style.overflow = "hidden";
div.innerHTML = "";
if(document.compatMode == "BackCompat"){
div.style.height = "auto";
}else{
div.style.height = "0%";
}
}
}
}
function bitsWIREDiCON() {
this.property = new Object();
this.dicArray = new Array();
this.fctArray = new Array();
this.searchRes = new Array();
this.descURLs = new Array();
this.init = function () {
this.loadProperty();
this.loadDictionary();
this.loadFacet();
};
this.loadProperty = function() {
this.property = eval("(" + bitsWiGenInfo + ")");
};
this.loadDictionary = function() {
for (var i = 0; i < bitsWiDicInfo.length; i++) {
bitsWiDic = new bitsWIDicClass();
bitsWiDic.loadDic(bitsWiDicInfo[i]);
this.dicArray.push(bitsWiDic);
}
};
this.loadFacet = function() {
for (var i = 0; i < bitsWiFctInfo.length; i++) {
bitsWiFct = new bitsWIFctClass();
bitsWiFct.loadFct(bitsWiFctInfo[i]);
this.fctArray.push(bitsWiFct);
}
};
this.setCSS = function() {
bitsWi.property["CSSIndex"] = document.styleSheets.length;
var bitsWiStyle = document.createElement("style");
if(document.getElementsByTagName('head')[0]){
document.getElementsByTagName('head')[0].appendChild(bitsWiStyle);
}else{
var head = document.createElement("head");
head.appendChild(bitsWiStyle);
document.appendChild(head);
}
if (bitsWi.property["StyleDefinition"] != null && bitsWi.property["StyleDefinition"].length > 0) {
var bitsWiStyles = bitsWi.property["StyleDefinition"].split("}");
var stylecontents = "";
if(bitsWiBrowser.match(/^IE/)){
//faster than addRule
document.styleSheets[bitsWi.property["CSSIndex"]].cssText = bitsWi.property["StyleDefinition"];
}else{
for (var styleIndex = 0; styleIndex < bitsWiStyles.length; styleIndex++) {
//if(bitsWiBrowser.match(/^IE/)) {
// var selpro = bitsWiStyles[styleIndex].split("{");
// if (selpro[0] && selpro[1]) {
// document.styleSheets[bitsWi.property["CSSIndex"]].addRule(selpro[0], '{' + selpro[1] + '}');
// }
//} else
if (bitsWiBrowser == "Safari") {
if (bitsWiStyles[styleIndex]) {
stylecontents += bitsWiStyles[styleIndex] + "}\n";
}
} else {
if (bitsWiStyles[styleIndex]) {
document.styleSheets[bitsWi.property["CSSIndex"]].insertRule(bitsWiStyles[styleIndex] + '}', document.styleSheets[bitsWi.property["CSSIndex"]].cssRules.length);
}
}
}
}
if (bitsWi.property["TermColor"] != null && bitsWi.property["TermColor"].length > 0) {
if(bitsWiBrowser.match(/^IE/)){
// for IE8
var cssText = document.styleSheets[bitsWi.property["CSSIndex"]].cssText;
document.styleSheets[bitsWi.property["CSSIndex"]].cssText = cssText + " .bitsWiWIREDiCONSpan {color:#" + bitsWi.property["TermColor"] + "} .bitsWiWIREDiCONSpan_ORIGINAL {color:#" + bitsWi.property["TermColor"] + "}";
//document.styleSheets[bitsWi.property["CSSIndex"]].addRule(".bitsWiWIREDiCONSpan", "{color:" + '#' + bitsWi.property["TermColor"] + "}");
//document.styleSheets[bitsWi.property["CSSIndex"]].addRule(".bitsWiWIREDiCONSpan_ORIGINAL", "{color:" + '#' + bitsWi.property["TermColor"] + "}");
} else if (bitsWiBrowser == "Safari") {
stylecontents += ".bitsWiWIREDiCONSpan {color:" + '#' + bitsWi.property["TermColor"] + "}\n";
stylecontents += ".bitsWiWIREDiCONSpan_ORIGINAL {color:" + '#' + bitsWi.property["TermColor"] + "}\n";
} else {
document.styleSheets[bitsWi.property["CSSIndex"]].insertRule(".bitsWiWIREDiCONSpan {color:" + '#' + bitsWi.property["TermColor"] + "}", document.styleSheets[bitsWi.property["CSSIndex"]].cssRules.length);
document.styleSheets[bitsWi.property["CSSIndex"]].insertRule(".bitsWiWIREDiCONSpan_ORIGINAL {color:" + '#' + bitsWi.property["TermColor"] + "}", document.styleSheets[bitsWi.property["CSSIndex"]].cssRules.length);
}
}
if (bitsWi.property["TermBGColor"] != null && bitsWi.property["TermBGColor"].length > 0) {
if(bitsWiBrowser.match(/^IE/)){
// for IE8
var cssText = document.styleSheets[bitsWi.property["CSSIndex"]].cssText;
document.styleSheets[bitsWi.property["CSSIndex"]].cssText = cssText + " .bitsWiWIREDiCONSpan {background-color:#" + bitsWi.property["TermBGColor"] + "} .bitsWiWIREDiCONSpan_ORIGINAL {background-color:#" + bitsWi.property["TermBGColor"] + "}";
//document.styleSheets[bitsWi.property["CSSIndex"]].addRule(".bitsWiWIREDiCONSpan", "{background-color:" + '#' + bitsWi.property["TermBGColor"] + "}");
//document.styleSheets[bitsWi.property["CSSIndex"]].addRule(".bitsWiWIREDiCONSpan_ORIGINAL", "{background-color:" + '#' + bitsWi.property["TermBGColor"] + "}");
} else if (bitsWiBrowser == "Safari") {
stylecontents += ".bitsWiWIREDiCONSpan {background-color:" + '#' + bitsWi.property["TermBGColor"] + "}\n";
stylecontents += ".bitsWiWIREDiCONSpan_ORIGINAL {background-color:" + '#' + bitsWi.property["TermBGColor"] + "}\n";
} else {
document.styleSheets[bitsWi.property["CSSIndex"]].insertRule(".bitsWiWIREDiCONSpan {background-color:" + '#' + bitsWi.property["TermBGColor"] + "}", document.styleSheets[bitsWi.property["CSSIndex"]].cssRules.length);
document.styleSheets[bitsWi.property["CSSIndex"]].insertRule(".bitsWiWIREDiCONSpan_ORIGINAL {background-color:" + '#' + bitsWi.property["TermBGColor"] + "}", document.styleSheets[bitsWi.property["CSSIndex"]].cssRules.length);
}
}
if (bitsWiBrowser == "Safari") {
var bitsWiStyle = document.createElement("style");
bitsWiStyle.appendChild(document.createTextNode(stylecontents));
document.getElementsByTagName('head')[0].appendChild(bitsWiStyle);
}
}
};
this.showUI = function() {
this.setCSS();
var ui;
ui = document.createElement("div");
ui.setAttribute("id", "bitsWiUIMainDiv");
var attachdiv;
if (bitsWi.property["AttachDivID"] != null && bitsWi.property["AttachDivID"].length > 0) {
attachdiv = document.getElementById(bitsWi.property["AttachDivID"]);
}
var templateHTML = "";
ui.innerHTML = bitsWiTemplateHTML;
// User Interface drag event
if (bitsWi.property["PanelPosition"] != null && bitsWi.property["PanelPosition"] == "Floating") {
bitsWIaddEvent(document, 'mousemove', function(e) {bitsWiOnMouseMove(e);});
bitsWIaddEvent(document, 'mouseup', function(e) {bitsWiOnMouseUp(e);});
}
bitsWi.property["InsertHeadOnly"] = "0";
bitsWi.property["TermHighlight"] = "1";
if (bitsWi.property["AttachDivID"] != null && bitsWi.property["AttachDivID"].length > 0) {
if (attachdiv != null) {
bitsWi.property["UIIsAttached"] = "1";
ui.style.position = "static";
attachdiv.appendChild(ui);
} else {
bitsWi.property["UIIsAttached"] = "0";
document.body.appendChild(ui);
}
} else {
document.body.appendChild(ui);
}
var bitsWiUIMainDiv = document.getElementById("bitsWiUIMainDiv");
if (document.compatMode && document.compatMode != "BackCompat") {
bitsWiDragBarClientX = document.documentElement.clientWidth - bitsWiUIMainDiv.clientWidth - 4;
bitsWiDragBarClientY = 1;
} else {
bitsWiDragBarClientX = document.body.clientWidth - bitsWiUIMainDiv.clientWidth - 4;
bitsWiDragBarClientY = 1;
}
bitsWiAdjustPanelPos();
};
this.getSelectedDictionary = function() {
for (var i = 0; i < this.dicArray.length; i++) {
if (this.dicArray[i].isSelected()) {
return this.dicArray[i];
}
}
return null;
};
this.getSelectedFacets = function() {
var retArray = new Array();
for (var i = 0; i < this.fctArray.length; i++) {
if (this.fctArray[i].isSelected()) {
retArray.push(this.fctArray[i]);
}
}
return retArray;
};
this.getSelectedFacetsMap = function() {
var retMap = new Array();
for (var i = 0; i < this.fctArray.length; i++) {
if (this.fctArray[i].isSelected()) {
var id = this.fctArray[i].property["id"];
retMap[id] = true;
}
}
return retMap;
};
this.selectDicById = function(dic_id) {
for (var i = 0; i < this.dicArray.length; i++) {
if (this.dicArray[i].property["id"] == dic_id) {
this.clearDicSelection();
this.dicArray[i].select();
break;
}
}
};
this.clearDicSelection = function () {
for (var i = 0; i < this.dicArray.length; i++) {
this.dicArray[i].deselect();
}
};
this.selectFctById = function(fct_id) {
for (var i = 0; i < this.fctArray.length; i++) {
if (this.fctArray[i].property["id"] == fct_id) {
this.clearFctSelection();
this.fctArray[i].select();
}
}
};
this.addSelectFctById = function(fct_id) {
for (var i = 0; i < this.fctArray.length; i++) {
if (this.fctArray[i].property["id"] == fct_id) {
this.fctArray[i].select();
}
}
};
this.clearFctSelection = function () {
for (var i = 0; i < this.fctArray.length; i++) {
this.fctArray[i].deselect();
}
};
this.getSortedFacets = function() {
var retArray = new Array();
for (var i = 0; i < this.fctArray.length; i++) {
if (this.fctArray[i].isSelected()) {
retArray.push(this.fctArray[i]);
}
}
for (var i = 0; i < this.fctArray.length; i++) {
if (this.fctArray[i].isSelected()) continue;
retArray.push(this.fctArray[i]);
}
return retArray;
};
}
function bitsWIDicClass() {
this.fSelected = false;
this.loadDic = function(JSON) {
var info = eval("(" + JSON + ")");
this.property = info.property;
this.term2ID = info.term2ID;
};
this.toString = function() {
this.retStr = "";
for (var key in this.property) {
this.retStr += key + " -> " + this.property[key];
this.retStr += "\n";
}
this.retStr += "\n";
for (var key in this.term2ID) {
this.retStr += key + " -> " + this.term2ID[key];
this.retStr += "\n";
}
return this.retStr;
};
this.select = function() {
this.fSelected = true;
};
this.deselect = function() {
this.fSelected = false;
};
this.isSelected = function() {
return this.fSelected;
};
}
function bitsWIFctClass() {
this.fSelected = false;
this.loadFct = function(JSON) {
var info = eval("(" + JSON + ")");
this.property = info.property;
};
this.toString = function() {
this.retStr = "";
for (var key in this.property) {
this.retStr += key + " -> " + this.property[key];
this.retStr += "\n";
}
return this.retStr;
};
this.select = function() {
this.fSelected = true;
};
this.deselect = function() {
this.fSelected = false;
};
this.isSelected = function() {
return this.fSelected;
};
}
function bitsWISearchResClass(term, id) {
this.term = term;
this.id = id;
this.desc = "";
this.show = true;
this.toString = function() {
this.retStr = this.term + " -> " + this.id + " :" + this.desc + "\n";
return this.retStr;
}
}
function bitsWIaddEvent(obj, evType, fn){
if(!obj["_"+evType]){
obj["_"+evType] = [];
if(obj["on" + evType] != null) obj["_"+evType].push(obj["on" + evType]);
obj["on" + evType] = bitsWIevokeEvent;
} else {
// for protorype.js
//for(var i in obj["_"+evType]) if(obj["_"+evType][i]===fn) return;
for(var i = 0; i < obj["_"+evType].length; i++) if(obj["_"+evType][i]===fn) return;
}
obj["_"+evType].push(fn);
};
function bitsWIremoveEvent(obj, evType, fn){
if(obj["_"+evType]){
// for protorype.js
//for(var i in obj["_"+evType]){
for(var i = 0; i < obj["_"+evType].length; i++){
if(obj["_"+evType][i]===fn) delete obj["_"+evType][i];
}
}
};
function bitsWIevokeEvent(e) {
var e = e || window.event;
// for protorype.js
//for(var i in this["_"+e.type]) this["_"+e.type][i].apply(this,[e]);
for(var i = 0; i < this["_"+e.type].length; i++) this["_"+e.type][i].call(this,e);
};
function bitsWIelemPos(elem) {
var obj = new Object();
obj.x = elem.offsetLeft;
obj.y = elem.offsetTop;
while(elem.offsetParent) {
elem = elem.offsetParent;
obj.x += elem.offsetLeft;
obj.y += elem.offsetTop;
}
return obj;
};
function bitsWITermTooltipPos(baseElem, pos, popupElem, padding) {
var offsetElem = baseElem;
var offsetLeft = 0;
var offsetTop = 0;
while(offsetElem) {
offsetLeft += offsetElem.offsetLeft;
offsetTop += offsetElem.offsetTop;
offsetElem = offsetElem.offsetParent;
}
var offsetMap = new Array();
if(pos == "upper"){
offsetMap["top"] = offsetTop - popupElem.offsetHeight;
offsetMap["left"] = offsetLeft;
}else if(pos == "left"){
offsetMap["top"] = offsetTop;
offsetMap["left"] = offsetLeft - popupElem.offsetWidth ;
}else if(pos == "right"){
offsetMap["top"] = offsetTop;
offsetMap["left"] = offsetLeft + baseElem.offsetWidth;
}else if(pos == "lower"){
offsetMap["top"] = offsetTop + baseElem.offsetHeight;
offsetMap["left"] = offsetLeft;
// }else if(pos == "auto" && popupElem && body){
}else if(pos == "auto"){
// var win = baseElem.ownerDocument.defaultView;
var scrollLeft = document.body.scrollLeft || document.documentElement.scrollLeft;
var scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
var innerHeight = 0;
var innerWidth = 0;
if (document.compatMode && document.compatMode != "BackCompat") {
innerHeight = document.documentElement.clientHeight
innerWidth = document.documentElement.clientWidth;
}else{
innerHeight = document.body.clientHeight;
innerWidth = document.body.clientWidth;
}
// var innerHeight = window.innerHeight || document.body.clientHeight;
// var innerWidth = window.innerWidth || document.body.clientWidth;
// var innerHeight = document.body.clientHeight || document.documentElement.clientHeight;
// var innerWidth = document.body.clientWidth || document.documentElement.clientWidth;
// potition top
offsetMap["top"] = offsetTop + baseElem.offsetHeight - padding;
offsetMap["pos_v"] = "lower";
// var dispElemBottom = offsetTop + baseElem.offsetHeight + popupElem.offsetHeight - win.scrollY;
var dispElemBottom = offsetTop + baseElem.offsetHeight + popupElem.offsetHeight - scrollTop;
// if(dispElemBottom > win.innerHeight){
//alert(window.innerHeight);
if(dispElemBottom > innerHeight){
offsetMap["top"] = offsetTop - popupElem.offsetHeight + padding;
offsetMap["pos_v"] = "upper";
}
// position left
offsetMap["left"] = offsetLeft - padding;
offsetMap["pos_h"] = "left";
// var dispElemRight = offsetLeft + popupElem.offsetWidth - win.scrollX;
var dispElemRight = offsetLeft + popupElem.offsetWidth - scrollLeft;
// if(dispElemRight > win.innerWidth){
if(dispElemRight > innerWidth){
offsetMap["left"] = offsetLeft + baseElem.offsetWidth - popupElem.offsetWidth + padding;
offsetMap["pos_h"] = "right";
}
}else{
offsetMap["top"] = offsetTop - padding;
offsetMap["left"] = offsetLeft - padding;
}
return offsetMap;
};
function bitsWIcurrentTarget(e,attribute) {
var elem;
if(e.srcElement){
elem = e.srcElement;
for(var i = 0; i < 100, elem; i++){
if(elem.getAttribute(attribute) != null){
break;
}
elem = elem.parentNode;
}
}else{
elem = e.currentTarget;
}
return elem;
};