/**
 * Image Overlay
 * 
 * @version 1.0.0
 * @author arjen
 * 
 * jQuery 1.2.6
 */

jQuery.fn.ImageOverlay = function(options) {
	var defaults = {
		type: 'overlay-small',
		ignore_pngreq: false
	}
	var options = $.extend(defaults, options);

	// need proper png support
	if (!options.ignore_pngreq && $.browser.msie && parseFloat($.browser.version) < 7)
		return false;
	
	if (options.type == 'fluidbox') {
		this.each(function(){
			var $this = $(this);
			//var width = $this.width();

			overlay = $this
				.wrap('<span class="imgOverlayWrap imgOverlay-fluidbox"/>')
				.after('<span class="imgOverlayAid fluidbox"><span class="fb-top"><span class="inner"></span></span><span class="fb-bottom"><span class="inner"></span></span></span>')
				.parent()
				.width($this.width())
				.height($this.height());
		
			var fbTopHeigt = $this.height() - overlay.find('.fb-bottom').height();
			overlay.find('.fb-top').height(fbTopHeigt);
		});
		
	}
	else {
		this.each(function(){
			var $this = $(this);			
			$this
				.wrap('<span class="imgOverlayWrap"/>')
				.after('<span class="imgOverlayAid"/>')
				.parent()
				.width($this.width())
				.height($this.height())
				.end();
		});
	}
}

/**
 * function for imgOverlay small
 * 
 */

$();

$(function(){
	$("img.overlay").ImageOverlay({ignore_pngreq: true});	


	
/**
 * list items hover
 * 
 */
	// link effect op submit buttons	
	$('.highlight li div, #shows .highlight li, #films .highlight li').hover(function(){	
		$(this).addClass('hover');
		$(this).find('a.moreInfo').addClass('hover');
	},function(){
		$(this).removeClass('hover');
		$(this).find('a.moreInfo').removeClass('hover');
	});
	
	$('.highlight li .txtLink').hover(function(){
		$(this).parents('li').find('a.moreInfo').removeClass('hover');
	},function(){
		$(this).parents('li').find('a.moreInfo').addClass('hover');
	});
	
	$('.highlight li div, #shows .highlight li, #films .highlight li').click(function(){
		sHref = $(this).find('.moreInfo').attr('href');	
		window.location.href = sHref;	
	});
	
	$('.highlight li input.txtLink').click(function(e){
		e.stopPropagation();
	});

	
	// MouseOver effect op submit buttons
	$('input.txtLink').hover(function() {
  		$(this).addClass('txtLinkHover');
 	}, function() {
	  	$(this).removeClass('txtLinkHover');
 	}); 
	$('input.submit').hover(function() {
  		$(this).addClass('btnHover');
 	}, function() {
	  	$(this).removeClass('btnHover');
 	}); 
	$('.forgetButton').click(function() {
	  	$('#forgetBox').toggle('slow');
	  	return false;
 	}); 
 	
 	
/**
 * mp3 audio player click
 * 
 **/	
	//function toggle(obj) {
	//	var el = document.getElementById(obj);
	//	el.style.display = (el.style.display != 'none' ? 'none' : '' );
	//}


	$('a[href$=".mp3"]').click(function() {			
		$('#audioplayer').remove();		
		var sFile = $(this).attr('href');
		$(this).parent().append('<div id="audioplayer"></div>');
		var flashvars = {playMe:"true", myFile: sFile};			
		var params = {bgcolor:"#ffffff"};			
		var attributes = {id:"audioplayerObject"};
		swfobject.embedSWF("/flash/audioplayer2.swf", "audioplayer", "220", "25", "7.0.0","expressInstall.swf", flashvars, params, attributes);
		if ($('#audioplayer').length > 0)
			return true;
		return false;
	});

	// change appearance of filmNotice on Voorstellingenoverzicht after 3 seconds
	//setTimeout("$('#filmNotice').animate({width: '70%', opacity: 0.4, marginLeft: '0.6in', fontSize: '3em', borderWidth: '10px'}, 1500 );" , 3000);
	
	$('#filmsFilter').removeClass('hidden');
	$('#filmsFilter input').click(function() {
		var sClassName = $(this).attr('value');
		$('#noFilms').addClass('hidden');
		if (sClassName == "allen") {
			$('.film').show();
		} else {
			$('.film').hide();
			if ($('.'+sClassName).length) {
				$('.'+sClassName).show();
			} else {
				$('#noFilms').removeClass('hidden');
			}
		}
		return true;
	});
});

