﻿function killErrors() {
	return true;
}
window.onerror = killErrors;

function AutoScroll(obj){
	//alert(  );
	//$(obj).find("ul:first").css({marginTop:"0px"});
	$(obj).find("ul:first").animate({
			marginTop:"-200px"
	},500,function(){
			$(this).css({marginTop:"0px"}).find("li:first").appendTo(this);
	});
}


/*禁止右键*/
/*function click(e) {
	if (document.all) {
		if (event.button==2)
		{
			//alert("欢迎光临正太广告!");
			oncontextmenu='return false';
		}
		if (event.button==1||event.button==3) {
			oncontextmenu='return false';
		}
	}
	if (document.layers) {
		if (e.which == 3) {
		//alert("欢迎光临正太广告!");
		oncontextmenu='return false';
		}
	}
}
if (document.layers) {
	document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;
document.oncontextmenu = new Function("return false;");
//document.onselectstart = new function(return oSelect(event.srcElement));
document.onselectstart = new Function("return false;");
document.ondragstart = new Function("return false;");*/




//改变图片大小
function resizepic(thispic) {
	if(thispic.width>730) thispic.width=730;
}
//无级缩放图片大小
function bbimg(o) {
	return false;
	var zoom=parseInt(o.style.zoom, 10)||100;
	zoom+=event.wheelDelta/12;
	if (zoom>0) o.style.zoom=zoom+'%';
	return false;
}


//等比例缩放图片
 /**
   * ImgD：原图
   * maxWidth：允许的最大宽度
   * maxHeight：允许的最大高度
   */
function DrawImage(ImgD,FitWidth,FitHeight){
	var image=new Image();
	image.src=ImgD.src;
	if(image.width>0 && image.height>0){
		if(image.width/image.height>= FitWidth/FitHeight){
			if(image.width>FitWidth){
				ImgD.width=FitWidth;
				ImgD.height=(image.height*FitWidth)/image.width;
			}else{
				ImgD.width=image.width;
				ImgD.height=image.height;
			}
		} else{
			if(image.height>FitHeight){
				ImgD.height=FitHeight;
				ImgD.width=(image.width*FitHeight)/image.height;
			}else{
				ImgD.width=image.width;
				ImgD.height=image.height;
			}
		}
		ImgD.style.marginTop = (FitHeight-ImgD.height)/2+"px";
	}
}

// no margin
function DrawImageNomargin(ImgD,FitWidth,FitHeight){
	var image=new Image();
	image.src=ImgD.src;
	if(image.width>0 && image.height>0){
		if(image.width/image.height>= FitWidth/FitHeight){
			if(image.width>FitWidth){
				ImgD.width=FitWidth;
				ImgD.height=(image.height*FitWidth)/image.width;
			}else{
				ImgD.width=image.width;
				ImgD.height=image.height;
			}
		} else{
			if(image.height>FitHeight){
				ImgD.height=FitHeight;
				ImgD.width=(image.width*FitHeight)/image.height;
			}else{
				ImgD.width=image.width;
				ImgD.height=image.height;
			}
		}
	}
}

function ExpandImage(ImgD,FitWidth,FitHeight){
	var image=new Image();
	image.src=ImgD.src;
	if(image.width>0 && image.height>0){
		ImgD.width=FitWidth;
		ImgD.height=(image.height*FitWidth)/image.width;
		if(ImgD.height > FitHeight)
			ImgD.height = FitHeight;
	}
}

function ExpandImage1(ImgD,FixedWidth){     //固定图宽，然后后等比例缩放
	var image=new Image();
	image.src=ImgD.src;
	if (image.width < FixedWidth){
		ImgD.width = image.width;
		ImgD.height = image.height;
		return;
	}
	if(image.width>0 && image.height>0){
		ImgD.width=FixedWidth;
		ImgD.height=(image.height*FixedWidth)/image.width;
}
}

function fontZoom(size) {
	document.getElementById('article-content').style.fontSize=size+'px';
}
