// LookWAYup
// Copyright (c) 2000-2006 RES Inc.
// You may not change nor copy this file, or even write programs "inspired" by it
// Webmasters: you can put LookWAYup on your pages using the methods and subject to the conditions on the LookWAYup site.
var dL=document;
var ns4=(dL.layers)? true:false;
var ns6=(dL.getElementById)? true:false; // DOM Gecko, or ie5
var ie4=(dL.all)? true:false; // ie4 or up
var ie5=(ie4 && ns6) ? true:false;
var vL=navigator.appVersion.toLowerCase();
var X11=(vL.indexOf('x11') > -1);
var Mac=(vL.indexOf('mac') > -1);
var Agt=navigator.userAgent.toLowerCase()
var Ope=(Agt.indexOf('ope') > -1);
var Saf=(Agt.indexOf('safari') > -1);
var Click1=false;
var Click2=false;
var otherWindow='no';
var dE;
var s;
var slang=null, lang=null;
var lwuScript ='http://lookWAYup.com/lwu.exe/lwu/d';

if (ns4){
window.captureEvents (Event.DRAGDROP | Event.DBLCLICK | Event.MOUSEUP | Event.KEYDOWN);
window.onDragDrop=nsGetInfo;
window.onDblClick=dClk;
window.onMouseUp=mUp;
window.onKeyUp=Key;
}else{
if (ie4||Ope||Saf) {dL.ondblclick=dClk;dL.onmouseup=mUp;dL.onkeyup=Key;}
else dL.addEventListener('dblclick', dClk, false); // Gecko
}

function Key(e)
{
var key=ns4?e.which:event.keyCode
if(event)if(event.target)if(event.target.tagName=='input') return true // form has the focus
if (key==13) dClk(e)// CR.
return true;
} 

function mUp(e)
{
// simulate DoubleClick
if (X11||Mac||Ope){
	if (Click1){Click2=true}
	else {Click1=true; setTimeout("Click1=false;",550);}
}
if (Click2) dClk(e)
return true;
}

function otherWin (hyper) {
hyper.target='otherWin';
if (s=='s'){ hyper.target=ie4?'_main':'_content'}
else{
otherWindow=window.open(hyper.href,'otherWin', 'channelmode=0,scrollbars,resizable,toolbar,width=520,height=520');
if(ie5 || ns4) otherWindow.focus(); // IE4 & ns6 can't focus if it's another domain.
return false
}
return true
}

function to(l) {lang=l;slang=null}
function fr(l) {slang=l;lang=null}

function lwu(w) {
var l,t,h
if (!w) w="";
w=w.replace(/^[^A-Za-z]+|[^A-Za-z\xDF-\xFF]+$/g,'');// trim
if (w!="" && w.length<50){
Click2=false;

l=(slang)?';slang='+slang:''
t=(lang)?'&lang='+lang:''
to(null)
h=location.host
var o=window
var wh=450,x=0,y=0,ww=265
if (ns6){y=o.screenY;x=o.screenX;wh=o.outerHeight-53}
if (dL.f){dL.f.w.value=w;dL.f.submit();}
else{var u=lwuScript+l+'?t='+escape(dL.title)+t+'&h='+h+'&s=s&w='+escape(w);
var sbw=o.open(u,'_search', 'scrollbars,resizable,dependent,width='+ww+',height='+wh+',screenx='+x+',screeny='+y);
if(ie5)o.open(u,'_search');if(!ie5)if((x-sbw.screenX)<10){o.resizeTo(o.outerWidth-ww,wh+53);o.moveTo(x+ww,y)}}
}
}

function fnGetInfo() {
cursorToCopy();
lwu(event.dataTransfer.getData("Text"));
}

function dClk(e) {
Click2=true;
var str=null;
if (window.getSelection) {str=window.getSelection().toString()}
else if (dL.getSelection) str=dL.getSelection();
else if (dL.selection && dL.selection.createRange)
{
	var range=dL.selection.createRange();
	if (range) str=range.text;
}
if (!str) if (Saf) str=getSelection(); // Safari
// if (!str && Ope) {window.open('http://lookwayup.com/free/installOP.htm','otherWin', 'scrollbars,resizable,width=610,height=520');Ope=false}
lwu(str);
return true;
}

function toE(l) {
dL.f.action='/lwu.exe/lwu/toEng';
}

function nsGetInfo(e) {
dL.f.w.value=e.data; // need UniversalBrowserRead
return false;
}

function cursorToCopy() {
event.returnValue=false; // cancel default
event.dataTransfer.dropEffect="copy"; // cursor to copy icon.
}
function searchURL(q, d){return '';}
function searchExt(q, d){return '';}
function set_eng_pref(){
eID=1;if (!(dE)) get_pref();if (dE) {eID=dE.selectedIndex};siteID=dE.options[eID].value;set_pref(eID);return siteID;
}
function set_pref(pref){
var tod=new Date();
var exp=new Date(tod.getTime() + (52 * 7 * 86400000)); // 52 weeks
dL.cookie='LWU=;expires=Monday, 07-Nov-99 01:00:00 GMT' // no old path
dL.cookie='LWU='+ pref + ';expires=' + exp.toGMTString()+';path=/;'
}
function get_pref(){
if (dL.Eng){
dE=dL.Eng.Engine;
var c=(dL.cookie)?dL.cookie:'';
var start=c.indexOf('LWU=')
if (start == -1) return null;
var end=c.indexOf(';',start+4);
if (end == -1) end=c.length;
c=unescape(c.substring(start+4,end));
if (dE)if (!isNaN(dE.selectedIndex)) dE.selectedIndex=parseInt(c);
return c;}
}
