(function($){$.fn.contactable=function(options){var defaults={name:'Name',email:'Email',message:'Message',subject:'Feedback from a Guest',recievedMsg:'Thank you for your valuable feedback. We will get back to you shortly.<br /><br /><br /><br />',notRecievedMsg:'Sorry but your message could not be sent, try again later.<br /><br /><br /><br />',disclaimer:'Please feel free to get in touch, we value your feedback',hideOnSubmit:true};var options=$.extend(defaults,options);return this.each(function(options){$(this).html('<div id="contactable"></div><form id="contactForm" method="" action=""><div id="loading"></div><div id="callback"><div id="callbackMessage">&nbsp;</div><div id="callbackBtn"><input type="button" value="Close" id="btnClose" class="button"  style="width:300px;"/></div></div><div class="holder"><p><label for="name">Name <span class="red"> * </span></label><br /><input id="name" name="name" maxlength="100" style="width:300px;" class="inputTxt"/></p><p><label for="email">Email Address <span class="red"> * </span></label><br /><input id="email" name="email"  maxlength="100" style="width:300px;" class="inputTxt"/></p><p><label for="comment">Your Feedback <span class="red"> * </span></label><br /><textarea id="comment" name="comment" class="comment" rows="4" cols="45" ></textarea></p><p><input class="submit" type="submit" value="Send" />&nbsp;&nbsp;<input class="displayNone" type="button" value="Cancel" id="btnCancel" /></p><p class="disclaimer">'+defaults.disclaimer+'</p></div></form>');$('div#contactable').toggle(function(){$('#overlay').css({display:'block'});$(this).animate({"marginRight":"-=5px"},"fast");$('#contactForm').animate({"marginRight":"-=0px"},"fast");$(this).animate({"marginRight":"+=387px"},"slow");$('#contactForm').animate({"marginRight":"+=390px"},"slow");fnFeedbackFormReInitialize();$('#name').focus();},function(){$('#contactForm').animate({"marginRight":"-=390px"},"slow");$(this).animate({"marginRight":"-=387px"},"slow").animate({"marginRight":"+=5px"},"fast");$('#overlay').css({display:'none'});});$("#btnCancel").click(function(){$('#contactable').trigger('click');});$("#btnClose").click(function(){$('#contactable').trigger('click');});$("#contactable").click(function(){fnFeedbackFormReInitialize();});function fnFeedbackFormReInitialize()
{$('#callback').hide();$('#email').val('');$('#name').val('');$('#comment').val('');$('#btnClose').hide();$('.holder').show();$('#name').focus();}
$("#contactForm").validate({rules:{name:{required:true,minlength:2},email:{required:true,email:true},comment:{required:true}},messages:{name:"",email:"",comment:""},submitHandler:function(){$('.holder').hide();$('#loading').show();$.post(strFeedBackFilePath+'ajax-feedback.php',{subject:defaults.subject,name:$('#name').val(),email:$('#email').val(),comment:$('#comment').val()},function(data){$('#btnClose').show();$('#loading').css({display:'none'});if(data==1){$('#callback').show();$('#callbackMessage').html('').append(defaults.recievedMsg);$('.callbackBtn').show();if(defaults.hideOnSubmit==true){$('#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();$('#callbackMessage').html('').append(defaults.notRecievedMsg);}});}});});};})(jQuery);
