/*
功能：重新取得验证码
fileSrc 路径
*/
function refreshimg(fileSrc)
{
  document.all.chkcode.src=fileSrc+'Include/checkcode.asp?s='+Math.random();
}

/*
功能：验证表单
form_obj 表单名称-OBJ
chkurl 验证链接 ParaCheck.asp
chktype 验证类型
cgts 成功提示
formName 表单名称
*/
function CheckForm(form_obj,chkurl,chktype,cgts,formName)
{
    //创建AJAX对象	
if(window.ActiveXObject){
    http_request = new ActiveXObject("Microsoft.XMLHTTP");
}else if(window.ActiveXObject){
    http_request = new ActiveXObject("Msxml2.XMLHTTP.4.0");
}else if(window.ActiveXObject){
    http_request = new ActiveXObject("Msxml2.XMLHTTP");
}else if(window.XMLHttpRequest){
   http_request = new XMLHttpRequest();
}	
    //alert(form_obj);
	var query_string='';
    var and='';
    for (var i=0;i<form_obj.length ;i++ )
    {
        e=form_obj[i];
    
        if (e.name) {
            if (e.type=='select-one') {
                element_value=e.options[e.selectedIndex].value;
            } else if (e.type=='select-multiple') {
                for (var n=0;n<e.length;n++) {
                    var op=e.options[n];
                    if (op.selected) {
                        //query_string+=and+e.name+'='+encodeURIComponent(op.value);
                        //query_string+=and+e.name+'='+op.value;
						query_string+=and+e.name+'='+encodeURIComponent(escape(op.value));
                        and="&"
                    }
                }
                continue;
            } else if (e.type=='checkbox' || e.type=='radio') {
                if (e.checked==false) {   
                    continue;   
                }   
                element_value=e.value;
            } else if (typeof e.value != 'undefined') {
                element_value=e.value;
            } else {
                continue;
            }
            //query_string+=and+e.name+'='+encodeURIComponent(element_value);
            //query_string+=and+e.name+'='+element_value;
            query_string+=and+e.name+'='+encodeURIComponent(escape(element_value));
            and="&"
        }

    }
	//分离URL
		chkurls=chkurl.split("?");
		if (chkurls[1]=='' || typeof chkurls[1]=='undefined')
		{
			chkurl=chkurls[0]+"?"; //test.asp?
		}
		else
		{
			chkurl=chkurls[0]+"?"+chkurls[1]+"&"; //test.asp?test=1&
		}
	var form_method=form_obj.method.toUpperCase(); //将表单方法名称转换－大写
	//alert(form_method);
	if (form_method=='GET') {
	  query_string=null;
	  var new_chkurl=""+chkurl+query_string+"&chktype="+chktype+"&timestamp="+new Date().getTime();
	}
	if (form_method=='POST') {
	  var new_chkurl=""+chkurl+"timestamp="+new Date().getTime();
	  query_string="chktype="+chktype+"&"+query_string;
	}
	//alert(new_chkurl);
	//alert(query_string);
	
    http_request.open(form_method,new_chkurl,false);
	if (form_method=='POST') {
	  http_request.setrequestheader("Content-Length",query_string.length); 
	  http_request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	}
	http_request.send(query_string);
    var returntxt=unescape(http_request.responseText)
	
	if (returntxt == '') {
	  if (cgts != '') {
	    alert(cgts); //成功提示
	  }
	  form_obj.submit();
	} else {		
	  ReturnTxt(returntxt,formName);
	}
}

function ReturnTxt(returntxt,formName)
{
	  //分离返回参数
      var arr_returntxt = new Array();
      arr_returntxt=returntxt.split("|");	
	  alertTXT=arr_returntxt[0];
	  inputName=arr_returntxt[1];
	  zxURL=arr_returntxt[2];
	  
	  if (alertTXT == '') {
	  	alertTXT = '参数错误';	
	  }		
	  alert(alertTXT);
	  if (zxURL !='') {
	    self.window.location=zxURL;
	  }  
	  if (inputName != '') {
	    document.all(formName).all(inputName).focus();
	  }
	  return false;
}

function CheckInput(str,runurl,operid,formName,inputName)
{

if(window.ActiveXObject){
    http_request = new ActiveXObject("Microsoft.XMLHTTP");
}else if(window.ActiveXObject){
    http_request = new ActiveXObject("Msxml2.XMLHTTP.4.0");
}else if(window.ActiveXObject){
    http_request = new ActiveXObject("Msxml2.XMLHTTP");
}else if(window.XMLHttpRequest){
   http_request = new XMLHttpRequest();
}

  var linkurl=""+runurl+"?operid="+operid+"&str="+str+"&timestamp="+new Date().getTime()
  //alert(linkurl);
  http_request.open("GET",linkurl,false);
  http_request.send(null);

  var returntxt=unescape(http_request.responseText)
  //alert(returntxt);
  if (operid=='会员登录') {
    if (returntxt.length>0){
	  ReturnTxt(returntxt,formName);
    } else {
	  document.all(formName).submit();	
	}
  }  
}


/*
功能：操作提示
TsContent 提示内容
*/
function CzTS(TsContent)
{	
	if (confirm(TsContent)) {
	  return true;
	}
	return false;
}


/*
功能：操作警告
TsContent 警告内容
*/
function CzWarn(WarnContent)
{	
	alert(WarnContent);
}

function doZoom(n)
{	
	document.getElementById("Content").style.fontSize=n+"px";
}

function getRadioBoxValue(radioName)  
{  
            var obj = document.getElementsByName(radioName);            
              for(i   =   0;   i   <   obj.length;   i++)    {  
                  if(obj[i].checked)    {  
                          return   obj[i].value;  
                  }  
              }          
             return "undefined";        
}

//将单字节转换成双直接
String.prototype.len=function()   
{   
	return   this.replace(/[^\x00-\xff]/g,"**").length;   
}


function isNumber(INum) 
{ 
  var Letters = "1234567890"; 
  var i; 
  var c; 
  for( i = 0; i < INum.length; i ++ ) 
  { 
    c = INum.charAt( i ); 
    if (Letters.indexOf( c ) == -1) 
    { 
      return false; 
    } 
  } 
    return true; 
} 

function isInteger(INum)
{
  var IsNum = /^[-]{0,1}[0-9]{1,}$/;
  return IsNum.test(INum);
}

function isEmail(Email)
{
  var IsEmail = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;
  return IsEmail.test(Email);
}

function isValidStr(Str) 
{ 
  var Letters = "'"; 
  var i; 
  var c; 
  for( i = 0; i < Str.length; i ++ ) 
  { 
    c = Str.charAt( i ); 
    if (Letters.indexOf( c ) == 0) 
    { 
	  return true;
    } 
  } 
    return false; 
}

function OpenDialog(ToPage,InputName,FormName){
  var arr=showModalDialog(ToPage, '', 'dialogWidth:800px; dialogHeight:600px; help: no; scroll: yes; status: no');
  if(arr!=null){ 
	if(FormName=='SendSmsForm'){  
      document.all(FormName).all(InputName).value+=arr;
	}else{
	  document.all(FormName).all(InputName).value=arr;
	}
  }
}

function links_onchange() {
	if ( document.getElementById("links").value == "" )
		return; 
	window.open( document.getElementById("links").value );
}

//测字符串实际长度
String.prototype.Tlength = function(){var arr=this.match(/[^\x00-\xff]/ig);return this.length+(arr==null?0:arr.length);}

//字符串左取
String.prototype.left = function(num,mode){if(!/\d+/.test(num))return(this);var str = this.substr(0,num);if(!mode) return str;var n = str.Tlength() - str.length;num = num - parseInt(n/2);return this.substr(0,num);}

//字符串右取
String.prototype.right = function(num,mode){if(!/\d+/.test(num))return(this);var str = this.substr(this.length-num);if(!mode) return str;var n = str.Tlength() - str.length;num = num - parseInt(n/2);return this.substr(this.length-num);}

//字符串包含
String.prototype.GetCount = function(str,mode){return eval("this.match(/("+str+")/g"+(mode?"i":"")+").length");}

//字符串去除两端空字符
String.prototype.Trim=function(){return this.replace(/(^\s*)|(\s*$)/g,"");}
String.prototype.Ltrim = function(){return this.replace(/(^\s*)/g, "");}
String.prototype.Rtrim = function(){return this.replace(/(\s*$)/g, "");}

function onEnterClick(event)
{
        var eventObj=(event==null) ? window.event : event;
        var keyCode = (eventObj.which) ? eventObj.which : eventObj.keyCode;
        if(keyCode == 13){
                return true;
        }else{
                return false;
        }
}

//function showdiv(frname,frurl,divcss) {
//	var obj=document.getElementById(divcss);
//    parent.frames[""+frname+""].location.href=frurl;
//	
//	if(obj.style.display=="none")
//	{
//	    obj.style.display="block";
//		obj.style.height=document.body.clientHeight+"px";
//	}
//	else
//	{
//		obj.style.display="none";
//		obj.style.height=document.body.clientHeight+"px";
//		parent.frames[""+frname+""].location.href=frurl;
//	}
//}

<!--
//第一种形式 第二种形式 更换显示样式
function setTab(name,cursel,n){
 for(i=1;i<=n;i++){
  var menu=document.getElementById(name+i);
  var con=document.getElementById("con_"+name+"_"+i);
  menu.className=i==cursel?"hover":"";
  con.style.display=i==cursel?"block":"none";
 }
}
//-->