jQuery.fn.fadeToggle = function(speed, easing, callback) {
	return this.animate({opacity: 'toggle'}, speed, easing, callback);
};
jQuery(document).ready(function($) {
  $('a[rel*=facebox]').facebox()
})
function setValue(id, value1, value2) {
	if ($('#' + id).val() == value1) {
		$('#' + id).val(value2);
	} else {
		$('#' + id).val(value1);
	}
}
function hide(div) {
	$('#' + div).hide();
}
function show(div) {
	$('#' + div).show();
}

function fadeToggleDiv(div)
{
	$('#' + div).fadeToggle('fast');
}
function toggleDiv(div)
{
	$('#' + div).toggle();
}
function sendMail()
{
	$('#submit').html('<img src="/images/loading.gif" alt="" /> Laddar...');
	
	$.post('/ajax/ajax_send_mail.php',
	{
		sendto:				$('#sendto').val(),
		name:				$('#name').val(),
		email:				$('#email').val(),
		telephone:			$('#telephone').val(),	
		subject:			$('#subject').val(),
		message:			$('#message').val()
	},
	function (data)
	{
		$('#submit').html('<input type="submit" value="Skicka" />');
		if (data == 'true') {
			$('#error_message').hide();
			$('#ok_message').fadeIn('slow');
		} else {
			$('#ok_message').hide();
			$('#error_message').hide();
			$('#error_message').fadeIn('slow');
			$('#error_message').html(data);			
		}
	});
}
function moreinfo()
{
	$('#submit').hide();
	$('#loading').show();
	$.post('/ajax/ajax_moreinfo.php', {
		affiliate: 	$('#affiliate').val(),
		merchant: 	$('#merchant').val(),
		name: 		$('#name').val(),
		email:		$('#email').val()
	}, function (data) {
		$('#loading').hide();
		$('#submit').show();
		jQuery.facebox(data);
	});
	
}