
<!-- Begin
	// NOTE:  This version of the search.js file is for use
	//        *only* with the LiquidData project.

	// The parameter passed to doSearch() is ignored until
	// the WDTs are changed to pass in the correct product.
	// For now, the product is hard-coded into each search.js
	// for each doc set.

	// The doSearch function needs to open the file
	//     PRODUCT/doc11/search/search_offline_main.html
	// 
	// For PRODUCT/doc11/index.html       (0 levels down from docs70)
	// we use            search/search_offline_main.html
	// 
	// For PRODUCT/doc11/intro/index.html (1 level  down from docs70)
	// we use         ../search/search_offline_main.html
	//
	// This code determines how many "../"s we need.
	//
	dotdot = document.location.href;
	//
	// for CD search
	re = new RegExp( ".*docs11\/", "i" );
	dotdot = dotdot.replace( re, "" )
	//alert( "1 dotdot="+dotdot);
	re = new RegExp( "[^/]*\/", "g" );
	dotdot = dotdot.replace( re, "../" )
	//alert( "2 dotdot="+dotdot);
	re = new RegExp( "[a-zA-Z].*", "i" );
	dotdot = dotdot.replace( re, "" )
	//alert( "3 dotdot="+dotdot);

	var now=(new Date()).getTime();
	var net_up = false;
	function im_good() {
	    //alert( 'good' );
	    net_up = true;
	}
	function im_bad() {
	    //alert( 'bad' );
	    net_up = false;
	}

//The is_local function checks to see if you are using file protocol.  If so, it uses the local search.
// Thanks Jay!
	
	function is_local() {
    	re = new RegExp( ":.*", "i" );
    	var x = document.location.href
    	prot = x.replace( re, "" )
    	if ( prot == "file" ) net_up = false;
    	else net_up = true;
    	//alert ( " net_up = " + net_up );
 	}

	var im = new Image
	im.onload = im_good
	im.onerror = im_bad
	im.src = 'http://edocs.bea.com/images/blank.gif?' + now;

	// This function is called by the child window that handles CD searches
	function getSearchText() {
	    return document.forms[0].search_text.value;
	}

	function doSearch(area) {
// call the is_local function to see if we should use the local search
	    is_local();
		var debug = false; // TODO FIX must be set to 'false' for production
	    if ( net_up && debug ) {
		if ( false == confirm( "REMOVE THIS MESSAGE FOR PRODUCTION.\nNetwork is available.  Click OK to search on-line docs.  Click Cancel to search CD docs." ) )
		    net_up = false;
	    }

	    //alert( 'net_up=' + net_up );
	    if ( net_up ) {
		var theEntry=getSearchText();
			
		// search for any blank spaces and replace with '+'	
		var pattern = /\b \b/ig;
		var theQuery = theEntry.replace(pattern,"+");

		//alert( "redirecting...");

		// edocs online search URLs often contain:
		// A)  the product name (e.g. ".../liquiddata/...")
		// B)  a corresponding shorthand (e.g. ".../ld/...")
		// C)  a version-numbered subdirectory (e.g. ".../go10/...").
		//
		// These variables are used to compose the assigned to
		// document.location (in the case where the network is available).
		//
		// TODO FIX:  Check these names!
		area    = "liquiddata";
		dir     = "liquiddata/docs11";
		subdir  = "docs11";

		document.location="http://search.bea.com/"+dir+"/query.html?col=edocs&qp=url%3Ahttp%3A%2F%2Fe-docs.bea.com%2F"+area+"%2F"+subdir+"%2F&qt="+theQuery+"&qs=&qc=&pw=100%25&ws=0&qm=0&st=1&nh=10&lk=1&rf=0&rq=0";
		//alert( "redirected");
	    } else {
		// Network is unavailable,
		// use QuestAgent applet to search docs on CDROM.
		window.open(dotdot + "search/search_main.html", "subwin");
	    }
	    return false;
	}

// End -->
