window.addEvent('domready',function() {
		new SmoothScroll({duration: 1000});
		// ajax for service pages
			$$('.commercial').each(function(item,index) {
					item.addEvent('click', function(e) {
							var url = item.getProperty('id');
							e = new Event(e).stop();
							new Ajax(url, {
							method: 'get',
							update: $('commercial-content')
						}).request();
				  });
		  });
		// Slides for gallery pages	
		 $$('.swap-thumbs').each(function(item, index) {
				  var fx = new Fx.Styles($('project-pic'), { duration: 500, wait: false} );
				  item.addEvent('click',function() {
						 fx.start({
						  'opacity': 0
						  }).chain(function() {
							var id = item.getProperty('id');
							$('project-pic').setProperty('src', '/graphics/photo-gallery/large/' + id);
								fx.start.delay(300, this, {
									'opacity':1	
								});
						  });
						 
				  });
		  });
		 //mouseovers for gallery pages
		 $$('.thumb-box').each(function(el) {
				el.addEvent('mouseover',function(e) {
					el.setStyle('background-color', '#c9c9c9');
					el.setStyle('border-color', '#00395');
					el.setStyle('cursor', 'pointer');
				});
				el.addEvent('mouseleave',function(e) {
					el.setStyle('background-color', '#fff');
					el.setStyle('border-color', '#6d8eb7');
					el.setStyle('cursor', 'default');
				});
				el.addEvent('click',function(e) {  });
			});
		 
  });

/*  DO MOUSEOVERS  */
function mo(over_out,image)
{
	var src = image.src, ext = src.substring(src.lastIndexOf('.'),src.length);
	image.src = (over_out ? src.replace(ext,'-mo' + ext) : src.replace('-mo' + ext,ext)); return;
}

/*  GET AN ELEMENT 
if(typeof $ != 'function') { function $(element) { return document.getElementById(element); } }

 */
