function productFinder(){  
var q = document.finder.finalquery;
var p=document.finder.product;
var eu = document.finder.enduse;
var ra = document.finder.range;
q.value="";
q.value += 'FIELD template contains WebPageProduct AND FIELD pubstatus contains 2';
if (p.value!="" )  q.value += ' AND ( FIELD title contains ' + p.value + ' OR FIELD sourcetext contains ' + p.value + ' OR FIELD sourcetext3 contains ' + p.value + ' OR FIELD sourcetext4 contains ' + p.value +')' ;
if ( eu.selectedIndex > 0 ) q.value += ' AND FIELD sourcetext3 contains ' + unescape(eu.options[eu.selectedIndex].value);  
if ( ra.selectedIndex > 0 ) q.value += ' AND FIELD sourcetext4 contains ' + unescape(ra.options[ra.selectedIndex].value);  
//alert(q.value);
document.finder.submit();
}
function basicSearch(){  
var q = document.basic.finalquery;
var ra = document.basic.lookup;
q.value="";
q.value += 'NOT FIELD template contains WebPageProduct AND NOT FIELD template contains index02 AND FIELD pubstatus contains 2';
if (ra.value!="" )  q.value += ' AND ( FIELD title contains ' + ra.value + ' OR FIELD sourcetext contains ' + ra.value + ' OR FIELD sourcetext3 contains ' + ra.value + ' OR FIELD sourcetext4 contains ' + ra.value +')' ;
document.basic.submit();
}
function showMore(hide) {
  document.getElementById('readMore').style.display='block';
if(hide!='') {
  document.getElementById(hide).style.display='none'; }
}
function checkKeyPressed(evt)
{
  evt = (evt) ? evt : (window.event) ? event : null;
  if (evt)
  {
    var charCode = (evt.charCode) ? evt.charCode :
                   ((evt.keyCode) ? evt.keyCode :
                   ((evt.which) ? evt.which : 0));
    if (charCode == 13) productFinder();
  }    
}
function checkKeyPressedN(evt)
{
  evt = (evt) ? evt : (window.event) ? event : null;
  if (evt)
  {
    var charCode = (evt.charCode) ? evt.charCode :
                   ((evt.keyCode) ? evt.keyCode :
                   ((evt.which) ? evt.which : 0));
    if (charCode == 13) basicSearch();
  }    
}

function showFinder(state) {
var http = false;

if(navigator.appName == "Microsoft Internet Explorer") {
  http = new ActiveXObject("Microsoft.XMLHTTP");
} else {
  http = new XMLHttpRequest();
}

  http.abort();
  http.open("POST", "sp?open&cid=ElementProductFinderHome", true);
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
if(state=='1') {
         document.getElementById('homeFinder').innerHTML = http.responseText;}
else {
        document.getElementById('homeFinder').innerHTML ='<a href=\"#\" onclick=showFinder(\'1\');><img src=images/prodfinder.gif/$file/prodfinder.gif border=0></a>';}    

   }
  }
  http.send(null);
}

