var CalcunConfig = {
	basePath : '/',
	
	/**
	*	Gets a parameter from the current url
	*/
	urlParam: function( name )
	{
	  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	  var regexS = "[\\?&]"+name+"=([^&#]*)";
	  var regex = new RegExp( regexS );
	  var results = regex.exec( window.location.href );
	  if( results == null ) {
	    return "";
	  } else {
	    return results[1];
	  }
	},
	
	/**
	* Trim whitespace
	*/
	trim: function(str) {
	    if(!str || typeof str != 'string')
	        return null;
	
	    return str.replace(/^[\s]+/,'').replace(/[\s]+$/,'').replace(/[\s]{2,}/,' ');	
	},
	
    /**
    * Forward ajax loaded urlss
    * Since 5.0.1
    */  
    changeAjaxUrl: function(url) {
        var fullUrl = window.location.href.split('#!')[0] + '#!' + url;
        window.location.href = fullUrl;
    },
    
    /**
    * Loads ajax url
    */
    loadAjaxUrl: function() {
        var url = window.location.href.split('#!');
        if(url.length > 1) {
            window.location.href = url[1];
        }
    }
};

/**
* Ajax url redirect
* with IE hack
*/
$(document).ready(function() {
    CalcunConfig.loadAjaxUrl();
});
