// opens the current page with the parameter set as the selection 
// e.g. calling querystringSelection('about'); from index.asp loads index.asp?selection=about
function querystringSelection(selection){
	var newURL = document.location.pathname + '?selection=' + selection;
	document.location = newURL;
	}


// links to specified anchor on the current page		
function anchorLinkFromMenu(namedAnchor)
	{
	var newURL = document.location.pathname + location.search.substring(0) + '#' + namedAnchor;
	document.location = newURL; 
	}


// posts the site search form request to the relevant URL. 
function submitSearchFormToURL()
			{			
			var numRadios = document.SearchForm.searchType.length;
			var q = document.SearchForm.q.value;
			 
            
				if (document.SearchForm.searchType[0].checked == true)
			
		            {  
		              document.SearchForm.action = "http://www.research4development.info/SearchResearchDatabase.asp?client=default_frontend&proxystylesheet=default_frontend&output=xml_no_dtd&site=default_collection&filter=0"
		             //document.SearchForm.action = "http://83.244.212.106/search?client=default_frontend&proxystylesheet=default_frontend&output=xml_no_dtd&site=default_collection&filter=0"
				     
				    }
		
		            
		
				if (document.SearchForm.searchType[1].checked == true)
				       {
				      
				        document.SearchForm.method = "post";
				        document.SearchForm.action = "SearchResearchDatabase.asp?&cx=002378675671429383726%3Aostb-xowivi&cof=FORID%3A11&searchType=SearchResearchDatabase.asp&q="+q
				        
				         
				       }
				
				        
				    
					  
					 // document.SearchForm.submit();
					//}	
					
				//}			
			}
			
			
// posts the site search form request to the relevant URL. 
function submitGoogleSearchFormToURL()
			{			
			var numRadios = document.frmSearch.searchType.length;
			var q = document.frmSearch.q.value;
		
                if (document.frmSearch.searchType[0].checked == true)
			
		            {  
		             document.frmSearch.method = "post";
		             document.frmSearch.action = "SearchResearchDatabase.asp?&cx=002378675671429383726:jdtadzpnwfc&cof=FORID%3A11&searchType=SearchResearchDatabase.asp&q="+q
				        
				         
				  
				    }
               
				if (document.frmSearch.searchType[1].checked == true)
			
		            {  
		             document.frmSearch.target= "GoogleMiniResults";
		             document.frmSearch.action = "http://83.244.212.106/search?client=default_frontend&proxystylesheet=default_frontend&output=xml_no_dtd&site=default_collection&cx=default_collection&filter=0"
				  
				    }
		
		            
		
				if (document.frmSearch.searchType[2].checked == true)
				       {
				      
				       document.frmSearch.method = "post";
				        document.frmSearch.action = "SearchResearchDatabase.asp?&cx=002378675671429383726%3Aostb-xowivi&cof=FORID%3A11&searchType=SearchResearchDatabase.asp&q="+q
				        
				         
				       }
				
				 
				  
				if (document.frmSearch.searchType[3].checked == true)
				       {
				      
				        document.frmSearch.target = "GoogleMiniResults";
				        document.frmSearch.action = "http://83.244.212.106/search?client=default_frontend&proxystylesheet=default_frontend&output=xml_no_dtd&site=R4D_Projects&cx=R4D_Projects&filter=0"
				        
				         
				       }     
				    
				
				if (document.frmSearch.searchType[4].checked == true)
				       {
				      
				        document.frmSearch.target = "GoogleMiniResults";
				        document.frmSearch.action = "http://83.244.212.106/search?client=default_frontend&proxystylesheet=default_frontend&output=xml_no_dtd&site=R4D_Outputs&cx=R4D_Outputs&filter=0"
				        
				         
				       }
				       
				 
				if (document.frmSearch.searchType[5].checked == true)
				       {
				        
				        document.frmSearch.method = "post";
				        document.frmSearch.action = "SearchResearchDatabase.asp?&cx=002378675671429383726:tvuiz99-6cq&cof=FORID%3A11&searchType=SearchResearchDatabase.asp&q="+q
				        
				         
				       }	  
					 // document.SearchForm.submit();
					//}	
					
				//}			
			}			

// when focused on the SiteSearch form and enter is hit submitSearchFormToURL() is called

function submitDFIDSearch()
			{			
                  var q = document.frmSearch.q.value;
                  
                 document.DFIDSearch.method = "post";
                  
                  document.DFIDSearch.action = "SearchResearchDatabase.asp?&cx=002378675671429383726%3Aostb-xowivi&cof=FORID%3A11&searchType=SearchResearchDatabase.asp&q="+q
			      
			}        



function submitRelatedSitesSearch()
           {
                 var q = document.frmSearch.q.value;
                 
                document.RelatedSitesSearch.method = "post";
                 
				 document.RelatedSitesSearch.action = "SearchResearchDatabase.asp?&cx=002378675671429383726:tvuiz99-6cq&cof=FORID%3A11&searchType=SearchResearchDatabase.asp&q="+q
			     
           }
 
function GoogleWWWSearch()  
            {
                 var q = document.frmSearch.q.value;
                 
                document.GoogleSearch.method = "post";
                 
				 document.GoogleSearch.action = "SearchResearchDatabase.asp?&cx=002378675671429383726:jdtadzpnwfc&cof=FORID%3A11&searchType=SearchResearchDatabase.asp&q="+q
			     

           }
         
     
function submitOnEnter(e)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;

if (keycode == 13)
   {
   submitSearchFormToURL();
   return false;
   }
else
   return true;
}


// when called focus is moved to the first field of the form id/name passed as the parameter
function focusNamedForm(formToFocusOn)
	{
	document.forms[formToFocusOn].elements[0].focus();
	}	

// opens the image passed as the parameter in a new sized window
var imageWindow;
function launchImageWindow(imageName, folderName)
	{	
	imageWindow = window.open('images/' + folderName + '/' + imageName,'','width=440,height=300');
	imageWindow.focus();
	}
