// JavaScript Document
/*
*ǰ̨Ê×Ò³»ÃµÆÆ¬²¥·ÅЧ¹û
*/
var t = 0;
var n = 0;
var count = 0;
$(function(){
count = $("#play_list a").size();
$("#play_list a:not(:first-child)").hide();
$("#play_info").html($("#play_list a:first-child").find("img").attr('alt'));
$("#play_text li:first-child").css({"background":"#fff",'color':'#000'});
$("#play_info").click(function(){window.open($("#play_list a:first-child").attr('href'), "_blank");});
$("#play_text li").click(function() {
var i = $(this).text() - 1;
n = i;
if (i >= count){
return;
}
$("#play_info").html($("#play_list a").eq(i).find("img").attr('alt'));
$("#play_info").unbind().click(function(){window.open($("#play_list a").eq(i).attr('href'), "_blank");});
$("#play_list a").filter(":visible").fadeOut(1000).parent().children().eq(i).fadeIn(1000);
$(this).css({"background":"#fff",'color':'#000'}).siblings().css({"background":"#000",'color':'#fff'});
});
t = setInterval("showAuto()", 2000);
$("#play").hover(function(){clearInterval(t);}, function(){t = setInterval("showAuto()", 2000);});
});
function showAuto()
{
n = n >= (count - 1) ? 0 : n + 1;
$("#play_text li").eq(n).trigger('click');
}
/*
*µã»÷Ìí¼ÓÊղش¥·¢
*/
function addCookie()
{
//var url = location.href;
var url = "http://www.baidu.com";
/*if (document.all)
{
window.external.addFavorite(url,document.title);
}
else if (window.sidebar)
{
}*/
}
function addBookmark(title, url) {
var ctrl = (navigator.userAgent.toLowerCase()).indexOf("mac") != -1 ? "Command/Cmd" : "CTRL";
if (document.all) {
window.external.AddFavorite(url, title);
} else {
if (window.sidebar) {
window.sidebar.addPanel(title, url, "");
} else {
alert("\u60a8\u53ef\u4ee5\u5c1d\u8bd5\u901a\u8fc7\u5feb\u6377\u952e" + ctrl + " + D \u52a0\u5165\u5230\u6536\u85cf\u5939!");
}
}
}
$(document).ready(function(){
$(".addBookmark").click(function() {
var ctrl = (navigator.userAgent.toLowerCase()).indexOf('mac') != -1 ? 'Command/Cmd' : 'CTRL';
if (document.all){
window.external.AddFavorite("http://www.dangbao.net","Dangbaos Blog");
}else if (window.sidebar){
window.sidebar.addPanel("Dangbao's Blog", "http:www.dangbao.net", "");
}else {
alert('Äú¿ÉÒÔ³¢ÊÔͨ¹ý¿ì½Ý¼ü' + ctrl + ' + D ¼ÓÈëµ½ÊղؼÐ!');
}
});
});
/*
*µã»÷ÉèΪÊ×ҳʱ´¥·¢
*/
function setHomepage(url) {
if (document.all) {
document.body.style.behavior = "url(#default#homepage)";
//alert(location.href);
document.body.setHomePage(url);
} else {
if (window.sidebar) {
if (window.netscape) {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
}
catch (e) {
alert("\u8be5\u64cd\u4f5c\u88ab\u6d4f\u89c8\u5668\u62d2\u7edd\uff0c\u5982\u679c\u60f3\u542f\u7528\u8be5\u529f\u80fd\uff0c\u8bf7\u5728\u5730\u5740\u680f\u5185\u8f93\u5165 about:config,\u7136\u540e\u5c06\u9879 signed.applets.codebase_principal_support \u503c\u8be5\u4e3atrue");
}
}
var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
prefs.setCharPref("browser.startup.homepage", url);
}
}
}
/*
*ÑéÖ¤Ê×Ò³Óû§µÇ¼
*/
function checkLogin(){
if($("#accountText").val()==""){
//alert("ÇëÊäÈëµÇ¼Õʺţ¡");
$("#error_login").html("<font color=red>ÇëÊäÈëµÇ¼Õʺţ¡</font>");
return false;
}
if($("#pwdText").val()==""){
//alert("ÇëÊäÈëµÇ¼ÃÜÂ룡");
$("#error_login").html("<font color=red>ÇëÊäÈëµÇ¼ÃÜÂ룡</font>");
return false;
}
if(!checkVerify()){
//alert("ÇëÊäÈëÕýÈ·µÄÑéÖ¤Â룡");
$("#error_login").html("<font color=red>ÇëÊäÈëÕýÈ·µÄÑéÖ¤Â룡</font>");
return false;
}
$("#error_login").html(" ");
return true;
}
function onmouseoverStyle(obj){
var oldSrc = $(obj).children("img").attr("src");
if(oldSrc.indexOf("_1")==-1){
var newSrc = oldSrc.substr(0,oldSrc.indexOf("gif")-1)+"_1.gif";
$(obj).children("img").attr("src",newSrc);
}
}
function onmouseoutStyle(obj){
var oldSrc = $(obj).children("img").attr("src");
if(oldSrc.indexOf("_1")!=-1){
var newSrc = oldSrc.substr(0,oldSrc.indexOf("gif")-3)+".gif";
$(obj).children("img").attr("src",newSrc);
}
}