// JScript File
// Created by Kumuthini.L
var IsFillHidden = "Y";
function ManualTimeEntry()
{
    IsFillHidden = "N";
    ManualTimeEntryTerminals();
    var InTerminal;
    var OutTerminal;
    if(document.aspnetForm.ctl00_BodyContentPH_hdn_InTerminal.value != "")
    {
        InTerminal = document.aspnetForm.ctl00_BodyContentPH_hdn_InTerminal.value;
        document.aspnetForm.ctl00_BodyContentPH_ddlInTerminals.value = InTerminal;
    }
    if(document.aspnetForm.ctl00_BodyContentPH_hdn_OutTerminal.value != "")
    {
        OutTerminal = document.aspnetForm.ctl00_BodyContentPH_hdn_OutTerminal.value;
        document.aspnetForm.ctl00_BodyContentPH_ddlOutTerminals.value = OutTerminal;
    }
    //ManualTimeEntry_InPunchTypes();
    //ManualTimeEntry_OutPunchTypes();
}
 function SelectInTerminal()
 {
    var InTerminal;
    if(document.aspnetForm.ctl00_BodyContentPH_hdn_InTerminal.value != "")
    {
        InTerminal = document.aspnetForm.ctl00_BodyContentPH_hdn_InTerminal.value;
        alert(InTerminal);
        document.aspnetForm.ctl00_BodyContentPH_ddlInTerminals.value = InTerminal;
    }
 }
  function SelectOutTerminal()
  {
    var OutTerminal;
    if(document.aspnetForm.ctl00_BodyContentPH_hdn_OutTerminal.value != "")
    {
        OutTerminal = document.aspnetForm.ctl00_BodyContentPH_hdn_OutTerminal.value;
        alert(OutTerminal);
        document.aspnetForm.ctl00_BodyContentPH_ddlOutTerminals.value = OutTerminal;
    }
 }
var objInPunchTypes;
var objOutPunchTypes;
function ManualTimeEntry_InPunchTypes(SelTerminal,NoRecords,Errorinretrivingdetails,Select)
{
    if(window.ActiveXObject)
    {    
	    try
	    {
		    objInPunchTypes = new ActiveXObject("Msxml2.XMLHTTP");
	    }
	    catch(e)
	    {
		    try
		    {
			    objInPunchTypes = new ActiveXObject("Microsoft.XMLHTTP");
		    }
		    catch(e1)
		    {
			    objInPunchTypes = null;
		    }
	    }
    }  
     else if(window.XMLHttpRequest)
     {
	    try
	    {
		    objInPunchTypes = new XMLHttpRequest("Msxml2.XMLHTTP");
	    }
	    catch(e)
	    {
		    try
		    {
			    objInPunchTypes = new XMLHttpRequest("Microsoft.XMLHTTP");
		    }
		    catch(e1)
		    {
			    objInPunchTypes = null;
		    }
	    }
    }
//    try
//	{
//		objInPunchTypes = new XmlHttpRequest();
//	}
//	catch(e)
//	{
//		try
//		{
//			objInPunchTypes = new ActiveXObject("Microsoft.XMLHTTP");
//		}
//		catch(e1)
//		{
//			objInPunchTypes = new ActiveXObject("Msxml2.XMLHTTP");
//		}
//	}
	if(objInPunchTypes != null)
	{
		var EntranceId=document.getElementById('ctl00_BodyContentPH_ddlInTerminals').value;
	    if(EntranceId == "-Select-")
	    {
	      // alert("Select In Terminal");
	      alert(SelTerminal);
	       //Clears In PunchTypes dropdown
	       if (document.getElementById('ctl00_BodyContentPH_ddlInPunchTypes').options.length != null)
            {				
	            for (var count = document.getElementById('ctl00_BodyContentPH_ddlInPunchTypes').options.length-1;count >-1; count--)
	            {
	                document.getElementById('ctl00_BodyContentPH_ddlInPunchTypes').options[count] = null;
	            }	
            }
             //Fill In punchtypes drop down with 'Select'
             var newOptSelect = new Option(Select,'-Select-',  false, false);
             document.getElementById('ctl00_BodyContentPH_ddlInPunchTypes').options[0]=newOptSelect;
	       return false;
	    }
		if(EntranceId != "")
		{
		    if(window.ActiveXObject)
            {
		        objInPunchTypes.onreadystatechange =  Process_Response_InPunchTypes;		
		        objInPunchTypes.open("GET","AjaxManualTimeEntry.aspx?EntranceId=" + EntranceId + "&TerminalType=I" + "&strType=PunchTypes" + "&RanId=" + Math.random(),true)
		        objInPunchTypes.send(null);
		    }
		    else if(window.XMLHttpRequest)
            {
		        objInPunchTypes.open("GET","AjaxManualTimeEntry.aspx?EntranceId=" + EntranceId + "&TerminalType=I" + "&strType=PunchTypes" + "&RanId=" + Math.random(),false)
		        objInPunchTypes.send(null);
		        objInPunchTypes.onreadystatechange =  Process_Response_InPunchTypes();		
            }
		} 
		if(IsFillHidden != "N")
		{
		    FillInTerminalHidden();
		}
	}
	return false;
}
function Process_Response_InPunchTypes()
{
   if (document.getElementById('ctl00_BodyContentPH_ddlInPunchTypes').options.length != null)
   {				
	  for (var count = document.getElementById('ctl00_BodyContentPH_ddlInPunchTypes').options.length-1;count >-1; count--)
	  {
	     document.getElementById('ctl00_BodyContentPH_ddlInPunchTypes').options[count] = null;
	  }	
   }
   if(objInPunchTypes.readyState == 4)
   {
	   if(objInPunchTypes.status == 200)
	   {
		  if(objInPunchTypes.responseText=="Fail" || objInPunchTypes.responseText=="")
		  {
			 var newOptSelect = new Option(Select,'-Select-',  false, false);
             document.getElementById('ctl00_BodyContentPH_ddlInPunchTypes').options[0]=newOptSelect;
		     //alert("No Records");
		     alert(NoRecords);
			 return;
		  }
		  else
		  {
			 var xml=objInPunchTypes.responseXML;
			 var dsRoot=xml.documentElement.getElementsByTagName("InPunchTypes");  
			 var totalRec = dsRoot.length;
             var newOptSelect = new Option(Select,'-Select-',  false, false);
             document.getElementById('ctl00_BodyContentPH_ddlInPunchTypes').options[0]=newOptSelect;
             for(i=0; i<totalRec; i++)
             {
                //var Value = xml.getElementsByTagName("Value")[i];
                //var Value = xml.getElementsByTagName('Value')[i].childNodes[0].nodeValue;
                var Value = xml.getElementsByTagName('PunchType_Value')[i].childNodes[0].nodeValue;
                //var PunchType=xml.getElementsByTagName("PunchType")[i];
                var PunchType = xml.getElementsByTagName('PunchType')[i].childNodes[0].nodeValue;
                var newOpt=new Option(PunchType,Value);
                document.getElementById('ctl00_BodyContentPH_ddlInPunchTypes').options[i+1]=newOpt;
             }
             document.getElementById('ctl00_BodyContentPH_ddlInPunchTypes').focus();
           }
      }
      else
      {
	    //alert("Error in retriving details");
	     alert(Errorinretrivingdetails);
      }
   }
}
function ManualTimeEntry_OutPunchTypes(SelOutTerminal,NoRecords,Errorinretrivingdetails)
{
   if(window.ActiveXObject)
    {    
	    try
	    {
		    objOutPunchTypes = new ActiveXObject("Msxml2.XMLHTTP");
	    }
	    catch(e)
	    {
		    try
		    {
			    objOutPunchTypes = new ActiveXObject("Microsoft.XMLHTTP");
		    }
		    catch(e1)
		    {
			    objOutPunchTypes = null;
		    }
	    }
    }  
     else if(window.XMLHttpRequest)
     {
	    try
	    {
		    objOutPunchTypes = new XMLHttpRequest("Msxml2.XMLHTTP");
	    }
	    catch(e)
	    {
		    try
		    {
			    objOutPunchTypes = new XMLHttpRequest("Microsoft.XMLHTTP");
		    }
		    catch(e1)
		    {
			    objOutPunchTypes = null;
		    }
	    }
    }
//    try
//	{
//		objOutPunchTypes = new XmlHttpRequest();
//	}
//	catch(e)
//	{
//		try
//		{
//			objOutPunchTypes = new ActiveXObject("Microsoft.XMLHTTP");
//		}
//		catch(e1)
//		{
//			objOutPunchTypes = new ActiveXObject("Msxml2.XMLHTTP");
//		}
//	}
	if(objOutPunchTypes != null)
	{
		var EntranceId=document.getElementById('ctl00_BodyContentPH_ddlOutTerminals').value;
		if(EntranceId == "-Select-")
	    {
	       //alert("Select Out Terminal");
	       alert(SelOutTerminal);
	       //Clears Out PunchTypes dropdown
	       if (document.getElementById('ctl00_BodyContentPH_ddlOutPunchTypes').options.length != null)
            {				
	            for (var count = document.getElementById('ctl00_BodyContentPH_ddlOutPunchTypes').options.length-1;count >-1; count--)
	            {
	                document.getElementById('ctl00_BodyContentPH_ddlOutPunchTypes').options[count] = null;
	            }	
            }
             //Fill Out punchtypes drop down with 'Select'
             var newOptSelect = new Option(Select,'-Select-',  false, false);
             document.getElementById('ctl00_BodyContentPH_ddlOutPunchTypes').options[0]=newOptSelect;
	       return false;
	    }
		if(EntranceId != "")
		{
		   if(window.ActiveXObject)
           {
		        objOutPunchTypes.onreadystatechange = Process_Response_OutPunchTypes;		
		        objOutPunchTypes.open("GET","AjaxManualTimeEntry.aspx?EntranceId=" + EntranceId + "&TerminalType=O" + "&strType=PunchTypes" + "&RanId=" + Math.random(),true)
		        objOutPunchTypes.send(null);
		   }
		   else if(window.XMLHttpRequest)
		   {
		        objOutPunchTypes.open("GET","AjaxManualTimeEntry.aspx?EntranceId=" + EntranceId + "&TerminalType=O" + "&strType=PunchTypes" + "&RanId=" + Math.random(),false)
		        objOutPunchTypes.send(null);
		        objOutPunchTypes.onreadystatechange = Process_Response_OutPunchTypes();		
		   }
		} 
		if(IsFillHidden != "N")
		{
		    FillOutTerminalHidden();
		}
	}
	return false;
}
function Process_Response_OutPunchTypes()
{
   if (document.getElementById('ctl00_BodyContentPH_ddlOutPunchTypes').options.length != null)
   {				
	  for (var count = document.getElementById('ctl00_BodyContentPH_ddlOutPunchTypes').options.length-1;count >-1; count--)
	  {
	     document.getElementById('ctl00_BodyContentPH_ddlOutPunchTypes').options[count] = null;
	  }	
   }
   if(objOutPunchTypes.readyState == 4)
   {
	   if(objOutPunchTypes.status == 200)
	   {
		  if(objOutPunchTypes.responseText=="Fail" || objOutPunchTypes.responseText=="")
		  {
			 var newOptSelect = new Option('-Select-','-Select-',  false, false);
             document.getElementById('ctl00_BodyContentPH_ddlOutPunchTypes').options[0]=newOptSelect;
		     //alert("No Records");
		      alert(NoRecords);
			 return;
		  }
		  else
		  {
			 var xml=objOutPunchTypes.responseXML;
			 var dsRoot=xml.documentElement.getElementsByTagName("OutPunchTypes");  
			 var totalRec = dsRoot.length;
             var newOptSelect = new Option(Select,'-Select-',  false, false);
             document.getElementById('ctl00_BodyContentPH_ddlOutPunchTypes').options[0]=newOptSelect;
             for(i=0; i<totalRec; i++)
             {
                //var Value = xml.getElementsByTagName("Value")[i];
                //var Value = xml.getElementsByTagName('Value')[i].childNodes[0].nodeValue;
                var Value = xml.getElementsByTagName('PunchType_Value')[i].childNodes[0].nodeValue;
                //var PunchType=xml.getElementsByTagName("PunchType")[i];
                var PunchType = xml.getElementsByTagName('PunchType')[i].childNodes[0].nodeValue;
                var newOpt=new Option(PunchType,Value);
                document.getElementById('ctl00_BodyContentPH_ddlOutPunchTypes').options[i+1]=newOpt;
             }
             document.getElementById('ctl00_BodyContentPH_ddlOutPunchTypes').focus();
           }
      }
      else
      {
	    //alert("Error in retriving details");
	    alert(Errorinretrivingdetails);
      }
   }
}
//Manual Time Entry fill In and Out Terminals in Dropdown Based on the Entrance
var objInTerminals;
var objOutTerminals;
function ManualTimeEntryTerminals(SelectEntranceID,NoRecords,Errorinretrivingdetails,Select)
{
	ManualTimeEntry_InTerminals(SelectEntranceID,NoRecords,Errorinretrivingdetails);
	ManualTimeEntry_OutTerminals(SelectEntranceID,NoRecords,Errorinretrivingdetails);
}
function ManualTimeEntry_InTerminals(SelectEntranceID,NoRecords,Errorinretrivingdetails)
{
   if(window.ActiveXObject)
    {    
	    try
	    {
		    objInTerminals = new ActiveXObject("Msxml2.XMLHTTP");
	    }
	    catch(e)
	    {
		    try
		    {
			    objInTerminals = new ActiveXObject("Microsoft.XMLHTTP");
		    }
		    catch(e1)
		    {
			    objInTerminals = null;
		    }
	    }
    }  
     else if(window.XMLHttpRequest)
     {
	    try
	    {
		    objInTerminals = new XMLHttpRequest("Msxml2.XMLHTTP");
	    }
	    catch(e)
	    {
		    try
		    {
			    objInTerminals = new XMLHttpRequest("Microsoft.XMLHTTP");
		    }
		    catch(e1)
		    {
			    objInTerminals = null;
		    }
	    }
    }
//    try
//	{
//		objInTerminals = new XmlHttpRequest();
//	}
//	catch(e)
//	{
//		try
//		{
//			objInTerminals = new ActiveXObject("Microsoft.XMLHTTP");
//		}
//		catch(e1)
//		{
//			objInTerminals = new ActiveXObject("Msxml2.XMLHTTP");
//		}
//	}
	if(objInTerminals != null)
	{
		var EntranceId=document.getElementById('ctl00_BodyContentPH_ddlEntranceName').value
	    if(EntranceId == "-Select-")
	    {
            //Clear Drop down OutTerminals
            if (document.getElementById('ctl00_BodyContentPH_ddlInTerminals').options.length != null)
            {				
	            for (var count = document.getElementById('ctl00_BodyContentPH_ddlInTerminals').options.length-1;count >-1; count--)
	            {
	                document.getElementById('ctl00_BodyContentPH_ddlInTerminals').options[count] = null;
	            }	
            }
            //Clear Drop down OutTerminals
	       if (document.getElementById('ctl00_BodyContentPH_ddlOutTerminals').options.length != null)
            {				
	            for (var count = document.getElementById('ctl00_BodyContentPH_ddlOutTerminals').options.length-1;count >-1; count--)
	            {
	                document.getElementById('ctl00_BodyContentPH_ddlOutTerminals').options[count] = null;
	            }	
            }
            //Fill Select for InTerminals and OutTerminals Drop downs
                var newOptSelect = new Option(Select,'-Select-',  false, false);
                var newOptSelectOut = new Option('Select','-Select-',  false, false);
                document.getElementById('ctl00_BodyContentPH_ddlInTerminals').options[0]=newOptSelect;
                document.getElementById('ctl00_BodyContentPH_ddlOutTerminals').options[0]=newOptSelectOut;
             //Clears In PunchTypes dropdown
	        if (document.getElementById('ctl00_BodyContentPH_ddlInPunchTypes').options.length != null)
            {				
	            for (var count = document.getElementById('ctl00_BodyContentPH_ddlInPunchTypes').options.length-1;count >-1; count--)
	            {
	                document.getElementById('ctl00_BodyContentPH_ddlInPunchTypes').options[count] = null;
	            }	
            }
             //Fill In punchtypes drop down with 'Select'
             var newOptSelectInPunchTypes = new Option('Select','-Select-',  false, false);
              document.getElementById('ctl00_BodyContentPH_ddlInPunchTypes').options[0]=newOptSelectInPunchTypes;
              //Clears Out PunchTypes dropdown
	       if (document.getElementById('ctl00_BodyContentPH_ddlOutPunchTypes').options.length != null)
            {				
	            for (var count = document.getElementById('ctl00_BodyContentPH_ddlOutPunchTypes').options.length-1;count >-1; count--)
	            {
	                document.getElementById('ctl00_BodyContentPH_ddlOutPunchTypes').options[count] = null;
	            }	
            }
             //Fill Out punchtypes drop down with 'Select'
             var newOptSelectOutPunchTypes = new Option(Select,'-Select-',  false, false);
             document.getElementById('ctl00_BodyContentPH_ddlOutPunchTypes').options[0]=newOptSelectOutPunchTypes;
               //alert("Select Entrance ID"); 
                alert(SelectEntranceID); 
	       return false;
	    }
		if(EntranceId != "")
		{
		    if(window.ActiveXObject)
		    {
		        objInTerminals.onreadystatechange =  Process_Response_InTerminals;		
		        objInTerminals.open("GET","AjaxManualTimeEntry.aspx?EntranceId=" + EntranceId + "&TerminalType=I" + "&strType=Terminals" + "&RanId=" + Math.random(),true)
		        objInTerminals.send(null);
		    }
		    else if(window.XMLHttpRequest)
            {
		        objInTerminals.open("GET","AjaxManualTimeEntry.aspx?EntranceId=" + EntranceId + "&TerminalType=I" + "&strType=Terminals" + "&RanId=" + Math.random(),false)
		        objInTerminals.send(null);
		        objInTerminals.onreadystatechange =  Process_Response_InTerminals();		
            }
		} 
	}
	return false;
}
function Process_Response_InTerminals()
{
   if (document.getElementById('ctl00_BodyContentPH_ddlInTerminals').options.length != null)
   {				
	  for (var count = document.getElementById('ctl00_BodyContentPH_ddlInTerminals').options.length-1;count >-1; count--)
	  {
	     document.getElementById('ctl00_BodyContentPH_ddlInTerminals').options[count] = null;
	  }	
   }
   if(objInTerminals.readyState == 4)
   {
	   if(objInTerminals.status == 200)
	   {
		  if(objInTerminals.responseText=="Fail" || objInTerminals.responseText=="")
		  {
			 var newOptSelect = new Option(Select,'-Select-',  false, false);
             document.getElementById('ctl00_BodyContentPH_ddlInTerminals').options[0]=newOptSelect;
		     //alert("No Records");
		      alert(NoRecords);
			 return;
		  }
		  else
		  {
			 var xml=objInTerminals.responseXML;
			 var dsRoot=xml.documentElement.getElementsByTagName("InTerminals");  
			 var totalRec = dsRoot.length;
             var newOptSelect = new Option(Select,'-Select-',  false, false);
             document.getElementById('ctl00_BodyContentPH_ddlInTerminals').options[0]=newOptSelect;
             for(i=0; i<totalRec; i++)
             {
                //var Value = xml.getElementsByTagName("Reader_Id")[i];
                var Value = xml.getElementsByTagName('Reader_Id')[i].childNodes[0].nodeValue;
                //var TerminalName=xml.getElementsByTagName("Terminal_Name")[i];
                var TerminalName = xml.getElementsByTagName('Terminal_Name')[i].childNodes[0].nodeValue;
                var newOpt=new Option(TerminalName,Value);
                document.getElementById('ctl00_BodyContentPH_ddlInTerminals').options[i+1]=newOpt;
             }
             document.getElementById('ctl00_BodyContentPH_ddlInTerminals').focus();
           }
      }
      else
      {
	    //alert("Error in retriving details");
	     alert(Errorinretrivingdetails);
      }
   }
}
function ManualTimeEntry_OutTerminals(SelectEntranceID,NoRecords,Errorinretrivingdetails,Select)
{
    if(window.ActiveXObject)
     {    
	        try
	        {
		        objOutTerminals = new ActiveXObject("Msxml2.XMLHTTP");
	        }
	        catch(e)
	        {
		        try
		        {
			        objOutTerminals = new ActiveXObject("Microsoft.XMLHTTP");
		        }
		        catch(e1)
		        {
			        objOutTerminals = null;
		        }
	        }
        }  
         else if(window.XMLHttpRequest)
         {
	        try
	        {
		        objOutTerminals = new XMLHttpRequest("Msxml2.XMLHTTP");
	        }
	        catch(e)
	        {
		        try
		        {
			        objOutTerminals = new XMLHttpRequest("Microsoft.XMLHTTP");
		        }
		        catch(e1)
		        {
			        objOutTerminals = null;
		        }
	        }
        }
//    try
//	{
//		objOutTerminals = new XmlHttpRequest();
//	}
//	catch(e)
//	{
//		try
//		{
//			objOutTerminals = new ActiveXObject("Microsoft.XMLHTTP");
//		}
//		catch(e1)
//		{
//			objOutTerminals = new ActiveXObject("Msxml2.XMLHTTP");
//		}
//	}
	if(objOutTerminals != null)
	{
		var EntranceId=document.getElementById('ctl00_BodyContentPH_ddlEntranceName').value
	    if(EntranceId == "-Select-")
	    {
	    return false;
	    }
		if(EntranceId != "")
		{
		   if(window.ActiveXObject)
           {
		        objOutTerminals.onreadystatechange = Process_Response_OutTerminals;		
		        objOutTerminals.open("GET","AjaxManualTimeEntry.aspx?EntranceId=" + EntranceId + "&TerminalType=O" + "&strType=Terminals" + "&RanId=" + Math.random(),true)
		        objOutTerminals.send(null);
		   }
		   else if(window.XMLHttpRequest)
           {
		        objOutTerminals.open("GET","AjaxManualTimeEntry.aspx?EntranceId=" + EntranceId + "&TerminalType=O" + "&strType=Terminals" + "&RanId=" + Math.random(),false)
		        objOutTerminals.send(null);
		        objOutTerminals.onreadystatechange = Process_Response_OutTerminals();		
           }
		} 
	}
	return false;
}
function Process_Response_OutTerminals()
{
   if (document.getElementById('ctl00_BodyContentPH_ddlOutTerminals').options.length != null)
   {				
	  for (var count = document.getElementById('ctl00_BodyContentPH_ddlOutTerminals').options.length-1;count >-1; count--)
	  {
	     document.getElementById('ctl00_BodyContentPH_ddlOutTerminals').options[count] = null;
	  }	
   }
   if(objOutTerminals.readyState == 4)
   {
	   if(objOutTerminals.status == 200)
	   {
		  if(objOutTerminals.responseText=="Fail" || objOutTerminals.responseText=="")
		  {
			 var newOptSelect = new Option(Select,'-Select-',  false, false);
             document.getElementById('ctl00_BodyContentPH_ddlOutTerminals').options[0]=newOptSelect;
		     alert(NoRecords);
			 return;
		  }
		  else
		  {
			 var xml=objOutTerminals.responseXML;
			 var dsRoot=xml.documentElement.getElementsByTagName("OutTerminals");  
			 var totalRec = dsRoot.length;
             var newOptSelect = new Option(Select,'-Select-',  false, false);
             document.getElementById('ctl00_BodyContentPH_ddlOutTerminals').options[0]=newOptSelect;
             for(i=0; i<totalRec; i++)
             {
                //var Value = xml.getElementsByTagName("Reader_Id")[i];
                var Value = xml.getElementsByTagName('Reader_Id')[i].childNodes[0].nodeValue;
               // var TerminalName=xml.getElementsByTagName("Terminal_Name")[i];
                var TerminalName = xml.getElementsByTagName('Terminal_Name')[i].childNodes[0].nodeValue;
                var newOpt=new Option(TerminalName,Value);
                document.getElementById('ctl00_BodyContentPH_ddlOutTerminals').options[i+1]=newOpt;
             }
             document.getElementById('ctl00_BodyContentPH_ddlOutTerminals').focus();
           }
      }
      else
      {
	    alert(Errorinretrivingdetails);
      }
   }
}
 function FillInTerminalHidden()
 {
    var InTerminal;
    var InTerminalSelectedIndex = document.aspnetForm.ctl00_BodyContentPH_ddlInTerminals.selectedIndex;
    if(InTerminalSelectedIndex != -1)
    {
        InTerminal = document.aspnetForm.ctl00_BodyContentPH_ddlInTerminals.options[InTerminalSelectedIndex].value;
        document.aspnetForm.ctl00_BodyContentPH_hdn_InTerminal.value = InTerminal;  
    }
 }
  function FillOutTerminalHidden()
  {
    var OutTerminal;
    var OutTerminalSelectedIndex = document.aspnetForm.ctl00_BodyContentPH_ddlOutTerminals.selectedIndex;
    if(OutTerminalSelectedIndex != -1)
    {
        OutTerminal = document.aspnetForm.ctl00_BodyContentPH_ddlOutTerminals.options[OutTerminalSelectedIndex].value;
        document.aspnetForm.ctl00_BodyContentPH_hdn_OutTerminal.value = OutTerminal; 
    }
  }