////////////////////////////
// 仿照delphi自定义的 Alert ， 方便调试
////////////////////////////
function memo(){}
memo.alert = function (str){
var memo_textarea;
	memo_textarea = document.getElementById("memo_textarea");
	if(memo_textarea==null){
	memo_textarea = document.createElement("textarea");
	memo_textarea.id="memo_textarea"
	memo_textarea.style.position = "absolute";
	memo_textarea.style.width='100px';
	memo_textarea.style.height='300px';
	memo_textarea.style.left = (document.documentElement.scrollWidth-parseInt(memo_textarea.style.width));  ;memo_textarea.style.top = "0";
	document.body.appendChild(memo_textarea);
	}
	if(str!="")
	memo_textarea.value = str+"\r\n" + memo_textarea.value;
}


////////////////////////////
//重设图片 宽 高
//使用方式: jq_resizeImgs( $(".xiaoguo123 > img") , 106,106);
////////////////////////////
function jq_resizeImgs( jqObj , maxWidth , maxHeight ){
	var resizeImgs_timer;

	function jq_resizeImgs_run(){
	var resize_count = 0;
	
		jqObj.each(function(){
		//memo.alert("aaa");
			if(this.clientWidth==0 || this.clientHeight==0 ) resize_count++; //如果图片没初始化

			if( this.clientWidth > maxWidth ){ //如果宽度太宽
				this.style.width = maxWidth+"px";
				this.style.height = "";
				resize_count++;
			}
			if( this.clientHeight > maxHeight ){//如果高度太高
				this.style.width = "";
				this.style.height =  maxHeight+"px";
				resize_count++;
			}
			
		});
		//关闭时间器
		if(resize_count==0) window.clearInterval(resizeImgs_timer);
	}
	resizeImgs_timer = window.setInterval( jq_resizeImgs_run , 1000 );
}

var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F9361a67720824867a4d421f1f4aea110' type='text/javascript'%3E%3C/script%3E"));


