<?php
/*
　* @$Id
　* @
　* @Ver: 2.0
　* @Create: 2009-11-18 8:10
　* @Modify: 
　* @Author: CPWEB http://www.cpweb.net.cn
　* @Copyright (C) 2008 www.cpweb.net.cn. All Rights Reserved.
　* @License CPWEB is free software and use is subject to license terms
　*/
import('TagLib');
class TagLibCpweb extends TagLib{
	public function _initialize(){
		$this->xml = dirname(__FILE__).'/Tags/cpweb.xml';
	}
	public function _cpweb_list($attr,$content){
		$tag=$this->parseXmlAttr($attr,'include');
		$name=$tag['name'];
		$limit=$tag['limit'];
		if($limit){
			$url_value='limit/'.$limit;
		}else{
			$url_value='';
		}
		$url='http://'.$_SERVER['SERVER_NAME'].__APP__.'/'.$name.'/cpweb_tag/'.$url_value;
		$return='<?php echo file_get_contents("'.$url.'"); ?>';
		return $return;
	}
	public function _cpweb_js_image($attr,$content){
		$tag=$this->parseXmlAttr($attr,'include');
		$name=$tag['name'];
		$cp_url=$tag['cp_url'];
		$parseStr.=<<<END
<SCRIPT type="text/javascript">
if(qgIE == "FF"){
	filter_code = "filter:progid:dximagetransform.microsoft.wipe(gradientsize=1.0,wipestyle=4, motion=forward);";
}else{
	filter_code = "filter:progid:DXImageTransform.Microsoft.RevealTrans(duration=5, transition=23);"
}
var widths=730;
var heights=150;
var counts=2;//获取翻页图片数量
var cp_url="$cp_url";
img1=new Image();
img1.src=cp_url+"Public/images/banner.gif";
url1=new Image();
url1.src="http://www.cpweb.net.cn";
img2=new Image();
img2.src=cp_url+"Public/images/banner1.gif";
url2=new Image();
url2.src="http://www.cpweb.net.cn";
var nn=1;
var key=0;
function change_img(){
	if(key==0){
		key=1;
	}
	else if(document.all){
		$("qgplayer_pic").filters[0].Apply();
		$("qgplayer_pic").filters[0].Play(duration=2);
	}
	eval('$("qgplayer_pic").src=img'+nn+'.src');
	if(qgIE != "FF"){
		eval('$("qgplayer_pic").filters.item(0).transition=23');
	}else{
		for(p_i=0;p_i<11;p_i++){
			var p_i_i = 0.1 * p_i;
			var p_i_m = 100 * p_i;
			window.setTimeout("eval(ff_filter("+p_i_i+"))",p_i_m);
		}
	}
	eval('$("qgplayer_url").href=url'+nn+'.src');
	for (var i=1;i<=counts;i++){
		$("xxjdjj"+i).className='axx';
	}
	$("xxjdjj"+nn).className='bxx';
	nn++;
	if(nn>counts){
		nn=1;
	}
	tt=setTimeout('change_img()',8000);
}
function changeimg(n){
	nn=n;
	window.clearInterval(tt);
	change_img();
}
function ff_filter(t){
	var m = '$("qgplayer_pic").style.cssText = "-moz-opacity:'+t+';"';
	return m;
}
document.write('<style>');
document.write('.axx{padding:1px 7px;margin:1px;}');
document.write('a.axx:link,a.axx:visited{text-decoration:none;color:#fff;line-height:12px;font:11px sans-serif;background-color:#666;}');
document.write('a.axx:active,a.axx:hover{text-decoration:none;color:#fff;line-height:12px;font:11px sans-serif;background-color:#999;}');
document.write('.bxx{padding:1px 7px;margin:1px;}');
document.write('a.bxx:link,a.bxx:visited{text-decoration:none;color:#fff;line-height:12px;font:11px sans-serif;background-color:#D34600;}');
document.write('a.bxx:active,a.bxx:hover{text-decoration:none;color:#fff;line-height:12px;font:11px sans-serif;background-color:#D34600;}');
document.write('</style>');
document.write('<div style="width:'+widths+'px;height:'+heights+'px;overflow:hidden;text-overflow:clip;">');
var xljw_filter = filter_code;
document.write('<div><a id="qgplayer_url" target="_blank"><img id="qgplayer_pic" style="border:0px;'+xljw_filter+'" width='+widths+' height='+heights+' /></a></div>');
document.write('<div style="text-align:right;top:-20px;right:5px;position:relative;height:15px;padding:0px;margin:1px;border:0px;">');
for(var i=1;i<counts+1;i++){
	document.write('<a href="javascript:changeimg('+i+');" id="xxjdjj'+i+'" class="axx" target="_self">'+i+'</a>');
}
document.write('</div></div>');
change_img();
</SCRIPT>
END;
		return $parseStr;
	}
}
?>