
function cltInstalled(){
	var exed=false;
	if(navigator.userAgent.indexOf("MSIE") !=-1){	
		try{
			var cfv = new ActiveXObject("CloudFun.VersionFun2");
			exed=true;
		}
		catch(e){
			try{
				var cfv = new ActiveXObject("CloudFun.VersionFun");
				exed=true;
				/*try{
					cfv.GetVersionComments();
					if(cfv.GetVersionComments()!=1){
						exed=false;
					}else{
						exed=true;
					}			
				}
				catch(e){
					exed=false;
				}*/
			}
			catch(e){
				exed=false;
			}
		}
	}else{
		exed=true;
	}
	return exed;
}

document.writeln('<div id="cld_stppop" style="position:absolute;z-index:1000;width:112px; background:#fff; display:none;"><a id="cld_stpdown" href="#" onclick="MyPopStp.ClosePop();MyPopStp.HitsStat(1);" class="a1">下载</a><a id="cld_stpcoll" href="#" onclick="MyPopStp.ClosePop();MyPopStp.HitsStat(2);" class="a2">收藏</a></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,
	posoption:1,
	clientflag:3,
	ietype:"",
	sid:0,
	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';
		this.GetDockPos();
		this.posoption=1;
		if(arguments.length>3){
			this.posoption=arguments[3];
		}
		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;
		switch (this.posoption){
			case 1:
				if(poswidth>185){
					offsetx= poswidth/3;
				}else if(poswidth<80){
					offsetx= poswidth;
				}else{
					offsetx= poswidth/2;
				}
				offsety=posheight;
				break;

			case 2:
				offsety=posheight;
				break;

			case 3:
				var xabs=0;
				var yabs=posheight;
				if(arguments.length>4){
					xabs=parseInt(arguments[4]);
				}
				if(arguments.length>5){
					yabs=parseInt(arguments[5]);
				}
				offsetx= xabs;
				offsety= yabs;
				break;

			case 4:
				offsetx=0;
				offsety=posheight;
				var xabs=0;
				var yabs=0;
				if(arguments.length>4){
					xabs=parseInt(arguments[4]);
				}
				if(arguments.length>5){
					yabs=parseInt(arguments[5]);
				}
				offsetx= offsetx + xabs;
				offsety= offsety + yabs;
				break;

			default:
				break;
		}
		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{
			//this.Popdown.href="javascript:MycldDowntip.ShowMsg();";
			//this.Popcoll.href="javascript:MycldDowntip.ShowMsg();";
			var curhref=encodeURIComponent(arguments[1]);
			this.Popdown.href="http://update.yunduan.cn/clddownload.php?stp=" + curhref;
			this.Popcoll.href="http://update.yunduan.cn/clddownload.php?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);
			}
		}
	},
	GetDockPos:function(){
		var tempobj=this.DockObject;
		var paddLeftint=0;
		var borderLeftint=0;
		var paddTopint=0;
		var borderTopint=0;
		this.leftoffset=0;
		this.topoffset=0;
		if(tempobj.style.paddingLeft){
			paddLeftint=parseInt(tempobj.style.paddingLeft)
		}
		if(tempobj.style.borderLeftWidth){
			borderLeftint=parseInt(tempobj.style.borderLeftWidth)
		}
		if(tempobj.style.paddingTop){
			paddLeftint=parseInt(tempobj.style.paddingTop)
		}
		if(tempobj.style.borderTopWidth){
			borderLeftint=parseInt(tempobj.style.borderTopWidth)
		}
		this.leftoffset =  tempobj.offsetLeft + tempobj.clientLeft + paddLeftint + borderLeftint;
		this.topoffset = tempobj.offsetTop + tempobj.clientTop + paddLeftint + borderLeftint;
		while((tempobj= tempobj.offsetParent) != null) {
				this.leftoffset += tempobj.offsetLeft;
				if(tempobj.offsetParent==null){
					this.topoffset += tempobj.offsetTop;
				}else{
					this.topoffset += tempobj.offsetTop-tempobj.scrollTop;
				}
		}
	},
	SetSid:function(){
		this.sid=arguments[0];
	},
	HitsStat:function(){
		if(this.clientflag==1){
			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);
		}
	}
}

var MyPopStp=new cld_stppop();

