function hideAffiliateCompany()
{
	$("#account_type").val("1");
	$("#account_type_company").hide();
}

function showAffiliateCompany()
{
	$("#account_type").val("2");
	$("#account_type_company").fadeIn("slow");
}

function approveTerms()
{
	if ($("#terms").val() == "0") {
		$("#terms").val("1");
	} else {
		$("#terms").val("0");
	}
}

function toggleAffiliateTerms()
{
	 $("#signup_terms").fadeToggle("slow");
	 $("#signup_terms").load("/terms.php");
}

function signupAffiliate()
{
	
	$('#loading').fadeIn('slow');
	$("#loading").html('<img src="/images/loading.gif" alt="" /> Laddar...');
	$("#submit").hide();
	
	$.post("/ajax/ajax_signup_affiliate.php",
	{
		account_type: 		$("#account_type").val(),
		company_name:		$("#company_name").val(),
		orgnr:				$("#orgnr").val(),
		firstname:			$("#firstname").val(),
		lastname:			$("#lastname").val(),
		address:			$("#address").val(),
		postnr:				$("#postnr").val(),
		city:				$("#city").val(),
		country:			$("#country").val(),
		email:				$("#email").val(),
		category:			$("#category").val(),
		type:				$("#type").val(),
		sex:				$("#sex").val(),
		age:				$("#age").val(),
		website_url:		$("#website_url").val(),
		description:		$("#description").val(),
		terms: 				$("#terms").val()
	},
	function (data)
	{
		if (data == "true") {
			$("#error_message").hide();
			$("#signup_form").hide();
			$("#ok_message").fadeIn("slow");
			$('#pixel').load('/ajax/ajax_pixel_a.php');
		} else {
			$("#error_message").hide();
			$("#error_message").fadeIn("slow");
			$("#error_message").html(data);
			$("#loading").hide();
			$("#submit").show();
		}
	}
	)
}

function signupMerchant()
{
	$('#loading').fadeIn('slow');
	$("#loading").html('<img src="/images/loading.gif" alt="" /> Laddar...');
	$("#submit").hide();
	
	$.post("/ajax/ajax_signup_merchant.php",
	{
		firstname:					$("#firstname").val(),
		lastname:					$("#lastname").val(),
		email:						$("#email").val(),		
		company_name:				$("#company_name").val(),
		telephone:					$("#telephone").val(),
		fax:						$("#fax").val(),
		company_name:				$("#company_name").val(),		
		orgnr:						$("#orgnr").val(),
		address:					$("#address").val(),
		postnr:						$("#postnr").val(),
		city:						$("#city").val(),
		country:					$('#country').val(),
		compensation_click:			$("#compensation_click").val(),
		compensation_lead:			$("#compensation_lead").val(),
		compensation_saleflat:		$("#compensation_saleflat").val(),
		compensation_saleprocent:	$("#compensation_saleprocent").val(),			
		category:					$("#category").val(),
		website_url:				$("#website_url").val()
	},
	function (data)
	{
		if (data == "true") {
			$("#error_message").hide();
			$("#signup_form").hide();
			$("#ok_message").fadeIn("slow");
			$('#pixel').load('/ajax/ajax_pixel_m.php');
		} else {
			$("#error_message").hide();
			$("#error_message").fadeIn("slow");
			$("#error_message").html(data);
			$("#loading").hide();
			$("#submit").show();			
		}
	}
	)
}