	// ***************************************************
	// METHODS for populating/refreshing the search box
	// ***************************************************

	function searchchange(which) {

		// reset country and city pick if region, city pick if country
		if(which=='region') $('scountry').value = '';
		if(which=='region' || which=='country') $('scity').value = '';
		
		new Ajax.Updater('midbox', '/listings/midbox/',
		{
			method: 'post',
	  		parameters: Form.serialize('searchform'),
	    	evalScripts: true,
	    	onSuccess: function(transport) {
	    	},
	    	onFailure: function(){ alert('Something went wrong...'); return false; }
	  	});

	}
	function searchreset() {
		new Ajax.Updater('midbox', '/listings/midbox/',
		{
			method: 'post',
	    	evalScripts: true,
	    	onSuccess: function(transport) {
	    	},
	    	onFailure: function(){ alert('Something went wrong...'); return false; }
	  	});
	
	}

	function searchchangeadv(which) {

		// reset country and city pick if region, city pick if country
		if(which=='region') $('scountry').value = '';
		if(which=='region' || which=='country') $('scity').value = '';
		
		new Ajax.Updater('advbox', '/listings/advbox/',
		{
			method: 'post',
	  		parameters: Form.serialize('searchform'),
	    	evalScripts: true,
	    	onSuccess: function(transport) {
	    	},
	    	onFailure: function(){ alert('Something went wrong...'); return false; }
	  	});

	}
	function searchchangegeo(which) {

		// reset country and city pick if region, city pick if country
		if(which=='region') $('scountry').value = '';
		if(which=='region' || which=='country') $('scity').value = '';
		
		new Ajax.Updater('geobox', '/listings/geobox/',
		{
			method: 'post',
	  		parameters: Form.serialize('geosearchform'),
	    	evalScripts: true,
	    	onSuccess: function(transport) {
	    	},
	    	onFailure: function(){ alert('Something went wrong...'); return false; }
	  	});

	}

	function searchchangeusv(which) {

		// reset country and city pick if region, city pick if country
		if(which=='region') $('scountry').value = '';
		if(which=='region' || which=='country') $('scity').value = '';
		
		new Ajax.Updater('midbox', '/usv/midbox/',
		{
			method: 'post',
	  		parameters: Form.serialize('searchform'),
	    	evalScripts: true,
	    	onSuccess: function(transport) {
	    	},
	    	onFailure: function(){ alert('Something went wrong...'); return false; }
	  	});

	}
	function searchresetusv() {
		new Ajax.Updater('midbox', '/usv/midbox/',
		{
			method: 'post',
	    	evalScripts: true,
	    	onSuccess: function(transport) {
	    	},
	    	onFailure: function(){ alert('Something went wrong...'); return false; }
	  	});
	
	}

	function searchchangeadvusv(which) {

		// reset country and city pick if region, city pick if country
		if(which=='region') $('scountry').value = '';
		if(which=='region' || which=='country') $('scity').value = '';
		
		new Ajax.Updater('advbox', '/usv/advbox/',
		{
			method: 'post',
	  		parameters: Form.serialize('searchform'),
	    	evalScripts: true,
	    	onSuccess: function(transport) {
	    	},
	    	onFailure: function(){ alert('Something went wrong...'); return false; }
	  	});

	}


	function addbinder(listingid) {
		
		divname = 'dybinder'+listingid.toString();

		new Ajax.Updater(divname, '/listings/addbinder/',
		{
			method: 'post',
	  		parameters: 'listingid='+listingid.toString(),
	    	evalScripts: true,
	    	onSuccess: function(transport) {
	    	},
	    	onFailure: function(){ alert('Something went wrong...'); return false; }
	  	});

	}
	function removebinder(listingid) {
		
		divname = 'dybinder'+listingid.toString();

		new Ajax.Updater(divname, '/listings/removebinder/',
		{
			method: 'post',
	  		parameters: 'listingid='+listingid.toString(),
	    	evalScripts: true,
	    	onSuccess: function(transport) {
	    	},
	    	onFailure: function(){ alert('Something went wrong...'); return false; }
	  	});

	}

	function poplogin() {
		if(modalwnd) {
			modalwnd.close();
			modalwnd.destroy();	
		}
		modalwnd = new Control.Modal();	

		$('modal-link').href = '/ajproc/poplogin/';
		modalwnd.initialize($('modal-link'),{  
			overlayOpacity: 0.75,
		    width: 450, 
		    height: 200,
		    className: 'modal',  
		    parameters: {evalScripts: true},
		    fade: false  
		});  
		modalwnd.open();
	}

	function popregister() {
		if(modalwnd) {
			modalwnd.close();
			modalwnd.destroy();	
		}
		modalwnd = new Control.Modal();	

		$('modal-link').href = '/ajproc/popregister/';
		modalwnd.initialize($('modal-link'),{  
			overlayOpacity: 0.75,
		    width: 840, 
		    height: 500,
		    className: 'modal',  
		    parameters: {evalScripts: true},
		    fade: false  
		});  
		modalwnd.open();
	}

	
	
