/*//mainSite//*/
$(document).ready(function(){

	$(".usefulTerms").accordion({
			header: 'dt',
			active: false,
			collapsible: true,
			autoHeight: false
	});	

	$("#sidebarNav").accordion({
			header: 'h4',
			active: false,
			collapsible: true,
			autoHeight: false,
			animated: 'easeslide'
	});

	$(".xx").accordion({
			event:'mouseover',
			active: 2,
			autoHeight: false
			});
	
/* slides
----------------------------------------------- */
	$('#faded').cycle({fx:'fade',timeout: 4000});
    $('#fadeq').cycle({fx:'fade',timeout: 4000});
	$('#fadeqb').cycle({fx:'fade',timeout: 6000});
	$('#fadeqc').cycle({fx:'fade',timeout: 5000});		
	$('#fadeh').cycle({fx:'fade', next:'#next', prev:'#prev' });
	$('#fadex').cycle({fx:'scrollDown',timeout: 6000});
/* governor-tooltips
----------------------------------------------- */
$('#portrets *').tooltip({ 
    track: true, 
    delay: 0, 
    showURL: false, 
    opacity: 0, 
    //fixPNG: true, 
    //showBody: " - ", 
    extraClass: "portret", 
    top: -15, 
    left: 5 
});
/* localScroll
--------------------------------------------------------------*/
$('#catSubjectBox').localScroll({
   target:'#SubjectScroll',
   axis:'xy',
   queue:'true',
   duration:1000,
   navigation: '.navigation a',
   onAfter: trigger
});

$('#opeNightBox').localScroll({
   target:'#opeNightScroll',
   axis:'xy',
   duration:1000,
   navigation: '.navigation a'
});

/* AK handle nav selection
--------------------------------------------------------------*/
function selectNav() {
  $(this)
    .parents('ul:first')
      .find('a')
        .removeClass('selected')
      .end()
    .end()
    .addClass('selected');
}

$('#catSubjectBox .SubjectNav').find('a').click(selectNav);
// go find the navigation link that has this target and select the nav
function trigger(data) {
  var el = $('#catSubjectBox .SubjectNav').find('a[href$="' + data.id + '"]').get(0);
  selectNav.call(el);
}
if (window.location.hash) {
  trigger({ id : window.location.hash.substr(1) });
} else {
  $('ul.SubjectNav a:first').click();
}

/* AK open new window
--------------------------------------------------------------*/
$('a.new-window').click(function(){
        window.open(this.href);
        return false;
		});
});
/* 
AK hover for ie6
--------------------------------------------------------------*/
/*sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
*/