home *** CD-ROM | disk | FTP | other *** search
/ Mundo do CD-ROM 118 / cdrom118.iso / internet / webaroo / WebarooSetup.exe / Webaroo.msi / _0845AD6985CB4F50A45F12D94BF53B55 < prev    next >
Encoding:
Text File  |  2006-03-13  |  4.5 KB  |  144 lines

  1. function search()      
  2.             {       
  3.                 var varSearchValue = trim(document.frmSearch.txtSearch.value);  
  4.                 var objSearchOption = document.frmSearch.searchoption;
  5.                 var varSearchOptionVal = objSearchOption[1].value;
  6.                 
  7.                 if(IsStartKeyword(varSearchValue))        
  8.                 {          
  9.                     alert("Search text should precede search expressions");          
  10.                     document.frmSearch.txtSearch.focus();          
  11.                     return false;        
  12.                 }        
  13.                 else        
  14.                 {          
  15.                     if(varSearchValue.length==0)          
  16.                     {            
  17.                         alert("Please enter a valid search term");            
  18.                         document.frmSearch.txtSearch.focus();            
  19.                         return false;          
  20.                     }          
  21.                     else          
  22.                     {            
  23.                         //if(IsSplChar(varSearchValue))            
  24.                         //{            
  25.                         //  document.frmSearch.txtSearch.value="";            
  26.                         //  document.frmSearch.txtSearch.focus();            
  27.                         //}            
  28.                         //else            
  29.                         //{              
  30.                         if(objSearchOption[0] && objSearchOption[0].checked)
  31.                         {
  32.                             parent.document.location.href="/webaroo/e29f1fe6/searchresult?main=1&txtSearch="+escape(document.frmSearch.txtSearch.value)+"&searcherid="+varSearchOptionVal+"&all=true";
  33.                         }
  34.                         else
  35.                         {
  36.                             parent.document.location.href="/webaroo/e29f1fe6/searchresult?main=1&txtSearch="+escape(document.frmSearch.txtSearch.value)+"&searcherid="+varSearchOptionVal+"&all=false";
  37.                         }
  38.                         //}          
  39.                     }        
  40.                 }      
  41.             }        
  42.             
  43.             function searchTopic(cityname, topic)      
  44.             {        
  45.                     document.location.href = "/webaroo/e29f1fe6/browseui?main=1&txtBrowseui="+cityname+" " + topic;        
  46.             }
  47.                 
  48.             function searchEditorPick(cityname)      
  49.             {          
  50.                 document.frmEP.action="/webaroo/e29f1fe6/search";          
  51.                 document.frmEP.txtEditorPick.value=cityname;
  52.                 document.frmEP.submit();      
  53.             }            
  54.             
  55.             function IsStartKeyword(strText)
  56.             {        
  57.                 arrKeyword = new Array('*','~','AND','OR')        
  58.                 for (intLoop = 0;intLoop < arrKeyword.length;intLoop++)        
  59.                 {          
  60.                     if(strText.indexOf(arrKeyword[intLoop])==0)          
  61.                     {            
  62.                         return true;            
  63.                         break;          
  64.                     }        
  65.                 }          
  66.                 return false;        
  67.             }            
  68.             
  69.             function trim(str)      
  70.             {        
  71.                 return((""+str).replace(/^\\s*([\\s\\S]*\\S+)\\s*$|^\\s*$/,'$1') );      
  72.             }        
  73.             
  74.             function SetSearchText()      
  75.             {        
  76.                 var done=0;        
  77.                 var arrQueryString = (location.search).split('&');        
  78.                 for(var i = 0; i<arrQueryString.length; i++)        
  79.                 {          
  80.                     if(arrQueryString[i].indexOf("txtSearch=") < 0)          
  81.                     {            
  82.                         continue;          
  83.                     }          
  84.                     document.frmSearch.txtSearch.value = unescape((arrQueryString[i].split('='))[1]).replace(/\\+/g, " ");
  85.                     done=1;          
  86.                     break;        
  87.                 }        
  88.                 if(done==0)          
  89.                 {            
  90.                     for(i = 0; i<arrQueryString.length; i++)            
  91.                     {              
  92.                         if(arrQueryString[i].indexOf("txtBrowseui=") < 0)              
  93.                         {                
  94.                         continue;              
  95.                         }              
  96.                         document.frmSearch.txtSearch.value = unescape((arrQueryString[i].split('='))[1]).replace(/\\+/g, " ");              
  97.                         done=1;              
  98.                         break;            
  99.                     }        
  100.                 }      
  101.             }  
  102.             
  103.             function SetEmptyText()
  104.             {
  105.                 var arrQueryString = (location.search).split('&');
  106.                 for(i = 0; i<arrQueryString.length; i++)
  107.                 {
  108.                     if(arrQueryString[i].indexOf("txtBrowseui=") < 0)
  109.                     {
  110.                         continue;
  111.                     }
  112.                     document.frmSearch.txtSearch.value = " ";
  113.                     break;
  114.                 }
  115.             }
  116.             function paginate(pageurl){
  117.                 parent.document.location.href=pageurl;
  118.             }
  119.             
  120.             function AddMoreResults(url)
  121.             {
  122.                 if (window.ActiveXObject)
  123.                 {
  124.                     var xmlDoc=new ActiveXObject("Microsoft.XMLHTTP");
  125.                     if (xmlDoc)
  126.                     {
  127.                         //Need this if this is to be done asynchronously
  128.                         //xmlDoc.onreadystatechange=loadXMLData;
  129.                         xmlDoc.open("GET",url,false);
  130.                         xmlDoc.send();
  131.                         // Once Data is Downloaded...
  132.                         if (xmlDoc.readyState==4)
  133.                         {
  134.                             // if "OK"
  135.                             if (xmlDoc.status==200)
  136.                             {
  137.                                 var htmlContent = xmlDoc.responseText;
  138.                                 document.MoreResults.innerHTML = htmlContent;
  139.                             }
  140.                         }
  141.                     }
  142.                 }
  143.             }
  144.