﻿(function(a) { a.address = (function() { var c = function(i) { a(this).trigger(a.extend(a.Event(i), (function() { var af = { value: this.value(), path: this.path(), pathNames: this.pathNames(), parameterNames: this.parameterNames(), parameters: {}, queryString: this.queryString() }; for (var ae = 0, p = af.parameterNames.length; ae < p; ae++) { af.parameters[af.parameterNames[ae]] = this.parameter(af.parameterNames[ae]) } return af }).call(this))) }; var U = function() { c.call(a.address, "init") }; var n = function() { c.call(a.address, "change") }; var O = function() { var i = T.href.indexOf("#"); return i != -1 ? ac(o(T.href.substr(i + 1))) : "" }; var g = function() { try { top.document; return top } catch (i) { return window } }; var E = function(p, i) { if (B.strict) { p = i ? (p.substr(0, 1) != "/" ? "/" + p : p) : (p == "" ? "/" : p) } return p }; var q = function(i, p) { return (h && T.protocol == "file:") ? (p ? P.replace(/\?/, "%3F") : P.replace(/%253F/, "?")) : i }; var ad = function(ag) { for (var ae = 0, p = ag.childNodes.length, af; ae < p; ae++) { if (ag.childNodes[ae].src) { k = String(ag.childNodes[ae].src) } if (af = ad(ag.childNodes[ae])) { return af } } }; var W = function() { if (!s) { var p = O(); var i = !(P == p); if (t && r < 523) { if (D != X.length) { D = X.length; if (typeof z[D - 1] != F) { P = z[D - 1] } S() } } else { if (h && i) { if (r < 7) { T.reload() } else { G.value(p) } } else { if (i) { P = p; S() } } } } }; var S = function() { n(); m(v, 10) }; var v = function() { var p = (T.pathname + (/\/$/.test(T.pathname) ? "" : "/") + C.value()).replace(/\/\//, "/").replace(/^\/$/, ""); var i = window[B.tracker]; if (typeof i == f) { i(p) } else { if (typeof pageTracker != F && typeof pageTracker._trackPageview == f) { pageTracker._trackPageview(p) } else { if (typeof urchinTracker == f) { urchinTracker(p) } } } }; var e = function() { var i = w.contentWindow.document; i.open(); i.write("<html><head><title>" + aa.title + "</title><script>var " + x + ' = "' + O() + '";<\/script></head></html>'); i.close() }; var M = function() { if (!R) { R = true; a("a").attr("xref", function() { return a(this).attr("href") }); if (h && r < 8) { aa.body.innerHTML = '<iframe id="' + x + '" src="javascript:false;" width="0" height="0"></iframe>' + aa.body.innerHTML; w = aa.getElementById(x); m(function() { a(w).bind("load", function() { var i = w.contentWindow; var p = i.location.href; P = (typeof i[x] != F ? i[x] : ""); if (P != O()) { S(); T.hash = q(P, true) } }); if (typeof w.contentWindow[x] == F) { e() } }, 50) } else { if (t) { if (r < 418) { a(aa.body).append('<form id="' + x + '" style="position:absolute;top:-9999px;" method="get"></form>'); I = aa.getElementById(x) } if (typeof T[x] == F) { T[x] = {} } if (typeof T[x][T.pathname] != F) { z = T[x][T.pathname].split(",") } } } m(function() { U(); n(); v() }, 1); if (h && r >= 8) { aa.body.onhashchange = W } else { u(W, 50) } a("a").attr("href", function() { return a(this).attr("xref") }).removeAttr("xref"); a("a[rel*=address:]").address() } }; var C = { baseURL: function() { var i = T.href; if (i.indexOf("#") != -1) { i = i.substr(0, i.indexOf("#")) } if (i.substr(i.length - 1) == "/") { i = i.substr(0, i.length - 1) } return i }, strict: function() { return B.strict }, history: function() { return B.history }, tracker: function() { return B.tracker }, title: function() { return aa.title }, value: function() { if (!Z) { return null } return o(E(q(P, false), false)) }, path: function() { var i = this.value(); return (i.indexOf("?") != -1) ? i.split("?")[0] : i }, pathNames: function() { var p = this.path(); var i = p.split("/"); if (p.substr(0, 1) == "/" || p.length == 0) { i.splice(0, 1) } if (p.substr(p.length - 1, 1) == "/") { i.splice(i.length - 1, 1) } return i }, queryString: function() { var p = this.value(); var i = p.indexOf("?"); return (i != -1 && i < p.length) ? p.substr(i + 1) : "" }, parameter: function(aj) { var ag = this.value(); var ae = ag.indexOf("?"); if (ae != -1) { ag = ag.substr(ae + 1); var ai = ag.split("&"); var ah, af = ai.length; while (af--) { ah = ai[af].split("="); if (ah[0] == aj) { return ah[1] } } } }, parameterNames: function() { var af = this.value(); var p = af.indexOf("?"); var ag = []; if (p != -1) { af = af.substr(p + 1); if (af != "" && af.indexOf("=") != -1) { var ah = af.split("&"); var ae = 0; while (ae < ah.length) { ag.push(ah[ae].split("=")[0]); ae++ } } } return ag } }; var G = { strict: function(i) { B.strict = i }, history: function(i) { B.history = i }, tracker: function(i) { B.tracker = i }, title: function(i) { m(function() { H = aa.title = i; if (J && w && w.contentWindow && w.contentWindow.document) { w.contentWindow.document.title = i; J = false } if (!L && Y) { T.replace(T.href.indexOf("#") != -1 ? T.href : T.href + "#") } L = false }, 50) }, value: function(ae) { ae = ac(o(E(ae, true))); if (ae == "/") { ae = "" } if (P == ae) { return } L = true; P = ae; s = true; S(); z[X.length] = P; if (t) { if (B.history) { T[x][T.pathname] = z.toString(); D = X.length + 1; if (r < 418) { if (T.search == "") { I.action = "#" + P; I.submit() } } else { if (r < 523 || P == "") { var i = aa.createEvent("MouseEvents"); i.initEvent("click", true, true); var p = aa.createElement("a"); p.href = "#" + P; p.dispatchEvent(i) } else { T.hash = "#" + P } } } else { T.replace("#" + P) } } else { if (P != O()) { if (B.history) { T.hash = "#" + q(P, true) } else { T.replace("#" + P) } } } if ((h && r < 8) && B.history) { m(e, 50) } if (t) { m(function() { s = false }, 1) } else { s = false } } }; var x = "jQueryAddress", f = "function", F = "undefined", A = a.browser, r = parseFloat(a.browser.version), Y = A.mozilla, h = A.msie, K = A.opera, t = A.safari, Z = false, N = g(), aa = N.document, X = N.history, T = N.location, u = setInterval, m = setTimeout, o = decodeURI, ac = encodeURI, ab = navigator.userAgent, w, I, k, H = aa.title, D = X.length, s = false, R = false, L = true, J = true, z = [], y = {}, P = O(), j = {}, B = { history: true, strict: true }; if (h) { r = parseFloat(ab.substr(ab.indexOf("MSIE") + 4)) } Z = (Y && r >= 1) || (h && r >= 6) || (K && r >= 9.5) || (t && r >= 312); if (Z) { for (var V = 1; V < D; V++) { z.push("") } z.push(O()); if (h && T.hash != O()) { T.hash = "#" + q(O(), true) } if (K) { history.navigationMode = "compatible" } ad(document); var b = k.indexOf("?"); if (k && b > -1) { var l, d = k.substr(b + 1).split("&"); for (var V = 0, Q; Q = d[V]; V++) { l = Q.split("="); if (/^(history|strict)$/.test(l[0])) { B[l[0]] = (isNaN(l[1]) ? /^(true|yes)$/i.test(l[1]) : (parseInt(l[1]) != 0)) } if (/^tracker$/.test(l[0])) { B[l[0]] = l[1] } } } a(M) } else { if ((!Z && T.href.indexOf("#") != -1) || (t && r < 418 && T.href.indexOf("#") != -1 && T.search != "")) { aa.open(); aa.write('<html><head><meta http-equiv="refresh" content="0;url=' + T.href.substr(0, T.href.indexOf("#")) + '" /></head></html>'); aa.close() } else { v() } } a.each(("init,change").split(","), function(ae, p) { j[p] = function(af, i) { a(a.address).bind(p, i || af, i && af); return this } }); a.each(("baseURL,strict,history,tracker,title,value").split(","), function(ae, p) { j[p] = function(i) { if (typeof i != "undefined") { if (Z) { G[p](i) } return a.address } else { return C[p]() } } }); a.each(("path,pathNames,queryString,parameter,parameterNames").split(","), function(ae, p) { j[p] = function(i) { return C[p](i) } }); return j })(); a.fn.address = function(b) { a(this).click(function() { var c = b ? b.call(this) : /address:/.test(a(this).attr("rel")) ? a(this).attr("rel").split("address:")[1].split(" ")[0] : a(this).attr("href").replace(/^#/, ""); a.address.value(c); return false }) } } (jQuery));
(function($) { var $$; $$ = $.fn.galleria = function($options) { if (!$$.hasCSS()) { return false; } $.historyInit($$.onPageLoad); var $defaults = { insert: '.galleria_container', history: true, clickNext: true, onImage: function(image, caption, thumb) { }, onThumb: function(thumb) { } }; var $opts = $.extend($defaults, $options); for (var i in $opts) { if (i) { $.galleria[i] = $opts[i]; } } var _insert = ($($opts.insert).is($opts.insert)) ? $($opts.insert) : jQuery(document.createElement('div')).insertBefore(this); var _div = $(document.createElement('div')).addClass('galleria_wrapper'); var _span = $(document.createElement('span')).addClass('caption'); _insert.addClass('galleria_container').append(_div).append(_span); return this.each(function() { $(this).addClass('galleria'); $(this).children('li').each(function(i) { var _container = $(this); var _o = $.meta ? $.extend({}, $opts, _container.data()) : $opts; _o.clickNext = $(this).is(':only-child') ? false : _o.clickNext; var _a = $(this).find('a').is('a') ? $(this).find('a') : false; var _img = $(this).children('img').css('display', 'none'); var _src = _a ? _a.attr('href') : _img.attr('src'); var _title = _a ? _a.attr('title') : _img.attr('title'); var _loader = new Image(); if (_o.history && (window.location.hash && window.location.hash.replace(/\#/, '') == _src)) { _container.siblings('.active').removeClass('active'); _container.addClass('active'); } $(_loader).load(function() { $(this).attr('alt', _img.attr('alt')); var _thumb = _a ? _a.find('img').addClass('thumb noscale').css('display', 'none') : _img.clone(true).addClass('thumb').css('display', 'none'); if (_a) { _a.replaceWith(_thumb); } if (!_thumb.hasClass('noscale')) { var w = Math.ceil(_img.width() / _img.height() * _container.height()); var h = Math.ceil(_img.height() / _img.width() * _container.width()); if (w < h) { _thumb.css({ height: 'auto', width: _container.width() }); } else { _thumb.css({ width: 'auto', height: _container.height() }); } } else { window.setTimeout(function() { _thumb.css({ marginLeft: 0, marginTop: 0 }); }, 1); } _thumb.attr('rel', _src); _thumb.attr('title', _title); _thumb.click(function() { $.galleria.activate(_src); }); _thumb.hover(function() { $(this).addClass('hover'); }, function() { $(this).removeClass('hover'); }); _container.hover(function() { _container.addClass('hover'); }, function() { _container.removeClass('hover'); }); _container.prepend(_thumb); _thumb.css('display', 'block'); _o.onThumb(jQuery(_thumb)); if (_container.hasClass('active')) { $.galleria.activate(_src); } _img.remove(); }).error(function() { _container.html('<span class="error" style="color:red">Error loading image: ' + _src + '</span>'); }).attr('src', _src); }); }); }; $$.nextSelector = function(selector) { return $(selector).is(':last-child') ? $(selector).siblings(':first-child') : $(selector).next(); }; $$.previousSelector = function(selector) { return $(selector).is(':first-child') ? $(selector).siblings(':last-child') : $(selector).prev(); }; $$.hasCSS = function() { $('body').append($(document.createElement('div')).attr('id', 'css_test').css({ width: '1px', height: '1px', display: 'none' })); var _v = ($('#css_test').width() != 1) ? false : true; $('#css_test').remove(); return _v; }; $$.onPageLoad = function(_src) { var _wrapper = $('.galleria_wrapper'); var _thumb = $('.galleria img[rel="' + _src + '"]'); if (_src) { if ($.galleria.history) { window.location = window.location.href.replace(/\#.*/, '') + '#' + _src; } _thumb.parents('li').siblings('.active').removeClass('active'); _thumb.parents('li').addClass('active'); var _img = $(new Image()).attr('src', _src).addClass('replaced'); _wrapper.empty().append(_img); _wrapper.siblings('.caption').html(_thumb.attr('title')); $.galleria.onImage(_img, _wrapper.siblings('.caption'), _thumb); if ($.galleria.clickNext) { _img.css('cursor', 'pointer').click(function() { $.galleria.next(); }); } } else { _wrapper.siblings().andSelf().empty(); $('.galleria li.active').removeClass('active'); } $.galleria.current = _src; }; $.extend({ galleria: { current: '', onImage: function() { }, activate: function(_src) { if ($.galleria.history) { $.historyLoad(_src); } else { $$.onPageLoad(_src); } }, next: function() { var _next = $($$.nextSelector($('.galleria img[rel="' + $.galleria.current + '"]').parents('li'))).find('img').attr('rel'); $.galleria.activate(_next); }, prev: function() { var _prev = $($$.previousSelector($('.galleria img[rel="' + $.galleria.current + '"]').parents('li'))).find('img').attr('rel'); $.galleria.activate(_prev); } } }); })(jQuery); jQuery.extend({ historyCurrentHash: undefined, historyCallback: undefined, historyInit: function(callback) { jQuery.historyCallback = callback; var current_hash = location.hash; jQuery.historyCurrentHash = current_hash; if (jQuery.browser.msie) { if (jQuery.historyCurrentHash === '') { jQuery.historyCurrentHash = '#'; } $("body").prepend('<iframe id="jQuery_history" style="display: none;"></iframe>'); var ihistory = $("#jQuery_history")[0]; var iframe = ihistory.contentWindow.document; iframe.open(); iframe.close(); iframe.location.hash = current_hash; } else if ($.browser.safari) { jQuery.historyBackStack = []; jQuery.historyBackStack.length = history.length; jQuery.historyForwardStack = []; jQuery.isFirst = true; } jQuery.historyCallback(current_hash.replace(/^#/, '')); setInterval(jQuery.historyCheck, 100); }, historyAddHistory: function(hash) { jQuery.historyBackStack.push(hash); jQuery.historyForwardStack.length = 0; this.isFirst = true; }, historyCheck: function() { if (jQuery.browser.msie) { var ihistory = $("#jQuery_history")[0]; var iframe = ihistory.contentDocument || ihistory.contentWindow.document; var current_hash = iframe.location.hash; if (current_hash != jQuery.historyCurrentHash) { location.hash = current_hash; jQuery.historyCurrentHash = current_hash; jQuery.historyCallback(current_hash.replace(/^#/, '')); } } else if ($.browser.safari) { if (!jQuery.dontCheck) { var historyDelta = history.length - jQuery.historyBackStack.length; if (historyDelta) { jQuery.isFirst = false; var i; if (historyDelta < 0) { for (i = 0; i < Math.abs(historyDelta); i++) { jQuery.historyForwardStack.unshift(jQuery.historyBackStack.pop()); } } else { for (i = 0; i < historyDelta; i++) { jQuery.historyBackStack.push(jQuery.historyForwardStack.shift()); } } var cachedHash = jQuery.historyBackStack[jQuery.historyBackStack.length - 1]; if (cachedHash !== undefined) { jQuery.historyCurrentHash = location.hash; jQuery.historyCallback(cachedHash); } } else if (jQuery.historyBackStack[jQuery.historyBackStack.length - 1] === undefined && !jQuery.isFirst) { if (document.URL.indexOf('#') >= 0) { jQuery.historyCallback(document.URL.split('#')[1]); } else { current_hash = location.hash; jQuery.historyCallback(''); } jQuery.isFirst = true; } } } else { current_hash = location.hash; if (current_hash != jQuery.historyCurrentHash) { jQuery.historyCurrentHash = current_hash; jQuery.historyCallback(current_hash.replace(/^#/, '')); } } }, historyLoad: function(hash) { var newhash; if (jQuery.browser.safari) { newhash = hash; } else { newhash = '#' + hash; location.hash = newhash; } jQuery.historyCurrentHash = newhash; if (jQuery.browser.msie) { var ihistory = $("#jQuery_history")[0]; var iframe = ihistory.contentWindow.document; iframe.open(); iframe.close(); iframe.location.hash = newhash; jQuery.historyCallback(hash); } else if (jQuery.browser.safari) { jQuery.dontCheck = true; this.historyAddHistory(hash); var fn = function() { jQuery.dontCheck = false; }; window.setTimeout(fn, 200); jQuery.historyCallback(hash); location.hash = newhash; } else { jQuery.historyCallback(hash); } } });
var rt = {}; rt.resize = function(b) { var c = $("#pages"), d = $("body").width() - 980; $("#home", c).css("margin-left", d / 2 + "px"); $("li.divider", c).width(d); var f = 0; $(">li", c).each(function() { f += $(this).outerWidth(true) }); $(c).width(f + d / 2); if (b != undefined) { b = $("li.active", c); d = ($("body").width() - 980) / 2; d = parseInt(c.css("left")) + (-b.offset().left + d); c.css("left", d + "px") } }; rt.moveTo = function(b) { var c = $("#pages"); c.find("li.active").removeClass("active"); if (typeof b == "string") b = $("#" + b, c); var d = ($("body").width() - 980) / 2; d = parseInt(c.css("left")) + (-b.offset().left + d); c.animate({ left: d + "px" }, 1E3, function() { $("#home-nav a").removeClass("hover"); $(".swirl").hide() }); b.addClass("active") }; rt.next = function() { var b = $("#pages"), c = $("li.active", b).nextAll(".page:first"); if (c.length == 0) c = $("li.page:first", b); rt.moveTo(c) }; rt.prev = function() { var b = $("#pages"), c = $("li.active", b).prevAll(".page:first"); if (c.length == 0) c = $("li.page:last", b); rt.moveTo(c) }; rt.moveToPortfolio = function(b) { rt.filterGallery(b, false); $.address.value("portfolio-content") }; rt.filterGallery = function(b, c) { var d = $("#gallery"); $("#small-print, #small-web, #small-identity").removeClass("active").rotate(0); $("#small-" + b).addClass("active").rotate(-40); $("li.active", d).removeClass("active"); if (c === true) { var f = $("li:not(." + b + ")", d), g = 0; f.fadeOut("normal", function() { g++; g == f.length && $("li." + b, d).fadeIn("normal") }) } else { $("li:not(." + b + ")", d).hide(); $("li." + b, d).show() } $("li." + b + ":first", d).addClass("active"); d.data("filter", b); pageTracker && pageTracker._trackPageview("/portfolio/" + b) }; $.address.change(function(b) { b = b.value.substring(1); if (b.length == 0) b = "home"; b == "portfolio-content" && $("#gallery").data("filter") == undefined ? $.address.value("portfolio") : rt.moveTo(b) }); $(function() { rt.resize(); $(window).resize(rt.resize); $(window).keypress(function(a) { if (a.keyCode == 37 || a.keyCode == 38 || a.keyCode == 39 || a.keyCode == 40) a.preventDefault() }); $(window).keyup(function(a) { if (a.keyCode == 37 || a.keyCode == 38) { a.preventDefault(); rt.prev() } if (a.keyCode == 39 || a.keyCode == 40) { a.preventDefault(); rt.next() } }); $("#home-nav li.about a").click(function(a) { a.preventDefault(); $(this).addClass("hover"); $("#swirl-about").width(0).show().animate({ width: "335px" }, "slow", function() { $.address.value("about") }) }); $(".small-nav li.about a").click(function(a) { a.preventDefault(); $.address.value("about") }); $("#home-nav li.portfolio a").click(function(a) { a.preventDefault(); $(this).addClass("hover"); $("#swirl-portfolio").width(0).show().animate({ width: "318px" }, "slow", function() { $.address.value("portfolio") }) }); $(".small-nav li.portfolio a").click(function(a) { a.preventDefault(); $.address.value("portfolio") }); $("#home-nav li.contact a").click(function(a) { a.preventDefault(); $(this).addClass("hover"); $("#swirl-contact").width(0).show().animate({ width: "371px" }, "slow", function() { $.address.value("contact") }) }); $(".small-nav li.contact a").click(function(a) { a.preventDefault(); $.address.value("contact") }); var b = $("#big-print").rotate({ maxAngle: 0, minAngle: -30, bind: [{ mouseover: function() { b[0].rotateAnimation(-35) } }, { mouseout: function() { b[0].rotateAnimation(85) } }, { click: function() { rt.moveToPortfolio("print") } }] }), c = $("#big-web").rotate({ maxAngle: 0, minAngle: -25, bind: [{ mouseover: function() { c[0].rotateAnimation(-35) } }, { mouseout: function() { c[0].rotateAnimation(85) } }, { click: function() { rt.moveToPortfolio("web") } }] }), d = $("#big-identity").rotate({ maxAngle: 45, minAngle: 0, bind: [{ mouseover: function() { d[0].rotateAnimation(85) } }, { mouseout: function() { d[0].rotateAnimation(-35) } }, { click: function() { rt.moveToPortfolio("identity") } }] }), f = $("#small-print").rotate({ maxAngle: 0, minAngle: -30, bind: [{ mouseover: function() { f[0].hasClass("active") || f[0].rotateAnimation(-35) } }, { mouseout: function() { f[0].hasClass("active") || f[0].rotateAnimation(85) } }, { click: function() { rt.filterGallery("print", true) } }] }), g = $("#small-web").rotate({ maxAngle: 0, minAngle: -25, bind: [{ mouseover: function() { g[0].hasClass("active") || g[0].rotateAnimation(-35) } }, { mouseout: function() { g[0].hasClass("active") || g[0].rotateAnimation(85) } }, { click: function() { rt.filterGallery("web", true) } }] }), h = $("#small-identity").rotate({ maxAngle: 45, minAngle: 0, bind: [{ mouseover: function() { h[0].hasClass("active") || h[0].rotateAnimation(85) } }, { mouseout: function() { h[0].hasClass("active") || h[0].rotateAnimation(-35) } }, { click: function() { rt.filterGallery("identity", true) } }] }); swfobject.embedSWF("content/head.swf", "spinning-head", "41", "41", "9.0.0"); $("#gallery").galleria({ history: false, clickNext: false, insert: "#main_image", onImage: function(a, e, i) { a.css("display", "none").fadeIn("slow"); e.css("opacity", 0).animate({ opacity: 0.7 }, "slow"); $("a", e).attr("target", "_blank"); a.css("width", "auto"); a.css("height", "auto"); if ($.browser.msie && $.browser.version < 7) { e = 395 / 600; var j = a.css("height") / a.css("width"); a.css("height") > 395 && j < e && a.height(395); a.css("width") > 600 && e < j && a.width(600); a.height() > 395 && a.height(395) } a.css("margin-top", (395 - a.height()) / 2 + "px"); i.parents("li").siblings().children("img.selected").fadeTo(500, 0.3); i.fadeTo("fast", 1).addClass("selected") }, onThumb: function(a) { var e = a.parents("li"), i = e.is(".active") ? "1" : "0.3"; a.css({ display: "none", opacity: i }).fadeIn(1500); a.click(function() { if (pageTracker) { var j = a.attr("alt"), l = a.closest("li"), k = "unknown"; if (l.hasClass("web")) k = "web"; if (l.hasClass("identity")) k = "identity"; if (l.hasClass("print")) k = "print"; pageTracker._trackPageview("/portfolio/" + k + "/" + j) } }); a.hover(function() { a.fadeTo("fast", 1) }, function() { e.not(".active").children("img").fadeTo("fast", 0.3) }) } }); $("#send-contact").click(function() { $("#message").val().length == 0 && $("#message").addClass("error").blur(function() { $(this).val().length > 0 && $(this).removeClass("error") }); $("#name").val().length == 0 && $("#name").addClass("error").blur(function() { $(this).val().length > 0 && $(this).removeClass("error") }); $(this).siblings(".error").length == 0 ? $(this).closest("div").slideUp(function() { $.post("send.aspx", { name: $("#name").val(), phone: $("#phone").val(), email: $("#email").val(), message: $("#message").val() }, function(a) { var e = $("#contact-form div"); a == "success" ? e.html("Your message has been sent.") : e.html("Oops, that didn't go according to plan. Please contact us by email."); e.slideDown() }) }) : $(this).siblings(".error:first").focus() }) });
(function(f){for(var g,j=document.getElementsByTagName("head")[0].style,i="transformProperty WebkitTransform OTransform".split(" "),h=0;h<i.length;h++)if(j[i[h]]!==undefined)g=i[h];jQuery.fn.extend({ImageRotate:function(b){if(!(this.Wilq32&&this.Wilq32.PhotoEffect)){b=f.extend(true,{},b);return(new Wilq32.PhotoEffect(this.get(0),b))._temp}},rotate:function(b){if(!(this.length===0||typeof b=="undefined")){if(typeof b=="number")b={angle:b};for(var a=[],c=0,d=this.length;c<d;c++){var e=this.get(c);typeof e.Wilq32==
"undefined"?a.push(f(f(e).ImageRotate(b))):e.Wilq32.PhotoEffect._rotate(b.angle)}return a}},rotateAnimation:function(b){if(!(this.length===0||typeof b=="undefined")){if(typeof b=="number")b={animateAngle:b};for(var a=[],c=0,d=this.length;c<d;c++){var e=this.get(c);typeof e.Wilq32=="undefined"?a.push(f(f(e).ImageRotate(b))):e.Wilq32.PhotoEffect.rotateAnimation(b)}return a}}});Wilq32=window.Wilq32||{};Wilq32.PhotoEffect=function(){function b(a,c){this._img=a;this._parameters=c||{};this._parameters.angle=
this._angle=c.angle||0;this._parameters.animateAngle=typeof c.animateAngle=="number"?c.animateAngle:this._angle}return g?function(a,c){b.call(this,a,c);a.Wilq32={PhotoEffect:this};this._temp=this._img;this._BindEvents(a,this._parameters.bind);this._rotate(this._parameters.angle);this._parameters.angle!=this._parameters.animateAngle&&this.rotateAnimation(this._parameters)}:function(a,c){b.call(this,a,c);this._parameters.className=a.className;this._parameters.id=a.getAttribute("id");this._temp=document.createElement("span");
this._temp.style.display="inline-block";this._temp.Wilq32={PhotoEffect:this};a.parentNode.insertBefore(this._temp,a);if(a.complete)this._Loader();else{var d=this;jQuery(this._img).bind("load",function(){d._Loader()})}}}();Wilq32.PhotoEffect.prototype={rotateAnimation:function(b){this._parameters.animateAngle=b.animateAngle;this._parameters.callback=b.callback||this._parameters.callback||function(){};this._animateStart()},_BindEvents:function(b,a){if(a)for(var c in a)if(a.hasOwnProperty(c))for(var d in a[c])a[c].hasOwnProperty(d)&&
jQuery(b).bind(d,a[c][d])},_Loader:function(){return function(){this._temp.setAttribute("id",this._parameters.id);this._temp.className=this._parameters.className;this._width=this._img.width;this._height=this._img.height;this._widthHalf=this._width/2;this._heightHalf=this._height/2;var b=Math.sqrt(this._height*this._height+this._width*this._width);this._widthAdd=b-this._width;this._heightAdd=b-this._height;this._widthAddHalf=this._widthAdd/2;this._heightAddHalf=this._heightAdd/2;this._img.parentNode.removeChild(this._img);
this._canvas=document.createElement("canvas");this._canvas.setAttribute("width",this._width);this._canvas.style.position="relative";this._canvas.style.left=-this._widthAddHalf+"px";this._canvas.style.top=-this._heightAddHalf+"px";this._canvas.Wilq32=this._temp.Wilq32;this._temp.appendChild(this._canvas);this._temp.style.width=this._width+"px";this._temp.style.height=this._height+"px";this._BindEvents(this._canvas,this._parameters.bind);this._cnv=this._canvas.getContext("2d");this._rotate(this._parameters.angle);
this._parameters.angle!=this._parameters.animateAngle&&this.rotateAnimation(this._parameters)}}(),_animateStart:function(){this._timer&&clearTimeout(this._timer);this._animate()},_animate:function(){var b=!!Math.round(this._angle*100-this._parameters.animateAngle*100)==0&&!!this._timer;this._parameters.callback&&b&&this._parameters.callback();if(b&&!this._parameters.animatedGif)clearTimeout(this._timer);else{if(this._canvas||this._vimage||this._img){this._angle-=(this._angle-this._parameters.animateAngle)*
0.1;if(typeof this._parameters.minAngle!="undefined")this._angle=Math.max(this._angle,this._parameters.minAngle);if(typeof this._parameters.maxAngle!="undefined")this._angle=Math.min(this._angle,this._parameters.maxAngle);this._rotate(~~(this._angle*10)/10)}var a=this;this._timer=setTimeout(function(){a._animate.call(a)},10)}},_rotate:function(){var b=Math.PI/180;return g?function(a){this._img.style[g]="rotate("+a+"deg)"}:function(a){if(!(!this._img.width||typeof a!="number")){a=a%360*b;this._canvas.width=
this._width+this._widthAdd;this._canvas.height=this._height+this._heightAdd;this._cnv.translate(this._widthAddHalf,this._heightAddHalf);this._cnv.translate(this._widthHalf,this._heightHalf);this._cnv.rotate(a);this._cnv.translate(-this._widthHalf,-this._heightHalf);this._cnv.drawImage(this._img,0,0)}}}()}})(jQuery);
