var ua = navigator.userAgent.toLowerCase();
	isIE = ((ua.indexOf("msie") != -1) && (ua.indexOf("opera") == -1) && (ua.indexOf("webtv") == -1));

function _select_0(_2,_3) {
	for(i=0;i<document.getElementById(_2).length;i++){
		if (document.getElementById(_2).options[i].value == _3){
		 document.getElementById(_2).options[i].selected=true;
		}
	}
}
function _select_1(_2,_3) {
	for(i=0;i<document.getElementById(_2).length;i++){
		if (_3.indexOf(document.getElementById(_2).options[i].value.toLowerCase())>-1){
		 document.getElementById(_2).options[i].selected=true;
		}
	}
}
function hideElms(elmTag) {
	for (i=0; i<document.all.tags(elmTag).length; i++){
		obj = document.all.tags(elmTag)[i];
		if (!obj || !obj.offsetParent) continue;
		obj.style.visibility = "hidden";
	}
}

function showElms(elmTag) {
	for (i=0; i<window.parent.document.all.tags(elmTag).length; i++){
		obj = window.parent.document.all.tags(elmTag)[i];
		if (!obj || !obj.offsetParent) continue;
		obj.style.visibility = "visible";
	}
}

function showElms_1(elmTag) {
	for (i=0; i<document.all.tags(elmTag).length; i++){
		obj = document.all.tags(elmTag)[i];
		if (!obj || !obj.offsetParent) continue;
		obj.style.visibility = "visible";
	}
}

function show_upload(_1,_2,_3) {
	if(isIE){
		hideElms('select');
	}
	else{
		document.body.style.overflow="hidden";
	}
	document.getElementById(_2).style.display = "block";
	if(document.all){document.getElementById(_2).style.top = document.body.scrollTop;}
	document.getElementById(_2).src= 'images/load.gif';
	//window.setTimeout("document.getElementById('"+_2+"').src='upload.asp?formPath="+encodeURIComponent(_3)+"&inputname="+_4+"'",1000);
	window.setTimeout("document.getElementById('"+_2+"').src='"+_3+"'",500);
	//document.getElementById(_2).src= _3;
	var arrayPageScroll = getPageScroll();
	var arrayPageSize = getPageSize();

	var lightboxTop = arrayPageScroll[1] + ((arrayPageSize[3] - 35 - 400) / 2);
	var lightboxLeft = ((arrayPageSize[0] - 20 - 660) / 2);

	document.getElementById(_2).style.top = (lightboxTop < 0) ? "0px" : lightboxTop + "px";
	document.getElementById(_2).style.left = (lightboxLeft < 0) ? "0px" : lightboxLeft + "px";
	document.getElementById(_1).style.height =arrayPageSize[1];
	document.getElementById(_1).style.width = arrayPageSize[0];
	document.getElementById(_1).style.display = "block";
}

function hidden_upload(_1,_2) {
	if(isIE){
		showElms('select')
	}
	else{
		window.parent.document.body.style.overflow="auto";
	}
	window.parent.document.getElementById(_2).style.display = "none";
	window.parent.document.getElementById(_2).src = "about:blank";
	window.parent.document.getElementById(_1).style.display = "none";
}

function hidden_upload_1(_1,_2) {
	if(isIE){
		showElms_1('select')
	}
	else{
		document.body.style.overflow="auto";
	}
	document.getElementById(_2).style.display = "none";
	document.getElementById(_2).src = "about:blank";
	document.getElementById(_1).style.display = "none";
}
function openScript(url, width, height){
	var Win = window.open(url,"openScript",'width=' + width + ',height=' + height + ',resizable=0,scrollbars=no,menubar=no,status=no,left=200, top=200,screenX=500,screenY=100' );
}

function _c_f(_1,_2,_3,_4){
/*
_1:input ID
_2:Min Length
_3:Max Length
_4:error meSsAge
*/
var strl=trim(document.getElementById(_1).value);
	if (strl.length<_2 && _2!=0)
	{
		return('错误,'+_4+'最小长度是:'+_2+'字符');
	}
	if (strl.length>_3 && _3!=0)
	{
		return ('错误,'+_4+'最大长度是:'+_3+'字符');
	}
	return '';
}
function _c_f_1(_1,_2){
	var strx=document.getElementById(_1);
	if (strx.options[strx.selectedIndex].value.length==0)
	{
		return('错误,请选择'+_2);
	}else{
		return '';
	}
}

function ltrim(s){
 return s.replace( /^\s*/, "");
}

function rtrim(s){
 return s.replace( /\s*$/, "");
}
function trim(s){
 return rtrim(ltrim(s));
}

function _s_l(_1,_2){
	document.getElementById(_1).innerHTML='<h2>'+_2+'</h2>';
	document.getElementById(_1).style.display='block';
}
function _h_l(_1){
	document.getElementById(_1).style.display='none';
}
function _img_0(_1,_2){
	document.getElementById(_1).innerHTML='<img src="'+document.getElementById(_2).value+'" alt="" />';
}
//
// getPageScroll()
// Returns array with x,y page scroll values.
// Core code from - quirksmode.org
//
function getPageScroll(){

	var yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

	arrayPageScroll = new Array('',yScroll)
	return arrayPageScroll;
}



//
// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.org
// Edit for Firefox by pHaez
//
function getPageSize(){

	var xScroll, yScroll;

	if (window.innerHeight && window.scrollMaxY) {
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}

	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}

	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else {
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
	return arrayPageSize;
}
function sAlert(txt,struri){
	//var eSrc=(document.all)?window.event.srcElement:arguments[1];
	if(isIE)hideElms('select');
	var shield = document.createElement("DIV");
	shield.id = "shield";
	shield.style.position = "absolute";
	shield.style.left = "0px";
	shield.style.top = "0px";
	shield.style.width = "100%";
	//shield.style.height = document.documentElement.clientHeight+1000+"px";
	shield.style.height =((document.documentElement.clientHeight>document.documentElement.scrollHeight)?document.documentElement.clientHeight:document.documentElement.scrollHeight)+"px";
	shield.style.background = "#333";
	shield.style.textAlign = "center";
	shield.style.zIndex = "10000";
	shield.style.filter = "alpha(opacity=0)";
	shield.style.opacity = 0;
	var alertFram = document.createElement("DIV");
	alertFram.id="alertFram";
	alertFram.style.position = "absolute";
	alertFram.style.left = "50%";
	alertFram.style.top = "50%";
	alertFram.style.marginLeft = "-225px" ;
	alertFram.style.marginTop = -75+document.documentElement.scrollTop+"px";
	alertFram.style.width = "450px";
	alertFram.style.height = "150px";
	alertFram.style.background = "#ccc";
	alertFram.style.textAlign = "center";
	alertFram.style.lineHeight = "150px";
	alertFram.style.zIndex = "10001";

	strHtml  = "<div style=\"margin:0px;padding:0px;width:100%\">\n";
	strHtml += "	<div style=\"background:#FF6500;text-align:left;padding-left:20px;font-size:14px;font-weight:bold;height:25px;line-height:25px;border:1px solid #FF9E33;\">[Information]</div>\n";
	strHtml += "	<div style=\"background:#fff;text-align:center;font-size:12px;height:120px;line-height:120px;border-left:1px solid #FF9E33;border-right:1px solid #FF9E33;\">"+txt+"</div>\n";
	strHtml += "	<div style=\"background:#FFECDF;text-align:center;font-weight:bold;height:35px;line-height:35px; border:1px solid #FF9E33;\"><input type=\"button\" value=\"O K\" id=\"do_OK\" onclick=\"doOk('"+struri+"')\" /></div>\n";
	strHtml += "</div>\n";
	alertFram.innerHTML = strHtml;
	document.body.appendChild(alertFram);
	document.body.appendChild(shield);
	this.setOpacity = function(obj,opacity){
		if(opacity>=1)opacity=opacity/100;
		try{ obj.style.opacity=opacity; }catch(e){}
		try{
			if(obj.filters.length>0&&obj.filters("alpha")){
				obj.filters("alpha").opacity=opacity*100;
			}else{
				obj.style.filter="alpha(opacity=\""+(opacity*100)+"\")";
			}
		}catch(e){}
	}
	var c = 0;
	this.doAlpha = function(){
		if (++c > 20){clearInterval(ad);return 0;}
		setOpacity(shield,c);
	}
	var ad = setInterval("doAlpha()",1);
	this.doOk = function(stru){
		document.body.removeChild(alertFram);
		document.body.removeChild(shield);
		//eSrc.focus();
		document.body.onselectstart = function(){return true;}
		document.body.oncontextmenu = function(){return true;}
		if(isIE)showElms_1('select');
		if (stru!='' && stru!='undefined' &&stru!='null')
		{
			document.location=stru;
		}
	}
	document.getElementById("do_OK").focus();
	//eSrc.blur();
	//document.body.onselectstart = function(){return false;}
	//document.body.oncontextmenu = function(){return false;}
}
function dAlert(txt,$uri,$furi){
	//var eSrc=(document.all)?window.event.srcElement:arguments[1];
	if(isIE)hideElms('select');
	var shield = document.createElement("DIV");
	shield.id = "shield";
	shield.style.position = "absolute";
	shield.style.left = "0px";
	shield.style.top = "0px";
	shield.style.width = "100%";
	//shield.style.height = document.documentElement.clientHeight+"px";
	shield.style.height =((document.documentElement.clientHeight>document.documentElement.scrollHeight)?document.documentElement.clientHeight:document.documentElement.scrollHeight)+"px";
	shield.style.background = "#333";
	shield.style.textAlign = "center";
	shield.style.zIndex = "10000";
	shield.style.filter = "alpha(opacity=0)";
	shield.style.opacity = 0;
	var alertFram = document.createElement("DIV");
	alertFram.id="alertFram";
	alertFram.style.position = "absolute";
	alertFram.style.left = "50%";
	alertFram.style.top = "50%";
	alertFram.style.marginLeft = "-225px" ;
	alertFram.style.marginTop = -75+document.documentElement.scrollTop+"px";
	alertFram.style.width = "450px";
	alertFram.style.height = "150px";
	alertFram.style.background = "#ccc";
	alertFram.style.textAlign = "center";
	alertFram.style.lineHeight = "150px";
	alertFram.style.zIndex = "10001";

	strHtml  = "<div style=\"margin:0px;padding:0px;width:100%\">\n";
	strHtml += "	<div style=\"background:#FF6500;text-align:left;padding-left:20px;font-size:14px;font-weight:bold;height:25px;line-height:25px;border:1px solid #FF9E33;\">[系统提示]</div>\n";
	strHtml += "	<div style=\"background:#fff;text-align:center;font-size:12px;height:120px;line-height:120px;border-left:1px solid #FF9E33;border-right:1px solid #FF9E33;\">"+txt+"</div>\n";
	strHtml += "	<div style=\"background:#FFECDF;text-align:center;font-weight:bold;height:35px;line-height:35px; border:1px solid #FF9E33;\"><input type=\"button\" value=\"返 回\" id=\"do_OK\" onclick=\"doOk('"+$uri+"')\" />&nbsp;&nbsp;<input type=\"button\" value=\"继 续\" id=\"do_OK_change\" onclick=\"doOk('"+$furi+"')\" /></div>\n";
	strHtml += "</div>\n";
	alertFram.innerHTML = strHtml;
	document.body.appendChild(alertFram);
	document.body.appendChild(shield);
	this.setOpacity = function(obj,opacity){
		if(opacity>=1)opacity=opacity/100;
		try{ obj.style.opacity=opacity; }catch(e){}
		try{
			if(obj.filters.length>0&&obj.filters("alpha")){
				obj.filters("alpha").opacity=opacity*100;
			}else{
				obj.style.filter="alpha(opacity=\""+(opacity*100)+"\")";
			}
		}catch(e){}
	}
	var c = 0;
	this.doAlpha = function(){
		if (++c > 20){clearInterval(ad);return 0;}
		setOpacity(shield,c);
	}
	var ad = setInterval("doAlpha()",1);
	this.doOk = function($u){
		document.body.removeChild(alertFram);
		document.body.removeChild(shield);
		//eSrc.focus();
		document.body.onselectstart = function(){return true;}
		document.body.oncontextmenu = function(){return true;}
		if(isIE)showElms_1('select');
		if ($u!='' && $u!='undefined' &&$u!='null')
		{
			document.location.href=$u;
		}
	}
	//document.getElementById("do_OK").focus();
	//eSrc.blur();
	//document.body.onselectstart = function(){return false;}
	//document.body.oncontextmenu = function(){return false;}
}
// return the value of the radio button that is checked
// return an empty string if none are checked, or
// there are no radio buttons
function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

// set the radio button with the given value as being checked
// do nothing if there are no radio buttons
// if the given value does not exist, all the radio buttons
// are reset to unchecked
function setCheckedValue(radioObj, newValue) {
	if(!radioObj)
		return;
	var radioLength = radioObj.length;
	if(radioLength == undefined) {
		radioObj.checked = (radioObj.value == newValue.toString());
		return;
	}
	for(var i = 0; i < radioLength; i++) {
		radioObj[i].checked = false;
		if(radioObj[i].value == newValue.toString()) {
			radioObj[i].checked = true;
		}
	}
}

function doOkp(url){
	document.body.removeChild(document.getElementById("alertFram"));
	document.body.removeChild(document.getElementById("shield"));
	if (url!='' && url!='undefined' &&url!='null')
		{
			document.location.href=url;
		}
}

