﻿// JScript File
// MDIndia//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 - 620;
        var tdht = document.getElementById('tdContent').style.height;
        tdht = tdht.replace("px", "");
        if(tdht < newht)
        {
            document.getElementById('tdContent').style.height = newht + "px";
        }
        
        var scnWid,scnHei;
	    if (self.innerHeight) // all except Explorer
	    {
		    scnWid = self.innerWidth;
		    scnHei = self.innerHeight;
	    }
	    else if (document.documentElement && document.documentElement.clientHeight)
		    // Explorer 6 Strict Mode
	    {
		    scnWid = document.documentElement.clientWidth;
		    scnHei = document.documentElement.clientHeight;
	    }
	    else if (document.body) // other Explorers
	    {
		    scnWid = document.body.clientWidth;
		    scnHei = document.body.clientHeight;
	    }
        newht = scnHei - 130;
        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("../BGSMain.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 = "http://www.mdindiaonline.com/pdfdownloads/" + pdfname + ".pdf";
            window.open(pdfname,"Demonstration","toolbar=0,location=0,status=0,  menubar=0,scrollbars=1,resizable=1,width=600,height=600");
        }
        
        function DownloadSchedules(filename)
        {
            var pdfname = filename;
            pdfname = "http://www.mdindiaonline.com/" + pdfname;
            window.open(filename,"Demonstration","toolbar=0,location=0,status=0,  menubar=0,scrollbars=1,resizable=1,width=600,height=600");
        }

        function ViewNotes()
        {
            window.open("http://www.mdindiaonline.com/BGSSS/Insurance/BGSNotes.aspx","Demonstration","toolbar=0,location=0,status=0,  menubar=0,scrollbars=1,resizable=1,width=400,height=300");
        }
        
        function ViewPrints(filename)
        {
            var pdfname = filename;            
            pdfname = "http://www.mdindiaonline.com/BGSEPrint/" + pdfname;
            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 MDID ");
                 }
                 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");
                }
             }
          }   
        }
        
        function abc()
        {
            alert ("hi");
        }

function OpenRating()
{
    window.open("../Feedback.aspx","Rating","status=yes,width=500,height=400,resizable=no,top=150,left=200");
}

function OpenRating1()
{
    window.open("Feedback.aspx","Rating","status=yes,width=500,height=300,resizable=no,top=150,left=200");
}

   function ViewDiv(divid)
   {
	    document.getElementById('divAuth').style.display="none";
	    document.getElementById('divForms').style.display="none";
	    document.getElementById('divEmpanell').style.display="none";
	    document.getElementById('divFGI').style.display="none";
	    document.getElementById('divNIA').style.display="none";
	    
	    var brow=(navigator.appName)
	    
        if(brow=="Microsoft Internet Explorer")
        {
            document.getElementById(divid).style.display="block";
        }
        else
        {
	        document.getElementById(divid).style.display="table";	    
	    }
   }
   
   
      function ShowDiv(divid)
   {
	    document.getElementById('divAuth').style.display="none";
	    document.getElementById('divForms').style.display="none";
	    document.getElementById('divEmpanell').style.display="none";
	    document.getElementById('divFGI').style.display="none";
	    document.getElementById('divNIA').style.display="none";
	    
	    var brow=(navigator.appName)
	    
        if(brow=="Microsoft Internet Explorer")
        {
            document.getElementById(divid).style.display="block";
        }
        else
        {
	        document.getElementById(divid).style.display="table";	    
	    }
   }

    function validatelimit(obj, maxchar)
     {
    
        if(this.id) obj = this;
        
        var remaningChar = maxchar - obj.value.length;
        //document.getElementById('<%= Label1.ClientID %>').innerHTML = remaningChar;

            if( remaningChar <= 0)
            {
               obj.value = obj.value.substring(maxchar,0); 
               alert('Character Limit exceeds!');
               return false;

            }
            else
            {return true;}
     }
