// JavaScript Document

var popUpFadeOutDelay = 200;

function showPopup( elem, showOrHide )
{
	if ( showOrHide ) {
		var pos = elem.position();
		var eheight = elem.outerHeight();
		$("img", elem).css( { position : "absolute", top : (pos.top + eheight)+"px", left : (pos.left)+"px"} )
		              .fadeIn( popUpFadeOutDelay );
	}
	else {
		$("img", elem).fadeOut( popUpFadeOutDelay );
	}
}

function reinitScrollPane()
{
	$('.details').jScrollPane({ reinitialiseOnImageLoad : true, 
												   scrollbarWidth : 24, 
												   scrollbarMargin : 3, 
													arrowSize : 0, 
													dragMaxHeight : 24, 
													dragMinHeight : 24, 
													showArrows : false });
}

if ( parent.contentReady == null )
{
	window.location = "index.php?url="+window.location+"&title="+Url.encode( document.title );
}
else{
	
	function contentInit() {
			 if ( parent.contentReady == null )
				 return;
				 
			 parent.contentReady();
			 
			 $(".popup").hover( function() { showPopup( $(this), true ) }, function() { showPopup( $(this), false ) } );
			 $(".popup img").click( function() { $(this).fadeOut( popUpFadeOutDelay ) } );
			 
			 $("a").click( function() { return parent.getContent( $(this) ); } );
			 $(".details").jScrollPane( { reinitialiseOnImageLoad : true, 
												   scrollbarWidth : 24, 
												   scrollbarMargin : 3, 
													arrowSize : 0, 
													dragMaxHeight : 24, 
													dragMinHeight : 24, 
													showArrows : false } );
			  
	}
	
	$contentReady = new parent.OnReady();
	$().ready( 
			
		
		function() {
			 if ( parent.contentReady == null )
				 return;
				 
			 parent.contentReady();
			 $contentReady.ready();		  
		}
	);  // main content function
	
	$contentReady.add( contentInit );
}


/*$().ready( 
   	
   function() {
		 if ( parent.contentReady == null )
		    return;
			 
	    parent.contentReady();
		 
		 $(".popup").hover( function() { showPopup( $(this), true ) }, function() { showPopup( $(this), false ) } );
		 $(".popup img").click( function() { $(this).fadeOut( popUpFadeOutDelay ) } );
		 
		 $("a").click( function() { return parent.getContent( $(this) ); } );
		 $(".details").jScrollPane( { reinitialiseOnImageLoad : true, scrollbarWidth : 24, scrollbarMargin : 3, arrowSize : 0, dragMaxHeight : 24, dragMinHeight : 24, showArrows : false } );
		  
}); 
}*/


