﻿//lazyload调用
$(function() {
	$(".post-body img").lazyload({
		placeholder : "http://www.wilf.cn/image/grey.gif",       
		effect      : "fadeIn"
	});
});

//goto 返回顶部
$(function () { $("<div id='class_gotop' style='position:fixed;right:10px;bottom:10px;z-index:100;display:none;'><a id='class_a_gotop' title='回到顶部' style='display:block;_display:none;height:50px;width:50px;background:url(\"http://www.wilf.cn/THEMES/Sina/STYLE/Yellow/top_button_off.gif\");' href='javascript:'></a></div>").appendTo("body"); $(window).scroll(function () { if ($(window).scrollTop() > 200) { $("#class_gotop").fadeIn("slow") } else { $("#class_gotop").fadeOut("slow") } }); $("#class_a_gotop").click(function () { $("html,body").animate({ scrollTop: 0 }, 600) }).hover(function () { $(this).attr("style", "display:block;_display:none;height:50px;width:50px;background:url('http://www.wilf.cn/THEMES/Sina/STYLE/Yellow/top_button_on.gif');") }, function () { $(this).attr("style", "display:block;_display:none;height:50px;width:50px;background:url('http://www.wilf.cn/THEMES/Sina/STYLE/Yellow/top_button_off.gif');") }) });

//折叠摘要部分 
function showhidediv(id,openclose){
	try{
		if(document.getElementById(id)){
			if(document.getElementById(id).style.display=='none'){
				document.getElementById(id).style.display='block';
				openclose.className="upArrow"
			}else{
				document.getElementById(id).style.display='none';
				openclose.className="downArrow"
			}
		}
		}catch(e){}
} 

//运行代码
function runEx(cod1)  {
	 cod=document.getElementById(cod1)
	  var code=cod.value;
	  if (code!=""){
		  var newwin=window.open('','','');  
		  newwin.opener = null 
		  newwin.document.write(code);  
		  newwin.document.close();
	}
}

//另存代码
function doSave(obj) {
	var winname = window.open('', '_blank', 'top=10000');
	winname.document.open('text/html', 'replace');
	winname.document.writeln(obj.value);
	winname.document.execCommand('saveas','','code.htm');
	winname.close();
}
