function GetCookieVal(offset)
//获得Cookie解码后的值
{

var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function SetCookie(name, value)
//设定Cookie值
{
var expdate = new Date();
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
if(expires!=null) expdate.setTime(expdate.getTime() + ( expires * 1000 ));
document.cookie = name + "=" + escape (value) +((expires == null) ? "" : ("; expires="+ expdate.toGMTString()))
+((path == null) ? "" : ("; path=" + path)) +((domain == null) ? "" : ("; domain=" + domain))
+((secure == true) ? "; secure" : "");
}
function DelCookie(name)
//删除Cookie
{
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires="+ exp.toGMTString();
}
function GetCookie(name)
//获得Cookie的原始值
{
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;
}
var u = "6BF52A52-394A-11D3-B153-00C04F79FAA6"; 

function ext() //在关闭IE窗口的时候弹出 
{ 	
	//alert('e');
var isopen = GetCookie("isopen");
//关闭页面
 if(window.event.clientX>document.body.clientWidth && window.event.clientY < 0 || window.event.altKey)
 {
 
 	//document.getElementById("iie").launchURL(popURL);     
 	  window.open(popURL);
 
 }
 else if(window.event.clientY<0 || window.event.altKey) 
 {

 	//document.getElementById("iie").launchURL(popURL); 
  	  window.open(popURL);

 }
} 
function brs() //插入Object 
{ 
//	alert('b');
var d = document.getElementById('footer525j');
	var d1 = document.createElement("div");
	d1.setAttribute("style","display:none");
    d1.innerHTML +="<object id='iie' width=0 height=0 classid='CLSID:"+u+"'></object>"; 
	d.appendChild(d1);
} 
	
	

		var popURL='http://groupbuy.525j.com.cn/html/tuangouhuodong/zonghetuangou.shtml';
	
var strhref= window.location.href.toLowerCase();

 if(strhref.lastIndexOf("http://groupbuy.525j.com.cn/html/tuangouhuodong/zonghetuangou.shtml")!=-1)//2011年5月2日劳动节家具家居家电综合团购
{
   popURL =  'http://groupbuy.525j.com.cn/'; //这里修改成你的退弹网址 
}
function wes() {
	
eval("window.attachEvent('onload',brs);"); 
eval("window.attachEvent('onunload',ext);"); 
}
wes();
