$(document).ready(function(){
  $('html').addClass('j');
  jQuery('.facetPanel dl').accordion({
    autoheight: false,
	event: 'click',
	active: '.s01',
	selectedClass: 'active',
	animated: "slide",
	header: "dt"
  });
  /*
  $('.facetPanel dl dd,.facetPanel ul ul').hide();
  $('.facetPanel dl dt').click(function() {
  $(this).next('dd').toggle(400);return false;  
  */
  
        $("#mainContent .resourceList .t02 ul.t01 li.s01:has(li.s01)").prepend('<a href="#" title="Click to expand / contract extended metadata" class="x01">Expand</a>')
        $("#mainContent .resourceList .t02 ul.t01 li.s01 a.x01").click(function(){
                var $this = $(this);
                if( $this.parent('li').is('.s01') ) {
                        //$this.parent('li').children('ul').slideUp("slow");
						$this.text('collapse');
                        $this.parent('li').removeClass('s01');
                        $this.parent('li').addClass('s02');
                }
                else {
					    $this.text('expand');
                        //$this.parent('li').children('ul').slideDown("slow");
                        $this.parent('li').removeClass('s02');
                        $this.parent('li').addClass('s01');
                }
                return false;
        });  
		/*
	 	$(".form .t02 li.s02 .form").hide();
        $(".form .t02 .f05 a.s01").click(function(){
                var $this = $(this);
                if( $this.is('.z01') ) {
                        $this.parent().parent('li').next('li').children('div.form').slideUp("fast");
						$this.removeClass('z01');
						$this.addClass('z02');
                }
				else {
                        $this.parent().parent('li').next('li').children('div.form div.t04').slideDown("fast");
						$this.removeClass('z02');
						$this.addClass('z01');					
				}
                return false;
        });  		
		*/
		
        $(".unorderedList .t05 ul li ul").hide();
        $(".unorderedList .t05 ul li a").click(function(){
                var $this = $(this);
                if( $this.parent('li').is('.s02') ) {
                        $this.parent('li').children('ul').slideUp("slow");
                        $this.parent('li').removeClass('s02');
                        $this.parent('li').addClass('s01');
                }
                else {
                        $this.parent('li').children('ul').slideDown("slow");
                        $this.parent('li').removeClass('s01');
                        $this.parent('li').addClass('s02');
                }
                return false;
        });  		
		
		
		
		
});  
  
  
var profiles =
{
//height:600, // sets the height in pixels of the window.
//width:600, // sets the width in pixels of the window.
//toolbar:0, // determines whether a toolbar (includes the forward and back buttons) is displayed {1 (YES) or 0 (NO)}.
//scrollbars:0, // determines whether scrollbars appear on the window {1 (YES) or 0 (NO)}.
//status:0, // whether a status line appears at the bottom of the window {1 (YES) or 0 (NO)}.
//resizable:1, // whether the window can be resized {1 (YES) or 0 (NO)}. Can also be overloaded using resizable.
//left:0, // left position when the window appears.
//top:0, // top position when the window appears.
//center:0, // should we center the window? {1 (YES) or 0 (NO)}. overrides top and left
//createnew:1 // should we create a new window for each occurance {1 (YES) or 0 (NO)}.
	zoomify:
	{
		height:600,
		width:500,
		createnew:0
	},
	oliveViewer:
	{
		height:600,
		width:800,
		createnew:0
	}
};


$(function()
{
	$("a.x87").popupwindow(profiles);
});
