﻿function setHomepage() {　 // 设置首页
	if (document.all) {
		document.body.style.behavior = 'url(#default#homepage)';
		document.body.setHomePage('http://www.asscp.org.cn/');
	}
	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', 'http://taotao.wsyren.com');
	}
} 
function addCookie() {　 // 加入收藏夹
	if (document.all) {
		window.external.addFavorite('http://www.asscp.org.cn/', '添加网址');
	}
	else if (window.sidebar) {
		window.sidebar.addPanel('添加网址', 'http://www.asscp.org.cn/', "");
	}
}

$(document).ready(function(){
	index_show();
})

function index_show(){
	var index = 0;
	lis = $("#focus_num").children().length;
	 //alert(lis)
	 $("#focus_num span").mouseover(function(){
		index  =  $("#focus_num span").index(this);
		showImg(index);
	});
	//自动开始
	var MyTime = setInterval(function(){
		showImg(index)
		index++;
		if(index==lis){index=0;}
	} , 4000);

	//滑入 停止动画，滑出开始动画.
	$('.focus').hover(function(){
		if(MyTime){
			clearInterval(MyTime);
		}
	},function(){
		MyTime = setInterval(function(){
			showImg(index)
			index++;
			if(index==lis){index=0;}
		} ,4000);
	});
}
//通过控制i ，来显示不同的幻灯片
function showImg(index){
	$("#focus_pic a")
	.eq(index).stop(true,true).show()
	.siblings().hide();
	$("#focus_num span")
	.eq(index).addClass("current")
	.siblings().removeClass("current");
}

