function is_ie()
{
	var agt=navigator.userAgent.toLowerCase();
	var ie = ((agt.indexOf("msie") != -1));
	if ( ie )
	{
		return true;
	}
	else
	{
		return false;
	}	
}
function ocxstatus()
{
	var UUPObj;
	try
	{
		//UUPObj = new ActiveXObject("UPDATEC2.UpdateC2Ctrl.1");
		UUPObj = new ActiveXObject("UUPLAYEROCX.UUPlayerOCXCtrl.1");
		if ( typeof UUPObj != 'undefined' )
		{
			return true;
		}
	}
	catch(e)
	{
		return false;
	}
}
//滑动效果函数
function sl(el,dtype,oncomplete){
	//el : 滑动的element 
	//dtype : 滑动方向'up' or 'down'
	//oncomplete : 完成滑动后的事件,可选
	if(el.isShowing)return false;
	var slide = {
		_d : null,
		_step : 3,
		_maxheight : 35,
		_delay : 100,
		_timer : null,
		_afterF : null,
		_clear : function(){
			if(this._timer){clearInterval(this._timer)}
			},
		init : function(eo){
			eo.parentNode.style.height = '100%';
			eo.parentNode.style.overflow = 'hidden';
			eo.style.zoom = '1';//hack for IE6's clientHeight			
			this._maxheight = eo.clientHeight ? eo.clientHeight : this._maxheight;
			},
		setopt : function(p,v){
			this['_'+p] = v;
			},			
		show : function(eo){
			this._clear();
			this._curheight = this._maxheight;
			eo.style.marginTop = '-' + this._maxheight +'px';
			eo.style.display = 'block';
			eo.isShowing = true;
			var obj = this;
			this._timer = setInterval(function(){
				obj._curheight -= obj._step;
				if(obj._curheight < 0){
					obj._clear();
					eo.style.marginTop = '0px';
					eo.isShowing = false;
					if(typeof(obj._afterF)=='function'){obj._afterF()}
					}
				else{
					eo.style.marginTop = '-' + obj._curheight + 'px';
					}
				},this._delay);
			},
		hide : function(eo){
			this._clear();
			this._curheight = 0;
			eo.style.marginTop = '0px';
			eo.isShowing = true;
			var obj = this;
			this._timer = setInterval(function(){
				obj._curheight += obj._step;
				if(obj._curheight > obj._maxheight){
					obj._clear();
					eo.style.marginTop = '-' + obj._maxheight + 'px';
					eo.isShowing = false;
					if(typeof(obj._afterF)=='function'){obj._afterF()}
					}
				else{
					eo.style.marginTop = '-' + obj._curheight + 'px';
					}
				},this._delay);
			}
		}
	slide.init(el);
	slide.setopt('afterF',oncomplete);	
	switch(dtype){
		case 'up':
			slide.hide(el);
			break;
		case 'down':
			slide.show(el);
		}	
	}

var topdroptip = {
	init : function(){
		if(ocxstatus() || Cookie.get('notshow')||!is_ie())return false;
		var d = document.createElement('div');
		var down_url = "http://download.uusee.com/pop/down.php?u="+u+"&c="+c+"&d=0" ;
		var dhtml = '<div><div id="toptip" style="display:none;">'+
		'<b><input type="checkbox" id="noTips" /><label for="noTips">下次不显示</label> <a href="#1" onclick="topdroptip.hide()">关闭</a></b>'+
		'<p>系统检测到您的电脑上未安装最新版本的 <i style="color:#3fa500">UUSee软件</i>'+
		'  ，为了方便您收看网络电视节目，请点击下载 '+
		'<a href="'+down_url+'" target="_blank"><img src="http://res.pplive.com/images/topDown.gif" alt=""/></a></p>'+
		'<div id="shadow"></div>'+
		'</div></div>';
		d.innerHTML = dhtml;
		document.body.insertBefore(d,document.body.childNodes[0]);
		//document.write(dhtml);
		this.show();
		},
	show : function(){
		if( ocxstatus() || Cookie.get('notshow')||!is_ie())return false;
		sl($('toptip'),'down');
		},
	hide : function(){
		if($('noTips').checked){
			Cookie.add('notshow',1,0,0,30,0,0,0);
			}
		sl($('toptip'),'up',function(){$('toptip').style.display='none';});
		}
	}
	
topdroptip.init();
