function getCardType(text){
    if(text==1){
      document.getElementById("loginCardTypeDiv").style.display="block";
       document.getElementById("ustyle").innerHTML="卡&nbsp;&nbsp;号：";
      DWREngine.setAsync(false);
      CardActiveDwr.searchCurrentCardType(cardTypeFunction);
    }else{
       document.getElementById("loginCardTypeDiv").style.display="none";
    	 document.getElementById("ustyle").innerHTML="用户名：";
    } 
   
 
}
function cardTypeFunction(data){
 if (data.length != 0) 
	{ 
		var obj = document.getElementById("loginCardType");
	
		deleteOption(obj);
		
	    addOption("-1","--请选择卡类型--",obj);
	 
	    for(var i=0;i<data.length;i++)
	    {   
			addOption(data[i].cardType+"-"+data[i].visaCode,data[i].cardName,obj);
	    }
	  
	 }

}
//删除OPTION通用方法
function deleteOption(obj)
{ 
  
	var n=obj.options.length;
	for(i=n;i>=0;i--)
    {
		obj.remove(i);
		n=obj.options.length;
	}
}
//添加option通用方法
function addOption(code,name,obj)
{
	var option=document.createElement("option");
	option.value=code;
	option.text=name;
	obj.options.add(option);
}




  
function checkLoginForm()
  
{ 


  createXMLHttpRequest();

    var cardVCode=document.getElementById("veriadmin").value;
    var url="cardActiveAction.do?action=validateVcode&inputCode="+cardVCode+"&flag=1";
	xmlHttp.open("POST",url,true);
	
    xmlHttp.onreadystatechange=handleStateChanage1;
    xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
    xmlHttp.send(url);
}
  
function handleStateChanage1()
{
	if (xmlHttp.readyState==4)
	{  
		if(xmlHttp.status==200)
		{
			parseResults1();
		}
	}
}

function parseResults1(){
 
   responseText= xmlHttp.responseText; 
    
    var userName = jsTrim(document.getElementById("userName").value) ;	
	var password = jsTrim(document.getElementById("password").value);
	var veriadmin = jsTrim(document.getElementById("veriadmin").value);  	

	var cardType=document.getElementById("loginCardType").value;

	var loginType=document.getElementById("loginCardType").value;
 
	responseText=responseText.substr(0,1);
    
	if(loginType==1)
	{
		if(loginType=="1"&&cardType=="-1"){
		   alert("请选择卡类型！");
		   window.document.getElementById("loginCardType").focus();
		   return false;
		}
	}
	if(userName == "")
    {
		alert("请输入登录账号或卡号！");
		window.document.getElementById("userName").focus();
        return false;
    }
    if(password == "")
    {
		alert("请输入密码！");
		window.document.getElementById("password").focus();
        return false;
    }
   
	if(veriadmin == "")   
	{   
		alert("请输入验证码！"); 
		window.document.getElementById("veriadmin").focus();
		return false;  
	}
	else if(jsTrim(responseText)=="0")   
	{   
		alert("验证码输入错误！");   		
		return false; 
	}   
	else   
	{   
        document.getElementById("focusAdd").submit();  
	}   
   
}
