<!--

/*******************************************************************************************/
/* All functions must be prefixed with he_ to avoid duplication with other scripts         */
/*******************************************************************************************/

var idFocus = null;	

/**********************************************************************/
/* Stop Users from clicking "Process" button more than once           */
/* Used by membership pages, but can be used by other controls        */
/**********************************************************************/
function he_OnBeforeMemSubmit(btnSubmitId,btnProcessingId)
{   
     var _page_IsValid = true;
    if (typeof Page_IsValid == 'undefined')
    {
	
	}
	else
	{
		if (Page_IsValid != null)
		{
			_page_IsValid = Page_IsValid	
		}
	}
	
   
    if (_page_IsValid==true)
    {
       try{
		btnSubmit = document.getElementById(btnSubmitId);
		btnProcessing = document.getElementById(btnProcessingId);
		var width = btnSubmit.offsetWidth;
		btnProcessing.style.width = width;
		btnSubmit.style.display = "none";
		btnProcessing.style.display = "";
		}catch(e){}
		return true;
	}
	else
		return false;
}


/**********************************************************************/
/* Stop Users from clicking "Process" button more than once           */
/* Used by any Buy Template pages, but can be used by other controls  */
/**********************************************************************/
function he_OnBeforeSubmit()
{
	//Page_IsValid is Microsoft's var set in WebUIValidation.ValidationSummaryOnSubmit()
	var _page_IsValid = true;
    
    if (typeof Page_IsValid == 'undefined')
    {
	
	}
	else
	{
		if (Page_IsValid != null)
		{
			_page_IsValid = Page_IsValid	
		}
	}
    
    if (_page_IsValid==true)
    {
        //get button that is to be disabled and the replacing processing button
        try{var btnSubmit = document.getElementById(document.getElementById("he_lastClicked").value);
			var btnProcessing = document.getElementById(btnSubmit.id + "_Processing");
        }catch(e){}
  
        if (btnSubmit&&btnProcessing)
        {
		
			
			try{
				btnSubmit.style.width=0;
				btnProcessing.style.display = "";
			}catch(e){}
		}
		return true;
	}
	else
	{
		return false;
	}
}


function he_Body_OnClick()
{
    var clickedId = "";
    try{
   		var theEvent=window.event || arguments.callee.caller.arguments[0];
		if (!document.all)
			clickedId = theEvent.target.id;
		else
    		clickedId = theEvent.srcElement.id;
		document.getElementById("he_lastClicked").value = clickedId;
	}
	catch(e){}
}

function he_ValidateLen(obj,args)
{  
  try{
	    if (obj.MaxLength<0) return true;
		args.IsValid = (args.Value.length<obj.MaxLength);
	}catch(e){return true};
}

function he_ValidateCertName(obj, args)
{
	

	try
	{
		var cbIsGift = document.getElementById(cbIsGiftClientId);
		
		if (cbIsGift != null && cbIsGift.checked)
		{
			args.IsValid = (args.Value.length > 0);
		}
		else
		{
			args.IsValid = true;
		}
		
	}
	catch(e)
	{
		return true;
		
		
	}
			

						

}

function he_TestIfOther(e)
{
	
	var index = e.selectedIndex;
	var display = false;
	
	try
	{
		if(e.options[index].value == "other")
		{
			display = true;					
		}
		
		var otherName = e.name + "_other";			
		var otherControl;		
		
		
		
		if (document.getElementById)
		{
			otherControl = document.getElementById(otherName);
		}
		else if (document.all)
		{
			otherControl = document.all[otherName];
			
		}
		
		if(otherControl == null)
		{
			var anotherName = otherName.substring(3, otherName.length);
			
			if (document.getElementById)
			{
				otherControl = document.getElementById(anotherName);
			}
			else if (document.all)
			{
				otherControl = document.all[anotherName];
				
			}
			
		}
		
		
		if(otherControl != null)
		{
				if(display)
				{
					otherControl.style.display = "";
				}
				else
				{
					otherControl.style.display = "none";
				}
		}
			
		
		
	}
	catch(e)
	{
		
	};
	
	
}

/****set focus ***/

function Page_load()
{
	//alert("page load");
	try{
			if (idFocus!=null)
			{				
				document.getElementById(idFocus).focus();	
			}
			
		}
	catch(e){}	
}

//-->

