﻿// **********************************************************************
// ValidationBase.js | Created On: 15th February 2008 | Sujay V Sarma
//  File contains all functions to validate form elements
// **********************************************************************

// This function returns the object for the given Id
// id: the id of the object to retrieve
// returns: object or null
function getDocumentObject(id) 
{
	var d = null;
	
	if (document.getElementById) {
		d = document.getElementById(id);
	} else if (document.all) {
		d = document.all(id);
	}
	
	return d;
}

// This is the base validation function, called by the form "onSubmit"
// value: the value of the field
// returns: true if validations pass
function Validate(controlId, value)
{
        var passed = false;
        var obj = getDocumentObject(controlId);
        
        // find out what validations are required
        var needsReq = ((obj.getAttribute("isrequired")!=null) ? (obj.getAttribute("isrequired")=="true") : false );
        var needsPattern = (obj.getAttribute("regexpattern")!=null);
        var needsEqual = (obj.getAttribute("comparewith")!=null);
        var needsRange = (obj.getAttribute("rangefrom")!=null);
        var valDisplay = obj.getAttribute("validatordisplay");
        
        var required = (needsReq ? ValidateRequiredField(controlId, value) : true); 
        var pattern = (needsPattern ? ValidatePattern(controlId, value) : true); 
        var equal = (needsEqual ? ValidateEqualTo(controlId, value) : true); 
        var range = (needsRange ? ValidateRange(controlId, value) : true); 
        
        
        passed = required & pattern & equal & range;
        if (! passed) {
            if ((valDisplay != null) && (valDisplay != ""))
            {
                var valMessages = GetValidatorMessages(obj, required, pattern, equal, range);
                if (valDisplay == "alert")
                {
                    alert(valMessages);
                }
                else
                {
                    var ele = getDocumentObject(valDisplay);
                    ele.innerHTML = valMessages;
                }
            }
        }
        else
        {
            if (valDisplay != "alert")
            {
                var ele = getDocumentObject(valDisplay);
                ele.innerHTML = '';
            }
        }
        
        return passed; 
}

// This function composes the validation messages based on validation results
// obj: reference to the runtime control
// required: result of requiredfield validation
// pattern: result of regex validation
// equal: result of compare validation
// range: result of range validation
// returns: string containing the message
function GetValidatorMessages(obj, required, pattern, equal, range)
{
    var msg1, returnMsg, ctlCaption;
    
    returnMsg = "";
    ctlCaption = obj.getAttribute("Caption");
    
    if (! required) {
        msg1 = obj.getAttribute("MessageRequiredFail");
        if ((msg1 != null) && (msg1 != "")) {
            returnMsg += msg1 + "\n";
        } else
            returnMsg += "Value for " + ctlCaption + " is a required field.\n";
    }
    
    if (! pattern) {
        msg1 = obj.getAttribute("MessageReqExFail");
        if ((msg1 != null) && (msg1 != "")) {
            returnMsg += msg1 + "\n";
        } else
            returnMsg += "Value for " + ctlCaption + " is not in specified format.\n";
    }
    
    if (! equal) {
        msg1 = obj.getAttribute("MessageCompareFail");
        if ((msg1 != null) && (msg1 != "")) {
            returnMsg += msg1 + "\n";
        } else
            returnMsg += "Value for " + ctlCaption + " must match other specified value.\n";
    }
    
    if (! range) {
        msg1 = obj.getAttribute("MessageRangeFail");
        if ((msg1 != null) && (msg1 != "")) {
            returnMsg += msg1 + "\n";
        } else
            returnMsg += "Value for " + ctlCaption + " must be in specified range.\n";
    }
    
    returnMsg = returnMsg.substring(0, returnMsg.length-1);
    returnMsg = returnMsg.replace("\n", "<br>");
    
    return returnMsg;
}


// This function validates if the field is a "required field"
// value: value of the field
// returns: true if passed
function ValidateRequiredField(controlId, value) 
{
    var returnValue = false;
	if ((value != null) && (value != ""))
	{	
		returnValue = true;		
	}
	
	return returnValue;
}

// This function validates the field with a regular expression
// value: value of the field
// returns: true if passed
function ValidatePattern(controlId, value)
{   
  var returnValue = false;
  var pattern = getDocumentObject(controlId).getAttribute("regexpattern");
  var re = new RegExp(pattern);
  
  if ((value != "") && (re.test(value)))
  {
      returnValue = true;		
  }
  return returnValue;
}

// This function validates if the field's value matches a given value
// value: value of the field
// targetValue: the value to compare with
// returns: true if passed
function ValidateEqualTo(controlId, value)
{
   var returnValue = false;
   var targetValue = getDocumentObject(controlId).getAttribute("comparewith");
   if((value != "") && (value==targetValue))
   {
      returnValue = true;		
   }
   return returnValue;
}

// This function validates if the field is a "required field"
// value: value of the field
// start: the starting value of the range
// end: the final value of the range
// returns: true if passed
function ValidateRange(controlId, value)
{ 
   var returnValue = false;
   var start = getDocumentObject(controlId).getAttribute("rangefrom");
   var end = getDocumentObject(controlId).getAttribute("rangeto");
   
   if ((value != "") && (value >= start) && (value <= end))
   {
      returnValue = true;		
   }       
   return returnValue;      
}        
        

// This function validates the length of the field
// value: value of the field
// minLength: minimum length o the value required
// returns: true if passed
function ValidateLength(controlId, value) 
{
    var returnValue = false;
	if ((value != null) && (value != "") && (value.length >= minLength))
	{
	   returnValue = true;		
	}
	return returnValue;
} 

function ValidateMultiselectHasSelection(controlId, value)
{
    var returnValue = false;
    var selIndex = getDocumentObject(controlId).selectedIndex;
    
    if ((value != null) && (value != "") && (selIndex > -1))
    {
        returnValue = true;
    }    
    return returnValue;
}
function FormatSSN(t,v,r)
{
    var vc = document.getElementById(v);
    var vr = document.getElementById(r);
    var pattern = /(\d{3}).*(\d{2}).*(\d{4})/;
    var setPattern = /^(\d{3})-(\d{2})-(\d{4})$/;
    var str = t.value;
    var result;
    if (!str.match(setPattern))
    {
        result = str.match(pattern);
        if (result!= null)
        {
            t.value = t.value.replace(/[^\d]/gi,'');
            str = result[1] + '-' + result[2] + '-' + result[3];
            t.value = str;
            vc.style.display="none";
            vr.style.display="none";
        }
        else
        {
            if (t.value.match(/[^\d]/gi))
            t.value = t.value.replace(/[^\d]/gi,'');
        }
    }
}
function FormatPhoneAreaCode(t)
{
    var pattern = /(\d{3})/;
    var setPattern = /^(\d{3})$/;
    var str = t.value;
    var result;
    if (!str.match(setPattern))
    {
        result = str.match(pattern);
        if (result!= null)
        {
            t.value = t.value.replace(/[^\d]/gi,'');
            str = result[1];
            t.value = str;
        }
        else
        {
            if (t.value.match(/[^\d]/gi))
            t.value = t.value.replace(/[^\d]/gi,'');
        }
    }
}
function FormatPhone(t,v,r)
{
    var vc = document.getElementById(v);
    var vr = document.getElementById(r);
    var pattern = /(\d{3}).*(\d{4})/;
    var setPattern = /^(\d{3})-(\d{4})$/;
    var str = t.value;
    var result;
    if (!str.match(setPattern))
    {
        result = str.match(pattern);
        if (result!= null)
        {
            t.value = t.value.replace(/[^\d]/gi,'');
            str = result[1] + '-' + result[2];
            t.value = str;
            //alert(vc);
            vc.style.display="none";
            vr.style.display="none";
        }
        else
        {
            if (t.value.match(/[^\d]/gi))
            t.value = t.value.replace(/[^\d]/gi,'');
        }
    }
}
function FormatPhoneExtCode(t)
{
    var pattern = /(\d{4})/;
    var setPattern = /^(\d{4})$/;
    var str = t.value;
    var result;
    if (!str.match(setPattern))
    {
        result = str.match(pattern);
        if (result!= null)
        {
            t.value = t.value.replace(/[^\d]/gi,'');
            str = result[1];
            t.value = str;
        }
        else
        {
            if (t.value.match(/[^\d]/gi))
            t.value = t.value.replace(/[^\d]/gi,'');
        }
    }
}

function ValidateZip(t)
{
    var pattern = /(\d{5})/;
    var setPattern = /^(\d{5})$/;
    var str = t.value;
    var result;
    if (!str.match(setPattern))
    {
        result = str.match(pattern);
        if (result!= null)
        {
            t.value = t.value.replace(/[^\d]/gi,'');
            str = result[1];
            t.value = str;
        }
        else
        {
            if (t.value.match(/[^\d]/gi))
            t.value = t.value.replace(/[^\d]/gi,'');
        }
    }
}
//Format Credit Card Number
function FormatCreditCardNumber(t)
{
    var pattern = /(\d{4}).*(\d{4}).*(\d{4}).*(\d{4})/;
    var setPattern = /^(\d{4})-(\d{4})-(\d{4})-(\d{4})$/;
    var str = t.value;
    var result;
    if (!str.match(setPattern))
    {
        result = str.match(pattern);
        if (result!= null)
        {
            t.value = t.value.replace(/[^\d]/gi,'');
            str = result[1] + '-' + result[2] + '-' + result[3] + '-' + result[4];
            t.value = str;
        }
        else
        {
            if (t.value.match(/[^\d]/gi))
            t.value = t.value.replace(/[^\d]/gi,'');
        }
    }
}


//Added by Kalpesh to check the expiration date of credit card.
function ValidCard(ddlmonth,ddlyear,tdstyle,rfvalid)
{
        
        try
        {
            checkmonth = document.getElementById(ddlmonth).value;
            checkyear = document.getElementById(ddlyear).value;
            tdblock = document.getElementById(tdstyle);
            rfvexpdate = document.getElementById(rfvalid);
            
//            alert(checkmonth);
//            alert(checkyear);
//            alert(reqfv.style.display);
            
            date1 = new Date();
            var comp1date = new Date(checkmonth +" 1," + checkyear);
            var comp2date = new Date((date1.getFullYear()),(date1.getMonth()),1 );
            //alert(comp1date);
            //alert(comp2date);
            
            if (typeof(checkmonth) == "undefined" || checkmonth == null) return false;
            if (typeof(checkyear) == "undefined" || checkyear == null) return false;
            if (typeof(tdblock) == "undefined" || tdblock == null) return false;
          
            //alert(reqfv.style.display);
            if(comp1date < comp2date)
            {
            // alert("Invalid date");
             ValidatorEnable(rfvexpdate,true);
             tdblock.style.display="block";
            
             
            }
            else
            {
            tdblock.style.display="none";
            ValidatorEnable(rfvexpdate,false);
            //alert(reqfv.style.display);
            }
        }
        catch(e)
        {
            alert("Error :" + e.message + " in ValidCard()");
        }  
}



/* For ListBox Selection in FormPhysicianDetails page */
function SelectItemListBox(objListbox)
{   var v;
    for(v=1;v<objListbox.length;v++)
    {
        if(objListbox.options[v].selected)
        {
            objListbox.options[0].selected=false;
        }
    }
}
/*Function to hide Pane in Admin Baby Nursery*/
function HideBabyFirstPane()
{
    document.getElementById("divDetailsOne").style.display = "none";
    document.getElementById("divDetailsTwo").style.display = "block";
}
function HideBabySecondPane()
{
    document.getElementById("divDetailsTwo").style.display = "none";
    document.getElementById("divDetailsOne").style.display = "block";
}
/*End Function to hide Pane in Admin Baby Nursery*/

/*Function to fire Click event of button from textbox*/
function clickButton(e, buttonid){ 

      var evt = e ? e : window.event;

      var bt = document.getElementById(buttonid);

      if (bt){ 

          if (evt.keyCode == 13){ 

                bt.click(); 

                return false; 
          } 
      } 
}
/*End*/

/* Check Maxlength of Textbox*/

function ckeckMaxLength(objTextBox,MaxLength)
{   
    if(MaxLength != 0 && objTextBox.value.length >= MaxLength)
    {
      return false;
    }
}

/*End*/


    function HidePersonalInfo(obj,id,rfvid1)
    {
        try
        {
            var ctl = document.getElementById(id);
            var req1 = document.getElementById(rfvid1);
                      
         
            if (typeof(obj) == "undefined" || obj == null) return false;
            if (typeof(ctl) == "undefined" || ctl == null) return false;
          
            if(obj.checked)
            {
             
                ValidatorEnable(req1,false);
                
                ctl.style.display="none";
                

            }    
        }
        catch(e)
        {
            alert("Error :" + e.message + " in onClickHide()");
        }
    }

    function ShowPersonalInfo(obj,id,rfvid1)
    {
        try
        {
        var ctl = document.getElementById(id);
        var req1 = document.getElementById(rfvid1);
             
        if (typeof(obj) == "undefined" || obj == null) return false;
        if (typeof(ctl) == "undefined" || ctl == null) return false;
      
        if(obj.checked)
            {
         
            ctl.style.display="block";
            ValidatorEnable(req1,true);
        
      
            }
        }
        catch(e)
        {
            alert("Error :" + e.message + " in onClickShow()");
        }    
    }





















function onClickHideControls1(obj,id)
{
    try
    {
        
        var ctl = document.getElementById(id);
        //alert(obj +' ?? '+id+' ?? '+ctl);
   	    if (typeof(obj) == "undefined" || obj == null) return false;
   	    if (typeof(ctl) == "undefined" || ctl == null) return false;
        if(obj.checked)
        {
            ctl.style.display="none";
        }    
    }
    catch(e)
    {
        alert("Error :" + e.message + " in onClickHideControls()");
    }
}
function onClickShowControls1(obj,id)
{
    try
    {
        var ctl = document.getElementById(id);
       //alert(obj +' ?? '+id+' ?? '+ctl);
   	    if (typeof(obj) == "undefined" || obj == null) return false;
   	    if (typeof(ctl) == "undefined" || ctl == null) return false;
        if(obj.checked)
        {
            ctl.style.display="block";
        }
    }
    catch(e)
    {
        alert("Error :" + e.message + " in onClickShowControls()");
    }    
}

 function onClickHideControls(obj,id,rfvid)
    {
        try
        {
            var ctl = document.getElementById(id);
            var req1 = document.getElementById(rfvid);
            
            if (typeof(obj) == "undefined" || obj == null) return false;
            if (typeof(ctl) == "undefined" || ctl == null) return false;
          
            if(obj.checked)
            {
                
                ValidatorEnable(req1,false);
                ctl.style.display="none";
                
            }    
        }
        catch(e)
        {
            alert("Error :" + e.message + " in onClickHideControls()");
        }
    }

    function onClickShowControls(obj,id,rfvid)
    {
        try
        {
        var ctl = document.getElementById(id);
         var req1 = document.getElementById(rfvid);
       
        if (typeof(obj) == "undefined" || obj == null) return false;
        if (typeof(ctl) == "undefined" || ctl == null) return false;
      
        if(obj.checked)
            {
            
            ctl.style.display="block";
            ValidatorEnable(req1,true);
    
            }
        }
        catch(e)
        {
            alert("Error :" + e.message + " in onClickShowControls()");
        }    
    }
    
    
    
    
    function onIndividHideControls(obj,id,rfvid)
    {
        try
        {
            var ctl = document.getElementById(id);
            var req1 = document.getElementById(rfvid);
            
            if (typeof(obj) == "undefined" || obj == null) return false;
            if (typeof(ctl) == "undefined" || ctl == null) return false;
          
            if(obj.checked)
            {
                
                ValidatorEnable(req1,false);
                ctl.style.display="none";
                
            }    
        }
        catch(e)
        {
            alert("Error :" + e.message + " in onIndividHideControls()");
        }
    }

    function onCorpHideControls(obj,id,rfvid)
    {
        try
        {
        var ctl = document.getElementById(id);
         var req1 = document.getElementById(rfvid);
       
        if (typeof(obj) == "undefined" || obj == null) return false;
        if (typeof(ctl) == "undefined" || ctl == null) return false;
      
        if(obj.checked)
            {
            
            ctl.style.display="block";
            ValidatorEnable(req1,true);
    
            }
        }
        catch(e)
        {
            alert("Error :" + e.message + " in onCorpHideControls()");
        }    
    }
    
    
    
    
    
    
    
    function onClickHideControls_new(obj,id,rfvid)
    {
        try
        {
            var ctl = document.getElementById(id);
            var req1 = document.getElementById(rfvid);
          
            if (typeof(obj) == "undefined" || obj == null) return false;
            if (typeof(ctl) == "undefined" || ctl == null) return false;
          
            if(obj.checked)
            {
                ValidatorEnable(req1,false);
                ctl.style.display="none";
                
            }    
        }
        catch(e)
        {
            alert("Error :" + e.message + " in onClickHideControls_new()");
        }
    }

    function onClickShowControls_new(obj,id,rfvid)
    {
        try
        {
        var ctl = document.getElementById(id);
         var req1 = document.getElementById(rfvid);

        if (typeof(obj) == "undefined" || obj == null) return false;
        if (typeof(ctl) == "undefined" || ctl == null) return false;
      
        if(obj.checked)
            {
                ctl.style.display="block";
                ValidatorEnable(req1,true);
            }
        }
        catch(e)
        {
            alert("Error :" + e.message + " in onClickShowControls_new()");
        }      
    }

function onClickHide(obj,id,rfvid1,rfvid2,rfvid3)
    {
        try
        {
            var ctl = document.getElementById(id);
            var req1 = document.getElementById(rfvid1);
            var req2 = document.getElementById(rfvid2);
            var req3 = document.getElementById(rfvid3);
            
         
            if (typeof(obj) == "undefined" || obj == null) return false;
            if (typeof(ctl) == "undefined" || ctl == null) return false;
          
            if(obj.checked)
            {
             
                ValidatorEnable(req1,false);
                ValidatorEnable(req2,false);
                ValidatorEnable(req3,false);
                ctl.style.display="none";
                

            }    
        }
        catch(e)
        {
            alert("Error :" + e.message + " in onClickHide()");
        }
    }

    function onClickShow(obj,id,rfvid1,rfvid2,rfvid3)
    {
        try
        {
        var ctl = document.getElementById(id);
        var req1 = document.getElementById(rfvid1);
        var req2 = document.getElementById(rfvid2);
        var req3 = document.getElementById(rfvid3);
     
        if (typeof(obj) == "undefined" || obj == null) return false;
        if (typeof(ctl) == "undefined" || ctl == null) return false;
      
        if(obj.checked)
            {
         
            ctl.style.display="block";
            ValidatorEnable(req1,true);
            ValidatorEnable(req2,true);
            ValidatorEnable(req3,true);
      
            }
        }
        catch(e)
        {
            alert("Error :" + e.message + " in onClickShow()");
        }    
    }


function onClickHide4(obj,id,rfvid1,rfvid2,rfvid3,rfvid4)
    {
        try
        {
            var ctl = document.getElementById(id);
            var req1 = document.getElementById(rfvid1);
            var req2 = document.getElementById(rfvid2);
            var req3 = document.getElementById(rfvid3);
            var req4 = document.getElementById(rfvid4);
            
          
            if (typeof(obj) == "undefined" || obj == null) return false;
            if (typeof(ctl) == "undefined" || ctl == null) return false;
          
            if(obj.checked)
            {
             ValidatorEnable(req1,false);
            ValidatorEnable(req2,false);
            ValidatorEnable(req3,false);
            ValidatorEnable(req4,false);
                ctl.style.display="none";
           
       
            }    
        }
        catch(e)
        {
            alert("Error :" + e.message + " in onClickHide4()");
        }
    }

    function onClickShow4(obj,id,rfvid1,rfvid2,rfvid3,rfvid4)
    {
        try
        {
        var ctl = document.getElementById(id);
       var req1 = document.getElementById(rfvid1);
        var req2 = document.getElementById(rfvid2);
        var req3 = document.getElementById(rfvid3);
        var req4 = document.getElementById(rfvid4);
       
        if (typeof(obj) == "undefined" || obj == null) return false;
        if (typeof(ctl) == "undefined" || ctl == null) return false;
      
        if(obj.checked)
            {
            
            ctl.style.display="block";
              
            ValidatorEnable(req1,true);
            ValidatorEnable(req2,true);
            ValidatorEnable(req3,true);
            ValidatorEnable(req4,true);
 
            }
        }
        catch(e)
        {
            alert("Error :" + e.message + " in onClickShow4()");
        }    
    }




function onClickHide5(obj,id,rfvid1,rfvid2,rfvid3,rfvid4,rfvid5)
    {
        try
        {
            var ctl = document.getElementById(id);
            var req1 = document.getElementById(rfvid1);
            var req2 = document.getElementById(rfvid2);
            var req3 = document.getElementById(rfvid3);
            var req4 = document.getElementById(rfvid4);
            var req5 = document.getElementById(rfvid5);
           
            if (typeof(obj) == "undefined" || obj == null) return false;
            if (typeof(ctl) == "undefined" || ctl == null) return false;
          
            if(obj.checked)
            {
               
                ValidatorEnable(req1,false);
                ValidatorEnable(req2,false);
                ValidatorEnable(req3,false);
                ValidatorEnable(req4,false);
                ValidatorEnable(req5,false);
                ctl.style.display="none";
                

            }    
        }
        catch(e)
        {
            alert("Error :" + e.message + " in onClickHide5()");
        }
    }

    function onClickShow5(obj,id,rfvid1,rfvid2,rfvid3,rfvid4,rfvid5)
    {
        try
        {
        var ctl = document.getElementById(id);
        var req1 = document.getElementById(rfvid1);
        var req2 = document.getElementById(rfvid2);
        var req3 = document.getElementById(rfvid3);
        var req4 = document.getElementById(rfvid4);
        var req5 = document.getElementById(rfvid5);
     
        if (typeof(obj) == "undefined" || obj == null) return false;
        if (typeof(ctl) == "undefined" || ctl == null) return false;
      
        if(obj.checked)
            {
          
            ctl.style.display="block";
            ValidatorEnable(req1,true);
            ValidatorEnable(req2,true);
            ValidatorEnable(req3,true);
            ValidatorEnable(req4,true);
            ValidatorEnable(req5,true);
          
            }
        }
        catch(e)
        {
            alert("Error :" + e.message + " in onClickShow5()");
        }    
    }


function onClickHide2(obj,id,rfvid1,rfvid2)
    {
        try
        {
            var ctl = document.getElementById(id);
            var req1 = document.getElementById(rfvid1);
            var req2 = document.getElementById(rfvid2);
       
            if (typeof(obj) == "undefined" || obj == null) return false;
            if (typeof(ctl) == "undefined" || ctl == null) return false;
          
            if(obj.checked)
            {
                
               
                 ValidatorEnable(req1,false);
                 ValidatorEnable(req2,false);
                 ctl.style.display="none";
            }    
        }
        catch(e)
        {
            alert("Error :" + e.message + " in onClickHide2()");
        }
    }

    function onClickShow2(obj,id,rfvid1,rfvid2)
    {
        try
        {
        var ctl = document.getElementById(id);
        var req1 = document.getElementById(rfvid1);
        var req2 = document.getElementById(rfvid2);
    
        if (typeof(obj) == "undefined" || obj == null) return false;
        if (typeof(ctl) == "undefined" || ctl == null) return false;
      
        if(obj.checked)
            {

            ctl.style.display="block";
             ValidatorEnable(req1,true);
             ValidatorEnable(req2,true);

            }
        }
        catch(e)
        {
            alert("Error :" + e.message + " in onClickShow2()");
        }    
    }

 function onClickHideControlsCustomValidator(obj,id,rfvid,cvid)
    {
        try
        {
            var ctl = document.getElementById(id);
            var req1 = document.getElementById(rfvid);
	    var customval = document.getElementById(cvid);
            
            if (typeof(obj) == "undefined" || obj == null) return false;
            if (typeof(ctl) == "undefined" || ctl == null) return false;
          
            if(obj.checked)
            {
                
                ValidatorEnable(req1,false);
                ctl.style.display="none";
		customval.style.display="none"; 
                
            }    
        }
        catch(e)
        {
            alert("Error :" + e.message + " in onClickHideControls()");
        }
    }

    function onClickShowControlsCustomValidator(obj,id,rfvid,cvid)
    {
        try
        {
        var ctl = document.getElementById(id);
         var req1 = document.getElementById(rfvid);
        var customval = document.getElementById(cvid);
       
        if (typeof(obj) == "undefined" || obj == null) return false;
        if (typeof(ctl) == "undefined" || ctl == null) return false;
      
        if(obj.checked)
            {
            
            ctl.style.display="block";
	    customval.style.display="none"; 
            ValidatorEnable(req1,true);
    
            }
        }
        catch(e)
        {
            alert("Error :" + e.message + " in onClickShowControls()");
        }    
    }

function DropDownchangeShow(obj,showblock1,showblock2)
{
    try
    {
        var ddlid = document.getElementById(obj).value;
        var block1 = document.getElementById(showblock1);
        var block2 = document.getElementById(showblock2);
        
        
        if (typeof(obj) == "undefined" || obj == null) return false;
        
        
        if(ddlid == "Temporary")
        {
        block1.style.display = "block";
        }
        else
        {
        block1.style.display = "none";
        }
        
        
        if(ddlid == "Summer")
        {
        block2.style.display = "block";
        }
        else
        {
        block2.style.display = "none";
        }
    }
    catch(e)
    {
        alert("Error :" + e.message + " in DropDownchangeShow()");
    }
}


function CheckBoxShowHide(obj,req,isreq)
{
    try
    {
        var trdisp = document.getElementById(req);
        var rfvReq = document.getElementById(isreq);
        
        if (typeof(obj) == "undefined" || obj == null) return false;
        
        if(obj.checked)
        {
                trdisp.style.display = "block";
                 ValidatorEnable(rfvReq,true);
        }
        else
        {
                ValidatorEnable(rfvReq,false);
                trdisp.style.display = "none";
        }
    }
    catch(e)
    {
       alert("Error :" + e.message + " in CheckBoxShowHide()");
    }
}

function RadioShowHide(obj1,req1,isreq1,obj2,req2,isreq2,obj3,req3,isreq3)
{
    try
    {
        var trdisp = document.getElementById(req1);
        var rfvReq = document.getElementById(isreq1);
        var rdb1 = document.getElementById(obj1);
      //  alert(trdisp.style.display);
        
        var trdisp2 = document.getElementById(req2);
        var rfvReq2 = document.getElementById(isreq2);
         var rdb2 = document.getElementById(obj2);
        //  alert(trdisp2.style.display);
        
        var trdisp3 = document.getElementById(req3);
        var rfvReq3 = document.getElementById(isreq3);
         var rdb3 = document.getElementById(obj3);
       //   alert(trdisp3.style.display);
        
        if (typeof(obj1) == "undefined" || obj1 == null) return false;
        if (typeof(obj2) == "undefined" || obj2 == null) return false;
        if (typeof(obj3) == "undefined" || obj3 == null) return false;
        
        if(rdb1.checked)
        {
                //alert(trdisp.style.display);
                trdisp.style.display = "block";
                trdisp2.style.display = "none";
                trdisp3.style.display = "none";
                ValidatorEnable(rfvReq,true);
                ValidatorEnable(rfvReq2,false);
                ValidatorEnable(rfvReq3,false);
        }
//        else
//        {
//                ValidatorEnable(rfvReq,false);
//                trdisp.style.display = "none";
//        }
        
         if(rdb2.checked)
        {
                trdisp.style.display = "none";
                trdisp2.style.display = "block";
                trdisp3.style.display = "none";
                ValidatorEnable(rfvReq,false);
                ValidatorEnable(rfvReq2,true);
                ValidatorEnable(rfvReq3,false);
        }
//        else
//        {
//                ValidatorEnable(rfvReq2,false);
//                trdisp2.style.display = "none";
//        }
        
         if(rdb3.checked)
        {
                trdisp.style.display = "none";
                trdisp2.style.display = "none";
                trdisp3.style.display = "block";
                ValidatorEnable(rfvReq,false);
                ValidatorEnable(rfvReq2,false);
                ValidatorEnable(rfvReq3,true);
        }
//        else
//        {
//                ValidatorEnable(rfvReq3,false);
//                trdisp3.style.display = "none";
//        }
    }
    catch(e)
    {
       alert("Error :" + e.message + " in RadioShowHide()");
    }
}


function CheckFutureDate(obj)
{
alert(document.getElementById(obj).value);
}


function DisableValidationsRelation(obj,fn,ln,rel) 
{
    var ctl1 = document.getElementById(fn);
    var ctl2 = document.getElementById(ln);
    var ctl3 = document.getElementById(rel);

    if (typeof(ctl1) == "undefined" || ctl1 == null) return false;
    if (typeof(ctl2) == "undefined" || ctl2 == null) return false;
    if (typeof(ctl3) == "undefined" || ctl3 == null) return false;

    if(obj.checked)
    {
        //alert(ctl1);
        ValidatorEnable(ctl1,true);
        ValidatorEnable(ctl2,true);                               
        ValidatorEnable(ctl3,true);
    }            
}
function EnableValidationsRelation(obj,fn,ln,rel) 
{
    var ctl1 = document.getElementById(fn);
    var ctl2 = document.getElementById(ln);
    var ctl3 = document.getElementById(rel);
    
    if (typeof(ctl1) == "undefined" || ctl1 == null) return false;
    if (typeof(ctl2) == "undefined" || ctl2 == null) return false;
    if (typeof(ctl3) == "undefined" || ctl3 == null) return false;
    
    if(obj.checked)
    {
        //alert(ctl1);
        ValidatorEnable(ctl1,false);
        ValidatorEnable(ctl2,false);
        ValidatorEnable(ctl3,false);
        
        ctl1.style.display='none';
        ctl2.style.display='none';
        ctl3.style.display='none';        
    }            
}
function DisableValidationsSecondary(obj,fn,ln,ad,ct,st,zp,ac,nm,icn,pin) 
{
    var ctl1 = document.getElementById(fn);
    var ctl2 = document.getElementById(ln);
    var ctl3 = document.getElementById(ad);
    var ctl4 = document.getElementById(ct);
    var ctl5 = document.getElementById(st);
    var ctl6 = document.getElementById(zp);
    var ctl7 = document.getElementById(ac);
    var ctl8 = document.getElementById(nm);
    var ctl9 = document.getElementById(icn);
    var ctl0 = document.getElementById(pin);

    if (typeof(ctl1) == "undefined" || ctl1 == null) return false;
    if (typeof(ctl2) == "undefined" || ctl2 == null) return false;
    if (typeof(ctl3) == "undefined" || ctl3 == null) return false;
    if (typeof(ctl4) == "undefined" || ctl4 == null) return false;
    if (typeof(ctl5) == "undefined" || ctl5 == null) return false;
    if (typeof(ctl6) == "undefined" || ctl6 == null) return false;    
    if (typeof(ctl7) == "undefined" || ctl7 == null) return false;
    if (typeof(ctl8) == "undefined" || ctl8 == null) return false;
    if (typeof(ctl9) == "undefined" || ctl9 == null) return false;    
    if (typeof(ctl0) == "undefined" || ctl0 == null) return false;
    
    if(obj.checked)
    {
        //alert(ctl1);
        ValidatorEnable(ctl1,false);
        ValidatorEnable(ctl2,false);                               
        ValidatorEnable(ctl3,false);
        ValidatorEnable(ctl4,false);
        ValidatorEnable(ctl5,false);                               
        ValidatorEnable(ctl6,false);
        ValidatorEnable(ctl7,false);
        ValidatorEnable(ctl8,false);                               
        ValidatorEnable(ctl9,false);
        ValidatorEnable(ctl0,false);
    }            
}
function EnableValidationsSecondary(obj,fn,ln,ad,ct,st,zp,ac,nm,icn,pin) 
{
    var ctl1 = document.getElementById(fn);
    var ctl2 = document.getElementById(ln);
    var ctl3 = document.getElementById(ad);
    var ctl4 = document.getElementById(ct);
    var ctl5 = document.getElementById(st);
    var ctl6 = document.getElementById(zp);
    var ctl7 = document.getElementById(ac);
    var ctl8 = document.getElementById(nm);
    var ctl9 = document.getElementById(icn);
    var ctl0 = document.getElementById(pin);

    if (typeof(ctl1) == "undefined" || ctl1 == null) return false;
    if (typeof(ctl2) == "undefined" || ctl2 == null) return false;
    if (typeof(ctl3) == "undefined" || ctl3 == null) return false;
    if (typeof(ctl4) == "undefined" || ctl4 == null) return false;
    if (typeof(ctl5) == "undefined" || ctl5 == null) return false;
    if (typeof(ctl6) == "undefined" || ctl6 == null) return false;    
    if (typeof(ctl7) == "undefined" || ctl7 == null) return false;
    if (typeof(ctl8) == "undefined" || ctl8 == null) return false;
    if (typeof(ctl9) == "undefined" || ctl9 == null) return false;    
    if (typeof(ctl0) == "undefined" || ctl0 == null) return false;
    
    if(obj.checked)
    {
        //alert(ctl1);
        ValidatorEnable(ctl1,true);
        ValidatorEnable(ctl2,true);                               
        ValidatorEnable(ctl3,true);
        ValidatorEnable(ctl4,true);
        ValidatorEnable(ctl5,true);                               
        ValidatorEnable(ctl6,true);
        ValidatorEnable(ctl7,true);
        ValidatorEnable(ctl8,true);                               
        ValidatorEnable(ctl9,true);
        ValidatorEnable(ctl0,true);
        
        ctl1.style.display='none';
        ctl2.style.display='none';
        ctl3.style.display='none';
        ctl4.style.display='none';
        ctl5.style.display='none';
        ctl6.style.display='none';
        ctl7.style.display='none';
        ctl8.style.display='none';
        ctl9.style.display='none';
        ctl0.style.display='none';        
    }            
}

function HideRelationDetails(obj,a,b,c,d,e,f,g) 
{
    var ctl1 = document.getElementById(a);
    var ctl2 = document.getElementById(b);
    var ctl3 = document.getElementById(c);
    var ctl4 = document.getElementById(d);
    var ctl5 = document.getElementById(e);
    var ctl6 = document.getElementById(f);
    var ctl7 = document.getElementById(g);

    if (typeof(ctl1) == "undefined" || ctl1 == null) return false;
    if (typeof(ctl2) == "undefined" || ctl2 == null) return false;
    if (typeof(ctl3) == "undefined" || ctl3 == null) return false;
    if (typeof(ctl4) == "undefined" || ctl4 == null) return false;
    if (typeof(ctl5) == "undefined" || ctl5 == null) return false;
    if (typeof(ctl6) == "undefined" || ctl6 == null) return false;    
    if (typeof(ctl7) == "undefined" || ctl7 == null) return false;
    
    if(obj.checked)
    {
        //alert(ctl1);
        ctl1.style.display="none";
        ctl2.style.display="none";
        ctl3.style.display="none";
        ctl4.style.display="none";
        ctl5.style.display="none";
        ctl6.style.display="none";
        ctl7.style.display="none";
    }            
}
function ShowRelationDetails(obj,a,b,c,d,e,f,g) 
{
    var ctl1 = document.getElementById(a);
    var ctl2 = document.getElementById(b);
    var ctl3 = document.getElementById(c);
    var ctl4 = document.getElementById(d);
    var ctl5 = document.getElementById(e);
    var ctl6 = document.getElementById(f);
    var ctl7 = document.getElementById(g);

    if (typeof(ctl1) == "undefined" || ctl1 == null) return false;
    if (typeof(ctl2) == "undefined" || ctl2 == null) return false;
    if (typeof(ctl3) == "undefined" || ctl3 == null) return false;
    if (typeof(ctl4) == "undefined" || ctl4 == null) return false;
    if (typeof(ctl5) == "undefined" || ctl5 == null) return false;
    if (typeof(ctl6) == "undefined" || ctl6 == null) return false;    
    if (typeof(ctl7) == "undefined" || ctl7 == null) return false;
    
    if(obj.checked)
    {
        //alert(ctl1);
        ctl1.style.display="block";
        ctl2.style.display="block";
        ctl3.style.display="block";
        ctl4.style.display="block";
        ctl5.style.display="block";
        ctl6.style.display="block";
        ctl7.style.display="block";
    }            
}
function RenderSameAddress(obj,a,b,c,d,e,f,aa,bb,cc,dd,ee,ff) 
{
    var ctl1 = document.getElementById(a);
    var ctl2 = document.getElementById(b);
    var ctl3 = document.getElementById(c);
    var ctl4 = document.getElementById(d);
    var ctl5 = document.getElementById(e);
    var ctl6 = document.getElementById(f);
    var ctl11 = document.getElementById(aa);
    var ctl22 = document.getElementById(bb);
    var ctl33 = document.getElementById(cc);
    var ctl44 = document.getElementById(dd);
    var ctl55 = document.getElementById(ee);
    var ctl66 = document.getElementById(ff);
    
    //alert(ctl1);

    if (typeof(ctl1) == "undefined" || ctl1 == null) return false;
    if (typeof(ctl2) == "undefined" || ctl2 == null) return false;
    if (typeof(ctl3) == "undefined" || ctl3 == null) return false;
    if (typeof(ctl4) == "undefined" || ctl4 == null) return false;
    if (typeof(ctl5) == "undefined" || ctl5 == null) return false;
    if (typeof(ctl6) == "undefined" || ctl6 == null) return false; 
    if (typeof(ctl11) == "undefined" || ctl11 == null) return false;
    if (typeof(ctl22) == "undefined" || ctl22 == null) return false;
    if (typeof(ctl33) == "undefined" || ctl33 == null) return false;
    if (typeof(ctl44) == "undefined" || ctl44 == null) return false;
    if (typeof(ctl55) == "undefined" || ctl55 == null) return false;
    if (typeof(ctl66) == "undefined" || ctl66 == null) return false; 
    
    if(obj.checked)
    {
        //alert(ctl1);
        ctl11.value           = ctl1.value;
        ctl22.value           = ctl2.value;
        ctl33.value           = ctl3.value;
        ctl44.selectedIndex   = ctl4.selectedIndex;
        ctl55.value           = ctl5.value;
        ctl66.value           = ctl6.value;        
    }
    else
    {
        //alert(ctl1);
        ctl11.value            = "";
        ctl22.value            = "";
        ctl33.value            = "";
        ctl44.selectedIndex    = 0;
        ctl55.value            = "";
        ctl66.value            = "";        
    }            
}

function RenderPatientAddress(obj,a,b,c,d,e,f,aa,bb,cc,dd,ee,ff) 
{
    var ctl1 = document.getElementById(a);
    var ctl2 = document.getElementById(b);
    var ctl3 = document.getElementById(c);
    var ctl4 = document.getElementById(d);
    var ctl5 = document.getElementById(e);
    var ctl6 = document.getElementById(f);
    var ctl11 = document.getElementById(aa);
    var ctl22 = document.getElementById(bb);
    var ctl33 = document.getElementById(cc);
    var ctl44 = document.getElementById(dd);
    var ctl55 = document.getElementById(ee);
    var ctl66 = document.getElementById(ff);
    
    //alert(ctl1);

    if (typeof(ctl1) == "undefined" || ctl1 == null) return false;
    if (typeof(ctl2) == "undefined" || ctl2 == null) return false;
    if (typeof(ctl3) == "undefined" || ctl3 == null) return false;
    if (typeof(ctl4) == "undefined" || ctl4 == null) return false;
    if (typeof(ctl5) == "undefined" || ctl5 == null) return false;
    if (typeof(ctl6) == "undefined" || ctl6 == null) return false; 
    if (typeof(ctl11) == "undefined" || ctl11 == null) return false;
    if (typeof(ctl22) == "undefined" || ctl22 == null) return false;
    if (typeof(ctl33) == "undefined" || ctl33 == null) return false;
    if (typeof(ctl44) == "undefined" || ctl44 == null) return false;
    if (typeof(ctl55) == "undefined" || ctl55 == null) return false;
    if (typeof(ctl66) == "undefined" || ctl66 == null) return false; 
    
    if(obj.checked)
    {
        //alert(ctl1);
        ctl11.value           = ctl1.value;
        ctl22.value           = ctl2.value;
        ctl33.value           = ctl3.value;
        ctl44.selectedIndex   = ctl4.selectedIndex;
        ctl55.value           = ctl5.value;
        ctl66.value           = ctl6.value;        
    }     
}
function ResetPatientAddress(obj,a,b,c,d,e,f,aa,bb,cc,dd,ee,ff) 
{
//    var ctl1 = document.getElementById(a);
//    var ctl2 = document.getElementById(b);
//    var ctl3 = document.getElementById(c);
//    var ctl4 = document.getElementById(d);
//    var ctl5 = document.getElementById(e);
//    var ctl6 = document.getElementById(f);
    var ctl11 = document.getElementById(aa);
    var ctl22 = document.getElementById(bb);
    var ctl33 = document.getElementById(cc);
    var ctl44 = document.getElementById(dd);
    var ctl55 = document.getElementById(ee);
    var ctl66 = document.getElementById(ff);
    
    //alert(ctl1);

//    if (typeof(ctl1) == "undefined" || ctl1 == null) return false;
//    if (typeof(ctl2) == "undefined" || ctl2 == null) return false;
//    if (typeof(ctl3) == "undefined" || ctl3 == null) return false;
//    if (typeof(ctl4) == "undefined" || ctl4 == null) return false;
//    if (typeof(ctl5) == "undefined" || ctl5 == null) return false;
//    if (typeof(ctl6) == "undefined" || ctl6 == null) return false; 
    if (typeof(ctl11) == "undefined" || ctl11 == null) return false;
    if (typeof(ctl22) == "undefined" || ctl22 == null) return false;
    if (typeof(ctl33) == "undefined" || ctl33 == null) return false;
    if (typeof(ctl44) == "undefined" || ctl44 == null) return false;
    if (typeof(ctl55) == "undefined" || ctl55 == null) return false;
    if (typeof(ctl66) == "undefined" || ctl66 == null) return false; 
    
    if(obj.checked)
    {
//        alert(ctl11 +""+ctl22 +""+ ctl33 +""+ ctl44 +""+ ctl55 +""+ ctl66 );
        ctl11.value            = "";
        ctl22.value            = "";
        ctl33.value            = "";
        ctl44.selectedIndex    = 0;
        ctl55.value            = "";
        ctl66.value            = "";        
    }            
}

function RenderPatientDetails(obj,a,b,c,d,e,f,g,h,i,j,k,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,x,y,z) 
{
    var ctl1 = document.getElementById(a);
    var ctl2 = document.getElementById(b);
    var ctl3 = document.getElementById(c);
    var ctl4 = document.getElementById(d);
    var ctl5 = document.getElementById(e);
    var ctl6 = document.getElementById(f);
    var ctl7 = document.getElementById(g);
    var ctl8 = document.getElementById(h);
    var ctl9 = document.getElementById(i);
    var ctl0 = document.getElementById(j);    
    var ctl10 = document.getElementById(k);
    
    var ctl11 = document.getElementById(aa);
    var ctl22 = document.getElementById(bb);
    var ctl33 = document.getElementById(cc);
    var ctl44 = document.getElementById(dd);
    var ctl55 = document.getElementById(ee);
    var ctl66 = document.getElementById(ff);
    var ctl77 = document.getElementById(gg);
    var ctl88 = document.getElementById(hh);
    var ctl99 = document.getElementById(ii);
    var ctl00 = document.getElementById(jj);
    var ctl100 = document.getElementById(kk);
    
    var ctlx = document.getElementById(x);
    var ctly = document.getElementById(y);
    var ctlz = document.getElementById(z);


    if (typeof(ctl1) == "undefined" || ctl1 == null) return false;
    if (typeof(ctl2) == "undefined" || ctl2 == null) return false;
    if (typeof(ctl3) == "undefined" || ctl3 == null) return false;
    if (typeof(ctl4) == "undefined" || ctl4 == null) return false;
    if (typeof(ctl5) == "undefined" || ctl5 == null) return false;
    if (typeof(ctl6) == "undefined" || ctl6 == null) return false; 
    if (typeof(ctl7) == "undefined" || ctl7 == null) return false;
    if (typeof(ctl8) == "undefined" || ctl8 == null) return false;
    if (typeof(ctl9) == "undefined" || ctl9 == null) return false;
    if (typeof(ctl0) == "undefined" || ctl0 == null) return false; 
    if (typeof(ctl10) == "undefined" || ctl10 == null) return false; 

    
    if (typeof(ctl11) == "undefined" || ctl11 == null) return false;
    if (typeof(ctl22) == "undefined" || ctl22 == null) return false;
    if (typeof(ctl33) == "undefined" || ctl33 == null) return false;
    if (typeof(ctl44) == "undefined" || ctl44 == null) return false;
    if (typeof(ctl55) == "undefined" || ctl55 == null) return false;
    if (typeof(ctl66) == "undefined" || ctl66 == null) return false; 
    if (typeof(ctl77) == "undefined" || ctl77 == null) return false;
    if (typeof(ctl88) == "undefined" || ctl88 == null) return false;
    if (typeof(ctl99) == "undefined" || ctl99 == null) return false;
    if (typeof(ctl00) == "undefined" || ctl00 == null) return false;
    if (typeof(ctl100) == "undefined" || ctl100 == null) return false; 
        
    if (typeof(ctlx) == "undefined" || ctlx == null) return false;
    if (typeof(ctly) == "undefined" || ctly == null) return false; 
    if (typeof(ctlz) == "undefined" || ctlz == null) return false;
    
    if(obj.checked)
    {
        //alert(ctlx.value);
        //alert(ctl1);        
        ctl11.value            = ctl1.value;       
        ctl22.value            = ctl2.value;        
        ctl33.selectedIndex    = ctl3.selectedIndex;
        ctl44.selectedIndex    = ctl4.selectedIndex;
        ctl55.selectedIndex    = ctl5.selectedIndex;
        ctl66.value            = ctl6.value;      
        ctl77.value            = ctl7.value;        
        ctl88.value            = ctl8.value;        
        ctl99.value            = ctl9.value;       
        ctl00.value            = ctl0.value;
        ctl100.selectedIndex    = ctl10.selectedIndex;
        ctlx.selectedIndex     = 21;//"Self";
        ctly.style.display     = "none";
        ctlz.style.display     = "none"; 
    }   
}


function ResetPatientDetails(obj,a,b,c,d,e,f,g,h,i,j,k,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,x,y,z) 
{
    var ctl1 = document.getElementById(a);
    var ctl2 = document.getElementById(b);
    var ctl3 = document.getElementById(c);
    var ctl4 = document.getElementById(d);
    var ctl5 = document.getElementById(e);
    var ctl6 = document.getElementById(f);
    var ctl7 = document.getElementById(g);
    var ctl8 = document.getElementById(h);
    var ctl9 = document.getElementById(i);
    var ctl0 = document.getElementById(j);    
    var ctl10 = document.getElementById(k);    
    
    var ctl11 = document.getElementById(aa);
    var ctl22 = document.getElementById(bb);
    var ctl33 = document.getElementById(cc);
    var ctl44 = document.getElementById(dd);
    var ctl55 = document.getElementById(ee);
    var ctl66 = document.getElementById(ff);
    var ctl77 = document.getElementById(gg);
    var ctl88 = document.getElementById(hh);
    var ctl99 = document.getElementById(ii);
    var ctl00 = document.getElementById(jj);    
    var ctl100 = document.getElementById(kk);
    
    var ctlx = document.getElementById(x);
    var ctly = document.getElementById(y);
    var ctlz = document.getElementById(z);


    if (typeof(ctl1) == "undefined" || ctl1 == null) return false;
    if (typeof(ctl2) == "undefined" || ctl2 == null) return false;
    if (typeof(ctl3) == "undefined" || ctl3 == null) return false;
    if (typeof(ctl4) == "undefined" || ctl4 == null) return false;
    if (typeof(ctl5) == "undefined" || ctl5 == null) return false;
    if (typeof(ctl6) == "undefined" || ctl6 == null) return false; 
    if (typeof(ctl7) == "undefined" || ctl7 == null) return false;
    if (typeof(ctl8) == "undefined" || ctl8 == null) return false;
    if (typeof(ctl9) == "undefined" || ctl9 == null) return false;
    if (typeof(ctl0) == "undefined" || ctl0 == null) return false; 
    if (typeof(ctl10) == "undefined" || ctl10 == null) return false; 

    if (typeof(ctl11) == "undefined" || ctl11 == null) return false;
    if (typeof(ctl22) == "undefined" || ctl22 == null) return false;
    if (typeof(ctl33) == "undefined" || ctl33 == null) return false;
    if (typeof(ctl44) == "undefined" || ctl44 == null) return false;
    if (typeof(ctl55) == "undefined" || ctl55 == null) return false;
    if (typeof(ctl66) == "undefined" || ctl66 == null) return false; 
    if (typeof(ctl77) == "undefined" || ctl77 == null) return false;
    if (typeof(ctl88) == "undefined" || ctl88 == null) return false;
    if (typeof(ctl99) == "undefined" || ctl99 == null) return false;
    if (typeof(ctl00) == "undefined" || ctl00 == null) return false;
    if (typeof(ctl100) == "undefined" || ctl100 == null) return false;
        
    if (typeof(ctlx) == "undefined" || ctlx == null) return false;
    if (typeof(ctly) == "undefined" || ctly == null) return false; 
    if (typeof(ctlz) == "undefined" || ctlz == null) return false;
    
    
    if(obj.checked)
    {
        //alert(ctl1);
       /* */
        ctl11.value            = "";       
        ctl22.value            = "";  
        ctl11.focus();       
        ctl22.focus();                
        ctl33.selectedIndex    = 0;
        ctl44.selectedIndex    = 0;
        ctl55.selectedIndex    = 0;        
        ctl66.value            = "";      
        ctl77.value            = "";        
        ctl88.value            = "";       
        ctl99.value            = "";      
        ctl00.value            = "";        
        ctl88.focus();
        ctl99.focus();
        ctl00.focus();
        obj.focus(); 
        ctl100.selectedIndex    = ctl10.selectedIndex;           
        ctly.style.display     = "block";         
        ctlz.style.display     = "block";   
        ctlx.selectedIndex     = 0;    
    }   
}