function _dump(arr,level) {
var dumped_text = "";
if(!level) level = 0;

//The padding given at the beginning of the line.
var level_padding = "";
for(var j=0;j<level+1;j++) level_padding += "    ";

if(typeof(arr) == 'object') { //Array/Hashes/Objects
 for(var item in arr) {
  var value = arr[item];
 
  if(typeof(value) == 'object') { //If it is an array,
   dumped_text += level_padding + "'" + item + "' ...\n";
   dumped_text += dump(value,level+1);
  } else {
   dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
  }
 }
} else { //Stings/Chars/Numbers etc.
 dumped_text = "===>"+arr+"<===("+typeof(arr)+")";
}
return dumped_text;
} 

jQuery(document).ready( function() {
	Properties.init();
});
/** this method is used for url encoding */
jQuery.extend({
    URLEncode: function(c){
        var o = '';
        var x = 0;
        c = c.toString();
        var r = /(^[a-zA-Z0-9_.]*)/;
        while (x < c.length) {
            var m = r.exec(c.substr(x));
            if (m != null && m.length > 1 && m[1] != '') {
                o += m[1];
                x += m[1].length;
            }
            else {
                if (c[x] == ' ') 
                    o += '+';
                else {
                    var d = c.charCodeAt(x);
                    var h = d.toString(16);
                    o += '%' + (h.length < 2 ? '0' : '') + h.toUpperCase();
                }
                x++;
            }
        }
        return o;
    },
    URLDecode: function(s){
        var o = s;
        var binVal, t;
        var r = /(%[^%]{2})/;
        while ((m = r.exec(o)) != null && m.length > 1 && m[1] != '') {
            b = parseInt(m[1].substr(1), 16);
            t = String.fromCharCode(b);
            o = o.replace(m[1], t);
        }
        return o;
    }
});

/* Streamer */
var Properties = {
	init : function() {
		this.ALL_STREAM_URL = '/all/?';
		this.EQUITIES_STREAM_URL = '/equities/stream/?';
		this.COMMENTARY_STREAM_URL = '/commentary/stream/?';
		this.FOREX_STREAM_URL = '/forex/stream/?';
		this.FUTURES_STREAM_URL = '/futures/stream/?';
		this.OPTIONS_STREAM_URL = '/options/stream/?';
		this.SUGGESTED_STREAM_URL = '/suggested/stream/?';
		this.CHARTS_STREAM_URL = '/chart/stream/?';
		this.ROOM_STREAM_URL = '/room/stream/?';
		this.CLUBS_STREAM_URL = '/clubs_pulse/stream/?';
		if(typeof membro != 'undefined' && membro !=''){
			this.ROOM_STREAM_URL = '/room/stream/?username='+membro;
		}
		this.YAHAOO_FINANCE_STOCK_WEBSERVICE = 'http://d.yimg.com/autoc.finance.yahoo.com/autoc?callback=YAHOO.Finance.SymbolSuggest.ssCallback&query=';
		this.SEARCH_SUGGEST_USER = '/stream/ajaxUserNameRequest.cfm?callback=?&username=';
		this.SIGN_IN_TEMPLATE = '/files/_sign_in_template.html';
		this.TRENDING_STREAM_URL = '/stream/trending/trending.cfm?';
		this.DIRECT_STREAM_URL = '/direct/stream/?';
		this.FRIENDS_STREAM_URL = '/friends/stream/?';
		this.FRIEND_MESSAGE_URL = '/user/friend/?';
		/*this.FRIENDS_MESSAGE_URL = '/friends/stream/?';*/
		this.MENTION_MESSAGE_URL = '/mentions/stream/?';
		this.MOSTLIKED_STREAM_URL = '/mostliked/stream/?';
		this.LIKED_STREAM_URL = '/liked/stream/?';
		
		
		
		this.DIRECT_MESSAGE_URL = '/message/?';
		
		this.BIT_LY_USERNAME = 'wetradetogether';
		this.BIT_LY_APIKEY = 'R_3d73cbabfc5bc8adaeece67c29e882a0';
		this.BIT_LY_PASSWORD = 'wetradetogether_short_link!';
		this.BIT_LY_EMAIL_ID = 'alfredo.baraldi@gmail.com';

		this.BIT_LY_URL = 'http://api.bit.ly/shorten?login=' + this.BIT_LY_USERNAME 
						+ '&apiKey=' + this.BIT_LY_APIKEY
						+ '&version=2.0.1&history=1&callback=?'
				+ '&longUrl=';
				
		this.LINK_DIALOG_SYMBOL_URL = '/charts/ajaxSymbolRequest/?callback=?&symbol=';
		/*non togliere l'url assoluto che inizia con http://www.wetradetogether.com, occorre per lo srink dell'url*/
		this.LINK_DIALOG_SYMBOL_THUMB_URL = 'http://www.wetradetogether.com/images/photos/square/';
		this.LINK_DIALOG_SYMBOL_LARGE_URL = 'http://www.wetradetogether.com/images/photos/large/';
		this.LINK_DIALOG_SYMBOL_VIEW_URL = 'http://www.wetradetogether.com/charts/show/';
		
		this.SAVE_USER_SEARCH_URL = '/search?callback=?&mode=save&text=';
		this.DELETE_USER_SEARCH_URL = '/search?callback=?&mode=delete&text=';
		this.RETREIVE_USER_SEARCH_URL = '/search?callback=?&mode=retreive';
		
		this.SEARCH_SYMBOL_URL = '/symbols/stream/?search=';
		this.SYMBOL_PAGE_URL = '/symbols/?search=';
		
		this.USER_PAGE_URL = '/user/user?user=';
		this.SEARCH_USER_URL = '/user/stream/username.cfm?username=';
		
		this.DAILY_STREAM_URL = '/daily/stream/?';
		this.HOURLY_STREAM_URL = '/hourly/stream/?';
		this.WEEKLY_STREAM_URL = '/weekly/stream/?';
		
		this.CREATE_FRIENDSHIP_URL = '/user/createFriendship?callback=?&username=';
		this.DESTROY_FRIENDSHIP_URL = '/user/destroyFriendship?callback=?&username=';
		this.BLOCK_USER_URL = '/user/block?callback=?&username=';
		
		this.DAILY_GRAPH_URL = '/stream/trending/graphDaily.cfm?callback=?';
		this.HOURLY_GRAPH_URL = '/stream/trending/graphHourly.cfm?callback=?';
		this.WEEKLY_BIS_GRAPH_URL = '/stream/trending/graphWeekly.cfm?callback=?';
		this.WEEKLY_GRAPH_URL = '/stream/trending/graphWeekly.cfm?callback=?&symbol=';
		
		this.WATCH_LIST_VIEW = '/list/view?callback=?';
		this.WATCH_LIST_ADD = '/list/add?callback=?&name=';
		this.WATCH_LIST_DELETE = '/list/delete/?id=';

		this.WATCH_LIST_SYMBOL_VIEW = '/list_symbol/view/?callback=?&id=#1';
		this.WATCH_LIST_SYMBOL_ADD = '/list_symbol/add/?callback=?&Listid=#1&symbol=#2';
		this.WATCH_LIST_SYMBOL_DELETE = '/list_symbol/delete/#1?&callback=?';
		
		this.WATCH_LIST_URL = '/list/search/?id=';
		this.WATCH_LIST_SEARCH = '/watchlist/?search=';
		 
		
		this.PEOPLE_BLOCKED_USER = '/user/viewBlock?callback=?';
		this.PEOPLE_UNBLOCK_USER = '/user/unblock/?callback=?&username=';

		this.USER_PROFILE_FOLLOWER = '/user/FollowersStatus/?callback=?&username=';		
		this.USER_PROFILE_FOLLOWING = '/user/FollowingStatus/?callback=?&username=';	
		
		this.SYMBOL_REAL_TIME_INFO =  '/symbols/real/?callback=?&search=';
		this.SYMBOL_NAME =  '/symbols/title/?callback=?&search=';
		this.STOCK_ADDITONAL_INFO = '/symbols/symbolsAjax/?callback=?&search=';
		
		this.ADD_EVENT_URL = '/event/add_event/?callback=?';
	}
};

