if (typeof(VIPSHOP) == 'undefined' || !VIPSHOP )
{
	var VIPSHOP = {};
	VIPSHOP.version = '0709';
}

function $()
{
    return document.getElementById(arguments[0]);
}


VIPSHOP.cookie = {
    set: function(name, value, domain, path, hour) {
        if (hour) {
            var today = new Date();
            var expire = new Date();
            expire.setTime(today.getTime() + 3600000 * hour);
        }
        document.cookie = name + "=" + value + "; " + (hour ? ("expires=" + expire.toGMTString() + "; ") : "") + (path ? ("path=" + path + "; ") : "path=/; ") + (domain ? ("domain=" + domain + ";") : ("domain=" + QZFL.config.domainPrefix + ";"));
        return true;
    },
    get: function(name) {
        var r = new RegExp("(?:^|;+|\\s+)" + name + "=([^;]*)");
        var m = document.cookie.match(r);
        return (!m ? "": m[1]);
    },
    del: function(name, domain, path) {
        document.cookie = name + "=; expires=Mon, 26 Jul 1997 05:00:00 GMT; " + (path ? ("path=" + path + "; ") : "path=/; ") + (domain ? ("domain=" + domain + ";") : ("domain=" + QZFL.config.domainPrefix + ";"));
    }
};

var AjaxRequest=function(url,ajaxOptions)
{
	this.XmlHttpGetMessages=this.CreateXmlHttpRequestObject();
	this.Url=url;
	this.AjaxOptions=ajaxOptions;
	this.Exist=false;
}

AjaxRequest.prototype.Create=function()
{	
	this.RequestMessage();
}

AjaxRequest.prototype.RequestMessage=function()
{
	var oThis=this;
	if(this.XmlHttpGetMessages)
	{
		try
		{

			if(this.XmlHttpGetMessages.readyState==4||this.XmlHttpGetMessages.readyState==0)
			{

				if(this.AjaxOptions.parameters)
					this.Url+="?"+this.AjaxOptions.parameters;
				if(this.AjaxOptions.method.toLowerCase()=="get")
				{
					this.XmlHttpGetMessages.open(this.AjaxOptions.method,this.Url,true);
					this.XmlHttpGetMessages.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
					this.XmlHttpGetMessages.onreadystatechange=function(){oThis.HandleReceivingMessages();};
					this.XmlHttpGetMessages.send(null);
				}
				else
				{
					this.XmlHttpGetMessages.open(this.AjaxOptions.method,this.Url,true);
					this.XmlHttpGetMessages.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
					this.XmlHttpGetMessages.onreadystatechange=function(){oThis.HandleReceivingMessages();};
					this.XmlHttpGetMessages.send(this.AjaxOptions.parameters);
				}
			}
			else
			{
				setTimeout("AjaxRequest.RequestMessage();",0.5);
			}
		}
		catch (e)
		{
			document.write(e.toString());
		}
	}
}

AjaxRequest.prototype.HandleReceivingMessages=function()
{
	if(this.XmlHttpGetMessages.readyState==4)
	{
		if(this.XmlHttpGetMessages.status==200)
		{
			try
			{
				this.AjaxOptions.onComplete.call(this,this.XmlHttpGetMessages);//等价于下面的注释
			}
			catch (e)
			{		
				document.write(e.toString());
			}
		}
		else
		{
			alert(this.XmlHttpGetMessages.statusText+"  error number "+this.XmlHttpGetMessages.readyState+"  try again.");
		}
	}
}

AjaxRequest.prototype.CreateXmlHttpRequestObject=function()
{
	
	var xmlHttp;
	if(window.ActiveXObject)
	{
		try
		{				
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch (e)
		{
			
			xmlHttp=false;
		}
	}
	else
	{
		try
		{
			xmlHttp=new XMLHttpRequest();
		}
		catch (e)
		{
			xmlHttp=false;
		}
	}

	if(!xmlHttp)
		alert("error");
	else
		return xmlHttp;
}

var dv_timer,divTop, divLeft, divWidth, divHeight, docHeight, docWidth, objTimer, t_i=0, h_i = 0, pageWidth=970;
function show_cart_warning(t) {
	try {
		dv_timer = setTimeout(getMsg, t);
		window.onresize = resizeDiv;
		window.onscroll = resizeDiv;
	
	
		divHeight = parseInt($("eMeng").offsetHeight, 10);
		divWidth = parseInt($("eMeng").offsetWidth, 10);
	}
	catch (e) {
		return false;
	}
}

function $a(id,tag){var re=(id&&typeof id!="string")?id:document.getElementById(id);if(!tag){return re;}else{return re.getElementsByTagName(tag);}}

var f_request_mail = f_mail = f_pwd = f_pwd2 =f_username = f_verify = f_term = false;
function reg_check(frm)
{
	check_reg_request_mail();
	check_reg_verify();
	f_term=check_reg_term();
	//sleep(1000);
	var bok = check_birthday(frm);
	if(!bok) {
		alert("请输入正确的生日，格式 19881201");
		return false;
	}
	if(!f_request_mail || !f_mail || !f_pwd || !f_pwd2 ||!f_term)
	{
		alert('请把注册内容填写完整');
		return false;
	}
	return true;
}
function check_birthday (frm) {
	if(typeof(frm.birthday) != 'undefined') {
		var bok = isDate(frm.birthday.value);
		if(!bok) {
			$('birthday_span').innerHTML = '<img src="/img/account/check_wrong.jpg" width="13" height="13"/>';
		} else{
			$('birthday_span').innerHTML = '<img src="/img/account/check_right.jpg" width="13" height="13"/>';
		}
		return bok;
	}	
	return true;
}
function isDate(str) {
	var r = str.match(/^(19\d{2})(\d{2})(\d{2})$/);
	if(r==null)
	 return false
	var d= new Date(r[1], r[2]-1, r[3]);
	return (d.getFullYear()==r[1]&&(d.getMonth()+1)==r[2]&&d.getDate()==r[3]);
}

function changeValidate()
{
	$("verify_image").src = "/comm/authimg.php?v="+parseInt(Math.random()*(1000-1)+1);
}

function FocusImg(time,foc,fbimg)
{
	var beg=$a($a(fbimg,"dd")[0],"div")[0];beg.check=true;
	var au=$a(foc,"a"),now=1,tm;var bimgs=$a(foc,"img");var vimg=new Image();vimg.src=bimgs[0].src;
	var ba=$a($a(fbimg,"dt")[0],"a")[0];ba.href=au[0].href;ba.onfocus=function(){this.blur()};
	var bt=$a(fbimg,"dt")[0];bt.appendChild(vimg);
	var bi=$a(bt,"img")[1];bi.alt=bimgs[0].alt;
	var bp=$a($a(fbimg,"dd")[0],"ul")[0];
	var len=au.length;for(var i=0;i<len;i++){bp.innerHTML+="<li>"+(i+1)+"</li>";}
	var bps=$a(bp,"li");bps[0].className="show";function pfn(i){bps[i].onclick=function(){go(i);if(beg.check){clearInterval(tm);init();}else{clearInterval(tm)}}}for(var i=0;i<len;i++){pfn(i);}
	function xunhuan(){if(/*@cc_on!@*/false){bi.style.filter="progid:DXImageTransform.Microsoft.Wipe(GradientSize=1.0,motion=forward)";bi.filters[0].Apply();bi.filters[0].Play(duration=1);}
	ba.href=au[now].href;bi.src=bimgs[now].src;bi.alt=bimgs[now].alt;for(var i=0;i<len;i++){bps[i].className="";}bps[now].className="show";(now<len-1)?now++:now=0;}
	function init(){tm=setInterval(xunhuan,time);};function go(n){clearInterval(tm);now=n;xunhuan();init();}init();
	beg.onclick=function(){if(beg.check){beg.check=false;clearInterval(tm);beg.innerHTML="PLAY";}else{beg.check=true;clearInterval(tm);xunhuan();init();beg.innerHTML="STOP";}};
}

var L_small_div=null;
var L_show_div=null;
var globle_to_url="";
function showlayer()
{
	var div=document.getElementById("bigdiv");
	var d_height=document.body.clientHeight;
	var d_width=document.body.clientWidth;
	var s_a_height=window.screen.availHeight;
	var scrollTop = window.pageYOffset|| document.documentElement.scrollTop|| document.body.scrollTop|| 0;
	div.style.height=d_height+"px";
	div.style.width=d_width-2+"px";
	div.style.backgroundColor="#666666";
	if (window.XMLHttpRequest)
	{ 
 		if(!window.ActiveXObject)
		{ 
			 div.style.opacity="0.6";
		 } 
		 else 
		 {
			div.style.filter ="alpha(opacity=60)";
 		 }
	} 
	else 
	{
		div.style.filter ="alpha(opacity=60)";
		
		for(var i=0; i<document.all.tags("select").length;i++)
			document.all.tags("select")[i].style.display="none";
	}
	div.style.display="block";
	L_small_div.style.top=s_a_height/2-parseInt(L_small_div.style.height)/2+scrollTop-50+"px";
	L_small_div.style.left=d_width/2-parseInt(L_small_div.style.width)/2+"px";
	L_small_div.style.display="block";

	if(document.getElementById("online_flash"))
		document.getElementById("online_flash").style.visibility="hidden";

	if(document.getElementById("soon_online_flash"))
		document.getElementById("soon_online_flash").style.visibility="hidden";
	
	if(document.getElementById("em_show_swf"))
		document.getElementById("em_show_swf").style.visibility="hidden";

	if(document.getElementById("ad_flash_g"))
		document.getElementById("ad_flash_g").style.visibility="hidden";
}

function show_div()
{
	var div=document.getElementById("bigdiv");
	var d_height=document.body.clientHeight;
	var d_width=document.body.clientWidth;
	
	var s_a_height=window.screen.availHeight;
	var scrollTop = window.pageYOffset|| document.documentElement.scrollTop|| document.body.scrollTop|| 0;

	div.style.height=d_height+"px";
	div.style.width=d_width-2+"px";
	div.style.backgroundColor="#666666";
	if (window.XMLHttpRequest)
	{ 
 		if(!window.ActiveXObject)
		{
			 div.style.opacity="0.6";
		 } 
		 else 
		 {
			div.style.filter ="alpha(opacity=60)";
 		 }
	} 
	else 
	{
		div.style.filter ="alpha(opacity=60)";
		
		for(var i=0; i<document.all.tags("select").length;i++)
			document.all.tags("select")[i].style.display="none";
	}
	div.style.display="";

	L_show_div.style.top=s_a_height/2-parseInt(L_show_div.style.height)/2+scrollTop-50+"px";
	L_show_div.style.left=d_width/2-parseInt(L_show_div.style.width)/2+"px";
	L_show_div.style.display="block";

	if(document.getElementById("online_flash"))
		document.getElementById("online_flash").style.visibility="hidden";

	if(document.getElementById("soon_online_flash"))
		document.getElementById("soon_online_flash").style.visibility="hidden";
	
	if(document.getElementById("em_show_swf"))
		document.getElementById("em_show_swf").style.visibility="hidden";

	if(document.getElementById("ad_flash_g"))
		document.getElementById("ad_flash_g").style.visibility="hidden";
}
//关闭一个能把整个页面都覆盖的div 
function L_colosediv()
{
	
	var div=document.getElementById("bigdiv");

	if(typeof($('login_div')) != 'undefined') {
		$('login_div').innerHTML = ' ';
	}
	
	if(window.ActiveXObject)
		for(var i=0; i<document.all.tags("select").length;i++)
				document.all.tags("select")[i].style.display="";
	
	if(self.frames["rightFrame"])
	{
		if(window.ActiveXObject)
			for(var i=0; i<self.frames["rightFrame"].document.all.tags("select").length;i++)
					self.frames["rightFrame"].document.all.tags("select")[i].style.display="";
	}
	div.style.display="none";
	L_small_div.style.display="none";
	
	if(document.getElementById("online_flash"))
		document.getElementById("online_flash").style.visibility="inherit";

	if(document.getElementById("soon_online_flash"))
		document.getElementById("soon_online_flash").style.visibility="inherit";
	
	if(document.getElementById("em_show_swf"))
		document.getElementById("em_show_swf").style.visibility="inherit";

	if(document.getElementById("ad_flash_g"))
		document.getElementById("ad_flash_g").style.visibility="inherit";
}

function L_showdiv()
{
	
	var div=document.getElementById("bigdiv");
	
	if(window.ActiveXObject)
		for(var i=0; i<document.all.tags("select").length;i++)
				document.all.tags("select")[i].style.display="";
	
	if(self.frames["rightFrame"])
	{
		if(window.ActiveXObject)
			for(var i=0; i<self.frames["rightFrame"].document.all.tags("select").length;i++)
					self.frames["rightFrame"].document.all.tags("select")[i].style.display="";
	}
	div.style.display="none";
	L_show_div.style.display="none";
	
	if(document.getElementById("online_flash"))
		document.getElementById("online_flash").style.visibility="inherit";

	if(document.getElementById("soon_online_flash"))
		document.getElementById("soon_online_flash").style.visibility="inherit";
	
	if(document.getElementById("em_show_swf"))
		document.getElementById("em_show_swf").style.visibility="inherit";

	if(document.getElementById("ad_flash_g"))
		document.getElementById("ad_flash_g").style.visibility="inherit";
}



function InitAjax()
{
　var ajax=false; 
　try { 
　　ajax = new ActiveXObject("Msxml2.XMLHTTP"); 
　} catch (e) { 
　　try { 
　　　ajax = new ActiveXObject("Microsoft.XMLHTTP"); 
　　} catch (E) { 
　　　ajax = false; 
　　} 
　}
　if (!ajax && typeof XMLHttpRequest!='undefined') { 
　　ajax = new XMLHttpRequest(); 
　} 
　return ajax;
}

function getinfo(id,url)
{
　
　var show = document.getElementById(id); 
　var ajax = InitAjax();

　ajax.open("GET", url, true); 

　ajax.onreadystatechange = function() { 
　
　　if (ajax.readyState == 4 && ajax.status == 200) { 
　　　show.innerHTML = ajax.responseText; 
　　} 
	/*else{
            show.innerHTML = " connection error!"; 
       }*/ 
　}
　　ajax.send(null); 
}

function UrlEncode(str){
	var m="",sp="!'()*-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~"
	for(var i=0;i<str.length;i++){
		if(sp.indexOf(str.charAt(i))!=-1){
			m+=str.charAt(i)	
		}else{
			var n=str.charCodeAt(i)
			var t="0"+n.toString(8)
			if(n>0x7ff)
				m+=("%"+(224+parseInt(t.slice(-6,-4),8)).toString(16)+"%"+(128+parseInt(t.slice(-4,-2),8)).toString(16)+"%"+(128+parseInt(t.slice(-2),8)).toString(16)).toUpperCase()
			else if(n>0x7f)
				m+=("%"+(192+parseInt(t.slice(-4,-2),8)).toString(16)+"%"+(128+parseInt(t.slice(-2),8)).toString(16)).toUpperCase()
			else
				m+=("%"+("0"+n.toString(16)).slice(-2)).toUpperCase()
		}
	}
	return m;
}


//把全角数字转成半角数字
function tot(mobnumber)
{
	while(mobnumber.indexOf("０")!=-1){
		mobnumber = mobnumber.replaceAll("０","0");        
		}
	while(mobnumber.indexOf("１")!=-1){
		mobnumber = mobnumber.replaceAll("１","1");
		}
	while(mobnumber.indexOf("２")!=-1){
		mobnumber = mobnumber.replaceAll("２","2");
		}
	while(mobnumber.indexOf("３")!=-1){
		mobnumber = mobnumber.replaceAll("３","3");
		}
	while(mobnumber.indexOf("４")!=-1){
		mobnumber = mobnumber.replaceAll("４","4");
		}
	while(mobnumber.indexOf("５")!=-1){
		mobnumber = mobnumber.replaceAll("５","5");
		}
	while(mobnumber.indexOf("６")!=-1){
		mobnumber = mobnumber.replaceAll("６","6");
		}
	while(mobnumber.indexOf("７")!=-1){
		mobnumber = mobnumber.replaceAll("７","7");
		}
	while(mobnumber.indexOf("８")!=-1){             
		mobnumber = mobnumber.replaceAll("８","8");
		}
	while(mobnumber.indexOf("９")!=-1){
		mobnumber = mobnumber.replaceAll("９","9");
		}
	return mobnumber;
}

function is_price(string)
{
	var pattern=/^[0-9]{1,}$/;
	return pattern.test(string);
}

function is_num(string)
{
	string=Math.abs(string);
	var pattern=/^[0-9]+$/;
	return pattern.test(string);
}

function is_email(email)
{
	var pattern=/([\w|_|\.|\+]*)@(\w*)\.([\w]+)/;
	return pattern.test(email);
}

function is_phone(email)
{
		var pattern = /^1\d{10}$/;
		return pattern.test(email);
}

function is_QQ(email)
{
		var pattern = /^\d{4,}$/;
		return pattern.test(email);
}

function sleep(n)
{
	var start=new Date().getTime();
	while(true)  if(new Date().getTime()-start>n) break;
}
      
function change_title()
{
	var t = document.title;
	if (t.substring(0,5)!= '购物袋提示')
		document.title = '购物袋提示 ' + t;
	else
		document.title = t.replace('购物袋提示 ', '');
}

var s_t_timer;
function getMsg()
{
	try{
		divTop = parseInt($("eMeng").style.top, 10);
		divLeft = parseInt($("eMeng").style.left, 10);
		docWidth = document.documentElement.clientWidth;
		docHeight = document.documentElement.clientHeight;
		$("eMeng").style.top = parseInt(document.documentElement.scrollTop, 10) + docHeight + 10 + 'px';// divHeight

		$("eMeng").style.left = parseInt(document.documentElement.scrollLeft, 10) + docWidth - divWidth + 'px';
		$("eMeng").style.visibility='visible';
		$("eMeng").style.display="block";
		objTimer = window.setInterval(moveDiv, 10);
		if (document.all)
		{
			s_t_timer = setInterval(change_title, 1500);
		}
	} catch(e) {
	}
}

/**
 * 用于设置判断信息框停留时间, 以及窗口大小或位置改变时信息框的位置设置
 */
function resizeDiv()
{
	t_i += 1; // 用于保存计算信息框停留的时间
	if (t_i > 1300) {
		closeDiv(); // 客户想不用自动消失由用户来自己关闭所以屏蔽这句
	}
	try{ // 此代码仅当在窗口变化时可起作用, 而不使信息框消失等...
		docWidth = document.documentElement.clientWidth;
		docHeight = document.documentElement.clientHeight;

		$("eMeng").style.top = docHeight - divHeight + parseInt(document.documentElement.scrollTop, 10) + 'px';
		$("eMeng").style.left = docWidth - divWidth + parseInt(document.body.scrollLeft, 10) + 'px';
	} catch(e) {
	}
}

/**
 * 控制窗口渐渐上升显示
 */
function moveDiv()
{
	h_i++;
	try {
		if(h_i > divHeight+10) {
			window.clearInterval(objTimer);
			//objTimer = window.setInterval("resizeDiv()", 1);
		}
		divTop = parseInt($("eMeng").style.top, 10);
		$("eMeng").style.top = divTop - 1 + 'px';
	} catch (e){
	}
}

/**
 * 关闭信息框
 */
function closeDiv()
{
	$('eMeng').style.display = 'none';
	if (objTimer) {
		window.clearInterval(objTimer);
	}
	if (s_t_timer)
		window.clearInterval(s_t_timer);
}

// 改变样式

function changeStyle(obj,num)
{
	for(var i=1;i<=8;i++)
	{
		if (!$("imgBox"+i))
			continue;
		var path=document.getElementById("imgBox"+i).src;
		var pos=path.lastIndexOf("/");
		var file_name=path.substr(pos+1,path.length);
		var path_t=path.substr(0,pos);

		if(i!=num)
		{
			file_name=file_name.replace(/ac_/,"");
			document.getElementById("imgBox"+i).src=path_t+"/"+file_name;	
		}
		else
		{
			if(file_name.indexOf("ac_")<0)
			{
				document.getElementById("imgBox"+i).src=path_t+"/"+"ac_"+file_name;
			}
		}
			
	}

	for(var i=1;i<=22;i++)
	{
		if($("li"+i))
			$("li"+i).childNodes[0].className="initA";
	}
	obj.className="initCl";
}

//
function no_flash()
{
	$("brand_flash").style.visibility="hidden";
	showlayer();
}

function format_money(tmp)
{   
  var tmp2=tmp.split(".");
  tmp = tmp2[0];
  var tmp3=tmp2[1];
  if(typeof(tmp3)=="undefined")
  	tmp3="00";
  var tmp1=Math.round((tmp3/Math.pow(10,tmp3.length))*100)
  tmp1=tmp1.toString()
  if(tmp1.length==1)
  	tmp1="0"+tmp1
  
  var   signa=0
  var   ll=tmp.length
  if   (ll%3==1){
  tmp="00"+tmp
  signa=2
  }
  if(ll%3==2){
  tmp="0"+tmp
  signa=1
  }
  var   tt=(tmp.length)/3
  var   mm=new   Array()
  for   (var   i=0;i<tt;i++){
  mm[i]=tmp.substring(i*3,3+i*3)
  }

  var   vv=""
  for(var   i=0;i<mm.length;i++)
  vv+=mm[i]+","


  vv=vv.substring(signa,vv.length-1)+"."+tmp1
  return vv;
}

function bbs_logout()
{
	$('ife_ajax_login').src = 'surface.php?act=logout';
	$("register_gift").style.display="";
}

function L_login()
{
	L_small_div=parent.document.getElementById("login_div");
	if (!L_small_div)
	{
		setTimeout(L_login, 800);
		return false;
	}
	L_small_div.innerHTML = '<div class="login_Borders"><div style="float:right;margin-right:5px;"><img src="/images/btn.gif" border="0" onclick="L_colosediv()" style="cursor:pointer;" /></div><form name="frm_ajax_login" target="ife_ajax_login" action="/blank.html" method="post" style="margin:0"><div style="width:200px; height:300px; float:left; padding:24px 15px 24px 20px;"><p style="text-align:center;"><img src="/images/qrtj_06.gif" /></p><div><img src="/images/top_l.gif" /><div style="border-left:1px solid #DED2D2;border-right:1px solid #DED2D2;width:212px; padding:10px 0 15px 0; background:#F7F4F7"><div id="invite_msg"></div><p style="margin-left:15px;">登录帐号：<input name="user_login_email" type="text" id="user_login_email"  maxlength="50" style="background-image: url(/images/input.jpg);background-repeat: no-repeat;height: 16px;width: 118px;background-position:right bottom;margin:auto auto;background-color: transparent;border:0px;font-size:12px;color: #999999;margin:auto auto" /></p><br /><p style="margin-left:15px;">密&nbsp; &nbsp; &nbsp; &nbsp; 码：<input name="user_login_password" type="password" id="user_login_password" maxlength="50" style="background-image: url(/images/input.jpg);background-repeat: no-repeat;height: 16px;width: 118px;background-position:right bottom;margin:auto auto;background-color: transparent;border:0px;font-size:12px;color: #999999;margin:auto auto" onkeypress="if (window.event.keyCode==13)login()" /></p><span style=" display:block;margin:17px 0 20px 60px;"><input type="image" src="/images/btn_1.gif" value="提交" style="vertical-align:middle" onclick="login()" /><a href="/account/password.php" target="_blank"  style="color:#898989; text-decoration:underline">忘记密码</a></span><span style="width: 156px; margin: 25px auto 6px; display: block;"><a href="/aliuser/" onclick="javascript:window.open(\'/aliuser/?return=\'+encodeURIComponent(location));L_colosediv(); return false;"><img src="/images/alipay_dl.gif" border="0" /></a></span><span style="width: 156px; margin: 20px auto 6px; display: block;"><a href="/bill/send.php" onclick="javascript:window.open(\'/bill/send.php?return=\'+encodeURIComponent(location));L_colosediv(); return false;"><img src="/images/kqdl.gif" border="0" style="margin:10px auto" /></a></span><p style="margin-top:4px;" /></div><img src="/images/bot_l.gif" /></div></div></form><form name="regForm" action="/invitation.php" method="post" style="margin:0" onsubmit="return reg_check(this)" target="regFrame"><input type="hidden" name="act" value="submit"/><input type="hidden" name="user_login_email" id="user_login_email" value="" /><input type="hidden" name="user_login_password" id="user_login_email" value="" /><div style="width:410px; float:left; padding-top:0; padding-left:15px;"> <p style="text-align:center;"><img src="/images/qrtj_09.gif" /></p><div ><img src="/images/top_r.gif" /><div style="border-left:1px solid #DED2D2; border-right:1px solid #DED2D2; padding:10px 0 5px 15px;width:383px; background:#F7F4F7"> <p>邀 请 人：<input id="reg_request_mail" name="reg_request_mail" type="text" class="input1" onblur="if(this.value ==\'\') this.value=$(\'invite_mail\').value\';check_reg_request_mail();" onfocus="if(this.value==$(\'invite_mail\').value)this.value=\'\'" value="invite@vipshop.com"/><span style="color: #AE1128;" id="reg_request_mail_span"></span></p><p style="line-height:5px;">登 录 名：	<input  type="radio" name="reg_login_type" value="phone" checked="checked" onclick="show_tip(\'mail_tip\',\'none\');$(\'phone_tip\').innerHTML=\'手机注册可获700积分。\';"/>	    手机	      <input type="radio" name="reg_login_type" value="qq" onclick="show_tip(\'mail_tip\',\'none\');$(\'phone_tip\').innerHTML=\'QQ注册可获500积分。\';"/>	      QQ号	      <input type="radio" name="reg_login_type" value="msn" onclick="show_tip(\'mail_tip\',\'none\');$(\'phone_tip\').innerHTML=\'MSN注册可获500积分。\';"/>	      MSN帐号      <input type="radio" name="reg_login_type" value="email" onclick="show_tip(\'mail_tip\',\'\');$(\'phone_tip\').innerHTML=\'E-mail注册可获500积分。\';"/>	      E-mail </p>  <p id=\'mail_tip\' style=\'color:#AE1128;display:none\'>为确保能正常接网站信息，建议填写163以外的邮箱。</p>	  <p style="margin-left:54px;*margin-left:30px; _margin-left:30px; line-height:5px;"><input id="reg_mail" name="reg_mail" type="text" class="input1" onblur="check_reg_mail()" value=""/> <span style="color: #AE1128;" id="reg_mail_span"></span></p>	  <p style="display:none;" id="phone_tip">手机注册可获700积分。</p><p style="line-height:5px;">性 &nbsp;&nbsp;&nbsp; 别：	    <input type="radio" name="reg_sex" value="1" />	    男	    <input name="reg_sex" type="radio" value="0" checked="checked" />	    女	  </p> <p style="line-height:5px;">生 &nbsp;&nbsp;&nbsp; 日：&nbsp;&nbsp;<input id="birthday"name="birthday" style="width:94px;" onblur="check_birthday(this.form)"  type="text" class="input1"  /> &nbsp; 可用于找回密码，填写格式19891201<span style="color: #AE1128;" id="birthday_span"></span>  <p style="line-height:5px;">登录密码：<input id="reg_pwd"name="reg_pwd"  type="password" class="input1" onblur="check_reg_pwd()" /> &nbsp;6-12个字符<span style="color: #AE1128;" id="reg_pwd_span"></span> </p>  <p style="line-height:5px;">确认密码：<input id="reg_pwd2" name="reg_pwd2" type="password" class="input1" onblur="check_reg_pwd2()" /><span style="color: #AE1128;" id="reg_pwd2_span"></span>   </p>  <p style="line-height:5px;">验 证 码：<input id="reg_verify" name="reg_verify" type="text"  class="input1"  style="width:94px; height:15px;" onblur="check_reg_verify()" />  <img src="http://www.vipshop.com/tr.gif" align="absmiddle" id="verify_image" />&nbsp;&nbsp;<span onclick="changeValidate()"  style="cursor:pointer; color: #AE1128;">看不清，换一张</span><span style="color: #AE1128;" id="reg_verify_span"></span> </p>	 <p style=" margin:8px auto;"><input id="reg_term" name="reg_term" type="checkbox" value="checkbox" checked="checked" onclick="check_term()"/> <u> <a href="/clause.php" target="_blank" style="color:#999">我已阅读并接受VIPSHOP服务条款。</a></u><span style="color: #AE1128;" id="reg_term_span"></span></p> <input type="image" src="/images/qrtj.gif" style="margin-left:103px; margin-bottom:8px"  /> 	</div><img src="/images/bot_r.gif" /></div></div></form><div style="clear:both"></div></div><iframe name="regFrame" id="regFrame" style="display:none"></iframe>';

	if ($('verify_image').src == 'http://www.vipshop.com/tr.gif') {
		$('verify_image').src = '/comm/authimg.php';
	}
	
	if (globle_to_url != '/account/account_index.php?act=other.html')
	{
		$('invite_msg').style.display = 'none';
		$('login_div').style.height = '410px';
	}
	else
	{
		$('invite_msg').style.display = 'block';
		$('login_div').style.height = '410px';
	}
	showlayer();

	if (globle_to_url != '/shop/guest_login.php?act=cart_clean&reg=1')
		$("user_login_email").focus();
	else
		$("reg_mail").focus();

	var login_un = VIPSHOP.cookie.get('login_username').replace('%40', '@');

	if (is_email(login_un) || is_phone(login_un) || is_QQ(login_un)) {
		$("user_login_email").value = login_un;
	}
}

function login(flag)
{	
	var url="/loginout.php";
	/*邀请朋友时,用户注册后，调用login*/
	if(flag == 'invite'){
		var userEmail=document.getElementById("user_login_email").value;
		var userPassword=document.getElementById("user_login_password").value;
	}
	/*七月邀请有礼活动注册入口*/
	else if(flag == 'july_activity'){
		//L_small_div=parent.document.getElementById("login_div");
		var userEmail=parent.document.getElementById("july_login_email").value;
		var userPassword=parent.document.getElementById("july_login_password").value;
	}
	else if(flag==1)
	{
		L_small_div=parent.document.getElementById("login_div");
		var userEmail=parent.document.getElementById("user_name_frame").value;
		var userPassword=parent.document.getElementById("user_password_frame").value;
	}	
	else
	{
		var userEmail=parent.document.getElementById("user_login_email").value;
		var userPassword=parent.document.getElementById("user_login_password").value;
	}
	if ($('verify_image').src == '')
		$('verify_image').src = '/comm/authimg.php';
	var pars="act=login&email="+encodeURI(userEmail)+"&password="+encodeURI(userPassword)+'&v='+Math.round(Math.random()*1000000);
	var ajax=new AjaxRequest(url,{method:"get",parameters:pars,onComplete:responseLogin});
	ajax.Create();
}

function responseLogin(originHttpRequest)
{
	var response=originHttpRequest.responseText;
	if(response)
	{
		var _arr=response.split("@@");

		if(_arr[0]=="ok")
		{
			/*begin: add in 2009-07-06 邀请朋友流程优化*/
			is_login='true';
			/*end: add in 2009-07-06 */
			
			/*if ($("hid_shop_index"))
			{
				var url="index.php";
				var pars="act=cart_clean";
				var ajax=new AjaxRequest(url,{method:"get",parameters:pars,onComplete:cart_clean});
				ajax.Create();
				return false;
			}*/
			
			if ($('hd_cart_recover')){
				document.frm_cart.submit();
				return;
			}
			
			/*if($("login_message"))
			{
				$("login_message").innerHTML=_arr[1];
				if($("login_tb"))
					$("login_tb").style.display="none";
			}*/
			
			if ($('div_user_info')) {
				$('div_user_info').innerHTML=_arr[1];
			}
			
			
			L_colosediv();
			
			if (globle_to_url) {
				window.location = globle_to_url
			}

			/*if(globle_to_url)
			{
				if(globle_to_url=="/@@@flag=1")
				{
					getMMessage();
					globle_to_url="";
					return false;
				}
				else if (globle_to_url == 'one.php') {
					parent.get_one_fav();
					return false;
				}
				var tmp_url=globle_to_url;
				globle_to_url="";
				window.location=tmp_url;
			}*/

			globle_to_url="";
			return false;
			
			//add by Summer in 02-04-2009
			document.frm_ajax_login.submit();
		}
		else if (_arr[0]=="false1")
			alert("抱歉,您的账户尚未激活！");
		else if (_arr[0]=="false2")
			alert("您好，您的帐户已被冻结。有任何疑问请致电：400-6789-888与客服联系。");	
		else if (_arr[0]=="false3")
			alert("抱歉,网盟用户已暂停登录！")	
		else alert("抱歉,用户名或者密码有错");
	}
}

//判断是否登录

function isLogin(url)
{
	if (url == 'hold') {
		globle_to_url="";

		var url="/loginout.php";
		var pars="act=islogin";
		var ajax=new AjaxRequest(url,{method:"get",parameters:pars,onComplete:responseIsLogin});
		ajax.Create();
	}
	else if(url=="/@@@flag=1")
	{
		
		if($("L_user_name")&&$("L_user_name").innerHTML!="")
		{
			getMMessage();
			return false;
		}

		if(url)
			globle_to_url=url;
		else
			globle_to_url="";

		var url="/loginout.php";
		var pars="act=islogin";
		var ajax=new AjaxRequest(url,{method:"get",parameters:pars,onComplete:responseIsLogin});
		ajax.Create();
		return false;
		
	}
	else if($("L_user_name"))
	{
		if (arguments[1] != 1)
			window.location=url;
		else
			window.open(url);
		return false;
	}
	else
	{
		
		if(url)
			globle_to_url=url;
		else
			globle_to_url="";

		var url="/loginout.php";
		var pars="act=islogin";
		var ajax=new AjaxRequest(url,{method:"get",parameters:pars,onComplete:responseIsLogin});
		ajax.Create();
	}
}

function showLoading(ret) {
	L_small_div=parent.document.getElementById("login_div");
	L_small_div.innerHTML ='';
	showlayer();

}

function responseIsLogin(originHttpRequest)
{
	var response=originHttpRequest.responseText;
	if(response=="false")
	{
		L_login();
	}

	if(response=="ok")
	{
		if($("merchandiseDetail_id"))
		{
			getMMessage();
		}
		else
		{	
				if(globle_to_url)
				{
					var tmp_url=globle_to_url;
					globle_to_url="";
					window.location=tmp_url;
				} else {
				    window.location = window.location;
				}
		}
	}
}

function local_reg_success(response)
{
	if(response=="false")
	{
		L_login();
	}
	if(response=="ok")
	{
		if($("merchandiseDetail_id"))
		{
			getMMessage();
		}
		else if ($("hid_shop_index"))
		{
			var url="index.php";
			var pars="act=cart_clean";
			var ajax=new AjaxRequest(url,{method:"get",parameters:pars,onComplete:cart_clean});
			ajax.Create();
			return false;
		}
		else
		{	
			if(globle_to_url)
				{
					var tmp_url=globle_to_url;
					globle_to_url="";
					window.location=tmp_url;
				}/*如果不跳转,显示登陆名，用户邀请朋友页面*/
				else{
					document.getElementById("user_login_email").value = document.getElementById("reg_mail").value;
					document.getElementById("user_login_password").value = document.getElementById("reg_pwd").value;
					login('invite');
					sleep(1000);
					window.location = window.location;
				}
		}
	}
}

function cart_clean(originHttpRequest) {
	var response=originHttpRequest.responseText;
	if (response == '0' || response == '2')	//已登录
	{
		window.location=globle_to_url;
	}
	else if (response == '1')	//都没库存
	{
		$('login_div').style.display = 'none';
		L_small_div=$("div_get_fav");
		showlayer();
	}
	else if (response == '3'){	//部分没库存
		$('login_div').style.display = 'none';
		L_small_div=$("div_already_get");
		showlayer();
	}

}

var gocart_flag = true;
//获取和提交商品信息
function getMMessage(f)
{
	if (!gocart_flag|| !f) {
		window.location = window.location;
	    return false;
	}
	
	var mid = $("merchandiseDetail_id").value;
	var size=$("L_size").value;
	var num=$("merchandise_num").value;
	
	if (!mid || !size || !num) {
		alert('商品数据载入中，请稍后再试！');
		return false;
	}
	
	if (size == '0') {
		alert('请先选择尺码！');
		return false;
	}
	if (num=='0'||mid==''){
		alert('商品已售完！');
		return false;
	}
	var url =  "/shop/index.php?act=add&id="+mid+"&size="+size+"&merchandise_num="+num;
	if ($('size_relate_id'))
		url += '&relate_id=' + $('size_relate_id').value;
	
	if ($('onsale_day') && $('onsale_day').value == '1') {
		isLogin(url);
		return false;
	}
	
	var login_un = VIPSHOP.cookie.get('login_username').replace('%40', '@');
	

	if ($("L_user_name") || is_email(login_un) || is_phone(login_un) || is_QQ(login_un)) {
		isLogin(url);
		//$("user_login_email").value = login_un;
	}
	else {
		location = url;
	}
	/*if (f == 1)
		location = "/shop/index.php?act=add&id="+mid+"&size="+size+"&merchandise_num="+num;
	else {
		$('ife_ajax_login').src="/shop/index.php?act=ajax&id="+mid+"&size="+size+"&merchandise_num="+num;
		
	}*/
	return false;
}


//获取和提交留言
function getAndSaveMessage()
{
	var title=$("m_title").value;
	var content=$("m_content").value;
	if(title==""||content=="")
	{
		alert("标题或者内容不能为空");
		return false;
	}
	
}

//判断日期
function is_date(string)
{
	
	var pattern=/^[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}$/;
	if(!pattern.test(string))
	{
		alert("日期格式不对");
		return false;
	}
	var arr=string.split("-");

	if(arr[1].indexOf("0")==0)
	{
		arr[1]=arr[1].substr(1);
	}

	if(arr[2].indexOf("0")==0)
	{
		arr[2]=arr[2].substr(1);
	}

	if(parseInt(arr[1])<1||parseInt(arr[1])>12)
	{
		alert("月份不对");
		return false;
	}
	if(parseInt(arr[2])<1||parseInt(arr[2])>31)
	{
		alert("日期的天数不对");
		return false;
	}
	return true;
}

function toNumber(s)
{
	var patn = /^0\d$/;
	if (!patn.test(s))
		return parseInt(s);
	else
		return parseInt(s.substring(1,2));
}

var at_time =0;
function setAuctionTime()
{
	var tmp_n;
	var aum = document.getElementById('aum');
	var aus = document.getElementById('aus');

	
	if (!aum || !aus) {
		if (at_time >= 5) {
			if (sat) {
				clearTimeout(sat);
			}
		}
		at_time++;
		return;
		/*setTimeout(setAuctionTime, 300);
	    return;*/
	}
	
	var am = toNumber(aum.innerHTML);	//获得剩余分钟
	var as = toNumber(aus.innerHTML);	//获得剩余秒
	if(as)
	{
		tmp_n = as - 1;
		if (tmp_n < 10)
			tmp_n = '0' + tmp_n;
		aus.innerHTML = tmp_n;
	}
	else if(am)
	{
		tmp_n = am - 1;
		if (tmp_n < 10)
			tmp_n = '0' + tmp_n;
		aum.innerHTML = tmp_n;
		aus.innerHTML = 59;
	}
	else
	{
		clearInterval(sat);
		return false;
	}
}

var timer_cart;
function show_cart_div()
{
	if (timer_cart)
		clearTimeout(timer_cart);
	if ($('div_my_cart'))
		$('div_my_cart').style.display = 'block';
}

function wait_close_cart_div()
{
	timer_cart = setTimeout(close_cart_div, 400);
}

function close_cart_div()
{
	if ($('div_my_cart'))
		$('div_my_cart').style.display = 'none';
}

function Marquee(instance,marquee,direction,delay,amount){
this.instance =instance;//实例名称
this.marquee = document.getElementById(marquee);
this.delay = delay;
if(this.delay==null){
this.delay = 1;
}
this.amount = amount;
if(this.amount==null){
this.amount = 1;
}
this.direction = direction;
this.width = this.marquee.clientWidth;
this.height = this.marquee.clientHeight;
this.container = document.createElement("table");
this.container.border=0;
this.container.cellspacing="0"
this.container.cellpadding="0"
this.container.style.display='inline'
var _HTML = this.marquee.innerHTML;
this.marquee.innerHTML = "";
this.marquee.appendChild(this.container);
var _tr = this.container.insertRow(this.container.rows.length);
var _td = _tr.insertCell(_tr.cells.length);
_td.innerHTML = _HTML;
this.scrollHeight = this.container.clientHeight;
this.scrollWidth = this.container.clientWidth;
switch(this.direction.toLowerCase()){
case "up":
case "down":
if(this.scrollHeight>=this.height){
var _tr = this.container.insertRow(this.container.rows.length);
var _td = _tr.insertCell(_tr.cells.length);
_td.innerHTML = _HTML;
this.scrollHeight = this.container.clientHeight;
}
if(this.direction.toLowerCase()=="down"){
this.marquee.scrollTop=this.scrollHeight/2;
}
break;
default:
if(this.scrollWidth>=this.width){
var _td = _tr.insertCell(_tr.cells.length);
_td.innerHTML = _HTML;
this.scrollWidth = this.container.clientWidth;
}

}

this.marquee.m = this;

this.intervalId = null;
this.marquee.onmouseover = function (){
this.m.Stop();
}
this.marquee.onmouseout = function (){
this.m.Start();
}
this.Start();
}
Marquee.prototype.Start = function (){
this.intervalId = setInterval(this.instance+".Scroll()",this.delay)
//this.Scroll();
}
Marquee.prototype.Stop = function (sender){
if(this.intervalId!=null){
clearInterval(this.intervalId);
}
}
Marquee.prototype.Scroll = function (){
switch(this.direction.toLowerCase()){
case "up":
if((this.marquee.scrollTop+this.height)>=this.scrollHeight){
this.marquee.scrollTop-=this.scrollHeight/2
}
if(this.scrollHeight>this.height){
this.marquee.scrollTop+=this.amount;
}
break;
case "down":
if(this.marquee.scrollTop<=0){
this.marquee.scrollTop+=this.scrollHeight/2
}
if(this.scrollHeight>this.height){
this.marquee.scrollTop-=this.amount;
}
break;
case "right":
if(this.marquee.scrollLeft<=0){
this.marquee.scrollLeft+=this.scrollWidth/2
}
if(this.scrollWidth>this.width){
this.marquee.scrollLeft-=this.amount;
}
break;
default:
if((this.marquee.scrollLeft+this.width)>=this.scrollWidth){
this.marquee.scrollLeft-=this.scrollWidth/2
}
if(this.scrollWidth>this.width){
this.marquee.scrollLeft+=this.amount;
}
}
}

function result_info(m) {
	$('dv_content').innerHTML = '<div style="margin-top:30px; line-height:22px; text-align:center">' + m + '</div><div style="text-align:center; height:60px; margin-top:20px"><img src="/img/shop/ljgm_btn.gif" style="cursor:pointer" onclick="$(\'cart_msg\').style.display=\'none\'" /> <a href="/shop"><img src="/img/shop/n_ckgwc.gif" border="0" /></a></div>';
	$("cart_msg").style.display='block';
	gocart_flag = true;
}

function setTab(m,n){
var tli=document.getElementById("menu"+m).getElementsByTagName("li");
var mli=document.getElementById("main"+m).getElementsByTagName("ul"); 
for(i=0;i<10;i++){
  tli[i].className=i==n?"hover":""; 
  mli[i].style.display=(i==n?"block":"none"); 
}
}

function mail_success(m)
{
	document.frm_smail.email.value = '请输入朋友的e-mail';
	alert(m);
}

function mail_fail(m)
{
	alert(m);
}

function nav_now(i)
{
	return;
	var x = document.getElementById('nav' + i);
	if (i == 3)
	{
		if (document.getElementById('nav2').className == 'headnav_account_ac')
			document.getElementById('nav2').className = 'headnav_account';
		if (document.getElementById('nav3').className == 'headnav_friend')
		{
			x.className = x.className + '_ac';
		}
		return;
	}
	x.className = x.className + '_ac';
}

function check_invite(obj)
{
	globle_to_url = '/account/account_index.php?act=imap.php' + UrlEncode('?msn=' + obj.email.value);
	isLogin(globle_to_url);
	return false;
}

function chk_top_login(obj) {
	if (!obj.user_name_frame.value) {
		obj.user_name_frame.focus();
		alert('请输入登录帐号！');
		return false;
	}
	if (!obj.user_password_frame.value) {
		obj.user_password_frame.focus();
		alert('请输入密码！');
		return false;
	}
	login(1);
	return false;
}

function renren_connent(){
	var ifr = document.getElementById('rr_iframe');
	if(ifr){
		ifr.parentNode.removeChild(ifr);
	}
	var str = '<iframe width="640" height="600" frameborder="0" style="overflow: hidden; position: absolute; left: 300px; top: 160px; z-index: 9999;" src="/renren/index.php" id="rr_iframe" allowtransparency="true"/>';
	if(document.body.insertAdjacentHTML){
		document.body.insertAdjacentHTML('BeforeEnd', str);
	}else{
		if(document.body.lastChild){
			var range = document.body.ownerDocument.createRange();
			range.setStartAfter(document.body.lastChild);
			frag = range.createContextualFragment(str);
			document.body.appendChild(frag);
		}else{
			document.body.innerHTML = str;
		}
	}
	$('login_div').style.display = 'none';
}


