<?php
#注册插件
RegisterPlugin("animatebg","ActivePlugin_animatebg");
function ActivePlugin_animatebg() {
	Add_Filter_Plugin('Filter_Plugin_Zbp_MakeTemplatetags','animatebg_box');
}
function animatebg_box() {
	global $zbp;
	$config = array(
		"anbgcolor" => $zbp->Config('animatebg')->anbgcolor,
		"anbgspeed" => $zbp->Config('animatebg')->anbgspeed,
		"anbgpnum" => $zbp->Config('animatebg')->anbgpnum
	);
	$zbp->footer .= '<script type="text/javascript">var zbPath="'.$zbp->host.'", anbgColor = "'.$config["anbgcolor"].'", anbgSpeed = "'.$config["anbgspeed"].'", anbgPnum = '.$config["anbgpnum"].';</script>
<script type="text/javascript">document.writeln(unescape("%3Cscript src=\""+zbPath+"zb_users/plugin/animatebg/main.js\" type=\"text/javascript\"%3E%3C/script%3E"));</script>' . "\r\n";
}
function InstallPlugin_animatebg() {
    global $zbp;
    //配置初始化
    if (!$zbp->Config('animatebg')->HasKey('anbgcolor')) {
		$zbp->Config('animatebg')->anbgcolor = '#F7FAFC';
		$zbp->Config('animatebg')->anbgspeed = '10';
		$zbp->Config('animatebg')->anbgpnum = '38';
        $zbp->SaveConfig('animatebg');
    }
}
function UninstallPlugin_animatebg() {
	global $zbp;
	//$zbp->DelConfig('animatebg');
}