﻿// 控制文字滚动
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=600; 
var iHeight=380;
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");
}
}
//收藏此页,IE和firefox兼容
function bookmarksite(title, url){
if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
window.sidebar.addPanel(title, url, "")
}