function eWick_freezeEvent(e) {
	if (e.preventDefault) 
		e.preventDefault();
	e.returnValue = false;
	e.cancelBubble = true;
	if (e.stopPropagation) 
		e.stopPropagation();
	return false;
}

function eWick_isWithinNode(e,i,c,t,obj) {
	answer = false;
	te = e;
	while(te && !answer) {
		if	((te.id && (te.id == i)) || (te.className && (te.className == i+"Class"))
				|| (!t && c && te.className && (te.className == c))
				|| (!t && c && te.className && (te.className.indexOf(c) != -1))
				|| (t && te.tagName && (te.tagName.toLowerCase() == t))
				|| (obj && (te == obj))
			) {
			answer = te;
		} else {
			te = te.parentNode;
		}
	}
	return te;
}

function eWick_getEvent(event) {
	return (event ? event : window.event);
}

function eWick_getEventElement(e) {
	return (e.srcElement ? e.srcElement: (e.target ? e.target : e.currentTarget));
}

function eWick_findElementPosX(o) {
	curleft = 0;
	if (o.offsetParent) {
		while (o.offsetParent) {
			curleft += o.offsetLeft;
			o = o.offsetParent;
		}
	}
	else if (o.x)
		curleft += o.x
	return curleft;
}

function eWick_findElementPosY(o) {
	curtop = 0;
	if (o.offsetParent) {
		while (o.offsetParent) {
			curtop += o.offsetTop;
			o = o.offsetParent;
		}
	}
	else if (o.y)
		curtop += o.y
	return curtop;
}


function eWick_handleKeyPress(event) {
	e = eWick_getEvent(event);
	eL = eWick_getEventElement(e);

	upEl = eWick_isWithinNode(eL,null,"eWickEnabled",null,null);
	kc = e["keyCode"];

	if (eWick_isWickObject() && ((kc == 13) || (kc == 9))) {
		eWick.selectingSomething = true;
		if (eWick.isSafari) eWick.inputBox.blur();   /*hack to "wake up" safari*/
		try { eWick.inputBox.focus(); }
		catch(e) { return; }
		eWick.inputBox.value = eWick.inputBox.value.replace(/[ \r\n\t\f\s]+$/gi,' ');
		eWick_hideSmartInputFloater();
	} 
	else if (upEl && (kc != 38) && (kc != 40) && (kc != 37) && (kc != 39) && (kc != 13) && (kc != 27)) {
		if (!eWick_isWickObject() || (eWick_isWickObject() && !eWick.selectingSomething)) {
			eWick_processSmartInput(upEl);
		}
	} 
	else if (eWick_isWickObject() && eWick.inputBox) {
		eWick.inputBox.focus(); /*kinda part of the hack.*/
	}

}


function eWick_handleKeyDown(event) {
	e = eWick_getEvent(event);
	eL = eWick_getEventElement(e);

	if (eWick_isWickObject() && (kc = e["keyCode"])) {
		if (kc == 40) {
			eWick.selectingSomething = true;
			eWick_freezeEvent(e);
			if (eWick.isGecko) 
				eWick.inputBox.blur(); /* Gecko hack */
			eWick_selectNextSmartInputMatchItem();
		} 
		else if (kc == 38) {
			eWick.selectingSomething = true;
			eWick_freezeEvent(e);
			if (eWick.isGecko) 
				eWick.inputBox.blur();
			eWick_selectPreviousSmartInputMatchItem();
		} 
		else if ((kc == 13) || (kc == 9)) {
			eWick.selectingSomething = true;
			eWick_activateCurrentSmartInputMatch();
			eWick_freezeEvent(e);
		} 
		else if (kc == 27)  {
			eWick_hideSmartInputFloater();
			eWick_freezeEvent(e);
		} 
		else {
			eWick.selectingSomething = false;
		}
	}
}

function eWick_handleFocus(event) {
	e = eWick_getEvent(event);
	eL = eWick_getEventElement(e);
	if (focEl = eWick_isWithinNode(eL,null,"eWickEnabled",null,null)) {
		if (!eWick_isWickObject() || (eWick_isWickObject() && !eWick.selectingSomething)) {
			eWick_processSmartInput(focEl);
		}
	}
}

function eWick_handleBlur(event) {
	e = eWick_getEvent(event);
	eL = eWick_getEventElement(e);
	if (blurEl = eWick_isWithinNode(eL,null,"eWickEnabled",null,null)) {
		if (eWick_isWickObject() && !eWick.selectingSomething) 
			eWick_hideSmartInputFloater();
	}
}

function eWick_handleClick(event) {
	e2 = eWick_getEvent(event);
	eL2 = eWick_getEventElement(e2);
	if (eWick_isWickObject() && eWick.selectingSomething) {
		eWick_selectFromMouseClick();
	}
}

function eWick_handleMouseOver(event) {
	e = eWick_getEvent(event);
	eL = eWick_getEventElement(e);
	if (eWick_isWickObject() && (mEl = eWick_isWithinNode(eL,null,"eWick_matchedSmartInputItem",null,null))) {
		eWick.selectingSomething = true;
		eWick_selectFromMouseOver(mEl);
	} 
	else if (eWick_isWickObject()) {
		eWick.selectingSomething = false;
	}
}

function eWick_showSmartInputFloater() {
	if (!eWick.floater.style.display || (eWick.floater.style.display=="none")) {
		if (!eWick.customFloater) {
			x = eWick_findElementPosX(eWick.inputBox);
			y = eWick_findElementPosY(eWick.inputBox) + eWick.inputBox.offsetHeight;
			/*hack: browser-specific adjustments.*/
			if (!eWick.isGecko && !eWick.isWinIE) x += 8;
			if (!eWick.isGecko && !eWick.isWinIE) y += 10;
			eWick.floater.style.left = x;
			eWick.floater.style.top = y;
		} 
		else {
			/*additional things for custom floater
			  beyond setting display and visibility*/
		}
		eWick.floater.style.display="block";
		eWick.floater.style.visibility="visible";
		eWick.floater.style.width = eWick.inputBox.offsetWidth;
		eWick_hideBadElement('SELECT', eWick.floater);
	}
}

function eWick_hideSmartInputFloater() {
	if (eWick_isWickObject()) {
		eWick_hideFloaterWait();
		eWick.floater.style.display="none";
		eWick.floater.style.visibility="hidden";
		eWick = null;
		eWick_showBadElement('SELECT');		
	}
}

function eWick_smartInputMatch(cleanValue, value) {
	this.cleanValue = cleanValue;
	this.value = value;
	this.isSelected = false;
}

function eWick_RemoveBadChars(s, bTrim) {
	s = s.replace(/\?|\(|\)|\[|\]|\{|\}|\.|\,|\||\\|\^|\$|\"|\'|\//g, " ");
	s = s.replace(/\s+/g, " ");
	if (bTrim) {
		s = s.replace(/^\s+|\s+$/g, '')   
	}
	return s;
}
function eWick_simplifyToRegExp(s) {
	if (!s) return "";
	s = eWick_RemoveBadChars(s, true);
    s = s.replace(/α|ά/gi,"(α|ά)");
    s = s.replace(/ε|έ/gi,"(ε|έ)");
    s = s.replace(/η|ή/gi,"(η|ή)");
	s = s.replace(/ι|ί|ϊ|ΐ/gi,"(ι|ί|ϊ|ΐ)");
    s = s.replace(/ο|ό/gi,"(ο|ό)");
	s = s.replace(/υ|ύ|ϋ|ΰ/gi,"(υ|ύ|ϋ|ΰ)");
    s = s.replace(/ω|ώ/gi,"(ω|ώ)");
    s = s.replace(/σ|ς/gi,"(σ|ς)");
    s = s.replace(/\s+/gi,"(\\s+)");

	return s;
}
function eWick_simplifyToString(s) {
	/*	arChars["a"]="α";arChars["b"]="β";arChars["e"]="ε";arChars["h"]="η";arChars["i"]="ι";arChars["k"]="κ";arChars["m"]="μ";arChars["n"]="ν";arChars["o"]="ο";arChars["p"]="ρ";arChars["t"]="τ";arChars["x"]="χ";arChars["y"]="υ";arChars["z"]="ζ";*/
	if (!s) return "";
	s = s.replace(/α|ά/gi,"α");
    s = s.replace(/ε|έ/gi,"ε");
    s = s.replace(/η|ή/gi,"η");
    s = s.replace(/ι|ί|ϊ|ΐ/gi,"ι");
    s = s.replace(/ο|ό/gi,"ο");
    s = s.replace(/υ|ύ|ϋ|ΰ/gi,"υ");
    s = s.replace(/ω|ώ/gi,"ω");
	return s.replace(/^[\(\)]+/,'').replace(/\(\)]+$/,'');

}

function eWick_getUserInputBase(value) {
	try {
		s = eWick.inputBox.value;
	}
	catch(e) { return; }
	a = s;
	if ((lastComma = s.lastIndexOf(value)) != -1) {
		a = a.replace(value, '');
	}
	else{
		a = "";
	}
	return a;
}

/*start*/
function eWick_runMatchingLogic(responseText) {
	if(!eWick_isWickObject()) return;

	responseText = responseText.replace(/^\s+|\s+$/, '');
	if (responseText.replace(/^\s+|\s+$/, '') != "") arResults = responseText.split("\n");		    
	else											 arResults = new Array();

	eWick.matchCollection = new Array();
	var userInput = eWick_simplifyToRegExp(eWick.inputBox.value);
	if(eWick.searchFromStart == 1) {
		var regExpMatch = new RegExp("^([() \"'\>\<\-]*)("+userInput+")","i");
		var	regExpMark = new RegExp("^([() \"'\}\{\-]*)("+userInput+")","gi");		
	}
	else if(eWick.searchFromStart == 2){
		//TODO: search from start of each word
		alert("TODO: Search from start of each word");
	}
	else if(eWick.searchFromStart == 3) {	
		//TODO: something is wrong when string contains special chars ("'...)
		userInput = "([^α-ωΑ-Ωa-zA-ZάέήίϊΐόύϋΰώΆΈΉΊΪΌΎΫΏ0-9]*)("
			+userInput.replace("\(\\s\+\)", ")([^α-ωΑ-Ωa-zA-ZάέήίϊΐόύϋΰώΆΈΉΊΪΌΎΫΏ0-9]*)|([^α-ωΑ-Ωa-zA-ZάέήίϊΐόύϋΰώΆΈΉΊΪΌΎΫΏ0-9]*)(")
			+")([^α-ωΑ-Ωa-zA-ZάέήίϊΐόύϋΰώΆΈΉΊΪΌΎΫΏ0-9]*)";
		var	regExpMark = new RegExp("([() \"'\}\{\-]*)("+userInput+")","gi");
		var regExpMatch = new RegExp("([() \"'\>\<\-]*)("+userInput+")","gi");
	}
	for (i=0,j=0;(i<arResults.length);i++) {
		if (!eWick.clientFilter) {
			eWick.matchCollection[j++] = new eWick_smartInputMatch(arResults[i], arResults[i].replace(regExpMark, "$1<span class='eWick_matchingChar'>$2</span>"));
		}
		else if (arResults[i].match(regExpMatch) && eWick.clientFilter) {
			eWick.matchCollection[j++] = new eWick_smartInputMatch(arResults[i], arResults[i].replace(regExpMark, "$1<span class='eWick_matchingChar'>$2</span>"));
		}
	}

	if (eWick.matchCollection && (eWick.matchCollection.length > 0)) 
		eWick_selectSmartInputMatchItem(0);
	content = eWick_getSmartInputBoxContent();

	if (content) {
		eWick_modifySmartInputBoxContent(content);
		eWick_showSmartInputFloater();
	} 
	else {
		//if (eWick.inputBox.value != "") {
		//	eWick_modifySmartInputBoxContent('<span class="eWick_NoMatch">Δεν βρέθηκαν αποτελέσματα</span>');
		//	eWick_showSmartInputFloater();		    
		//}
		//else{
			eWick_hideSmartInputFloater();
		//}
	}
}

function eWick_activateCurrentSmartInputMatch() {
	if ((selIndex = eWick_getCurrentlySelectedSmartInputItem()) != null) {
		baseValue = eWick_getUserInputBase(eWick.matchCollection[selIndex].value);
		addedValue = eWick.matchCollection[selIndex].cleanValue;
		theString = (baseValue ? baseValue : "") + addedValue;
		eWick.inputBox.value = theString.replace(/^\s+|\s+$/, '');
		eWick_setCaretToEnd();
	}
}


function eWick_retrieveData(userInput) {
	try{
		window.clearTimeout(eWick.iKeyPressTimeout);
	}
	catch(e){};
	eWick.iKeyPressTimeout = window.setTimeout("eWick_retrieveData2('"+eWick_RemoveBadChars(userInput, true)+"')", 200);
}
function eWick_retrieveData2(userInput) {

	if (!eWick_isWickObject()) {
	    return;
	}

	eWick.oCB.method = "post";
	eWick.oCB.AbortAll();
	eWick.oCB.OnLoading = eWick_showFloaterWait;
	eWick.oCB.OnLoaded = eWick_hideFloaterWait;
	eWick.oCB.OnComplete = eWick_runMatchingLogic;
	if (typeof eWick.arCallbackParams != "undefined") {
		for (i=0;i<eWick.arCallbackParams.length;i++) {
			if (typeof eWick.arCallbackParams[i] != "undefined") {
				eWick.oCB.AddParam(eWick.arCallbackParams[i][0], eWick.arCallbackParams[i][1]);			    
			}
		}	    
	}
	eWick.oCB.AddParam("userInput", userInput);
	eWick.oCB.AddParam("maxMatches", eWick.MAX_MATCHES);
	eWick.oCB.Post(eWick.callbackPage);    
}

function eWick_processSmartInput(inputBox) {
	if (!eWick_isWickObject()) 
		eWick = new eWickObject();

	eWick.inputBox = inputBox;

	try { classData = inputBox.className.split(" "); }
	catch(e) {return;}
	eWickDirectives = null;
	for (i=0;(!eWickDirectives && classData[i]);i++) {
		if (classData[i].indexOf("eWickEnabled") != -1)
			eWickDirectives = classData[i];
	}

	/*
	  eWickEnabled:CALLBACK PAGE:ID OF FLOATER:PARAMETERS FOR CALLBACK
	  e.g. 
	  class="eWickEnabled:callback.htm:customFloterID:page='search';results=10"
	  or with no custom floater
	  class="eWickEnabled:callback.htm::page='search';results=10"
	*/

	if (eWickDirectives) {
		/*eWickEnabled:ID OF FLOATER*/
		arDirectives = eWickDirectives.split(":");

		if (arDirectives[1] != "" && typeof arDirectives[1] != "undefined"){
			eWick.callbackPage = arDirectives[1];
		}
		else{
			var eCallback_pb_ex = new Error("Η σελίδα callback είναι υποχρεωτική (π.χ. eWickEnabled:callback.htm)");
			throw eCallback_pb_ex;
			return false;	
		}
		if (arDirectives.length >= 3){
			if (arDirectives[2] != "" ){
				eWick.customFloater = true;
				newFloaterId = arDirectives[2];
				eWick.floater = document.getElementById(newFloaterId);
				eWick.floaterContent = eWick.floater.getElementsByTagName("div")[0];
			}
		}
		if (arDirectives.length == 4){
			if (arDirectives[3] != "" ){
				arParams = arDirectives[3].split(";");
				eWick.arCallbackParams = new Array();
				for (i=0;i<arParams.length;i++) {
					arParam = arParams[i].split("=");
					eWick.arCallbackParams[i] = new Array();
					eWick.arCallbackParams[i][0] = arParam[0];
					eWick.arCallbackParams[i][1] = arParam[1];
				}
			}
		}
	
	}

	/*if userinput not blank and is meaningful*/
	userInput = eWick_RemoveBadChars(eWick.inputBox.value, true);
	if (userInput && (userInput != "") && (userInput != '"')) {
		eWick_retrieveData(userInput);
	}
	else {
		eWick.matchCollection = null;
		eWick_hideSmartInputFloater();
	}
}

/*end*/
function eWick_getSmartInputBoxContent() {
	a = null;
	if (eWick_isWickObject() && eWick.matchCollection && (eWick.matchCollection.length > 0)) {
		a = '';
		for (i = 0;i < eWick.matchCollection.length; i++) {
			selectedString = eWick.matchCollection[i].isSelected ? ' eWick_selectedSmartInputItem' : '';
			a += '<p class="eWick_matchedSmartInputItem' + selectedString + '">' + eWick.matchCollection[i].value.replace(/\{ */gi,"&lt;").replace(/\} */gi,"&gt;") + '</p>';
		}
	}
	return a;
}

function eWick_modifySmartInputBoxContent(content) {
	eWick.floaterContent.innerHTML = '<div id="eWick_smartInputResults">' + content +'</div>';
	eWick_resizeSmartInputIframe();
	eWick.matchListDisplay = document.getElementById("eWick_smartInputResults");
}

function eWick_selectFromMouseOver(o) {
	currentIndex = eWick_getCurrentlySelectedSmartInputItem();
	if (currentIndex != null) 
		eWick_deSelectSmartInputMatchItem(currentIndex);
	newIndex = eWick_getIndexFromElement(o);
	eWick_selectSmartInputMatchItem(newIndex);
	eWick_modifySmartInputBoxContent(eWick_getSmartInputBoxContent());
}

function eWick_selectFromMouseClick() {
	eWick_activateCurrentSmartInputMatch();
	eWick.inputBox.focus();
	eWick_hideSmartInputFloater();
}

function eWick_getIndexFromElement(o) {
	index = 0;
	while(o = o.previousSibling) {
		index++;
	}
	return index;
}

function eWick_getCurrentlySelectedSmartInputItem() {
	answer = null;
	if(typeof(eWick.matchCollection) != 'undefined' && typeof(eWick.matchCollection.length) != 'undefined') {
	for (i = 0; ((i < eWick.matchCollection.length) && !answer) ; i++) {
		if (eWick.matchCollection[i].isSelected)
			answer = i;
		}
	}
	return answer;
}

function eWick_selectSmartInputMatchItem(index) {
	if(typeof(eWick.matchCollection[index]) != 'undefined') 
	eWick.matchCollection[index].isSelected = true;
}

function eWick_deSelectSmartInputMatchItem(index) {
	eWick.matchCollection[index].isSelected = false;
}

function eWick_selectNextSmartInputMatchItem() {
	currentIndex = eWick_getCurrentlySelectedSmartInputItem();
	if (currentIndex != null) {
		eWick_deSelectSmartInputMatchItem(currentIndex);
		if ((currentIndex + 1) < eWick.matchCollection.length)
			eWick_selectSmartInputMatchItem(currentIndex + 1);
		else
			eWick_selectSmartInputMatchItem(0);
	} 
	else {
		eWick_selectSmartInputMatchItem(0);
	}
	eWick_modifySmartInputBoxContent(eWick_getSmartInputBoxContent());
}

function eWick_selectPreviousSmartInputMatchItem() {
	currentIndex = eWick_getCurrentlySelectedSmartInputItem();
	if (currentIndex != null) {
		eWick_deSelectSmartInputMatchItem(currentIndex);
		if ((currentIndex - 1) >= 0)
			eWick_selectSmartInputMatchItem(currentIndex - 1);
		else
			eWick_selectSmartInputMatchItem(eWick.matchCollection.length - 1);
	} 
	else {
		eWick_selectSmartInputMatchItem(eWick.matchCollection.length - 1);
	}
	eWick_modifySmartInputBoxContent(eWick_getSmartInputBoxContent());
}


function eWick_setCaretToEnd() {
	if (eWick.inputBox.createTextRange) {
		var v = eWick.inputBox.value;
		var r = eWick.inputBox.createTextRange();
		r.moveStart('character', v.length);
		r.select();
	}
}

function eWick_showFloaterWait() {
	x = eWick_findElementPosX(eWick.inputBox) - 19;
	y = eWick_findElementPosY(eWick.inputBox);
	eWick.floaterWait.style.left = x;
	eWick.floaterWait.style.top = y;
	eWick.floaterWait.style.display="block";
	eWick.floaterWait.style.visibility="visible";
}
function eWick_hideFloaterWait() {
	if (eWick_isWickObject()) {
		eWick.floaterWait.style.display="none";
		eWick.floaterWait.style.visibility="hidden";
	}
}

function eWick_registerSmartInputListeners() {

	inputs = document.getElementsByTagName("input");
	texts = document.getElementsByTagName("textarea");
	allinputs = new Array();
	z = 0;
	y = 0;
	while(inputs[z]) {
		allinputs[z] = inputs[z];
		z++;
	}
	while(texts[y]) {
		allinputs[z] = texts[y];
		z++;
		y++;
	}

	for (i=0; i < allinputs.length;i++) {
		if ((c = allinputs[i].className) && (c.indexOf("eWickEnabled") > -1)) {
			allinputs[i].setAttribute("autocomplete","OFF");
			allinputs[i].onfocus = eWick_handleFocus;
			allinputs[i].onblur = eWick_handleBlur;
			allinputs[i].onkeydown = eWick_handleKeyDown;
			allinputs[i].onkeyup = eWick_handleKeyPress;
		}
	}
}

function eWick_resizeSmartInputIframe() { /* to adjust iframe*/
	/*hack: for some reason IE sometimes doesn't see the CSS z-index*/
	if (eWick.floater.style.zIndex <= 0) eWick.floater.style.zIndex = 3;
	/*show Iframe, which can float over SELECTs, but below floater, so they both go on top of SELECT elements in IE*/
	eWick.floaterIframe.style.width = eWick.floater.offsetWidth;
	eWick.floaterIframe.style.height = eWick.floater.offsetHeight;
	eWick.floaterIframe.style.top = eWick.floater.style.top;
	eWick.floaterIframe.style.left = eWick.floater.style.left;
	eWick.floaterIframe.style.zIndex = eWick.floater.style.zIndex - 2;
	eWick_hideBadElement('SELECT', eWick.floater);
}


/*eWick Object*/
function eWickObject () {
	this.clientFilter = false;
	this.customFloater = false;
	this.floater = document.getElementById("eWick_smartInputFloater");
	this.floaterContent = document.getElementById("eWick_smartInputFloaterContent");
	this.selectedSmartInputItem = null;
	this.MAX_MATCHES = 15;
	this.isGecko = (navigator.userAgent.indexOf("Gecko/200") != -1);
	this.isSafari = (navigator.userAgent.indexOf("Safari") != -1);
	this.isWinIE = ((navigator.userAgent.indexOf("Win") != -1 ) && (navigator.userAgent.indexOf("MSIE") != -1 ));
	this.floaterIframe = document.getElementById("eWick_smartInputFloaterIframe");
	this.floaterWait = document.getElementById("eWick_smartInputFloaterWait");
	this.arCallbackParams = new Array();
	this.callbackPage = "";
	this.iKeyPressTimeout = -1;
	this.searchFromStart = 3; //1:start of phrase, 2:start of word, 3:anywhere
	try{
		this.oCB = new eCallback();
	}
	catch(e){
		var eCallback_pb_ex = new Error("Δεν υπάρχει το αντικείμενο eCallback");
		throw eCallback_pb_ex;
		return false;
	}
	this.oCB.bypassCache = false;
}
function eWick_isWickObject() {
    return (typeof(eWick) != "undefined" && eWick != null)
}
var eWick = null;

if (document.addEventListener) {
	document.addEventListener("keydown", eWick_handleKeyDown, false);
	document.addEventListener("keyup", eWick_handleKeyPress, false);
	document.addEventListener("click", eWick_handleClick, false);
	document.addEventListener("mouseover", eWick_handleMouseOver, false);
	window.addEventListener("onload", eWick_registerSmartInputListeners, false);
} 
else {
	document.onkeydown = eWick_handleKeyDown;
	document.onkeyup = eWick_handleKeyPress;
	document.onmouseup = eWick_handleClick;
	document.onmouseover = eWick_handleMouseOver;
	//Keep other onload methods

	if(typeof window.onload=='function'){
		this.on=onload;
		window.onload=function(){
			eWick_registerSmartInputListeners();
			this.on();
		};
	}
	else{
		window.onload=function(){
			eWick_registerSmartInputListeners();
		};
	}
}


collectionIndex = new Array();

document.write (
'<table id="eWick_smartInputFloater" class="eWick_Floater" cellpadding="0" cellspacing="0"><tr><td id="eWick_smartInputFloaterContent" nowrap="nowrap">'
+'<\/td><\/tr><\/table>' + '<iframe id="eWick_smartInputFloaterIframe" class="eWick_Floater" name="eWick_smartInputFloaterIframeName" src="about:blank" scrolling="no" frameborder="0"></iframe>' +
'<div class="eWick_Floater" id="eWick_smartInputFloaterWait"><img src="../images/eWick_Wait.gif"></div>'
);


function eWick_hideBadElement( elmID, overDiv ) {
	if( document.all ){
		for( i = 0; i < document.all.tags( elmID ).length; i++ ){
			obj = document.all.tags( elmID )[i];	

			if( !obj || !obj.offsetParent ){
				continue;
			}
			 // Find the element's offsetTop and offsetLeft relative to the BODY tag.
			objLeft = obj.offsetLeft;
			objTop = obj.offsetTop;
			objParent = obj.offsetParent;

			while( objParent.tagName.toUpperCase() != "BODY" ){
				objLeft += objParent.offsetLeft;
				objTop += objParent.offsetTop;
				objParent = objParent.offsetParent;
			}
		
			objHeight = obj.offsetHeight;
			objWidth = obj.offsetWidth;

			if(( overDiv.offsetLeft + overDiv.offsetWidth ) <= objLeft );
			else if(( overDiv.offsetTop + overDiv.offsetHeight ) <= objTop );
			else if( overDiv.offsetTop >= ( objTop + objHeight ));
			else if( overDiv.offsetLeft >= ( objLeft + objWidth ));
			else{
				obj.style.visibility = "hidden";
			}
		}
	}
}
 
function eWick_showBadElement( elmID ){
	if( document.all ){
		for( i = 0; i < document.all.tags( elmID ).length; i++ ){
			obj = document.all.tags( elmID )[i];
			if( !obj || !obj.offsetParent ){
				continue;
			}
				obj.style.visibility = "";
		}
	}
}
