function textCounter(field, countfield, maxlimit) {
	if (field.value.length > maxlimit) {
		field.value = field.value.substring(0, maxlimit);
	} else {
		countfield.value = maxlimit - field.value.length;
	}
}
	    
function getRegionsOrStatesByCountry(countryCode, stateCode, forBilling) {
   DWRUtilJS.getRegionsOrStatesByCountry(countryCode, stateCode, forBilling,  {
        callback:function(dataFromServer) {
	   		document.getElementById('statesOrRegions').innerHTML = dataFromServer;
        }
   });
}

function getPopularDestinations( countryCode, stateCode, destName ) {
   DWRUtilJS.getPopularDestinations(countryCode, stateCode, destName,  {
        callback:function(dataFromServer) {
	   document.getElementById('popularDestinations').innerHTML = dataFromServer;
        }
   });
}

function loadPropertyNames( countryCode, stateCode, city, propertyType, propertyName ) {
   DWRUtilJS.getPropertyNameByCountryStateAndCity(countryCode, stateCode, city, propertyType, propertyName,  {
        callback:function(dataFromServer) {
        	document.getElementById('propertyNames').innerHTML = dataFromServer;
        }
   });
}

function getMinimalListingInfo( listingID ) {
   DWRUtilJS.getMinimalListingInfo(listingID,  {
        callback:function(dataFromServer) {
        	document.getElementById('listingInfo').innerHTML = dataFromServer;
        }
   });
}

function getPropertyNames( propertyName ) {
  	var countryCode = document.forms[0].country.value;
  	var stateCode = document.forms[0].state.value;
  	var city = document.forms[0].city.value;
  	var propertyType = document.forms[0].propertyType.value;
   DWRUtilJS.getPropertyNameByCountryStateAndCity(countryCode, stateCode, city, propertyType, propertyName,  {
        callback:function(dataFromServer) {
        	document.getElementById('propertyNames').innerHTML = dataFromServer;
        }
   });
}