// generated by coffeescript 1.9.3 /* jquery lighter copyright 2015 kevin sylvestre 1.3.4 */ (function() { "use strict"; var $, animation, lighter, slide, bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; $ = jquery; animation = (function() { function animation() {} animation.transitions = { "webkittransition": "webkittransitionend", "moztransition": "moztransitionend", "otransition": "otransitionend", "transition": "transitionend" }; animation.transition = function($el) { var el, i, len, ref, result, type; for (i = 0, len = $el.length; i < len; i++) { el = $el[i]; ref = this.transitions; for (type in ref) { result = ref[type]; if (el.style[type] != null) { return result; } } } }; animation.execute = function($el, callback) { var transition; transition = this.transition($el); if (transition != null) { return $el.one(transition, callback); } else { return callback(); } }; return animation; })(); slide = (function() { function slide(url) { this.url = url; } slide.prototype.type = function() { switch (false) { case !this.url.match(/\.(webp|jpeg|jpg|jpe|gif|png|bmp)$/i): return 'image'; default: return 'unknown'; } }; slide.prototype.preload = function(callback) { var image; image = new image(); image.src = this.url; return image.onload = (function(_this) { return function() { _this.dimensions = { width: image.width, height: image.height }; return callback(_this); }; })(this); }; slide.prototype.$content = function() { return $("").attr({ src: this.url }); }; return slide; })(); lighter = (function() { lighter.namespace = "lighter"; lighter.prototype.defaults = { loading: '#{lighter.namespace}-loading', fetched: '#{lighter.namespace}-fetched', padding: 40, dimensions: { width: 480, height: 480 }, template: "
\n
\n \n ×\n \n \n
\n
\n
\n
\n
\n
\n
\n
" }; lighter.lighter = function($target, options) { var data; if (options == null) { options = {}; } data = $target.data('_lighter'); if (!data) { $target.data('_lighter', data = new lighter($target, options)); } return data; }; lighter.prototype.$ = function(selector) { return this.$el.find(selector); }; function lighter($target, settings) { if (settings == null) { settings = {}; } this.show = bind(this.show, this); this.hide = bind(this.hide, this); this.observe = bind(this.observe, this); this.keyup = bind(this.keyup, this); this.size = bind(this.size, this); this.align = bind(this.align, this); this.process = bind(this.process, this); this.resize = bind(this.resize, this); this.type = bind(this.type, this); this.prev = bind(this.prev, this); this.next = bind(this.next, this); this.close = bind(this.close, this); this.$ = bind(this.$, this); this.$target = $target; this.settings = $.extend({}, this.defaults, settings); this.$el = $(this.settings.template); this.$overlay = this.$("." + lighter.namespace + "-overlay"); this.$content = this.$("." + lighter.namespace + "-content"); this.$container = this.$("." + lighter.namespace + "-container"); this.$close = this.$("." + lighter.namespace + "-close"); this.$prev = this.$("." + lighter.namespace + "-prev"); this.$next = this.$("." + lighter.namespace + "-next"); this.$body = this.$("." + lighter.namespace + "-body"); this.dimensions = this.settings.dimensions; this.process(); } lighter.prototype.close = function(event) { if (event != null) { event.preventdefault(); } if (event != null) { event.stoppropagation(); } return this.hide(); }; lighter.prototype.next = function(event) { if (event != null) { event.preventdefault(); } return event != null ? event.stoppropagation() : void 0; }; lighter.prototype.prev = function() { if (typeof event !== "undefined" && event !== null) { event.preventdefault(); } return typeof event !== "undefined" && event !== null ? event.stoppropagation() : void 0; }; lighter.prototype.type = function(href) { if (href == null) { href = this.href(); } return this.settings.type || (this.href().match(/\.(webp|jpeg|jpg|jpe|gif|png|bmp)$/i) ? "image" : void 0); }; lighter.prototype.resize = function(dimensions) { this.dimensions = dimensions; return this.align(); }; lighter.prototype.process = function() { var fetched, loading; fetched = (function(_this) { return function() { return _this.$el.removeclass(lighter.namespace + "-loading").addclass(lighter.namespace + "-fetched"); }; })(this); loading = (function(_this) { return function() { return _this.$el.removeclass(lighter.namespace + "-fetched").addclass(lighter.namespace + "-loading"); }; })(this); this.slide = new slide(this.$target.attr("href")); loading(); return this.slide.preload((function(_this) { return function(slide) { _this.resize(slide.dimensions); _this.$content.html(_this.slide.$content()); return fetched(); }; })(this)); }; lighter.prototype.align = function() { var size; size = this.size(); return this.$container.css({ width: size.width, height: size.height, margin: "-" + (size.height / 2) + "px -" + (size.width / 2) + "px" }); }; lighter.prototype.size = function() { var ratio; ratio = math.max(this.dimensions.height / ($(window).height() - this.settings.padding), this.dimensions.width / ($(window).width() - this.settings.padding)); return { width: ratio > 1.0 ? math.round(this.dimensions.width / ratio) : this.dimensions.width, height: ratio > 1.0 ? math.round(this.dimensions.height / ratio) : this.dimensions.height }; }; lighter.prototype.keyup = function(event) { if (event.target.form != null) { return; } if (event.which === 27) { this.close(); } if (event.which === 37) { this.prev(); } if (event.which === 39) { return this.next(); } }; lighter.prototype.observe = function(method) { if (method == null) { method = 'on'; } $(window)[method]("resize", this.align); $(document)[method]("keyup", this.keyup); this.$overlay[method]("click", this.close); this.$close[method]("click", this.close); this.$next[method]("click", this.next); return this.$prev[method]("click", this.prev); }; lighter.prototype.hide = function() { var alpha, omega; alpha = (function(_this) { return function() { return _this.observe('off'); }; })(this); omega = (function(_this) { return function() { return _this.$el.remove(); }; })(this); alpha(); this.$el.position(); this.$el.addclass(lighter.namespace + "-fade"); return animation.execute(this.$el, omega); }; lighter.prototype.show = function() { var alpha, omega; omega = (function(_this) { return function() { return _this.observe('on'); }; })(this); alpha = (function(_this) { return function() { return $(document.body).append(_this.$el); }; })(this); alpha(); this.$el.position(); this.$el.removeclass(lighter.namespace + "-fade"); return animation.execute(this.$el, omega); }; return lighter; })(); $.fn.extend({ lighter: function(option) { if (option == null) { option = {}; } return this.each(function() { var $this, action, options; $this = $(this); options = $.extend({}, $.fn.lighter.defaults, typeof option === "object" && option); action = typeof option === "string" ? option : option.action; if (action == null) { action = "show"; } return lighter.lighter($this, options)[action](); }); } }); $(document).on("click", "[data-lighter]", function(event) { event.preventdefault(); event.stoppropagation(); return $(this).lighter(); }); }).call(this); function checkmail(input){ var pattern1=/^([a-za-z0-9_\-\.])+\@([a-za-z0-9_\-\.])+\.([a-za-z]{2,4})$/; if(pattern1.test(input)){ return true; }else{ return false; }} function proceed(){ var name = document.getelementbyid("name"); var email = document.getelementbyid("email"); var msg = document.getelementbyid("message"); var errors = ""; if(name.value == ""){ name.classname = 'error'; return false;} else if(email.value == ""){ email.classname = 'error'; return false;} else if(checkmail(email.value)==false){ alert('please provide a valid email address.'); return false;} else if(msg.value == ""){ msg.classname = 'error'; return false;} else { $.ajax({ type: "post", url: "php/submit.php", data: $("#contact_form").serialize(), success: function(msg){ //alert(msg); if(msg){ $('#contact_form').fadeout(1000); $('#contact_message').fadein(1000); document.getelementbyid("contact_message"); return true; }}}); }};