change_cities = function(province) {
	new Ajax.Updater('city', PATH+'cities.php', {
	  parameters: { p: province  }
	});
}

up_vote = function(listing_id) {
	new Ajax.Updater('votes_'+listing_id, PATH+'upvote.php', {
	  parameters: { id: listing_id  },
	  onSuccess: function() {
			if($('votenow')) {
				/*Element.update($('votenow'), '<span class="alreadyvoted">Voted!</span>')*/
			}
		}
	});
}

login = function(returnto) {
	Effect.Appear('loginpop', { duration: 0.6 });
	Form.Element.setValue($('returntohere'), returnto)
}

closelogin = function() {
	Effect.Fade('loginpop', { duration: 0.3 });
}

ratem = function(id, type, rate) {
	var container = 'rateem-'+type+'-'+id;
	/*$(container).update('<img style="text-align:center;" src="/style/loading.gif" alt="Loading">');*/
	new Ajax.Updater($(container), PATH+'rate.php', {
		parameters: { rateOption: rate, rateType: type, rateID: id },
		evalScripts: true,
		onSuccess: function() {}
	});
}

update_select = function(selected, field, parent, select, noother) {
	if(!noother) {
		noother = false;
	}
	new Ajax.Updater($(field), PATH+'update_select.php', {
		parameters: { 'p': selected, 'type': field, 'select': select, 'noother': noother },
		onComplete: function(response) {		}
	});
}
