var cur_submenu = 'monoloog';
var cur_data = 1;
var cur_media = 6;	// last media id minus 2


function a( url )
{
	window.open( url, '_blank' );
}


function bg_audio_off()
{
	//x = document.getElementById('bg_audio');
	x = $('#bg_audio')[0].off();
}


function next_data()
{
	if( $('.data'+(cur_data-1)).length )
	{
		$('.data'+(cur_data--)).hide();
		$('.data'+cur_data).show()
	}
}


function prev_data()
{
	if( $('.data'+(cur_data+1)).length )
	{
		$('.data'+(cur_data++)).hide();
		$('.data'+cur_data).show();
	}
}


function next_media()
{
	if( $('#mediathumb'+(cur_media+3)).length )
	{
		$('#mediathumb'+(cur_media++)).hide();
		$('#mediathumb'+(cur_media+2)).show();
	}
}


function prev_media()
{
	if( $('#mediathumb'+(cur_media-1)).length )
	{
		$('#mediathumb'+(cur_media+2)).hide();
		$('#mediathumb'+(--cur_media)).show();
	}
}


function submenu( m )
{
	$('#home_' + cur_submenu).hide();
	$('#home_' + m).show();
	cur_submenu = m;
}


$(document).ready( function()
{
	vars = { audio_file: 'audio/bg.mp3' };
	parm = { wmode: 'transparent', scale: 'noscale', allowScriptAccess: 'always' };
	attr = {};
		
	swfobject.embedSWF( 'swf/audio.swf', 'bg_audio', '37', '34', '10.0.0', 'expressInstall.swf', vars, parm, attr );
	
	
	
	$('.btn_nieuwe_media').click( next_media );
	$('.btn_oude_media').click( prev_media );
	
	$('div.speel_lijst').load( 'ajax_speeldata.html?r=' + Math.random(), function()
	{
		$('table.speel_data > tbody > tr > .btn_new').click( next_data );
		$('table.speel_data > tbody > tr > .btn_old').click( prev_data );
		
		$('table.speel_data > tbody > tr')
			.mouseover( function()
			{
				i = $('#dataextra'+$(this).attr('dataid'));
				
				if( !i.length ) {
					return;
				}
				
				$('table.speel_data_extra').hide();
				i.show();
			});
	});
	
	$('#media_content').load( 'ajax_media.html?r=' + Math.random(), function()
	{
		$('a[rel^=prettyPhoto]').prettyPhoto({theme:'dark_rounded'});
				
		$('div.media')
			.mouseover( function()
			{
				$('div.mediainfo').hide();
				$('#mediainfo'+$(this).attr('mediaid')).show();
			});
	});
		
	$('.btn_monoloog').mouseover( function() { submenu( 'monoloog' ) } );
	$('.btn_voortraject').mouseover( function() { submenu( 'voortraject' ) } );
	$('.btn_piloot_traject').mouseover( function() { submenu( 'piloot_traject' ) } );
	$('.btn_fighting_nordin').mouseover( function() { submenu( 'fighting_nordin' ) } );
	$('.btn_boumadian_jaghi').mouseover( function() { submenu( 'boumadian_jaghi' ) } );
});



/*
function fixPNG( img )
{
	// get src
	var src = img.src;
	// set width and height
	if (!img.style.width) { img.style.width = $(img).width(); }
	if (!img.style.height) { img.style.height = $(img).height(); }
	// replace by blank image
	img.onload = function() { };
	img.src = blank.src;
	// set filter (display original image)
	img.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
}


// IE PNG fix.
//$('body').supersleight({shim: '/img/x.gif'});

if( $(this).supersleight )
{
	$('.logo_stichting_alhambra')
		.add('.home_submenu')
		.supersleight({shim: '/img/x.gif'});
}

	

// PNG fix, http://docs.jquery.com/Tutorials:PNG_Opacity_Fix_for_IE6
if( (/MSIE ((5\.5)|6)/.test(navigator.userAgent) && navigator.platform == "Win32") )
{
	$('img[src$=.png]').each(function() {
		if( !this.complete ) {
			this.onload = function() { fixPng(this) };
		} else {
			fixPNG( this );
		}
	});
}

*/
