

var switch_custom_title_color_offset = 0;

function switch_custom_title_color(){
	var colors = ["#FF0000", "#00FF00", "#0000FF"];
	if(switch_custom_title_color_offset >= colors.length){
		switch_custom_title_color_offset = 0;
	}
	var color = colors[switch_custom_title_color_offset];
        if (document.getElementById("fm_point_custom_title")) {
            document.getElementById("fm_point_custom_title").style.color = color;
            switch_custom_title_color_offset++;
        }
}

function sp_point_init(){

	try{
		if(channel_profile.point_level != null && channel_profile.point_level_next_percent != null){

			var _levelFix = parseInt( channel_profile.point_level);
			if( isNaN(_levelFix) || _levelFix < 0){
				_levelFix = 0;
			}
			if(_levelFix < 10) _levelFix = "0" + _levelFix;

			var _levelPercentFix = Math.ceil( channel_profile.point_level_next_percent / 10 );
			if(_levelPercentFix < 10) _levelPercentFix = "0" + _levelPercentFix;

			var barText = '';
			if( channel_profile.point_level_up != null ){
				barText = '当前经验:' + channel_profile.point_score + '; 升级还需:' + channel_profile.point_level_up + '';
			}

			var barText2 = '';
			if( channel_profile.point_level_up != null ){
				barText2 = '当前级别:' + _levelFix + '; 下一级头衔:' + g_strip_nouse( channel_profile.point_level_next_name ) + '';
			}

			document.write('<div class="grade">');
			document.write('<a href="http://group.360quan.com/395/appDetail/app=blog&id=158790" target="_blank">');
			document.write('<img border="0" src="http://image.360quan.com/css/space/level' + _levelFix + '.gif" title="' + barText2 + '" />');
			document.write('</a>');
			document.write('<span id="fm_point_custom_title">' + g_strip_nouse( channel_profile.custom_title ) + '</span>');
			document.write('<cite>' + channel_profile.point_level_name + '</cite>');
			document.write('升级:<img width="50" height="10" title="' + barText + '" class="step" src="http://image.360quan.com/css/space/step' + _levelPercentFix + '.gif" /></div>');
		}
	}catch(e){}

	try{
		window.setInterval("switch_custom_title_color()", 300);
	}catch(e){}

}

