//function _smallWindow_setCookie(name, value, mins, path, domain,secure){
//	var expires = -1;
//	if((typeof mins == "number")&&(mins >= 0)){
//		var d = new Date();
//		d.setTime(d.getTime()+(mins*60*1000));
//		expires = d.toGMTString();
//	}
//	document.cookie = name + "=" + value + ";"
//		+ (expires != -1 ? " expires=" + expires + ";" : "")
//		+ (path ? "path=" + path : "")
//		+ (domain ? "; domain=" + domain : "")
//		+ (secure ? "; secure" : "");
//}

//function _smallWindow_getCookie(/*String*/name){
//	var idx = document.cookie.lastIndexOf(name+'=');
//	if(idx == -1) { return null; }
//	var value = document.cookie.substring(idx+name.length+1);
//	var end = value.indexOf(';');
//	if(end == -1) { end = value.length; }
//	value = value.substring(0, end);
//	value = unescape(value);
//	return value; //String
//}

//var smallWindow_cookieValue=_smallWindow_getCookie("__recommed_window");
//if("1"!=smallWindow_cookieValue){
	
//	if(window.location.href.indexOf("tuili.com")==-1){
//		_smallWindow_setCookie("__recommed_window","1",30,"/",null,false);
//	}else{
//		_smallWindow_setCookie("__recommed_window","1",30,"/","tuili.com",false);
//	}
var Urlstr=window.location.href.toLowerCase()

if((Urlstr.indexOf("/blog/index.")==-1)&&(Urlstr.indexOf("/blog/user_")==-1)&&(Urlstr.indexOf("/blog/photo.")==-1)&&(Urlstr.indexOf("/blog/digg.")==-1)&&(Urlstr.indexOf("/blog/list")==-1)&&(Urlstr.indexOf("/blog/tags.")==-1)&&(Urlstr.indexOf("/blog/groups.")==-1)){
	var smallWindowInnerHTML = "<div style=\"font-size: 12px;border:#112482 1px solid;width:200px;padding:1px;clear:both;\">";
	smallWindowInnerHTML += "<div id=\"smallWindowHead\" style=\"height:27px;background-color: #112482;background-image: url(http://www.tuili.com/plugin/bbscommend/barbg.GIF);background-repeat: repeat;\">";
	smallWindowInnerHTML += "<div style=\"font-size: 14px;	color:#FFFFFF;	font-weight: bold;float:left;padding-top:6px;padding-left:8px\">²©ÎÄÍÆ¼ö</div>";
	smallWindowInnerHTML += "<div style=\"float:right;padding:6px 6px 0px 6px\"><a href=\"javascript:void(0);\" onclick=\"smallWindowMinSize()\"><img src=\"http://www.tuili.com/plugin/bbscommend/icon_min.GIF\" border=\"0\" /></a>";
	smallWindowInnerHTML += "<a href=\"javascript:void('close');\" onclick=\"smallWindowClose()\"><img src=\"http://www.tuili.com/plugin/bbscommend/icon_close.GIF\" border=\"0\" /></a></div>";
	smallWindowInnerHTML += "</div><div id=\"smallWindowContent\" style=\"background-color:white;height:180px;margin:0px 0px;\"><iframe frameborder=0 scrolling=no width=195 height=180 src=\"http://www.tuili.com/plugin/bbscommend/commend.html\"></iframe></div><div style=\"clear:both\"></div></div>";
	
	var smallWindowHTML = "<div id='smallWindow' style='z-index:999;position:absolute;'>"+smallWindowInnerHTML+"</div>";
	document.write(smallWindowHTML);
	var smallWindow = document.getElementById("smallWindow");
	
	var smallWindowTop = parseInt(smallWindow.style.top,10);
	var smallWindowLeft  = parseInt(smallWindow.style.left,10);
	var smallWindowHeadHeigh = parseInt(document.getElementById("smallWindowHead").offsetHeight,10)+5;
	var smallWindowContentHeigh = parseInt(document.getElementById("smallWindowContent").offsetHeight,10);
	var smallWindowHeigh = smallWindowHeadHeigh+smallWindowContentHeigh;
	var smallWindowWidth = parseInt(smallWindow.offsetWidth,10);
	var docWidth = document.body.clientWidth;
	var docHeight = document.body.clientHeight;
	
	smallWindow.style.left = (docWidth - smallWindowWidth + parseInt(document.body.scrollLeft,10))+"px";
	smallWindow.style.top = (docHeight + parseInt(document.body.scrollTop,10))+"px";
	objTimer = window.setInterval("_smallWindow_countdown()",50)
	
	var counter = 20;
	function _smallWindow_countdown(){
		smallWindow.style.top = (docHeight - ((20-counter)/20)*smallWindowWidth + parseInt(document.body.scrollTop,10))+"px";
		counter--;
		if(counter<0){
			window.clearInterval(objTimer);
			objTime2 = window.setInterval(smallWindowSetPosition,300);
		}
	}
	function smallWindowSetPosition(){
		smallWindow.style.left = (document.body.clientWidth - smallWindowWidth + parseInt(document.body.scrollLeft,10))+"px";
		smallWindow.style.top = (document.body.clientHeight - smallWindowHeigh + parseInt(document.body.scrollTop,10))+"px";
	}
	function smallWindowClose(){
		try{
			var sWin = document.getElementById("smallWindow");
			sWin.parentNode.removeChild(sWin);
		}catch(e){
		
		}
	}
	function smallWindowMinSize(){
		try{
			var sWinContent = document.getElementById("smallWindowContent");
			if("none"==sWinContent.style.display){
				sWinContent.style.display="block";
				smallWindowHeigh = smallWindowHeadHeigh+smallWindowContentHeigh;
			}else{
				sWinContent.style.display="none";
				smallWindowHeigh = smallWindowHeadHeigh;
			}
		}catch(e){
		}
	}
}
