$(document).ready(function(){

	//选择相册
	$("#album_select").change(function(){
		url='/'+gxym+',photo{albumid}.html'
		value=$("#album_select").attr("value")
		if(value==0)
			url=url.replace("{albumid}","")
		else 
			url=url.replace("{albumid}","_"+value)
		//alert(url)
		window.location=url
	  });


}); 
function test(){
	//alert('test')
}
function loadComment(blogid,photoid,pn){
					//alert('hello')
					$("#comment").html('')
					$("#comment_page").html('')
                    $.ajax({
                        type: "get",
                        url: '/album/'+blogid+'/'+photoid+'/queryReplyList.html?date='+new Date()+"&pn="+pn,
                        dataType: 'json',
						success: function(reply){
							$("#comment").html('')
                            //alert('success'+reply.pagehtml)
                            html='<li><p class="tit2"><i class="fl"><a href="#"><img src="@img" /></a></i><a href="#">@username</a> 于@date说：<span><a href="#">回复</a></span></p><p>@ct</p></li>'
                            if(reply.totalcount==0)
                                $("#comment").html("没有评论")
                            else{
                                //$("#comment").html("有评论")
                                allhtml=''
                                $.each(reply.result,function(i,item){
                                   t=html.replace("@date",item['create_time'])
                                   t=t.replace("@username",item['sender_username']) 
                                   t=t.replace("@img",item['senderImg']) 
                                   t=t.replace("@ct",item['content']) 
                                   allhtml=allhtml+t
                                })
                                $("#comment").html($(allhtml))
								//$("#comment").after(reply.pagehtml)
								$("#comment_page").html(reply.pagehtml)
                            }

                        }
					});
	}
function copyHotBlogUrl(purl,aid,userid){
	var getUrl = '/hotblog/joinActivity.jspa';
	$.ajax({
	    type: "get",
	     url: getUrl,
	     data:{'userid':userid,'t':new Date().getTime()},
	     success: function(data){
	    	 if(data=='\r\nok'){
	    		 copy()
	    	 }else{
	    		 alert('对不起该博主还没有参加博主的评选活动，您可以邀请博主参加!')
	    	 }
	     }});
	var copy = function(){
		if (!purl) {
			return;
		}
		var txt = 'http://blog.jrj.com.cn/hotblog/viewArticle.jspa?articleId=' + aid + '&userInfo='+purl+'&userid='+userid;
		try{
			window.clipboardData.clearData();
			window.clipboardData.setData("Text", txt);
			var alt = new JRJ.ui.Alerts();
			alt.alert({
				draggable : true,
				okButton : '好了',
				message:"<p style='line-height:20px;'>文章标题和地址已经复制到剪切板，您可以按 CTRL+V粘贴到QQ、MSN等发送给好友！</p>",
				title:"分享连接为博主投票！"
			});
		}catch(e){
			dlg2 = new JRJ.ui.Dialogs();
			 dlg2.dialog2({
			  	title:"分享连接为博主投票！",
			  	content:'<textarea id="relationinput" style="height:60px;width:325px;border:1px solid #DDDDDD;">浏览器拒绝！您可以手动复制连接：'+txt+'粘贴到QQ、MSN等发送给好友！</textarea>',
			  	hasCancelBtn:false, 
				draggable:false,
			  	callback:function(a){},
			  	closeCallback:function(a){}
			  });
		}
	}
}
