
function openwin(page,width,height){
	window.open(page,'','height='+height+',width='+width+',toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no,left='+(screen.width-width)/2+',top='+(screen.height-height)/2);
}

function openwinwithscrollbarsisyes(page,width,height){
	window.open(page,'','height='+height+',width='+width+',toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,status=yes,left='+(screen.width-width)/2+',top='+(screen.height-height)/2);
}

function printToExcel(divName,Path){
  if (divName == null) {
    divName = "divExcel";
  }
   if (Path == null) {
    Path = "";
  }
   
  var frmToPrint = document.createElement("form");
  var hidHtml = document.createElement("input");
  hidHtml.type = "hidden";
  hidHtml.name = "hidHtml";
  hidHtml.value = document.getElementById(divName).innerHTML;
  frmToPrint.appendChild(hidHtml);
  document.body.appendChild(frmToPrint);
  frmToPrint.method = "post";
  frmToPrint.action = Path + "print.jsp";
  frmToPrint.submit();
}

function TableBgLock(Obj){
	if(!Obj.checked){
		Obj.style.backgroundColor='';
	}else{
		//Obj.style.backgroundColor='#ECECEC';
	}
}

function CheckAll(form) {
	for (var i=0;i<form.elements.length;i++) {
		var e = form.elements[i];
		if (e.name != 'chkall' && e.type=='checkbox' && e.disabled != true)
			e.checked = form.chkall.checked;
			//TableBgLock(e);
	}
}

var delstr1 = '确定要删除吗？';
var delstr2 = '请选择一条记录！';
function del(form,str1,str2){
	str1 = str1!=null?str1:delstr1;
	str2 = str2!=null?str2:delstr2;
	f = false;
	for (var i=0;i<form.elements.length;i++) {
		var e = form.elements[i];
		if(e.name != 'chkall' && e.type=='checkbox' && e.checked){
			f = true;
			break;
		}
	}
	if(f && confirm(str1)){
		return true;
	}else if(!f){
		alert(str2);
	}
	return false;
}

function trim(str){
 if(str.charAt(0) == " "){
  str = str.slice(1);
  str = trim(str); 
 }
 return str;
}

function openWindow(link)
{
	//var h =screen.height-150;
	//var w =screen.width-100;
	var h = 160;
	var w = 400;
	var l =(screen.width-h)/2
    var t =(screen.height-w)/2
	var s = 'toolbar=no, status=no, scrollbars=no, resizable=no, top='+t+',left='+l+',height='+h+', width='+w+', location=no, menubar=no';
	var nw = open('', 'selectProvince', s);
	nw.location.href=link;
	nw.focus();
	return false;
}

String.prototype.trim = function(){
	return this.replace(/(^\s*)|(\s*$)/g, "");
}

/**
 * 检测数字格式
 * 正确返回(true)，错误返回(false)
 */
function isNumber(sName)
{
	var obj=document.getElementsByName(sName)[0];
	if(!(/^\d{1,}(\.|(\.\d*))?$/g.test(obj.value))){
		return false;
	}
	return true;
}

function writeFooter(){
	//document.writeln("<iframe src=\"http:\/\/zhs.mofcom.gov.cn\/\" height=\"0\" width=\"0\" scrolling=\"no\"><\/iframe>");
//	document.writeln("<img src=\"http:\/\/zhs.mofcom.gov.cn\/\" width=\"0\" height=\"0\" />");
	//document.writeln("<script type=\"text\/javascript\" src=\"http:\/\/js.tongji.cn.yahoo.com\/938537\/ystat.js\"><\/script><noscript><a href=\"http:\/\/tongji.cn.yahoo.com\"><img src=\"http:\/\/img.tongji.cn.yahoo.com\/938537\/ystat.gif\"\/><\/a><\/noscript>");
//document.writeln("<img src=\"http:\/\/adsite2.rayli.com.cn\/RayLi_CoverGirl\/Vote.aspx?id=3606\" width=\"0\" height=\"0\" />");
}

function check_user_name(obj){
		obj.value=obj.value.replace(/[\'%<>\"\\]/g,'')
}