﻿// JScript File

function blink(elId){
  var html = '';
  if(document.all){
    html += 'var bl = document.all.' + elId + ';';
  }
  else if(document.getElementById){
    html += 'var bl = document.getElementById("' + elId + '");';
  }
  html += 'bl.style.visibility = ' + 'bl.style.visibility == "hidden" ? "visible" : "hidden"';
  if(document.all || document.getElementById){
    setInterval(html, 1000);
  }
}
function init(){
  blink('blnTollFree');
}
onload=init;

//Used in Grievance
function ValidateKey()
{
    if (event.keyCode < 48 || event.keyCode > 58 ) event.returnValue=false;    
}
function CustomSearch(sender,args)
{

    if(document.aspnetForm.ctl00_ContentPlaceHolder1_txtTokenID.value=='')
    {   
     alert("Please enter the Keyword to Search");
     document.aspnetForm.ctl00_ContentPlaceHolder1_txtTokenID.focus();
     args.IsValid=false;
    } 
    else
    {
     args.IsValid=true;
    }
}

function CustomVal(sender,args)
{
if(document.aspnetForm.ctl00_ContentPlaceHolder1_fileupload.value!='')
 {	
    str = document.aspnetForm.ctl00_ContentPlaceHolder1_fileupload.value;
    if(!(str.lastIndexOf(".")>0 & (str.substring(str.lastIndexOf(".")+1).toUpperCase()=="GIF" || str.substring(str.lastIndexOf(".")+1).toUpperCase()=="JPG" || str.substring(str.lastIndexOf(".")+1).toUpperCase()=="JPEG" || str.substring(str.lastIndexOf(".")+1).toUpperCase()=="PNG" || str.substring(str.lastIndexOf(".")+1).toUpperCase()=="DOC" || str.substring(str.lastIndexOf(".")+1).toUpperCase()=="TXT" || str.substring(str.lastIndexOf(".")+1).toUpperCase()=="PDF" || str.substring(str.lastIndexOf(".")+1).toUpperCase()=="XLS" || str.substring(str.lastIndexOf(".")+1).toUpperCase()=="CSV")))
    {
        alert("File must be GIF, JPG, PNG, DOC, TXT, PDF, XLS or CSV  format");
        document.aspnetForm.ctl00_ContentPlaceHolder1_fileupload.focus();
        args.IsValid=false;
    }
 }
else
 {
    args.IsValid=true;
 }
}

function ConfirmDelete()
{
    if (confirm("Are you sure you want to delete this Record?")==true)
        return true;
    else
        return false;
}

function custom_Search(sender,args)
     {
     if(document.aspnetForm.ctl00_ContentPlaceHolder1_txtTokenID.value =="")
     {
      alert("Please enter Token No to Search.");
      args.IsValid = false;
     }
     else
     {
      args.IsValid = true;
     }
}

function custom_Attach_Req(sender,args)
     {
     if(document.aspnetForm.ctl00_ContentPlaceHolder1_fileupload.value =="")
     {
      alert("Please Select the file to be Uploded.");
      args.IsValid = false;
     }
     else
     {
      args.IsValid = true;
     }
}
 function textCounter(field,cntfield,maxlimit) 
	{
						
		if (field.value.length > maxlimit)
		{ // if too long...trim it!
			field.value = field.value.substring(0, maxlimit);		
			alert("You can enter upto " + maxlimit + " Characters");
		}
		else
		{			
			cntfield.value = maxlimit - field.value.length;
		}
	}  

function isDigit(sTitle)
{
   var reTitle=/^[0-9\ ]*$/; 
   if(!reTitle.test(sTitle))
   {      
	return false;
   }
   return true;
} 


function custom_Search1(sender,args)
     {
     if(!isDigit(document.aspnetForm.ctl00_ContentPlaceHolder1_txtTokenID.value))
     {
      alert("Please enter the numeric value.");
      args.IsValid = false;
     }
     else
     {
      args.IsValid = true;
     }
}

function ValidateSearch()
    {
      if (document.aspnetForm.ctl00_ContentPlaceHolder1_txtSearch.value=="")
       {
         alert("Please enter the Keyword to Search");
         document.aspnetForm.ctl00_ContentPlaceHolder1_txtSearch.focus();
         return false;
        }
        if(document.aspnetForm.ctl00_ContentPlaceHolder1_drpSearchCriteria.value=="3")
       {
           if(!isDigit(document.aspnetForm.ctl00_ContentPlaceHolder1_txtSearch.value))
            {
	            alert("Please enter the numeric value.");
	            document.aspnetForm.ctl00_ContentPlaceHolder1_txtSearch.focus();
	            return false;
            }
       }
       if(document.aspnetForm.ctl00_ContentPlaceHolder1_drpSearchCriteria.value=="" || document.aspnetForm.ctl00_ContentPlaceHolder1_drpSearchCriteria.value=="Select")
       {
         alert("Please select the Criteria.");
         document.aspnetForm.ctl00_ContentPlaceHolder1_drpSearchCriteria.focus();
         return false;
       }
   }
   
function ConfirmClosed()
{
    if (confirm("Are you sure you want to close this Ticket?")==true)
        return true;
    else
        return false;
}

function LoadGallery(imageFilePath)
{
  if (document.all)
  {
    document.getElementById("surgal").style.filter="blendTrans(duration=1)";
    document.getElementById("surgal").filters.blendTrans.Apply();
  }
  document.getElementById("surgal").src = imageFilePath;
  if (document.all)
  {
    document.getElementById("surgal").filters.blendTrans.Play();
  }
}
function RSBYdetails(x)
{
	window.open("RSBYDetails.aspx?hID="+x,'nsp','scrollbars=0,width=450,height=300');
}
