if (!this.AjaxUrl){
	
	var AjaxUrl = function(){
		
		return {
			
			LoopDelay : 90,
			Location : '',
			iFrameContent : '',
		
			Init : function(){
				
				this.ReplaceUrls();
				this.Loop();
				
			},
			
			Loop : function(){
				
				this.CheckUrl();
				setTimeout('AjaxUrl.Loop('+this.LoopDelay+')', this.LoopDelay);
				
			},
		
			ReplaceUrls : function(){
			
				var arr = document.getElementsByTagName('a');
				for (var i = 0; i < arr.length; i++){
					
					var currentRel = arr[i].getAttribute('rel');
					
					if (currentRel == 'nooverwrite'){ continue; } // href should not be altered
					else if (currentRel == 'processed'){ continue; } // href has already been altered
					
					var currentUrl = arr[i].getAttribute('href');
					/*if (browser.isIE){
						var newUrl = currentUrl.replace('index.php?', 'ajaxurl.php?');
						arr[i].setAttribute('target', 'ajaxurl');
					}
					else {
						var newUrl = currentUrl.replace('index.php?', '#');
					}*/
					var newUrl = currentUrl.replace('index.php?', '#');
					
					arr[i].setAttribute('href', newUrl);
					
				}
				
			},
		
			CheckUrl : function(){
		
				if (window.location.toString() == this.Location.toString()){ 
					if (!browser.isIE){ return; }
					
					// url is the same, but maybe there's new content in the iframe
					var content = Toolkit.get('iframe').contentWindow.document.body.innerHTML;
					if (this.iFrameContent == content){ return; }
					
					this.iFrameContent = content;
					var url = content.substr(content.indexOf('#'));
					
					
					
					if (url == this.Location.toString()){ return; }
					document.location = url;
					
				} // nothing to trigger
				else { // something to trigger
				
					this.Location = window.location.toString();
					
					if (browser.isIE){
						var parts = this.Location.split('#');
						window.frames['ajaxurl'].location = 'ajaxurl.php?'+parts[1];				
					}
								
					Catalog.ParseUrlToProperties(this.Location);
					Catalog.Refresh();
					
				}
				
			}
		
		};
		
	}();

}
