function wc()
{
	if(window.console)
	{
		for(var i = 0; i < arguments.length; i++)
		{
			window.console.log(arguments[i]);
		}
	}
	else
	{
		//alert(msg);
	}
}

$(document).ready(function()
{
	/* 
		Shadowbox
	*/
	var ShadowboxOptions = {
		
		assetURL:			BASE_URL + 'js/jquery.shadowbox/',
		
		resizeLgImages:		true,
		
		displayNav:			true,
		
		handleUnsupported:	'remove',
		
		keysClose:			['c', 27], // c or esc
		
		autoplayMovies:		true
	};
	
	Shadowbox.init(ShadowboxOptions);
	
	/* 
		maak alle producten op de homepage clickable
		- alle tekst enzo
	*/
	$('#page.productlinepage div.product-dataobject div.product').each(function()
	{
			
		var href = $('h2 a', this).attr('href');
		var title = $('h2 a', this).attr('title');
		
		//wc(this);
		
		$(this).css({cursor: 'pointer'}).attr('title', title);
		

		$(this).click(function() {
			
			document.location = href;
			
			return false;
		});
	});
	
	/* 
		banners in productpage clickable maken
	*/
	$('#page.productpage div.banners div.object1 div.datarecord, #page.productpage div.banners div.object2 div.datarecord').each(function()
	{
			
		var href = $('li a', this).attr('href');
		
		var title = $('li a', this).attr('title');
		
		 wc(href, title, this);
		
		$(this).css({cursor: 'pointer'}).attr('title', title);
		

		$(this).click(function() {
			
			document.location = href;
			
			return false;
		});
	});
	
	/* 
		Cycle... rouleren van banners
	*/
	var cycle_options = {

		fx: 'fade',
		fx: 'shuffle',
		fx: 'scrollLeft',
		//fx: 'scrollRight',
		//fx: 'scrollDown',
		//fx: 'scrollUp',
		
		slideExpr: 'div.datarecord',
		
		//cleartype: false,
		cleartypeNoBg: true,
		
		pause: true,
		timeout: 5000,
		speed: 800
	};
	
	// banner 1
	$('#page.productlinepage div.banners div.object1').cycle(cycle_options);
	
	// banner 2
	$('#page.productlinepage div.banners div.object2').cycle(cycle_options);
	
	// producten in een sidebar
	$('#page.textpage div.sidebar div.product-dataobject').cycle(cycle_options);
	
	// banner 3 news
	cycle_options.fx = 'fade';
	cycle_options.speed = 750;
	cycle_options.timeout = 8000,
	cycle_options.cleartypeNoBg = true;
	
	$('#page div.banners div.news-banner').cycle(cycle_options);
	
	// achterliggende pagina's in de sidebar
	
	// check... $('#page.textpage div.sidebar div.content-dataobject').cycle(cycle_options);
	
	$('#page.textpage div.sidebar div.pressrelease-dataobject').cycle(cycle_options);
	
	/* 
		dropdown menu
	*/
	$("#page div.headerframe div.navigationobject ul li").hover(
		function(){ $("#page div.headerframe div.navigationobject ul li ul", this).show(); }, 
		function() { } 
	);
	
	// IE... ?
	if (document.all) {
		$("#page div.headerframe div.navigationobject ul li").hoverClass("sfHover");
	}
	
	/* 
		language switch
	*/
	$('#page div.headerframe div.languages ul li a').wrapInner('<span></span>');
	$('#page div.headerframe div.languages ul li a span').css({
		opacity: 0
	});
	
	/* 	$('#page div.headerframe div.languages ul li.other a').css({
		opacity: 0.4
	});
	
	$('#page div.headerframe div.languages ul li.other a').hover(
	
		function(){
			$(this).css({opacity: 1.0});
		},		
		function(){
			$(this).css({opacity: 0.4});
		} 
	); */
	
	/* 
		use media for swf
	*/
	$('div.swf').media({
		
		width:     460, 
		height:    350, 
		autoplay:  true, 
				
		src: $('p a.url_file', this).attr('href'),
		
		attrs:     { autoplay:  true,  autostart:  true, controlbar: 'none' },  // object/embed attrs 
		params:    { autoplay: true, autostart: true, controlbar: 'none' }, // object params/embed attrs 
		caption:   false // supress caption text 
	});
	
	/* 
		flowplayer for video's
	*/
	$('div.video p a.video').each(function() {
		
		var video_url = $(this).attr('href'); wc(video_url);
		
		// video_url = 'http://hlzlepper.local/webroot/VR/www.ishopshape.com.rev5/media/uploaded/testanimatie.mov';
		
		// - empty the video div!!!
		$(this).parents('div.video').empty().flowplayer(
		
			{
				src: BASE_URL+'js/flowplayer/flowplayer-3.1.1.swf',
				
				wmode: 'opaque',
				
				bgcolor: '#ffffff',
				// bgcolor: 'transparent',
				
				foo: 'bar'
			},
			
			{
				// debug: true,
								
				clip: { 
					
					autoPlay: true,
					autoBuffering: true,
					
					scaling: 'orig',
					scaling: 'fit',
					// scaling: 'scale',
					
					url: video_url,
					
					// loop to the first clip 
					onBeforeFinish: function() { 
					
						this.seek(0);
						this.play(0);
												
						return false;
					}
				},
				
				screen: {         
					//width:460, height:350 //, top:55, right:77 
				},
				
				canvas: { 
					
					// use a wicked backgound color 
					backgroundColor: '#ffffff',
					
					// backgroundColor: 'transparent', 
					
					// a gradient 
					backgroundGradient: 'none'
					
					// and "curved" corners 
					// borderRadius: 20 
				},
				
				plugins: {
				
					controls: {
						
						autoHide: 'never',
						hideDelay: 4000,
						
						//zIndex: 100,
						//top: 0,
						bottom: 1,
						
						
						backgroundGradient: 'none',
						backgroundColor: 'transparent',
						
						
						//opacity: 0.5,
						
						all:false
						
						//play: true,
						//scrubber:true,
						//fullscreen: true
					}
					
					,controls: null
					
					//foo: 'bar'
				}
			}
		);
	});
	
	//.css({display:'block',width:'520px',height:'330px'})
	//var a = $('p.video a').flowplayer(BASE_URL+'gui/swf/flowplayer/flowplayer-3.1.1.swf');
	
	//wc(a);
	
	
	
});

$.fn.hoverClass = function(c) {
	return this.each(function(){
		$(this).hover( 
			function() { $(this).addClass(c);  },
			function() { $(this).removeClass(c); }
		);
	});
};

/*

Options:
	
	http://malsup.com/jquery/cycle/options.html
	
FX:
	
	http://malsup.com/jquery/cycle/browser.html
	
	•	blindX
	•	blindY
	•	blindZ
	•	cover
	•	curtainX
	•	curtainY
	•	fade
	•	fadeZoom
	•	growX
	•	growY
	•	scrollUp
	•	scrollDown
	•	scrollLeft
	•	scrollRight
	•	scrollHorz
	•	scrollVert
	•	shuffle
	•	slideX
	•	slideY
	•	toss
	•	turnUp
	•	turnDown
	•	turnLeft
	•	turnRight
	•	uncover
	•	wipe
	•	zoom
*/