Event.observe(window, 'load', function() {
	// do some CSS magic for no javascript version
	Element.addClassName('main', 'hasjs');


	//-------- SWAPPER ----------
	
	// some DOM stuff
	var triggers = $$('#main .swapnav');
	var contents = $$('#main .swapcontent');

	// all the important stuff
	if (triggers.length>0 && contents.length>0) {
		
		var swapper = new FadeSwap(triggers, contents, 'click');

		// fix the local nav
		var localnav = $$('#main #localnav ul li a');
		if (localnav.length>0) {
			for (var i=0; i<localnav.length; i++) {
				var section = document.location.toString().match(/(.*)#/);
				section = (section) ? section[1] : document.location.toString();
				if (localnav[i].href.match(section)) localnav[i].href += '#overview';
			}
		}

		// fix the anchor links for Safari
		// and make anchor links fade and swap instead of browser default
		var anchors = new AnchorFix(triggers, contents, swapper);
		
		// find the default
		var id = 0;
		if (document.location.hash) {
			var initial = document.location.hash;
			initial = initial.match(/#(.*)/)[1];
			var doesContentExist = anchors.doesContentExist(initial)
			if (doesContentExist) {
				id = doesContentExist.index;
			}
		}

		// swap to the default
		swapper.swapContent(null, id);
	}
	
	//-------- SOLUTIONS PROFILES ----------
	if($('profiles')) new ShowProfiles($('profiles'));


	
	//-------- PROFILES IMAGE/MOVIE POPUPS ----------
	
	// image gallery overlay
    var images = $$('#main .sidebar .box.gallery li a.overlaythumb');
    imageGallery = (images.length>0) ? new AC.ImageOverlay(images) : false;

	// movie overlay
	var movieOverlayNav = $$('#main .box .videogallery .watchvideo');
	var movieOverlay = (movieOverlayNav.length>0) ? new AC.MovieOverlay(movieOverlayNav, {movieheight:360}) : false;

}, false); 




