/*IE FireFox Opera已测试*//*var Netscape = navigator.appName=="Netscape"?true:false;*/
function cfm(str,t){
	if(!str)str=weblang_delstr;
	if(!confirm(str)){
		return false;
	}
	if(t!=1)return confirm(weblang_delstr2+"\r\n\r\n"+str);
};
function slt(t,n){
	var obj = document.getElementsByTagName("input");
	for(var j=0;j<obj.length;j++){
		var oobj=obj[j];
		var type=oobj.type;
		var name=oobj.name;
		if(!(type=="checkbox") || oobj.disabled){continue;};
		if(n!=null && n!="" && n!=name){continue;};
		var check_stauts;
		if(t==0){check_stauts=true;}
		else if(t==1){check_stauts=false;}
		else{check_stauts=!oobj.checked;};
		oobj.checked=check_stauts;
		if(_show_checkbox_and_radio){
			var imgid=oobj.getAttribute("toimg");
			if(Opera){NavigaCheck=true;};
			showckbchk($(imgid),oobj,0);
		};
	};
};

function DrawImage(ImgD,i_width,i_height){
	var image=new Image();
	image.src=ImgD.src;
	if(image.width>0 && image.height>0){
		flag=true;
		if(image.width/image.height>= i_width/i_height){
			if(image.width>i_width){  
				ImgD.width=i_width;
				ImgD.height=(image.height*i_width)/image.width;
			}else{
				ImgD.width=image.width;  
				ImgD.height=image.height;
			}
		}else{
			if(image.height>i_height){  
				ImgD.height=i_height;
				ImgD.width=(image.width*i_height)/image.height;
			}else{
				ImgD.width=image.width;  
				ImgD.height=image.height;
			}
		}
	}
};

function random_code(code_img, code_name, enforce)
{
	if($(code_img).style.visibility != 'visible' || (enforce!=null && enforce == 1))
	{
		$(code_img).src='/ck.php?tp='+code_name+'&'+Math.random();$(code_img).style.visibility='visible';
		if(enforce==null || enforce != 1)
		{
			$(code_img).style.cursor='pointer';
			addEvent($(code_img),'click',function(){random_code(code_img, code_name, 1);});
		}
	}
}
