﻿// JScript File
// CompanyName//MDIMaster page

    function GetOver(id)
    {
        document.getElementById(id).style.color="#000080";
        document.getElementById(id).style.fontWeight = "bold";        
    }
    
    function GetDown(divName)
    {
        document.getElementById(divName).style.color="#ffffff";
        document.getElementById(divName).style.fontWeight = "normal";        
    }
    
    function GetDiv(divname)
{
    document.getElementById('divPolicy').style.display = "none";
    document.getElementById('divClaim').style.display = "none";
    document.getElementById('ctl00_ContentPlaceHolder2_lblMsg').style.display = "none";
    
    document.getElementById(divname).style.display = "block";
}

function Numeric()
    { 
        var code;
        if (!e) var e = window.event;
     
        if (e.keyCode) code = e.keyCode; 
      //  alert(code);
        if( (code >= 48 && code <= 57) )
        {
         
        return true;
        }
        return false;
   } 
   
   function DecimalPoint(txtvalue)
   {
//   var code;
//   var length = txtvalue.length;
//   alert(txtvalue.length);

    if (!/^\d+\.?\d*$/.test(txtvalue)) 
        {
        alert ("HI");
        }
   }
   
   function PolicyNoCheck()
   {
      var code;
        if (!e) var e = window.event;
     
        if (e.keyCode) code = e.keyCode; 
        //alert(code);
        if( (code >= 47 && code <= 57) )
        {
           return true;
        }
        return false;
            
   }
   
   //set height of the screen
      function SetHt()
    {
        var ht = screen.height;
        newht = ht - 200;
        var tdht = document.getElementById('tdContent').style.height;
        tdht = tdht.replace("px", "");
        if(tdht < newht)
        {
            document.getElementById('tdContent').style.height = newht + "px";
        }
    }

// set ccnno for confirmation
    function GetHome()
    {
        if (confirm("Are you sure to close this session of CCN: " + ccnno + "?")==true) 
        {
            return true;
			//window.location = "ClaimDetails.aspx";
		}
		else
		{
			return false;
		}

    }
function CallPrint(strid)
{
 var prtContent = document.getElementById(strid);
 var WinPrint = window.open('','','letf=0,top=0,width=1,height=1,toolbar=0,scrollbars=0,status=0');
 WinPrint.document.write(prtContent.innerHTML);
 WinPrint.document.close();
 WinPrint.focus();
 WinPrint.print();
 WinPrint.close();
 prtContent.innerHTML=strOldOne;
}


//  checking logout starts

    function SetSession()
    {
        var cook = document.cookie;
        if (cook != null)
        {
            //alert(document.cookie);
            //var d = new Date();
            //d.setDate("1/1/1900");
            //d = new Date("December 25, 2007");
            createCookie(".AspAuth","",-1);
            //document.cookie = "v0=1;expires=" + d.toGMTString() + ";" + ";";
            
           // alert(document.cookie);
        }
        //javascript:window.history.forward(1);
    }
        
        function createCookie(name,value,days) 
        {
	        if (days) 
	        {
		        var date = new Date();
		        date.setTime(date.getTime()+(days*24*60*60*1000));
		        var expires = "; expires="+date.toGMTString();
		    }
	        else 
	            var expires = "";
	            document.cookie = name+"="+value+expires+"; path=/";
        }


        function GetSession()
        {  
            var cook = document.cookie;
            //alert(readCookie(".AspAuth"));
            if (readCookie(".AspAuth") == 'null')
            {
                alert("Your session expired.....Please login again.");
                window.location.href("../Login.aspx");
            }

            //javascript:window.history.forward(1);
            
        }       
        function readCookie(name) 
        {
	        var nameEQ = name + "=";
	        var ca = document.cookie.split(';');
	        for(var i=0;i < ca.length;i++) 
	        {
	        	var c = ca[i];
    		    while (c.charAt(0)==' ') 
    		        c = c.substring(1,c.length);
    	            if (c.indexOf(nameEQ) == 0) 
		                return c.substring(nameEQ.length,c.length);
		    }
	        return 'null';
        }

// checking logout ends


// download forms on static page
        function DownloadForms(filename)
        {
            var pdfname = filename;
            pdfname = "/pdfdownloads/" + pdfname + ".pdf";
            window.open(pdfname,"Demonstration","toolbar=0,location=0,status=0,  menubar=0,scrollbars=1,resizable=1,width=600,height=600");
        }
        function getConfirm(type) 
		{ 
			if (confirm("Are you sure to "+type+" record?")==true) 
				return true; 
			else
				return false; 
		}
		//Code 
		function CheckMDI(txtMdi)
        {
            if  (txtMdi.value.length>0)
            {
                 if  (txtMdi.value.length != 15)
                 {
                     alert(" Incorrect RSID ");
                 }
                 else 
                 {
                    var txtvalue = txtMdi.value.substring(5,0);
                   
                   if (txtvalue!="MDI5-")
                    {
                       alert ("Incorrect MDIID");
                    }
                }
            }   
        }
        
        function CheckCCN(txtccn)
        {
        if  (txtccn.value.length>0)
        {
             if  (txtccn.value.length != 10)
             {
                 alert(" Incorrect CCN Number ");
             }
             else 
             {
                var txtvalue = txtccn.value.substring(3,0);
               
               if (txtvalue!="MDI")
                {
                   alert ("Incorrect CCN Number");
                }
             }
          }   
        }
