function getxmlval()
{
if (window.XMLHttpRequest)
  {
  xmlval=new XMLHttpRequest();
  }
else
  {
  xmlval=new ActiveXObject("Microsoft.XMLHTTP");
  }
  return xmlval;
}
function radevent(elemval)
{
document.getElementById("cols_select").innerHTML='<img src="ajax-loader.gif"> loading...';
 
xmlhttp=getxmlval();  
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("cols_select").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","getselectbox.php?str="+elemval,true);
xmlhttp.send();

}


function chkvalidation()
{

 if(document.searchform.selcity.value=="-1")
 {
  //alert('Please Select City');
  makealertbox('Please Select City');
  document.searchform.selcity.focus();
  return false;
  
 }
 else if(document.searchform.type.value=="-1")
 {
  //alert('Please Select Type');
  makealertbox('Please Select Type');
  document.searchform.type.focus();
  return false;
  
 }
 else if(document.searchform.location.value=="-1")
 {
  
  makealertbox('Please Select Location');
  document.searchform.location.focus();
  return false;
  
 }
 else if(document.searchform.sel_purchase.value=="-1")
 {
  
  makealertbox('Please Select Budget');
  document.searchform.sel_purchase.focus();
  return false;
  
 }

 document.forms["searchform"].submit();
}
function radevent1(elemval)
{
document.getElementById("cols_select1").innerHTML='<img src="ajax-loader.gif"> loading...';
 
xmlhttp=getxmlval();  
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("cols_select1").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","getselectbox1.php?str="+elemval,true);
xmlhttp.send();

}
function makealertbox(msg)
{
	  var getbyid=document.getElementById('bodydiv');
	  var divmake=document.createElement('table');
	  divmake.id="alertid";
	 divmake.className = "classA";
	var tr1=document.createElement('tr');
	var td1=document.createElement('td');
	td1.innerHTML ="Error Validation";
	tr1.appendChild(td1);
	tr1.className = "classB";
	var tr2=document.createElement('tr');
	var td2=document.createElement('td');
	td2.innerHTML =msg;
	td2.className = "classC";
	tr2.appendChild(td2);
var tr3=document.createElement('tr');
	var td3=document.createElement('td');
	td3.innerHTML = "<input type='button' name='mytext' value='Ok' onclick='closediv()'>";
	td3.className = "classD";
	tr3.appendChild(td3);
	
divmake.appendChild(tr1);
divmake.appendChild(tr2);
divmake.appendChild(tr3);
getbyid.appendChild(divmake);
	  
	  getbyid.appendChild(divmake); 
}
function closediv()
{
	var parent = document.getElementsByTagName('getbyid');
var elem = document.getElementById('alertid');
var old = (elem.parentNode).removeChild(elem);
}
