var xmlHttp

function showmainResult(str,showimage,showdesc)
{
if (str.length==0)
 { 
 document.getElementById("mainsearch").innerHTML="";
 document.getElementById("mainsearch").style.borderTop="0px";
 return
 }

xmlHttp=GetXmlHttpObjectmain()

if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }

var url="search.php"
url=url+"?q="+str.replace(/&/,"%26")+"&si="+showimage+"&sd="+showdesc
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChangedmain 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 

function stateChangedmain() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("mainsearch").
 innerHTML=xmlHttp.responseText;
 matchHeight();
 } 
}

function GetXmlHttpObjectmain()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 // Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}

function matchHeight2(){

   var divs,contDivs,maxHeight,divHeight,d;
     // get all <div> elements in the document
     divs=document.getElementsByTagName('div');
     contDivs=[];
     // initialize maximum height value
     maxHeight=0;
     // iterate over all <div> elements in the document
     for(var i=0;i<divs.length;i++){
          // make collection with <div> elements with class attribute 'container'
          if(/\bcolumn\b/.test(divs[i].className)){
                d=divs[i];
                contDivs[contDivs.length]=d;
                // determine height for <div> element
                if(d.offsetHeight){
                     divHeight=d.offsetHeight;
                }
                else if(d.style.pixelHeight){
                     divHeight=d.style.pixelHeight;
                }
                // calculate maximum height
                maxHeight=Math.max(maxHeight,divHeight);
          }
     }
     // assign maximum height value to all of container <div> elements
     for(var i=0;i<contDivs.length;i++){
          maxHeight=maxHeight+10;
          contDivs[i].style.height=maxHeight + "px";
     }
}

