

var xmlHttp



function showCompany(cost,business,prod,start,pg)

{ 





for(i = 0; i < cost; i++)

{

	var c_id="startcost_" + i;

	

		if(document.getElementById(c_id).checked == true)

		{

			var cost_tmp = 0;	

		}

	}

	



for(i = 0; i < business; i++)

	{

		var b_id="businesstype_" + i;

		if(document.getElementById(b_id).checked == true)

		{

			var bus_tmp = 0;	

		}

	}





for(i = 0; i < prod; i++)

	{

		var p_id="prod_ind_" + i;

		if(document.getElementById(p_id).checked == true)

		{

			var p_tmp = 0;	

		}

	}

		/*if(bus_tmp != 0)

	{

		alert("Please Select Atleast one Business Type .");

		return false;

	}*/

	if(cost_tmp == 0 && bus_tmp != 0 && p_tmp != 0)

	{

		checkAllBusiness(business);
		checkAllProd(prod);
		/*alert("Please Select Atleast one Startup Cost .");

		return false;*/

	}
	if(cost_tmp != 0 && bus_tmp == 0 && p_tmp != 0)

	{

		checkAll(cost);
		checkAllProd(prod);
		/*alert("Please Select Atleast one Startup Cost .");

		return false;*/

	}
	if(cost_tmp != 0 && bus_tmp != 0 && p_tmp == 0)

	{

		checkAllBusiness(business);
		checkAll(cost);
		/*alert("Please Select Atleast one Startup Cost .");

		return false;*/

	}
	if(cost_tmp == 0 && bus_tmp == 0 && p_tmp != 0)

	{
		checkAllProd(prod);
		/*alert("Please Select Atleast one Startup Cost .");

		return false;*/

	}
	if(cost_tmp != 0 && bus_tmp == 0 && p_tmp == 0)

	{
		checkAll(cost);
		/*alert("Please Select Atleast one Startup Cost .");

		return false;*/

	}
	if(cost_tmp == 0 && bus_tmp != 0 && p_tmp == 0)

	{
		checkAllBusiness(business);
		/*alert("Please Select Atleast one Startup Cost .");

		return false;*/

	}
	if(cost_tmp != 0 && bus_tmp != 0 && p_tmp != 0)

	{

		checkAllBusiness(business);
		checkAll(cost);
		checkAllProd(prod);
		/*alert("Please Select Atleast one Startup Cost .");

		return false;*/

	}

	/*if(p_tmp != 0)

	{

		alert("Please Select Atleast one Product/Industry .");

		return false;

	}

*/

 

xmlHttp=GetXmlHttpObject()

if (xmlHttp==null)

 {

 alert ("Browser does not support HTTP Request")

 return

 }

 var coststr = "";

 var businessstr = "";

 var prodstr = "";

 

for( i = 0; i < cost; i++)

{

	var k = "startcost_" + i; 

	var checkbox = document.getElementById(k);	

	

	if(checkbox.checked==true)

	{

		if(coststr)

			coststr = coststr + "," + checkbox.value;

		else

			coststr = coststr + checkbox.value;

	}

	

}



for( i = 0; i < business; i++)

{

	var k = "businesstype_" + i; 

	var checkbox1 = document.getElementById(k);	

	

	if(checkbox1.checked==true)

	{

		if(businessstr)

			businessstr = businessstr + "," + checkbox1.value;

		else

			businessstr = businessstr + checkbox1.value;

	}

	

}



for( i = 0; i < prod; i++)

{

	var j = "prod_ind_" + i; 

	var checkbox2 = document.getElementById(j);	

	if(checkbox2.checked==true)

	{

		if(prodstr)

			prodstr = prodstr + "," + checkbox2.value;

		else

			prodstr = prodstr + checkbox2.value;

	}

	

}

 toggle_visibility('ajaxDiv','loading');

// toggle_visibility('loading','');

 /*age1 = document.myForm.age.value;

 wpm1 = document.myForm.wpm.value;

 sex1 = document.myForm.sex.value;*/

var url="list_company.php"



url=url+"?cost="+coststr

url=url+"&business="+businessstr

url=url+"&prod="+prodstr

url=url+"&start="+start

url=url+"&pgno="+pg



xmlHttp.onreadystatechange=stateChanged 

xmlHttp.open("GET",url,true)

xmlHttp.send(null)

}



function stateChanged() 

{ 

	document.getElementById("ajaxDiv1").style.display='none';

if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")

 { 

 

 toggle_visibility('loading','');

document.getElementById("loading").style.display='none';

document.getElementById("ajaxDiv").style.display='none';



document.getElementById("ajaxDiv1").style.display='inline';

document.getElementById("newtd").innerHTML=xmlHttp.responseText 





//alert(xmlHttp.responseText);





 } 

}



function GetXmlHttpObject()

{

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 toggle_visibility(id,id1) {

	

	// alert(document.getElementById(id).style.display);

       //var e = document.getElementById(id);

	  /* if(id == 'loading')

	   {

		   	alert("hiiii");

		   }*/

		

		if(document.getElementById("loading").style.display == 'inline')

		{

			document.getElementById("ajaxDiv").style.display='none';

			document.getElementById("ajaxDiv1").style.display='none';

		}

			

			//alert(document.getElementById(id).style.display);

       if(document.getElementById(id).style.display == 'inline' || document.getElementById(id).style.display == 'block' || document.getElementById(id).style.display == '' || document.getElementById(id).style.display == 'none')

	   {

			

		   	document.getElementById(id).style.display='none';

			if(id1 != '')

			{

				document.getElementById(id1).style.display='inline';

			}

          //e.style.display = 'none';

	   }

       else

	   {

		  document.getElementById(id).style.display='inline'; 	

			if(id1 != '')

			{

			  document.getElementById(id1).style.display='none';

			}

          //e.style.display = 'block';

	   }

	   

    }