/**
 * iframe自适应高度
 */
function iFrameHeight() {
	var ifm= document.getElementById("iframepage");
	var subWeb = document.frames ? document.frames["iframepage"].document : ifm.contentDocument;
	if(ifm != null && subWeb != null) {
		ifm.height = subWeb.body.scrollHeight;
	}
} 

/**
 * 加入到我的链接库
 */
function addMyLinks(title, url){
	if(confirm('确认收藏博客？'+title+'('+url+')')){
		showIFModal('/addMyLinks?t='+encodeURIComponent(title)+'&u='+url, '添加收藏', 350);
	}
}

/**
 * 加为我的好友
 */
function addMyFriend(){
	showIFModal('/addMyFriend', '添加好友', 350);
}

/**
 * 加为关注
 */
function addMyAtte(){
	showIFModal('/addMyAtte', '加为关注', 350);
}

/**
 * 发站内信
 */
function addMsg(){
	showIFModal('/addMsg', '发送站内信', 350);
}

/**
 * 添加收藏日志
 */
function addColl(title, blogid){
	if(confirm('确认收藏博文：'+title+'?')){
		showIFModal('/addColl?title='+encodeURIComponent(title)+'&blogid='+blogid, '收藏博文', 350);
	}
}

/**
 * 头部登录
 */
function TopLineLogin(){
	var username = $('#TB_Username').val(), userpwd = $('#TB_Userpwd').val();
	if(!username|| !userpwd){
		showMeg2("请填写完整");
//		initModal('<center>请填写完整!</center>', '提示');
		return false;
	}
}

/**
 * 博文评论分页
 */
function commentPage(page, id){
	$('#comment').load('/comment?id='+id+'&page='+page);
}


/**
 * 留言分页
 */
function leaveList(id){
	$('#leave').load('/leaveList?&page='+page);
}

//预加载图像区
url = new Array();
url[0] = "/kindeditor-3.5.2/skins/common/loading.gif";
imgObj = new Image();
for(x in url){
	imgObj.src = url[x];
}

$(function(){
//	$('.page a').click(function(){
//		$(this).parent().html("<img src='/kindeditor-3.5.2/skins/common/loading.gif' />")
//	})
	$('.bwt').click(function(){
		$(this).parent().find('.plc').slideToggle();
	})
})

/**
 * 交换日历头顶上的箭头
 */
var toggleCalTag=function(obj){
	var img = $(obj).find('img');
	if(img.attr('src')=='/res/blog/image/arrowup.gif') img.attr('src', '/res/blog/image/arrowdown.gif');
	else img.attr('src', '/res/blog/image/arrowup.gif');
}
