function GetTitle()
{
	var kdocTitle = document.title;
	if(kdocTitle == null)
	{ 
		var t_titles = document.getElementByTagName("title") 
		if(t_titles && t_titles.length >0) 
		{ 
		   kdocTitle = t_titles[0]; 
		}else{ 
		   kdocTitle = ""; 
		} 
	}
	return kdocTitle;
}

function GetScreen()
{
	return window.screen.width+"*"+window.screen.height;
}

function SetSiteStatistics(AspRoot,catalogId,pageType,contentId)
{	
	try
	{		
		var f = document.createElement("<form id='MyformContent' action='"+AspRoot+"/SiteStatistic/SiteStatisticRequest.aspx' method='get' target='SetSiteStatisticsIframe'>");   
		var i1 = document.createElement("<input type='text' name='Title' id='Title' value='"+ GetTitle() +"'>");
		var i2 = document.createElement("<input type='text' name='Path' id='Path' value='"+ escape(window.location.href) +"'>");
		var i3 = document.createElement("<input type='text' name='Screen' id='Screen' value='"+ GetScreen() +"'>");
		var i4 = document.createElement("<input type='text' name='catalogId' id='catalogId' value='"+ catalogId +"'>");
		var i5 = document.createElement("<input type='text' name='pageType' id='pageType' value='"+ pageType +"'>");
		var i6 = document.createElement("<input type='text' name='contentId' id='contentId' value='"+ contentId +"'>");
		f.appendChild(i1);
		f.appendChild(i2);
		f.appendChild(i3);
		f.appendChild(i4);
		f.appendChild(i5);
		f.appendChild(i6);
		document.appendChild(f);
		
		var g = document.createElement("<iframe src='' id='SetSiteStatisticsIframe' name='SetSiteStatisticsIframe' height='0' width='0'>");
		document.appendChild(g);
		
		f.submit();
		
		document.removeChild(f);

		ShowFloatDiv(catalogId);
		
	}
	catch(err)
	{
		
	}
}

function ShowFloatDiv(catalogId)
{
	if(catalogId==1) return;
	if(isNaN(catalogId)) return;
	var TempUrl = escape("http://manager.yntsti.net/Vote/vote.aspx?doaction=getfloat&catalogid="+catalogId);
	var myRequestDuty = new Request({method: 'get', 
		url: "/ajax.aspx?encode=65001&url="+TempUrl,
		onSuccess: function(t) {
			var str = t;

			if(str=="" || str==null || str=="User:False") return;
			var mystr = str.split(";");
			
			if(mystr.length<2) return;
			if(mystr[0]=="" || mystr[1]=="") return;

			var GoToUrl = mystr[0];
			var imageUrl = mystr[1];

			var ClosebuttonHtml = '<div align="right" style="position: absolute;top:0px;right:0px;margin:2px;padding:2px;z-index:2000;"><a href="javascript:;" onclick="CloseFloatDiv()" style="color:red;text-decoration:none;font-size:12px;">关闭</a></div>' 

			var AdContentHtml = ClosebuttonHtml + '<a href="' + GoToUrl +'"><img src="'+ imageUrl +'" width="100" height="250" border="0" /></a>'; 

			var TempFloatDiv = new floatAdver();
			TempFloatDiv.createInfo("background:#FFF;height:250px;width:100px;border:1px solid #CCC;","background:#FFF;height:250px;width:100px;border:1px solid #CCC;",AdContentHtml,AdContentHtml,200);
			TempFloatDiv.createAdv();
		}
	});

	myRequestDuty.send();
}

function CloseFloatDiv()
{
	document.getElementById("RDiv_FloatDiv").style.display = "none";
	document.getElementById("LDiv_FloatDiv").style.display = "none";
}

function floatAdver(){
	this.fDivs = new Array();//浮动广告对象数组
	this.divCount = 0 ; //浮动广告对象数量
	this.h = 560;//距离顶部距离
	this.fDiv;
	this.lDiv = "";
	this.rDiv = "";
	this.lDivCssText = "position:absolute;top:0px;left:10px;width:100px;height:100px;border:1px solid red;";
	this.rDivCssText = "position:absolute;top:0px;right:10px;width:100px;height:100px;border:1px solid red;";
	this.lDivInner = "";
	this.rDivInner = "";
}
floatAdver.prototype = {
	createInfo:function(lcss,rcss,linfo,rinfo,h){ //设置两边浮动层信息
		this.lDivCssText += lcss;
		this.rDivCssText += rcss;
		this.lDivInner = linfo;
		this.rDivInner = rinfo;
		this.h = h;

	},
	createFloatDiv:function(){ // 创建２个浮动层
		this.lDiv = document.createElement("div");	
		this.rDiv = document.createElement("div");
		this.lDiv.style.cssText = this.lDivCssText;	
		this.rDiv.style.cssText = this.rDivCssText;
		this.lDiv.innerHTML = this.lDivInner;
		this.rDiv.innerHTML = this.rDivInner;
		document.body.appendChild(this.rDiv);
		document.body.appendChild(this.lDiv);
		this.rDiv.id="RDiv_FloatDiv";
		this.lDiv.id="LDiv_FloatDiv";
		this.divCount++;
	},
	createAdvPro:function(){ //类内部创建层的浮动过程
		var bodyScrollTop = document.documentElement.scrollTop;		
		if(this.rDiv != bodyScrollTop + this.h)
		{
			this.$(this.rDiv).style.top = parseInt(this.$(this.rDiv).style.top) + Math.ceil((bodyScrollTop + this.h - parseInt(this.$(this.rDiv).style.top))/20)	+ "px";	
			this.$(this.lDiv).style.top = this.$(this.rDiv).style.top;
		}		
	},
	
	createAdv:function(){ //调用内部浮动 入口!!
		var _this = this;
		_this.createFloatDiv();
		setInterval(function(){_this.createAdvPro();},10);
		
	},
	floatPro:function(){//非类内部创建层的 浮动效果
		var bodyScrollTop = document.documentElement.scrollTop;		
		if(this.fDiv.style.top != bodyScrollTop + this.h)
		{
			this.$(this.fDiv).style.top = parseInt(this.$(this.fDiv).style.top) + Math.ceil((bodyScrollTop + this.h - parseInt(this.$(this.fDiv).style.top))/20)	+ "px";
			
		}
	},
	$:function(o){ //获取对象
		if(typeof(o) == "string")
		return document.getElementById(o);
		return o;
	},
	begins:function(o,h){//调用浮动 入口!!
		var _this = this;
		_this.fDiv = _this.$(o);
		_this.h = h;
		//alert(this.fDiv.id);
		setInterval(function(){_this.floatPro();},10);
	}
}