window.onload = function() {   
	if($j("#slideshow").length > 0) {
		//$j("#slideshow").html("");
		//$j("#slideshow").html('<div id="buttonWrap"><div class="buttons"><a href="">Inspection</a>&nbsp;&nbsp;/&nbsp;&nbsp;<a href="">Testing</a></div></div><div class="slides"><img src="_assets/images/slide1.jpg" border="0" /><img src="_assets/images/slide2a.jpg" border="0" /><img src="_assets/images/slide2b.jpg" border="0" /><img src="_assets/images/slide3.jpg" border="0" /><img src="_assets/images/slide4a.jpg" border="0" /><img src="_assets/images/slide4b.jpg" border="0" /><img src="_assets/images/slide5a.jpg" border="0" /><img src="_assets/images/slide5b.jpg" border="0" /><img src="_assets/images/slide6.jpg" border="0" /><img src="_assets/images/slide-ins.jpg" border="0" /><img src="_assets/images/slide-test.jpg" border="0" /></div>');
		
		//var so = new SWFObject("_assets/flash/preloader.swf", "slideshow", "970", "334", "9.0.0", "");
		//so.addVariable("variable", "slideshow");
		//so.addParam("wmode", "opaque");
		//so.write("slideshow");
		
		if (navigator.mimeTypes ["application/x-shockwave-flash"] == undefined) {
			$j("#slideshow .slides").cycle({
				'cleartype':true,
				'cleartypeNoBg':true
			});
		}
	}
};
$j(document).ready(function() {
	
	$j(".accordion").accordion({
		autoHeight: false,
		collapsible: true,
		active: false
	});
		
	/*
	$j("x.accordion-expanded").accordion({
		autoHeight: false,
		collapsible: false
		//active: false
	});
	*/	
	
	//$j(".tabbox").tabs();
	
	
	//if ($j('.slides').length > 0) {
	//	$j('.slides').cycle({
	//		'cleartype':true,
	//		'cleartypeNoBg':true
	//	});
	//}
	
	// $j("#topnav, #navbar>#nav, h2, .heading, .learn, #locations, .buttons, .sub-nav, h3, ._title, .date, .title").addClass("fontReplace");
	$j(".carousel").simplyScroll({
		className: 'vert',
		horizontal: false,
		frameRate: 15,
		speed: 1,
		autoMode: 'loop'
	});	
	
	$j(".tabbed").tabs();
    
	if($j("#p_login").length > 0) {
		$j(".row a").text("» Login");
	}
	//$j("._advlist").find("a").text().replace(/View Website/g,"Login");
	
	$j(".sub-nav li").last().addClass("last");
	
	if($j("#subCategories .techSub").length > 0) {
		$j("#subCategories .techSub").appendTo($j("._nav_technical-expertise"));
	}
	if($j("#subCategories .secSub").length > 0) {
		$j("#subCategories .secSub").appendTo($j("._nav_sectors"));
	}
	
	$j("._2-column #main, #pageHeader").corner("5px");
	$j("#pageHeader img").addClass('corner iradius5');
	$j(".listing .entry").each(function(i){
		if(i == 0) {
			$j(this).addClass("first");
		}
	});
	
	$j.each(['p_about', 'p_careers','p_contact','p_sitemap','p_login'], function(index, value) { 
  		if($j("body").hasClass(value) == true) {
			$j("#topnav ."+value).addClass("active");
		}
	});
	
	if ($j.browser.mozilla) {
		$j("#searchbar input._submit").css("top","2px");
	}

	// # IE Helpers
	$j('#nav>li:last-child').addClass('_last-child');
	$j('._featurebox:last-child').addClass('_last-child'); 
	$j('fieldset:last-child').addClass('_last-child'); 
	$j('p:last-child').addClass('_last-child'); 
	$j('#content table td:last-child, #content table th:last-child').addClass('_last-child'); 

	$j('a.submit').unbind();
	$j('a.submit').click(function(e){
		e.preventDefault();
		var href = $j(this).attr('href');
		var form = $j(this).parents('form');
		if (href != '' && href != '#') {
			form.attr('action',href);
		}
		form.submit();		
	});	
	
	//$j('#_site-functions a.font-larger').appendTo('span.extras');
	//$j('span.extras').append(' | ');
	//$j('#_site-functions a.font-smaller').appendTo('span.extras');
	$j('#_site-functions').appendTo('span.extras');	
	$j('.alert-button a').click(function(e){
		e.preventDefault();
		$j('.alert-msg').fadeOut();
	});
	
});

