﻿// JScript File

//For LTrim Function
function Ltrim_string(objID)
{			
var j = 0,k=0;
if(objID.length>0)
{
	for(var i=0;i<objID.length && k<objID.length;i++)
	{
		if(objID.charAt(i)==" ")
		{
		j++;
		}
		else
		{
		k = objID.length;
		}
	}
	objID =objID.substring(j,objID.length);
}
	return objID;
}

//For trims value from rightside and returns orginal text without space
function Rtrim_string(objID)
{			
    var len = 0,chk = 0,newlen=0;
    if(objID.length>0)
    {
        len = objID.length; 
	    for(var i=len-1;i>=0 ;i--)
	    {
            if(objID.charAt(i)==" ")
		    {
		        if(chk == 1)
		        newlen = newlen +1;
		    }
		    else
		    {
		        newlen = newlen + 1;
		        chk = 1;
		    }
	    }
	    objID =objID.substring(0,newlen);
	    
	 }
    return objID;
}


//For trims value from rightside and returns orginal text length
function Rtrim_stringLen(objID)
{			
var chk = 0, len = 0, newlen=0;
if(objID.value.length > 0)
{
len = objID.value.length; 
	for(var i=len-1; i>=0; i--)
	{
        if(objID.value.charAt(i)==" ")
		{
		    if(chk == 1)
		        newlen = newlen +1;
		}
		else
		{
		    newlen = newlen + 1;
		    chk = 1;
		}
	}
}
return newlen;
}

//function checks for the spaces in between
function CheckSpaces(objID,strControlName)     
{
    var trimVal= trimAll(objID.value);
    if(trimVal.length >0)
    {
        for(var i=0;i<trimVal.length;i++)
        {
            if(trimVal.charAt(i) == " ")
            {
                alert(strControlName + " : Spaces are not allowed");
                objID.focus();
                objID.select();
                return false;
            }
        }
    }
    return true;
}
//For trims value from leftside and returns orginal text length
function Ltrim_stringLen(objID)
{			
var chk = 0, len = 0, newlen=0;
if(objID.value.length > 0)
{
len = objID.value.length; 
	for(var i =0; i<=len-1; i++)
	{
        if(objID.value.charAt(i)==" ")
		{
		    if(chk == 1)
		        newlen = newlen +1;
		}
		else
		{
		    newlen = newlen + 1;
		    chk = 1;
		}
	}
}
return newlen;
}

//function that checks for the blank space at starting
function CheckLSpace(objID,strControlName)
{
    var chk = 0, len = 0;
   if(objID.value.length > 0)
    {
        len = objID.value.length; 
	    for(var i =0; i<=len-1; i++)
	    {
            if(objID.value.charAt(i)==  " ")
		    {
		        if(chk != 1)
		        {
		            alert(strControlName + " : Spaces at the start are not allowed");
		            objID.focus();
		            objID.select();
		            return false;
		        }
            }
            else
                chk = 1;
        }
    }
    return true;
 
}

//Blank Check
function CheckBlank(objID,strControlName)
{
   if (Ltrim_string(objID.value)=="")
   {
		//alert(strControlName+": Cannot be left blank");
		alert("Please enter "+ strControlName);
		objID.value="";
		objID.focus();
		return false;
	}
	return true;
}


//Allow only Numbers in TextBox
function CheckNumeric(objID,strControlName)
	{	
		if (objID.value!="")
		{
			var num=/[0-9]+/
			numflag=objID.value.match(num);	
			if(numflag !=objID.value){
			alert(strControlName+ ": Should be Numeric only.")
			objID.focus();
 			objID.select();
			return false;
		}
	}
	return true;
}

//Allow only Numbers (in amount format) having decimal in TextBox
function CheckAmount(objID,strControlName)
	{	
		if (objID.value!="")
		{
			var num=/[0-9.0-9]+/
			numflag=objID.value.match(num);	
			if(numflag !=objID.value){
			alert(strControlName+ ": Should be Numeric only.")
			objID.focus();
 			objID.select();
			return false;
		}
	}
	return true;
}

function CheckAlphabets(objID,strControlName)
{
	var alpha=/[a-zA-Z]+/;
	alphaflag=objID.value.match(alpha);	
		if(alphaflag != objID.value)
		{
			//alert(strControlName+ ": Should be Alphabets only.")
			alert("Please enter valid " + strControlName)
			objID.focus();
 			objID.select();
			return false;
	}
	return true;
}

//function to check alphabets with space
function CheckAlphabetsWithSpace(objID,strControlName)
{
	var alpha=/[a-zA-Z ]+/;
	alphaflag=objID.value.match(alpha);	
		if(alphaflag != objID.value)
		{
			//alert(strControlName+ ": Should be Alphabets only.")
			alert("Please enter valid " + strControlName)
			objID.focus();
 			objID.select();
			return false;
	}
	return true;
}

/////////function to check maximum lenght of charachters.
function CheckMaximumCharLimit(objID, MaxCharachter, strControlName) {
    if (objID.value != "") {
        if (objID.value.length > MaxCharachter) {
            //alert(strControlName + " : Should not be greater than " + MaxCharachter + " characters");
            alert("Max " + MaxCharachter + " characters allowed");
            objID.focus();
            objID.select();
            return false;
        }
    }
    return true;
}

//Validation For Drop-Down List
function CheckDropDown(objID,strControlName)
{
	   if(objID.options[0].selected=="true" || objID.selectedIndex == 0)
	   {
		//alert(strControlName+ ": Select a proper option.");
		alert("Please select " + strControlName);
		objID.focus();
		return false;
	}
	return true;
} 

//Check for Decimal Numbers
function CheckDecimal(objID,strControlName)
{	
	var iCount=0;
	Temp =objID.value;	
	if(Temp.length==0)
	{
		Temp = 0;
		return true;
	}
	var validchars = "1234567890.";
	for(var j=0;j<Temp.length && iCount < 2;j++)
	{
		if(validchars.indexOf(Temp.charAt(j)) == -1)
		{
		alert(strControlName+ ": Should have Decimal values only");
			objID.focus();
 			objID.select();		
			return false;
		}
		else if(Temp.charAt(j)==".")
			iCount++;
	}
	if(iCount > 1)
	{
		alert(strControlName+ ": Should have Decimal values only");
		objID.focus();
 		objID.select();	
		return false;
	}
	
	return true;
}

//Validation For Single EMail-Id
function CheckMail(objID,strControlName)
{

	var email =/[-a-zA-Z0-9_\.']+@[-a-zA-Z0-9]+\.[-a-zA-Z0-9\.]+/;
	var eflag = objID.value.match(email);
	if(eflag!=objID.value)
	{
		//alert(strControlName+ ": Should be in proper format")
		alert("Please enter valid email address");
		objID.focus();
		objID.select();
		return false;
	}
	else if(objID.value.indexOf(".")==0)
	{
		//alert(strControlName +": Should be valid Email")
		alert("Please enter valid email address");
		objID.focus();
		objID.select();
		return false;
    }

	var LastIndex = objID.value.lastIndexOf(".");
	var FirstIndex = objID.value.indexOf(".");
    
	if((LastIndex - FirstIndex) == 1 || (objID.value.length-1 == LastIndex)) // in case of ids like  abc@abc..abc and abc@abc.abc.
	{
	    //alert(strControlName + ": Should be valid Email")
	    alert("Please enter valid email address");
	    objID.focus();
		objID.select();
		return false;
	}
	if(objID.value.indexOf("..") >= 1)  
	{
	    //alert(strControlName + ": Should be valid Email")
	    alert("Please enter valid email address");
	    objID.focus();
		objID.select();
		return false;
	}
	return  true;
}



//Validation For Phone No
function CheckPhone(objID,strControlName) {
//    var num = /[0-9\-\+\/\"("\")"\s]+/
		var num=/[0-9-\+]+/
		numflag=objID.value.match(num);	
		if (objID.value!="")
		{
		    if(numflag != objID.value)
		    {
			    alert(strControlName+ ": Should be valid phone number")
			    objID.focus();
 			    objID.select();
			    return false;
		    }
	        if(objID.value.length<6)
	        {
		        alert(strControlName+ ": Should be atleast 6 digit number")
		        objID.focus();
		        objID.select();
		        return false;

            }
		    else if(objID.value.length>=18)
		    {
		        alert(strControlName + ": Should not be greater than 18 digit")
		        objID.focus();
		        objID.select();
		        return false;
		    }
	}
		return true;
} 



/////////Checking:for phone number
function PhoneCheck(objID,strControlName)
{
    var num=/[0-9\-\+\/\"("\")"\s]+/
		numflag=objID.value.match(num);	
		if (objID.value!="")
		{
		if((numflag != objID.value)&&(objID.value.length<6)&&(objID.value.length>=18))
		{
			//alert(strControlName+ ": Should be valid phone number")
			alert("Please enter valid phone number")
			objID.focus();
 			objID.select();
			return false;
		}
	}
		return true;

	
}  


////////Checking:for mobile number with specified length
function MobileCheckLength(objControl,strControlName)
{
if(objControl.value.length>10 || objControl.value.length<10)
{
//alert(strControlName+ ":Should be 10 digit number");
alert("Please enter valid Mobile number")
objControl.focus();
objControl.select();
return false;
}

return true;
}


///function to check mobile number

function CheckMobile(objID,strControlName)
{
		var num=/[0-9\+]+/
		numflag=objID.value.match(num);	
		if (objID.value!="")
		{
		    if ((numflag != objID.value) )//||( (objID.value.charAt(0) != "9")|| (objID.value.charAt(0) != "8")))
		{
			//alert(strControlName+ ": Should be valid Mobile number")
			alert("Please enter valid Mobile number")
			objID.focus();
 			objID.select();
			return false;
			}
			}
		return true;
}

//Checking:for mobile number with specified length and should digits
function CheckMobileValidate(objControl, strControlName) {

    if (CheckMobile(objControl, strControlName)) {
        if (objControl.value.length > 10 || objControl.value.length < 10 ) {
            //alert(strControlName + ": Should be 10 digit number");
            alert("Please enter valid Mobile number");
            objControl.focus();
            objControl.select();
            return false;
        }
        else {
            return true;
        }
    }
    else {
        return false;
    }


}

////function to check specified length-length can be pass by passing values to the parameter

function LengthCheck(objControl,strControlName,strlength)
{
    if(objControl.value.length!=strlength)
    {
    alert(strControlName+": Should be "+strlength+" digits number");
    objControl.focus();
    return false;
    }  
    return true;
}   



/////////Checking:for no single radio button is selected
function RadioCheck(objControl1,objControl2,strControlName)
{
    if(objControl1.checked==false&&objControl2.checked==false)
    {
    //alert(strControlName+": Select a proper choice");
    alert("Please select "+strControlName );
    objControl1.focus();
    objControl1.select();
    return false;
    }
    
return true;
}

 ////returns the difference between 2 dates  dates should be in dd/mm/yyyy format
function findDateDifference(x1, x2)
{
    var ssdate = new String(x1.value);
    var ssdatee = new String(x2.value);
			
    var SDate= new Array(3);
    SDate = ssdate.split("/");
    var ssdate1 =new String(SDate[1] + "/" +  SDate[0] + "/" + SDate[2]);
	
    var SDate1= new Array(3);
    SDate1 = ssdatee.split("/");
    var ssdate2 =new String(SDate1[1] + "/" +  SDate1[0] + "/" + SDate1[2]);
	
    var one_day=1000*60*60*24;
				
    var objDate1=new Date(ssdate1);
    var objDate2=new Date(ssdate2);
    var diff = (objDate2.getTime()-objDate1.getTime())/one_day;
    if(parseInt( SDate1[2] % 4) > 0)
    {
        diff = parseInt(diff)+1;
    }
    return diff;
}
//Validation For Character Limit
function CheckCharLimit(objID,str,strControlName)
{
	charlength=Ltrim_string(objID.value).length;
		if(charlength < str){
			alert(strControlName+": Should have atleast " +str+ " characters.")
			objID.focus();
 			objID.select();
			return false;
	}
	return true;
}

////Allow only specified special characters --- Modified By Abhijit
function CheckSpecialChar(objID, strControlName, spstr)
{
    var str = objID.value;
    var validchars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" + spstr;
    var tmpStr = ""

    for (var j = 0; j < spstr.length; j++) {
        tmpStr = tmpStr + spstr.charAt(j) + " ";
    }
    tmpStr = tmpStr.toString().replace("  ", "Space ");
    if (spstr.toString().indexOf(" ") >= 0)
    {
        spstr = spstr.toString().replace(" ", "Space");
    }

    if (CheckBlank(objID, strControlName))
    {
        for (var j = 0; j < str.length; j++)
            if (validchars.indexOf(str.charAt(j)) == -1)
        {
            //alert(strControlName + ": Should not have any special characters except: " + tmpStr)
            alert("Please enter valid " + strControlName)
            objID.focus();
            objID.select();
            return false;
        }
        return true;
    }
}

function CheckSpecialAlphaOnly(objID, strControlName, spstr) {
    var str = objID.value;
    var validchars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + spstr;

    if (spstr.toString().indexOf(" ") >= 0) {
        spstr = spstr.toString().replace(" ", "Space ");
    }

    if (CheckBlank(objID, strControlName)) {
        for (var j = 0; j < str.length; j++)
            if (validchars.indexOf(str.charAt(j)) == -1) {
            //alert(strControlName + ": Should not have any Numbers and special characters except: [ " + spstr + " ]")
            alert("Please enter valid " + strControlName)
            objID.focus();
            objID.select();
            return false;
        }
        return true;
    }
} 

//Validation when for confirm password
function confpswdchk(pass, confpass,msg)
{
	if(confpass.value != pass.value){
		alert(msg);
		confpass.focus();
		confpass.select();
		return false;
	}
	return true;
}
//Check the TextBox Length
function charlencheck(objID,strControlName,NoOfCharacters)
{
	charlength=Rtrim_stringLen(objID);
	if(objID.value!="")
	{
		if(charlength < NoOfCharacters)
		{
		    alert(strControlName + ": Cannot be less than " + NoOfCharacters  + " characters!");
		    objID.focus();
		    objID.select();
		    return false;
		}
	}
//	if(objID.value.length != charlength)
//	{
//		alert(strControlName + ": Blank spaces are not allowed.");
//		objID.focus();
//		objID.select();
//		return false;
//    }
//    if(objID.value.length != Ltrim_stringLen(objID))
//	{
//		alert(strControlName + ": Blank spaces are not allowed.");
//		objID.focus();
//		objID.select();
//		return false;
//    }
	return true;
}

//Do not allow only Numbers in TextBox
function CheckUserName(objID,strControlName)
	{	
		if (objID.value!="")
		{
			var num=/[0-9]+/
			numflag=objID.value.match(num);	
			if(numflag ==objID.value){
			alert(strControlName+ ": Should be AlphaNumeric.")
			objID.focus();
 			objID.select();
			return false;
		}
	}
	return true;
}
//
//Allow AlphaNumeric characters
function CheckAlphaNumeric(objID,strControlName)
{
	var alpha=/[a-zA-Z0-9\'\-\/&\s]+/;
	alphaflag=objID.value.match(alpha);	
		if(alphaflag != objID.value)
		{
			alert(strControlName+ ": Should be AlphaNumeric characters only.")
			objID.focus();
 			objID.select();
			return false;
	}
	else
	{
	return true;
	}
}

//Allow only specified special characters
function CheckSpaceChar(objID,strControlName)
{
var str=objID.value;
var validchars = " ";
for (var j=0;j<str.length;j++)
if(validchars.indexOf(str.charAt(j)) == 0)
	{
		alert(strControlName+ ": Should not have any spaces.")
		objID.focus();
 		objID.select();
		return false;
	}
	return true;
} 
// Check the Login Name & Password for not being same.
function ChkPwdAndLoginName(password,login)
 {  
    if(password.value.toLocaleLowerCase() == login.value.toLocaleLowerCase())
    {
       alert("Password and User Name cannot be same.");
       password.focus();
       password.select();
       return false;
    }
    return true;
 }
 
 //For PMS=Check while adding Transaction 
  function QuantityCheck(objID,name)
    {

        if(objID.value == 0)
        {
            alert(name + ": Cannot be zero");
            objID.focus();
            objID.select();
            return false;
        }
        return true;
    }
    
    function decimalNoCheck(objID,noOfDecimalDigits,MaxNo,objName)
    {
     var val1 = objID.value.indexOf(".");
     var val2 = eval(objID.value.length) - eval(val1)-1;
	    if(val1 !="-1")
	    {
	        if(val1 > MaxNo)
            {
                alert(objName + ": Cannot be more than " + MaxNo + " digits before decimal!");
                objID.focus();
			    objID.select();
                return false;  
            }
		    if(val2 > noOfDecimalDigits)
		    {
			    alert( objName +": Can be " + noOfDecimalDigits + " decimals only!");
			    objID.focus();
			    objID.select();
			    return false;
		    }
	    }
	    else
	    {
	        if(objID.value.length > MaxNo)
		    {
		        alert(objName + ": Cannot be more than " + MaxNo + " digits!");
		        objID.focus();
		        objID.select();
		        return false;
		    }
	    }
	    return true;
    }
    
    
function ClearText(objID,DefaultName)
    {
	    var textname = document.getElementById(objID);
	    if (textname.value == DefaultName)
	        textname.value="";
	   // document.getElementById(objID).focus();
   }
   
function FillText(objID,DefaultName)
{
    var textname=document.getElementById(objID);
	if (textname.value == "")
	    textname.value = DefaultName;
}





///This function check radio buttons for selection
    function ChkRadio(radio,radioName)
    {
        var radioChoice =false;
        for( i=0; i<radio.length;i++)
        {
            if(radio[i].checked)
            {
                radioChoice = true;
                break;
            }
        }
        if(!radioChoice)
        {
            //alert(radioName+ " : Select the proper choice");
            alert("Please select "+radioName);
            return false;
        }
        return true;
    }
    
    
///This function checks the Birth date validation    
     function checkBirthDate(objID,strControlName)
    {
   
                var dt =new Date();
                var x1 = dt.getDate() +"/"+ (dt.getMonth()+1)+"/"+ dt.getFullYear();
                var x2 = objID.value;
                var ssdate = new String(x1);
                var ssdatee = new String(x2);
            			
                var SDate= new Array(3);
                SDate = ssdate.split("/");
                var ssdate1 =new String(SDate[1] + "/" +  SDate[0] + "/" + SDate[2]);
            	
                var SDate1= new Array(3);
                SDate1 = ssdatee.split("/");
                var ssdate2 =new String(SDate1[1] + "/" +  SDate1[0] + "/" + SDate1[2]);
            	
                var one_day=1000*60*60*24;
            				
                var objDate1=new Date(ssdate1+"");
                var objDate2=new Date(ssdate2+"");
                var diff = (objDate2.getTime()-objDate1.getTime())/one_day;
                if(parseInt( SDate1[2] % 4) > 0)
                {
                    diff = parseInt(diff)+1;
                }
                if(diff >= 0)
                {
                    alert(strControlName + ": can not be equal to or greater than Current date");
                    objID.focus();
                    objID.select();
                    return false;
                }
                return true;
    }
    
    //For trimming String
function trimAll(sString) 
    {
        while (sString.substring(0,1) == ' ')
            {
            sString = sString.substring(1, sString.length);
            }
        while (sString.substring(sString.length-1, sString.length) == ' ')
            {
            sString = sString.substring(0,sString.length-1);
            }
        return sString;
     }
     //Function to check the birthdate
     function BirthDate(date, strControlName1) {
         var d = new Date();
         var cyear = parseInt(d.getFullYear());
         date_year = date.value.substring(date.value.length - 4, date.value.length)
         date_year.value == parseInt(date_year);
         if ((date_year == cyear) == true) {
             alert(strControlName1 + ': Birth year can\'t same as current year.');
             date.focus();
             return false;
         }
         var diff = parseInt(cyear) - parseInt(date_year);

         if (diff < 18) {
             alert(strControlName1 + ': Your age must greater or equal to 18-Yrs.');
             date.focus();
             return false;
         }
         return true;
     }


     function DateComparison(Date1, strDate1, Date2, strDate2) {
         var SplitFromDate = new Array();
         var SplitToDate = new Array();
         var FromDate = new Date();
         var ToDate = new Date();

         SplitFromDate = Date1.value.split("/");
         SplitToDate = Date2.value.split("/");

         FromDate.setFullYear(SplitFromDate[2], SplitFromDate[1], SplitFromDate[0]);
         ToDate.setFullYear(SplitToDate[2], SplitToDate[1], SplitToDate[0]);

         if (FromDate <= ToDate)
             return true;
         else {
             alert(strDate1 + " : Should be less than or equal to '" + strDate2 + "'");
             Date1.select();
             return false;
         }
     }
     
     
function CheckBoxListValidation(objID, strControlName) {
        var flag = false;
        for (i = 0; document.getElementById(objID.id + "_" + i) != null; i++) {
            if (document.getElementById(objID.id + "_" + i).checked == true) {
                flag = true;
                break;
            }
        }
        if (!flag) {
            //alert(strControlName + ": Select atleast one Option.");
            alert( "Please select atleast one "+strControlName );
            return false;
        }
        return true;
    }



    function setFocus(ObjID) {
        ObjID = document.getElementById(ObjID);
        ObjID.focus();
    } 
    
    function RadioListValidation(objID, strControlName)
    {
        var flag=false;
        for(i=0;document.getElementById(objID.id + "_" + i)!=null;i++){
        if (document.getElementById(objID.id + "_" + i).checked == true) {
                flag = true;
                break;
            }
        }
        if (!flag) {
            //alert(strControlName + ": Select atleast one Option.");
            alert( "Please select atleast one "+strControlName );
            return false;
        }
        return true;
    }
    
     function OpenBuyOnline(URL )
    {
        window.open (URL,"BuyOnline","status=0,toolbar=0,resizable=yes,width=1003,height=610,left=10,top=50,scrollbars=yes"); 
        //return false;
    }

    function MM_openBrWindow(theURL,winName,features) { 
    window.open(theURL,winName,features);}
    
    
    
     function SubMenu_Click(str,stri)
    {
        SubMenu_UnClick("divTab_01","1")
        SubMenu_UnClick("divTab_02","2")
        SubMenu_UnClick("divTab_03","3")
        SubMenu_UnClick("divTab_04","4")
        SubMenu_UnClick("divTab_05","5")
        SubMenu_UnClick("divTab_06","6")
        SubMenu_UnClick("divTab_07","7")
    
        if(document.getElementById(str)!=null)
            document.getElementById(str).style.display="block";  
            
                  if(document.getElementById("dvTab1_" + stri)!=null)
            document.getElementById("dvTab1_" + stri).className = "nav_l";
        if(document.getElementById("dvTab2_" + stri)!=null)
            document.getElementById("dvTab2_" + stri).className = "nav_r";
        if(document.getElementById("dvTab3_" + stri)!=null)
            document.getElementById("dvTab3_" + stri).className = "dvTabActive"; 
    }
      
     
    function SubMenu_UnClick(str,stri)
    {
        
        
        if(document.getElementById(str)!=null)
            document.getElementById(str).style.display="none"; 
           
            
             if(document.getElementById("dvTab1_" + stri)!=null)    
            document.getElementById("dvTab1_" + stri).className = "navactive_l";
        if(document.getElementById("dvTab2_" + stri)!=null)
            document.getElementById("dvTab2_" + stri).className = "navactive_r";
        if(document.getElementById("dvTab3_" + stri)!=null)
            document.getElementById("dvTab3_" + stri).className = "dvTab01"; 
           
    
   
    
    }
       
  function ResetRedio(rbListID,iDef)
    {
        var rbList = document.getElementById(rbListID);
		 var rdbChild;
		 for(var t=0;t<rbList.cells.length;t++)
        {
            rdbChild = document.getElementById( rbListID + "_" + t );
            if(rdbChild!=null)
            if(rdbChild.checked)
            {
                rdbChild.checked=false;
            }
        }
        rdbChild = document.getElementById(rbListID + "_" + (iDef-1));
        if(rdbChild!=null)
            rdbChild.checked=true;
    }



function expand(cid)
            {
    		    if(document.getElementById(cid)!= null)
					document.getElementById(cid).style.display="block";
		    }
		    function collaps(cid)
		    {
    		    if(document.getElementById(cid)!= null)
					document.getElementById(cid).style.display="none";
		    }
    function ValidPolicyNo() 
    {
            if(!Validate())
            {
            document.getElementById("txtPolicyNo").focus();
            return false;
        }
        else {
           
window.open("MotorRenewal.aspx?a="+  document.getElementById("txtPolicyNo").value,'RenewOnline','status=0,toolbar=0,resizable=yes,width=1003,height=610,left=10,top=50,scrollbars=yes');
            return false;
        }
        }
        
        
        
function ValidatePolicyNo(obj)
{
    if (obj.value.trim() != "")
    {   
            if(parseInt(obj.value.trim()) == 0 )
            {
                alert("Policy No. Should not be Zero")
                obj.focus();
                obj.select();
                return false;
                
            }
            if(obj.value.trim().length < 16 )
            {
                alert("Policy No. should be 16 Digit");
                obj.focus();
                obj.select();
                return false;
            }
            return true;
    }
}
 String.prototype.trim = function() 
                {
                    a = this.replace(/^\s+/, '');
                    return a.replace(/\s+$/, '');
                };
function Validate()
{
     var str1 = document.getElementById("txtPolicyNo").value.trim();

        if (document.getElementById("txtPolicyNo").value.trim() == "")
            {
                alert("Policy No. Should not be Blank");
                document.getElementById("txtPolicyNo").focus();
                return false;
            } 
     
         var Status;
         Status = ValidatePolicyNo(document.getElementById("txtPolicyNo"));  
            if (Status == false )
            {
                return false;
            }
            
         if(str1.substring(0,2).trim() != "vp" && str1.substring(0,2).trim() != "VP")
             {
                alert("Please enter a valid Policy Number");
                document.getElementById("txtPolicyNo").focus();
                return false;
             }
            return true;
 
}
    function SetKey(event) 
    {
       
        if (event.keyCode == 13) 
        {
            ValidPolicyNo();
            return false;
        }
    }
    
    function TabMenu_Click(str,stri)
    {
        TabMenu_UnClick("divTab_01","1")
        TabMenu_UnClick("divTab_02","2")
        TabMenu_UnClick("divTab_03","3")
        TabMenu_UnClick("divTab_04","4")
        TabMenu_UnClick("divTab_05","5")
        TabMenu_UnClick("divTab_06","6")
        TabMenu_UnClick("divTab_07","7")
    
        if(document.getElementById(str)!=null)
            document.getElementById(str).style.display="block";  

       if(document.getElementById("dvTab3_" + stri)!=null)
            document.getElementById("dvTab3_" + stri).className = "dvTabActive_h"; 
            
    }
    
    
      function TabMenu_UnClick(str,stri)
    {
        if(document.getElementById(str)!=null)
            document.getElementById(str).style.display="none"; 
           
       if(document.getElementById("dvTab3_" + stri)!=null)
            document.getElementById("dvTab3_" + stri).className = "dvTabInActive_h"; 
    }