// JavaScript Document

var ajax = new Array();

function defcompany(cpid)
{
	getCompanyList(document.getElementById('City'), cpid);
	//alert(cpid);
}


function getCompanyList(ctid, cpid)
{
	var city_id = ctid.options[ctid.selectedIndex].value;
	document.getElementById('Company').options.length = 0;	// Empty Degination select box
	if(city_id.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		ajax[index].requestFile = '/ajaxphp/recruiters/client/getcompanys.php?city_id='+city_id+'&cpid='+cpid;	// Specifying which file to get
		//alert("Hi city_id "+ ctid.options[ctid.selectedIndex].value);
		ajax[index].onCompletion = function(){ createCompany(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}

function createCompany(index)
{
	var obj = document.getElementById('Company');
	//alert((ajax[index].response));
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}



function definstitute(instid)
{
	getInstituteList(document.getElementById('InstCity'),instid);
	//alert("Institute Id"+instid);
}


function getInstituteList(ct, instid)
{
	var cityid = ct.options[ct.selectedIndex].value;
	//alert(cityid);
	//alert("City Id is "+cityid+" and Inst Code "+ct);
	document.getElementById('Institute').options.length = 0;	// Empty Degination select box
	if(cityid.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		
		ajax[index].requestFile = '/ajaxphp/recruiters/client/getinstitute.php?cityid='+cityid+'&instid='+instid;	// Specifying which file to get
		
		//alert("Hi city_id "+ ct.options[ct.selectedIndex].value);
		
		ajax[index].onCompletion = function(){ createInstitute(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}

function createInstitute(index)
{
	var obj = document.getElementById('Institute');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}

