/**
 *添加收藏、置为首页
*/
function AddFavorite(sURL, sTitle) {   
    try {   
        window.external.addFavorite(sURL, sTitle);   
    } catch (e) {   
        try {   
            window.sidebar.addPanel(sTitle, sURL, "");   
        } catch (e) {   
            alert("加入收藏失败，请使用Ctrl+D进行添加");   
        }   
    }   
}   
/**   
 *    
 * @param {} obj 当前对象，一般是使用this引用。   
 * @param {} vrl 主页URL   
 */   
function SetHome(obj, vrl) {   
    try {   
        obj.style.behavior = 'url(#default#homepage)';   
        obj.setHomePage(vrl);   
    } catch (e) {   
        if (window.netscape) {   
            try {   
                netscape.security.PrivilegeManager   
                        .enablePrivilege("UniversalXPConnect");   
            } catch (e) {   
                alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将 [signed.applets.codebase_principal_support]的值设置为'true',双击即可。");   
            }   
            var prefs = Components.classes['@mozilla.org/preferences-service;1']   
                    .getService(Components.interfaces.nsIPrefBranch);   
            prefs.setCharPref('browser.startup.homepage', vrl);   
        }   
    }   
}  
/**
 *登录前判断
*/
function login_ajax_all() {
	username = $('head_username').value;
	if(username==''){
		alert('请输入您的用户名');
		return false;
	}
	password = $('head_password').value;
	if(password==''){
		alert('请输入您的密码');
		return false;
	}
	return true;
}

function onMouseover(id, num, str1, str2, classname) {
	for(i=0; i<num; i++){
		if(i==id){
			document.getElementById(str1+i).className = classname;
			document.getElementById(str2+i).style.display = 'block';
		}else{
			document.getElementById(str1+i).className = '';
			document.getElementById(str2+i).style.display = 'none';
		}
	}
}

function ismobile()
{
	mobile = document.getElementById('mobile').value;	
	regexp = /((\(\d{3}\))|(\d{3}\-))?13[0-9]\d{8}|15[0-9]\d{8}|18[0-9]\d{8}/g;
	if(regexp.test(mobile)){
		return true;
	}else{
		alert("请输入正确的手机号码");
		return false;
	}
}

function IP2V(ip) {
	re=/(\d+)\.(\d+)\.(\d+)\.(\d+)/g //匹配IP地址的正则表达式 
	if(re.test(ip)) 
	{
		return true;
	} 
	else 
	{ 
		alert("请输入正确的IP地址");
		return false;
	} 
}

function attention_stock()
{
	mobile = document.getElementById('mobile').value;	
	regexp = /((\(\d{3}\))|(\d{3}\-))?13[0-9]\d{8}|15[0-9]\d{8}|18[0-9]\d{8}/g;
	if(regexp.test(mobile)){
		stock = document.getElementById('stock').value;
		if(stock!='')
		{
			len = stock.length;
			if(len!=6)
			{				
				alert("请输入正确的股票代码");
				return false;
			}
			return true;
		}
		alert("请输入股票代码");
		return false;
	}else{
		alert("请输入正确的手机号码");
		return false;
	}
}

function changeDis(bqid, doid, nums, classname1, classname2, imgid, divid) {
	nums = nums + 1;
	for(i=1;i<nums;i++){
		if(i == doid){			
			document.getElementById(bqid+i).className = classname1;
			document.getElementById(imgid+i).className = '';
			document.getElementById(divid+i).className = '';
		}else{
			document.getElementById(bqid+i).className = classname2;
			document.getElementById(imgid+i).className = 'none';
			document.getElementById(divid+i).className = 'none';
		}
	}	
}

function changeDis2(bqid, doid, nums, classname1, divid) {
	nums = nums + 1;
	for(i=1;i<nums;i++){
		if(i == doid){			
			document.getElementById(bqid+i).className = classname1;
			document.getElementById(divid+i).className = '';
		}else{
			document.getElementById(bqid+i).className = '';
			document.getElementById(divid+i).className = 'none';
		}
	}	
}

// JavaScript Document
lastScrollY=0;
function heartBeat(){ 
var diffY;
if (document.documentElement && document.documentElement.scrollTop)
diffY = document.documentElement.scrollTop;
else if (document.body)
diffY = document.body.scrollTop
else
{/*Netscape stuff*/}
percent=.1*(diffY-lastScrollY); 
if(percent>0)percent=Math.ceil(percent); 
else percent=Math.floor(percent); 
document.getElementById("lovexin12").style.top=parseInt(document.getElementById
("lovexin12").style.top)+percent+"px";
document.getElementById("lovexin14").style.top=parseInt(document.getElementById
("lovexin12").style.top)+percent+"px";
lastScrollY=lastScrollY+percent; 
}
function hide()  
{   
document.getElementById("lovexin12").style.display="none"; 
document.getElementById("lovexin14").style.display="none";
}
suspendcode12="<DIV id=\"lovexin12\" style='left:2px;POSITION:absolute;TOP:200px;z-index:99;'><img src='http://level2.tzt.cn/images/adv.jpg' width='150' height='250' border='0' usemap='#Mapaz'><map name='Mapaz'><!--<area shape='rect' coords='132,0,151,17' href='javascript:window.hide()'>--><area shape='rect' coords='0,0,150,250' href='http://www.tzt.cn/tzt_hd/level2/' target='_blank'></map></div>"
suspendcode14="<DIV id=\"lovexin14\" style='right:2px;POSITION:absolute;TOP:200px;z-index:99;'><img src='http://www.tzt.cn/images/zd_bgb.jpg' width='153' height='119' border='0' usemap='#Mapas'><map name='Mapas'><area shape='rect' coords='133,2,149,16' href='javascript:window.hide()'><area shape='rect' coords='4,17,150,114' href='http://www.tzt.cn/tzt_hd/tzt111226/' target='_blank'></map></div>"
document.write(suspendcode12); 
document.write(suspendcode14); 
window.setInterval("heartBeat()",1);

