jQuery(function() {
	jQuery("form").submit(function() {
		var f = jQuery(this)
		jQuery.post(document.location.href,jQuery(this).serialize(),function(data) {
			
			if (data.error) {
				f.find('.error').remove();
				f.prepend("<div class='error'>"+data.error+"</div>")
			}
			else if (data.message) {
				f.html(data.message)
			}
			
			if (data.redirect) {
				setTimeout(function(){
	     			document.location = data.redirect
	     		},1000);
	     	}
			
		},"json");	
		return false;
	})
})

function unhide(divID) {
 var item = document.getElementById(divID);
 if (item) {
 item.className=(item.className=='hidden')?'unhidden':'hidden';
 }
 }

var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-20890085-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();



