var options = {
	delay:175,
	json:true,
	loadingClass:"aLoad",
	timeout:50000,
	script:'/ajax/suggestions/airports.php',
	ajaxParams:{action:"", json:true, searchsystem:"def"},
	format:function(selLiObj) {
		return (selLiObj.innerHTML.replace(/<\/?b>/gi,'')).replace(/(.*),(.*)\((.*)\)/,'$1 ($3)');
	},
	callback:function(){refreshMerchants();},
	errorHandler:function(asObj){
		$(asObj.fld).addClass("err").focus(remErr);
	}
};

$(function() {
	as1 = new AS('fromAir', options);
	as2 = new AS('toAir', options);

	linkCounter = "http://www.travelgrove.com/cgi-bin/cars/link_counter_new.cgi";
	merchantsRefreshFile = "/ajax/merchants/cars_new2.json.php";
});

function validateBox(frm){
	errorMsg = "";
	errorClass = "";
	var patt1 = /.*\s\(...\)/i; /*city inputs*/
	var patt2 = /[0-9]{2}\/[0-9]{2}\/[0-9]{4}/; /*date inputs*/
	var date = new Date();
	var d1 = $(frm).find("#dep_cal").datepicker('getDate');
	var d2 = $(frm).find("#arr_cal").datepicker('getDate');
	if (!patt1.test($(frm).find("#fromAir").val())) {errorMsg += '\t'+errMsg['dep']+'\n';errorClass+="#fromAir,";}
	if ($(frm).find("#toAir").val()!=$(frm).find("#toAir").get(0).defaultValue && !patt1.test($(frm).find("#toAir").val())) 	{errorMsg += '\t'+errMsg['arr']+'\n';errorClass+="#toAir,";}
	if (!patt2.test($(frm).find("#dep_cal").val())) {errorMsg += '\t'+errMsg['d1']+'\n';errorClass+="#dep_cal,";}
	if (!patt2.test($(frm).find("#arr_cal").val())) {errorMsg += '\t'+errMsg['d2']+'\n';errorClass+="#arr_cal,";}
	if (d1>0 && d1<date)				{errorMsg += '\t'+errMsg['d1']+'\n';errorClass+="#dep_cal,";}
	if (d1>0 && d2>0 && d1>d2)			{errorMsg += '\t'+errMsg['d1d2']+'\n';errorClass+="#arr_cal,";}
	if ($(".mSel").length<1)			{errorMsg += '\t'+errMsg['selectOne']+'\n';}
	if (errorMsg) errorMsg = errMsg['enterFirst']+'\n'+errorMsg;
	$(frm).find(errorClass).addClass("err").focus(remErr);
	return errorMsg ? errorMsg : false;
};