﻿// JScript File
function ShowHelp(helptext,id) 
	{
        if(document.getElementById(id).innerHTML=='?')
		{
			document.getElementById(id).innerHTML=helptext;
		}
		else
		{
			document.getElementById(id).innerHTML='?';
		}
	}
	
		function ShowHelpOnce(helptext,id) 
	{
        
		if(document.getElementById(id).innerHTML!=helptext)
		{
			document.getElementById(id).innerHTML="<table border=1 bordercolor=navy cellpadding=3 cellspacing=0><tr><td bgcolor='#CBD6DC'>" + helptext + "</td></tr></table>";
		}

	}
	
   var submitcount=0;
   function checkSubmit() {

      if (submitcount == 0)
      {
      submitcount++;
      document.Surv.submit();
      }
   }
   	
	function textCounter(field, counterid, maxlimit) 
	{
		if ((field.name == "txtDescription") && (field.value.length < this.document.all("txtHeading").value.length))
		{document.getElementById(counterid).innerHTML= 'Characters Required : ' + (String)(this.document.all("txtHeading").value.length - field.value.length);}
		else
		{
			if (field.value.length > maxlimit)
			{field.value = field.value.substring(0, maxlimit);}
			else
			{document.getElementById(counterid).innerHTML= 'Characters Remaining : ' + (String)(maxlimit - field.value.length);}      
			
		}			
	}	
	
 /* this function shows the pop-up when
     user moves the mouse over the link */
    function Show(helptext)
    {
        /* get the mouse left position */
        //x = event.clientX + document.body.scrollLeft;
        
        x = window.event.x+document.body.scrollLeft;
        //x = event.clientX + document.body.scrollLeft;
        /* get the mouse top position  */
        //y = event.clientY + document.body.scrollTop + 35;
        //y = event.clientY + document.body.scrollTop;
        y = window.event.y+document.body.scrollTop + 35;
        Popup.style.display="block";        
        /* set the pop-up's left */
        
        Popup.style.left = x;
        /* set the pop-up's top */
        Popup.style.top = y;
        /* display the pop-up */        
        Popup.innerHTML = helptext;
        
        
    }
    /* this function hides the pop-up when
     user moves the mouse out of the link */
    function Hide()
    {
        /* hide the pop-up */
        Popup.style.display="none";
    }
function CheckNumericKeyInfo($char, $mozChar, ctrl) 
{

if($mozChar != null) 
{ // Look for a Mozilla-compatible browser
if($mozChar == 13 || $char == 13)
    {
        document.getElementById(ctrl).click();
        return false;    
    }
else
    return true;
}
else 
{ // Must be an IE-compatible Browser
if($char == 13) 
    {
    document.getElementById(ctrl).click();
    return false;
    }
else 
    {
    return true;
    }
}
}
