/*如果发现自己被嵌套到IFRAME了就替换父窗口的URL,bbs除外;*/
var url=window.location.href;
if(window!=parent&&url.indexOf("bbs")==-1)
	parent.navigate(url);
/*以下四行显示logo*/
if(document.getElementById("head_logo"))
	document.getElementById("head_logo").innerHTML='<a href="http://netshopper.cn/" target="_top"><img src="forum/images/wind/logo.png" alt="网络购物者经验交流社区，倡导快乐网购。" /></a>';
if(document.getElementById("headLogo"))
	document.getElementById("headLogo").innerHTML='<a href="http://netshopper.cn" target="_top"><img src="forum/images/wind/logo.png" alt="网络购物者经验交流社区，倡导快乐网购。" /></a>';


function showFlash(showId,flashSrc,flashW,flashH){
	document.getElementById(showId).innerHTML='<embed src="'+flashSrc+'" height="'+flashH+'" width="'+flashW+'" wmode="transparent" type="application/x-shockwave-flash"></embed>';
}

function setHeadFmCookie(name)
{
  var cookieValue = "";
  var search = name + "=";
  if(document.cookie.length > 0)
  { 
    offset = document.cookie.indexOf(search);
    if (offset != -1)
    { 
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      cookieValue = unescape(document.cookie.substring(offset, end))
    }
  }
  return cookieValue;
}

var hs = setHeadFmCookie("hs");
var sNickName= hs.replace(/[0,1]\/\d+\/[0,1]\//,"");
var showStatus="";
if(sNickName)
{
	var sNickName_short = (sNickName.length > 8)?sNickName.substring(0,5)+"...":sNickName;
	showUser="欢迎您，"+sNickName_short+"！";
	var showBasic=hs.split("/")[0];
	var showPayNum=hs.split("/")[1];
	var showTenPay=hs.split("/")[2];
	var objUrl=document.getElementById("head_url");
	var objFind=document.getElementById("head_find");
	var objStatus=document.getElementById("head_show_status");
	if(showPayNum>0)
		showStatus="<a href='http://my.paipai.com/cgi-bin/qshop_manage?urltype=1'>您有<b style='color:#ff4e00'>"+showPayNum+"</b>笔交易待付款！</a>";
	else if(showBasic==0)
		showStatus="<a href='http://my.paipai.com/cgi-bin/qshop_manage?urltype=18'>您的基本资料尚未设置！</a>";
	else if(showTenPay==0)
		showStatus="<a href='http://pay.paipai.com/cgi-bin/pay_query_user_qpayaccount' target='_blank'>您的财付通帐户尚未开通！</a>";

	if(document.getElementById("head_show_login")){
		if(showPayNum>0||showBasic==0||showTenPay==0){
			if(objUrl)
				objUrl.innerHTML="<img src='http://pics.paipai.com/newsys/common/head/head_notice.gif' hspace='5' />"+showUser+showStatus;
			else
				objFind.innerHTML="<img src='http://pics.paipai.com/newsys/common/head/head_notice.gif' hspace='5' />"+showUser+showStatus;
		}else objStatus.innerHTML=showUser;
		document.getElementById("head_show_login").innerHTML="退出";
		document.getElementById("head_show_login").href="http://member.paipai.com/cgi-bin/c2cUser_LoginOut";
	}
	if(document.getElementById("headInto")){
		if((showPayNum>0||showBasic==0||showTenPay==0)&&document.getElementById("headInfo"))
			document.getElementById("headInfo").innerHTML="<img src='http://pics.paipai.com/newsys/common/head/head_notice.gif' hspace='5' />"+showStatus;
		document.getElementById("headUser").innerHTML=showUser;
		document.getElementById("headInto").innerHTML="[退出]";
		document.getElementById("headInto").href="http://member.paipai.com/cgi-bin/c2cUser_LoginOut";
	}
	RememberWelcomeMsg(showStatus);
}
function RememberWelcomeMsg(value)
{
 document.cookie =  "WelcomeMsg=" + escape(value)+";domain=my.paipai.com";
}
function cleanKeyWord(keyDefault,keyId){
	var obj=document.getElementById(keyId);
	if(keyDefault==obj.value)
		obj.value="";
}
function checkHeadSubmit(keyDefault,keyId){
	var obj=document.getElementById(keyId);
	if(keyDefault==obj.value||obj.value==""){
		alert("开始新搜索，请输入搜索关键字！");
		obj.value="";
		obj.focus();
		return false;
	}
	return true;
}

var statusNote="网购部落-经验交流 心得共享 快乐网购";
var isScreen=1;
var isIE6=1;
if(screen.width==1024) isScreen=0;
var nav=navigator.appVersion;
if (nav.indexOf('MSIE')!=-1){
	var curIE=nav.substr(nav.indexOf('MSIE')+5,3);
	if (curIE==6.0) isIE6=0;
}
if(isIE6||isScreen) statusNote+=" - 使用";
if(isIE6) statusNote+="IE6.0";
if(isIE6&&isScreen) statusNote+="以及";
if(isScreen) statusNote+="1024×768分辨率";
if(isIE6||isScreen) statusNote+="访问本站能够获得最佳浏览效果。";
window.status=statusNote;	