//document.writeln('<div id="cld_stppop" style="position:absolute;z-index:1000;display:none;width:102;height:22;"><div class="showDownloadTip"></div><div class="showDownloadTip1"><a id="cld_stpdown" href="#" onclick="MyPopStp.ClosePop();MyPopStp.HitsStat(1);" class="a1">&nbsp;&nbsp;&nbsp;下载</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a id="cld_stpcoll" href="#" onclick="MyPopStp.ClosePop();MyPopStp.HitsStat(2);" class="a2">&nbsp;&nbsp;&nbsp;收藏</a></div></div>');
var cld_stptimer;
var cld_offtime=500;
function cld_stppop(){}
cld_stppop.prototype={
	DockObject:null,
	PopObject:null,
	Popdown:null,
	Popcoll:null,
	leftoffset:0,
	topoffset:0,
	clientflag:3,
	ietype:"",
	sid:0,
	statargs:[],
	PopStp:function(){
		if(this.clientflag==3){
			this.clientflag=1;
			if(!cltInstalled()){
				this.clientflag=0;
			}
		}
		this.PopObject=document.getElementById('cld_stppop');
		this.Popdown=document.getElementById('cld_stpdown');
		this.Popcoll=document.getElementById('cld_stpcoll');
		this.DockObject=arguments[0];
		if(cld_stptimer){
			clearTimeout(cld_stptimer);
		}
		this.PopObject.style.display = 'block';
		var dockpos=this.GetPosition(this.DockObject,"self");
		var poppos=this.GetPosition(this.PopObject,"parent");
		this.leftoffset=dockpos[0]-poppos[0];
		this.topoffset=dockpos[1]-poppos[1];
		var poswidth = this.DockObject.offsetWidth;
		var posheight = this.DockObject.offsetHeight;
		var popwidth = this.PopObject.offsetWidth;
		var popheight = this.PopObject.offsetHeight;
		var offsetx=0;
		var offsety=0;
		if(arguments.length>3){
			var posvals=arguments[3];
		}else{
			var posvals=[-1,-1];
		}
		if(posvals[0]==-1){
			if(poswidth>185){
				offsetx= poswidth/3;
			}else if(poswidth<80){
				offsetx= poswidth;
			}else{
				offsetx= poswidth/2;
			}			
		}else{
			offsetx=posvals[0];
		}
		if(posvals[1]==-1){
			offsety=posheight;
		}else{
			offsety=posvals[1];
		}		
		this.PopObject.style.left = (this.leftoffset + offsetx) + "px";
		this.PopObject.style.top = (this.topoffset + offsety) + "px";
		if(this.clientflag==1){
			this.Popdown.href=arguments[1];
			this.Popcoll.href=arguments[2];
		}else{
			var curhref=encodeURIComponent(arguments[1]);
			//if(typeof GetDownCltWebsite == 'function'){
				//var urldomain=GetDownCltWebsite();
			//}else{
				//var urldomain="";
			//}
			this.Popdown.href=GetDownCltWebsite() + "?stp=" + curhref;
			this.Popcoll.href=GetDownCltWebsite() + "?stp=" + curhref;
		}
		if(!this.DockObject.exist) {
			this.DockObject.exist= true;
			this.DockObject.outfunc = typeof this.DockObject.onmouseout == 'function' ? this.DockObject.onmouseout : null;
			this.DockObject.onmouseout = function() {
				if(this.outfunc) this.outfunc();
				cld_stptimer = setTimeout('MyPopStp.ClosePop()', cld_offtime);
			}
		}
		var tempo=this.PopObject;
		if(!this.PopObject.exist) {
			this.PopObject.exist= true;
			this.PopObject.onmouseover = function() {
				clearTimeout(cld_stptimer);
			}
			this.PopObject.onmouseout = function() {
				cld_stptimer = setTimeout('MyPopStp.ClosePop()', cld_offtime);
			}
		}
	},
	SetSid:function(){
		this.sid=arguments[0];
	},
	SetStatargs:function(){
		this.statargs=arguments;
	},
	GetStatargs:function(){
		return this.statargs;
	},
	HitsStat:function(){
		var htype=parseInt(arguments[0]);
		switch (htype){
			case 1:
				cldhits(this.sid,3);
				break;
			case 2:
				cldhits(this.sid,4);
				break;
			default:
				break;
		}
	},
	ClosePop:function(){
		if(this.PopObject){
			this.PopObject.style.display = 'none';
			clearTimeout(cld_stptimer);
		}
	},
	GetPosition:function (tobj,ttype){
		var tempobj=tobj;
		var leftoffset=0;
		var topoffset=0;
		if(typeof ttype == 'undefined'){ttype="self";}
		if(ttype=="self"){
			leftoffset =  tempobj.offsetLeft;
			topoffset = tempobj.offsetTop;
		}else if(ttype=="parent"){
			if(tempobj.style.marginLeft){
				leftoffset=leftoffset + parseInt(tempobj.style.marginLeft);
			}
			if(tempobj.style.marginTop){
				topoffset=topoffset + parseInt(tempobj.style.marginTop);
			}
			if((tempobj= tempobj.offsetParent) != null){
				if(tempobj.style.paddingLeft){
					leftoffset=leftoffset + parseInt(tempobj.style.paddingLeft);
				}
				if(tempobj.style.paddingTop){
					leftoffset=leftoffset + parseInt(tempobj.style.paddingTop);
				}
				//leftoffset =  leftoffset + tempobj.offsetLeft + tempobj.clientLeft-tempobj.scrollLeft;
				//topoffset = topoffset + tempobj.offsetTop + tempobj.clientTop-tempobj.scrollTop;
				leftoffset =  leftoffset + tempobj.offsetLeft + tempobj.clientLeft;
				topoffset = topoffset + tempobj.offsetTop + tempobj.clientTop;
				var sUserAgent=window.navigator.userAgent.toLowerCase();
				if(sUserAgent.indexOf("khtml") > -1 || sUserAgent.indexOf("chrome") > -1 || sUserAgent.indexOf("applewebkit") > -1){
					topoffset =topoffset - (document.documentElement.scrollTop + document.body.scrollTop);
				}
			}
		}
		while((tempobj= tempobj.offsetParent) != null) {
			leftoffset = leftoffset + tempobj.offsetLeft + tempobj.clientLeft-tempobj.scrollLeft;
			topoffset = topoffset + tempobj.offsetTop + tempobj.clientTop-tempobj.scrollTop;
		}
		return [leftoffset,topoffset];
	}
}

var MyPopStp=new cld_stppop();
