var Site = {
	
	start: function(){
		
		if ($('kwick')) Site.parseKwicks();
		//if ($('contact_form')) Site.checkForm();
		
	},
	
	parseKwicks: function(){
		var kwicks = $$('a.kwick');
		var fx = new Fx.Elements(kwicks, {wait: false, duration: 200, transition: Fx.Transitions.quadOut});
		kwicks.each(function(kwick, i){
			kwick.addEvent('mouseenter', function(e){
				var obj = {};
				obj[i] = {
					'width': [kwick.getStyle('width').toInt(), 185]
				};
				kwicks.each(function(other, j){
					if (other != kwick){
						var w = other.getStyle('width').toInt();
						if (w != 105) obj[j] = {'width': [w, 105]};
					}
				});
				fx.start(obj);
			});
		});
		
		$('kwick').addEvent('mouseleave', function(e){
			var obj = {};
				kwicks.each(function(other, j){
					if (other.hasClass('on')) {
						obj[j] = {'width': [other.getStyle('width').toInt(), 185]};
					} else {
						obj[j] = {'width': [other.getStyle('width').toInt(), 105]};
					}
				});
				fx.start(obj);
		});
	},
	
	checkForm: function() {
		var f = $('contact_form');
		f.addEvent('onsubmit', function() {
			if ($('name').value=="" || $('phone-email').value=="") {
				alert("'Name' and 'Email' are required fields. Please fill them in before submitting.");
				return false;
			} else if ($('message').value=="") {
				alert("Your message is empty! Please say something...");
				return false;
			} else {
				return true;
			}
		});		
	}
	
};

window.addEvent('load', Site.start);