﻿function checkLen(Target) {	
    num = maxLen;
	StrLen = Target.value.length;
	if (StrLen > num){
		Target.value = Target.value.substring(0,num);
		charsLeft = 0;
	} else {
		charsLeft = num - StrLen;
	}
	
	var formElement = document.getElementById('remain');
    formElement.innerHTML=charsLeft;
	formElement.textContent=charsLeft;
}
function checkIdenLen(Target) {	
    num = maxLen;
	StrLen = Target.value.length;
	if (StrLen > num){
		Target.value = Target.value.substring(0,num);
		charsLeft = 0;
	} else {
		charsLeft = num - StrLen;
	}
	
	remainIden.innerHTML=charsLeft;
	remainIden.textContent=charsLeft;
}

function ClientForceInput(source, arguments)
{
    var re = new RegExp("(?:[<>]){1,}");
    var input = arguments.Value;
      if (!input.match(re)) {
        //alert("Successful match");
        arguments.IsValid= true;
      } else {
        //alert("No match");
        arguments.IsValid=  false;
      }      
}

function ClientEncodeBeforeSend(source, arguments)
{
     alert(source.id);
     //arguments.Value = hello;
     arguments.IsValid=  false;
}


function normaloption_checkedchanged(rad,radPersonalId)
 {
     // debugger;
     var radNormal = document.getElementById(radNormalId);
     var radPersonal = document.getElementById(radPersonalId);
     
     var trUploadFile = document.getElementById("trUploadFile");
     
     var trNormalToOption = document.getElementById("trNormalToOption");
     var trNormalToManually = document.getElementById("trNormalToManually");
     var trNormalToImport = document.getElementById("trNormalToImport");
     
     var normalSend = document.getElementById("normalSend");
     var personalSend = document.getElementById("personalSend");
          
     if (radNormal && radPersonal && trUploadFile && trNormalToManually && trNormalToImport && trNormalToOption && normalSend && personalSend)
     {
         trNormalToOption.style.display = "none";
         trNormalToManually.style.display = "none";
         trNormalToImport.style.display = "none";
         
         trUploadFile.style.display = "none";
         
         normalSend.style.display = "none";
         personalSend.style.display = "none";
         
         if (radNormal.checked)
         {
            normalSend.style.display = "inline";            
            if (document.all) // IE
            {
                trNormalToOption.style.display = "inline";
                trNormalToManually.style.display = "inline";
                trNormalToImport.style.display = "inline";
            }
            else
            {
                trNormalToOption.style.display = "table-row";
                trNormalToManually.style.display = "table-row";
                trNormalToImport.style.display = "table-row";
            }
         }         
         else if (radPersonal.checked)
         {
             personalSend.style.display = "inline";
             if (document.all) // IE
             {
                  trUploadFile.style.display = "inline";
             }   
             else
             {  
                  trUploadFile.style.display = "table-row";
             }          
         }
     }
 }

function feature_checkedchanged(radNormalId,radPersonalId)
 {
     // debugger;
     var radNormal = document.getElementById(radNormalId);
     var radPersonal = document.getElementById(radPersonalId);
     
     var trUploadFile = document.getElementById("trUploadFile");
     
     var trNormalToOption = document.getElementById("trNormalToOption");
     var trNormalToManually = document.getElementById("trNormalToManually");
     var trNormalToImport = document.getElementById("trNormalToImport");
     
     var normalSend = document.getElementById("normalSend");
     var personalSend = document.getElementById("personalSend");
          
     if (radNormal && radPersonal && trUploadFile && trNormalToManually && trNormalToImport && trNormalToOption && normalSend && personalSend)
     {
         trNormalToOption.style.display = "none";
         trNormalToManually.style.display = "none";
         trNormalToImport.style.display = "none";
         
         trUploadFile.style.display = "none";
         
         normalSend.style.display = "none";
         personalSend.style.display = "none";
         
         if (radNormal.checked)
         {
            normalSend.style.display = "inline";            
            if (document.all) // IE
            {
                trNormalToOption.style.display = "inline";
                trNormalToManually.style.display = "inline";
                trNormalToImport.style.display = "inline";
            }
            else
            {
                trNormalToOption.style.display = "table-row";
                trNormalToManually.style.display = "table-row";
                trNormalToImport.style.display = "table-row";
            }
         }         
         else if (radPersonal.checked)
         {
             personalSend.style.display = "inline";
             if (document.all) // IE
             {
                  trUploadFile.style.display = "inline";
             }   
             else
             {  
                  trUploadFile.style.display = "table-row";
             }          
         }
     }
 }

// function feature_checkedchanged(radNormalId,radPersonalId,radIdentifierId)
// {
//     // debugger;
//     var radNormal = document.getElementById(radNormalId);
//     var radPersonal = document.getElementById(radPersonalId);
//     var radIdentifier = document.getElementById(radIdentifierId);
//     
//     var trTo = document.getElementById("trTo");
//     var trUploadFile = document.getElementById("trUploadFile");
//     var trToIdentifier = document.getElementById("trToIdentifier");
//     
//     var normalSend = document.getElementById("normalSend");
//     var personalSend = document.getElementById("personalSend");
//     var identifierSend = document.getElementById("identifierSend");
//     
//          
//     if (radNormal && radPersonal && radIdentifier && trTo && trToIdentifier && trUploadFile && normalSend && personalSend && identifierSend)
//     {
//         trTo.style.display = "none";
//         trUploadFile.style.display = "none";
//         trToIdentifier.style.display = "none";
//         normalSend.style.display = "none";
//         personalSend.style.display = "none";
//         identifierSend.style.display = "none";
//         
//         if (radNormal.checked)
//         {
//            normalSend.style.display = "inline";            
//            if (document.all) // IE
//                trTo.style.display = "inline";
//            else
//                trTo.style.display = "table-row";
//         }         
//         else if (radPersonal.checked)
//         {
//             personalSend.style.display = "inline";
//             if (document.all) // IE
//             {
//                  trUploadFile.style.display = "inline";
//             }   
//             else
//             {  
//                  trUploadFile.style.display = "table-row";
//             }          
//         }
//         else if (radIdentifier.checked)
//         {
//             identifierSend.style.display = "inline";
//             if (document.all) // IE
//             {
//                  trToIdentifier.style.display = "inline";
//             }   
//             else
//             {  
//                  trToIdentifier.style.display = "table-row";
//             }    
//         }
//     }
// }
