// JavaScript Document
function switchSysBar(){
if (switchPoint.title=="打开在线客服"){
switchPoint.title="关闭在线客服"
document.all("client").style.left="0px"
}else{
switchPoint.title="打开在线客服"
document.all("client").style.left="-170px" }
}
function MoveLeftLayer() {
var y = 30;
var diff = (document.body.scrollTop + y - document.all.client.style.posTop)*.40;
var y = document.body.scrollTop + y - diff;
eval("document.all.client.style.posTop = y");
setTimeout("MoveLeftLayer('client');", 50);
}

function List(id,DateAndTime,newlocation,catid,str)
{window.open("/market/MarketList.asp?id="+id+"&DateAndTime="+DateAndTime+"&newlocation="+newlocation+"&catid="+catid+"&keyword="+str,"","");}
function popup(mylink)
{window.open(mylink, "new", "height=400, width=320, top=200, left=300,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no")}
function show_popup(mylink,wid,hei,scrollbar)
{window.open(mylink,'new','top=110,left=280,width='+wid+',height='+hei+',scrollbars='+scrollbar+'')}

function trim(inputString) {
if (typeof inputString != "string") { return inputString; }
var retValue = inputString;
var ch = retValue.substring(0, 1);
while (ch == " ") { 
//检查字符串开始部分的空格
retValue = retValue.substring(1, retValue.length);
ch = retValue.substring(0, 1);
}
ch = retValue.substring(retValue.length-1, retValue.length);
while (ch == " ") {
//检查字符串结束部分的空格
retValue = retValue.substring(0, retValue.length-1);
ch = retValue.substring(retValue.length-1, retValue.length);
}
while (retValue.indexOf("  ") != -1) { 
//将文字中间多个相连的空格变为一个空格
retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); }
return retValue;
} 

function show_menu(obj_s,obj){	var  s_id = document.getElementById(obj_s);	var  sc_id = document.getElementById(obj); s_id.style.display = "block";sc_id.className = "S";}
function hide_menu(obj_h,obj){	var  h_id = document.getElementById(obj_h);	var  hc_id = document.getElementById(obj); h_id.style.display = "none";hc_id.className = "S";}

//elm：需要插入flash的外层HTMLElement
//url: flash的地址
//w: flash宽
//h: flash高
function insertFlash(elm, url, w, h) {
if (!document.getElementById(elm)) return;
var str = '';


str += '<object width="'+ w +'" height="'+ h +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0">';
str += '<param name="movie" value="'+ url +'">';
str += '<param name="wmode" value="Transparent">';
str += '<param name="SCALE" value="exactfit">';
str += '<param name="quality" value="autohigh">';
str += '<embed width="'+ w +'" height="'+ h +'" src="'+ url +'" quality="autohigh" wmode="opaque" type="application/x-shockwave-flash" plugspace="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>';
str += '</object>';
document.getElementById(elm).innerHTML = str;
}

//首页滚动广告
function slideLine(ul, delay, speed, lh) {
	var slideBox = (typeof ul == 'string')?document.getElementById(ul):ul;
	var delay = delay||1000, speed=speed||20, lh = lh||20;
	var tid = null, pause = false;
	var start = function() {
		tid=setInterval(slide, speed);
	}
	var slide = function() {
		if (pause) return;
		slideBox.scrollTop += 2;	
		if (slideBox.scrollTop % lh == 0) {
			clearInterval(tid);
			slideBox.appendChild(slideBox.getElementsByTagName('li')[0]);
			slideBox.scrollTop = 0;
			setTimeout(start, delay);
		}
	}
	slideBox.onmouseover=function(){pause=true;}
	slideBox.onmouseout=function(){pause=false;}
	setTimeout(start, delay);
  }

//切换表格显示
function switchTab(identify,index,count) {
	for(i=0;i<count;i++) {
		var CurTabObj = document.getElementById("Tab_"+identify+"_"+i) ;
		var CurListObj = document.getElementById("List_"+identify+"_"+i) ;
		if (i != index) {
			fRemoveClass(CurTabObj , "upH3") ;
			fRemoveClass(CurListObj , "upBox") ;
		}
	}
	fAddClass(document.getElementById("Tab_"+identify+"_"+index),"upH3") ;
	fAddClass(document.getElementById("List_"+identify+"_"+index),"upBox") ;
}
function fAddClass(XEle, XClass)
{/* shawl.qiu code, void return */
  if(!XClass) throw new Error("XClass 不能为空!");
  if(XEle.className!="") 
  {
    var Re = new RegExp("\\b"+XClass+"\\b\\s*", "");
    XEle.className = XEle.className.replace(Re, "");
	var OldClassName = XEle.className.replace(/^\s+|\s+$/g,"") ;
	if (OldClassName == "" ) {
		 XEle.className = XClass;
	}
	else {
		XEle.className = OldClassName + " " + XClass;
	}
   
  }
  else XEle.className = XClass;
}/* end function fAddClass(XEle, XClass) */
function fRemoveClass(XEle, XClass)
{/* shawl.qiu code, void return */
  if(!XClass) throw new Error("XClass 不能为空!");
  var OldClassName = XEle.className.replace(/^\s+|\s+$/g,"") ;
  if(OldClassName!="") 
  {
    var Re = new RegExp("\\b"+XClass+"\\b\\s*", "");
    XEle.className = OldClassName.replace(Re, "");
  }
}/* function fRemoveClass(XEle, XClass) */

function msgmsg_clear(){if (document.cMsg.msgmsg.value == "简短留言，咨询、购买或合作？限50字") document.cMsg.msgmsg.value="";}
function msgtel_clear(){if (document.cMsg.msgtel.value == "请附上联系电话") document.cMsg.msgtel.value="";}
function textLimitCheck(thisArea,maxLength){if(thisArea.value.length>maxLength){alert(maxLength+"个字限制,超出的将自动去除.");thisArea.value = thisArea.value.substring(0, maxLength);thisArea.focus();}
/*回写span的值，当前填写文字的数量*/ 
//messageCount.innerText = thisArea.value.length;
}

//--检测登陆-->
function DoLogin() {
var UsernameGet = trim(document.loginForm.UsernameGet.value);
var PasswordGet = trim(document.loginForm.PasswordGet.value);
var Verifycode = trim(document.loginForm.Verifycode.value);

if(UsernameGet == "") {
alert("请输入会员登录名！");
document.loginForm.UsernameGet.focus();
return false;} 
if(PasswordGet == "") {
alert("请输入密码！");
document.loginForm.PasswordGet.focus();
return false;} 
if(Verifycode == "") {
alert("请输入验证码！");
document.loginForm.Verifycode.focus();
return false;} 
}

//校验user的弹出窗口
function check_id_window(value){
var filter=/^\s*[A-Za-z0-9]{6,20}\s*$/;
if (!filter.test(document.form.user.value)) { 
alert("用户名填写不正确,请重新填写！可使用的字符为（A-Z a-z 0-9）长度不小于6个字符，不超过20个字符，注意不要使用空格。"); 
document.form.user.focus();
document.form.user.select();
return false; 
}
window.open("check_id.asp?user="+value,"",'toolbar=no,directories=no,scrollbars=0,resizable=1,status=no,menubar=0,width=300,height=120');
}

