$j(document).ready(function() {
	
	$j(".accordionCollapsible").accordion({
		autoHeight: false,
		collapsible: true,
		active: false
	});
	
	$j(".accordion").accordion({
		autoHeight: false
		//collapsible: true,
		//active: false
	});
	
	if ($j('#slideshow .slides').length > 0) {
		$j('#slideshow .slides').cycle({
			'prev':'#slideshow .prev',
			'next':'#slideshow .next',
			'cleartype':true,
			'cleartypeNoBg':true
		});
		$j('#slideshow .pause').click(function(e){
			e.preventDefault();
			$j('#slideshow .slides').cycle('pause');
		});
		$j('#slideshow .play').click(function(e){
			e.preventDefault();
			$j('#slideshow .slides').cycle('resume');
		});
		
	}
	/*
	if ($j('.paging').length > 0) {
		$j('.paging').cycle({
			'prev':'.prev-page',
			'next':'.next-page',
			timeout: 0,
			'pager':'.pages',
			onPagerEvent: function() {
				Cufon.refresh();
			},
			onPrevNextEvent: function() {
				Cufon.refresh();
			},
			'cleartype':true,
			'cleartypeNoBg':true
		});	
	}
	*/
	$j(".tabbox").tabs();
	
	$j('a[rel^="videobox"]').prettyPhoto();
	
	$j('a[rel*="lightbox"]').prettyPhoto();
	//$j("h2, h3").addClass("rockwell");
	
	$j(".baseform.survey table").each(function(){
		$j(this).find("tr").each(function(i){
			
			if($j(this).hasClass("label") == false) {
				if(i % 2 == 0) {
					$j(this).addClass("odd");
				}
			}
			$j(this).children("td").first().addClass("first");
		});
	});
	
	$j(".survey form").validationEngine();
	
	// # 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();		
	});	
		
});

if ($j.browser.msie && ($j.browser.version == "6.0")) {
}
else {
	//Cufon.replace('#nav.cms', { fontFamily: 'Rockwell', hover: true });
	//Cufon.replace('#topnav', { fontFamily: 'Rockwell', hover: true });
	//Cufon.replace('a.readmore', { fontFamily: 'Rockwell', hover: true });
	//Cufon.replace('._featurebox ._title', { fontFamily: 'Rockwell', hover: true });
	//Cufon.replace('.rockwell', { fontFamily: 'Rockwell', hover: true });
	//Cufon.replace('#keypoints h3', { fontFamily: 'Rockwell', hover: true });
	//Cufon.replace('#title h2', { fontFamily: 'Rockwell', hover: true });
}
