
// **********************************************************************************************************
// **********************************************************************************************************
//
//			 REMOTE SCRIPTING CLIENT-SIDE JAVA
//
//**********************************************************************************************************
//**********************************************************************************************************
//
//
// Line	53    	  show_RS_RouterDataResults(gblObjRS)
// Line	88	  	  show_RS_RowCntDisplayNamesResults(gblObjRcdCount)
// Line	118  	 show_RS_RowCntRouterDataResults(gblObjRcdCount)
// Line	193	     show_RS_DisplayNamesCboResults(gblObjCbo)
// Line	243		 show_RS_RowCntDisplayNamesErrors(gblObjRcdCount)
// Line	269	     show_RS_RouterDataErrors(gblObjRS)
// Line	297      show_RS_DisplayNamesCboErrors(gblObjCbo)
// Line	323      showTimerWindow(strURL)
// Line	362      showTimerWindowOnTop()
// Line	374      getChangeCursor()
// Line	394      showRowCount()
// Line	404      getClearCombo()
// Line	416      getCloseTimerWindow()
// Line	426 	 getProcessRequest()




//**********************************************************************************************************
//**********************************************************************************************************

//------------------------------------------------------------
// Set the error event handler to true.  This removes 
// ugly, irritating comments in status bar.  All relavant errors
// seem to be handled.
//------------------------------------------------------------
//self.onerror = function() { return true;}



//------------------------------------------------------------
// Name a variable for the window object - global scope.
//------------------------------------------------------------
var gblChildWindow
var gblsRcdCount
var gblCboName


//-----------------------------------------------------------------------
// Results function for the asyncronous remote scripting data call.  
// This results function is for the DisplayName data that is 
// pulled from the router tables through the remote scripting
// call.
//-----------------------------------------------------------------------
function show_RS_CboResults(gblObjCbo){
    
	// Declare new array to hold datastream
	var aCboRows = new Array();
	var aFields = new Array();
	var strValue = new String();	
		
	
	//alert("Java function");	
	// Information passed here from the 
	// server that was originally passed by the
	// calling client-side remote script.  This is only
	// a string that is really a friendly name to let us
	// know what function called remote scripting.
	typeOp = gblObjCbo.context;
    
	// Assign string variable the return value of the sequel call.
	// Rows are separated by the "|" (Pipe) delimeter.
	sRS = gblObjCbo.return_value;
	
	//alert(sRS)
	
	if (sRS != 0){
	
		// Split the at each delimeter and assign
		// each split into a element in this array.
		aCboRows = sRS.split("|");
		
		
		// Loop for the length of the array and then 
		// assign each value to a new option element
		// of the cboDisplayName select element on this page.
		for ( var n = 0; n < aCboRows.length - 1; n++){
			
			strValue = aCboRows[n]
			
			//alert(gblCboName+strValue);
			
			aFields = strValue.split(";")
			
			//alert(aFields[1]);
			
			document.all(gblCboName).options[n] = new Option(aFields[1],aFields[0])		
			
		}
	
	}
	
}


//-----------------------------------------------------------------------
// Error callback function for the asyncronous remote scripting data call.  
// This function is for data that is to populate
// the cboDisplayName select element on this page.
//-----------------------------------------------------------------------
function show_RS_CboErrors(gblObjCbo){
    // Dump raw data
    msg = "The raw data returned by the remote method call is "
    msg = msg + gblObjCbo.data + "<br><br>"
	
	//document.write(msg);
    alert(msg);
    // Display friendlier information
    msg = "The following error occurred during the " 
    msg = msg + gblObjCbo.context + "<br><br>"
    msg = msg + " remote scripting call:\n"
    msg = msg + gblObjCbo.message
    alert(msg);
	//document.write(msg);
	//gblChildWindow.close();
	//alert("end show_RS_RouterDataErrors");
	
	//gblChildWindow.close();
	// Change cursor from busy to and arrow.
	//getChangeCursor()
}


//-----------------------------------------------------------------------
// Changes the cursor from an arrow to busy to tell the 
// user that a process is happening.
//-----------------------------------------------------------------------
function getChangeCursor(){
		
	if (document.all("docBody").style.cursor == "wait"){
			document.all("docBody").style.cursor = "auto";
			document.all("docMainTable").style.cursor = "auto";
			//document.all("cmdGetDisplayName").style.cursor = "auto";

	}else{
			document.all("docBody").style.cursor = "wait";
			document.all("docMainTable").style.cursor = "wait";
			//document.all("cmdGetDisplayName").style.cursor = "wait";
	}
}




//-----------------------------------------------------------------------
// Put a wrapper around global variable so that VB can read it.
//-----------------------------------------------------------------------
function showRowCount(){
	return gblsRcdCount;
}




//-----------------------------------------------------------------------
// Clear the cboDisplayName drop down box.
//-----------------------------------------------------------------------
function getClearCombo(strCboName){

	document.all(strCboName).options.length = 0;
	
	gblCboName = strCboName
	
}




//-----------------------------------------------------------------------
// Wrapper for closing the pop up window.
//-----------------------------------------------------------------------
function getCloseTimerWindow(){

	// Close pop up window.
	gblChildWindow.close();

}


//-----------------------------------------------------------------------
// Wrapper for detecting the onkeypress for the Enter Key.
//-----------------------------------------------------------------------
function getProcessRequest(){

	if (event.keyCode == 13){
		
			// alert("True Onkeypress");
			// Enter was pressed.  Call function to build spreadsheet
			getSQLString();
			
	}

}


