﻿// JScript File

//myButton
function ClientClick(myButton) 
{
// Client side validation
if (typeof (Page_ClientValidate) == 'function') 
{
if (Page_ClientValidate() == false)
{ return false; 
}
}

//make sure the button is not of type "submit" but "button"
if (myButton.getAttribute('type') == 'button') 
{
// disable the button
myButton.disabled = true;
myButton.className = "btn-inactive";
myButton.value = "processing..."; 


}
return true;
}


function ClientSideClick(myButton) 
{
// Client side validation
if (typeof (Page_ClientValidate) == 'function') 
{
if (Page_ClientValidate() == false)
{   

    return false; 
}
}

//make sure the button is not of type "submit" but "button"
if (myButton.getAttribute('type') == 'button') {
// disable the button
myButton.disabled = true;
myButton.className = "btn-inactive";
myButton.value = "processing..."; 

//display gray background and message
document.getElementById("graybackground-div").style.display = "block";
document.getElementById("message-div").style.display = "block";
}

 return true;
}

function confirm_delete(myButton)
{
    if (typeof (Page_ClientValidate) == 'function') 
    {
    if (Page_ClientValidate() == false)
    {   

        return false; 
    }
    }
    if (confirm("Are you sure to submit the application?") == true)
    {
           //myButton.disabled = true;
           myButton.className = "btn-inactive";
           myButton.value = "processing..."; 
           
        return true;
    }
    
    else
        return false;
}

 

function blanktext(add)
{   //alert('asd');
    if(add.value.length ==0)
    {
        alert('Member Code cannot be blank');
    }
}

function max120(add)
{
    if(add.value.length > 120)
            {
                alert('Length should not exceed 120 chars');
                add.value = add.value.substring(0,120);
            }
}
function max2048(add)
{
    if(add.value.length > 2048)
            {
                alert('Length should not exceed 2048 chars');
                add.value = add.value.substring(0,2048);
            }
}
function IsNumeric(sText)
        {
            var ValidChars = "0123456789.";
            var IsNumber=true;
            var Char;
            for (i = 0; i < sText.length && IsNumber == true; i++) 
            { 
                Char = sText.charAt(i); 
                if (ValidChars.indexOf(Char) == -1) 
                {
                   IsNumber = false;
                }
             }
            return IsNumber;
        }
          function validate()
          {
             var     blnSilverNumeric=IsNumeric(document.getElementById("ctl00$ContentPlaceHolder2$txtPartyMob").value)
             if (blnSilverNumeric==false)
             {
                 
                 document.getElementById("ctl00$ContentPlaceHolder2$txtPartyMob").value = window.document.forms(0).item("ctl00$ContentPlaceHolder2$txtPartyMob").value.substring(0, window.document.forms(0).item("ctl00$ContentPlaceHolder2$txtPartyMob").value.length-1);
                 return false;
             }
           }
           function validate1()
          {
             var     blnSilverNumeric=IsNumeric(document.getElementById("ctl00$ContentPlaceHolder2$txtPartyPin").value)
             if (blnSilverNumeric==false)
             {
                 
                 document.getElementById("ctl00$ContentPlaceHolder2$txtPartyPin").value = window.document.forms(0).item("ctl00$ContentPlaceHolder2$txtPartyPin").value.substring(0, window.document.forms(0).item("ctl00$ContentPlaceHolder2$txtPartyPin").value.length-1);
                 return false;
             }
           }
function max1000(add)
{
//            if (window.document.forms(0).item("ctl00$ContentPlaceHolder2$txtAdditional").value.length  > 1691) 
//             {
//                    alert("Length of Additional Information shouldn't be exceed 1691 chars"); 
//                    window.document.forms(0).item("ctl00$ContentPlaceHolder2$txtAdditional").value=window.document.forms(0).item("ctl00$ContentPlaceHolder2$txtAdditional").value.substring(0,1691);
//             } 
             //txtaddress
//             if (window.document.forms(0).item("ctl00$ContentPlaceHolder2$txtaddress").value.length  > 10) 
//             {
//                    alert("Length should not exceed 1000 chars"); 
//                    window.document.forms(0).item("ctl00$ContentPlaceHolder2$txtaddress").value=window.document.forms(0).item("ctl00$ContentPlaceHolder2$txtaddress").value.substring(0,10);
//             }
            if(add.value.length > 10)
            {
                alert('Length should not exceed 1000 chars');
                add.value = add.value.substring(0,10);
            }
             
}

function max500(add)
{
    if(add.value.length > 500)
            {
                alert('Length should not exceed 500 chars');
                add.value = add.value.substring(0,500);
            }
}
function max8000(add)
{
    if(add.value.length > 8)
            {
                alert('Length should not exceed 8000 chars');
                add.value = add.value.substring(0,8);
            }
}
function max5000(add)
{
    if(add.value.length > 5)
            {
                alert('Length should not exceed 500 chars');
                add.value = add.value.substring(0,5);
            }
}
function max1024(add)
{
    if(add.value.length > 1024)
            {
                alert('Length should not exceed 1024 chars');
                add.value = add.value.substring(0,1024);
            }
}

function max512(add)
{
    if(add.value.length > 512)
            {
                alert('Length should not exceed 512 chars');
                add.value = add.value.substring(0,512);
            }
}
function max256(add)
{
    if(add.value.length > 256)
            {
                alert('Length should not exceed 256 chars');
                add.value = add.value.substring(0,256);
            }
}
function max200(add)
{
    if(add.value.length >200)
            {
                alert('Length should not exceed 200 chars');
                add.value = add.value.substring(0,200);
            }
}
function max100(add)
{
    if(add.value.length > 100)
            {
                alert('Length should not exceed 100 chars');
                add.value = add.value.substring(0,100);
            }
            
}
function max300(add)
{
    if(add.value.length > 300)
            {
                alert('Length should not exceed 300 chars');
                add.value = add.value.substring(0,300);
            }
            
}
function max50(add)
{
    if(add.value.length >50)
            {
                alert('Length should not exceed 50 chars');
                add.value = add.value.substring(0,50);
            }
}
function HeightNews(val)
{
  
  
            if(window.document.forms(0).item("ctl00$ContentPlaceHolder2$txtHeight").value > 35.5)
            {
                alert("Height cannot be Greater than 35.5 cm");
                window.document.forms(0).item("ctl00$ContentPlaceHolder2$txtHeight").value="";
                window.document.forms(0).item("ctl00$ContentPlaceHolder2$txtRs").value="";
               
            }
       
            else if(window.document.forms(0).item("ctl00$ContentPlaceHolder2$txtHeight").value >= 5)
           {   
                
                if(window.document.forms(0).item("ctl00$ContentPlaceHolder2$HiddenField1").value * window.document.forms(0).item("ctl00$ContentPlaceHolder2$txtHeight").value > 47.5) 
                {
                    alert("Area Restriction should be less than 47.5 ");
                    window.document.forms(0).item("ctl00$ContentPlaceHolder2$txtRs").value="";
                    window.document.forms(0).item("ctl00$ContentPlaceHolder2$txtHeight").value="";
                }
                else
                {   
                var i,j;
                //i=window.document.forms(0).item("ctl00$ContentPlaceHolder2$HiddenField1").value * 400;
                i=(window.document.forms(0).item("ctl00$ContentPlaceHolder2$HiddenField1").value) * (window.document.forms(0).item("ctl00$ContentPlaceHolder2$txtHeight").value)*400;
                window.document.forms(0).item("ctl00$ContentPlaceHolder2$txtRs").value=i;
                j=window.document.forms(0).item("ctl00$ContentPlaceHolder2$txtRs").value;
                window.document.forms(0).item("ctl00$ContentPlaceHolder2$HiddenField2").value=j;
                
                }
               //return true;
            }
}
