function confirmVideoDelete() {
	return confirm("Weet u zeker dat u dit item wilt verwijderen?");
}

function confirmCancel(redir) {
	if (confirm("Weet u zeker dat u wilt annuleren? Wijzigingen worden dan niet doorgevoerd.")) {
		location.replace(redir);
	}
	return false;
}


/**
 * Moves the selected items of a select box down.
 * 
 * @param selectId
 * @return
 */
function moveSelectItemsDown(selectId) {
	$('#' + selectId + ' option:selected').each(function(){
		$(this).insertAfter($(this).next());
	});
}

function alt_show() {
    document.getElementById('filetypes').style.display = 'block';
}

function alt_remove() {
    document.getElementById('filetypes').style.display="none";
}

$(document).ready(function() {

    
	/**
	 * Add tablesorter to tables with class 'tablesorter' 
	 */
    $('.tablesorter').tablesorter();

	/**
	 * Add tablesorter to tables with class 'tablesorter' 
	 */
    $('.tablednd').tableDnD();

	
/*http://orkans-tmp.22web.net/star_rating/index.html#overview*/
   $("#stars-wrapper1").stars({
       oneVoteOnly: false
   });

		// $("input[type=text]").focus(function(){
		//     // Select field contents
		//     this.select();
		// });	
		if ( $("#accordion").length > 0 ) {		
			$("#accordion").accordion({
				alwaysOpen: false,
				header: 'h3',
				collapsible:true,
				active: false,
				autoHeight: false,
				change: function(event, ui) { 
			        if(ui.newHeader && ui.newHeader.hasClass('ui-state-active')){
			            $('#accordion h3').each(     
			                function(it, el){          
			                    var isActive = $(el).hasClass('ui-state-active');   
			                    if(isActive){
			                        $.cookie('accordion-active', it, {path:'/'});
			                    }   
			                } 
			            );
	                 }
			    }
			});
			
			if($.cookie('accordion-active')) {
			    $("#accordion").accordion('activate' , parseInt($.cookie('accordion-active'), 10));
			}
		}
		//http://sorgalla.com/projects/jcarousel/#Examples
		if ( $("#mycarousel").length > 0 ) {
		 	$('#mycarousel').jcarousel();
		}
		
		$('a.externalLink').each(
			    function(data){
			        var target = $(this).attr('href');
			        var col = $(this).attr('rel'); 
			        $(this).click(function(){
			        	statisticsService.visit(target, col);
			        	return true;
			        })
			    }
			);
		
		
		$('.portal-layout-ThreeColumns').corner('5px');
		
		$('div#contactFormBody .form-button').mouseover(function(){
	    	$(this).addClass("hover");
	    }).mouseout(function(){
	    	$(this).removeClass("hover");		
	    });
		
		
		$("#lom_reviews_handle").click(function () {
			if($(this).hasClass('reviews_closed')) {
				$(this).removeClass("reviews_closed");
				$(this).addClass("reviews_open");
			} else {
				$(this).addClass("reviews_closed");
				$(this).removeClass("reviews_open");
			}
			
			$("#lom_reviews").toggle("slow");
		}); 
		
		$('form.arrangeer a').click(function() {
			$(this).parent().submit();
			return false;
		});
});