var options = {
	delay:175,
	json:true,
	loadingClass:"aLoad",
	timeout:50000,
	script:'/ajax/suggestions/hotels.php',
	ajaxParams:{action:"", json:true, searchsystem:"def"},
	format:function(selLiObj) {
		return selLiObj.innerHTML.indexOf(' - ')>0 ? (selLiObj.innerHTML.substr(0,selLiObj.innerHTML.indexOf(' - ')).replace(/<\/?b>/gi,'')) : (selLiObj.innerHTML.replace(/<\/?b>/gi,''));
	},
	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/hotels/link_counter_new.cgi";
	merchantsRefreshFile = "/ajax/merchants/hotel_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 ($(frm).find("#fromAir").val().length<3 || $(frm).find("#fromAir").val()==$(frm).find("#fromAir").attr('defaultValue')) {errorMsg += '\t'+errMsg['arr']+'\n';errorClass+="#fromAir,";}
	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;
	$(errorClass).addClass("err").focus(remErr);
	return errorMsg ? errorMsg : false;
};