var MKPConfig = { CaseSensitive: "off", Charset: "UTF-8", CtrlURL: "script/mkp_controller.php", divName: 'divMKPScript', MemoryCache: 'on', parseElements: [] }; var MKPTimer = null; var MKPCache = []; var MKPSubstitutionTable = new Array(); var MKPScript = null; var MKPDiv = document.createElement('div'); MKPDiv.setAttribute('id', MKPConfig.divName); MKPDiv.setAttribute('onmouseover', 'MKPclearTimer()'); MKPDiv.setAttribute('onmouseout', 'MKPsetTimer()'); MKPDiv.setAttribute('class', 'mkpScript'); if(document.implementation && document.implementation.createDocument) var MKPisMozilla=true; else var MKPisMozilla=false; // Short name of function function $(divName) { return document.getElementById(divName); } function MKPhideMessage(){ var MessageObj=$(MKPConfig.divName); MessageObj.style.visibility="hidden"; } function MKPclearTimer() { if (MKPTimer) { clearTimeout(MKPTimer); MKPTimer = null; } } function MKPsetTimer() { MKPTimer = window.setTimeout('MKPhideMessage()', 250); } window.MKPSize = function() { var w = 0; var h = 0; //IE if(!window.innerWidth) { //strict mode if(!(document.documentElement.clientWidth == 0)) { w = document.documentElement.clientWidth; h = document.documentElement.clientHeight; } //quirks mode else { if(document.body.clientWidth) { w = document.body.clientWidth; h = document.body.clientHeight; } else { w = window.document.body.offsetWidth; h = window.document.body.offsetHeight; } } } //w3c else { w = window.innerWidth; h = window.innerHeight; } return {width:w,height:h}; } function MKPadjustMessage(evt) { var left; var top; MKPclearTimer(); MessageObj = $(MKPConfig.divName); if (MKPisMozilla) event=evt; wsize = window.MKPSize(); var rightedge = wsize.width-event.clientX; var bottomedge = wsize.height-event.clientY; // Compliance with HTML 4/XHTML if(document.documentElement && document.documentElement.scrollTop) scrollTop = document.documentElement.scrollTop; else scrollTop = document.body.scrollTop; // Compliance with HTML 4/XHTML if(document.documentElement && document.documentElement.scrollLeft) scrollLeft = document.documentElement.scrollLeft; else scrollLeft = document.body.scrollLeft; if (rightedge < MessageObj.offsetWidth) left = scrollLeft + event.clientX - MessageObj.offsetWidth; else left = scrollLeft + event.clientX; if (bottomedge < MessageObj.offsetHeight) top = scrollTop + event.clientY - MessageObj.offsetHeight; else top = scrollTop + event.clientY; MessageObj.style.top = (top)+"px"; MessageObj.style.left = (left)+"px"; MessageObj.innerHTML = ''; MessageObj.style.visibility = "visible"; } function MKPdeliveryMessage(respondStructure) { MessageObj.innerHTML = MKPdiv_content(respondStructure); } function MKPshowMessage(respondStructure) { MKPdeliveryMessage(respondStructure); if(MKPConfig.MemoryCache=="on") MKPCache[respondStructure.term] = respondStructure; return false; } var handleSuccess = function(respondStructure){ if(respondStructure !== undefined){ MKPshowMessage(respondStructure); } }; function MKPgetDefinition(term,evt){ MKPadjustMessage(evt); if(MKPCache[term]!=undefined) { return MKPdeliveryMessage(MKPCache[term]); } MKPserverRequest(MKPConfig.CtrlURL, 'call=getDataAndFitlering&term='+encodeURIComponent(term)+'&charset='+MKPConfig.Charset+'&casesensitive='+MKPConfig.CaseSensitive+'&sourceurl='+document.URL+'&PubId='+MKPConfig.PubID, 'handleSuccess'); } function MKPstripSlashes(content) { // Strip Slashes re = /\\\"/gi; content = content.replace(re, '"'); re = /\\\'/gi; content = content.replace(re, "'"); return content; } var MKPphandleSuccess = function(respondStructure){ if(respondStructure !== undefined){ MKPSubstitutionTable = respondStructure.termlist; if(MKPConfig.parseElements.length>0) { // Elements to parse are defined for(var Inx in MKPConfig.parseElements) { MKPparseChildNodes($(MKPConfig.parseElements[Inx])); re = /\{th\}(.*?)\{\/th\}/gi; text_str = $(MKPConfig.parseElements[Inx]).innerHTML + ''; //$(MKPConfig.parseElements[Inx]).innerHTML = text_str.replace(re, "$1"); } } else { // Otherwise parse whole BODY content BodyObj = document.getElementsByTagName("BODY"); MKPparseChildNodes(BodyObj[0]); re = /\{th\}(.*?)\{\/th\}/gi; text_str = BodyObj[0].innerHTML + ''; //BodyObj[0].innerHTML = text_str.replace(re, "$1"); } } }; function MKPparseContent(){ document.getElementsByTagName("body")[0].appendChild(MKPDiv); MKPserverRequest(MKPConfig.CtrlURL, 'PubWpID='+MKPConfig.PubWpID+'&charset='+MKPConfig.Charset+'&casesensitive='+MKPConfig.CaseSensitive+'&call=getDataAndParsing', 'MKPphandleSuccess'); } function MKPcalcClick(term){ if(MKPConfig.MemoryCache!="on") return true; MKPserverRequest(MKPConfig.CtrlURL, 'call=MKPcalcClick&casesensitive='+MKPConfig.CaseSensitive+'&term='+term+'&sourceurl='+document.URL+'&PubId='+MKPConfig.PubID, 'MKPphandleSuccess'); return true; } function MKPcalcImpression(term){ if(MKPCache[term]!=undefined) { return MKPdeliveryMessage(MKPCache[term]); } if(MKPConfig.MemoryCache!="on") return true; return true; } function MKPparseText(obj) { var text_str = obj.nodeValue + ''; if(text_str.length<2 || text_str=="null") return false; for(var i=0;i0 && obj.childNodes[i].nodeName!="IFRAME" && obj.childNodes[i].nodeName!="SCRIPT" && obj.childNodes[i].nodeName!="A" && obj.childNodes[i].nodeName!="H1" && obj.childNodes[i].nodeName!="H2" && obj.childNodes[i].nodeName!="H3") MKPparseChildNodes(obj.childNodes[i]); else MKPparseText(obj.childNodes[i]); } } function MKPserverRequest(url, data, callback) { var fUrl = url+'?'+data+'&callback='+callback; MKPScript = document.createElement('script'); MKPScript.setAttribute('type', 'text/javascript'); MKPScript.setAttribute('src', fUrl); MKPScript.setAttribute('id', 'scrMKPScript'); document.getElementsByTagName("head")[0].appendChild(MKPScript); } function MKPexec_clicks(url, ad_kwo_id){ window.open(url); MKPserverRequest(MKPConfig.CtrlURL, 'call=MKPcalcClick&ad_kwo_id='+encodeURIComponent(ad_kwo_id)+'&sourceurl='+document.URL+'&PubId='+MKPConfig.PubID, 'handleSuccess'); } function MKPdiv_content(respondStructure){ text=''; if(respondStructure.ad_Type==1)//text only text = '

'+respondStructure.ad_Title+'

'+respondStructure.ad_Text+'
'; if(respondStructure.ad_Type==2)//image + text text = '

'+respondStructure.ad_Title+'

'+respondStructure.ad_Text+'
'; return text; }