if(top.location!=self.location)top.location=self.location;

$(document).ready(function(){
	$(".btn_show_copy_div").click(function () {
		if ($('#cp_url').val()=="") {
			var pageUrl = urlFormat;
			pageUrl = pageUrl.replace("#ALBUMID#", albumId);
			pageUrl = pageUrl.replace("#PAGE#", 0);
			var pageTitle = $("#spn_title").html();
			$('#cp_url').val(pageTitle+" "+pageUrl);

			var ubbStr = htmlStr = srcStr = pageTitle+" \n\n ";
			var tmpSrc = '';
			$("img.img_big").each(function () {
				tmpSrc = $(this).attr("src");
				ubbStr += "[url="+pageUrl+"][img]"+tmpSrc+"[/img][/url] \n\n ";
				htmlStr += "<a href='"+pageUrl+"' title='"+pageTitle+"' ><img src='"+tmpSrc+"' border='0'></a> <br> \n";
				srcStr += tmpSrc+" \n\n ";
			});
			$('#cp_ubb').val(ubbStr);
			$('#cp_html').val(htmlStr);
			$('#cp_src').val(srcStr);
		}
		$('#copy_div').slideToggle();
	});

	$('#cp_url, #cp_ubb, #cp_html, #cp_src').click(function () {
		this.select();
	});

	$('.link_cp_url, .link_cp_ubb, .link_cp_html, .link_cp_src').click(function () {
		var ua = navigator.userAgent;
		var msieOffset = ua.indexOf("MSIE");
		if(msieOffset > 0){
			var clipBoardContent;
			var t = $(this).attr("class");
			var l = t.length;
			var copyType = t.substr(5, l-0-5);
			clipBoardContent = $("#"+copyType).val();
			window.clipboardData.setData("Text", clipBoardContent);
			switch (copyType){
				case 'cp_url': alert("复制成功,请粘贴到您的QQ/MSN上推荐给你的好友."); break;
				case 'cp_src': alert("复制成功,您可以单独引用这张图片."); break;
				case 'cp_ubb': alert("复制成功,请粘贴到您的论坛帖子中."); break;
				case 'cp_html': alert("复制成功,请粘贴到您的网页代码中."); break;
			}
		}else{
			alert("您的浏览器不支持此功能!\n请手动复制文本框中的代码!");
		}
	});
});

function getFavHtmlCode() {
	return "<a href=\"javascript:window.open('http://cang.baidu.com/do/add?it='+encodeURIComponent(document.title.substring(0,76))+'&iu='+encodeURIComponent(location.href)+'&fr=ien#nw=1','_blank','scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes'); void 0\">☆添加到百度搜藏</a>　<a href=\"javascript:window.open('http://shuqian.qq.com/post?from=3&title='+encodeURIComponent(document.title)+'&uri='+encodeURIComponent(document.location.href)+'&jumpback=2&noui=1','favit','width=930,height=470,left=50,top=50,toolbar=no,menubar=no,location=no,scrollbars=yes,status=yes,resizable=yes');void(0)\">☆收藏到QQ书签</a>　<a href=\"javascript:window.open('http://myweb.cn.yahoo.com/popadd.html?url='+encodeURIComponent(document.location.href)+'&title='+encodeURIComponent(document.title), 'Yahoo','scrollbars=yes,width=440,height=440,left=80,top=80,status=yes,resizable=yes');void(0);\">☆添加到雅虎收藏<sup>+</sup></a>　<a href=\"javascript:void(0);\" onclick=\"if(window.sidebar)window.sidebar.addPanel(document.title, document.location.href, ''); else if( document.all )window.external.AddFavorite(document.location.href, document.title); else if(window.opera && window.print)return true;\">☆添加到收藏夹</a>";
}
