HowTo use JavaScript to read in external file and assign datastream to variable for use with other functions


The jQuery.get works as expected and well documented to push the stream to target divElement.

GOAL :: Does anyone know a way to populate the open 'data-read' stream
NOT into an divElement but INTO a <$variable> for other functions to use the passed-in data ?

in other words : How can I use JavaScript to read in external file and assign the data-stream to a local session variable for use with other funtions during the Client side experience...

thanks so much

note: I cannot default to using a scripting language like PHP or ASP I need another workaround...




...
<script language="JavaScript">
//GOAL :: I want to load the contents into a variable as a sting
//jQuery.get( url, [ data ], [ success(data, textStatus, jqXHR) ], [ dataType ] )
// ref. http://api.jquery.com/jQuery.get
	
jQuery.get('myTextFile.log', function(data) {
//Alert the results from requesting file
alert(data);

//the following line will insert the var data (raw log) in the divElement
$('#readMyFile').html(data)
});	
</script>
...
<div id="readMyFile"></script>
...

Open in new window

JAaron AndersonProgramming Architect @ Widener UniversityAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
ProculopsisConnect With a Mentor Commented:

Do you mean something like this, where variable theText is accessible to the rest of the dom:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q__26822624.html</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">

var theText;

jQuery(document).ready( function () {

  $.get( "http://www.whatcar.com/Valuation/SelectMake?makeId=4708", getContent );

});

function getContent( data, sstatus, response ) {
  theText = response.responseText;
}

</script>

<style>
#dynamic-content { width: 640px; height: 400px; border: 1px dotted #f00; margin-left: auto; margin-right: auto; overflow: auto; background-color: beige; }
</style>

</head>
<body>

<input id="click-me" onclick="getElementById('dynamic-content').innerText=theText;" value="Click Me!" type="button" />

<div id="dynamic-content"></div>

</body>
</html>

Open in new window

0
 
leakim971PluritechnicianCommented:
Use an synchronous ajax call : $.ajax({"url":"myTextFile.log","async":false}).responseText
<script language="JavaScript">
var myString; // a global var to share it with all your function
...
myString = $.ajax({"url":"myTextFile.log","async":false}).responseText;
...
// I'm not sure you still want the following :
//alert(myString);
//$('#readMyFile').html(myString)
</script>
...
<div id="readMyFile"></script>
...

Open in new window

0
 
JAaron AndersonProgramming Architect @ Widener UniversityAuthor Commented:

@Proculopsis  I copied the script as you have it and its Not working :(  



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q__26822624.html</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">

var theText;

jQuery(document).ready( function () {

  $.get( "test.log", getContent ); // the only thing I change is the file name making sure it reside aside this .htm document

});

function getContent( data, sstatus, response ) {
  theText = response.responseText;
}

</script>

<style>
#dynamic-content { width: 640px; height: 400px; border: 1px dotted #f00; margin-left: auto; margin-right: auto; overflow: auto; background-color: beige; }
</style>

</head>
<body>

<input id="click-me" onclick="getElementById('dynamic-content').innerText=theText;" value="Click Me!" type="button" />

<div id="dynamic-content"></div>

</body>
</html>

Open in new window

0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
JAaron AndersonProgramming Architect @ Widener UniversityAuthor Commented:
ok I pullled everything out of my code working JUST with this... I renamed my log file to myTextFile.log and I still get nothing in FireFox works in IE ONLY !!! agggh!

@leakim97 not working... (course I did correct closing </div> at end of sample code)
validator says theres a syntax error with  ::

myString = $.ajax({"url":"myTextFile.log","async":false}).responseText;
0
 
ProculopsisCommented:

Try a fully qualified url in the $.get() call instead:

   http://127.0.0.1/virtual_directory/test.log

0
 
leakim971PluritechnicianCommented:
Work for me :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript" type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script language="javascript" type="text/javascript">
	var myString; // a global var to share it with all your function
    $(document).ready(function () {
		$("input").click(function() {
			myString = $.ajax({"url":"myTextFile.log","async":false}).responseText;
			showIt();
		});
	});
	function showIt() {
		$("#readMyFile").html(myString.replace(/\n/g,"<br />"));
	}
</script>
</head>
<body>
<input type="button" value="click" /><br />
<div id="readMyFile"></div>
</body>
</html>

Open in new window

leakim971-409887.flv
0
 
JAaron AndersonProgramming Architect @ Widener UniversityAuthor Commented:
ok works now .. not sure why no matter...
... moving forward...

my log file is formatted like so '...','...','...'

it comes into the stream fine for the click event but how can I populate an array with each line break result from line 16 (above)

now I need my stream to be slit into cells of an array...
myString.split(/','/);
0
 
leakim971PluritechnicianCommented:
myArray = myString.split(","); // if you don't worry about simple quote
0
 
JAaron AndersonProgramming Architect @ Widener UniversityAuthor Commented:
I need to take the "onclick event" out of the equation on your examples
I need to streamline it to populate the Array scraping the external file and return the results of the Array .. you can check the streamed value is neccessary as you step thru it...

but most importantly I cannot seem to populate the array
I can verify the stream is read by the onclick event but
I cannot verify the passing of that value into the array for use with
body onload function... thx
0
 
leakim971PluritechnicianCommented:
live link please :)
0
 
JAaron AndersonProgramming Architect @ Widener UniversityAuthor Commented:
psuedo code is this :

1. onload

at client request of page read in the external value

2. return and populate

populate the external string into an array(split by /,/)

3. read variable

make the array available to be read by other function/methods
0
 
leakim971PluritechnicianCommented:
1 :    
$(document).ready(function () {
			myString = $.ajax({"url":"myTextFile.log","async":false}).responseText;

Open in new window

2 :
	var myString, myArray; // a global var to share it with all your function

Open in new window


3:
		myArray = myString.split(",");

Open in new window


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript" type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script language="javascript" type="text/javascript">
	var myString, myArray; // a global var to share it with all your function
    $(document).ready(function () {
			myString = $.ajax({"url":"myTextFile.log","async":false}).responseText;
			showIt();
	});
	function showIt() {
		myArray = myString.split(",");
alert("myArray have : " + myArray.length + " elements");
	}
</script>
</head>
<body>
</body>
</html>

Open in new window

0
 
JAaron AndersonProgramming Architect @ Widener UniversityAuthor Commented:
postid_34898869 Proof of concept cant get to work right :
http://www.widener.edu/webdev/expertexchange/Q_26822624/postid_34898869.htm
.. but this doesnt matter to figure out...
..................................................................................................................................
... this works in IE at least here in form Im working on ...
http://www.widener.edu/webdev/expertexchange/Q_26822624/index.htm
now I just need the external file values to be populated into the array WUindex[]
cannot get the logic/syntax to work for line 22
in order to function for line 3358

thanks leakim971...this makes sense right ?...
0
 
JAaron AndersonProgramming Architect @ Widener UniversityAuthor Commented:
I learned my server does NOT allow .log files for some reason so I changed to reading .txt
0
 
JAaron AndersonProgramming Architect @ Widener UniversityAuthor Commented:
could it be a (this.value) prinicple of the WUindex variable ?
0
 
JAaron AndersonProgramming Architect @ Widener UniversityAuthor Commented:
could it be a (this.value) principle of the WUArray variable ? I mean ...
0
 
JAaron AndersonProgramming Architect @ Widener UniversityAuthor Commented:
maybe I need to incorporate an addeventListener() ?
0
 
JAaron AndersonProgramming Architect @ Widener UniversityAuthor Commented:
guess I cannot introduce an addEventListener because I learned its not IE supported... the read-in file script already doesnt work with firefox so I can't worry about cross compatibility must stay with IE supported DOM methods
0
 
JAaron AndersonProgramming Architect @ Widener UniversityAuthor Commented:
when I try to output to the screen
document.writeln(WUArray[1]); // Will output: the second record it gives me undefined...
0
 
leakim971PluritechnicianCommented:
I tried to download your file directly with the browser : http://www.widener.edu/webdev/expertexchange/Q_26822624/myTextFile.txt
I get a 404 error (file not found)
0
 
ProculopsisCommented:

Here's a slightly modified version of my original post, is this the sort of thing you are looking for:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>http://www.experts-exchange.com/Programming/Languages/Scripting/AJAX/Q_26822624.html</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">

var theData;

jQuery(document).ready( function () {

  $.get( "http://www.widener.edu/webdev/expertexchange/Q_26822624/university.txt", getContent );
  $("#click-me").click( display );

});

function getContent( data, status, response ) {
  theData = response.responseText.split( /,/ );
}

function display() {
  $("#dynamic-content")
  .empty()
  .append( "var theData = " )
  .append( JSON.stringify( theData ) );
}

</script>

<style>
#dynamic-content { width: 640px; height: 400px; border: 1px dotted #f00; margin-left: auto; margin-right: auto; overflow: auto; background-color: beige; }
</style>

</head>
<body>

<input id="click-me" value="Click Me!" type="button" />

<div id="dynamic-content"></div>

</body>
</html>

Open in new window

0
 
JAaron AndersonProgramming Architect @ Widener UniversityAuthor Commented:
@Proculopsis thanks man but that only does a part. what I also need is Im struggling to get the value read in from the stream to also be populated in an array ... split isnt seeming to work ...

>>I tried to download your file directly with the browser :
@leakim971 surprised not getting that halted studying the code...
you could reference that file from any where http://absolute path ...
what it was is that I learned myTextFile.log cannot be used via IIS default I had to just now make it a .txt file changing the extension


thanks guys for looking into this more...
Im just struggling trying to get that array 'WUArray' 's cells populated I just have it returning 'undefined' :(

thanks again
0
 
JAaron AndersonProgramming Architect @ Widener UniversityAuthor Commented:
@Proculopsis I know
http://www.widener.edu/webdev/expertexchange/Q_26822624/postid_34904200.htm
 "shows" the results as ["cells"]  but when I implement in my solution to read from the array it is again undefined...

http://www.widener.edu/webdev/expertexchange/Q_26822624/index3.htm
(clicking the University lookup button doesnt work) not just a "display test"
can you help me figure out why I cant harness the values in the Array
I am trying to do that on line2842
like I can do if I just hardcode in cell values like in lines 87-90
var EXindex=new Array('#Exton','#test','#inline','#hardcoded');// type E to test
var DEindex=new Array('#Delaware','#test','#inline','#hardcoded');// type D to test
var CHindex=new Array('#Chester','#test','#inline','#hardcoded'); // type C to test
var HBindex=new Array('#Harrisburg','#test','#inline','#hardcoded');// type H to test
thanks for all your guys' help were close...
0
 
JAaron AndersonProgramming Architect @ Widener UniversityAuthor Commented:
maybe another way to word what Im trying to do is look at line 2885 of
http://www.widener.edu/webdev/expertexchange/Q_26822624/index3.htm

Since:
line 2895 : works CHSearchbase(document.getElementById("qCH"),CHindex);
for line 89: var CHindex=new Array('#Chester','#test','#inline','#hardcoded'); // type C to test

why cant I get
line 2885 : WUSearchbase(document.getElementById("qWU"),WUArray);
to read for our programming we are scraping the array from the external file ?
should it be something more akin to :
WUSearchbase(document.getElementById("qWU"), JSON.stringify( WUArray ) );
?
thanks
0
 
leakim971Connect With a Mentor PluritechnicianCommented:
@jandersonwidener,

If WUArray is a json object you should modify WUSearchbase (or create WUSearchbaseJSON) to handle it.

>Im just struggling trying to get that array 'WUArray' 's cells populated I just have it returning 'undefined' :(

WUArray is an array or a table ? Please post here the part of the code where you're trying to do something with WUArray
0
 
JAaron AndersonProgramming Architect @ Widener UniversityAuthor Commented:
@leakim971
on http://www.widener.edu/webdev/expertexchange/Q_26822624/index3.htm
with this command line 2885 : WUSearchbase(document.getElementById("qWU"),WUArray);
I am trying to perform lines 250 thru line 755 against a populated WUArray[] just the same as...

I am w/command line 2895 : CHSearchbase(document.getElementById("qCH"),CHindex);
I am using the same working code to 'drive' the hard-coded array CHindex[] lines 760 thru 1266

as I am also w/command line 2904 : HBSearchbase(document.getElementById("HB"),HBindex);
I am using the same working code to 'drive' the hard-coded array HBindex[] lines 1271 thru 1775

as I am also w/command line 2912 : EXSearchbase(document.getElementById("qEX"),EXindex);
I am using the same working code to 'drive' the hard-coded array EXindex[] lines 1780 thru 2284

as I am also w/command line 2921 : DESearchbase(document.getElementById("qDE"),DEindex);
I am using the same working code to 'drive' the hard-coded array DEindex[] lines 2289 thru 2793
see lines 87 thru 90 for population of these hard-coded arrays...
0
 
JAaron AndersonProgramming Architect @ Widener UniversityAuthor Commented:
WUArray is an array or a table ? It is suppose to be an array
what a 'table' is more like a hashmap ?
I want to mimic and populate hardcoded cells w/ values like in lines 87-90
var EXindex=new Array('#Exton','#test','#inline','#hardcoded');// type E to test
var DEindex=new Array('#Delaware','#test','#inline','#hardcoded');// type D to test
var CHindex=new Array('#Chester','#test','#inline','#hardcoded'); // type C to test
var HBindex=new Array('#Harrisburg','#test','#inline','#hardcoded');// type H to test

I am trying to get to populate the WUArray from the external file university.txt
...split same format, able to be handled by other functions the same way EXindex, DEindex, CHindex, & HBindex can be just no matter what I do it comes back to me undefined... :(

does that make sense ?
0
 
leakim971PluritechnicianCommented:
Ok, please put the "debugger" keyword before the line 2885 so like this :




debugger;
WUSearchbase(document.getElementById("qWU"),WUArray);

Open in new window

0
 
JAaron AndersonProgramming Architect @ Widener UniversityAuthor Commented:
ok I put 'debugger;' in line 2884 ...
http://www.widener.edu/webdev/expertexchange/Q_26822624/index3.htm

whats debugger do ?
0
 
leakim971Connect With a Mentor PluritechnicianCommented:
We can see WUArray is null :

Clipboard03.jpg
Clipboard04.jpg
0
 
JAaron AndersonProgramming Architect @ Widener UniversityAuthor Commented:
@leakim971
ok clipboard 04 is me trying to printout the Array but its still undefined.
thanks for showing me this but its all null Im needing to figure out how to NOT have WUArray undefined.

you mentioned earlier post ID:34909352
>>If WUArray is a json object you should modify WUSearchbase (or create WUSearchbaseJSON) to handle it
should I make it one ? all thats new to me...  thoughts on that ?

Im looking to fix how to make the Array NOT undefined how do we remedy ?
thx
0
 
JAaron AndersonProgramming Architect @ Widener UniversityAuthor Commented:
took
<script language="javascript">
//document.writeln(WUArray[1]); // Will output: one
document.writeln('Array info here:');
var printArray = function (x, idx) {   document.writeln('['+idx+'] = '+x);}
WUArray.forEach(printArray); // outputs: [0] = 1 [1] = two [2] = 3 [3] = four [4] = 5
</script>
out...
0
 
leakim971Connect With a Mentor PluritechnicianCommented:
>Im looking to fix how to make the Array NOT undefined how do we remedy ?

Please show me where you populate it. Confirm it's a global variable.

You put your script inside the page. It's not safe, try to put all your function in the same file or inside the same tag when it's possible
0
 
JAaron AndersonProgramming Architect @ Widener UniversityAuthor Commented:
>>function in the same file
it is

>>or inside the same tag
not sure what tag is... does it mean
<script type="text/javascript"> ???


>>Please show me where you populate it.
isnt it http://www.widener.edu/webdev/expertexchange/Q_26822624/index3.htm :: line 49?
function getContent( data, status, response ) {
  WUArray = response.responseText.split( /,/ );
}
?? doesnt that perform the same as line 87 :: var EXindex=new Array('#Exton','#test','#inline','#hardcoded'); ??

>>Confirm it's a global variable.
Im going to try to learn how to be sure it is any suggestion how to confirm this ?



0
 
leakim971PluritechnicianCommented:
>it is
>:o(

>not sure what tag is... does it mean  <script type="text/javascript"> ???
Yes

>>Please show me where you populate it.
OK. What about my code in my first post ?
jQuery(document).ready( function () {
  WUArray =  $.ajax({"url":"http://www.widener.edu/webdev/expertexchange/Q_26822624/university.txt","async":false}).responseText;
  alert(WUArray); // please post what you get with this
  WUArray =  WUArray.split(",")
  $("#click-me").click( display );
});

>>Confirm it's a global variable.
It is declared as global line 40, don't worry :) !!!

var WUArray;

jQuery(document).ready( function () {

Open in new window



0
 
JAaron AndersonProgramming Architect @ Widener UniversityAuthor Commented:
ok Im putting all methods/ functions in same tag...

//// @ Author:leakim971  Ive been toggling testing between this and @Proculopsis suggestions
///////////////////////////////////////////////////////////////////////////////////////////
jQuery(document).ready( function () {
  WUArray =  $.ajax({"url":"http://www.widener.edu/webdev/expertexchange/Q_26822624/university.txt","async":false}).responseText;
  alert(WUArray); // please post what you get with this
  WUArray =  WUArray.split(",")
  $("#click-me").click( display );
////////////////////////////////////////////////////////////////////////////////////////////
});/// NOTE THIS jQuery DOES NOT seem to work in IE but in FFX it does...
/// see http://www.widener.edu/webdev/expertexchange/Q_26822624/index3.htm
///////////////////////////////////////////////////////////////////////////////////////////
0
 
JAaron AndersonProgramming Architect @ Widener UniversityAuthor Commented:
//should I read it in as a string first as earlier suggested then populate a Array?
var theUniversityIndex = ""; // a new String
var WUArray; // global Array variable

theUniversityIndex = $.ajax({"url":"university.txt","async":false}).responseText;
//THEN split to an array ...
 WUArray =  theUniversityPhoneIndex.split(",")
// or straight to an array as last post suggests WUArray =  WUArray.split(",") ??????????
0
 
leakim971PluritechnicianCommented:
I still see the previous one
0
 
JAaron AndersonProgramming Architect @ Widener UniversityAuthor Commented:
I see I cannot nest all code in the same tag - to boil things down the quintessential question here is...

// for javascript programming in
http://www.widener.edu/webdev/expertexchange/Q_26822624/index3.htm

// why  
this.WUSearchbase_keywords = ca; //line 239

//  for the method
function WUSearchbase(obj,ca){   //line 199

// is NOT populating with the values in array cells :
WUArray = response.responseText.split( /,/ ); //line 19


thanks
0
 
leakim971PluritechnicianCommented:
Please put a debugger keyword line 19, like this :


function getContent( data, status, response ) {
  debugger;
  WUArray = response.responseText.split( /,/ );

}

Open in new window

0
 
JAaron AndersonProgramming Architect @ Widener UniversityAuthor Commented:
I put in 'debugger' but that doesnt seem to do anything ?...

your statement having me nest all javascript in same tag got me thinking...

Im wondering if I should pursue more of a JSON object so I may be able to pass the array between functions sort of like
http://www.widener.edu/webdev/expertexchange/Q_26822624/index5.htm  is doing in code where Id nest all functions in one BIG this.load function ....

what do you guys think ?

0
 
leakim971PluritechnicianCommented:
>I put in 'debugger' but that doesnt seem to do anything ?...

What's url of the page ?
0
 
JAaron AndersonProgramming Architect @ Widener UniversityAuthor Commented:
0
 
JAaron AndersonProgramming Architect @ Widener UniversityAuthor Commented:
ok I think weve gone round and round with no solution so far looking at external webpages so I figured Id send the working code with hardcoded arrays inline for the ticket ...

this code is found online at
http://www.widener.edu/webdev/expertexchange/Q_26822624/test.htm

this line ::.
MYSearchbase(document.getElementById("qLookup"),MYArray); // is the key to array population

works hardcoded.... doesnt work dynamicly read in...

thoughts on Array DOM scope ?
thanks
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Hardcoded Phone Directory Lookup</title>
<script language="javascript" type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script type="text/javascript">
//////////////////////////////////////////////////////////////////
//////////// Index Array Handling Methods
//////////////////////////////////////////////////////////////////
// Hard coded Arrays all work below 
////////////////////////////////////////////////////////
var MYArray=new Array('#MYArray','#hardcoded test','#inline','#hardcoded');
// type 'E' in textfield 'qLookup' to test

//////////////////////////////////////////////////////////////////
//////////// Index Intelitext Drop Down
//////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////
// common searchbase functions
////////////////////////////////////////////////////////
function addEvent(obj,event_name,func_name){
	if (obj.attachEvent){
		obj.attachEvent("on"+event_name, func_name);
	}else if(obj.addEventListener){
		obj.addEventListener(event_name,func_name,true);
	}else{
		obj["on"+event_name] = func_name;
	}
}

function removeEvent(obj,event_name,func_name){
	if (obj.detachEvent){
		obj.detachEvent("on"+event_name,func_name);
	}else if(obj.removeEventListener){
		obj.removeEventListener(event_name,func_name,true);
	}else{
		obj["on"+event_name] = null;
	}
}
function stopEvent(evt){
	evt || window.event;
	if (evt.stopPropagation){
		evt.stopPropagation();
		evt.preventDefault();
	}else if(typeof evt.cancelBubble != "undefined"){
		evt.cancelBubble = true;
		evt.returnValue = false;
	}
	return false;
}
function getElement(evt){
	if (window.event){
		return window.event.srcElement;
	}else{
		return evt.currentTarget;
	}
}
function getTargetElement(evt){
	if (window.event){
		return window.event.srcElement;
	}else{
		return evt.target;
	}
}
function stopSelect(obj){
	if (typeof obj.onselectstart != 'undefined'){
		addEvent(obj,"selectstart",function(){ return false;});
	}
}
function getCaretEnd(obj){
	if(typeof obj.selectionEnd != "undefined"){
		return obj.selectionEnd;
	}else if(document.selection&&document.selection.createRange){
		var M=document.selection.createRange();
		try{
			var Lp = M.duplicate();
			Lp.moveToElementText(obj);
		}catch(e){
			var Lp=obj.createTextRange();
		}
		Lp.setEndPoint("EndToEnd",M);
		var rb=Lp.text.length;
		if(rb>obj.value.length){
			return -1;
		}
		return rb;
	}
}
function getCaretStart(obj){
	if(typeof obj.selectionStart != "undefined"){
		return obj.selectionStart;
	}else if(document.selection&&document.selection.createRange){
		var M=document.selection.createRange();
		try{
			var Lp = M.duplicate();
			Lp.moveToElementText(obj);
		}catch(e){
			var Lp=obj.createTextRange();
		}
		Lp.setEndPoint("EndToStart",M);
		var rb=Lp.text.length;
		if(rb>obj.value.length){
			return -1;
		}
		return rb;
	}
}
function setCaret(obj,l){
	obj.focus();
	if (obj.setSelectionRange){
		obj.setSelectionRange(l,l);
	}else if(obj.createTextRange){
		m = obj.createTextRange();		
		m.moveStart('character',l);
		m.collapse();
		m.select();
	}
}
function setSelection(obj,s,e){
	obj.focus();
	if (obj.setSelectionRange){
		obj.setSelectionRange(s,e);
	}else if(obj.createTextRange){
		m = obj.createTextRange();		
		m.moveStart('character',s);
		m.moveEnd('character',e);
		m.select();
	}
}
String.prototype.addslashes = function(){
	return this.replace(/(["\\\.\|\[\]\^\*\+\?\$\(\)])/g, '\\$1');
}
String.prototype.trim = function () {
    return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1");
};
function curTop(obj){
	toreturn = 0;
	while(obj){
		toreturn += obj.offsetTop;
		obj = obj.offsetParent;
	}
	return toreturn;
}
function curLeft(obj){
	toreturn = 0;
	while(obj){
		toreturn += obj.offsetLeft;
		obj = obj.offsetParent;
	}
	return toreturn;
}
function isNumber(a) {
    return typeof a == 'number' && isFinite(a);
}
function replaceHTML(obj,text){
	while(el = obj.childNodes[0]){
		obj.removeChild(el);
	};
	obj.appendChild(document.createTextNode(text));
}
////////////////////////////////////////////////////////
// this successfully populates inline arrays of text ',' delineated for each directory
////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////
///////////   MYSearchbase(document.getElementById("q"),WUArray);
/////////////////////////////////////////////////////////////////////////
function MYSearchbase(obj,ca){ // obj, ca
	/* ---- Public Variables ---- */
	this.MYSearchbase_timeOut = -1; // Autocomplete Timeout in ms (-1: autocomplete never time out)
	this.MYSearchbase_lim = 4;    // Number of elements autocomplete can show (-1: no limit)
	this.MYSearchbase_firstText = false; // should the auto complete be limited to the beginning of 

keyword?
	this.MYSearchbase_mouse = true; // Enable Mouse Support
	this.MYSearchbase_delimiter = new Array(';',',');  // Delimiter for multiple autocomplete. Set it to 

empty array for single autocomplete
	this.MYSearchbase_startcheck = 1; // Show widget only after this number of characters is typed in.
	/* ---- Public Variables ---- */

	/* --- Styles --- */
	this.MYSearchbase_bgColor = '#7bafde';
	this.MYSearchbase_textColor = '#FFFFFF';
	this.MYSearchbase_hColor = '#000000';
	this.MYSearchbase_fFamily = 'Verdana';
	this.MYSearchbase_fSize = '11px';
	this.MYSearchbase_hStyle = 'text-decoration:underline;font-weight="bold"';
	/* --- Styles --- */

	/* ---- Private Variables ---- */
	var MYSearchbase_delimwords = new Array();
	var MYSearchbase_cdelimword = 0;
	var MYSearchbase_delimchar = new Array();
	var MYSearchbase_display = false;
	var MYSearchbase_pos = 0;
	var MYSearchbase_total = 0;
	var MYSearchbase_curr = null;
	var MYSearchbase_rangeu = 0;
	var MYSearchbase_ranged = 0;
	var MYSearchbase_bool = new Array();
	var MYSearchbase_pre = 0;
	var MYSearchbase_toid;
	var MYSearchbase_tomake = false;
	var MYSearchbase_getpre = "";
	var MYSearchbase_mouse_on_list = 1;
	var MYSearchbase_kwcount = 0;
	var MYSearchbase_caretmove = false;
	this.MYSearchbase_keywords = new Array();
	/* ---- Private Variables---- */
	
	this.MYSearchbase_keywords = ca;
	//MAYBE TRY to FORCE the this.WUArray value HERE
	var MYSearchbase_self = this;

	MYSearchbase_curr = obj;
	
	addEvent(MYSearchbase_curr,"focus",MYSearchbase_setup);
	function MYSearchbase_setup(){
		addEvent(document,"keydown",MYSearchbase_checkkey);
		addEvent(MYSearchbase_curr,"blur",MYSearchbase_clear);
		addEvent(document,"keypress",MYSearchbase_keypress);
	}

	function MYSearchbase_clear(evt){
		if (!evt) evt = event;
		removeEvent(document,"keydown",MYSearchbase_checkkey);
		removeEvent(MYSearchbase_curr,"blur",MYSearchbase_clear);
		removeEvent(document,"keypress",MYSearchbase_keypress);
		MYSearchbase_removedisp();
	}
	function MYSearchbase_parse(n){
		if (MYSearchbase_self.MYSearchbase_delimiter.length > 0){
			var t = MYSearchbase_delimwords[MYSearchbase_cdelimword].trim().addslashes();
			var plen = MYSearchbase_delimwords[MYSearchbase_cdelimword].trim().length;
		}else{
			var t = MYSearchbase_curr.value.addslashes();
			var plen = MYSearchbase_curr.value.length;
		}
		var tobuild = '';
		var i;

		if (MYSearchbase_self.MYSearchbase_firstText){
			var re = new RegExp("^" + t, "i");
		}else{
			var re = new RegExp(t, "i");
		}
		var p = n.search(re);
				
		for (i=0;i<p;i++){
			tobuild += n.substr(i,1);
		}
		tobuild += "<font style='"+(MYSearchbase_self.MYSearchbase_hStyle)+"'>"
		for (i=p;i<plen+p;i++){
			tobuild += n.substr(i,1);
		}
		tobuild += "</font>";
			for (i=plen+p;i<n.length;i++){
			tobuild += n.substr(i,1);
		}
		return tobuild;
	}
	function MYSearchbase_generate(){
		if (document.getElementById('tat_table')){ MYSearchbase_display = 

false;document.body.removeChild(document.getElementById('tat_table')); } 
		if (MYSearchbase_kwcount == 0){
			MYSearchbase_display = false;
			return;
		}
		a = document.createElement('table');
		a.cellSpacing='1px';
		a.cellPadding='2px';
		a.style.position='absolute';
		a.style.top = eval(curTop(MYSearchbase_curr) + MYSearchbase_curr.offsetHeight) + "px";
		a.style.left = curLeft(MYSearchbase_curr) + "px";
		a.style.backgroundColor=MYSearchbase_self.MYSearchbase_bgColor;
		a.id = 'tat_table';
		document.body.appendChild(a);
		var i;
		var first = true;
		var j = 1;
		if (MYSearchbase_self.MYSearchbase_mouse){
			a.onmouseout = MYSearchbase_table_unfocus;
			a.onmouseover = MYSearchbase_table_focus;
		}
		var counter = 0;
		for (i=0;i<MYSearchbase_self.MYSearchbase_keywords.length;i++){
			if (MYSearchbase_bool[i]){
				counter++;
				r = a.insertRow(-1);
				if (first && !MYSearchbase_tomake){
					r.style.backgroundColor = MYSearchbase_self.MYSearchbase_hColor;
					first = false;
					MYSearchbase_pos = counter;
				}else if(MYSearchbase_pre == i){
					r.style.backgroundColor = MYSearchbase_self.MYSearchbase_hColor;
					first = false;
					MYSearchbase_pos = counter;
				}else{
					r.style.backgroundColor = MYSearchbase_self.MYSearchbase_bgColor;
				}
				r.id = 'tat_tr'+(j);
				c = r.insertCell(-1);
				c.style.color = MYSearchbase_self.MYSearchbase_textColor;
				c.style.fontFamily = MYSearchbase_self.MYSearchbase_fFamily;
				c.style.fontSize = MYSearchbase_self.MYSearchbase_fSize;
				c.innerHTML = MYSearchbase_parse(MYSearchbase_self.MYSearchbase_keywords[i]);
				c.id = 'tat_td'+(j);
				c.setAttribute('pos',j);
				if (MYSearchbase_self.MYSearchbase_mouse){
					c.style.cursor = 'pointer';
					c.onclick=MYSearchbase_mouseclick;
					c.onmouseover = MYSearchbase_table_highlight;
				}
				j++;
			}
			if (j - 1 == MYSearchbase_self.MYSearchbase_lim && j < MYSearchbase_total){
				r = a.insertRow(-1);
				r.style.backgroundColor = MYSearchbase_self.MYSearchbase_bgColor;
				c = r.insertCell(-1);
				c.style.color = MYSearchbase_self.MYSearchbase_textColor;
				c.style.fontFamily = 'arial narrow';
				c.style.fontSize = MYSearchbase_self.MYSearchbase_fSize;
				c.align='center';
				replaceHTML(c,'\\/');
				if (MYSearchbase_self.MYSearchbase_mouse){
					c.style.cursor = 'pointer';
					c.onclick = MYSearchbase_mouse_down;
				}
				break;
			}
		}
		MYSearchbase_rangeu = 1;
		MYSearchbase_ranged = j-1;
		MYSearchbase_display = true;
		if (MYSearchbase_pos <= 0) MYSearchbase_pos = 1;
	}
	function MYSearchbase_remake(){
		document.body.removeChild(document.getElementById('tat_table'));
		a = document.createElement('table');
		a.cellSpacing='1px';
		a.cellPadding='2px';
		a.style.position='absolute';
		a.style.top = eval(curTop(MYSearchbase_curr) + MYSearchbase_curr.offsetHeight) + "px";
		a.style.left = curLeft(MYSearchbase_curr) + "px";
		a.style.backgroundColor=MYSearchbase_self.MYSearchbase_bgColor;
		a.id = 'tat_table';
		if (MYSearchbase_self.MYSearchbase_mouse){
			a.onmouseout= MYSearchbase_table_unfocus;
			a.onmouseover=MYSearchbase_table_focus;
		}
		document.body.appendChild(a);
		var i;
		var first = true;
		var j = 1;
		if (MYSearchbase_rangeu > 1){
			r = a.insertRow(-1);
			r.style.backgroundColor = MYSearchbase_self.MYSearchbase_bgColor;
			c = r.insertCell(-1);
			c.style.color = MYSearchbase_self.MYSearchbase_textColor;
			c.style.fontFamily = 'arial narrow';
			c.style.fontSize = MYSearchbase_self.MYSearchbase_fSize;
			c.align='center';
			replaceHTML(c,'/\\');
			if (MYSearchbase_self.MYSearchbase_mouse){
				c.style.cursor = 'pointer';
				c.onclick = MYSearchbase_mouse_up;
			}
		}
		for (i=0;i<MYSearchbase_self.MYSearchbase_keywords.length;i++){
			if (MYSearchbase_bool[i]){
				if (j >= MYSearchbase_rangeu && j <= MYSearchbase_ranged){
					r = a.insertRow(-1);
					r.style.backgroundColor = MYSearchbase_self.MYSearchbase_bgColor;
					r.id = 'tat_tr'+(j);
					c = r.insertCell(-1);
					c.style.color = MYSearchbase_self.MYSearchbase_textColor;
					c.style.fontFamily = MYSearchbase_self.MYSearchbase_fFamily;
					c.style.fontSize = MYSearchbase_self.MYSearchbase_fSize;
					c.innerHTML = 

MYSearchbase_parse(MYSearchbase_self.MYSearchbase_keywords[i]);
					c.id = 'tat_td'+(j);
					c.setAttribute('pos',j);
					if (MYSearchbase_self.MYSearchbase_mouse){
						c.style.cursor = 'pointer';
						c.onclick=MYSearchbase_mouseclick;
						c.onmouseover = MYSearchbase_table_highlight;
					}
					j++;
				}else{
					j++;
				}
			}
			if (j > MYSearchbase_ranged) break;
		}
		if (j-1 < MYSearchbase_total){
			r = a.insertRow(-1);
			r.style.backgroundColor = MYSearchbase_self.MYSearchbase_bgColor;
			c = r.insertCell(-1);
			c.style.color = MYSearchbase_self.MYSearchbase_textColor;
			c.style.fontFamily = 'arial narrow';
			c.style.fontSize = MYSearchbase_self.MYSearchbase_fSize;
			c.align='center';
			replaceHTML(c,'\\/');
			if (MYSearchbase_self.MYSearchbase_mouse){
				c.style.cursor = 'pointer';
				c.onclick = MYSearchbase_mouse_down;
			}
		}
	}
	function MYSearchbase_goup(){
		if (!MYSearchbase_display) return;
		if (MYSearchbase_pos == 1) return;
		document.getElementById('tat_tr'+MYSearchbase_pos).style.backgroundColor = 

MYSearchbase_self.MYSearchbase_bgColor;
		MYSearchbase_pos--;
		if (MYSearchbase_pos < MYSearchbase_rangeu) MYSearchbase_moveup();
		document.getElementById('tat_tr'+MYSearchbase_pos).style.backgroundColor = 

MYSearchbase_self.MYSearchbase_hColor;
		if (MYSearchbase_toid) clearTimeout(MYSearchbase_toid);
		if (MYSearchbase_self.MYSearchbase_timeOut > 0) MYSearchbase_toid = 

setTimeout(function(){MYSearchbase_mouse_on_list=0;MYSearchbase_removedisp();},MYSearchbase_self.MYSearchbase_t

imeOut);
	}
	function MYSearchbase_godown(){
		if (!MYSearchbase_display) return;
		if (MYSearchbase_pos == MYSearchbase_total) return;
		document.getElementById('tat_tr'+MYSearchbase_pos).style.backgroundColor = 

MYSearchbase_self.MYSearchbase_bgColor;
		MYSearchbase_pos++;
		if (MYSearchbase_pos > MYSearchbase_ranged) MYSearchbase_movedown();
		document.getElementById('tat_tr'+MYSearchbase_pos).style.backgroundColor = 

MYSearchbase_self.MYSearchbase_hColor;
		if (MYSearchbase_toid) clearTimeout(MYSearchbase_toid);
		if (MYSearchbase_self.MYSearchbase_timeOut > 0) MYSearchbase_toid = 

setTimeout(function(){MYSearchbase_mouse_on_list=0;MYSearchbase_removedisp();},MYSearchbase_self.MYSearchbase_t

imeOut);
	}
	function MYSearchbase_movedown(){
		MYSearchbase_rangeu++;
		MYSearchbase_ranged++;
		MYSearchbase_remake();
	}
	function MYSearchbase_moveup(){
		MYSearchbase_rangeu--;
		MYSearchbase_ranged--;
		MYSearchbase_remake();
	}

	/* Mouse */
	function MYSearchbase_mouse_down(){
		document.getElementById('tat_tr'+MYSearchbase_pos).style.backgroundColor = 

MYSearchbase_self.MYSearchbase_bgColor;
		MYSearchbase_pos++;
		MYSearchbase_movedown();
		document.getElementById('tat_tr'+MYSearchbase_pos).style.backgroundColor = 

MYSearchbase_self.MYSearchbase_hColor;
		MYSearchbase_curr.focus();
		MYSearchbase_mouse_on_list = 0;
		if (MYSearchbase_toid) clearTimeout(MYSearchbase_toid);
		if (MYSearchbase_self.MYSearchbase_timeOut > 0) MYSearchbase_toid = 

setTimeout(function(){MYSearchbase_mouse_on_list=0;MYSearchbase_removedisp();},MYSearchbase_self.MYSearchbase_t

imeOut);
	}
	function MYSearchbase_mouse_up(evt){
		if (!evt) evt = event;
		if (evt.stopPropagation){
			evt.stopPropagation();
		}else{
			evt.cancelBubble = true;
		}
		document.getElementById('tat_tr'+MYSearchbase_pos).style.backgroundColor = 

MYSearchbase_self.MYSearchbase_bgColor;
		MYSearchbase_pos--;
		MYSearchbase_moveup();
		document.getElementById('tat_tr'+MYSearchbase_pos).style.backgroundColor = 

MYSearchbase_self.MYSearchbase_hColor;
		MYSearchbase_curr.focus();
		MYSearchbase_mouse_on_list = 0;
		if (MYSearchbase_toid) clearTimeout(MYSearchbase_toid);
		if (MYSearchbase_self.MYSearchbase_timeOut > 0) MYSearchbase_toid = 

setTimeout(function(){MYSearchbase_mouse_on_list=0;MYSearchbase_removedisp();},MYSearchbase_self.MYSearchbase_t

imeOut);
	}
	function MYSearchbase_mouseclick(evt){
		if (!evt) evt = event;
		if (!MYSearchbase_display) return;
		MYSearchbase_mouse_on_list = 0;
		MYSearchbase_pos = this.getAttribute('pos');
		MYSearchbase_penter();
	}
	function MYSearchbase_table_focus(){
		MYSearchbase_mouse_on_list = 1;
	}
	function MYSearchbase_table_unfocus(){
		MYSearchbase_mouse_on_list = 0;
		if (MYSearchbase_toid) clearTimeout(MYSearchbase_toid);
		if (MYSearchbase_self.MYSearchbase_timeOut > 0) MYSearchbase_toid = 

setTimeout(function(){MYSearchbase_mouse_on_list = 

0;MYSearchbase_removedisp();},MYSearchbase_self.MYSearchbase_timeOut);
	}
	function MYSearchbase_table_highlight(){
		MYSearchbase_mouse_on_list = 1;
		document.getElementById('tat_tr'+MYSearchbase_pos).style.backgroundColor = 

MYSearchbase_self.MYSearchbase_bgColor;
		MYSearchbase_pos = this.getAttribute('pos');
		while (MYSearchbase_pos < MYSearchbase_rangeu) MYSearchbase_moveup();
		while (MYSearchbase_pos > MYSearchbase_ranged) MYSearchbase_movedown();
		document.getElementById('tat_tr'+MYSearchbase_pos).style.backgroundColor = 

MYSearchbase_self.MYSearchbase_hColor;
		if (MYSearchbase_toid) clearTimeout(MYSearchbase_toid);
		if (MYSearchbase_self.MYSearchbase_timeOut > 0) MYSearchbase_toid = 

setTimeout(function(){MYSearchbase_mouse_on_list = 

0;MYSearchbase_removedisp();},MYSearchbase_self.MYSearchbase_timeOut);
	}
	/* ---- */

	function MYSearchbase_insertword(a){
		if (MYSearchbase_self.MYSearchbase_delimiter.length > 0){
			str = '';
			l=0;
			for (i=0;i<MYSearchbase_delimwords.length;i++){
				if (MYSearchbase_cdelimword == i){
					prespace = postspace = '';
					gotbreak = false;
					for (j=0;j<MYSearchbase_delimwords[i].length;++j){
						if (MYSearchbase_delimwords[i].charAt(j) != ' '){
							gotbreak = true;
							break;
						}
						prespace += ' ';
					}
					for (j=MYSearchbase_delimwords[i].length-1;j>=0;--j){
						if (MYSearchbase_delimwords[i].charAt(j) != ' ') break;
						postspace += ' ';
					}
					str += prespace;
					str += a;
					l = str.length;
					if (gotbreak) str += postspace;
				}else{
					str += MYSearchbase_delimwords[i];
				}
				if (i != MYSearchbase_delimwords.length - 1){
					str += MYSearchbase_delimchar[i];
				}
			}
			MYSearchbase_curr.value = str;
			setCaret(MYSearchbase_curr,l);
		}else{
			MYSearchbase_curr.value = a;
		}
		MYSearchbase_mouse_on_list = 0;
		MYSearchbase_removedisp();
	}
	function MYSearchbase_penter(){
		if (!MYSearchbase_display) return;
		MYSearchbase_display = false;
		var word = '';
		var c = 0;
		for (var i=0;i<=MYSearchbase_self.MYSearchbase_keywords.length;i++){
			if (MYSearchbase_bool[i]) c++;
			if (c == MYSearchbase_pos){
				word = MYSearchbase_self.MYSearchbase_keywords[i];
				break;
			}
		}
		MYSearchbase_insertword(word);
		l = getCaretStart(MYSearchbase_curr);
	}
	function MYSearchbase_removedisp(){
		if (MYSearchbase_mouse_on_list==0){
			MYSearchbase_display = 0;
			if (document.getElementById('tat_table')){ 

document.body.removeChild(document.getElementById('tat_table')); }
			if (MYSearchbase_toid) clearTimeout(MYSearchbase_toid);
		}
	}
	function MYSearchbase_keypress(e){
		if (MYSearchbase_caretmove) stopEvent(e);
		return !MYSearchbase_caretmove;
	}
	function MYSearchbase_checkkey(evt){
		if (!evt) evt = event;
		a = evt.keyCode;
		caret_pos_start = getCaretStart(MYSearchbase_curr);
		MYSearchbase_caretmove = 0;
		switch (a){
			case 38:
				MYSearchbase_goup();
				MYSearchbase_caretmove = 1;
				return false;
				break;
			case 40:
				MYSearchbase_godown();
				MYSearchbase_caretmove = 1;
				return false;
				break;
			case 13: case 9:
				if (MYSearchbase_display){
					MYSearchbase_caretmove = 1;
					MYSearchbase_penter();
					return false;
				}else{
					return true;
				}
				break;
			default:
				setTimeout(function(){MYSearchbase_tocomplete(a)},50);
				break;
		}
	}

	function MYSearchbase_tocomplete(kc){
		if (kc == 38 || kc == 40 || kc == 13) return;
		var i;
		if (MYSearchbase_display){ 
			var word = 0;
			var c = 0;
			for (var i=0;i<=MYSearchbase_self.MYSearchbase_keywords.length;i++){
				if (MYSearchbase_bool[i]) c++;
				if (c == MYSearchbase_pos){
					word = i;
					break;
				}
			}
			MYSearchbase_pre = word;
		}else{ MYSearchbase_pre = -1};
		
		if (MYSearchbase_curr.value == ''){
			MYSearchbase_mouse_on_list = 0;
			MYSearchbase_removedisp();
			return;
		}
		if (MYSearchbase_self.MYSearchbase_delimiter.length > 0){
			caret_pos_start = getCaretStart(MYSearchbase_curr);
			caret_pos_end = getCaretEnd(MYSearchbase_curr);
			
			delim_split = '';
			for (i=0;i<MYSearchbase_self.MYSearchbase_delimiter.length;i++){
				delim_split += MYSearchbase_self.MYSearchbase_delimiter[i];
			}
			delim_split = delim_split.addslashes();
			delim_split_rx = new RegExp("(["+delim_split+"])");
			c = 0;
			MYSearchbase_delimwords = new Array();
			MYSearchbase_delimwords[0] = '';
			for (i=0,j=MYSearchbase_curr.value.length;i<MYSearchbase_curr.value.length;i++,j--){
				if (MYSearchbase_curr.value.substr(i,j).search(delim_split_rx) == 0){
					ma = MYSearchbase_curr.value.substr(i,j).match(delim_split_rx);
					MYSearchbase_delimchar[c] = ma[1];
					c++;
					MYSearchbase_delimwords[c] = '';
				}else{
					MYSearchbase_delimwords[c] += MYSearchbase_curr.value.charAt(i);
				}
			}

			var l = 0;
			MYSearchbase_cdelimword = -1;
			for (i=0;i<MYSearchbase_delimwords.length;i++){
				if (caret_pos_end >= l && caret_pos_end <= l + 

MYSearchbase_delimwords[i].length){
					MYSearchbase_cdelimword = i;
				}
				l+=MYSearchbase_delimwords[i].length + 1;
			}
			var ot = MYSearchbase_delimwords[MYSearchbase_cdelimword].trim(); 
			var t = MYSearchbase_delimwords[MYSearchbase_cdelimword].addslashes().trim();
		}else{
			var ot = MYSearchbase_curr.value;
			var t = MYSearchbase_curr.value.addslashes();
		}
		if (ot.length == 0){
			MYSearchbase_mouse_on_list = 0;
			MYSearchbase_removedisp();
		}
		if (ot.length < MYSearchbase_self.MYSearchbase_startcheck) return this;
		if (MYSearchbase_self.MYSearchbase_firstText){
			var re = new RegExp("^" + t, "i");
		}else{
			var re = new RegExp(t, "i");
		}

		MYSearchbase_total = 0;
		MYSearchbase_tomake = false;
		MYSearchbase_kwcount = 0;
		for (i=0;i<MYSearchbase_self.MYSearchbase_keywords.length;i++){
			MYSearchbase_bool[i] = false;
			if (re.test(MYSearchbase_self.MYSearchbase_keywords[i])){
				MYSearchbase_total++;
				MYSearchbase_bool[i] = true;
				MYSearchbase_kwcount++;
				if (MYSearchbase_pre == i) MYSearchbase_tomake = true;
			}
		}

		if (MYSearchbase_toid) clearTimeout(MYSearchbase_toid);
		if (MYSearchbase_self.MYSearchbase_timeOut > 0) MYSearchbase_toid = 

setTimeout(function(){MYSearchbase_mouse_on_list = 

0;MYSearchbase_removedisp();},MYSearchbase_self.MYSearchbase_timeOut);
		MYSearchbase_generate();
	}
	return this;
}
/////////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////////////////////////////////////

	 	////////////////////////////////////////////////////////////////////////////////////
		///////////////////////////////////////////////////////////////////////////////////
		//  Google targeted Website with text field value
		//////////////////////////////////////////////////////////////////	
				function pushtoGoogle(){	
				var str;
				str = document.getElementById('qLookup').value;
				//got it here alert(str);
				splitListing = str.split("#") // zero based array
				//alert(splitListing);
				//telling the function to look for a single space
				//When it finds a single space, use that to add an item to the array

				returnjustnumber = splitListing[1];
				document.getElementById("q").value = returnjustnumber;
				}// end Google Search script    
             
</script>
<!-- 
// These next 2 scripts handle Hide/Show of DIV 'panels'
/////////////////////////////////////////////////////////////////////
-->
<SCRIPT language="JavaScript1.2" src="reveal.js"type="text/javascript"></SCRIPT>
<SCRIPT language="JavaScript1.2" src="jumpto.js"type="text/javascript"></SCRIPT>


<style type="text/css">
<!--
body {
	background-color: #fff;
}

#dynamic-content { width: 320px; height: 400px; border: 1px dotted #f00; margin-left: 18px; margin-right: auto; 

overflow: auto; background-color: beige; z-index:9; margin-top:120px; }
-->

@charset "utf-8";
/* CSS Document */

#pnlMYSearch {
	position:absolute;/*           position:absolute;            */
	width: 381px;
	height:25px;
	top: 80px;
	left: 450px;
z-index:5;	
background-color:#FFF
}

#MYReadFile {
	position:absolute;/*           position:absolute;            */
	width: 700px;
	height:600px;
	top: 120px;
	left: 18px;
	z-index:10;
	background-color:gold;
	font-size:12px;
	color:#000;
	
}



#pnlSearchBTN {
	position:absolute;/*           position:absolute;            */
	width: 166px;
	height:30px;
	top: 49px;
	left: 456px;
	z-index:3;
}


#button_bg {
	position:absolute;/*           position:absolute;            */
	width: 160px;
	height:63px;
	top: 110px;
	left: 581px;
	z-index:1;
	background-image:url(test_button_background.gif);
	
}
#testPanel {
	position:absolute;/*           position:absolute;            */
	width: 360px;
	height:400px;
	top: 0px;
	left: 18px;
	z-index:1;
	background-color:#FC6;
	
}


</style>
</head>

<body>

<FORM id="searchForm"  method="GET" action="http://www.google.com/search">
<input type="hidden" name="ie" value="ISO-8859-1">
<input type="hidden" name="oe" value="ISO-8859-1">



<script type="text/javascript" charset="utf-8">
document.write("The string is this long "+ MYArray +" (should be 23753)");
//processArrayValues.display()
</script>



    <div id="button_bg">

<table width="160" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="33" colspan="2" align="center" style="background-color:#FFF;">Search Array</td>
    </tr>
  <tr>
    <td width="90" height="30"><a href="#" onclick="showhide('pnlSearch');"><img src="trans_spacer.gif" alt="" 

width="90" height="30" hspace="0" vspace="0" border="0" /></a></td>
    <td width="70" height="30"><input type="image" src="trans_spacer.gif" height="31" width="70" border="0" 

value="Search MyWebsite.tld" id="submit" name="submit" alt="search" onclick="pushtoGoogle()" /></td>
  </tr></table></div>


<!-- Search Chester -->

<div id="pnlSearch" style="display: none;">
<label><a href="#" onclick="showhide('pnlSearch');"><img src="close_btn.gif" border="0" hspace="0" vspace="0" 

/></a> &nbsp;Search Array <font size="-2" color="#999999">: type E to test inline hardcoded array</font><INPUT  

type="text" id="qLookup" name="qLookup" size="60" value="" style="margin-left:10px;" 

autocomplete="off"></label>
<script language="javascript">
MYSearchbase(document.getElementById("qLookup"),MYArray);
</script>
</div>



<input type="hidden" name="client" value="google-csbe">         
<input type="hidden" name="domains" value="widener.edu">
<input type="radio" name="sitesearch" value="http://widener.edu" checked style="display:none;">

<input type="hidden" name="q" id="q" > 

</FORM>
    
</body>
</html>

Open in new window

0
 
leakim971Connect With a Mentor PluritechnicianCommented:
In the first case you're trying to use the value but it is not available
Hardcoded the array is present when the page load

You need something like this :


function getContent( data, status, response ) {
  WUArray = data.replace(/'|"/g,"").split( /,/ );
  MYSearchbase(document.getElementById("qLookup"), WUArray);
}

Open in new window

0
 
JAaron AndersonProgramming Architect @ Widener UniversityAuthor Commented:
hey @leakim971 man that works !
Im gonna try to implement later this week for a complete solution and will post so others can obtain source


can you explain how you came to this data.replace conclusion ?
and how in your mind/design is it operating to handle the scope need ?

thx
0
 
leakim971Connect With a Mentor PluritechnicianCommented:
>can you explain how you came to this data.replace conclusion ?

just to have '#MYArray','#hardcoded test','#inline','#hardcoded' instead '\'#MYArray\'','\'#hardcoded test\'','\'#inline\'','\'#hardcoded\''

for the other part, we use the data variable which contains your data

0
 
JAaron AndersonProgramming Architect @ Widener UniversityAuthor Commented:
thats great man... so perhaps the double quote was conflicting with passing to a paramater of the other sub-function... thanks !

final work is here http://www.widener.edu/webdev/phone_index.htm
0
 
JAaron AndersonProgramming Architect @ Widener UniversityAuthor Commented:
thx to Proculopsis for blazing a trail of understand but MAJOR props to leakim971 for patience and follow though! cheers !
0
All Courses

From novice to tech pro — start learning today.