﻿var QQObj=document.createElement('div');
var LYObj=document.createElement('div');
var WarnLink=''.split('|');
var WarnPic=''.split('|');
var WarnWeb=''.split('|');

function WarnClose(){
	if(warn.offsetHeight<9){warn.style.height='1px';warn.style.visibility='hidden';return;};
	else{warn.style.height=(warn.offsetHeight-8)+'px';setTimeout('WarnClose();',1)};
	return;};

function WarnOpen(){
	if(WarnWeb==''){return;};
	warn.style.visibility='visible';
	warn.style.height=(warn.offsetHeight+8)+'px';
	if(warn.offsetHeight>199){setTimeout('WarnClose();',15000);};
	else{setTimeout('WarnOpen();',1);};
	return;};

function QQ_LY_Move(){
	var Last_S_Top=document.documentElement.scrollTop;
	var Last_S_Left=document.documentElement.scrollLeft;
	var Last_C_Width=document.documentElement.clientWidth;
	var Last_C_Height=document.documentElement.clientHeight;
	var TY=QQObj.offsetTop*.9+Last_S_Top*.1+9.5;
	var TX=QQObj.offsetLeft*.9+(Last_C_Width+Last_S_Left)*.1-10;
	QQObj.style.top=(TY-TY%1)+'px';
	QQObj.style.left=(TX-TX%1)+'px';

	var Last_LY_Height=LYObj.children[0].children[1].src.search('Max')!=-1?218:-14;
	TX=LYObj.offsetHeight*.9+Last_LY_Height*.1;
	LYObj.style.height=(TX-TX%1)+'px';
	LYObj.style.top=Last_C_Height+Last_S_Top-LYObj.offsetHeight+'px';
	LYObj.style.left=Last_C_Width+Last_S_Left-214+'px';
	return void(0);};

function QQClose(){
	QQObj.style.display='none';
	return void(0);};

function LYClose(){
	LYObj.children[0].children[1].src=LYObj.children[0].children[1].src.search('Max')!=-1?'/images/MinLY.gif':'/images/MaxLY.gif';
	return void(0);};

function LY_GetFocus(Obj){
	if(Obj.innerText.replace(' ','')=='请给我们留言，我们会及时联系您'&&Obj.id=='W_LY_C')
		Obj.innerText='';
	if(Obj.value.replace(' ','')=='在这里输入您的电话'&&Obj.id=='W_LY_phone')
		Obj.value='';
	if(Obj.value.replace(' ','')=='在这里输入您的电子邮箱'&&Obj.id=='W_LY_email')
		Obj.value='';
	return void(0);};
function LY_LostFocus(Obj){
	if(Obj.innerText.replace(' ','')==''&&Obj.id=='W_LY_C')
		Obj.innerText='请给我们留言，我们会及时联系您';
	if(Obj.value.replace(' ','')==''&&Obj.id=='W_LY_phone')
		Obj.value='在这里输入您的电话';
	if(Obj.value.replace(' ','')==''&&Obj.id=='W_LY_email')
		Obj.value='在这里输入您的电子邮箱';
	return void(0);};

document.body.onload=function(){
	QQObj.className='QQ';
	QQObj.innerHTML='<div>在线客服</div>';
	QQObj.innerHTML+='<div><a href="http://wpa.qq.com/msgrd?V=1&Uin=936234434&Site=www.baibijia.com&Menu=No" target="_blank"><img src="http://wpa.qq.com/pa?p=1:936234434:6" /></a></div>';
	QQObj.innerHTML+='<div><a href="http://wpa.qq.com/msgrd?V=1&Uin=936290676&Site=www.baibijia.com&Menu=No" target="_blank"><img src="http://wpa.qq.com/pa?p=1:936290676:6" /></a></div>';
	QQObj.innerHTML+='<div><a href="http://wpa.qq.com/msgrd?V=1&Uin=914369244&Site=www.baibijia.com&Menu=No" target="_blank"><img src="http://wpa.qq.com/pa?p=1:914369244:6" /></a></div>';
	QQObj.innerHTML+='<div><a href="http://wpa.qq.com/msgrd?V=1&Uin=593454985&Site=www.baibijia.com&Menu=No" target="_blank"><img src="http://wpa.qq.com/pa?p=1:593454985:6" /></a></div>';
	QQObj.innerHTML+='<a href="javascript:void(0);" onclick="QQClose();">[关闭]</a>';
	QQObj.style.left='0px';
	QQObj.style.top='0px';

	LYObj.className='W_LY';
	var TempHTML;
	TempHTML='<div class="W_LY_Title" onclick="LYClose();"><div style="float:left;">百比佳欢迎您！</div><img style="float:right;" src="/images/';
	TempHTML+=location.pathname.substring(0,9)=='/products'?'Min':'Max';
	TempHTML+='LY.gif" /></div>';
	TempHTML+='<textarea id="W_LY_C" rows="6" cols="27" class="W_LY_Input" style="overflow:hidden;" onfocus="LY_GetFocus(this);" onfocusout="LY_LostFocus(this);">请给我们留言，我们会及时联系您</textarea>';
	TempHTML+='<input id="W_LY_phone" class="W_LY_Input" type="text" style="height:12px" value="在这里输入您的电话" onfocus="LY_GetFocus(this);" onfocusout="LY_LostFocus(this);" />';
	TempHTML+='<input id="W_LY_email" class="W_LY_Input" type="text" style="height:12px" value="在这里输入您的电子邮箱" onfocus="LY_GetFocus(this);" onfocusout="LY_LostFocus(this);" />';
	TempHTML+='<span class="W_LY_Button" onclick="W_LY_submitit();"><img id="liuyan_1" src="/images/LY_Button.gif"></span>';
	LYObj.innerHTML=TempHTML;

	LYObj.style.left=document.documentElement.clientWidth-214+'px';
	LYObj.style.top=document.documentElement.clientHeight+document.documentElement.scrollTop-26+'px';

	document.body.appendChild(QQObj);
	document.body.appendChild(LYObj);
	setInterval('QQ_LY_Move();',1);
	if(location.pathname=='/member/shop_pay.aspx')ShowWuPin();
	if(location.pathname=='/products/index.html')LoadGoodsList();

	for(i=0;i<WarnWeb.length;i++)
		if(location.pathname==WarnWeb[i]){
			setTimeout('WarnOpen();',1000);
			warn.src=WarnPic[i];
			var L=WarnLink[i];
			warn.onclick=function(){
				location.pathname=L;
				return;};};
	return void(0);};

function W_LY_submitit(){
	if(W_LY_C.innerText=='请给我们留言，我们会及时联系您'||W_LY_phone.value=='在这里输入您的电话'){
		alert('你提交的内容不完全!');return void(0);};
	var result=other.ajax.liuyan_insert('匿名','男',W_LY_phone.value,' ',' ',' ',W_LY_email.value,' ',W_LY_C.innerText,'在线留言').value;
	if(result=="1"){
		alert("您的留言己经提交！");
		LYClose();
		return void(0);};
	else{
		alert("提交失败！请稍后再试。");
		return void(0);};};
