function _showCreditPrompt() {
    var notice = getcookie('creditnotice').split('D');
    var basev = getcookie('creditbase').split('D');
    var creditrule = decodeURI(getcookie('creditrule', 1)).replace(String.fromCharCode(9), ' ');
    //    if(!discuz_uid || notice.length < 2 || notice[9] != discuz_uid) {
    //	setcookie('creditnotice', '');
    //	setcookie('creditrule', '');
    //	return;
    //    }
    var creditnames = creditnotice.split(',');
    var creditinfo = [];
    var e;
    for(var i = 0; i < creditnames.length; i++) {
	e = creditnames[i].split('|');
	creditinfo[e[0]] = [e[1], e[2]];
    }
//    creditShow(creditinfo, notice, basev, 0, 1, creditrule);
}

function getcookie(name) {
    var cookie_start = document.cookie.indexOf(name);
    var cookie_end = document.cookie.indexOf(";", cookie_start);
    return cookie_start == -1 ? '' : unescape(document.cookie.substring(cookie_start + name.length + 1, (cookie_end > cookie_start ? cookie_end : document.cookie.length)));
}

function setcookie(cookieName, cookieValue, seconds, path, domain, secure) {
    seconds = seconds ? seconds : 8400000;
    var expires = new Date();
    expires.setTime(expires.getTime() + seconds);
    document.cookie = escape(cookieName) + '=' + escape(cookieValue)
    + (expires ? '; expires=' + expires.toGMTString() : '')
    + (path ? '; path=' + path : '/')
    + (domain ? '; domain=' + domain : '')
    + (secure ? '; secure' : '');
}

function creditShow(creditinfo, notice, basev, bk, first, creditrule) {
    var s = '', check = 0;
    for(i = 1; i <= 8; i++) {
	v = parseInt(Math.abs(parseInt(notice[i])) / 5) + 1;
	if(notice[i] !== '0' && creditinfo[i]) {
	    s += '<span>' + creditinfo[i][0] + (notice[i] != 0 ? (notice[i] > 0 ? '<em>+' : '<em class="desc">') + notice[i] + '</em>' : '') + creditinfo[i][1] + '</span>';
	}
	if(notice[i] > 0) {
	    notice[i] = parseInt(notice[i]) - v;
	    basev[i] = parseInt(basev[i]) + v;
	} else if(notice[i] < 0) {
	    notice[i] = parseInt(notice[i]) + v;
	    basev[i] = parseInt(basev[i]) - v;
	}
	if($('hcredit_' + i)) {
	    $('hcredit_' + i).innerHTML = basev[i];
	}
    }
    for(i = 1; i <= 8; i++) {
	if(notice[i] != 0) {
	    check = 1;
	}
    }
    if(!s || first) {
	setcookie('creditnotice', '');
	setcookie('creditbase', '');
	setcookie('creditrule', '');
	if(!s) {
	    return;
	}
    }
    if(!$('creditpromptdiv')) {
	showPrompt(null, null, '<div id="creditpromptdiv">' + (creditrule ? '<i>' + creditrule + '</i> ' : '') + s + '</div>', 0);
    } else {
	$('creditpromptdiv').innerHTML = s;
    }
    setTimeout(function () {
	hideMenu(1, 'prompt');
	$('append_parent').removeChild($('ntcwin'));
    }, 1500);
}

function showPrompt(ctrlid, evt, msg, timeout) {
    $F('_showPrompt', arguments);
}