//for gme promo materials
function openNewWindow(URLtoOpen,windowName,windowFeatures) {
	newWindow = window.open(URLtoOpen, windowName, windowFeatures);
}

// Javascript for VCU search
function checkQuery() {
       var queryFld = document.keyword.query
       if (queryFld.value == "") {
       alert ("Please enter a query")
       queryFld.focus()
       return(false)
       }
   return(true)
 }

function checkName() {
     var nameFld = document.ccso.NAME
     if (nameFld.value == "") {
     alert ("Please enter a name")
     nameFld.focus()
     return(false)
     }
   return(true)
 }

function convertString( temp ) {
     var newString = "";
     var i=0;
     for( i=0; i < temp.length; i++ ) {
     if( temp.charAt(i) != " " ) {
     newString += temp.charAt(i);
     }
     else {
        newString += "+";
     }
    }
    return newString;
 }

//default search
 function setVCURadio(ip){
     if (ip.indexOf("128.172.")<0) {
     document.keyword.searchnav[0].checked = true;
      } else {
       document.keyword.searchnav[1].checked = true;
      } 
   }

function startSearch() {
// department search
  if( 
  document.keyword.searchnav.selectedIndex == 0 ) {
   if( checkQuery() ) {
     var header = "http://www.google.com/u/vcu";
     var options = "?q=";
     var options2 = "&sitesearch=vcu.edu/pharmtox&domains=vcu.edu";
     var searchVal = convertString(document.keyword.query.value);
    eval( "location = " + "\"" + header + options + searchVal + options2 + 
    "\"");
   }
 }
 
//vcu via Google
  if( 
  document.keyword.searchnav.selectedIndex == 1 ) {
  if( checkQuery() ) {
     var header = "http://www.google.com/u/vcu";
     var options = "?q=";
     var options2 = "&sitesearch=vcu.edu&domains=vcu.edu";
     var searchVal = convertString(document.keyword.query.value);
     eval( "location = " + "\"" + header + options + searchVal + options2 + 
     "\"");
  }
  }

//Internet via Google
 if( 
  document.keyword.searchnav.selectedIndex == 2 ) {
   if( checkQuery() ) {
   var header = "http://www.google.com/search";
   var options = "?hl=en&ie=UTF-8&oe=UTF-8";
   var searchVal = "&q=" + convertString(document.keyword.query.value);
   eval( "location = " + "\"" + header + options + searchVal + "\"");
  }
 }
  //people
  if( document.keyword.searchnav.selectedIndex == 4 ) {
  if( checkQuery() ) {
    var header = "http://search.vcu.edu/cgi-bin/directall.pl?"
    options = "TYPE=All";
    searchVal = "&NAME=" + 
    convertString(document.keyword.query.value);
    eval( "location = " + "\"" + header + options + searchVal + "\"" );
}
}


}