﻿// 控制文字滚动
var timer,stops=0;
function startscroll(o){
if (stops==1)return
stops=1
	var w1=o.getElementsByTagName("span")[0].offsetWidth,w2=o.offsetWidth;
	if(w1<=w2)return;
	hs(o,w1-w2+10,0,w1-w2+10);
}
function hs(o,d,c,p){
	c++;var t=(c>0?-c:c);o.getElementsByTagName("span")[0].style.marginLeft=t+'px';
	if(c==d){if(d==0){timer=window.setTimeout(function(){hs(o,p,0,p)},2500);}else timer=window.setTimeout(function(){hs(o,0,-p,p)},2500);}
	else timer=window.setTimeout(function(){hs(o,d,c,p)},20);
}

function stopScroll(old){
	old.getElementsByTagName("span")[0].style.marginLeft=0+'px';
	stops=0;
}
//弹出模式窗口,IE和firefox兼
function opennew(newl){
var iWidth=650; 
var iHeight=260;
var iTop=(window.screen.height-iHeight)/2;
var iLeft=(window.screen.width-iWidth)/2;
//alert(navigator.appName);
if (navigator.appName == "Microsoft Internet Explorer"){
window.showModalDialog("add.asp?l="+newl+"","window","dialogHeight: "+iHeight+"px; dialogWidth: "+iWidth+"px;dialogTop: "+iTop+"; dialogLeft: "+iLeft+"; resizable: no; status: no;scroll:no");
}
else
{
window.open("add.asp?l="+newl+"","window","width="+iWidth+",height="+iHeight+",top="+iTop+",left="+iLeft+",toolbar=no");
}
}
function ChecklogForm()
{
       if (document.logForm.username.value == "")
        {
        alert("请填写会员帐号！");
		document.logForm.username.focus();
        return (false);
        }

        var filter=/^\s*[.A-Za-z0-9_-]{5,15}\s*$/;
        if (!filter.test(document.logForm.username.value)) { 
                alert("会员帐号填写不正确,请重新填写！"); 
                document.logForm.username.focus();
                document.logForm.username.select();
                return (false); 
                } 
        
         if (document.logForm.password.value =="") 
         {
         alert("请填写登录密码！");
         document.logForm.password.focus();
         return (false); 
         }
		
        var filter=/^\s*[.A-Za-z0-9_-]{5,15}\s*$/;
        if (!filter.test(document.logForm.password.value)) { 
                alert("密码填写不正确,请重新填写！"); 
                document.logForm.password.focus();
                document.logForm.password.select();
                return (false); 
                } 
     
     document.logForm.submit()
}
//收藏此页,IE和firefox兼容
function bookmarksite(title, url){
if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
window.sidebar.addPanel(title, url, "")
}