function closeLoginBox() {
	setTimeout("$.fn.fancybox.close;document.location.href = '/index/';", 500);
}
function switchLanguage(lang) {
    u = location.href.split('/');
    u[5] = lang;
    location.href = u.join('/');
}

retrieveScreenshot = function(src, size)
{
	arr = src.split('-');
	lastpart = arr.length-1;
	newval = itemval.replace('-'+arr[lastpart],'');
	//alert(newval);
	if(newval=="") return false;
	mediumimage = newval+'-438x329.jpg';
	popupimage = newval.replace('cache/','')+'.jpg';
	
	if(size=='medium')
	return mediumimage;
	else
	return popupimage;
}

$(document).ready(function($){

	$('#screenshot').cycle({ 
	    fx:    'fade',
	    speed: 500,
	    timeout: 0,
	    next: '#btn-next',
	    prev: '#btn-prev',
    	before:   onBefore
	});

	jQuery('#mainimage-inner').cycle({ 
	    fx:    'fade', 
	    timeout:3300,
	    speed:  1200 
	});

	jQuery("a.photobox").fancybox({
		'zoomSpeedIn':	0, 
		'zoomSpeedOut':	0,
		'overlayShow': true,
		'overlayOpacity': 0.85
	});    
	jQuery("a.youtube").fancybox({
		'zoomSpeedIn':	100, 
		'zoomSpeedOut':	100,
		'frameWidth': 425,
		'frameHeight': 344,
		'overlayShow': true,
		'overlayOpacity': 0.85
	});    

	function onBefore() {
		curimage = $(this).parent().children().index(this)+1;
	    $('#cur-page').html(curimage);
	   // window.console.log(  $(this).parent().children().index(this) );
	}

	//$('.collapse').expander({slicePoint:575,expandText:'Lees verder',expandPrefix:'',userCollapse:false});

	/*var activeid = '';
	i = 1;
	$('.thumbnail img').each( function (e) { 
		if(i==1) activeid = jQuery(this).attr('src');
	
		itemval = jQuery(this).attr('src');
		file = retrieveScreenshot(itemval, 'medium');
		jQuery("<img>").attr("src", file);
		i++;
	});

	$('.thumbnail img').hover( function (e) { 
		curid = jQuery(this).attr("src");
		if(activeid==curid) return false;
		activeid = curid;

		itemval = jQuery(this).attr('src');
		mediumimage = retrieveScreenshot(itemval, 'medium');
		popupimage = retrieveScreenshot(itemval, 'popup');
		alert(mediumimage);
		if(file){
			jQuery(".screenshot a.photobox").attr('href', popupimage);
			jQuery("#screenshot-image").fadeOut(400,function() {
			jQuery(this).attr('src', mediumimage).fadeIn(600);});
		}
	});*/

});
