
var http_base = 'http://rating.rbc.ru';

        function show_table( type, eid ) {
		var id = eid.replace( /.*\//, '' );
                var wnd = window.open(
                        http_base+'/graphs/tbl.shtml?'+eid,
                        'rtbl'+id,
                        'height=300, width=800, toolbar=0, titlebar=0, status=0, menubar=0, scrollbars=1, resizable=1'
                        );
		wnd.focus();
        }
        function show_full( type, eid, width, height ) {
		var id = eid.replace( /.*\//, '' );
                if ( width == null || width == '' ) {
                        width = 220;
                } else if ( width.match( /^\d+%/ ) ) {
                        width = screen.width*width.replace(/[^\d]/, '')/100;
                }
                if ( width > screen.width - 100 ) {
                        width = screen.width - 100;
                }
		width=800; // для разтяжки
                if ( height == null || height == '' ) {
                        height=300;
                } else if ( height.match( /^\d+%/ ) ) {
                        height = screen.height*(height.replace(/[^\d]/g, ''))/100;
		} else {
			height = height - 0 + 100;
		}
		var shtml = type=='rating_tables' ? 'full.shtml' : 'full1.shtml';
                var wnd = window.open(
                        http_base+'/graphs/'+shtml+'?'+eid,
                        'rfull'+id,
                        'height='+height+', width='+width+', toolbar=0, titlebar=0, status=0, menubar=0, scrollbars=1, resizable=1'
                        );
		wnd.focus();
        }

	function top7_show( eid ) {
		width = screen.width > 1200 ? screen.width*2/3 : 800;
                var wnd = window.open(
                        http_base + '/top7/rating.shtml?'+eid,
                        'top7'+eid.replace(/.*\//, ''),
                        'height=456, width='+width+', toolbar=0, titlebar=0, status=0, menubar=0, scrollbars=0, resizable=0'
                        );
		wnd.focus();
	}

	function show_picture(url,width,height)
	{
		var wnd=window.open(http_base+url,'','width='+width+',height='+height);
		wnd.focus();
	}

	function show_table_adv( redid, type, eid ) {
		var old_base = http_base;
		if ( redid ) {
			http_base = 'http://redir.rbc.ru/cgi-bin/redirect.cgi?'+redid+'~'+http_base;
		}
		show_table( type, eid );
		http_base = old_base;
	}

	function show_full_adv( redid, type, eid, width, height ) {
		var old_base = http_base;
		if ( redid ) {
			http_base = 'http://redir.rbc.ru/cgi-bin/redirect.cgi?'+redid+'~'+http_base;
		}
		show_full( type, eid, width, height );
		http_base = old_base;
	}

	function top7_show_adv( redid, eid ) {
		var old_base = http_base;
		if ( redid ) {
			http_base = 'http://redir.rbc.ru/cgi-bin/redirect.cgi?'+redid+'~'+http_base;
		}
		top7_show( eid );
		http_base = old_base;
	}

	function show_picture_adv( redid, url, width, height ) {
		var old_base = http_base;
		if ( redid ) {
			http_base = 'http://redir.rbc.ru/cgi-bin/redirect.cgi?'+redid+'~'+http_base;
		}
		show_picture( url, width, height );
		http_base = old_base;
	}

	function cw( cols ) {
		return( (cols*75+220)+'' );
	}

	function undef() {
		var a = 1;
	}


	function top7_go( eid, num ) {
		document.location.href = http_base + '/top7/rating.shtml?'+eid+'_'+num;
	}

        
        function show_full_adv_all( redid, type, aid, eid, width, height ) {
                var old_base = http_base;
                if ( redid ) {
                        http_base = 'http://redir.rbc.ru/cgi-bin/redirect.cgi?'+redid+'~'+http_base;
                }
                show_full_all( type, aid, eid, width, height );
                http_base = old_base;
        }

	function show_full_all( type, aid, eid, width, height ) {
                var id = eid.replace( /.*\//, '' );
                if ( width == null || width == '' ) {
                        width = 220;
                } else if ( width.match( /^\d+%/ ) ) {
                        width = screen.width*width.replace(/[^\d]/, '')/100;
                }
                if ( width > screen.width - 100 ) {
                        width = screen.width - 100;
                }
                width=800; // для разтяжки
                if ( height == null || height == '' ) {
                        height=300;
                } else if ( height.match( /^\d+%/ ) ) {
                        height = screen.height*(height.replace(/[^\d]/g, ''))/100;
                } else {
                        height = height - 0 + 100;
                }
                window.location = http_base+'/articles/'+aid+'_tbl.shtml?'+eid;
//				var wnd = window.open(
//					http_base+'/articles/'+aid+'_tbl.shtml?'+eid,
//					'rfull'+id,
//					'height='+height+', width='+width+', toolbar=0, titlebar=0, status=0, menubar=0, scrollbars=0, resizable=1'
//					);
//			if (wnd) wnd.focus();
        }
