var htmldom = '<div style="background:url(http://img-cdn2.paixie.net/sign_pic/20101017/title_bg.jpg);width:350px;height:66px;"><span id="message_close" onclick="message_close()" style="background:#fff;display:block;width:28px;height:16px;line-height:16px;font-size:12px;float:right;margin:3px 3px 0 0;text-align:center;cursor:pointer;">关闭</span><div class="msg_nav" style="background:url(http://img-cdn2.paixie.net/sign_pic/20101017/msg_nav.jpg) no-repeat;position:relative;top:45px;left:82px;width:262px;height:21px;margin:0;padding:0;line-height:22px;text-align:center;font-size:12px;font-weight:bold;"><a href="#" onClick="return false;" onmouseover="showAds(1)">魅力女鞋</a><a href="#" onClick="return false;" onmouseover="showAds(2)">户外风</a><a href="#" onClick="return false;" onmouseover="showAds(3)">时尚动态</a><a href="#" onClick="return false;" onmouseover="showAds(4)">品牌特卖</a></div></div><div style="margin:0 3px 2px 3px;background:#fff;width:340px;height:220px;padding-left:4px;overflow:hidden;"><span id="Ads1"><a href="http://www.paixie.net/topic/369.html" target="_blank"><img src="http://img-cdn2.paixie.net/sign_pic/20120107/mn1011.jpg" border=0  alt="魅力女鞋"/></a></span><span id="Ads2" style="display:none;"><a href="http://www.paixie.net/topic/368.html" target="_blank"><img src="http://img-cdn2.paixie.net/sign_pic/20120107/mn1012.jpg" border=0 alt="户外风"/></a></span><span id="Ads3" style="display:none;"><a href="http://www.paixie.net/topic/367.html" target="_blank"><img src="http://img-cdn2.paixie.net/sign_pic/20120107/mn1013.jpg" border=0 alt="时尚动态" /></a></span><span id="Ads4" style="display:none;"><a href="http://www.paixie.net/tmh/" target="_blank"><img src="http://img-cdn2.paixie.net/sign_pic/20120107/mn1014.jpg" border=0  alt="品牌特卖"/></a></span></div>';
document.write('<style>.msg_nav a{color:#999;width:65px;height:22px;display:block;float:left; text-decoration:none}.msg_nav a:hover{background:#87C54B;color:#fff;}</style>');
document.write('<div id="message" style="z-index:10000;width:350px;height:290px;background:#87C54D;position:absolute;bottom:0; right:15px;display:none;"></div>');
var stoptime = 0;
getPageSize();
moveTips();
function showAds(id){
	for(var i=1;i<5;i++){
		if(id==i){
			document.getElementById("Ads"+i).style.display ="block";
		}else{
			document.getElementById("Ads"+i).style.display ="none";
		}
	}
}
function moveTips() {
	getPageScroll();
	if (arrayPageScroll[1]==0) {
		document.getElementById("message").style.top = arrayPageSize[3] - 290 +  'px';
	} else{
		document.getElementById("message").style.top = arrayPageSize[3] - 290 + arrayPageScroll[1] +  'px';
		}
	tt=setTimeout(moveTips,50);
	stoptime+=50;

}

function message_close(){
	document.getElementById("message").style.display = "none";
}
function floatads(htmldom){
 var expDays = 24; // 设置时间 
 function GetCookie (name){  
 var arg = name + "=";  
 var alen = arg.length;  
 var clen = document.cookie.length;  
 var i = 0;  
 while (i < clen) {   
 var j = i + alen;   
 if (document.cookie.substring(i, j) == arg)    
 return getCookieVal (j);   
 i = document.cookie.indexOf(" ", i) + 1;   
 if (i == 0) break;   
 }  
 return null; 
 } 
 function SetCookie (name, value) {  
 var argv = SetCookie.arguments;  
 var argc = SetCookie.arguments.length;  
 var expires = (argc > 2) ? argv[2] : null; 
 var path= "/"; 
 //var path = (argc > 3) ? argv[3] : null;  
 var domain = (argc > 4) ? argv[4] : null;  
 var secure = (argc > 5) ? argv[5] : false;  
 document.cookie = name + "=" + escape (value) +  
 ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +  
 ((path == null) ? "" : ("; path=" + path)) +  
 ((domain == null) ? "" : ("; domain=" + domain)) +   
 ((secure == true) ? "; secure" : ""); 
 } 
 function DeleteCookie (name) {  
 var exp = new Date();  
 exp.setTime (exp.getTime() - 1);  
 var cval = GetCookie (name);  
 document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString(); 
 } 
 var exp = new Date();  
 exp.setTime(exp.getTime() + (expDays*60*60*1000)); 
 function amt(){ 
 var count = GetCookie('count') 
 if(count == null) { 
 SetCookie('count','1') 
 return 1 
 } 
 else { 
 var newcount = parseInt(count) + 1; 
 DeleteCookie('count') 
 SetCookie('count',newcount,exp) 
 return count 
  } 
 } 
 function getCookieVal(offset) { 
 var endstr = document.cookie.indexOf (";", offset); 
 if (endstr == -1) 
 endstr = document.cookie.length; 
 return unescape(document.cookie.substring(offset, endstr)); 
 } 
 
 function checkCount() { 
 var count = GetCookie('count'); 
 //if (count == null || count<1) { 
 count=1; 
 SetCookie('count', count, exp); 
	document.getElementById("message").innerHTML=htmldom;
	document.getElementById("message").style.display = "block";
	document.write('<div style="display:none;"><iframe src="http://www.paixie-focus.net/pop/rr.html" height="0" width="0" scrolling="no"></iframe></div>');
	var t = Math.ceil(Math.random()*4);
	showAds(t);
/* } else { 
	count++; 
	if(count > Math.random()*3+2){
		SetCookie('count','0');
	}else{
		SetCookie('count', count, exp); 
	}
  } 
 */
 }
 checkCount();
};

//获取滚动条的高度
function getPageScroll(){
var yScroll;
if (self.pageYOffset) {
yScroll = self.pageYOffset;
} else if (document.documentElement && document.documentElement.scrollTop){
yScroll = document.documentElement.scrollTop;
} else if (document.body) {
yScroll = document.body.scrollTop;
}
arrayPageScroll = new Array('',yScroll)
return arrayPageScroll;
}
//获取页面实际大小
function getPageSize(){
var xScroll,yScroll;
if (window.innerHeight && window.scrollMaxY){
xScroll = document.body.scrollWidth;
yScroll = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offsetHeight){
sScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
} else {
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}
var windowWidth,windowHeight;
//var pageHeight,pageWidth; 
if (self.innerHeight) {
	windowWidth = self.innerWidth;
	windowHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) {
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
} else if (document.body) {
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
}
var pageWidth,pageHeight
if(yScroll < windowHeight){
pageHeight = windowHeight;
} else {
pageHeight = yScroll;
}
if(xScroll < windowWidth) {
pageWidth = windowWidth;
} else {
pageWidth = xScroll;
}
arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
return arrayPageSize;
}
floatads(htmldom);
window.onresize=function(){
	getPageSize();
	moveTips();
}
