$(document).ready(function(){
    $('.popup_window').bind('click', function(){
        $a = $(this);
        var name = $a.attr('name') || 'window';
        var width = $a.attr('width') || 640;
        var height = $a.attr('height') || 480;
        var left = parseInt((screen.availWidth/2) - (width/2));
        var top = parseInt((screen.availHeight/2) - (height/2));
        var windowFeatures = "width=" + width + ",height=" + height + 
            ",status,resizable=1,left=" + left + ",top=" + top + 
            ",screenX=" + left + ",screenY=" + top + ", scrollbars";
        window.open($a.attr('href'), name, windowFeatures);
        return false;
    });
    $('.set-paid-currency').bind('click', function(){
        var currency = $(this).attr('currency');
        $.getJSON(baseUrl + '/user/set-paid-currency', {
            currency: currency
        }, function(data){
            window.location.reload();
        });
        return false;
    });
    $('.right_col>.html-block-content>ul>li').bind('click', function(){
    	if ($(this).hasClass('opened')) {
    		$(this).removeClass('opened');  		
    		$('ul', this).hide();
    	} else {
    		$(this).addClass('opened');
    		$('ul', this).show();
    	}
    }).bind('mousedown', function(){
    	return false;
    });
    $('.right_col>.html-block-content a').bind('click', function(e){
    	e.stopPropagation();
    });
});
