var contact = new Object();
contact.url = 'cfc/frontend/io/jquery/contact.cfc';

contact.sendPersonalRecommendation = function() {
	
	var box = $("#recommendation");
	var description = $('#recommendation [name="description"]').val();
	var email = $('#recommendation [name="email"]').val();
	
	showLoading(box);
	
	$.ajax({
		type:'post',
		url: contact.url + '?method=sendPersonalRecommendation',
		data: {
			description:description,
			email:email
		},
		success:function(response){
			if(response == 1){
				$(box).html('<h3>Persönliche Empfehlung</h3><p>Ihre Anfrage wurde erfolgreich gesendet.</p>');
			}else{
				$(box).html('<h3>Persönliche Empfehlung</h3><p>Bitte geben Sie valide Informationen an.</p><a href="?page=Shop">Zurück</a>');
			}
		}
	});

};

contact.subscribeNewsletter = function() {
	
	var box = $("#newsletter");
	var email = $('#newsletter [name="email"]').val();
	
	showLoading(box);
	
	$.ajax({
		type:'post',
		url: contact.url + '?method=subscribeNewsletter',
		data: {
			email:email
		},
		success:function(response){
			if(response == 2){
				$(box).html('<h3>Newsletter</h3><p>Sie wurde erfolgreich dem Newsletter hinzugefügt.</p>');
			}else if (response == 1){
				$(box).html('<h3>Newsletter</h3><p>Sie sind bereits für den Newsletter angemeldet.</p>');
			}else {
				$(box).html('<h3>Newsletter</h3><p>Bitte geben Sie eine valide E-Mail Adresse an.</p><a href="?page=Home">Zurück</a>');
			}
		}
	});

};
