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


	var myNav = new mooNav('main_nav'); 
	
	$$('.calendar td:not([class*=disabled]):not([class*=current])').each(function(el, i) {
		el.addEvents({
			click: function() {
				el.getElement('a').fireEvent('click');
			},
			mouseenter: function() {
				el.addClass('over');
			},
			mouseleave: function() {
				el.removeClass('over');
			}
		});
	});
	if($('contact-us-side-bar')) {
			var updatediv = $('contact-form-wrapper');
			var wrapper = $('contact-form-wrapper');
			var name = $('name');
			var company = $('company');
			var email = $('email');
			var phone = $('phone');
			var question = $('question');
			var addl_require = $('addl_require');
			var contactHTMLRequest = new Request.HTML({
					url:'/includes/headers/contact-us.php',
					onSuccess:function(t,e,h,j) {
						if(h.contains('Please')) {
							alert(h);
						}
						else {
							updatediv.set('text',h);
						}
					}
			});
			$('submit_contact').addEvent('click',function(e) {
				e.stop();
				contactHTMLRequest.post({
						'submit_contact':'yes',
						'name':name.get('value'),
						'company':company.get('value'),
						'email':email.get('value'),
						'phone':phone.get('value'),
						'question':question.get('value'),
						'addl_require':addl_require.get('value')
				});
			});
		
	}
	
	if((load_video = $$('a.load_video')).length) {
		load_video.addEvents({
			click: function(e) {
			var videoId = this.get('id');
			//make an ajax call to get a description of this part note
			e.stop();//prevent the page from changing
			//make the ajax call, replace text
			dispVideo(videoId, true);
			}
		});
	}


	
});

	function dispVideo(videoId, autoplay) {
			//make the ajax call, replace text
			var req = new Request.HTML({
				method: 'get',
				url: '/includes/ajax/ajaxResponse.php',
				data: { 'call' : 'loadVideo',
					'id' : videoId,
					'autoplay' : autoplay},
				update: $('video-content')
			}).send();
	};
	
	function toggle(el) {
		myEl = document.getElementById(el);
		myEl.style.display = (myEl.style.display == 'block') ? 'none' : 'block';
	}


