function GetXmlHttpObject(){
    var xmlHttpNew = null;
    try {
        xmlHttpNew = new XMLHttpRequest();
    } 
    catch (e) {
        try {
            xmlHttpNew = new ActiveXObject("Msxml2.XMLHTTP");
        } 
        catch (e) {
            xmlHttpNew = new ActiveXObject("Microsoft.XMLHTTP");
        }
    }
    return xmlHttpNew;
}
function bbimg(o)
{
  //var zoom=parseInt(o.style.zoom, 10)||100;
  //zoom+=event.wheelDelta/12;
  //if (zoom>0) o.style.zoom=zoom+'%';
  return false;
}

function resizepic(thispic)
{
if(thispic.width>700){thispic.height=thispic.height*700/thispic.width;thispic.width=700;} 
}
//双击鼠标滚动屏幕的代码
var currentpos,timer;
function initialize()
{
timer=setInterval ("scrollwindow ()",30);
}
function sc()
{
clearInterval(timer);
}
function scrollwindow()
{
currentpos=document.body.scrollTop;
window.scroll(0,++currentpos);
if (currentpos !=document.body.scrollTop)
sc();
}
document.onmousedown=sc
document.ondblclick=initialize
//更改字体大小
var status0='';
var curfontsize=10;
var curlineheight=18;
function fontZoomA(){
  if(curfontsize>8){
    document.getElementById('fontzoom').style.fontSize=(--curfontsize)+'pt';
	document.getElementById('fontzoom').style.lineHeight=(--curlineheight)+'pt';
  }
}
function fontZoomB(){
  if(curfontsize<20){
    document.getElementById('fontzoom').style.fontSize=(++curfontsize)+'pt';
	document.getElementById('fontzoom').style.lineHeight=(++curlineheight)+'pt';
  }
}
//查询检查
function search()
{
  var k_word=s_form.keyword.value;
  k_word=k_word.replace(/(^\s*)|(\s*$)/g,"");
  if(k_word!=""&&k_word!=null)
  {   
     window.location=eval("\"product_list.asp?options=search&id="+escape(k_word)+"\";");
  }
  else
  {
    alert('查找关键字为空!');
	return false;
  }
}
//查检邮箱地址
function check_mail(c_mail)
{
  var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;
  if(pattern.test(c_mail))
  { return true; }
  else
  {return false;}
}
//登陆检查
function CheckForm() {
  if(document.getElementById("login_number").value.replace(/(^\s*)|(\s*$)/g,"") == '') 
  {
    alert('请输入用户名！');
    document.getElementById("login_number").select();
	return false;
  }
  if(document.getElementById("login_pass").value.replace(/(^\s*)|(\s*$)/g,"") == '') 
  {
    alert('请输入密码！');
    document.getElementById("login_pass").select();
    return false;
  }
   document.getElementById("Form1").submit();
}
//找回密码
function u_find()
{ var u_mail=document.getElementById("u_mail").value.replace(/(^\s*)|(\s*$)/g,"");
  if(!check_mail(u_mail))
  {
	  alert('邮箱地址不正确！');
	  document.getElementById("u_mail").select();
	  return false;
  }
  else
  {document.getElementById("Form2").submit();}
}
//登陆检查
function editpsd() {
  var o_psd,n_psd,n_psd2;
  o_psd = document.getElementById("o_psd").value.replace(/(^\s*)|(\s*$)/g,"");
  n_psd = document.getElementById("n_psd").value.replace(/(^\s*)|(\s*$)/g,"");
  n_psd2 = document.getElementById("n_psd2").value.replace(/(^\s*)|(\s*$)/g,"");
  if(o_psd == "") 
  { alert('请输入当前登录密码！');
    document.getElementById("o_psd").select();
	return false;  }
  if(n_psd == "") 
  { alert('请输入新密码！');
    document.getElementById("n_psd").select();
    return false;  }
  if(n_psd!=n_psd2)
  { alert('新密码两次输入不相同！');
    document.getElementById("n_psd").select();
    return false;}
  document.getElementById("Form3").submit();

}
//注册检查
function regedit() {
  var u_id,u_pass,u_pass2,u_name,u_mail;
  u_id=document.getElementById("u_id").value.replace(/(^\s*)|(\s*$)/g,"");
  u_pass=document.getElementById("u_pass").value.replace(/(^\s*)|(\s*$)/g,"");
  u_pass2=document.getElementById("u_pass2").value.replace(/(^\s*)|(\s*$)/g,"");
  u_name=document.getElementById("u_name").value.replace(/(^\s*)|(\s*$)/g,"");
  u_mail=document.getElementById("u_mail").value.replace(/(^\s*)|(\s*$)/g,"");
  if(u_id=='') 
  {
    alert('请输入登录用户名！');
    document.getElementById("u_id").select();
	return false;
  }
  if(u_pass=='') 
  {
    alert('请输入登录密码！');
    document.getElementById("u_pass").select();
	return false;
  }
  if(u_pass.length < 6)
  {
    alert('密码的长度小于6位！');
    document.getElementById("u_pass").select();
	return false;
  }
  if(u_pass2 == '') 
  {
    alert('请重复一次密码！');
    document.getElementById("u_pass2").select();
    return false;
  }
  if(u_pass!=u_pass2)
  { alert('两次密码输入相同！');
    document.getElementById("u_pass").select();
    return false;
  }
  if(u_name=="")
  { alert('请输入昵称！');
    document.getElementById("u_name").select();
    return false;
  }
  if(u_mail==''||!check_mail(u_mail))
  {
    alert('邮箱为空或邮箱地地不正确！');
    document.getElementById("u_mail").select();
    return false;
  }
   document.getElementById("form2").submit();
}
