/*
Copyright (c) 2009 Ylab, www.ylab.nl
*/
jQuery(document).ready(function($){
	function deleteFavorite(el, productid, rateid){
		var urlAjax = '/ajax/savefavorite.php?productid='+productid+'&rateid='+rateid+'&favorite=0';
		jQuery.getJSON(urlAjax, function(data){
			if(data.result && !data.favorite){
				$(el).parent().parent().slideUp();
			}else{
				alert('Fout bij het bewerken van de lijst met favorieten.');
			}
		});
	}

	$('#profilesave').click(function(){
		$('#tbprofileload').hide();
		$('#tbprofilesave').show();
		$('#bntSubmit').val('Aanmaken');
	})
	$('#profileload').click(function(){
		$('#tbprofileload').show();
		$('#tbprofilesave').hide();
		$('#bntSubmit').val('Inloggen');
	});
	$('#trchangepassword a').click(function(){
		$('#tbchangepassword').show();
		$('#trchangepassword').hide();
	});
	$('#tbchangepassword').hide();
	$('#trprofile :radio:checked').click();

	//fave
	$('.favDel').click(function(event){
		var ids = this.hash.substring(1).split(',');
		deleteFavorite(this, ids[0], ids[1], ids[2]);
	});

});

