//-------------------------------------------------------------------
// Function:      RedirectPopUp
// Developer:     Telly
// Date Created:  09/02/2003
// Description:   Redirects the users based on the search type chosen
//                in the search user control.
// Parameter1:  loc  = URL
// Parameter2:  form = the form.
//-------------------------------------------------------------------
function RedirectPopUp (loc,form) {
	var strType,strArg,strRootChannelUrl,strParsedSearchArg;
	var strSite, strClient, strProxyStylesheet, strOutput, strFilter, strGetFields;
	
	//strRootChannelUrl = form.RootChannelUrl.value;
						
	strArg = form.search.value;
	strSite = form.site.value;
	strClient = form.client.value;
	strProxyStylesheet = form.proxystylesheet.value;
	strOutput = form.output.value;
	strFilter = form.filter.value;
	strGetFields = form.getfields.value;
	//window.location is not working for the site
	//window.location = loc+'?q='+strArg+'&site='+strSite+'&client='+strClient+'&proxystylesheet='+strProxyStylesheet+'&output='+strOutput+'&filter='+strFilter+'&getfields='+strGetFields;
    
    //use the following code 
    //when we want to open the result page in another browser
    var swidowopen = loc+'?q='+strArg+'&site='+strSite+'&client='+strClient+'&proxystylesheet='+strProxyStylesheet+'&output='+strOutput+'&filter='+strFilter+'&getfields='+strGetFields;
    window.open(swidowopen);
	
}

//-------------------------------------------------------------------
// Function:      catchKeyPress
// Developer:     Telly
// Date Created:  09/02/2003
// Description:   Check to see if the user pressed the enter 
//                button on the search user control and calls the
//                click method of the button.
// Parameter1:  code   = the key pressed on the keyboard
// Parameter2:  sender = the element on the page the action will be 
//                       taken against.
// Helper function: testForEnterAndEsc(); 
// Exmaple of use:  <body onkeydown="catchKeyPress(window.event.keyCode, window.event.srcElement);">
//-------------------------------------------------------------------
function catchKeyPress(code, sender) {
	var ret=null;
	
	testForEnterAndEsc();
	
	if(code == '13') {
		if(sender.name == 'search'){
			ret=document.getElementById("btnG");
		}
		if(ret) { 
			ret.click(); 
		}
	}               
}

//-------------------------------------------------------------------
// Function:      testForEnterAndEsc
// Developer:     Telly
// Date Created:  09/02/2003
// Description:   used with the catchKeyPress function to prevent 
//                bubbling of the event.
//-------------------------------------------------------------------
function testForEnterAndEsc() {    
	if (event.keyCode == 13){// || event.keyCode == 27) {        
		event.cancelBubble = true;
		event.returnValue = false;
	}
}