
	
		var List = AFL_JS.ActionDispatcher.List = new Object();
		
		List.Settings = {
		}
		
		List.Storage = {
				
		}
		
		List.HashChange = function() {
			if(List.Storage.CurrentURLHash == self.document.location.hash) return;
			
			try {
				UrlHash = Base64.decode(self.document.location.hash.substring(1));
				UrlHash = UrlHash.evalJSON();
			} catch(error) {
				return false;
			}
			
			if("Set" in UrlHash) {
				List.LoadSet(UrlHash.Set, UrlHash.Previous, UrlHash.Section, UrlHash.URLParams);
			} else {
				List.LoadSection(UrlHash.Section, UrlHash.URLParams, 1);
			}
			return true;
		}
		
		List.EncodeURLHash = function(oHash) {
			oHash = oHash ? oHash : List.Storage.CurrentURLObject;
			List.Storage.CurrentURLObject = oHash;
			UrlHash = Object.toJSON(oHash);
			UrlHash = Base64.encode(UrlHash);
			List.Storage.CurrentURLHash = '#'+UrlHash;
			self.document.location.hash = '#'+UrlHash;
			return UrlHash;
		}
		
		List.LoadSection = function(section, URLext, recursive) {
			
			if(!recursive && !section.length) { //we will try to read the hash
				if(List.HashChange()) return;
			}
			
			if(AFL_JS.Common.Busyness.IsBusy('SectionLoad')) return;
			AFL_JS.Common.Busyness.Set('SectionLoad', true); 
			
			List.Storage.CurrentSection = section || 'null';
			if(!URLext) URLext = '';
			
			UrlHash = List.EncodeURLHash({Section: section, 'URLParams': URLext});

			advAJAX.post({
				url: '/gay_connections/index.php'+URLext,
    			sec: section,
				hot : MainGrid.GetHotListed(),
				url_hash : '#'+UrlHash,
    			onLoading : function() {
	    			BoxGrid.ToggleLoader(1);
    			},
    			onSuccess : function(obj) {
    				setTimeout( function() {
						BoxGrid.Load(obj.responseJSON);
						BoxGrid.ToggleLoader(0);
						AFL_JS.Common.Busyness.Set('SectionLoad', false);
    				}, 500);
    			}
			});
		}
		
		
		List.LoadSet = function(set, previous, sec, searchstring) { 
			if(AFL_JS.Common.Busyness.IsBusy('SectionLoad')) return;
			AFL_JS.Common.Busyness.Set('SectionLoad', true); 
			//This function is exact copy of doListCall above, it has been created that way to ensure that further 
			//changes to the sets loading can be implemented easly. 
			
			var previous = Object.isUndefined(BoxGrid.Pagination.Settings.Details.CurrentSet) ? previous : BoxGrid.Pagination.Settings.Details.CurrentSet;
			var set = set || 0;
			
			if(Object.isUndefined(List.Storage.CurrentSection) || !List.Storage.CurrentSection) {
				List.Storage.CurrentSection = sec;
			}
			
			var sec = List.Storage.CurrentSection;
						
			if(set == null) return;
			
			var URLext = (sec == 'Search') ? List.Storage.SearchURL : '';
			
			URLext = searchstring ? searchstring : URLext;
			List.Storage.SearchURL = URLext;
			
			UrlHash = List.EncodeURLHash({Section: List.Storage.CurrentSection, 'Set': set, 'Previous' : previous, 'URLParams' : URLext});
			
			advAJAX.post({
	    		url: '/gay_connections'+URLext,
				hot : MainGrid.GetHotListed(),
	    		set: previous + set,
	    		previous: previous,
    			sec: sec,
    			onLoading : function() {
	    			BoxGrid.ToggleLoader(1);
    			},
    			onSuccess : function(obj) {
    				setTimeout( function() {
    					BoxGrid.Load(obj.responseJSON);
						BoxGrid.ToggleLoader(0);
						AFL_JS.Common.Busyness.Set('SectionLoad', false);
    				}, 500);
    			}
			});
		}
		
		
		List.LoadSearch = function() {
			
			var params = new Object();
			params.Top = $('top_rated_input').checked;
			params.New = $('new_input').checked;
			params.AgeFrom = $F('age_input_from');
			params.AgeTo = $F('age_input_to');
			params.Country = $F('country_input');
			params.Region = $F('region_input');
			params.Interest = $F('interest_input');
			params.Taking = $('taking_calls_input').checked;
			params.WithVideo = $('with_video_input').checked;
			params.WithAudio = $('with_audio_input').checked;
			params.WithImage = $('with_image_input').checked;
			params.DirectInput = ($('direct_input').value.length > 0) ? $('direct_input').value : false;
			
			var URL = '?dummy=0';
			
			for(var a in params) URL += '&'+a+'='+encodeURIComponent(params[a]);
			
			List.Storage.SearchURL = URL;
			
			List.LoadSection('Search', URL);
			
		}
		
		List.changeGenderPreference = function(gender) {
			if(AFL_JS.Common.Busyness.IsBusy('SectionLoad')) return;
			BoxGrid.SortGenderTabs(gender);
			var URL = '?gpref='+encodeURIComponent(gender);
			List.LoadSection(List.Storage.CurrentSection, URL);
		}
		