﻿function navfun(n){		
		$(".top_2_2>ul>li").each(function(i){
			$(".top_2_2>ul>li").eq(i).find(">a").css({"background":"url("+ImageFolder+"navbg"+(i+1)+".jpg) 0px 0px" })
		 if(n==i)
		 {
			 $(".top_2_2>ul>li").eq(i).find(">a").css({"background":"url("+ImageFolder+"navbg"+(i+1)+".jpg) 0px -35px" })
			 $(".top_2_2>ul>li").eq(i).find(">ul").css({"display":"block" })
		 }
		 else
		 {
			$(this).hover(
			function(){$(".top_2_2>ul>li").eq(i).find(">a").css({"background":"url("+ImageFolder+"navbg"+(i+1)+".jpg) 0px -35px" })},
			function(){$(".top_2_2>ul>li").eq(i).find(">a").css({"background":"url("+ImageFolder+"navbg"+(i+1)+".jpg) 0px 0px" })}
		    );
		 }
			
	})
	}


function tabtog(n)
{
	$(".txt_1_3_t1 a").eq(n).css({"background":"url("+ImageFolder+"rnavbgc.jpg) no-repeat 0px 0px","color":"#D6C88A","font-weight":"bold"}).siblings().css({"background":"","color":"#ffffff","font-weight":"bold"})
	$(".txt_1_3_c .txt_1_3_cb").eq(n).show().siblings().hide();
    $(".txt_1_3_t1 a").each(function(i){
	   $(this).mouseover(function(){
		   $(this).css({"background":"url("+ImageFolder+"rnavbgc.jpg) no-repeat 0px 0px","color":"#D6C88A","font-weight":"bold"}).siblings().css({"background":"","color":"#ffffff","font-weight":"bold"})
		   $(".txt_1_3_c .txt_1_3_cb").eq(i).show().siblings().hide();
		   });
	   });
}




function leftFun(navid,pid) {
var onav = document.getElementById("leftnav").getElementsByTagName('a');
for (var i = 0; i < onav.length; i++) {
  if (i == pid) {
  onav[i].style.backgroundImage= "url("+ImageFolder+"left"+navid+"_"+i+"c.jpg)";
  } else {
  onav[i].style.backgroundImage= "url("+ImageFolder+"left"+navid+"_"+i+".jpg)";
  }
}
$("#leftnav a").each(function(i){
	if(pid!=i){
		$("#leftnav a").eq(i).hover(function(){
	$(this).css({ background:"url("+ImageFolder+"left"+navid+"_"+i+"c.jpg)" });
	}, 
	function(){
		$(this).css({ background:"url("+ImageFolder+"left"+navid+"_"+i+".jpg)" });
		});
		}
 });
}


function rightpop(){
		document.getElementById("qqDiv").style.top=(document.documentElement.scrollTop)+140+"px";
	document.getElementById("qqDiv").style.left=(document.documentElement.scrollLeft+document.documentElement.clientWidth-document.getElementById("qqDiv").offsetWidth)+"px";
	}
var rightstr="<div id=\"qqDiv\" class=\"div\" style=\"width:116px; height:155px; position:absolute; right:0px; top:140px; background:url("+ImageFolder+"qqbg.jpg) no-repeat;\">";
rightstr+="<div style=\"padding-top:35px; text-align:center;\"><a target=\"blank\" href=\"tencent://message/?uin=272694725&amp;Site=彭尼亚&amp;Menu=yes\"><img border=\"0\" SRC=http://wpa.qq.com/pa?p=3:272694725:7 alt=\"qq1\"></a></div>";
rightstr+="<div style=\"padding-top:5px; text-align:center;\"><a target=\"blank\" href=\"tencent://message/?uin=272694725&amp;Site=彭尼亚&amp;Menu=yes\"><img border=\"0\" SRC=http://wpa.qq.com/pa?p=3:272694725:7 alt=\"qq1\"></a></div>";
rightstr+="<div style=\"padding-top:5px; text-align:center;\"><a target=\"blank\" href=\"tencent://message/?uin=272694725&amp;Site=彭尼亚&amp;Menu=yes\"><img border=\"0\" SRC=http://wpa.qq.com/pa?p=3:272694725:7 alt=\"qq1\"></a></div>";
rightstr+="</div>";
document.write(rightstr); 
window.setInterval("rightpop()",1);


//加入收藏夹  格式 <a href="javascript:addFav()" class="navf2">添加收藏</a> 
function  addFav() {   
             if  (document.all) {   
                window.external.addFavorite(document.location.href, document.title);   
            }   
             else   if  (window.sidebar) {   
            window.sidebar.addPanel(document.title, document.location.href,  "" );   
            }   
        }   

//<a href="javascript:void(0);" onclick="SetHome(this)">设为首页</a>  
function SetHome(obj){   
    try{   
		obj.style.behavior='url(#default#homepage)';
		obj.setHomePage(document.location.href)
    }catch(e){   
        if(window.netscape){   
            try{   
                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");   
            }catch(e){   
                //alert("抱歉，此操作被浏览器拒绝！\n\n请在浏览器地址栏输入"about:config"并回车然后将[signed.applets.codebase_principal_support]设置为'true'");   
            };   
        }else{   
            alert("抱歉，您所使用的浏览器无法完成此操作。\n\n您需要手动将'http://www.k686.com/'设置为首页。");   
        };   
    };   
};


$(function(){
document.getElementById('time').innerHTML=new Date().toLocaleDateString()+' 星期'+'日一二三四五六'.charAt(new Date().getDay());setInterval("document.getElementById('time').innerHTML=new Date().toLocaleDateString()+' 星期'+'日一二三四五六'.charAt(new Date().getDay());",1000);
})


/*
默认显示内容使用方法
defshow($("#msgarea")[0],'文明上网，理性发言');
或
defshow("#loginusr","images/def_pwd.gif",true);
*/
function defshow(id,str,type){
	if(type)
	{
		if($(id).attr("value")==""){$(id).css({"background":"url("+str+") no-repeat 5px center #ffffff"});}
		$(id).focus(function(){$(this).css({"background":"url() no-repeat 5px center #ffffff"});});
		$(id).blur(function(){if($(this).attr("value")==""){$(this).css({"background":"url("+str+") no-repeat 5px center #ffffff"});}});
	}
	else
	{
		if($(id).attr("value")==""){$(id).attr("value",str)};
		$(id).focus(function(){if($(this).attr("value")==str){$(this).attr("value","")}});
		$(id).blur(function(){if($(this).attr("value")==""){$(this).attr("value",str)}});
	}
}

$(function(){
	defshow($("#msgarea")[0],'文明上网，理性发言');
})



/**
 * 检查输入的邮箱格式是否正确
 * 输入:str  字符串
 * 返回:true 或 flase; true表示格式正确
 */
function checkEmail(str){
    if (str.match(/[A-Za-z0-9_-]+[@](\S*)(net|com|cn|org|cc|tv|[0-9]{1,3})(\S*)/g) == null) {
        return false;
    }
    else {
        return true;
    }
}
