function ChangeEmailText(obj)
{
	obj.style.color = "#666666";

	if (obj.value == "E-mail")
	{
		obj.style.color = "#666666";
		obj.value = "";
	}
	
	else if (obj.value.length < 1)
	{
		obj.style.color = "#999999";
		obj.value = "E-mail";
	}
}

function PreventDefault(event)
{
	event.returnValue = false;

	if (event.preventDefault)
	{
		event.preventDefault();
	}
}

function FormSubmit(form)
{
	document.getElementById(form).submit();
}

/*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*/

/*Update Label file field*/
function updateFileField(oFileField, index)
{
	document.getElementById('file[' + index + ']').value = oFileField.value;
}

function isValidKey(event)
{
	var simbol = String.fromCharCode((window.event ? event.keyCode : event.charCode)).toUpperCase();
	if (!event.ctrlKey && !event.altKey && (window.ActiveXObject || event.keyCode == 0) && isNaN(simbol))
	{
		return false;
	}
	else if (simbol == 'V') return false;
}

