function changeDefaultValue(sender, default_value, change_value)
{
	sender.className = "";
	if (sender.value == default_value)
	{
		sender.value = change_value;
	}
}

function addEvent(obj, handler, callback, capture)
{
	if (obj.addEventListener)
	{
		obj.addEventListener(handler, callback, capture);
	}
	else if (obj.attachEvent)
	{
		obj.attachEvent('on' + handler, callback);
	}
}

/*Radio Button and checkbox beta version*/
	function Checkbox(name, value, checked, id)
	{
		this.button = null;
		this.checked = checked;
		this.initializedComponent();
		this.button.className = 'hidden_component';
		this.button.name = name;
		this.button.value = value;
		this.button.id = id;
		this.button.defaultChecked = checked;
		this.custom_button = document.createElement('label');
		this.custom_button.par_button = this.button;
		this.custom_button.className = 'checkbox' + (this.checked ? ' ch_checked' : '');
		this.custom_button.onclick = function(){this.par_button.click();};
		
		this.button.custom_button = this.custom_button;
		this.changeCheckedListener();
	}
	
	Checkbox.prototype.changeCheckedListener = function()
	{
		this.button.onclick = function()
		{
			this.custom_button.className = 'checkbox' + (this.checked ? ' ch_checked' : '');
		}
	}
	
	Checkbox.prototype.writeComponent = function(id_element)
	{
		var obj = document.getElementById(id_element);
		obj.appendChild(this.button);
		obj.appendChild(this.custom_button);
	}
	
	Checkbox.prototype.initializedComponent = function()
	{
		this.button = document.createElement('input');
		this.button.type = 'checkbox';
	}
	
	var radio_button_reference = [];
	function changeRadioButtonChecked(sender)
	{
		if (radio_button_reference[sender.name]) 
		{
			radio_button_reference[sender.name].custom_button.className = 'radio';
			radio_button_reference[sender.name].checked = false;
			radio_button_reference[sender.name].defaultChecked = false;
		}
		
		sender.checked = sender.defaultChecked = true;
		sender.custom_button.className = 'radio r_checked';
		radio_button_reference[sender.name] = sender;
	}
	
	RadioButton.prototype = new Checkbox;
	RadioButton.constructor = RadioButton;
	
	function RadioButton(name, value, checked, id)
	{
		Checkbox.call(this, name, value, checked, id);
		this.custom_button.className = 'radio';
		if (this.checked)
		{
			changeRadioButtonChecked(this.button);
		}
	}
	
	RadioButton.prototype.changeCheckedListener = function()
	{
		this.button.onclick = function()
		{
			changeRadioButtonChecked(this);
		}
	}
	
	RadioButton.prototype.initializedComponent = function()
	{
		this.button = document.createElement((!window.ActiveXObject ? 'input' : '<input type="radio">'));
		this.button.type = 'radio';
	}
/*end radio button and checkbox*/
function viewBigImage(sender)
{
	return false;
}

function sendForm(form_name)
{
	var oForm = null;
	if (oForm = document.forms[form_name])
	{
		oForm.submit();
	}
	return false;
}

function selectDeselectAllCheckbox()
{
	var oCheckbox = document.getElementById('select_deselect');
	var oInput = oCheckbox.form.getElementsByTagName('input');
	for (var i = 0, len = oInput.length; i < len; i++)
	{
		if (oInput[i].type == 'checkbox' && oInput[i].checked != oCheckbox.checked)
		{
			oInput[i].checked = oCheckbox.checked;
			oInput[i].custom_button.className = 'checkbox' + (oCheckbox.checked ? ' ch_checked' : '');
		}
	}
}

function updateLabelValue(sender, target_id)
{
	document.getElementById(target_id).innerHTML = sender.value;
}
