window.addEvent('domready', function () {

	new Asset.images([
			  '/static/css/top2.png',
			  '/static/css/lighter.png',
			  '/static/css/webface2.png',
			  '/static/css/21.png',
			  '/static/css/22.png',
			  '/static/css/23.png',
			  '/static/css/24.png',
			  '/static/css/bg2.png'
			  ]);
	$('container').setStyle('visibility','hidden');
 	new Tips('a');

	var Scroll = new Fx.Scroll('layer2', {
		link: 'chain',
 		duration: 700,
		wait: false
	    });
	var globalUrl = "";
	Scroll.addEvent('chainComplete', function(e) {
 		window.location.href = location.href.split('#')[0] + '#' + globalUrl;
	    });
	$$('div.navigation ul li a, p.top a').each(function(link) {
		link.addEvent('click', function (e) {
			var ev = new Event(e).stop();
			var url = link.get('href').split('#')[1];
			globalUrl = url;
			Scroll.toElement($(url));
		    });
	    });


	new FormCheck('form',{
		submitByAjax: true,
		display : {
		    checkValueIfEmpty: 1,
			showErrors: 1,
			errorsLocation : 1,
			indicateErrors : 2,
			scrollToFirst: false
			},
		onAjaxRequest : function () {
		    $$('input.submit').set('value', 'Sending...');
		},
		    onAjaxSuccess : function (result) {
		    $$('input.submit').set('value', 'Sent');
		},
		    onAjaxFailure : function () {
		    $$('input.submit').set('value', 'Send again');
		}
	});

    });