lastRequestTextareaValue = null; lastRequestLps = null; lastRequestLpt = null; var debug = 0; var pageName; var Drag = { obj : null, init : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper) { o.onmousedown = Drag.start; o.hmode = bSwapHorzRef ? false : true ; o.vmode = bSwapVertRef ? false : true ; o.root = oRoot && oRoot != null ? oRoot : o ; if (o.hmode && isNaN(parseInt(o.root.style.left ))) o.root.style.left = "0px"; if (o.vmode && isNaN(parseInt(o.root.style.top ))) o.root.style.top = "0px"; if (!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right = "0px"; if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom = "0px"; o.minX = typeof minX != 'undefined' ? minX : null; o.minY = typeof minY != 'undefined' ? minY : null; o.maxX = typeof maxX != 'undefined' ? maxX : null; o.maxY = typeof maxY != 'undefined' ? maxY : null; o.xMapper = fXMapper ? fXMapper : null; o.yMapper = fYMapper ? fYMapper : null; o.root.onDragStart = new Function(); o.root.onDragEnd = new Function(); o.root.onDrag = new Function(); }, start : function(e) { var o = Drag.obj = this; e = Drag.fixE(e); var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom); var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right ); o.root.onDragStart(x, y); o.lastMouseX = e.clientX; o.lastMouseY = e.clientY; if (o.hmode) { if (o.minX != null) o.minMouseX = e.clientX - x + o.minX; if (o.maxX != null) o.maxMouseX = o.minMouseX + o.maxX - o.minX; } else { if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x; if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x; } if (o.vmode) { if (o.minY != null) o.minMouseY = e.clientY - y + o.minY; if (o.maxY != null) o.maxMouseY = o.minMouseY + o.maxY - o.minY; } else { if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y; if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y; } document.onmousemove = Drag.drag; document.onmouseup = Drag.end; return false; }, drag : function(e) { e = Drag.fixE(e); var o = Drag.obj; var ey = e.clientY; var ex = e.clientX; var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom); var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right ); var nx, ny; if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX); if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX); if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY); if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY); nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1)); ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1)); if (o.xMapper) nx = o.xMapper(y) else if (o.yMapper) ny = o.yMapper(x) Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px"; Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px"; Drag.obj.lastMouseX = ex; Drag.obj.lastMouseY = ey; Drag.obj.root.onDrag(nx, ny); return false; }, end : function() { document.onmousemove = null; document.onmouseup = null; Drag.obj.root.onDragEnd( parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]), parseInt(Drag.obj.root.style[Drag.obj.vmode ? "top" : "bottom"])); Drag.obj = null; }, fixE : function(e) { if (typeof e == 'undefined') e = window.event; if (typeof e.layerX == 'undefined') e.layerX = e.offsetX; if (typeof e.layerY == 'undefined') e.layerY = e.offsetY; return e; } }; function Down(game) { Close(); } function Close() { var p=document.getElementById("dropin"); p.style.visibility="hidden"; } function sendgoogle() { var p="http://search.babylon.com/?babsrc=dictionarybc&sa=Search&q=" + document.getElementById("qc").value; document.location.href=p; } function download_tb(Urchin) { pageTracker._trackPageview(Urchin); var TranslatorFile= "http://www.babylon.com/systems/redirects/userupdateandredir.php?cname=searchID&ctype=ie_toolbar&cfile=redir"; document.location.href = TranslatorFile; } function submitit() { if(document.getElementById('searchweb').checked) { document.location.href = 'http://search.babylon.com/?q=' + document.getElementById('term').value + '&babsrc=dictionarybc'; } else { submit(); } } function clearDefault(el) { if (el.defaultValue==el.value) el.value = "" } var http_request = false; function makePOSTRequestfta(url, parameters) { http_requesta = false; if (window.XMLHttpRequest) { // Mozilla, Safari,... http_requesta = new XMLHttpRequest(); if (http_requesta.overrideMimeType) { http_requesta.overrideMimeType('text/html'); } } else if (window.ActiveXObject) { // IE try { http_requesta = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_requesta = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_requesta) { if(debug) alert('Cannot create XMLHTTP instance'); return false; } http_requesta.onreadystatechange = alertContentsfta; http_requesta.open('POST', url, true); http_requesta.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http_requesta.setRequestHeader("Content-length", parameters.length); http_requesta.setRequestHeader("Connection", "close"); http_requesta.send(parameters); } function makePOSTRequestft(url, parameters) { http_request = false; if (window.XMLHttpRequest) { // Mozilla, Safari,... http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType('text/html'); } } else if (window.ActiveXObject) { // IE try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_request) { if(debug) alert('Cannot create XMLHTTP instance'); return false; } http_request.onreadystatechange = alertContentsft; http_request.open('POST', url, true); http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http_request.setRequestHeader("Content-length", parameters.length); http_request.setRequestHeader("Connection", "close"); http_request.send(parameters); } function makePOSTRequestfte(url, parameters) { http_requeste = false; if (window.XMLHttpRequest) { // Mozilla, Safari,... http_requeste = new XMLHttpRequest(); if (http_requeste.overrideMimeType) { http_requeste.overrideMimeType('text/html'); } } else if (window.ActiveXObject) { // IE try { http_requeste = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_requeste = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_requeste) { if(debug) alert('Cannot create XMLHTTP instance'); return false; } http_requeste.onreadystatechange = alertContentsfte; http_requeste.open('POST', url, true); http_requeste.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http_requeste.setRequestHeader("Content-length", parameters.length); http_requeste.setRequestHeader("Connection", "close"); http_requeste.send(parameters); } function pause(numberMillis) { var now = new Date(); var exitTime = now.getTime() + numberMillis; while (true) { now = new Date(); if (now.getTime() > exitTime) return; } } function makePOSTRequestftes(url, parameters) { http_requestes = false; if (window.XMLHttpRequest) { // Mozilla, Safari,... http_requestes = new XMLHttpRequest(); if (http_requestes.overrideMimeType) { http_requestes.overrideMimeType('text/html'); } } else if (window.ActiveXObject) { // IE try { http_requestes = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_requestes = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_requestes) { if(debug) alert('Cannot create XMLHTTP instance'); return false; } http_requestes.onreadystatechange = alertContentsftes; http_requestes.open('POST', url, true); http_requestes.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http_requestes.setRequestHeader("Content-length", parameters.length); http_requestes.setRequestHeader("Connection", "close"); http_requestes.send(parameters); } function alertContentsft() { if (http_request.readyState == 4) { if (http_request.status == 200) { //alert(http_request.responseText); result = http_request.responseText; sourceLanguageSelect = document.getElementById('lps'); targetLanguageSelect = document.getElementById('lpt'); inputBox = document.getElementById('mytextarea1'); resultBox = document.getElementById('resltext'); if(sourceLanguageSelect != null && targetLanguageSelect != null) { // if the source and target language are the same // simply copy the content to the result box if(sourceLanguageSelect.value == targetLanguageSelect.value) resultBox.textContent = inputBox.value; else document.getElementById('resltext').innerHTML = result; } document.getElementById('resltoff').style.display = 'none'; document.getElementById('reslt').style.display = 'block'; //window.location.hash='reslt'; if(document.getElementById('qc') != null && document.getElementById('mytextarea1')) document.getElementById('qc').value = document.getElementById('mytextarea1').value; if(document.getElementById('translateQuery') != null) { document.getElementById('translateQuery').disabled = false; document.getElementById('translateQuery').value = 'Translate'; } } else { if(debug) alert(http_request.status); } } } function alertContentsfte() { if (http_requeste.readyState == 4) { if (http_requeste.status == 200) { //alert(http_requeste.responseText); result = http_requeste.responseText; document.getElementById('titles').innerHTML = result; //document.getElementById('reslt').style.display = 'block'; } else { if(debug) alert(http_requeste.status); } } } function alertContentsfta() { if (http_requesta.readyState == 4) { if (http_requesta.status == 200) { //alert(http_requesta.responseText); result = http_requesta.responseText; document.getElementById('resltext').innerHTML = result; document.getElementById('reslt').style.display = 'block'; } else { if(debug) alert(http_requeste.status); } } } function alertContentsftes() { if (http_requestes.readyState == 4) { if (http_requestes.status == 200) { // alert(http_requestes.responseText); result = http_requestes.responseText; document.getElementById('contents').innerHTML = result; } else { if(debug) alert(http_requestes.status); } } } function getft(obj) { inputElement = document.getElementById("mytextarea1"); if(inputElement == null) inputElement = document.getElementById("term"); currentRequestTextareaValue = inputElement.value; currentRequestLps = document.getElementById("lps"); if(currentRequestLps != null) currentRequestLps = currentRequestLps.value; currentRequestLpt = document.getElementById("lpt"); if(currentRequestLpt != null) currentRequestLpt = currentRequestLpt.value; if(currentRequestTextareaValue == lastRequestTextareaValue && currentRequestLps == lastRequestLps && currentRequestLpt == lastRequestLpt) return false; lastRequestTextareaValue = currentRequestTextareaValue; lastRequestLps = currentRequestLps; lastRequestLpt = currentRequestLpt; pageTracker._trackEvent(pageName, 'translation'); var poststr = "mytextarea1=" + encodeURI( inputElement.value ) + "&lps=" + encodeURI( currentRequestLps ) + "&lpt=" + encodeURI( currentRequestLpt ); makePOSTRequestft('/post_post.php', poststr); makePOSTRequestfte('/post_poste.php', poststr); makePOSTRequestftes('/post_postes.php', poststr); } function getfta(obj) { var poststr = "term=" + encodeURI( document.getElementById("term").value ) + "&uris=" + encodeURI( document.getElementById("uris").value); makePOSTRequestfta('/post_posta.php', poststr); } function download(theFile,Urchin) // links to download PHP by type { pageTracker._trackPageview(Urchin); var dURL = 'http://www.babylon.com/redirects/download.cgi?type=7262'; orig_URL = downloadAffCode; var theURL= orig_URL; window.open(dURL, 'Download', 'scrollbars=no,status=no,width=1,height=1'); var don=dURL; theURL=theURL; document.location.href = theURL; //window.open(theURL); } function downloadLP(theurl, Urchin) // links to download PHP by type { pageTracker._trackPageview(Urchin); document.location.href = theurl; } function goto_url(theFile,Urchin) // links to download PHP by type { pageTracker._trackPageview(Urchin); document.location.href = theFile; //window.open(theURL); } function purchase(theurl, Urchin) // links to download PHP by type { pageTracker._trackPageview(Urchin); document.location.href = theurl; } function sedtogoogle(){ var re= /<\S[^>]*>/g; var helphint = document.getElementById('contents').innerHTML; helphint = helphint.replace(re,""); document.location.href = 'http://search.babylon.com/?q=' + helphint + '&babsrc=dictionarybc'; } function google_ad_request_done(google_ads) { var s = ''; var i; if (google_ads.length == 0) return; if (google_ads[0].type == "image") { s += ''; } else if (google_ads[0].type == "flash") { s += '' + '' + '' + '' + ''; } else if (google_ads[0].type == "html") { s += google_ads[0].snippet; } else if (google_ads[0].type == "text") { if (google_ads.length == 1) { s += '' + '' + '' + google_ads[0].line1 + '
' + '' + google_ads[0].line2 + ' ' + google_ads[0].line3 + '
' + '' + google_ads[0].visible_url + '

'; } else if (google_ads.length > 1) { for(i=0; i < google_ads.length; ++i) { s += '
' + '' + '' + google_ads[i].line1 + '
' + '' + '' + google_ads[i].line2 + '
' + google_ads[i].line3 + '
' + '' + '' + google_ads[i].visible_url + '
'; } } s += 'Ads by Google'; } document.write(s); return; }