// JavaScript Document
///////////////// Function to get Types ////////////////
var Ajax = new sack();
function getTypes(catid)
{
	Ajax.requestFile='/views/ajax-server.php?cat_id='+catid;
	Ajax.onCompletion =	dispInfo
	Ajax.runAJAX(); 
}
/////////////// Funhction To get Manufacturers ///////////
var Ajax = new sack();
function getManuf(optid)
{
	Ajax.requestFile='/views/ajax-server.php?opt_id='+optid;
	Ajax.onCompletion =	dispInfo
	Ajax.runAJAX(); 
}
function dispInfo()
{
//alert(Ajax.response);
eval(Ajax.response);
}
///////////////// Home page search Validatons ///////////////////
function validateHome(frm_home,lnk)
{
	if(document.getElementById('select_cat').value =='0')
	{
		alert('Please select Category');
		return false;
	}
	if(isNaN(document.frm_home.txt_zip.value))
	{
		alert('Please enter the zip code as only Numeric data');
		document.frm_home.txt_zip.focus();
		return false;
	}
	if((document.getElementById('txt_zip').value!='') && (document.getElementById('slt_miles').value=='0'))
	{
		alert('Please select the Search Within miles also');
		return false;
	}	
	if((document.getElementById('txt_zip').value!='') && (document.getElementById('slt_miles').value!='0') && (document.getElementById('select_cat').value=='0'))
	{
		alert('Please select the atleast one category');
		return false;
	}

	
	if(document.getElementById('select_cat').value==3)
	document.frm_home.action = lnk+'buses/';
	else if(document.getElementById('select_cat').value==5)
	document.frm_home.action = lnk+'coaches/';
	
	document.frm_home.submit();
	/*Ajax.requestFile='../views/ajax-server.php?cat_id='+3;
	Ajax.onCompletion =	dispInfo
	Ajax.runAJAX(); */

	/*if(SelectValidation(val.select_cat,'Category')=='')
	{
		return false;
	}*/
	/*if(SelectValidation(val.sel_type,'Type')=='')
	{
		return false;
	}*/
/*	if(SelectValidation(val.sel_manufact,'Manufacturer')=='')
	{
		return false;
	}*/
	
	/*if (document.getElementById('txt_zip').value != '')
	{
		if(NumValidation(val.txt_zip,'Zip Code','','num')=='')
		{
			return false;
		}
	}*/
}
