$(document).ready(function()
{
	$('a.flash').each(function(i)
	{
		$(this).attr('rel',$(this).attr('href'));
		$(this).removeAttr('href');
	});
	$('a.flash').click(function() 
	{
		//$('#flashloader').load($(this).attr('rel'));
		$('.flashvalue').attr('value',$(this).attr('rel'));
		$('.flashsrc').attr('src',$(this).attr('rel'));
		$('#flashloader').dialog('option','title',$(this).attr('title'));
		$('#flashloader').dialog('open');
		return false;
	});
	$('#flashloader').dialog(
	{
		autoOpen:false,
		width: 'auto',
		height: 'auto',
		resizable: false
	});
	$('a.flipbook').each(function(i)
	{
		var href = $(this).attr('href');
		$(this).attr('rel',href.substr(1));
		$(this).removeAttr('href');
	});
	$('a.flipbook').click(function() 
	{
		//$('#flipbookselector').load( '/flipbook/selector.php?fb='+$(this).attr('rel') );
		//$('#flipbookloader').load( '/mod/'+$(this).attr('rel')+'/book.php' );
		var myclass = $(this).attr('class');
		var hw = myclass.split(" ");
		$('#flipbookloader').dialog('option','width',parseFloat(hw[1].substr(1)));
		$('#flipbookloader').dialog('option','height',parseFloat(hw[0].substr(1)));
		$('#flipbookloader').dialog('open');
		return false;
	});
	$('#flipbookloader').dialog(
	{
		autoOpen:false,
		resizable: false
	});
	$('a.defil').each(function(i)
	{
		var href = $(this).attr('href');
		$(this).attr('rel',href.substr(1));
		$(this).removeAttr('href');
	});
	$('a.defil').click(function() 
	{
		$('#defilloader').load( '/inc/defilement.php?dir='+$(this).attr('rel') );
		var myclass = $(this).attr('class');
		var hw = myclass.split(" ");
		$('#defilloader').dialog('option','width',parseFloat(hw[1].substr(1))+30);
		$('#defilloader').dialog('option','height',parseFloat(hw[0].substr(1))+60);
		$('#defilloader').dialog('option','title',$(this).attr('title'));
		$('#defilloader').dialog('open');
		return false;
	});
	$('#defilloader').dialog(
	{
		autoOpen:false,
		resizable: false
	});
});
