jQuery.noConflict();
(function($) { 
	$(function() {
		$(document).ready(function(){
			var fields = Array('title', 'firstname', 'lastname', 'email');
			
			for (var index = 0; index < fields.length; index ++) {
				$('#mailform' + fields[index]).focus(removeValueInput);
				$('#mailform' + fields[index]).blur(insertValueInput);
			}
			
			// Add special listener for spammer detection
			$('#mailformemail').focus(function() {
				$('#mailformhpot-changed').val('hpot-changed');
			});
		});
	});
})(jQuery);

function removeValueInput() {
	
	if (window.location.hostname == 'de.wycliffe.ch') {
	  var title = 'Anrede';
	  var firstname = 'Vorname';
	  var lastname = 'Name';
	  var email = 'Email';
	}
	else {
	  var title = 'Titre';
	  var firstname = 'Prénom';
	  var lastname = 'Nom';
	  var email = 'Email';
	}
	
	var value = '';
	if (this.id.search('title') > -1) {
		value = title;
	}
	else if (this.id.search('lastname') > -1) {
		value = lastname;
	}
	else if (this.id.search('firstname') > -1) {
		value = firstname;
	}
	else if (this.id.search('email') > -1) {
		value = email;
	}
	
	if (this.value == value) {
		this.value = '';	
	}
}

function insertValueInput() {
	if (window.location.hostname == 'de.wycliffe.ch') {
	  var title = 'Anrede';
	  var firstname = 'Vorname';
	  var lastname = 'Name';
	  var email = 'Email';
	}
	else {
	  var title = 'Titre';
	  var firstname = 'Prénom';
	  var lastname = 'Nom';
	  var email = 'Email';
	}
	
	var value = '';
	if (this.id.search('title') > -1) {
		value = title;
	}
	else if (this.id.search('lastname') > -1) {
		value = lastname;
	}
	else if (this.id.search('firstname') > -1) {
		value = firstname;
	}
	else if (this.id.search('email') > -1) {
		value = email;
	}
	
	if (this.value == '') {
		this.value = value;	
	}
}




