/*! ViewportResizer - v0.3.0 - 2013-10-28
* https://github.com/KaptinLin/ViewportResizer
* Copyright (c) 2013 amazingSurge; Licensed GPL */
!function(a,b,c,d){"use strict";function e(a){return("string"==typeof a||"number"==typeof a)&&!isNaN(a-0)&&""!==a}function f(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0}function g(a){return e(a)?a/2:"string"==typeof a&&"%"===a.charAt(a.length-1)?a.substr(0,a.length-1)/2+"%":void 0}function h(a){return"string"==typeof a&&"%"===a.charAt(a.length-1)?!0:!1}function i(){var a=jQuery('
"+"
"+"
"+"
"+"
").appendTo(l.optional.$container),l.optional.$width=l.optional.$custom.find("#optional_width"),l.optional.$height=l.optional.$custom.find("#optional_height"),l.optional.$add=l.optional.$custom.find("#optional_add"),l.optional.$saved=c("
").appendTo(l.optional.$container),l.optional.$container.appendTo(l.$optional)},activeMatch:function(a){var b=!1;return c(l.optional.$saved).children().each(function(){parseInt(c(this).data("width"),10)===a.width&&parseInt(c(this).data("height"),10)===a.height&&(c(this).attr("data-current","true"),c(this).siblings('[data-current="true"]').attr("data-current",null),b=!0)}),b},addToSaved:function(a){e(a.width)&&e(a.height)&&l.optional.activeMatch(a)===!1&&c("
Width: "+a.width+"
Height: "+a.height+"
").data("width",a.width).data("height",a.height).appendTo(l.optional.$saved).trigger("click")},active:function(a){c(a).attr("data-current","true"),c(a).siblings('[data-current="true"]').attr("data-current",null),j.$viewport.trigger("change",{viewport:"optional",dimensions:{width:parseInt(c(a).data("width"),10),height:parseInt(c(a).data("height"),10)}})},deactive:function(){l.optional.$saved.find('[data-current="true"]').attr("data-current",null)},bind:function(){l.$optional.hover(function(){l.$optional.attr("data-show","true"),e(j.current.width)&&l.optional.$width.val(j.current.width),e(j.current.height)&&l.optional.$height.val(j.current.height)},function(){l.$optional.attr("data-show","false")}),l.optional.$width.on("change",function(){e(this.value)&&(this.value
').addClass(v).appendTo(j.$viewport)},bind:function(){j.$viewport.delegate(j.$iframe,"resize",function(a,b){if("undefined"!=typeof b){var c={};"undefined"!=typeof b.width&&(c.width=j.settings.scrollbarInWidth||!e(b.width)?b.width:b.width+s,j.current.width=b.width),"undefined"!=typeof b.height&&(c.height=b.height,j.current.height=b.height),a.data.css(c)}}),j.$viewport.on("change",function(a,b){"undefined"!=typeof b&&"undefined"!=typeof b.target&&m.load(b.target)})},load:function(a){-1===a.search(/http(s){0,1}:\/\//)&&(a="http://"+a),j.$iframe.attr("src",a)}},q={init:function(){q.build(),q.bind()},build:function(){j.$info=c('
").addClass(y).appendTo(j.$viewport),j.$infoWidth=j.$info.find("."+y+"-width ."+y+"-value"),j.$infoHeight=j.$info.find("."+y+"-height ."+y+"-value")},bind:function(){j.$viewport.delegate(j.$info,"resize",function(a,b){if("undefined"!=typeof b){var c={};"undefined"!=typeof b.width&&(c.marginLeft=g(b.width),j.$infoWidth.text(b.width)),"undefined"!=typeof b.height&&(c.top=b.height,j.$infoHeight.text(b.height)),a.data.css(c)}})}},p={init:function(){p.build(),p.bind()},build:function(){j.$axis=c("
").addClass(x),j.$axisX=c("
").addClass(x+"-x").prependTo(j.$axis),j.$axisY=c("
").addClass(x+"-y").prependTo(j.$axis),j.$axis.prependTo(j.$viewport)},bind:function(){j.$viewport.delegate(j.$axisX,"resize",function(a,b){if("undefined"!=typeof b&&"undefined"!=typeof b.width){var c=b.width;j.settings.scrollbarInWidth&&e(b.width)||(c=b.width+s),a.data.css({marginLeft:g(c)})}}),j.$viewport.delegate(j.$axisY,"resize",function(a,b){"undefined"!=typeof b&&"undefined"!=typeof b.height&&a.data.css({top:b.height})})}},o={init:function(){o.build(),o.bind()},build:function(){j.$resizable=c("
").addClass(w),j.$resizableX=c("
").addClass(w+"-x").prependTo(j.$resizable),j.$resizableY=c("
").addClass(w+"-y").prependTo(j.$resizable),j.$resizableXY=c("
").addClass(w+"-xy").prependTo(j.$resizable),j.$resizable.appendTo(j.$viewport)},bind:function(){j.$viewport.delegate(j.$resizable,"resize",function(a,b){if("undefined"!=typeof b){var c={};if("undefined"!=typeof b.width){var d=b.width;h(d)||j.settings.scrollbarInWidth&&e(b.width)||(d=b.width+s),c.width=d,c.marginLeft=g("-"+d)}"undefined"!=typeof b.height&&(c.height=b.height),a.data.css(c)}}),j.$resizableX.drag("start",function(a,b){b.width=j.current.width,j.$viewport.attr("data-resizing","onx")}).drag(function(a,b){j.$viewport.trigger("resize",{width:Math.max(j.settings.min.width,b.width+2*parseInt(b.deltaX,10))})}).drag("dragend",function(){j.$viewport.attr("data-resizing",null)}),j.$resizableY.drag("start",function(a,b){b.height=j.current.height,j.$viewport.attr("data-resizing","ony")}).drag(function(a,b){j.$viewport.trigger("resize",{height:Math.max(j.settings.min.height,b.height+parseInt(b.deltaY,10))})}).drag("dragend",function(){j.$viewport.attr("data-resizing",null)}),j.$resizableXY.drag("start",function(a,b){b.width=j.current.width,b.height=j.current.height,j.$viewport.attr("data-resizing","onxy")}).drag(function(a,b){j.$viewport.trigger("resize",{width:Math.max(j.settings.min.width,b.width+2*parseInt(b.deltaX,10)),height:Math.max(j.settings.min.height,b.height+parseInt(b.deltaY,10))})}).drag("dragend",function(){j.$viewport.attr("data-resizing",null)})}},d()};j.settings={viewport:"auto",target:d,dimensions:{},components:{history:!0,inputer:!0,switcher:!0,iframe:!0,resizable:!0,axis:!0,info:!0},namespace:"resizer",container:{switcher:"header",inputer:"header",viewport:"article"},viewports:{auto:{width:"100%",height:"100%",description:"Auto"},optional:{description:"Optional"},mobile:{width:320,height:480,description:"Mobile"},tablet:{width:480,height:640,description:"Tablet"},notebook:{width:768,height:1024,description:"Notebook"},desktop:{width:1200,height:800,description:"Desktop"}},min:{width:240,height:320},step:5,inputerPlaceholder:"Type your url here",scrollbarInWidth:!0},j.getIframe=function(){return j.$iframe},j.addViewport=function(a,b){j.viewports.slug=b},j.go=function(a){j.$viewport.trigger("change",{target:a})},j.use=function(a){j.$viewport.trigger("change",{viewport:a})},j.change=function(a){j.$viewport.trigger("change",a)},j.resize=function(a){j.$viewport.trigger("resize",a)},j.resizeWidth=function(a){j.$viewport.trigger("resize",{width:a})},j.resizeHeight=function(a){j.$viewport.trigger("resize",{height:a})}}(window,document,jQuery),function(a,b){b.fn.autoGrowInput=function(a){return a=b.extend({maxWidth:1e3,minWidth:0,comfortZone:70},a),this.filter("input:text").each(function(){var c=a.minWidth||b(this).width(),d="",e=b(this),f=b("
").css({position:"absolute",top:-9999,left:-9999,width:"auto",fontSize:e.css("fontSize"),fontFamily:e.css("fontFamily"),fontWeight:e.css("fontWeight"),letterSpacing:e.css("letterSpacing"),whiteSpace:"nowrap"}),g=function(){if(d!==(d=e.val())){var b=d.replace(/&/g,"&").replace(/\s/g," ").replace(//g,">");f.html(b);var g=f.width(),h=g+a.comfortZone>=c?g+a.comfortZone:c,i=e.width(),j=i>h&&h>=c||h>c&&h