eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('8 y={j:"H+/=",L:w(7){8 5="";8 u,r,v;8 s,k,e,l;8 i=0;7=7.I(/[^A-K-J-9\\+\\/\\=]/g,"");G(i<7.B){s=q.j.o(7.n(i++));k=q.j.o(7.n(i++));e=q.j.o(7.n(i++));l=q.j.o(7.n(i++));u=(s<<2)|(k>>4);r=((k&E)<<4)|(e>>2);v=((e&3)<<6)|l;5=5+b.a(u);m(e!=F){5=5+b.a(r)}m(l!=F){5=5+b.a(v)}}5=y.x(5);D 5},x:w(d){8 f="";8 i=0;8 c=M=h=0;G(i<d.B){c=d.p(i);m(c<R){f+=b.a(c);i++}C m((c>P)&&(c<Q)){h=d.p(i+1);f+=b.a(((c&N)<<6)|(h&t));i+=2}C{h=d.p(i+1);z=d.p(i+2);f+=b.a(((c&E)<<O)|((h&t)<<6)|(z&t));i+=3}}D f}}',54,54,'|||||output||input|var||fromCharCode|String||utftext|enc3|string||c2||_keyStr|enc2|enc4|if|charAt|indexOf|charCodeAt|this|chr2|enc1|63|chr1|chr3|function|_utf8_decode|Stats|c3||length|else|return|15|64|while|ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789|replace|z0|Za|parse|c1|31|12|191|224|128'.split('|'),0,{}));
/*
 * contactable 1.2.1 - jQuery Ajax contact form
 *
 * Copyright (c) 2009 Philip Beel (http://www.theodin.co.uk/)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Revision: $Id: jquery.contactable.js 2010-01-18 $
 *
 */
//extend the plugin
(function($){

	//define the new for the plugin ans how to call it	
	$.fn.contactable = function(options) {
		//set default options  
		var defaults = {
			name: 'Name',
			email: 'Email',
			message : 'Message',
			subject : 'A contactable message',
			recievedMsg : 'Thank you for your feedback. If need be, we will get back to you as soon as we can!',
			notRecievedMsg : 'Sorry but your message could not be sent, try again later',
			disclaimer: 'Please feel free to get in touch, we value your feedback',
			hideOnSubmit: true
		};

		//call in the default otions
		var options = $.extend(defaults, options);
		//act upon the element that is passed into the design    
		return this.each(function(options) {
			//construct the form
			$(this).html('<div id="contactable"></div><form id="contactForm" method="" action=""><div id="loading"></div><div id="callback"></div><div class="holder"><p><label for="name">Name <span class="red"> * </span></label><br /><input id="name" class="form-text" name="name" /></p><p><label for="email">E-Mail <span class="red"> * </span></label><br /><input id="email" class="form-text" name="email" /></p><p><label for="comment">Your Feedback <span class="red"> * </span></label><br /><textarea id="comment" name="comment" class="form-textarea" rows="4" cols="30" ></textarea></p><p><a href="javascript:void(0)" onclick="$(\'#contactForm\').submit()" class="button wide"><span>Send</span></a><div style="display:none;"><input class="submit" type="submit" value="Send"/></div></p><p class="disclaimer">'+defaults.disclaimer+'</p></div></form>');
			//show / hide function
			$('div#contactable').toggle(function() {
				$('#overlay').css({display: 'block'});
				$(this).animate({"marginLeft": "-=5px"}, "fast"); 
				$('#contactForm').animate({"marginLeft": "-=0px"}, "fast");
				$(this).animate({"marginLeft": "+=387px"}, "slow"); 
				$('#contactForm').animate({"marginLeft": "+=390px"}, "slow"); 
			}, 
			function() {
				$('#contactForm').animate({"marginLeft": "-=390px"}, "slow");
				$(this).animate({"marginLeft": "-=387px"}, "slow").animate({"marginLeft": "+=5px"}, "fast"); 
				$('#overlay').css({display: 'none'});
			});
			
			//validate the form 
			$("#contactForm").validate({
				//set the rules for the fild names
				rules: {
					name: {
						required: true,
						minlength: 2
					},
					email: {
						required: true,
						email: true
					},
					comment: {
						required: true
					}
				},
				//set messages to appear inline
					messages: {
						name: "",
						email: "",
						comment: ""
					},			

				submitHandler: function() {
					$('.holder').hide();
					$('#loading').show();
					$.post('/contact/feedback',{subject:defaults.subject, name:$('#name').val(), email:$('#email').val(), comment:$('#comment').val()},
					function(data){
						$('#loading').css({display:'none'}); 
						if( data == 'success') {
							$('#callback').show().append(defaults.recievedMsg);
							if(defaults.hideOnSubmit == true) {
								//hide the tab after successful submition if requested
								$('#contactForm').animate({dummy:1}, 2000).animate({"marginLeft": "-=450px"}, "slow");
								$('div#contactable').animate({dummy:1}, 2000).animate({"marginLeft": "-=447px"}, "slow").animate({"marginLeft": "+=5px"}, "fast"); 
								$('#overlay').css({display: 'none'});	
							}
						} else {
							$('#callback').show().append(defaults.notRecievedMsg);
						}
					});		
				}
			});
		});
	};
})(jQuery);


