var $AjaxHashPath = {
		
	initialized : false,
	mainInitialized : false,
	
	callbackFun : null,
		
	processClickEvent : function(clickElement) {
	
		//grab the full url
		var hash = clickElement.attr('href');
		
		//remove the # value
		hash = hash.replace(/^.*#/, '');	
	
		//for back button
	 	$j.history.load(hash);	
	 	
	 	//run the ajax
	 	//this.getPage();	 	
		
	 	
	},
		
	init : function(callbackFun) {
		
		//Check if url hash value exists (for bookmark)
		$j.history.init(this.pageload);	
		
		this.callbackFun = callbackFun;
		this.initialized = true;
		
	},
		
	pageload : function(hash) {  
	    //if hash value exists, run the ajax  
		
		$AjaxHashPath.getPage();      
    },  		
		
    getPage : function() {
    	
    	var hrefValue = '';
    	
    	hrefValue = document.location.hash;
    	hrefValue = hrefValue.replace(/^.*#/, '');	
    	
    	if (document.location.hash == '') {
    		if ($AjaxHashPath.initialized == false) {
    			mainInit();
    			return false;
    		}
    		hrefValue = $DOMAIN;// + 'index/index';
    	}    	

        var LoadingText = quicksoft_localisation.VIEWS_SCRIPTS_OTHER_1;

            $j('#content').block({
                message: '<h1>' + LoadingText + '</h1>',
                css: { border: '1px solid #000' },
                overlayCSS: { backgroundColor: '#fff' }
            });
    	
		if (hrefValue == $DOMAIN) {
			//hrefValue += 'index/index';
		}    	

    	$j.ajax({
    		url: hrefValue,	
    		type: "POST",		
    		cache: false,
    		data: ({'ajax-mode' : 'ajax-mode'}),
    		success: function (data) {	
    		
				var endIndx = data.indexOf('<!-- END -->');
				
				if (endIndx >= 0) {
					$j('#content').html(data.substr(0,endIndx));
					
					$j('.breadcrumbs_inner:first').html($j('.breadcrumbs_inner_ajax:first').html());
					
					$j(document).ready(function () {
						
						//$LogoManager.init();
						
						if ($AjaxHashPath.mainInitialized) {
							mainReInit();
						}
						else {
							$AjaxHashPath.mainInitialized = true;
							$AjaxHashPath.callbackFun();
						}
					});		    							
				}	
    		}		
    	});
    }
    

		
};
