window.onresize = baiduResizeDiv;
	window.onerror = function(){}
	var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,objTimer,i = 0;
	String.prototype.Trim  = function(){return this.replace(/^\s+|\s+$/g,"");}
	
	function baidu_collapse(obj){
	ct = document.getElementById('tab_c_'+(3+3));
		if(ct.style.display=="none"){
			ct.style.display="";
			obj.src=obj.src.replace("b.gif","a.gif");
		} else {
			ct.style.display="none";
			obj.src=obj.src.replace("a.gif","b.gif");
		}
		baiduResizeDiv();
	}
	
	function baiduMsg()
	{
		try{
			divTop = parseInt(document.getElementById("eMeng").style.top,10);
			divLeft = parseInt(document.getElementById("eMeng").style.left,10);
			divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10);
			divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10);
			docWidth = document.body.clientWidth;
			docHeight = document.body.clientHeight;
			document.getElementById("eMeng").style.top = parseInt(document.body.scrollTop,10) + docHeight + 10;// divHeight
			document.getElementById("eMeng").style.left = parseInt(document.body.scrollLeft,10) + docWidth - divWidth;
			document.getElementById("eMeng").style.visibility="visible";
			objTimer = window.setInterval("baidu_move_div()",10);
		}catch(e){}
	} 
	
	function baiduResizeDiv()
	{
		i+=1;
		try{
			divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10);
			divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10);
			docWidth = document.body.clientWidth;
			docHeight = document.body.clientHeight;
			document.getElementById("eMeng").style.top = docHeight - divHeight + parseInt(document.body.scrollTop,10);
			document.getElementById("eMeng").style.left = docWidth - divWidth + parseInt(document.body.scrollLeft,10);
		}catch(e){}
	}
	
	function baidu_move_div()
	{
		try{
			if(parseInt(document.getElementById("eMeng").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10)))
			{
				window.clearInterval(objTimer);objTimer = window.setInterval("baiduResizeDiv()",1);
			}
			divTop = parseInt(document.getElementById("eMeng").style.top,10);
			document.getElementById("eMeng").style.top = divTop - 1;
		}catch(e){}
	}
	
	 function valid_message()
	{
		objMess = lea_mess.message;
		objContact = lea_mess.contact;
		
		objMess.value = objMess.value.Trim();
		objContact.value = objContact.value.Trim();
		
		strMess = objMess.value;
		strContact = objContact.value;
		
		if (strMess.length > 200)
		{
			alert('您的留言过长，请减少至200字内，谢谢！');
			return false;
		}
		if (strContact.length > 50)
		{
			alert('您的联系方式过长，请减少至50字内，谢谢！');
			return false;
		}
		if ((strMess.length < 1 || strMess==objMess.defaultValue) && strContact.length>0)
		{
			alert('您还没有任何产品咨询留言,麻烦请在第一行方框输入您的咨询信息\n直接订购请留言名字 地址即可完成订购,谢谢！');
			return false;
		}
		if ((strContact.length < 1 || strContact==objContact.defaultValue) && strMess.length>0)
		{
			alert('您还没有填写您的联系方式 有留必回\n请在第二行方框中输入您的手机或[区号+小灵通]，谢谢！');
			return false;
		}
		if ((strContact.length < 1 && strMess.length<1) ||  (strMess==objMess.defaultValue && strContact==objContact.defaultValue))
		{
			alert('您好，留言不能为空，谢谢！');
			return false;
		}
		if(!confirm('您确定发送留言吗?\n请您确保您的联系方式为手机号码或区号+小灵通\n本站将以短信方式回复 畅享信息随身服务\n【友情提示:此次信息发送仅限提交一次】')) 
		{
			return false;
		}
    	lea_mess.submit();
		document.getElementById("Submit").disabled=true;
		document.getElementById("message").disabled=true;
		document.getElementById("contact").disabled=true;
		document.getElementById("smstitle").innerHTML="在线问题已提交";
		document.getElementById("Submit").src="http://img.btoc.com.cn/img/button2.gif";
		msee_init();
	}
	
	function msee_init () {
		lea_mess.message.value = lea_mess.message.defaultValue;
		lea_mess.contact.value = lea_mess.contact.defaultValue;
	}
	
	function baiduMessbox(shape,color,shopid){

if (readCookie("adcode_temp")!= null) {
var adcode_temp = readCookie("adcode_temp");
adcode_temp = padLeft(adcode_temp,4);
adcode_temp = Chenge(adcode_temp);
urlkey="<u>幸运星</u>您已获礼包电话通知<font color=#cc0000>右侧买赠</font>代码下单填入立得<td>"+adcode_temp+"</td>";

		} else {
var urlkeynum;
var adcode_temp = Chenge('8888');
urlkey="全国订购直销电话<br>"+adcode_temp+"";
		}

if(document.all("adcode")!=null && urlkey !== null)
{

var adcodeshow=document.getElementsByName('adcode');
if(adcodeshow.length){
for(var i=0;i<adcodeshow.length;i++){
document.getElementsByName('adcode')[i].innerHTML=" "+ adcode_temp + ""; 
     }
 }	
}

if(document.all("adsum")!=null && readCookie("adcode_temp")!=null )
{
document.getElementById("adsum").value=readCookie("adcode_temp");
}

//alert(urlkey);		
		
		var localurl=document.location; 
		var fromsite=document.referrer; 
		var styles='position:absolute;top:0px;left:0px;z-index:99999;visibility:hidden;';
		var copic='<img src="http://img.btoc.com.cn/img/ico_'+color+'a.gif" align="absmiddle" class="ioc'+color+'" onClick="baidu_collapse(this)">';
		if(shape>1) window.onload = baiduMsg;
		else {styles='';copic=''}
		var s;
		if(shape==2) {
			s='<div id=eMeng style="Z-INDEX:99999;LEFT:0px;POSITION:absolute;TOP:0px;VISIBILITY:hidden;">'
				+ "<form name ='lea_mess' action ='http://www.btoc.com.cn/smsadd.asp' method ='post' style='margin:0px; padding:0px;' target=baidu_msg_frm>"
				+ '<table width="212" border="0" cellpadding="0" cellspacing="0" class="" id="tab_'+(color+3)+'" style="border:0px;">'
				+'  <tr>'
				+'    <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">'
				+'        <tr>'
				+'          <td width="28" rowspan="2" valign="bottom"><img src="http://img.btoc.com.cn/img/ico'+(color+1)+'.gif"></td>'
				+'          <td>&nbsp;<iframe src=\'\' name=baidu_msg_frm style=\'display:none;\'></iframe></td>'
				+'        </tr>'
				+'        <tr>'
				+'          <td align=right style="font-size:12px; background:url(http://img.btoc.com.cn/img/bg_'+color+'.gif);line-height:21px;height:21px;border-top:1px solid #808080;border-right:1px solid #808080;padding-right:6px;color:#808080;" onDblClick="baidu_collapse(this.firstChild.nextSibling)"><span id=smstitle>在线快速问题短信直达</span><img src="http://img.btoc.com.cn/img/ico_'+color+'a.gif" align="absmiddle" class="ioc'+color+'" onClick="baidu_collapse(this)">'
				+'		  </td>'
				+'        </tr>'
				+'      </table>'
				+'	  </td>'
				+'    </tr>'
				+ '</table>'
				+ '<table width="212" border="0" cellpadding="0" cellspacing="0" style="border:1px solid #808080;" id="tab_c_'+(color+3)+'">'
				+'  <tr bgcolor="#FFFFFF">'
				+'   <td style="color:#808080;line-height:14px;" align=center>'
				+'   <textarea name="message" style="width:98%; overflow:auto; font-size:12px; color:#808080; border:1px solid #808080; margin:4px 4px 4px 4px; height:50px" onfocus="if (this.value == this.defaultValue) this.value=\'\';" onblur="this.value=this.value.Trim(); if (this.value==\'\') this.value=this.defaultValue;">您好，感谢关注本网站！&#13;如果您对本站的产品或服务感兴趣，请点击此处留言，谢谢！</textarea>'
				+'   <textarea name="contact"   style="width:98%; overflow:auto; font-size:12px; color:#808080; border:1px solid #808080; margin:0px 4px 4px 4px;" onfocus="if (this.value == this.defaultValue) this.value=\'\';" onblur="this.value=this.value.Trim(); if (this.value==\'\') this.value=this.defaultValue;">请留下您的手机号码或小灵通【加区号】，本站有留必回。</textarea>'
				+'        <table border="0" cellspacing="0" cellpadding="0" style="margin:6px;">'
				+'          <tr>'
				+'            <td style="font-size:12px; color:#808080;">'+urlkey+'</td>'
				+'            <td width="47" align="right"><img src="http://img.btoc.com.cn/img/button.gif" border="0" id="Submit" style="cursor:hand;" onclick="valid_message();"></td>'
				+'          </tr>'
				+'        </table>'
				+'	   </td>'
				+'    </tr>'
				+'  </table><input type=hidden name=localurl value="'+localurl+'"><input type=hidden name=fromsite value="'+fromsite+'"></form>'
				+'</div>';
		} 
		document.writeln(s);
	}
baiduMessbox(2, 3, 0);
