﻿ACCLinkButton = function(clientID, strAnchor)
{
	this.clientID = clientID;
	this.strAnchor = strAnchor;
	this.name = null;
	this.text = null;
	this.a = null;

	var me = this;

	this.OnClick = function()
	{
		var input = NewTag('input');
		input.type='hidden';
		input.name = me.name;
		input.value = me.value;
		AddTag(input, me.a.parentNode, me.a);
		var form = document.getElementsByTagName('form')[0];
		if(me.strAnchor != null && me.strAnchor.length > 0)
			form.action += "#" + me.strAnchor;
		form.submit();
	}

	this.Init = function()
	{
		var button = GetBlock(clientID);
		me.text = button.value;
		me.name = button.name;
		a = NewTag('a', button.parentNode, button);
		a.href="javascript:void(0)";
		a.className = button.className;
		NewTextTag(me.text, a);
		AddEvent(a, "click", me.OnClick);
		me.a = a;
		button.parentNode.removeChild(button);
	}

	me.Init();
}