function input_focus(input_value, el) { if(el.value==input_value) el.value=''; el.addClass('focus')}
function input_blur(input_value, el) { if(el.value=='') el.value=input_value; el.removeClass('focus'); }
function rand(limit) { return Math.floor(Math.random()*(limit)); }
function submitForm() {
	ask_user = confirm("No attorney-client relationship with Gleason, Dunn, Walsh & O'Shea will be established by sending email to us.  Receipt of correspondence or information does not create a lawyer-client relationship between you and Gleason, Dunn, Walsh or O'Shea, or any of its individual attorneys, and any such information received will not be deemed confidential or privileged.  Do not send us personal information or information relating to a case, transaction, or potential representation, until you speak with one of our lawyers and get authorization to send that information to us.");
	if (ask_user == true) {
		return true;
	} else {
		return false;
	}
}
window.addEvent('domready', function() {
	$$('ul#menu li').addEvents({
		'mouseenter': function(e) {
			e.stop();
			this.addClass('mhover');
		},
		'mouseleave': function(e) {
			this.removeClass('mhover');
		}
	});
	$$('ul#menu ul').addEvents({
		'mouseleave': function(e) {
			this.getParent('li').removeClass('mhover');
		}
	});
	
	var myFx = new Fx({
		link: 'ignore', 
		duration: 3000,
		onStart: function() {
			var img1 = new Element('img', {'src': '/imgs/swap_imgs/'+files[rand(files.length)]});
			while($$('#swap_image1 img')[0].getProperty('src') == img1.getProperty('src') || 
					 ($$('#swap_image2 img')[0].getProperty('src') == img1.getProperty('src'))) {
				var img1 = new Element('img', {'src': '/imgs/swap_imgs/'+files[rand(files.length)]});
			}
			
			var img2 = new Element('img', {'src': '/imgs/swap_imgs/'+files[rand(files.length)]});
			while(($$('#swap_image1 img')[0].getProperty('src') == img2.getProperty('src')) || 
						($$('#swap_image2 img')[0].getProperty('src') == img2.getProperty('src')) || 
						(img1.getProperty('src') == img2.getProperty('src'))) {
				var img2 = new Element('img', {'src': '/imgs/swap_imgs/'+files[rand(files.length)]});
			}
			var duration = rand(2000) + 1000;
			if(!rand(2)) {
				img1.inject($('swap_image1'), 'top');
				$$('#swap_image1 img')[1].set('tween', {duration:duration,transition:'linear',onComplete: function(el) { el.destroy(); }});
				$$('#swap_image1 img')[1].tween('opacity',1, 0);
				img1.set('tween', {duration: duration,transition:'linear'});
				img1.tween('opacity', 0, 1);
			} else {
				img2.inject($('swap_image2'), 'top');
				$$('#swap_image2 img')[1].set('tween', {duration:duration,transition:'linear',onComplete: function(el) { el.destroy(); }});
				$$('#swap_image2 img')[1].tween('opacity',1, 0);
				img2.set('tween', {duration: duration,transition:'linear'});
				img2.tween('opacity', 0, 1);
			}
		},
		onComplete: function () {
			this.start();
		}
	});
	myFx.start();
	//$('text').set('html', 'src1: ' + img1.getProperty('src') + ' <br>src2: ' + img2.getProperty('src'));
});
