
nodes = document.getElementsByClassName('menu-1-4-47');
for(i = 0; i < nodes.length; i++)
{
	obj = nodes[i];

	if(obj.tagName.toLowerCase()=='a')
	{
		obj.id = 'client_login';
		break;
	}
}

var script_path = '/client_login_' + i18n_langpath + '.php';

if(obj)
{
	obj.observe('click', function(event) {
		event.stop();
		Lightview.show({
			href: script_path,
			rel: 'ajax',
			title: '',
			options: {
				topclose: false,
				menubar: false,
				autosize: true,
				ajax: {
					onComplete: function() {
						$('client-login-form').observe('submit', ClientLogin.formSubmit);
					},
					evalScripts: true
				}
			}
		});
	});
}

var ClientLogin = {};

ClientLogin.formSubmit = function(event)
{

	event.stop();

	Lightview.show({
		href: script_path,
		rel: 'ajax',
		title: '',

		options: {
			menubar: false,
			topclose: false,
			autosize: true,
			ajax: {
				parameters: Form.serialize('client-login-form'),
				evalScripts: true
			}
		}
	});

}

ClientLogin.formUpdate = function()
{

	Lightview.show({
		href: script_path + '?update',
		rel: 'ajax',
		title: '',

		options: {
			menubar: false,
			topclose: false,
			autosize: true
		}
	});

}

ClientLogin.formHide = function()
{
	Lightview.hide();
}

ClientLogin.formFieldTrack = function(obj,value,bFocus)
{
	if(bFocus)
	{
		if(obj.value==value)
		{
			obj.value = '';
			obj.style.color = '#000';
		}
	}
	else
	{
		if(obj.value=='')
		{
			obj.value = value;
			obj.style.color = '#aaa';
		}
	}
}

ClientLogin.out = function()
{
	Lightview.show({
		href: '/client_logout.php',
		rel: '',
		title: '',

		options: {
			menubar: false,
			topclose: false,
			autosize: true
		}
	});
}
