	function sendform() { 
		$('#sucmsg').hide('fast');
		$('#enqcover').show();
		
		var params = {nm:$('#nm').val(),adr:$('#adr').val(),ph:$('#ph').val(), em:$('#em').val(), enq:$('#enq').val(), ver:'0'};
		$.post('site/enquiry.php', params,
			function(d) {
				var a = [
					'<p class="success" style="text-align:center"><img src="site/images/email.jpg" style="height:100px"><br>Thank you for your enquiry, we will get back to you shortly.</p>'
					, '<p class="error">There was a problem sending your enquiry, please email us at ' + eml + '<br/><span class="small">('+ joinObj(params, 'ver') +')</span></p>'
					, '<p class="error">Please enter the required fields</p>'
					, '<p class="error">Invalid email address, a valid email address is required</p>'
				];
				var $ef = $('#enqfrm'); 
				switch (d) {
					case 's0': $ef.html("<tr><td>" + a[0] + "</td></tr>"); break;
					case 'fl0': $ef.html("<tr><td>" + a[1] + "</td></tr>"); break;
					case 'fl1': $('#sucmsg').html(a[2]); $('#sucmsg').show('slow'); break;
					case 'fl2': $('#sucmsg').html(a[3]); $('#sucmsg').show('slow'); break;
					default: $ef.html(a[1]);
				}
				$('#enqcover').hide();
			}
		); 
	}
	
	function doem(x, w) {
		//eg: x = gmail.comkias.chaos83, w = 12
		var y = x.substr(x.length - w) + '$' + x.substr(0, x.length - w); var z = y.replace('$','@');
		return '<a href="mail' + 'to:' + z + '">' + y.replace('$','<b>@</b>') + '</a>';
	}
	
	function joinObj(o, q) {
		var out = '';
		for (prop in o) if (o[prop] && !(prop == q)) out += ', ' + o[prop];
		return out.substring(2);
	}
	
	function echo(m) {
		document.write(m);
	}
	
	var eml = doem('thesydneycelebrant.com.auinfo', 4);
	
	$(document).ready(function() {
		SwitchEm();
	});

	function SwitchEm() {
		$(".switchem").each(function() {
			var $this = $(this);
			var t = $this.attr('title').replace(',','@').replace('[domain]', 'thesydneycelebrant.com.au');
			$this.html('<a href="mailto:'+t+'">'+t+'</a>');
			$this.attr('title', '');
		});
	}
