﻿$(function(){
//搜索
$("#sbi").focus(function(){
	if($(this).val()=="搜索...")$(this).val("");
}).blur(function(){
	if($(this).val().length<2)$(this).val("搜索...");
});
$("#form_search").submit(function(){
	var v=$("#sbi").val();
	if(v=="搜索..." || v.length<2)return false;
});

//输入框
$("input,textarea").focus(function(){
	$(this).addClass("focus");
}).blur(function(){
	$(this).removeClass("focus");
});

//随机事件
setTimeout(function(){
	var randID=parseInt(Math.random()*10);
	switch(randID){
		case 0:
			$("#msg").html("推出3G版：<a href=\"http://www.itfeed.cn/3g\">www.itfeed.cn/3g</a>");
			break;
		case 1:
			$("#msg").html("试试ITFeed微博 <a href=\"http://t.itfeed.cn\">t.itfeed.cn</a>");
			break;
		case 2:
			$("#msg").html("ITFeed 寻php共同开发者 ^-^");
			break;
		case 3:
			$("#msg").html("我也每天翻一遍 ^-^");
			break;
		default:
			$.ajax({
				url:"getRSS.asp",
				cache:false,
				success:function(data){
					$("#msg").html(data);
				}
			});
	}
},2000);

});

//容错
window.onerror=function(){return true;}

//编码email
function email(id,domain){document.write("<a href=\"mailto:"+id+"@"+domain+"\">"+id+"@"+domain+"</a>");}

//加入收藏夹
function addF(t,u){
	try{window.external.addFavorite(u,t);}catch(e){try{window.sidebar.addPanel(t,u,"");}catch(e){alert("加入收藏失败，请使用Ctrl+D进行添加");}}
}