
// 检查是否为数字
function checkIsInteger(str){
        if (str == ""){
         return false;
        }
        if (str.search(/^[0-9]+$/) < 0){
         return false;
        }
        else{
         return true;
        }
}
//加入收藏
function AddFavorite(sURL, sTitle)
{
   if (document.all) 
　 { 
        window.external.addFavorite(sURL, sTitle);
　 } 
　 else if (window.sidebar)
　 { 
        window.sidebar.addPanel(sTitle, sURL, "");
　 }  
}

// 设置首页 
function setMyHome(sURL) {  
  if (document.all) {  
    document.body.style.behavior='url(#default#homepage)';  
    document.body.setHomePage(sURL);  
   
 } else if (window.sidebar) {  
  if(window.netscape) {  
        try {    
            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");    
        } catch (e) {    
            alert( "该操作被浏览器拒绝，如果想启用该功能，请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true" );    
        }  
    }   
    var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);  
    prefs.setCharPref('browser.startup.homepage',sURL);  
  }  
}  


function tabit(btn){
	var tabNumber = 5;
	for(i=0;i<tabNumber;i++){
			if(document.getElementById("hot_d"+i)!=null){
			document.getElementById("hot_d"+i).style.display = "none";
			document.getElementById("tab_d"+i).className = "gre_a";
			}
		};
	document.getElementById("hot_d"+btn).style.display = "block";
	document.getElementById("tab_d"+btn).className = "org_a";
};






function open_maos_msg(){
	document.getElementById('maos_msg').style.display='block';
	document.getElementById('maos_fade').style.display='block'
}

function close_maos_msg(){
	document.getElementById('maos_msg').style.display='none';
	document.getElementById('maos_fade').style.display='none' 
}


//临时书架
function GeteMeng(flag)//是否开启临时书架
{
	if(flag == 0)
	{
		return false;
	}else
	{
		window.onload = getMsg;
		window.onresize = resizeDiv;
		return true;
	}
}

//window.onerror = function(){}
//短信提示使用(asilas添加)
var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,objTimer,i = 0;
function getMsg()
{
    try{
    divTop = parseInt(document.getElementById("eMeng").style.top,10)
    divLeft = parseInt(document.getElementById("eMeng").style.left,10)
    divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10)
    divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10)
    docWidth = document.body.clientWidth;
    docHeight = document.body.clientHeight;
    document.getElementById("eMeng").style.top = parseInt(document.body.scrollTop,10) + docHeight + 10;//  divHeight
    document.getElementById("eMeng").style.left = parseInt(document.body.scrollLeft,10) + docWidth - divWidth
    document.getElementById("eMeng").style.visibility="visible"
    objTimer = window.setInterval("moveDiv()",10)
    }
    catch(e){}
}
function resizeDiv()
{
    i+=1
    if(i>1000) closeDiv()
    try{
    divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10)
    divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10)
    docWidth = document.body.clientWidth;
    docHeight = document.body.clientHeight;
    document.getElementById("eMeng").style.top = docHeight - divHeight + parseInt(document.body.scrollTop,10)
    document.getElementById("eMeng").style.left = docWidth - divWidth + parseInt(document.body.scrollLeft,10)
    }
    catch(e){}
}
function moveDiv()
{
    try
    {
    if(parseInt(document.getElementById("eMeng").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10)))
    {
    window.clearInterval(objTimer)
    objTimer = window.setInterval("resizeDiv()",1)
    }
    divTop = parseInt(document.getElementById("eMeng").style.top,10)
    document.getElementById("eMeng").style.top = divTop - 1
    }
    catch(e){}
}
function closeDiv()
{
    document.getElementById('eMeng').style.visibility='hidden';
    if(objTimer) window.clearInterval(objTimer)
}




function open_maos_down(url){
	document.getElementById('maos_down').style.display='block';
	document.getElementById('maos_fade_down').style.display='block';
	document.getElementById('url_down').value=url;	
}

function close_maos_down(){
	document.getElementById('maos_down').style.display='none';
	document.getElementById('maos_fade_down').style.display='none' ;
	document.getElementById('alert_down').style.display='none';
	$("#code")[0].value = "";
}