﻿// JScript File

           function checkKeycode(e) {

               e = e || window.event;
               var code = e.keyCode || e.which;
               if(code == 13)
               {
               //window.alert(document.getElementById('searchtext').value);
               var objsearchText = document.getElementById('searchtext');
               var searchText;
               if ((objsearchText!=null))
               {
                   searchText = objsearchText.value;
                   searchText = searchText.replace(/>/gi, " >");
                   searchText = searchText.replace(/</gi, "< ");
                   objsearchText.value = searchText;
               }
               document.cookie="postbackcookie=";
			  
               window.top.document.location.href="/search.aspx?searchtext=" + searchText.replace('alert','').replace('confirm','') + "&folderid=0&searchfor=all&orderby=id&orderdirection=ascending";
               }
               //return CallSearch();
           }
         
           //document.onkeydown = checkKeycode;
         
           function CallSearch()
           {
               //window.alert(document.getElementById('searchtext').value);
               var objsearchText = document.getElementById('searchtext');
               var searchText;
               if ((objsearchText!=null))
               {
                   searchText = objsearchText.value;
                   searchText = searchText.replace(/>/gi, " >");
                   searchText = searchText.replace(/</gi, "< ");
                   objsearchText.value = searchText;
               }
               document.cookie="postbackcookie=";
               window.top.document.location.href="/search.aspx?searchtext=" + searchText.replace('alert','').replace('confirm','') + "&folderid=0&searchfor=all&orderby=id&orderdirection=ascending";
               //Load the page with the websearch server control in the bottom frame using Javascript
               //Set websearch properties using querystring parameters
               //Properties set here- search text,Orderby, FolderId, and SearchFor
               //SearchFor can be a value from all/html/documents/images/multimedia/discussionForum
               //Orderby can be one of these - editor,id,rank,title,datecreated,datemodified
               //OrderDirection can be ascending or descending
           }

           function checkkeyagain(e) {
 //return event.keyCode!=13;
               e = e || window.event;
               var code = e.keyCode || e.which;
		
               if(code == 13)
               {
				   
				   
				   setDirections(fromAddress.value, toAddress.value);  
				   
				    return false; 
			   }
			  
		   }


  function dowhat(page)
  {

		if( document.getElementById('searchtext').value!='') 
		{ 
			CallSearch(); 
			return false;
		} 
		else 
		{ 
		return ('undefined' == typeof Ektron || !Ektron.FormBlock || !typeof Ektron.FormBlock.validate  || Ektron.FormBlock.validate(this));
		}
	
  }
  
  function clearSearch(){
 document.getElementById('searchtext').value='';
  }
