function openMax(theUrl,wlength,hlength)
{
    window.open(theUrl, "subWindow","width="+wlength+",height="+hlength+"");
}

function	createXmlHttpRequest()
{
	if (window.ActiveXObject) {
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	} else if (window.XMLHttpRequest) {
		xmlHttp = new XMLHttpRequest();
	}
	return xmlHttp;
}

//判断汉字
function onlyChinese(str)
{
	var re = /[^\u3447-\uFA29]/;
	if(re.test(str))
		return true;
	else
		return false;
}

//判断邮箱地址
function checkEmail(strEmail)
{
	var chkEmail = /^\s*([\w-]+(\.\w+)*@([\w-]+\.)+\w{2,3})\s*$/;
	if(!chkEmail.test(strEmail))
		return false;
	
	return true;
}

function checkIdcard(strId)
{
	var chkIdcard = /\d{16,18}/;
	if(!chkIdcard.test(strId))
		return false;
	
	return true;
}

function checkTelephone(strPhone)
{
	var chkPhone = /\d{7,8}/;
	if(!chkPhone.test(strPhone))
		return false;
	
	return true;
}

//addItem()
function	addItem(fSelect,tSelect)
{
	var	addTmp = new Array();
	var tMaxIndex = tSelect.options.length;
	var addFlag;
	for(i = 1; i < fSelect.options.length; i++) {
		if(fSelect.options[i].selected) {
			addFlag = true;
			for(e = 1; e < tMaxIndex; e++) {
				if(fSelect.options[i].value == tSelect.options[e].value) {
					alert("您选择的项目\"" + tSelect.options[e].text + "\"已经存在，不需要重复添加！")
					addFlag = false;
					break;
				}
			}
			if(addFlag)
				addTmp = addTmp.concat(i);
		}
	}
	if(addTmp.length == 0) {
		alert("请选择要添加的项目！");
		return ;
	}
	//添加项目
	for(ii = 0; ii < addTmp.length; ii++) {
		tSelect.options[tMaxIndex + ii] = new Option(fSelect.options[addTmp[ii]].text,fSelect.options[addTmp[ii]].value);
	}
}

//function	delItem()
function	delItem(fSelect)
{
	var	delTmpId = new Array();
	var	delTmpName = new Array();
	for(i = 1; i < fSelect.options.length; i++) {
		if(!fSelect.options[i].selected) {
			delTmpId = delTmpId.concat(fSelect.options[i].value);
			delTmpName = delTmpName.concat(fSelect.options[i].text);
		}
	}
	if(delTmpId.length == fSelect.options.length - 1) {
		alert("您没有选择要删除的项目！");
		return ;
	}
	
	fSelect.options.length = delTmpId.length + 1;
	for(ii = 1; ii < fSelect.options.length; ii++) {
		fSelect.options[ii].value = delTmpId[ii - 1];
		fSelect.options[ii].text = delTmpName[ii - 1];
	}
}