function change(objDiv){
	var div = document.all(objDiv);
	if(div.style.display == "none"){
		div.style.display = "";
		eval("img"+objDiv).src="images/fold.gif";
	}else{
		div.style.display = "none";
		eval("img"+objDiv).src="images/folds.gif";
	}
}

function confirmdel(){
	if(window.confirm("确定删除吗？")){
		return true;
	}else{
		return false;
	}
}

function isint(n){
	if(n==parseInt(n)){
		return true;
	}else{
		return false;
	}
}

function ismail(str){
	var reg = /^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/;
	return reg.test(str);
}

function trim(str){
	return str.replace(/(^\s*)|(\s*$)/g, "");
}

function isdate(str){
	var reg = /^((((1[6-9]|[2-9]\d)\d{2})-(0?[13578]|1[02])-(0?[1-9]|[12]\d|3[01]))|(((1[6-9]|[2-9]\d)\d{2})-(0?[13456789]|1[012])-(0?[1-9]|[12]\d|30))|(((1[6-9]|[2-9]\d)\d{2})-0?2-(0?[1-9]|1\d|2[0-8]))|(((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))-0?2-29-))$/;
	return reg.test(str)
}

function ShowDialog(url,nwidth,nheight){
	x = (screen.width-nwidth)/2;
	y = (screen.height-nheight)/2;
	openformat = "height="+nheight+",width="+nwidth+",toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no,top="+y+",left="+x;
	window.open(url,"window",openformat)
}

function ShowDialogscroll(url,nwidth,nheight){
	x = (screen.width-nwidth)/2;
	y = (screen.height-nheight)/2;
	openformat = "height="+nheight+",width="+nwidth+",toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,status=no,top="+y+",left="+x;
	window.open(url,"window",openformat)
}

function changePage(intpage,url){
	window.location = url+"&intpage="+intpage;
}

function uploadfile(id,allowlist){
	var url = "img.asp?id="+id+"&allowlist="+allowlist;
	ShowDialog(url,350,80);
}

function upload(){
	var file1 = form1.file1.value;
	if(file1==""){
		alert("请选择要上传的文件！");
		return;
	}
	
	var bupload = false;
	var allowlist = form1.allowlist.value;
	if(allowlist != ""){
		var allows = allowlist.split(/,/);
		for(i = 0; i < allows.length; i++){
			var reg = new RegExp(".+\\."+allows[i]+"$","i");
			bupload = bupload || reg.test(form1.file1.value);
		}
	}else{
		bupload = true;
	}
	
	if(!bupload){
		alert("错误的文件类型！");
		return;
	}

	form1.submit();
}

function getDate(){
	var now = new Date();
	var year = now.getYear();
	var month = now.getMonth()+1;
	var day = now.getDate();
	return year + "-" + getStr(month,2) + "-" + getStr(day,2);
}

function getStr(str,n){
	str = str + "";
	for(i = str.length; i < n; i++){
		str = "0" + str;
	}
	return str;
}

function getlen(str){
	var reg = /[^\x00-\xff]/g;
	return str.replace(reg,"--").length;	
}