last_search=''

function SearchCatalog() {

	 dosearch = "n"

	 x = document.getElementById("SearchKeywords1").value
	 if (x == "Enter Keyword") {
	     x = ""
	 }
	 y = x.replace(/ /g,'') 
	 if (y > "") {
	    dosearch = "y"
	 }

	 hrefstring = "search-results.aspx?searchkeywords=" + x


	 x = document.getElementById("find_category").value
	 hrefstring += "&Programid=" + x

	 if (x > "") {
	 	dosearch = "y"
	 }

	 x = document.getElementById("find_format").value
	 hrefstring += "&courseformat=" + x

	 if (x > "") {
	 	dosearch = "y"
	 }

	 x = document.getElementById("find_format2").value
	 hrefstring += "&courserole=" + x

	 if (x > "") {
	 	dosearch = "y"
	 }



	 if (dosearch == "y") {

	 	location.href=hrefstring
	 }

	 else {
	    // alert ("Please enter a catalog selection criteria")
	    document.getElementById("SearchKeywords1").focus()
	 }
}

function SearchWebsiteOrig() {

	      if (document.getElementById("SearchKeywords").value > "" ) {
	         hrefs = "http://www.google.com/search?&num=100&q="
	         qs  = "site:www.learnquest.com "
	         qs += document.getElementById("SearchKeywords").value
	         qs = escape(qs)
	         //location=yes,modal=yes,resizable=yes,toolbar=yes modal=yes caused a flicker in IE when returning back to the originating page. Used in FF cause ts.focus() doesn't do what you want. Removed modal=yes cause of flicker
	         ts = window.open(hrefs+qs, "topsearch",
                           "location=yes,modal=yes,resizable=yes,toolbar=yes,status=yes,menubar=yes,scrollbars=yes,width=800"  )
	         ts.focus()
              }

}
function SearchWebsite() {

	      if (document.getElementById("SearchKeywords").value > "" ) {
	         hrefs = "http://www.google.com/cse?"
	         qs  = "cx=004495824145630216838:mfw-kib0jg8"
	         qs += "&ie=UTF-8&filter=0"
	         qs += "&sa=Search&num=100&q="
	         qs += escape(document.getElementById("SearchKeywords").value)
	         // qs = escape(qs)
	         //location=yes,modal=yes,resizable=yes,toolbar=yes modal=yes caused a flicker in IE when returning back to the originating page. Used in FF cause ts.focus() doesn't do what you want. Removed modal=yes cause of flicker
	         ts = window.open(hrefs+qs, "topsearch",
                           "location=yes,modal=yes,resizable=yes,toolbar=yes,status=yes,menubar=yes,scrollbars=yes,width=800"  )
	         ts.focus()
              }

}
function WhichButton() {


	if (last_search=='website' ) {
		SearchWebsite()
	}
	else if (last_search=='catalog' ) {
		SearchCatalog()
    }


}