Content-Type: multipart/related; start=; boundary=----------yLsh28qWOSrurz6bIywB5L Content-Location: http://www.frasedehoy.com/frase/332/dos-cosas-son-infinitas-el-universo-y-la-estupidez-humana-y-yo-no-estoy-seg Subject: =?utf-8?Q?Dos=20cosas=20son=20infinitas:=20el=20universo=20y=20la=20estupidez=20humana;=20y=20yo=20no=20estoy=20seguro=20sobre=20el=20universo=20::=20Frasedehoy.com=20(P=C3=A1gina=201)?= MIME-Version: 1.0 ------------yLsh28qWOSrurz6bIywB5L Content-Disposition: inline; filename*0="dos-cosas-son-infinitas-el-universo-y-la"; filename*1="-estupidez-humana-y-yo-no-estoy-seg.htm" Content-Type: text/html; charset=utf-8; name*0="dos-cosas-son-infinitas-el-universo-y-la"; name*1="-estupidez-humana-y-yo-no-estoy-seg.htm" Content-ID: Content-Location: http://www.frasedehoy.com/frase/332/dos-cosas-son-infinitas-el-universo-y-la-estupidez-humana-y-yo-no-estoy-seg Content-Transfer-Encoding: 8bit Dos cosas son infinitas: el universo y la estupidez humana; y yo no estoy seguro sobre el universo :: Frasedehoy.com (Página 1)

Visor de Frase

"Dos cosas son infinitas: el universo y la estupidez humana; y yo no estoy seguro sobre el universo"

Albert Einstein

4,43
Compartir


Comentarios para esta frase

Jpablob

Totalmente de acuerdo

Realmente es admirable lo tontos que podemos llegar a ser o actuar en determinados momentos...


Juanma22

Adhiero a esta frase

En los tiempo que corren queda mas que claro que lo unico infinito es la estupidez humana que engendra todos los males de que es capaz el hombre. Dia a dia esta frase se ve reflejada en los actos humanos que perjudican a millones de personas


Tau

Si es cierto, peeeroo...

Somos seres humanos y nos inclinamos ante la inteligencia de los grandes genios de la historia, sin saber que ellos tambien tenian estupidez, porque eran seres humanos, por mas que usaran el 4% del cerebro(Beethoven), tuviese los dos lobulos cerebrales conectados(Einstein) o lo que sea...
tau


Seren

Bien

Hasta que alguien lo describe con palabras


Air_fredd

Ciertamente, uno de los grandes....

Ciertamente la estupidez de los seres humanos no tiene fin, pero solo por el hecho de que nos dejamos guiar por nuestros sentimientos puramente "humanos", y si no nos damos cuenta, siempre seremos estupidos. AHH. respecto a un comentario hecho: La frase dice una verdad, y ante la verdad todos nos inclinamos, solo admiramos a quien pudo decirla.


Keke930

Es verdad

yo creo en lo del universo y en lo de la estupidez humana son dos cosas muy distintas pero ciertas


OmarS

Estupidez humana

Tomando en cuenta de q esto lo dijo un estupido no lo puedo tomar como cierto... y no es q crea q Albert Einstein sea un estupido sino q el asi se califica con esta frase.


Evangelion

Exacto!!!

Esta frase; en verdad es en lo unico que estoy segura de esta maldita "humanidad" y tambien no estoy segura del universo, "maldito" enigma que no me deja ni me mata. A y por cierto, a quien le quedo el saco jeje.


Quan-tum

Bueno

Bueno... alla el...
¿Que creyo que hay afuera del universo?... estupidez humana???.... por que si el universo no continua y la estupidez si entonces quien llege mas halla del universo se va a encontrar con la estupidez... 8-))))
Ademas no creo que los humanos seamos estupidos, creo que solo somos jovenes...


Mblancarosa

Tan infinitas como ciertas...

La estupidez del ser humano, es una condicion innata de algunos, y no se necesita ser joven o viejos para cumplir con esta condicion... y de lo que si estoy segura es que el universo es magestuoso y perfecto, no podria ser de otra manera.


Mostrando 1-10 de 38


------------yLsh28qWOSrurz6bIywB5L Content-Disposition: inline; filename=css.css Content-Type: text/css; name=css.css Content-Location: http://fonts.googleapis.com/css?family=PT+Sans+Narrow:400,700 Content-Transfer-Encoding: 8bit @font-face { font-family: 'PT Sans Narrow'; font-style: normal; font-weight: 400; src: local('PT Sans Narrow'), local('PTSans-Narrow'), url(http://fonts.gstatic.com/s/ptsansnarrow/v7/UyYrYy3ltEffJV9QueSi4RdbPw3QSf9R-kE0EsQUn2A.woff) format('woff'); } @font-face { font-family: 'PT Sans Narrow'; font-style: normal; font-weight: 700; src: local('PT Sans Narrow Bold'), local('PTSans-NarrowBold'), url(http://fonts.gstatic.com/s/ptsansnarrow/v7/Q_pTky3Sc3ubRibGToTAYiylde52zikAzebNtJS89aM.woff) format('woff'); } ------------yLsh28qWOSrurz6bIywB5L Content-Disposition: inline; filename=bootstrap.min.css Content-Type: text/css; name=bootstrap.min.css Content-Location: http://www.frasedehoy.com/css/bootstrap.min.css?v=20140307 Content-Transfer-Encoding: 8bit /*! * Bootstrap v3.1.1 (http://getbootstrap.com) * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ /*! normalize.css v3.0.0 | MIT License | git.io/normalize */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background:0 0}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}@media print{*{text-shadow:none!important;color:#000!important;background:transparent!important;box-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100%!important}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}select{background:#fff!important}.navbar{display:none}.table td,.table th{background-color:#fff!important}.btn>.caret,.dropup>.btn>.caret{border-top-color:#000!important}.label{border:1px solid #000}.table{border-collapse:collapse!important}.table-bordered th,.table-bordered td{border:1px solid #ddd!important}}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}:before,:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:62.5%;-webkit-tap-highlight-color:rgba(0,0,0,0)}body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.42857143;color:#333;background-color:#fff}input,button,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit}a{color:#428bca;text-decoration:none}a:hover,a:focus{color:#2a6496;text-decoration:underline}a:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}figure{margin:0}img{vertical-align:middle}.img-responsive,.thumbnail>img,.thumbnail a>img,.carousel-inner>.item>img,.carousel-inner>.item>a>img{display:block;max-width:100%;height:auto}.img-rounded{border-radius:6px}.img-thumbnail{padding:4px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out;display:inline-block;max-width:100%;height:auto}.img-circle{border-radius:50%}hr{margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);border:0}h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6{font-family:inherit;font-weight:500;line-height:1.1;color:inherit}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small,.h1 small,.h2 small,.h3 small,.h4 small,.h5 small,.h6 small,h1 .small,h2 .small,h3 .small,h4 .small,h5 .small,h6 .small,.h1 .small,.h2 .small,.h3 .small,.h4 .small,.h5 .small,.h6 .small{font-weight:400;line-height:1;color:#999}h1,.h1,h2,.h2,h3,.h3{margin-top:20px;margin-bottom:10px}h1 small,.h1 small,h2 small,.h2 small,h3 small,.h3 small,h1 .small,.h1 .small,h2 .small,.h2 .small,h3 .small,.h3 .small{font-size:65%}h4,.h4,h5,.h5,h6,.h6{margin-top:10px;margin-bottom:10px}h4 small,.h4 small,h5 small,.h5 small,h6 small,.h6 small,h4 .small,.h4 .small,h5 .small,.h5 .small,h6 .small,.h6 .small{font-size:75%}h1,.h1{font-size:36px}h2,.h2{font-size:30px}h3,.h3{font-size:24px}h4,.h4{font-size:18px}h5,.h5{font-size:14px}h6,.h6{font-size:12px}p{margin:0 0 10px}.lead{margin-bottom:20px;font-size:16px;font-weight:200;line-height:1.4}@media (min-width:768px){.lead{font-size:21px}}small,.small{font-size:85%}cite{font-style:normal}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}.text-justify{text-align:justify}.text-muted{color:#999}.text-primary{color:#428bca}a.text-primary:hover{color:#3071a9}.text-success{color:#3c763d}a.text-success:hover{color:#2b542c}.text-info{color:#31708f}a.text-info:hover{color:#245269}.text-warning{color:#8a6d3b}a.text-warning:hover{color:#66512c}.text-danger{color:#a94442}a.text-danger:hover{color:#843534}.bg-primary{color:#fff;background-color:#428bca}a.bg-primary:hover{background-color:#3071a9}.bg-success{background-color:#dff0d8}a.bg-success:hover{background-color:#c1e2b3}.bg-info{background-color:#d9edf7}a.bg-info:hover{background-color:#afd9ee}.bg-warning{background-color:#fcf8e3}a.bg-warning:hover{background-color:#f7ecb5}.bg-danger{background-color:#f2dede}a.bg-danger:hover{background-color:#e4b9b9}.page-header{padding-bottom:9px;margin:40px 0 20px;border-bottom:1px solid #eee}ul,ol{margin-top:0;margin-bottom:10px}ul ul,ol ul,ul ol,ol ol{margin-bottom:0}.list-unstyled{padding-left:0;list-style:none}.list-inline{padding-left:0;list-style:none;margin-left:-5px}.list-inline>li{display:inline-block;padding-left:5px;padding-right:5px}dl{margin-top:0;margin-bottom:20px}dt,dd{line-height:1.42857143}dt{font-weight:700}dd{margin-left:0}@media (min-width:768px){.dl-horizontal dt{float:left;width:160px;clear:left;text-align:right;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}}abbr[title],abbr[data-original-title]{cursor:help;border-bottom:1px dotted #999}.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:10px 20px;margin:0 0 20px;font-size:17.5px;border-left:5px solid #eee}blockquote p:last-child,blockquote ul:last-child,blockquote ol:last-child{margin-bottom:0}blockquote footer,blockquote small,blockquote .small{display:block;font-size:80%;line-height:1.42857143;color:#999}blockquote footer:before,blockquote small:before,blockquote .small:before{content:'\2014 \00A0'}.blockquote-reverse,blockquote.pull-right{padding-right:15px;padding-left:0;border-right:5px solid #eee;border-left:0;text-align:right}.blockquote-reverse footer:before,blockquote.pull-right footer:before,.blockquote-reverse small:before,blockquote.pull-right small:before,.blockquote-reverse .small:before,blockquote.pull-right .small:before{content:''}.blockquote-reverse footer:after,blockquote.pull-right footer:after,.blockquote-reverse small:after,blockquote.pull-right small:after,.blockquote-reverse .small:after,blockquote.pull-right .small:after{content:'\00A0 \2014'}blockquote:before,blockquote:after{content:""}address{margin-bottom:20px;font-style:normal;line-height:1.42857143}code,kbd,pre,samp{font-family:Menlo,Monaco,Consolas,"Courier New",monospace}code{padding:2px 4px;font-size:90%;color:#c7254e;background-color:#f9f2f4;white-space:nowrap;border-radius:4px}kbd{padding:2px 4px;font-size:90%;color:#fff;background-color:#333;border-radius:3px;box-shadow:inset 0 -1px 0 rgba(0,0,0,.25)}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:1.42857143;word-break:break-all;word-wrap:break-word;color:#333;background-color:#f5f5f5;border:1px solid #ccc;border-radius:4px}pre code{padding:0;font-size:inherit;color:inherit;white-space:pre-wrap;background-color:transparent;border-radius:0}.pre-scrollable{max-height:340px;overflow-y:scroll}.container{margin-right:auto;margin-left:auto;padding-left:15px;padding-right:15px}@media (min-width:768px){.container{width:750px}}@media (min-width:992px){.container{width:970px}}@media (min-width:1200px){.container{width:1170px}}.container-fluid{margin-right:auto;margin-left:auto;padding-left:15px;padding-right:15px}.row{margin-left:-15px;margin-right:-15px}.col-xs-1,.col-sm-1,.col-md-1,.col-lg-1,.col-xs-2,.col-sm-2,.col-md-2,.col-lg-2,.col-xs-3,.col-sm-3,.col-md-3,.col-lg-3,.col-xs-4,.col-sm-4,.col-md-4,.col-lg-4,.col-xs-5,.col-sm-5,.col-md-5,.col-lg-5,.col-xs-6,.col-sm-6,.col-md-6,.col-lg-6,.col-xs-7,.col-sm-7,.col-md-7,.col-lg-7,.col-xs-8,.col-sm-8,.col-md-8,.col-lg-8,.col-xs-9,.col-sm-9,.col-md-9,.col-lg-9,.col-xs-10,.col-sm-10,.col-md-10,.col-lg-10,.col-xs-11,.col-sm-11,.col-md-11,.col-lg-11,.col-xs-12,.col-sm-12,.col-md-12,.col-lg-12{position:relative;min-height:1px;padding-left:15px;padding-right:15px}.col-xs-1,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9,.col-xs-10,.col-xs-11,.col-xs-12{float:left}.col-xs-12{width:100%}.col-xs-11{width:91.66666667%}.col-xs-10{width:83.33333333%}.col-xs-9{width:75%}.col-xs-8{width:66.66666667%}.col-xs-7{width:58.33333333%}.col-xs-6{width:50%}.col-xs-5{width:41.66666667%}.col-xs-4{width:33.33333333%}.col-xs-3{width:25%}.col-xs-2{width:16.66666667%}.col-xs-1{width:8.33333333%}.col-xs-pull-12{right:100%}.col-xs-pull-11{right:91.66666667%}.col-xs-pull-10{right:83.33333333%}.col-xs-pull-9{right:75%}.col-xs-pull-8{right:66.66666667%}.col-xs-pull-7{right:58.33333333%}.col-xs-pull-6{right:50%}.col-xs-pull-5{right:41.66666667%}.col-xs-pull-4{right:33.33333333%}.col-xs-pull-3{right:25%}.col-xs-pull-2{right:16.66666667%}.col-xs-pull-1{right:8.33333333%}.col-xs-pull-0{right:0}.col-xs-push-12{left:100%}.col-xs-push-11{left:91.66666667%}.col-xs-push-10{left:83.33333333%}.col-xs-push-9{left:75%}.col-xs-push-8{left:66.66666667%}.col-xs-push-7{left:58.33333333%}.col-xs-push-6{left:50%}.col-xs-push-5{left:41.66666667%}.col-xs-push-4{left:33.33333333%}.col-xs-push-3{left:25%}.col-xs-push-2{left:16.66666667%}.col-xs-push-1{left:8.33333333%}.col-xs-push-0{left:0}.col-xs-offset-12{margin-left:100%}.col-xs-offset-11{margin-left:91.66666667%}.col-xs-offset-10{margin-left:83.33333333%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-8{margin-left:66.66666667%}.col-xs-offset-7{margin-left:58.33333333%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-5{margin-left:41.66666667%}.col-xs-offset-4{margin-left:33.33333333%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-2{margin-left:16.66666667%}.col-xs-offset-1{margin-left:8.33333333%}.col-xs-offset-0{margin-left:0}@media (min-width:768px){.col-sm-1,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-sm-10,.col-sm-11,.col-sm-12{float:left}.col-sm-12{width:100%}.col-sm-11{width:91.66666667%}.col-sm-10{width:83.33333333%}.col-sm-9{width:75%}.col-sm-8{width:66.66666667%}.col-sm-7{width:58.33333333%}.col-sm-6{width:50%}.col-sm-5{width:41.66666667%}.col-sm-4{width:33.33333333%}.col-sm-3{width:25%}.col-sm-2{width:16.66666667%}.col-sm-1{width:8.33333333%}.col-sm-pull-12{right:100%}.col-sm-pull-11{right:91.66666667%}.col-sm-pull-10{right:83.33333333%}.col-sm-pull-9{right:75%}.col-sm-pull-8{right:66.66666667%}.col-sm-pull-7{right:58.33333333%}.col-sm-pull-6{right:50%}.col-sm-pull-5{right:41.66666667%}.col-sm-pull-4{right:33.33333333%}.col-sm-pull-3{right:25%}.col-sm-pull-2{right:16.66666667%}.col-sm-pull-1{right:8.33333333%}.col-sm-pull-0{right:0}.col-sm-push-12{left:100%}.col-sm-push-11{left:91.66666667%}.col-sm-push-10{left:83.33333333%}.col-sm-push-9{left:75%}.col-sm-push-8{left:66.66666667%}.col-sm-push-7{left:58.33333333%}.col-sm-push-6{left:50%}.col-sm-push-5{left:41.66666667%}.col-sm-push-4{left:33.33333333%}.col-sm-push-3{left:25%}.col-sm-push-2{left:16.66666667%}.col-sm-push-1{left:8.33333333%}.col-sm-push-0{left:0}.col-sm-offset-12{margin-left:100%}.col-sm-offset-11{margin-left:91.66666667%}.col-sm-offset-10{margin-left:83.33333333%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-8{margin-left:66.66666667%}.col-sm-offset-7{margin-left:58.33333333%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-5{margin-left:41.66666667%}.col-sm-offset-4{margin-left:33.33333333%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-2{margin-left:16.66666667%}.col-sm-offset-1{margin-left:8.33333333%}.col-sm-offset-0{margin-left:0}}@media (min-width:992px){.col-md-1,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-md-10,.col-md-11,.col-md-12{float:left}.col-md-12{width:100%}.col-md-11{width:91.66666667%}.col-md-10{width:83.33333333%}.col-md-9{width:75%}.col-md-8{width:66.66666667%}.col-md-7{width:58.33333333%}.col-md-6{width:50%}.col-md-5{width:41.66666667%}.col-md-4{width:33.33333333%}.col-md-3{width:25%}.col-md-2{width:16.66666667%}.col-md-1{width:8.33333333%}.col-md-pull-12{right:100%}.col-md-pull-11{right:91.66666667%}.col-md-pull-10{right:83.33333333%}.col-md-pull-9{right:75%}.col-md-pull-8{right:66.66666667%}.col-md-pull-7{right:58.33333333%}.col-md-pull-6{right:50%}.col-md-pull-5{right:41.66666667%}.col-md-pull-4{right:33.33333333%}.col-md-pull-3{right:25%}.col-md-pull-2{right:16.66666667%}.col-md-pull-1{right:8.33333333%}.col-md-pull-0{right:0}.col-md-push-12{left:100%}.col-md-push-11{left:91.66666667%}.col-md-push-10{left:83.33333333%}.col-md-push-9{left:75%}.col-md-push-8{left:66.66666667%}.col-md-push-7{left:58.33333333%}.col-md-push-6{left:50%}.col-md-push-5{left:41.66666667%}.col-md-push-4{left:33.33333333%}.col-md-push-3{left:25%}.col-md-push-2{left:16.66666667%}.col-md-push-1{left:8.33333333%}.col-md-push-0{left:0}.col-md-offset-12{margin-left:100%}.col-md-offset-11{margin-left:91.66666667%}.col-md-offset-10{margin-left:83.33333333%}.col-md-offset-9{margin-left:75%}.col-md-offset-8{margin-left:66.66666667%}.col-md-offset-7{margin-left:58.33333333%}.col-md-offset-6{margin-left:50%}.col-md-offset-5{margin-left:41.66666667%}.col-md-offset-4{margin-left:33.33333333%}.col-md-offset-3{margin-left:25%}.col-md-offset-2{margin-left:16.66666667%}.col-md-offset-1{margin-left:8.33333333%}.col-md-offset-0{margin-left:0}}@media (min-width:1200px){.col-lg-1,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-lg-10,.col-lg-11,.col-lg-12{float:left}.col-lg-12{width:100%}.col-lg-11{width:91.66666667%}.col-lg-10{width:83.33333333%}.col-lg-9{width:75%}.col-lg-8{width:66.66666667%}.col-lg-7{width:58.33333333%}.col-lg-6{width:50%}.col-lg-5{width:41.66666667%}.col-lg-4{width:33.33333333%}.col-lg-3{width:25%}.col-lg-2{width:16.66666667%}.col-lg-1{width:8.33333333%}.col-lg-pull-12{right:100%}.col-lg-pull-11{right:91.66666667%}.col-lg-pull-10{right:83.33333333%}.col-lg-pull-9{right:75%}.col-lg-pull-8{right:66.66666667%}.col-lg-pull-7{right:58.33333333%}.col-lg-pull-6{right:50%}.col-lg-pull-5{right:41.66666667%}.col-lg-pull-4{right:33.33333333%}.col-lg-pull-3{right:25%}.col-lg-pull-2{right:16.66666667%}.col-lg-pull-1{right:8.33333333%}.col-lg-pull-0{right:0}.col-lg-push-12{left:100%}.col-lg-push-11{left:91.66666667%}.col-lg-push-10{left:83.33333333%}.col-lg-push-9{left:75%}.col-lg-push-8{left:66.66666667%}.col-lg-push-7{left:58.33333333%}.col-lg-push-6{left:50%}.col-lg-push-5{left:41.66666667%}.col-lg-push-4{left:33.33333333%}.col-lg-push-3{left:25%}.col-lg-push-2{left:16.66666667%}.col-lg-push-1{left:8.33333333%}.col-lg-push-0{left:0}.col-lg-offset-12{margin-left:100%}.col-lg-offset-11{margin-left:91.66666667%}.col-lg-offset-10{margin-left:83.33333333%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-8{margin-left:66.66666667%}.col-lg-offset-7{margin-left:58.33333333%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-5{margin-left:41.66666667%}.col-lg-offset-4{margin-left:33.33333333%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-2{margin-left:16.66666667%}.col-lg-offset-1{margin-left:8.33333333%}.col-lg-offset-0{margin-left:0}}table{max-width:100%;background-color:transparent}th{text-align:left}.table{width:100%;margin-bottom:20px}.table>thead>tr>th,.table>tbody>tr>th,.table>tfoot>tr>th,.table>thead>tr>td,.table>tbody>tr>td,.table>tfoot>tr>td{padding:8px;line-height:1.42857143;vertical-align:top;border-top:1px solid #ddd}.table>thead>tr>th{vertical-align:bottom;border-bottom:2px solid #ddd}.table>caption+thead>tr:first-child>th,.table>colgroup+thead>tr:first-child>th,.table>thead:first-child>tr:first-child>th,.table>caption+thead>tr:first-child>td,.table>colgroup+thead>tr:first-child>td,.table>thead:first-child>tr:first-child>td{border-top:0}.table>tbody+tbody{border-top:2px solid #ddd}.table .table{background-color:#fff}.table-condensed>thead>tr>th,.table-condensed>tbody>tr>th,.table-condensed>tfoot>tr>th,.table-condensed>thead>tr>td,.table-condensed>tbody>tr>td,.table-condensed>tfoot>tr>td{padding:5px}.table-bordered{border:1px solid #ddd}.table-bordered>thead>tr>th,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>tbody>tr>td,.table-bordered>tfoot>tr>td{border:1px solid #ddd}.table-bordered>thead>tr>th,.table-bordered>thead>tr>td{border-bottom-width:2px}.table-striped>tbody>tr:nth-child(odd)>td,.table-striped>tbody>tr:nth-child(odd)>th{background-color:#f9f9f9}.table-hover>tbody>tr:hover>td,.table-hover>tbody>tr:hover>th{background-color:#f5f5f5}table col[class*=col-]{position:static;float:none;display:table-column}table td[class*=col-],table th[class*=col-]{position:static;float:none;display:table-cell}.table>thead>tr>td.active,.table>tbody>tr>td.active,.table>tfoot>tr>td.active,.table>thead>tr>th.active,.table>tbody>tr>th.active,.table>tfoot>tr>th.active,.table>thead>tr.active>td,.table>tbody>tr.active>td,.table>tfoot>tr.active>td,.table>thead>tr.active>th,.table>tbody>tr.active>th,.table>tfoot>tr.active>th{background-color:#f5f5f5}.table-hover>tbody>tr>td.active:hover,.table-hover>tbody>tr>th.active:hover,.table-hover>tbody>tr.active:hover>td,.table-hover>tbody>tr.active:hover>th{background-color:#e8e8e8}.table>thead>tr>td.success,.table>tbody>tr>td.success,.table>tfoot>tr>td.success,.table>thead>tr>th.success,.table>tbody>tr>th.success,.table>tfoot>tr>th.success,.table>thead>tr.success>td,.table>tbody>tr.success>td,.table>tfoot>tr.success>td,.table>thead>tr.success>th,.table>tbody>tr.success>th,.table>tfoot>tr.success>th{background-color:#dff0d8}.table-hover>tbody>tr>td.success:hover,.table-hover>tbody>tr>th.success:hover,.table-hover>tbody>tr.success:hover>td,.table-hover>tbody>tr.success:hover>th{background-color:#d0e9c6}.table>thead>tr>td.info,.table>tbody>tr>td.info,.table>tfoot>tr>td.info,.table>thead>tr>th.info,.table>tbody>tr>th.info,.table>tfoot>tr>th.info,.table>thead>tr.info>td,.table>tbody>tr.info>td,.table>tfoot>tr.info>td,.table>thead>tr.info>th,.table>tbody>tr.info>th,.table>tfoot>tr.info>th{background-color:#d9edf7}.table-hover>tbody>tr>td.info:hover,.table-hover>tbody>tr>th.info:hover,.table-hover>tbody>tr.info:hover>td,.table-hover>tbody>tr.info:hover>th{background-color:#c4e3f3}.table>thead>tr>td.warning,.table>tbody>tr>td.warning,.table>tfoot>tr>td.warning,.table>thead>tr>th.warning,.table>tbody>tr>th.warning,.table>tfoot>tr>th.warning,.table>thead>tr.warning>td,.table>tbody>tr.warning>td,.table>tfoot>tr.warning>td,.table>thead>tr.warning>th,.table>tbody>tr.warning>th,.table>tfoot>tr.warning>th{background-color:#fcf8e3}.table-hover>tbody>tr>td.warning:hover,.table-hover>tbody>tr>th.warning:hover,.table-hover>tbody>tr.warning:hover>td,.table-hover>tbody>tr.warning:hover>th{background-color:#faf2cc}.table>thead>tr>td.danger,.table>tbody>tr>td.danger,.table>tfoot>tr>td.danger,.table>thead>tr>th.danger,.table>tbody>tr>th.danger,.table>tfoot>tr>th.danger,.table>thead>tr.danger>td,.table>tbody>tr.danger>td,.table>tfoot>tr.danger>td,.table>thead>tr.danger>th,.table>tbody>tr.danger>th,.table>tfoot>tr.danger>th{background-color:#f2dede}.table-hover>tbody>tr>td.danger:hover,.table-hover>tbody>tr>th.danger:hover,.table-hover>tbody>tr.danger:hover>td,.table-hover>tbody>tr.danger:hover>th{background-color:#ebcccc}@media (max-width:767px){.table-responsive{width:100%;margin-bottom:15px;overflow-y:hidden;overflow-x:scroll;-ms-overflow-style:-ms-autohiding-scrollbar;border:1px solid #ddd;-webkit-overflow-scrolling:touch}.table-responsive>.table{margin-bottom:0}.table-responsive>.table>thead>tr>th,.table-responsive>.table>tbody>tr>th,.table-responsive>.table>tfoot>tr>th,.table-responsive>.table>thead>tr>td,.table-responsive>.table>tbody>tr>td,.table-responsive>.table>tfoot>tr>td{white-space:nowrap}.table-responsive>.table-bordered{border:0}.table-responsive>.table-bordered>thead>tr>th:first-child,.table-responsive>.table-bordered>tbody>tr>th:first-child,.table-responsive>.table-bordered>tfoot>tr>th:first-child,.table-responsive>.table-bordered>thead>tr>td:first-child,.table-responsive>.table-bordered>tbody>tr>td:first-child,.table-responsive>.table-bordered>tfoot>tr>td:first-child{border-left:0}.table-responsive>.table-bordered>thead>tr>th:last-child,.table-responsive>.table-bordered>tbody>tr>th:last-child,.table-responsive>.table-bordered>tfoot>tr>th:last-child,.table-responsive>.table-bordered>thead>tr>td:last-child,.table-responsive>.table-bordered>tbody>tr>td:last-child,.table-responsive>.table-bordered>tfoot>tr>td:last-child{border-right:0}.table-responsive>.table-bordered>tbody>tr:last-child>th,.table-responsive>.table-bordered>tfoot>tr:last-child>th,.table-responsive>.table-bordered>tbody>tr:last-child>td,.table-responsive>.table-bordered>tfoot>tr:last-child>td{border-bottom:0}}fieldset{padding:0;margin:0;border:0;min-width:0}legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:inherit;color:#333;border:0;border-bottom:1px solid #e5e5e5}label{display:inline-block;margin-bottom:5px;font-weight:700}input[type=search]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type=radio],input[type=checkbox]{margin:4px 0 0;margin-top:1px \9;line-height:normal}input[type=file]{display:block}input[type=range]{display:block;width:100%}select[multiple],select[size]{height:auto}input[type=file]:focus,input[type=radio]:focus,input[type=checkbox]:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}output{display:block;padding-top:7px;font-size:14px;line-height:1.42857143;color:#555}.form-control{display:block;width:100%;height:34px;padding:6px 12px;font-size:14px;line-height:1.42857143;color:#555;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-webkit-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.form-control::-moz-placeholder{color:#999;opacity:1}.form-control:-ms-input-placeholder{color:#999}.form-control::-webkit-input-placeholder{color:#999}.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{cursor:not-allowed;background-color:#eee;opacity:1}textarea.form-control{height:auto}input[type=search]{-webkit-appearance:none}input[type=date]{line-height:34px}.form-group{margin-bottom:15px}.radio,.checkbox{display:block;min-height:20px;margin-top:10px;margin-bottom:10px;padding-left:20px}.radio label,.checkbox label{display:inline;font-weight:400;cursor:pointer}.radio input[type=radio],.radio-inline input[type=radio],.checkbox input[type=checkbox],.checkbox-inline input[type=checkbox]{float:left;margin-left:-20px}.radio+.radio,.checkbox+.checkbox{margin-top:-5px}.radio-inline,.checkbox-inline{display:inline-block;padding-left:20px;margin-bottom:0;vertical-align:middle;font-weight:400;cursor:pointer}.radio-inline+.radio-inline,.checkbox-inline+.checkbox-inline{margin-top:0;margin-left:10px}input[type=radio][disabled],input[type=checkbox][disabled],.radio[disabled],.radio-inline[disabled],.checkbox[disabled],.checkbox-inline[disabled],fieldset[disabled] input[type=radio],fieldset[disabled] input[type=checkbox],fieldset[disabled] .radio,fieldset[disabled] .radio-inline,fieldset[disabled] .checkbox,fieldset[disabled] .checkbox-inline{cursor:not-allowed}.input-sm{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-sm{height:30px;line-height:30px}textarea.input-sm,select[multiple].input-sm{height:auto}.input-lg{height:46px;padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}select.input-lg{height:46px;line-height:46px}textarea.input-lg,select[multiple].input-lg{height:auto}.has-feedback{position:relative}.has-feedback .form-control{padding-right:42.5px}.has-feedback .form-control-feedback{position:absolute;top:25px;right:0;display:block;width:34px;height:34px;line-height:34px;text-align:center}.has-success .help-block,.has-success .control-label,.has-success .radio,.has-success .checkbox,.has-success .radio-inline,.has-success .checkbox-inline{color:#3c763d}.has-success .form-control{border-color:#3c763d;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-success .form-control:focus{border-color:#2b542c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168}.has-success .input-group-addon{color:#3c763d;border-color:#3c763d;background-color:#dff0d8}.has-success .form-control-feedback{color:#3c763d}.has-warning .help-block,.has-warning .control-label,.has-warning .radio,.has-warning .checkbox,.has-warning .radio-inline,.has-warning .checkbox-inline{color:#8a6d3b}.has-warning .form-control{border-color:#8a6d3b;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-warning .form-control:focus{border-color:#66512c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b}.has-warning .input-group-addon{color:#8a6d3b;border-color:#8a6d3b;background-color:#fcf8e3}.has-warning .form-control-feedback{color:#8a6d3b}.has-error .help-block,.has-error .control-label,.has-error .radio,.has-error .checkbox,.has-error .radio-inline,.has-error .checkbox-inline{color:#a94442}.has-error .form-control{border-color:#a94442;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-error .form-control:focus{border-color:#843534;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483}.has-error .input-group-addon{color:#a94442;border-color:#a94442;background-color:#f2dede}.has-error .form-control-feedback{color:#a94442}.form-control-static{margin-bottom:0}.help-block{display:block;margin-top:5px;margin-bottom:10px;color:#737373}@media (min-width:768px){.form-inline .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.form-inline .form-control{display:inline-block;width:auto;vertical-align:middle}.form-inline .input-group>.form-control{width:100%}.form-inline .control-label{margin-bottom:0;vertical-align:middle}.form-inline .radio,.form-inline .checkbox{display:inline-block;margin-top:0;margin-bottom:0;padding-left:0;vertical-align:middle}.form-inline .radio input[type=radio],.form-inline .checkbox input[type=checkbox]{float:none;margin-left:0}.form-inline .has-feedback .form-control-feedback{top:0}}.form-horizontal .control-label,.form-horizontal .radio,.form-horizontal .checkbox,.form-horizontal .radio-inline,.form-horizontal .checkbox-inline{margin-top:0;margin-bottom:0;padding-top:7px}.form-horizontal .radio,.form-horizontal .checkbox{min-height:27px}.form-horizontal .form-group{margin-left:-15px;margin-right:-15px}.form-horizontal .form-control-static{padding-top:7px}@media (min-width:768px){.form-horizontal .control-label{text-align:right}}.form-horizontal .has-feedback .form-control-feedback{top:0;right:15px}.btn{display:inline-block;margin-bottom:0;font-weight:400;text-align:center;vertical-align:middle;cursor:pointer;background-image:none;border:1px solid transparent;white-space:nowrap;padding:6px 12px;font-size:14px;line-height:1.42857143;border-radius:4px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.btn:focus,.btn:active:focus,.btn.active:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn:hover,.btn:focus{color:#333;text-decoration:none}.btn:active,.btn.active{outline:0;background-image:none;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn.disabled,.btn[disabled],fieldset[disabled] .btn{cursor:not-allowed;pointer-events:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none}.btn-default{color:#333;background-color:#fff;border-color:#ccc}.btn-default:hover,.btn-default:focus,.btn-default:active,.btn-default.active,.open .dropdown-toggle.btn-default{color:#333;background-color:#ebebeb;border-color:#adadad}.btn-default:active,.btn-default.active,.open .dropdown-toggle.btn-default{background-image:none}.btn-default.disabled,.btn-default[disabled],fieldset[disabled] .btn-default,.btn-default.disabled:hover,.btn-default[disabled]:hover,fieldset[disabled] .btn-default:hover,.btn-default.disabled:focus,.btn-default[disabled]:focus,fieldset[disabled] .btn-default:focus,.btn-default.disabled:active,.btn-default[disabled]:active,fieldset[disabled] .btn-default:active,.btn-default.disabled.active,.btn-default[disabled].active,fieldset[disabled] .btn-default.active{background-color:#fff;border-color:#ccc}.btn-default .badge{color:#fff;background-color:#333}.btn-primary{color:#fff;background-color:#428bca;border-color:#357ebd}.btn-primary:hover,.btn-primary:focus,.btn-primary:active,.btn-primary.active,.open .dropdown-toggle.btn-primary{color:#fff;background-color:#3276b1;border-color:#285e8e}.btn-primary:active,.btn-primary.active,.open .dropdown-toggle.btn-primary{background-image:none}.btn-primary.disabled,.btn-primary[disabled],fieldset[disabled] .btn-primary,.btn-primary.disabled:hover,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary:hover,.btn-primary.disabled:focus,.btn-primary[disabled]:focus,fieldset[disabled] .btn-primary:focus,.btn-primary.disabled:active,.btn-primary[disabled]:active,fieldset[disabled] .btn-primary:active,.btn-primary.disabled.active,.btn-primary[disabled].active,fieldset[disabled] .btn-primary.active{background-color:#428bca;border-color:#357ebd}.btn-primary .badge{color:#428bca;background-color:#fff}.btn-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.btn-success:hover,.btn-success:focus,.btn-success:active,.btn-success.active,.open .dropdown-toggle.btn-success{color:#fff;background-color:#47a447;border-color:#398439}.btn-success:active,.btn-success.active,.open .dropdown-toggle.btn-success{background-image:none}.btn-success.disabled,.btn-success[disabled],fieldset[disabled] .btn-success,.btn-success.disabled:hover,.btn-success[disabled]:hover,fieldset[disabled] .btn-success:hover,.btn-success.disabled:focus,.btn-success[disabled]:focus,fieldset[disabled] .btn-success:focus,.btn-success.disabled:active,.btn-success[disabled]:active,fieldset[disabled] .btn-success:active,.btn-success.disabled.active,.btn-success[disabled].active,fieldset[disabled] .btn-success.active{background-color:#5cb85c;border-color:#4cae4c}.btn-success .badge{color:#5cb85c;background-color:#fff}.btn-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.btn-info:hover,.btn-info:focus,.btn-info:active,.btn-info.active,.open .dropdown-toggle.btn-info{color:#fff;background-color:#39b3d7;border-color:#269abc}.btn-info:active,.btn-info.active,.open .dropdown-toggle.btn-info{background-image:none}.btn-info.disabled,.btn-info[disabled],fieldset[disabled] .btn-info,.btn-info.disabled:hover,.btn-info[disabled]:hover,fieldset[disabled] .btn-info:hover,.btn-info.disabled:focus,.btn-info[disabled]:focus,fieldset[disabled] .btn-info:focus,.btn-info.disabled:active,.btn-info[disabled]:active,fieldset[disabled] .btn-info:active,.btn-info.disabled.active,.btn-info[disabled].active,fieldset[disabled] .btn-info.active{background-color:#5bc0de;border-color:#46b8da}.btn-info .badge{color:#5bc0de;background-color:#fff}.btn-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.btn-warning:hover,.btn-warning:focus,.btn-warning:active,.btn-warning.active,.open .dropdown-toggle.btn-warning{color:#fff;background-color:#ed9c28;border-color:#d58512}.btn-warning:active,.btn-warning.active,.open .dropdown-toggle.btn-warning{background-image:none}.btn-warning.disabled,.btn-warning[disabled],fieldset[disabled] .btn-warning,.btn-warning.disabled:hover,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning:hover,.btn-warning.disabled:focus,.btn-warning[disabled]:focus,fieldset[disabled] .btn-warning:focus,.btn-warning.disabled:active,.btn-warning[disabled]:active,fieldset[disabled] .btn-warning:active,.btn-warning.disabled.active,.btn-warning[disabled].active,fieldset[disabled] .btn-warning.active{background-color:#f0ad4e;border-color:#eea236}.btn-warning .badge{color:#f0ad4e;background-color:#fff}.btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.btn-danger:hover,.btn-danger:focus,.btn-danger:active,.btn-danger.active,.open .dropdown-toggle.btn-danger{color:#fff;background-color:#d2322d;border-color:#ac2925}.btn-danger:active,.btn-danger.active,.open .dropdown-toggle.btn-danger{background-image:none}.btn-danger.disabled,.btn-danger[disabled],fieldset[disabled] .btn-danger,.btn-danger.disabled:hover,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger:hover,.btn-danger.disabled:focus,.btn-danger[disabled]:focus,fieldset[disabled] .btn-danger:focus,.btn-danger.disabled:active,.btn-danger[disabled]:active,fieldset[disabled] .btn-danger:active,.btn-danger.disabled.active,.btn-danger[disabled].active,fieldset[disabled] .btn-danger.active{background-color:#d9534f;border-color:#d43f3a}.btn-danger .badge{color:#d9534f;background-color:#fff}.btn-link{color:#428bca;font-weight:400;cursor:pointer;border-radius:0}.btn-link,.btn-link:active,.btn-link[disabled],fieldset[disabled] .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.btn-link,.btn-link:hover,.btn-link:focus,.btn-link:active{border-color:transparent}.btn-link:hover,.btn-link:focus{color:#2a6496;text-decoration:underline;background-color:transparent}.btn-link[disabled]:hover,fieldset[disabled] .btn-link:hover,.btn-link[disabled]:focus,fieldset[disabled] .btn-link:focus{color:#999;text-decoration:none}.btn-lg,.btn-group-lg>.btn{padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}.btn-sm,.btn-group-sm>.btn{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-xs,.btn-group-xs>.btn{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.btn-block{display:block;width:100%;padding-left:0;padding-right:0}.btn-block+.btn-block{margin-top:5px}input[type=submit].btn-block,input[type=reset].btn-block,input[type=button].btn-block{width:100%}.fade{opacity:0;-webkit-transition:opacity .15s linear;transition:opacity .15s linear}.fade.in{opacity:1}.collapse{display:none}.collapse.in{display:block}.collapsing{position:relative;height:0;overflow:hidden;-webkit-transition:height .35s ease;transition:height .35s ease}@font-face{font-family:'Glyphicons Halflings';src:url(../fonts/glyphicons-halflings-regular.eot);src:url(../fonts/glyphicons-halflings-regular.eot?#iefix) format('embedded-opentype'),url(../fonts/glyphicons-halflings-regular.woff) format('woff'),url(../fonts/glyphicons-halflings-regular.ttf) format('truetype'),url(../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular) format('svg')}.glyphicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings';font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.glyphicon-asterisk:before{content:"\2a"}.glyphicon-plus:before{content:"\2b"}.glyphicon-euro:before{content:"\20ac"}.glyphicon-minus:before{content:"\2212"}.glyphicon-cloud:before{content:"\2601"}.glyphicon-envelope:before{content:"\2709"}.glyphicon-pencil:before{content:"\270f"}.glyphicon-glass:before{content:"\e001"}.glyphicon-music:before{content:"\e002"}.glyphicon-search:before{content:"\e003"}.glyphicon-heart:before{content:"\e005"}.glyphicon-star:before{content:"\e006"}.glyphicon-star-empty:before{content:"\e007"}.glyphicon-user:before{content:"\e008"}.glyphicon-film:before{content:"\e009"}.glyphicon-th-large:before{content:"\e010"}.glyphicon-th:before{content:"\e011"}.glyphicon-th-list:before{content:"\e012"}.glyphicon-ok:before{content:"\e013"}.glyphicon-remove:before{content:"\e014"}.glyphicon-zoom-in:before{content:"\e015"}.glyphicon-zoom-out:before{content:"\e016"}.glyphicon-off:before{content:"\e017"}.glyphicon-signal:before{content:"\e018"}.glyphicon-cog:before{content:"\e019"}.glyphicon-trash:before{content:"\e020"}.glyphicon-home:before{content:"\e021"}.glyphicon-file:before{content:"\e022"}.glyphicon-time:before{content:"\e023"}.glyphicon-road:before{content:"\e024"}.glyphicon-download-alt:before{content:"\e025"}.glyphicon-download:before{content:"\e026"}.glyphicon-upload:before{content:"\e027"}.glyphicon-inbox:before{content:"\e028"}.glyphicon-play-circle:before{content:"\e029"}.glyphicon-repeat:before{content:"\e030"}.glyphicon-refresh:before{content:"\e031"}.glyphicon-list-alt:before{content:"\e032"}.glyphicon-lock:before{content:"\e033"}.glyphicon-flag:before{content:"\e034"}.glyphicon-headphones:before{content:"\e035"}.glyphicon-volume-off:before{content:"\e036"}.glyphicon-volume-down:before{content:"\e037"}.glyphicon-volume-up:before{content:"\e038"}.glyphicon-qrcode:before{content:"\e039"}.glyphicon-barcode:before{content:"\e040"}.glyphicon-tag:before{content:"\e041"}.glyphicon-tags:before{content:"\e042"}.glyphicon-book:before{content:"\e043"}.glyphicon-bookmark:before{content:"\e044"}.glyphicon-print:before{content:"\e045"}.glyphicon-camera:before{content:"\e046"}.glyphicon-font:before{content:"\e047"}.glyphicon-bold:before{content:"\e048"}.glyphicon-italic:before{content:"\e049"}.glyphicon-text-height:before{content:"\e050"}.glyphicon-text-width:before{content:"\e051"}.glyphicon-align-left:before{content:"\e052"}.glyphicon-align-center:before{content:"\e053"}.glyphicon-align-right:before{content:"\e054"}.glyphicon-align-justify:before{content:"\e055"}.glyphicon-list:before{content:"\e056"}.glyphicon-indent-left:before{content:"\e057"}.glyphicon-indent-right:before{content:"\e058"}.glyphicon-facetime-video:before{content:"\e059"}.glyphicon-picture:before{content:"\e060"}.glyphicon-map-marker:before{content:"\e062"}.glyphicon-adjust:before{content:"\e063"}.glyphicon-tint:before{content:"\e064"}.glyphicon-edit:before{content:"\e065"}.glyphicon-share:before{content:"\e066"}.glyphicon-check:before{content:"\e067"}.glyphicon-move:before{content:"\e068"}.glyphicon-step-backward:before{content:"\e069"}.glyphicon-fast-backward:before{content:"\e070"}.glyphicon-backward:before{content:"\e071"}.glyphicon-play:before{content:"\e072"}.glyphicon-pause:before{content:"\e073"}.glyphicon-stop:before{content:"\e074"}.glyphicon-forward:before{content:"\e075"}.glyphicon-fast-forward:before{content:"\e076"}.glyphicon-step-forward:before{content:"\e077"}.glyphicon-eject:before{content:"\e078"}.glyphicon-chevron-left:before{content:"\e079"}.glyphicon-chevron-right:before{content:"\e080"}.glyphicon-plus-sign:before{content:"\e081"}.glyphicon-minus-sign:before{content:"\e082"}.glyphicon-remove-sign:before{content:"\e083"}.glyphicon-ok-sign:before{content:"\e084"}.glyphicon-question-sign:before{content:"\e085"}.glyphicon-info-sign:before{content:"\e086"}.glyphicon-screenshot:before{content:"\e087"}.glyphicon-remove-circle:before{content:"\e088"}.glyphicon-ok-circle:before{content:"\e089"}.glyphicon-ban-circle:before{content:"\e090"}.glyphicon-arrow-left:before{content:"\e091"}.glyphicon-arrow-right:before{content:"\e092"}.glyphicon-arrow-up:before{content:"\e093"}.glyphicon-arrow-down:before{content:"\e094"}.glyphicon-share-alt:before{content:"\e095"}.glyphicon-resize-full:before{content:"\e096"}.glyphicon-resize-small:before{content:"\e097"}.glyphicon-exclamation-sign:before{content:"\e101"}.glyphicon-gift:before{content:"\e102"}.glyphicon-leaf:before{content:"\e103"}.glyphicon-fire:before{content:"\e104"}.glyphicon-eye-open:before{content:"\e105"}.glyphicon-eye-close:before{content:"\e106"}.glyphicon-warning-sign:before{content:"\e107"}.glyphicon-plane:before{content:"\e108"}.glyphicon-calendar:before{content:"\e109"}.glyphicon-random:before{content:"\e110"}.glyphicon-comment:before{content:"\e111"}.glyphicon-magnet:before{content:"\e112"}.glyphicon-chevron-up:before{content:"\e113"}.glyphicon-chevron-down:before{content:"\e114"}.glyphicon-retweet:before{content:"\e115"}.glyphicon-shopping-cart:before{content:"\e116"}.glyphicon-folder-close:before{content:"\e117"}.glyphicon-folder-open:before{content:"\e118"}.glyphicon-resize-vertical:before{content:"\e119"}.glyphicon-resize-horizontal:before{content:"\e120"}.glyphicon-hdd:before{content:"\e121"}.glyphicon-bullhorn:before{content:"\e122"}.glyphicon-bell:before{content:"\e123"}.glyphicon-certificate:before{content:"\e124"}.glyphicon-thumbs-up:before{content:"\e125"}.glyphicon-thumbs-down:before{content:"\e126"}.glyphicon-hand-right:before{content:"\e127"}.glyphicon-hand-left:before{content:"\e128"}.glyphicon-hand-up:before{content:"\e129"}.glyphicon-hand-down:before{content:"\e130"}.glyphicon-circle-arrow-right:before{content:"\e131"}.glyphicon-circle-arrow-left:before{content:"\e132"}.glyphicon-circle-arrow-up:before{content:"\e133"}.glyphicon-circle-arrow-down:before{content:"\e134"}.glyphicon-globe:before{content:"\e135"}.glyphicon-wrench:before{content:"\e136"}.glyphicon-tasks:before{content:"\e137"}.glyphicon-filter:before{content:"\e138"}.glyphicon-briefcase:before{content:"\e139"}.glyphicon-fullscreen:before{content:"\e140"}.glyphicon-dashboard:before{content:"\e141"}.glyphicon-paperclip:before{content:"\e142"}.glyphicon-heart-empty:before{content:"\e143"}.glyphicon-link:before{content:"\e144"}.glyphicon-phone:before{content:"\e145"}.glyphicon-pushpin:before{content:"\e146"}.glyphicon-usd:before{content:"\e148"}.glyphicon-gbp:before{content:"\e149"}.glyphicon-sort:before{content:"\e150"}.glyphicon-sort-by-alphabet:before{content:"\e151"}.glyphicon-sort-by-alphabet-alt:before{content:"\e152"}.glyphicon-sort-by-order:before{content:"\e153"}.glyphicon-sort-by-order-alt:before{content:"\e154"}.glyphicon-sort-by-attributes:before{content:"\e155"}.glyphicon-sort-by-attributes-alt:before{content:"\e156"}.glyphicon-unchecked:before{content:"\e157"}.glyphicon-expand:before{content:"\e158"}.glyphicon-collapse-down:before{content:"\e159"}.glyphicon-collapse-up:before{content:"\e160"}.glyphicon-log-in:before{content:"\e161"}.glyphicon-flash:before{content:"\e162"}.glyphicon-log-out:before{content:"\e163"}.glyphicon-new-window:before{content:"\e164"}.glyphicon-record:before{content:"\e165"}.glyphicon-save:before{content:"\e166"}.glyphicon-open:before{content:"\e167"}.glyphicon-saved:before{content:"\e168"}.glyphicon-import:before{content:"\e169"}.glyphicon-export:before{content:"\e170"}.glyphicon-send:before{content:"\e171"}.glyphicon-floppy-disk:before{content:"\e172"}.glyphicon-floppy-saved:before{content:"\e173"}.glyphicon-floppy-remove:before{content:"\e174"}.glyphicon-floppy-save:before{content:"\e175"}.glyphicon-floppy-open:before{content:"\e176"}.glyphicon-credit-card:before{content:"\e177"}.glyphicon-transfer:before{content:"\e178"}.glyphicon-cutlery:before{content:"\e179"}.glyphicon-header:before{content:"\e180"}.glyphicon-compressed:before{content:"\e181"}.glyphicon-earphone:before{content:"\e182"}.glyphicon-phone-alt:before{content:"\e183"}.glyphicon-tower:before{content:"\e184"}.glyphicon-stats:before{content:"\e185"}.glyphicon-sd-video:before{content:"\e186"}.glyphicon-hd-video:before{content:"\e187"}.glyphicon-subtitles:before{content:"\e188"}.glyphicon-sound-stereo:before{content:"\e189"}.glyphicon-sound-dolby:before{content:"\e190"}.glyphicon-sound-5-1:before{content:"\e191"}.glyphicon-sound-6-1:before{content:"\e192"}.glyphicon-sound-7-1:before{content:"\e193"}.glyphicon-copyright-mark:before{content:"\e194"}.glyphicon-registration-mark:before{content:"\e195"}.glyphicon-cloud-download:before{content:"\e197"}.glyphicon-cloud-upload:before{content:"\e198"}.glyphicon-tree-conifer:before{content:"\e199"}.glyphicon-tree-deciduous:before{content:"\e200"}.caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px solid;border-right:4px solid transparent;border-left:4px solid transparent}.dropdown{position:relative}.dropdown-toggle:focus{outline:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;list-style:none;font-size:14px;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,.15);border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175);background-clip:padding-box}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:nowrap}.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus{text-decoration:none;color:#262626;background-color:#f5f5f5}.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus{color:#fff;text-decoration:none;outline:0;background-color:#428bca}.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{color:#999}.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{text-decoration:none;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);cursor:not-allowed}.open>.dropdown-menu{display:block}.open>a{outline:0}.dropdown-menu-right{left:auto;right:0}.dropdown-menu-left{left:0;right:auto}.dropdown-header{display:block;padding:3px 20px;font-size:12px;line-height:1.42857143;color:#999}.dropdown-backdrop{position:fixed;left:0;right:0;bottom:0;top:0;z-index:990}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{border-top:0;border-bottom:4px solid;content:""}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:1px}@media (min-width:768px){.navbar-right .dropdown-menu{left:auto;right:0}.navbar-right .dropdown-menu-left{left:0;right:auto}}.btn-group,.btn-group-vertical{position:relative;display:inline-block;vertical-align:middle}.btn-group>.btn,.btn-group-vertical>.btn{position:relative;float:left}.btn-group>.btn:hover,.btn-group-vertical>.btn:hover,.btn-group>.btn:focus,.btn-group-vertical>.btn:focus,.btn-group>.btn:active,.btn-group-vertical>.btn:active,.btn-group>.btn.active,.btn-group-vertical>.btn.active{z-index:2}.btn-group>.btn:focus,.btn-group-vertical>.btn:focus{outline:0}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group{margin-left:-1px}.btn-toolbar{margin-left:-5px}.btn-toolbar .btn-group,.btn-toolbar .input-group{float:left}.btn-toolbar>.btn,.btn-toolbar>.btn-group,.btn-toolbar>.input-group{margin-left:5px}.btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.btn-group>.btn:first-child{margin-left:0}.btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-bottom-right-radius:0;border-top-right-radius:0}.btn-group>.btn:last-child:not(:first-child),.btn-group>.dropdown-toggle:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.btn-group>.btn-group{float:left}.btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group>.btn-group:first-child>.btn:last-child,.btn-group>.btn-group:first-child>.dropdown-toggle{border-bottom-right-radius:0;border-top-right-radius:0}.btn-group>.btn-group:last-child>.btn:first-child{border-bottom-left-radius:0;border-top-left-radius:0}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group>.btn+.dropdown-toggle{padding-left:8px;padding-right:8px}.btn-group>.btn-lg+.dropdown-toggle{padding-left:12px;padding-right:12px}.btn-group.open .dropdown-toggle{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-group.open .dropdown-toggle.btn-link{-webkit-box-shadow:none;box-shadow:none}.btn .caret{margin-left:0}.btn-lg .caret{border-width:5px 5px 0;border-bottom-width:0}.dropup .btn-lg .caret{border-width:0 5px 5px}.btn-group-vertical>.btn,.btn-group-vertical>.btn-group,.btn-group-vertical>.btn-group>.btn{display:block;float:none;width:100%;max-width:100%}.btn-group-vertical>.btn-group>.btn{float:none}.btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0}.btn-group-vertical>.btn:first-child:not(:last-child){border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn:last-child:not(:first-child){border-bottom-left-radius:4px;border-top-right-radius:0;border-top-left-radius:0}.btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group-vertical>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group-vertical>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-right-radius:0;border-top-left-radius:0}.btn-group-justified{display:table;width:100%;table-layout:fixed;border-collapse:separate}.btn-group-justified>.btn,.btn-group-justified>.btn-group{float:none;display:table-cell;width:1%}.btn-group-justified>.btn-group .btn{width:100%}[data-toggle=buttons]>.btn>input[type=radio],[data-toggle=buttons]>.btn>input[type=checkbox]{display:none}.input-group{position:relative;display:table;border-collapse:separate}.input-group[class*=col-]{float:none;padding-left:0;padding-right:0}.input-group .form-control{position:relative;z-index:2;float:left;width:100%;margin-bottom:0}.input-group-lg>.form-control,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.btn{height:46px;padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}select.input-group-lg>.form-control,select.input-group-lg>.input-group-addon,select.input-group-lg>.input-group-btn>.btn{height:46px;line-height:46px}textarea.input-group-lg>.form-control,textarea.input-group-lg>.input-group-addon,textarea.input-group-lg>.input-group-btn>.btn,select[multiple].input-group-lg>.form-control,select[multiple].input-group-lg>.input-group-addon,select[multiple].input-group-lg>.input-group-btn>.btn{height:auto}.input-group-sm>.form-control,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.btn{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-group-sm>.form-control,select.input-group-sm>.input-group-addon,select.input-group-sm>.input-group-btn>.btn{height:30px;line-height:30px}textarea.input-group-sm>.form-control,textarea.input-group-sm>.input-group-addon,textarea.input-group-sm>.input-group-btn>.btn,select[multiple].input-group-sm>.form-control,select[multiple].input-group-sm>.input-group-addon,select[multiple].input-group-sm>.input-group-btn>.btn{height:auto}.input-group-addon,.input-group-btn,.input-group .form-control{display:table-cell}.input-group-addon:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child),.input-group .form-control:not(:first-child):not(:last-child){border-radius:0}.input-group-addon,.input-group-btn{width:1%;white-space:nowrap;vertical-align:middle}.input-group-addon{padding:6px 12px;font-size:14px;font-weight:400;line-height:1;color:#555;text-align:center;background-color:#eee;border:1px solid #ccc;border-radius:4px}.input-group-addon.input-sm{padding:5px 10px;font-size:12px;border-radius:3px}.input-group-addon.input-lg{padding:10px 16px;font-size:18px;border-radius:6px}.input-group-addon input[type=radio],.input-group-addon input[type=checkbox]{margin-top:0}.input-group .form-control:first-child,.input-group-addon:first-child,.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group>.btn,.input-group-btn:first-child>.dropdown-toggle,.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle),.input-group-btn:last-child>.btn-group:not(:last-child)>.btn{border-bottom-right-radius:0;border-top-right-radius:0}.input-group-addon:first-child{border-right:0}.input-group .form-control:last-child,.input-group-addon:last-child,.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group>.btn,.input-group-btn:last-child>.dropdown-toggle,.input-group-btn:first-child>.btn:not(:first-child),.input-group-btn:first-child>.btn-group:not(:first-child)>.btn{border-bottom-left-radius:0;border-top-left-radius:0}.input-group-addon:last-child{border-left:0}.input-group-btn{position:relative;font-size:0;white-space:nowrap}.input-group-btn>.btn{position:relative}.input-group-btn>.btn+.btn{margin-left:-1px}.input-group-btn>.btn:hover,.input-group-btn>.btn:focus,.input-group-btn>.btn:active{z-index:2}.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group{margin-right:-1px}.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group{margin-left:-1px}.nav{margin-bottom:0;padding-left:0;list-style:none}.nav>li{position:relative;display:block}.nav>li>a{position:relative;display:block;padding:10px 15px}.nav>li>a:hover,.nav>li>a:focus{text-decoration:none;background-color:#eee}.nav>li.disabled>a{color:#999}.nav>li.disabled>a:hover,.nav>li.disabled>a:focus{color:#999;text-decoration:none;background-color:transparent;cursor:not-allowed}.nav .open>a,.nav .open>a:hover,.nav .open>a:focus{background-color:#eee;border-color:#428bca}.nav .nav-divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.nav>li>a>img{max-width:none}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs>li{float:left;margin-bottom:-1px}.nav-tabs>li>a{margin-right:2px;line-height:1.42857143;border:1px solid transparent;border-radius:4px 4px 0 0}.nav-tabs>li>a:hover{border-color:#eee #eee #ddd}.nav-tabs>li.active>a,.nav-tabs>li.active>a:hover,.nav-tabs>li.active>a:focus{color:#555;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent;cursor:default}.nav-tabs.nav-justified{width:100%;border-bottom:0}.nav-tabs.nav-justified>li{float:none}.nav-tabs.nav-justified>li>a{text-align:center;margin-bottom:5px}.nav-tabs.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-tabs.nav-justified>li{display:table-cell;width:1%}.nav-tabs.nav-justified>li>a{margin-bottom:0}}.nav-tabs.nav-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a:focus{border:1px solid #ddd}@media (min-width:768px){.nav-tabs.nav-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a:focus{border-bottom-color:#fff}}.nav-pills>li{float:left}.nav-pills>li>a{border-radius:4px}.nav-pills>li+li{margin-left:2px}.nav-pills>li.active>a,.nav-pills>li.active>a:hover,.nav-pills>li.active>a:focus{color:#fff;background-color:#428bca}.nav-stacked>li{float:none}.nav-stacked>li+li{margin-top:2px;margin-left:0}.nav-justified{width:100%}.nav-justified>li{float:none}.nav-justified>li>a{text-align:center;margin-bottom:5px}.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-justified>li{display:table-cell;width:1%}.nav-justified>li>a{margin-bottom:0}}.nav-tabs-justified{border-bottom:0}.nav-tabs-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:hover,.nav-tabs-justified>.active>a:focus{border:1px solid #ddd}@media (min-width:768px){.nav-tabs-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:hover,.nav-tabs-justified>.active>a:focus{border-bottom-color:#fff}}.tab-content>.tab-pane{display:none}.tab-content>.active{display:block}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-right-radius:0;border-top-left-radius:0}.navbar{position:relative;min-height:50px;margin-bottom:20px;border:1px solid transparent}@media (min-width:768px){.navbar{border-radius:4px}}@media (min-width:768px){.navbar-header{float:left}}.navbar-collapse{max-height:340px;overflow-x:visible;padding-right:15px;padding-left:15px;border-top:1px solid transparent;box-shadow:inset 0 1px 0 rgba(255,255,255,.1);-webkit-overflow-scrolling:touch}.navbar-collapse.in{overflow-y:auto}@media (min-width:768px){.navbar-collapse{width:auto;border-top:0;box-shadow:none}.navbar-collapse.collapse{display:block!important;height:auto!important;padding-bottom:0;overflow:visible!important}.navbar-collapse.in{overflow-y:visible}.navbar-fixed-top .navbar-collapse,.navbar-static-top .navbar-collapse,.navbar-fixed-bottom .navbar-collapse{padding-left:0;padding-right:0}}.container>.navbar-header,.container-fluid>.navbar-header,.container>.navbar-collapse,.container-fluid>.navbar-collapse{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.container>.navbar-header,.container-fluid>.navbar-header,.container>.navbar-collapse,.container-fluid>.navbar-collapse{margin-right:0;margin-left:0}}.navbar-static-top{z-index:1000;border-width:0 0 1px}@media (min-width:768px){.navbar-static-top{border-radius:0}}.navbar-fixed-top,.navbar-fixed-bottom{position:fixed;right:0;left:0;z-index:1030}@media (min-width:768px){.navbar-fixed-top,.navbar-fixed-bottom{border-radius:0}}.navbar-fixed-top{top:0;border-width:0 0 1px}.navbar-fixed-bottom{bottom:0;margin-bottom:0;border-width:1px 0 0}.navbar-brand{float:left;padding:15px;font-size:18px;line-height:20px;height:50px}.navbar-brand:hover,.navbar-brand:focus{text-decoration:none}@media (min-width:768px){.navbar>.container .navbar-brand,.navbar>.container-fluid .navbar-brand{margin-left:-15px}}.navbar-toggle{position:relative;float:right;margin-right:15px;padding:9px 10px;margin-top:8px;margin-bottom:8px;background-color:transparent;background-image:none;border:1px solid transparent;border-radius:4px}.navbar-toggle:focus{outline:0}.navbar-toggle .icon-bar{display:block;width:22px;height:2px;border-radius:1px}.navbar-toggle .icon-bar+.icon-bar{margin-top:4px}@media (min-width:768px){.navbar-toggle{display:none}}.navbar-nav{margin:7.5px -15px}.navbar-nav>li>a{padding-top:10px;padding-bottom:10px;line-height:20px}@media (max-width:767px){.navbar-nav .open .dropdown-menu{position:static;float:none;width:auto;margin-top:0;background-color:transparent;border:0;box-shadow:none}.navbar-nav .open .dropdown-menu>li>a,.navbar-nav .open .dropdown-menu .dropdown-header{padding:5px 15px 5px 25px}.navbar-nav .open .dropdown-menu>li>a{line-height:20px}.navbar-nav .open .dropdown-menu>li>a:hover,.navbar-nav .open .dropdown-menu>li>a:focus{background-image:none}}@media (min-width:768px){.navbar-nav{float:left;margin:0}.navbar-nav>li{float:left}.navbar-nav>li>a{padding-top:15px;padding-bottom:15px}.navbar-nav.navbar-right:last-child{margin-right:-15px}}@media (min-width:768px){.navbar-left{float:left!important}.navbar-right{float:right!important}}.navbar-form{margin-left:-15px;margin-right:-15px;padding:10px 15px;border-top:1px solid transparent;border-bottom:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1);margin-top:8px;margin-bottom:8px}@media (min-width:768px){.navbar-form .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.navbar-form .form-control{display:inline-block;width:auto;vertical-align:middle}.navbar-form .input-group>.form-control{width:100%}.navbar-form .control-label{margin-bottom:0;vertical-align:middle}.navbar-form .radio,.navbar-form .checkbox{display:inline-block;margin-top:0;margin-bottom:0;padding-left:0;vertical-align:middle}.navbar-form .radio input[type=radio],.navbar-form .checkbox input[type=checkbox]{float:none;margin-left:0}.navbar-form .has-feedback .form-control-feedback{top:0}}@media (max-width:767px){.navbar-form .form-group{margin-bottom:5px}}@media (min-width:768px){.navbar-form{width:auto;border:0;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;-webkit-box-shadow:none;box-shadow:none}.navbar-form.navbar-right:last-child{margin-right:-15px}}.navbar-nav>li>.dropdown-menu{margin-top:0;border-top-right-radius:0;border-top-left-radius:0}.navbar-fixed-bottom .navbar-nav>li>.dropdown-menu{border-bottom-right-radius:0;border-bottom-left-radius:0}.navbar-btn{margin-top:8px;margin-bottom:8px}.navbar-btn.btn-sm{margin-top:10px;margin-bottom:10px}.navbar-btn.btn-xs{margin-top:14px;margin-bottom:14px}.navbar-text{margin-top:15px;margin-bottom:15px}@media (min-width:768px){.navbar-text{float:left;margin-left:15px;margin-right:15px}.navbar-text.navbar-right:last-child{margin-right:0}}.navbar-default{background-color:#f8f8f8;border-color:#e7e7e7}.navbar-default .navbar-brand{color:#777}.navbar-default .navbar-brand:hover,.navbar-default .navbar-brand:focus{color:#5e5e5e;background-color:transparent}.navbar-default .navbar-text{color:#777}.navbar-default .navbar-nav>li>a{color:#777}.navbar-default .navbar-nav>li>a:hover,.navbar-default .navbar-nav>li>a:focus{color:#333;background-color:transparent}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:hover,.navbar-default .navbar-nav>.active>a:focus{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav>.disabled>a,.navbar-default .navbar-nav>.disabled>a:hover,.navbar-default .navbar-nav>.disabled>a:focus{color:#ccc;background-color:transparent}.navbar-default .navbar-toggle{border-color:#ddd}.navbar-default .navbar-toggle:hover,.navbar-default .navbar-toggle:focus{background-color:#ddd}.navbar-default .navbar-toggle .icon-bar{background-color:#888}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#e7e7e7}.navbar-default .navbar-nav>.open>a,.navbar-default .navbar-nav>.open>a:hover,.navbar-default .navbar-nav>.open>a:focus{background-color:#e7e7e7;color:#555}@media (max-width:767px){.navbar-default .navbar-nav .open .dropdown-menu>li>a{color:#777}.navbar-default .navbar-nav .open .dropdown-menu>li>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>li>a:focus{color:#333;background-color:transparent}.navbar-default .navbar-nav .open .dropdown-menu>.active>a,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:focus{color:#ccc;background-color:transparent}}.navbar-default .navbar-link{color:#777}.navbar-default .navbar-link:hover{color:#333}.navbar-inverse{background-color:#222;border-color:#080808}.navbar-inverse .navbar-brand{color:#999}.navbar-inverse .navbar-brand:hover,.navbar-inverse .navbar-brand:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-text{color:#999}.navbar-inverse .navbar-nav>li>a{color:#999}.navbar-inverse .navbar-nav>li>a:hover,.navbar-inverse .navbar-nav>li>a:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.active>a:hover,.navbar-inverse .navbar-nav>.active>a:focus{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav>.disabled>a,.navbar-inverse .navbar-nav>.disabled>a:hover,.navbar-inverse .navbar-nav>.disabled>a:focus{color:#444;background-color:transparent}.navbar-inverse .navbar-toggle{border-color:#333}.navbar-inverse .navbar-toggle:hover,.navbar-inverse .navbar-toggle:focus{background-color:#333}.navbar-inverse .navbar-toggle .icon-bar{background-color:#fff}.navbar-inverse .navbar-collapse,.navbar-inverse .navbar-form{border-color:#101010}.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.open>a:hover,.navbar-inverse .navbar-nav>.open>a:focus{background-color:#080808;color:#fff}@media (max-width:767px){.navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header{border-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu .divider{background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a{color:#999}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:focus{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:focus{color:#444;background-color:transparent}}.navbar-inverse .navbar-link{color:#999}.navbar-inverse .navbar-link:hover{color:#fff}.breadcrumb{padding:8px 15px;margin-bottom:20px;list-style:none;background-color:#f5f5f5;border-radius:4px}.breadcrumb>li{display:inline-block}.breadcrumb>li+li:before{content:"/\00a0";padding:0 5px;color:#ccc}.breadcrumb>.active{color:#999}.pagination{display:inline-block;padding-left:0;margin:20px 0;border-radius:4px}.pagination>li{display:inline}.pagination>li>a,.pagination>li>span{position:relative;float:left;padding:6px 12px;line-height:1.42857143;text-decoration:none;color:#428bca;background-color:#fff;border:1px solid #ddd;margin-left:-1px}.pagination>li:first-child>a,.pagination>li:first-child>span{margin-left:0;border-bottom-left-radius:4px;border-top-left-radius:4px}.pagination>li:last-child>a,.pagination>li:last-child>span{border-bottom-right-radius:4px;border-top-right-radius:4px}.pagination>li>a:hover,.pagination>li>span:hover,.pagination>li>a:focus,.pagination>li>span:focus{color:#2a6496;background-color:#eee;border-color:#ddd}.pagination>.active>a,.pagination>.active>span,.pagination>.active>a:hover,.pagination>.active>span:hover,.pagination>.active>a:focus,.pagination>.active>span:focus{z-index:2;color:#fff;background-color:#428bca;border-color:#428bca;cursor:default}.pagination>.disabled>span,.pagination>.disabled>span:hover,.pagination>.disabled>span:focus,.pagination>.disabled>a,.pagination>.disabled>a:hover,.pagination>.disabled>a:focus{color:#999;background-color:#fff;border-color:#ddd;cursor:not-allowed}.pagination-lg>li>a,.pagination-lg>li>span{padding:10px 16px;font-size:18px}.pagination-lg>li:first-child>a,.pagination-lg>li:first-child>span{border-bottom-left-radius:6px;border-top-left-radius:6px}.pagination-lg>li:last-child>a,.pagination-lg>li:last-child>span{border-bottom-right-radius:6px;border-top-right-radius:6px}.pagination-sm>li>a,.pagination-sm>li>span{padding:5px 10px;font-size:12px}.pagination-sm>li:first-child>a,.pagination-sm>li:first-child>span{border-bottom-left-radius:3px;border-top-left-radius:3px}.pagination-sm>li:last-child>a,.pagination-sm>li:last-child>span{border-bottom-right-radius:3px;border-top-right-radius:3px}.pager{padding-left:0;margin:20px 0;list-style:none;text-align:center}.pager li{display:inline}.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;border-radius:15px}.pager li>a:hover,.pager li>a:focus{text-decoration:none;background-color:#eee}.pager .next>a,.pager .next>span{float:right}.pager .previous>a,.pager .previous>span{float:left}.pager .disabled>a,.pager .disabled>a:hover,.pager .disabled>a:focus,.pager .disabled>span{color:#999;background-color:#fff;cursor:not-allowed}.label{display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em}.label[href]:hover,.label[href]:focus{color:#fff;text-decoration:none;cursor:pointer}.label:empty{display:none}.btn .label{position:relative;top:-1px}.label-default{background-color:#999}.label-default[href]:hover,.label-default[href]:focus{background-color:gray}.label-primary{background-color:#428bca}.label-primary[href]:hover,.label-primary[href]:focus{background-color:#3071a9}.label-success{background-color:#5cb85c}.label-success[href]:hover,.label-success[href]:focus{background-color:#449d44}.label-info{background-color:#5bc0de}.label-info[href]:hover,.label-info[href]:focus{background-color:#31b0d5}.label-warning{background-color:#f0ad4e}.label-warning[href]:hover,.label-warning[href]:focus{background-color:#ec971f}.label-danger{background-color:#d9534f}.label-danger[href]:hover,.label-danger[href]:focus{background-color:#c9302c}.badge{display:inline-block;min-width:10px;padding:3px 7px;font-size:12px;font-weight:700;color:#fff;line-height:1;vertical-align:baseline;white-space:nowrap;text-align:center;background-color:#999;border-radius:10px}.badge:empty{display:none}.btn .badge{position:relative;top:-1px}.btn-xs .badge{top:0;padding:1px 5px}a.badge:hover,a.badge:focus{color:#fff;text-decoration:none;cursor:pointer}a.list-group-item.active>.badge,.nav-pills>.active>a>.badge{color:#428bca;background-color:#fff}.nav-pills>li>a>.badge{margin-left:3px}.jumbotron{padding:30px;margin-bottom:30px;color:inherit;background-color:#eee}.jumbotron h1,.jumbotron .h1{color:inherit}.jumbotron p{margin-bottom:15px;font-size:21px;font-weight:200}.container .jumbotron{border-radius:6px}.jumbotron .container{max-width:100%}@media screen and (min-width:768px){.jumbotron{padding-top:48px;padding-bottom:48px}.container .jumbotron{padding-left:60px;padding-right:60px}.jumbotron h1,.jumbotron .h1{font-size:63px}}.thumbnail{display:block;padding:4px;margin-bottom:20px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.thumbnail>img,.thumbnail a>img{margin-left:auto;margin-right:auto}a.thumbnail:hover,a.thumbnail:focus,a.thumbnail.active{border-color:#428bca}.thumbnail .caption{padding:9px;color:#333}.alert{padding:15px;margin-bottom:20px;border:1px solid transparent;border-radius:4px}.alert h4{margin-top:0;color:inherit}.alert .alert-link{font-weight:700}.alert>p,.alert>ul{margin-bottom:0}.alert>p+p{margin-top:5px}.alert-dismissable{padding-right:35px}.alert-dismissable .close{position:relative;top:-2px;right:-21px;color:inherit}.alert-success{background-color:#dff0d8;border-color:#d6e9c6;color:#3c763d}.alert-success hr{border-top-color:#c9e2b3}.alert-success .alert-link{color:#2b542c}.alert-info{background-color:#d9edf7;border-color:#bce8f1;color:#31708f}.alert-info hr{border-top-color:#a6e1ec}.alert-info .alert-link{color:#245269}.alert-warning{background-color:#fcf8e3;border-color:#faebcc;color:#8a6d3b}.alert-warning hr{border-top-color:#f7e1b5}.alert-warning .alert-link{color:#66512c}.alert-danger{background-color:#f2dede;border-color:#ebccd1;color:#a94442}.alert-danger hr{border-top-color:#e4b9c0}.alert-danger .alert-link{color:#843534}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.progress{overflow:hidden;height:20px;margin-bottom:20px;background-color:#f5f5f5;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);box-shadow:inset 0 1px 2px rgba(0,0,0,.1)}.progress-bar{float:left;width:0;height:100%;font-size:12px;line-height:20px;color:#fff;text-align:center;background-color:#428bca;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);-webkit-transition:width .6s ease;transition:width .6s ease}.progress-striped .progress-bar{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-size:40px 40px}.progress.active .progress-bar{-webkit-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-bar-success{background-color:#5cb85c}.progress-striped .progress-bar-success{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-info{background-color:#5bc0de}.progress-striped .progress-bar-info{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-warning{background-color:#f0ad4e}.progress-striped .progress-bar-warning{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-danger{background-color:#d9534f}.progress-striped .progress-bar-danger{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.media,.media-body{overflow:hidden;zoom:1}.media,.media .media{margin-top:15px}.media:first-child{margin-top:0}.media-object{display:block}.media-heading{margin:0 0 5px}.media>.pull-left{margin-right:10px}.media>.pull-right{margin-left:10px}.media-list{padding-left:0;list-style:none}.list-group{margin-bottom:20px;padding-left:0}.list-group-item{position:relative;display:block;padding:10px 15px;margin-bottom:-1px;background-color:#fff;border:1px solid #ddd}.list-group-item:first-child{border-top-right-radius:4px;border-top-left-radius:4px}.list-group-item:last-child{margin-bottom:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}.list-group-item>.badge{float:right}.list-group-item>.badge+.badge{margin-right:5px}a.list-group-item{color:#555}a.list-group-item .list-group-item-heading{color:#333}a.list-group-item:hover,a.list-group-item:focus{text-decoration:none;background-color:#f5f5f5}a.list-group-item.active,a.list-group-item.active:hover,a.list-group-item.active:focus{z-index:2;color:#fff;background-color:#428bca;border-color:#428bca}a.list-group-item.active .list-group-item-heading,a.list-group-item.active:hover .list-group-item-heading,a.list-group-item.active:focus .list-group-item-heading{color:inherit}a.list-group-item.active .list-group-item-text,a.list-group-item.active:hover .list-group-item-text,a.list-group-item.active:focus .list-group-item-text{color:#e1edf7}.list-group-item-success{color:#3c763d;background-color:#dff0d8}a.list-group-item-success{color:#3c763d}a.list-group-item-success .list-group-item-heading{color:inherit}a.list-group-item-success:hover,a.list-group-item-success:focus{color:#3c763d;background-color:#d0e9c6}a.list-group-item-success.active,a.list-group-item-success.active:hover,a.list-group-item-success.active:focus{color:#fff;background-color:#3c763d;border-color:#3c763d}.list-group-item-info{color:#31708f;background-color:#d9edf7}a.list-group-item-info{color:#31708f}a.list-group-item-info .list-group-item-heading{color:inherit}a.list-group-item-info:hover,a.list-group-item-info:focus{color:#31708f;background-color:#c4e3f3}a.list-group-item-info.active,a.list-group-item-info.active:hover,a.list-group-item-info.active:focus{color:#fff;background-color:#31708f;border-color:#31708f}.list-group-item-warning{color:#8a6d3b;background-color:#fcf8e3}a.list-group-item-warning{color:#8a6d3b}a.list-group-item-warning .list-group-item-heading{color:inherit}a.list-group-item-warning:hover,a.list-group-item-warning:focus{color:#8a6d3b;background-color:#faf2cc}a.list-group-item-warning.active,a.list-group-item-warning.active:hover,a.list-group-item-warning.active:focus{color:#fff;background-color:#8a6d3b;border-color:#8a6d3b}.list-group-item-danger{color:#a94442;background-color:#f2dede}a.list-group-item-danger{color:#a94442}a.list-group-item-danger .list-group-item-heading{color:inherit}a.list-group-item-danger:hover,a.list-group-item-danger:focus{color:#a94442;background-color:#ebcccc}a.list-group-item-danger.active,a.list-group-item-danger.active:hover,a.list-group-item-danger.active:focus{color:#fff;background-color:#a94442;border-color:#a94442}.list-group-item-heading{margin-top:0;margin-bottom:5px}.list-group-item-text{margin-bottom:0;line-height:1.3}.panel{margin-bottom:20px;background-color:#fff;border:1px solid transparent;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05)}.panel-body{padding:15px}.panel-heading{padding:10px 15px;border-bottom:1px solid transparent;border-top-right-radius:3px;border-top-left-radius:3px}.panel-heading>.dropdown .dropdown-toggle{color:inherit}.panel-title{margin-top:0;margin-bottom:0;font-size:16px;color:inherit}.panel-title>a{color:inherit}.panel-footer{padding:10px 15px;background-color:#f5f5f5;border-top:1px solid #ddd;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.list-group{margin-bottom:0}.panel>.list-group .list-group-item{border-width:1px 0;border-radius:0}.panel>.list-group:first-child .list-group-item:first-child{border-top:0;border-top-right-radius:3px;border-top-left-radius:3px}.panel>.list-group:last-child .list-group-item:last-child{border-bottom:0;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel-heading+.list-group .list-group-item:first-child{border-top-width:0}.panel>.table,.panel>.table-responsive>.table{margin-bottom:0}.panel>.table:first-child,.panel>.table-responsive:first-child>.table:first-child{border-top-right-radius:3px;border-top-left-radius:3px}.panel>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:first-child{border-top-left-radius:3px}.panel>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:last-child{border-top-right-radius:3px}.panel>.table:last-child,.panel>.table-responsive:last-child>.table:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:first-child{border-bottom-left-radius:3px}.panel>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:last-child{border-bottom-right-radius:3px}.panel>.panel-body+.table,.panel>.panel-body+.table-responsive{border-top:1px solid #ddd}.panel>.table>tbody:first-child>tr:first-child th,.panel>.table>tbody:first-child>tr:first-child td{border-top:0}.panel>.table-bordered,.panel>.table-responsive>.table-bordered{border:0}.panel>.table-bordered>thead>tr>th:first-child,.panel>.table-responsive>.table-bordered>thead>tr>th:first-child,.panel>.table-bordered>tbody>tr>th:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:first-child,.panel>.table-bordered>tfoot>tr>th:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:first-child,.panel>.table-bordered>thead>tr>td:first-child,.panel>.table-responsive>.table-bordered>thead>tr>td:first-child,.panel>.table-bordered>tbody>tr>td:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:first-child,.panel>.table-bordered>tfoot>tr>td:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:first-child{border-left:0}.panel>.table-bordered>thead>tr>th:last-child,.panel>.table-responsive>.table-bordered>thead>tr>th:last-child,.panel>.table-bordered>tbody>tr>th:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:last-child,.panel>.table-bordered>tfoot>tr>th:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:last-child,.panel>.table-bordered>thead>tr>td:last-child,.panel>.table-responsive>.table-bordered>thead>tr>td:last-child,.panel>.table-bordered>tbody>tr>td:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:last-child,.panel>.table-bordered>tfoot>tr>td:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:last-child{border-right:0}.panel>.table-bordered>thead>tr:first-child>td,.panel>.table-responsive>.table-bordered>thead>tr:first-child>td,.panel>.table-bordered>tbody>tr:first-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>td,.panel>.table-bordered>thead>tr:first-child>th,.panel>.table-responsive>.table-bordered>thead>tr:first-child>th,.panel>.table-bordered>tbody>tr:first-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>th{border-bottom:0}.panel>.table-bordered>tbody>tr:last-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>td,.panel>.table-bordered>tfoot>tr:last-child>td,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>td,.panel>.table-bordered>tbody>tr:last-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>th,.panel>.table-bordered>tfoot>tr:last-child>th,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}.panel>.table-responsive{border:0;margin-bottom:0}.panel-group{margin-bottom:20px}.panel-group .panel{margin-bottom:0;border-radius:4px;overflow:hidden}.panel-group .panel+.panel{margin-top:5px}.panel-group .panel-heading{border-bottom:0}.panel-group .panel-heading+.panel-collapse .panel-body{border-top:1px solid #ddd}.panel-group .panel-footer{border-top:0}.panel-group .panel-footer+.panel-collapse .panel-body{border-bottom:1px solid #ddd}.panel-default{border-color:#ddd}.panel-default>.panel-heading{color:#333;background-color:#f5f5f5;border-color:#ddd}.panel-default>.panel-heading+.panel-collapse .panel-body{border-top-color:#ddd}.panel-default>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#ddd}.panel-primary{border-color:#428bca}.panel-primary>.panel-heading{color:#fff;background-color:#428bca;border-color:#428bca}.panel-primary>.panel-heading+.panel-collapse .panel-body{border-top-color:#428bca}.panel-primary>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#428bca}.panel-success{border-color:#d6e9c6}.panel-success>.panel-heading{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.panel-success>.panel-heading+.panel-collapse .panel-body{border-top-color:#d6e9c6}.panel-success>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#d6e9c6}.panel-info{border-color:#bce8f1}.panel-info>.panel-heading{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.panel-info>.panel-heading+.panel-collapse .panel-body{border-top-color:#bce8f1}.panel-info>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#bce8f1}.panel-warning{border-color:#faebcc}.panel-warning>.panel-heading{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.panel-warning>.panel-heading+.panel-collapse .panel-body{border-top-color:#faebcc}.panel-warning>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#faebcc}.panel-danger{border-color:#ebccd1}.panel-danger>.panel-heading{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.panel-danger>.panel-heading+.panel-collapse .panel-body{border-top-color:#ebccd1}.panel-danger>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#ebccd1}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);box-shadow:inset 0 1px 1px rgba(0,0,0,.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,.15)}.well-lg{padding:24px;border-radius:6px}.well-sm{padding:9px;border-radius:3px}.close{float:right;font-size:21px;font-weight:700;line-height:1;color:#000;text-shadow:0 1px 0 #fff;opacity:.2;filter:alpha(opacity=20)}.close:hover,.close:focus{color:#000;text-decoration:none;cursor:pointer;opacity:.5;filter:alpha(opacity=50)}button.close{padding:0;cursor:pointer;background:0 0;border:0;-webkit-appearance:none}.modal-open{overflow:hidden}.modal{display:none;overflow:auto;overflow-y:scroll;position:fixed;top:0;right:0;bottom:0;left:0;z-index:1050;-webkit-overflow-scrolling:touch;outline:0}.modal.fade .modal-dialog{-webkit-transform:translate(0,-25%);-ms-transform:translate(0,-25%);transform:translate(0,-25%);-webkit-transition:-webkit-transform .3s ease-out;-moz-transition:-moz-transform .3s ease-out;-o-transition:-o-transform .3s ease-out;transition:transform .3s ease-out}.modal.in .modal-dialog{-webkit-transform:translate(0,0);-ms-transform:translate(0,0);transform:translate(0,0)}.modal-dialog{position:relative;width:auto;margin:10px}.modal-content{position:relative;background-color:#fff;border:1px solid #999;border:1px solid rgba(0,0,0,.2);border-radius:6px;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5);background-clip:padding-box;outline:0}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000}.modal-backdrop.fade{opacity:0;filter:alpha(opacity=0)}.modal-backdrop.in{opacity:.5;filter:alpha(opacity=50)}.modal-header{padding:15px;border-bottom:1px solid #e5e5e5;min-height:16.42857143px}.modal-header .close{margin-top:-2px}.modal-title{margin:0;line-height:1.42857143}.modal-body{position:relative;padding:20px}.modal-footer{margin-top:15px;padding:19px 20px 20px;text-align:right;border-top:1px solid #e5e5e5}.modal-footer .btn+.btn{margin-left:5px;margin-bottom:0}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}@media (min-width:768px){.modal-dialog{width:600px;margin:30px auto}.modal-content{-webkit-box-shadow:0 5px 15px rgba(0,0,0,.5);box-shadow:0 5px 15px rgba(0,0,0,.5)}.modal-sm{width:300px}}@media (min-width:992px){.modal-lg{width:900px}}.tooltip{position:absolute;z-index:1030;display:block;visibility:visible;font-size:12px;line-height:1.4;opacity:0;filter:alpha(opacity=0)}.tooltip.in{opacity:.9;filter:alpha(opacity=90)}.tooltip.top{margin-top:-3px;padding:5px 0}.tooltip.right{margin-left:3px;padding:0 5px}.tooltip.bottom{margin-top:3px;padding:5px 0}.tooltip.left{margin-left:-3px;padding:0 5px}.tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;text-decoration:none;background-color:#000;border-radius:4px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-left .tooltip-arrow{bottom:0;left:5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-right .tooltip-arrow{bottom:0;right:5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-width:5px 5px 5px 0;border-right-color:#000}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-width:5px 0 5px 5px;border-left-color:#000}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-left .tooltip-arrow{top:0;left:5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-right .tooltip-arrow{top:0;right:5px;border-width:0 5px 5px;border-bottom-color:#000}.popover{position:absolute;top:0;left:0;z-index:1010;display:none;max-width:276px;padding:1px;text-align:left;background-color:#fff;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);white-space:normal}.popover.top{margin-top:-10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-left:-10px}.popover-title{margin:0;padding:8px 14px;font-size:14px;font-weight:400;line-height:18px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.popover-content{padding:9px 14px}.popover>.arrow,.popover>.arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.popover>.arrow{border-width:11px}.popover>.arrow:after{border-width:10px;content:""}.popover.top>.arrow{left:50%;margin-left:-11px;border-bottom-width:0;border-top-color:#999;border-top-color:rgba(0,0,0,.25);bottom:-11px}.popover.top>.arrow:after{content:" ";bottom:1px;margin-left:-10px;border-bottom-width:0;border-top-color:#fff}.popover.right>.arrow{top:50%;left:-11px;margin-top:-11px;border-left-width:0;border-right-color:#999;border-right-color:rgba(0,0,0,.25)}.popover.right>.arrow:after{content:" ";left:1px;bottom:-10px;border-left-width:0;border-right-color:#fff}.popover.bottom>.arrow{left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#999;border-bottom-color:rgba(0,0,0,.25);top:-11px}.popover.bottom>.arrow:after{content:" ";top:1px;margin-left:-10px;border-top-width:0;border-bottom-color:#fff}.popover.left>.arrow{top:50%;right:-11px;margin-top:-11px;border-right-width:0;border-left-color:#999;border-left-color:rgba(0,0,0,.25)}.popover.left>.arrow:after{content:" ";right:1px;border-right-width:0;border-left-color:#fff;bottom:-10px}.carousel{position:relative}.carousel-inner{position:relative;overflow:hidden;width:100%}.carousel-inner>.item{display:none;position:relative;-webkit-transition:.6s ease-in-out left;transition:.6s ease-in-out left}.carousel-inner>.item>img,.carousel-inner>.item>a>img{line-height:1}.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block}.carousel-inner>.active{left:0}.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%}.carousel-inner>.next{left:100%}.carousel-inner>.prev{left:-100%}.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0}.carousel-inner>.active.left{left:-100%}.carousel-inner>.active.right{left:100%}.carousel-control{position:absolute;top:0;left:0;bottom:0;width:15%;opacity:.5;filter:alpha(opacity=50);font-size:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6)}.carousel-control.left{background-image:-webkit-linear-gradient(left,color-stop(rgba(0,0,0,.5) 0),color-stop(rgba(0,0,0,.0001) 100%));background-image:linear-gradient(to right,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1)}.carousel-control.right{left:auto;right:0;background-image:-webkit-linear-gradient(left,color-stop(rgba(0,0,0,.0001) 0),color-stop(rgba(0,0,0,.5) 100%));background-image:linear-gradient(to right,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1)}.carousel-control:hover,.carousel-control:focus{outline:0;color:#fff;text-decoration:none;opacity:.9;filter:alpha(opacity=90)}.carousel-control .icon-prev,.carousel-control .icon-next,.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right{position:absolute;top:50%;z-index:5;display:inline-block}.carousel-control .icon-prev,.carousel-control .glyphicon-chevron-left{left:50%}.carousel-control .icon-next,.carousel-control .glyphicon-chevron-right{right:50%}.carousel-control .icon-prev,.carousel-control .icon-next{width:20px;height:20px;margin-top:-10px;margin-left:-10px;font-family:serif}.carousel-control .icon-prev:before{content:'\2039'}.carousel-control .icon-next:before{content:'\203a'}.carousel-indicators{position:absolute;bottom:10px;left:50%;z-index:15;width:60%;margin-left:-30%;padding-left:0;list-style:none;text-align:center}.carousel-indicators li{display:inline-block;width:10px;height:10px;margin:1px;text-indent:-999px;border:1px solid #fff;border-radius:10px;cursor:pointer;background-color:#000 \9;background-color:rgba(0,0,0,0)}.carousel-indicators .active{margin:0;width:12px;height:12px;background-color:#fff}.carousel-caption{position:absolute;left:15%;right:15%;bottom:20px;z-index:10;padding-top:20px;padding-bottom:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6)}.carousel-caption .btn{text-shadow:none}@media screen and (min-width:768px){.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-prev,.carousel-control .icon-next{width:30px;height:30px;margin-top:-15px;margin-left:-15px;font-size:30px}.carousel-caption{left:20%;right:20%;padding-bottom:30px}.carousel-indicators{bottom:20px}}.clearfix:before,.clearfix:after,.container:before,.container:after,.container-fluid:before,.container-fluid:after,.row:before,.row:after,.form-horizontal .form-group:before,.form-horizontal .form-group:after,.btn-toolbar:before,.btn-toolbar:after,.btn-group-vertical>.btn-group:before,.btn-group-vertical>.btn-group:after,.nav:before,.nav:after,.navbar:before,.navbar:after,.navbar-header:before,.navbar-header:after,.navbar-collapse:before,.navbar-collapse:after,.pager:before,.pager:after,.panel-body:before,.panel-body:after,.modal-footer:before,.modal-footer:after{content:" ";display:table}.clearfix:after,.container:after,.container-fluid:after,.row:after,.form-horizontal .form-group:after,.btn-toolbar:after,.btn-group-vertical>.btn-group:after,.nav:after,.navbar:after,.navbar-header:after,.navbar-collapse:after,.pager:after,.panel-body:after,.modal-footer:after{clear:both}.center-block{display:block;margin-left:auto;margin-right:auto}.pull-right{float:right!important}.pull-left{float:left!important}.hide{display:none!important}.show{display:block!important}.invisible{visibility:hidden}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.hidden{display:none!important;visibility:hidden!important}.affix{position:fixed}@-ms-viewport{width:device-width}.visible-xs,.visible-sm,.visible-md,.visible-lg{display:none!important}@media (max-width:767px){.visible-xs{display:block!important}table.visible-xs{display:table}tr.visible-xs{display:table-row!important}th.visible-xs,td.visible-xs{display:table-cell!important}}@media (min-width:768px) and (max-width:991px){.visible-sm{display:block!important}table.visible-sm{display:table}tr.visible-sm{display:table-row!important}th.visible-sm,td.visible-sm{display:table-cell!important}}@media (min-width:992px) and (max-width:1199px){.visible-md{display:block!important}table.visible-md{display:table}tr.visible-md{display:table-row!important}th.visible-md,td.visible-md{display:table-cell!important}}@media (min-width:1200px){.visible-lg{display:block!important}table.visible-lg{display:table}tr.visible-lg{display:table-row!important}th.visible-lg,td.visible-lg{display:table-cell!important}}@media (max-width:767px){.hidden-xs{display:none!important}}@media (min-width:768px) and (max-width:991px){.hidden-sm{display:none!important}}@media (min-width:992px) and (max-width:1199px){.hidden-md{display:none!important}}@media (min-width:1200px){.hidden-lg{display:none!important}}.visible-print{display:none!important}@media print{.visible-print{display:block!important}table.visible-print{display:table}tr.visible-print{display:table-row!important}th.visible-print,td.visible-print{display:table-cell!important}}@media print{.hidden-print{display:none!important}} ------------yLsh28qWOSrurz6bIywB5L Content-Disposition: inline Content-Type: image/png Content-Location: http://www.frasedehoy.com/img/bkg_quote.png Content-Transfer-Encoding: Base64 iVBORw0KGgoAAAANSUhEUgAAAKwAAAB/CAYAAABymylZAAAAGXRFWHRTb2Z0d2Fy ZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAE3lJREFUeNrsnQ+MHNV9x9/Mztl3u3v7 f+9wjyQn4ShxqdtSFcORBBqDTYliGYciWwLiJK6uMpYVB6iNRYEiYvCfJrFqBRJQ RJwQxZabGofUxoHQ5krsxkSxUKSaSiCTPyeDd2//3u792d2Z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Rn3YVvmQ9CuTHwb/F+CvxvKaJvNPgh/B4nnwY53+qgvyKvh+ 8H8JfhVWr8Lq/ibyz4N/DatfI7TpSiZdceznz2Qy7FmtMfvEIpNOYM4w821HOoeg UwZvdzdRuzQmNoxhAhyLz9wnow+DxwtFu/ku8B7wcfDaAvw0+DHwU+ANweqXjVfA LwXvBR+sw18GPw2+xLP+/xdgAOsBhSnqxgQ6AAAAAElFTkSuQmCC ------------yLsh28qWOSrurz6bIywB5L Content-Disposition: inline; filename=frasedehoy.css Content-Type: text/css; name=frasedehoy.css Content-Location: http://www.frasedehoy.com/css/frasedehoy.css?v=20140307 Content-Transfer-Encoding: 8bit a{color:#333333} a:hover{color:#6d8d43; text-decoration: none} hr{border-color:#d6d6d6} .ptsans{font-family: 'PT Sans Narrow', sans-serif;} body{background: url(../img/bkg_quote.png) no-repeat;} .georgia{font-family: Georgia;} .arial{font-family: Arial, Helvetica, sans-serif;} .lucida {font-family: 'lucida grande',tahoma,verdana,arial,sans-serif;} .clickme{cursor: pointer} .oculto{display: none} .score{color: #a98e20} .fb-comments, .fb-comments span, .fb-comments.fb_iframe_widget span iframe {width: 100% !important;} .no-padding-left{padding-left:0} .alert h4 {font-weight: bold} .btn-vote {background: transparent;} .caret-vote {margin-left:65px !important} .layout-ad {z-index: 1} #head{margin-bottom:30px; margin-top:30px} #head .fb-follow{line-height: 31px} #logo {margin-bottom:5px} #container_search{position:relative; margin-bottom:5px} #container_search input{padding-right:24px; font-size: 0.9em} #container_search ::-webkit-input-placeholder {font-style: italic} #container_search ::-moz-placeholder {font-style: italic} #container_search ::-moz-placeholder{font-style: italic} #container_search ::-ms-input-placeholder{font-style: italic} #container_search .glyphicon-search{color:gray; position: absolute; right: 8px; top:9px} #main_menu{font-size: 1.15em; font-weight: bold} #main_menu ul{line-height: 2em} #main_menu ul li{padding-right:9px} #main_menu .glyphicon-plus-sign {color:#6d8d43; font-size:0.9em} #main_menu .registro-login{font-size:1.2em} #main_menu .registro-login a{color:#997e11;} #view_home #frase_container {background: url(../img/bkg_frase.jpg) no-repeat;} #view_home #frase_container .frase-big{font-weight:bold; font-size:3.8em; padding:0 20px 0 20px} #view_home #frase_container .frase-big-xs{font-size:2.8em; padding:0 20px 0 20px} #view_home #frase_container .autor {font-weight:bold; font-size:2em; color:#a98e20} #view_home #frase_container .autor a{color:#a98e20} #view_home #frase_container .cantidad-frases{text-decoration: underline; font-style: italic;} #view_home #frase_container .cantidad-frases a{color:#333333} #view_home #frase_container .fecha{line-height: 40px; font-size:0.9em} #view_home #categorias div span {font-size:1.2em; font-weight: bold} #view_home #categorias ul li {font-style: italic; font-size:0.9em} #view_home #categorias span a{color:#151515} #view_home #categorias a{color:#333333} #view_home #browser #tabs{font-size:1.2em; font-weight: bold} #view_home #browser #tabs .active a{background-color: #000000; color:#FFFFFF} #view_home #browser #tabs a:hover{background-color: #151515; color:#FFFFFF} #view_home #browser #tabs {border-bottom:2px solid #000000} #view_home #browser .tab-content {margin-top:20px; margin-left:15px; overflow:auto;} #view_home #browser .tab-content div ul li {float:left; width:20%; margin:0 35px 5px 0;} #view_home #browser .tab-content div ul li[class=visible-xs] {width:45%; margin:0 5px 25px 0;} #view_home #browser .tab-content div ul li .ptsans {font-size:1.4em; font-weight: bold} #view_home #browser .tab-content div ul li .georgia {font-size:0.9em; text-decoration: underline; font-style: italic} #view_home #browser .tab-content ul li {line-height: 16px; } #view_home #puntaje .glyphicon-star {font-size: 1.3em;} #view_home #puntaje .ptsans {font-size: 2.3em; margin-left:8px} #view_home #puntaje small {position: relative; top:-8px} #view_home #puntaje small i {font-size: 0.9em;} #view_home #container_votar {line-height: 44px} #view_home #share_buttons ul {list-style: none; margin: 0 0 20px 0; padding: 0;width: 100%;} #view_home #share_buttons ul li {display: block; float: left; margin-right: 10px;} #view_home #frase_share_xs {margin-top:10px} #view_home #frase_share_xs ul {list-style: none; margin:0; padding: 0;width: 100%;} #view_home #frase_share_xs ul li {display: block; margin-bottom:5px} #vista_autor #autor .titulo {font-style: italic; font-size:1em} #vista_autor #autor #nombre {font-weight:bold; font-size:3.4em; margin-top:0} #vista_autor #autor #ver_mas span {font-weight: bold; text-decoration: underline} #vista_autor #container_frases_autor .lista-frases .frase {font-size: 1.3em} #vista_autor #container_frases_autor .lista-frases small {font-size: 0.9em} #vista_autor #container_frases_autor .ruler-lista-frases {border-color:#e6e6e6} #vista_autor #container_frases_autor .lista-frases .puntaje {position: relative; top:5px; height: 35px;} #vista_autor #container_frases_autor .lista-frases .glyphicon-star {font-size:0.8em} #vista_autor #container_frases_autor .frase-share small a span {text-decoration: underline; font-style: italic} #vista_autor #container_frases_autor .frase-share small a img {text-decoration: none;} #vista_autores .lista-autores {font-size: 1.3em} #msg_404 {margin:120px 0} #vista_frase #titulo {font-style: italic; font-size:1.1em} #vista_frase #frase {font-weight:bold; font-size:3.0em; padding:0 20px} #vista_frase #autor {font-weight:bold; font-size:1.6em; color:#a98e20} #vista_frase #autor a{color:#a98e20} #vista_frase #puntaje .glyphicon-star {font-size: 0.7em} #vista_frase #puntaje span {font-size: 1.2em;} #vista_frase #share_bar {margin-top:20px; margin-bottom:30px;} #vista_frase #share_bar .share-buttons {margin-top:5px} #vista_frase #share_bar .share-buttons ul {list-style: none; padding:0} #vista_frase #share_bar .share-buttons ul li {margin:0; height: 28px} #vista_frase #titulo_comentarios {font-weight: bold} #vista_frase #cuerpo_comentario, #vista_frase #titulo_comentario {font-size: 11px;} #vista_frase #autor_comentario { color:#3b5998; font-weight: bold; font-size:11px} #vista_frase #timestamp_comentario { color:#a98e20;} .register-box, .login-box {position: absolute; margin-top:10px; z-index:9000; background-color: #D5D6C7; color:#696464; padding:10px 15px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; font-size:0.9em} .registro-login ul {list-style: none; padding:0; margin:0} .registro-login ul li {padding:0; margin:0} .login-box label, .register-box label {font-size: 0.8em;} .login-box .caret-up, .register-box .caret-up {width:0;height:0;border-left:12px solid transparent;border-right:12px solid transparent;border-bottom:12px solid #D5D6C7; position:absolute; top:-12px; left:15px} .login-box form a, .register-box form a {font-size:0.7em; color:#FFFFFF !important; text-decoration: underline} .login-box .checkbox, .register-box .checkbox {line-height:15px} .login-box .fb_login, .register-box .fb_login {background: url(../img/btn_fb_login.png) no-repeat 6px; width: 160px; border:none;} .login-box .fb_login span, .register-box .fb_login span {float: left; margin-left:15px; line-height: 25px; text-decoration: none; font-weight: bold; font-size:1.1em} .register-box p {font-size:0.7em; line-height: 1.5em; font-weight: lighter} .register-box select {font-size:0.8em;} .register-box .form-group {margin-bottom:0} #vista_categoria #autor {font-size:1em; margin-top:10px;} #vista_categoria #autor a {font-weight: bold} #container_frases .lista-frases .frase {font-size: 1.3em} #container_frases .lista-frases small {font-size: 0.9em} #container_frases .ruler-lista-frases {border-color:#e6e6e6} #container_frases .lista-frases .puntaje {position: relative; top:5px; height: 35px;} #container_frases .lista-frases .glyphicon-star {font-size:0.8em} #container_frases .frase-share ul {padding:0; list-style: none} #container_frases .frase-share ul li {margin:0; height: 28px} #container_frases .frase-share small a span {text-decoration: underline; font-style: italic} #container_frases .frase-share small a img {text-decoration: none;} #footer small {font-size: 0.8em; color:#666666} .twitter-typeahead {display: block !important} .tt-hint {display: none !important} .twitter-typeahead .tt-query,.twitter-typeahead .tt-hint {margin-bottom: 0;} .tt-dropdown-menu {min-width: 160px;margin-top: 2px;padding: 5px 0;background-color: #fff;border: 1px solid #ccc;border: 1px solid rgba(0,0,0,.2);*border-right-width: 2px;*border-bottom-width: 2px;-webkit-border-radius: 6px;-moz-border-radius: 6px;border-radius: 6px;-webkit-box-shadow: 0 5px 10px rgba(0,0,0,.2);-moz-box-shadow: 0 5px 10px rgba(0,0,0,.2);box-shadow: 0 5px 10px rgba(0,0,0,.2);-webkit-background-clip: padding-box;-moz-background-clip: padding;background-clip: padding-box;width: 100% !important} .tt-suggestion {display: block;padding: 3px 20px;} .tt-suggestion.tt-is-under-cursor {color: #fff;background-color: #0081c2;background-image: -moz-linear-gradient(top, #0088cc, #0077b3);background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0077b3));background-image: -webkit-linear-gradient(top, #0088cc, #0077b3);background-image: -o-linear-gradient(top, #0088cc, #0077b3);background-image: linear-gradient(to bottom, #0088cc, #0077b3);background-repeat: repeat-x;filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0)} .tt-suggestion.tt-is-under-cursor a {color: #fff;} .tt-suggestion p {margin: 0;} .share_friend_div {background: #EAEAEA; border:1px solid #DADADA; border-right:none; border-left:none; padding:7px 0; font-size:1.1em; margin:5px} #skyscrapper {z-index: 1000} .fb-comments { width:100%; } ------------yLsh28qWOSrurz6bIywB5L Content-Disposition: inline; filename=jquery.js Content-Type: application/javascript; charset=utf-8; name=jquery.js Content-Location: http://code.jquery.com/jquery.js Content-Transfer-Encoding: Base64 LyohCiAqIGpRdWVyeSBKYXZhU2NyaXB0IExpYnJhcnkgdjEuMTEuMQogKiBodHRw Oi8vanF1ZXJ5LmNvbS8KICoKICogSW5jbHVkZXMgU2l6emxlLmpzCiAqIGh0dHA6 Ly9zaXp6bGVqcy5jb20vCiAqCiAqIENvcHlyaWdodCAyMDA1LCAyMDE0IGpRdWVy eSBGb3VuZGF0aW9uLCBJbmMuIGFuZCBvdGhlciBjb250cmlidXRvcnMKICogUmVs ZWFzZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlCiAqIGh0dHA6Ly9qcXVlcnkub3Jn L2xpY2Vuc2UKICoKICogRGF0ZTogMjAxNC0wNS0wMVQxNzo0MloKICovCgooZnVu Y3Rpb24oIGdsb2JhbCwgZmFjdG9yeSApIHsKCglpZiAoIHR5cGVvZiBtb2R1bGUg PT09ICJvYmplY3QiICYmIHR5cGVvZiBtb2R1bGUuZXhwb3J0cyA9PT0gIm9iamVj dCIgKSB7CgkJLy8gRm9yIENvbW1vbkpTIGFuZCBDb21tb25KUy1saWtlIGVudmly b25tZW50cyB3aGVyZSBhIHByb3B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disposition: inline; filename=bootstrap.min.js Content-Type: text/javascript; name=bootstrap.min.js Content-Location: http://www.frasedehoy.com/js/bootstrap.min.js Content-Transfer-Encoding: 8bit /*! * Bootstrap v3.1.1 (http://getbootstrap.com) * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one(a.support.transition.end,function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b()})}(jQuery),+function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function c(){f.trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one(a.support.transition.end,c).emulateTransitionEnd(150):c())};var d=a.fn.alert;a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("bs.alert");e||d.data("bs.alert",e=new c(this)),"string"==typeof b&&e[b].call(d)})},a.fn.alert.Constructor=c,a.fn.alert.noConflict=function(){return a.fn.alert=d,this},a(document).on("click.bs.alert.data-api",b,c.prototype.close)}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.isLoading=!1};b.DEFAULTS={loadingText:"loading..."},b.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",f.resetText||d.data("resetText",d[e]()),d[e](f[b]||this.options[b]),setTimeout(a.proxy(function(){"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},b.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?a=!1:b.find(".active").removeClass("active")),a&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}a&&this.$element.toggleClass("active")};var c=a.fn.button;a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof c&&c;e||d.data("bs.button",e=new b(this,f)),"toggle"==c?e.toggle():c&&e.setState(c)})},a.fn.button.Constructor=b,a.fn.button.noConflict=function(){return a.fn.button=c,this},a(document).on("click.bs.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle"),b.preventDefault()})}(jQuery),+function(a){"use strict";var b=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},b.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},b.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},b.prototype.to=function(b){var c=this,d=this.getActiveIndex();return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},b.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},b.prototype.next=function(){return this.sliding?void 0:this.slide("next")},b.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},b.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}if(e.hasClass("active"))return this.sliding=!1;var j=a.Event("slide.bs.carousel",{relatedTarget:e[0],direction:g});return this.$element.trigger(j),j.isDefaultPrevented()?void 0:(this.sliding=!0,f&&this.pause(),this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid.bs.carousel",function(){var b=a(i.$indicators.children()[i.getActiveIndex()]);b&&b.addClass("active")})),a.support.transition&&this.$element.hasClass("slide")?(e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid.bs.carousel")},0)}).emulateTransitionEnd(1e3*d.css("transition-duration").slice(0,-1))):(d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid.bs.carousel")),f&&this.cycle(),this)};var c=a.fn.carousel;a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c),g="string"==typeof c?c:f.slide;e||d.data("bs.carousel",e=new b(this,f)),"number"==typeof c?e.to(c):g?e[g]():f.interval&&e.pause().cycle()})},a.fn.carousel.Constructor=b,a.fn.carousel.noConflict=function(){return a.fn.carousel=c,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(b){var c,d=a(this),e=a(d.attr("data-target")||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"")),f=a.extend({},e.data(),d.data()),g=d.attr("data-slide-to");g&&(f.interval=!1),e.carousel(f),(g=d.attr("data-slide-to"))&&e.data("bs.carousel").to(g),b.preventDefault()}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var b=a(this);b.carousel(b.data())})})}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.DEFAULTS={toggle:!0},b.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},b.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b=a.Event("show.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.$parent&&this.$parent.find("> .panel > .in");if(c&&c.length){var d=c.data("bs.collapse");if(d&&d.transitioning)return;c.collapse("hide"),d||c.data("bs.collapse",null)}var e=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[e](0),this.transitioning=1;var f=function(){this.$element.removeClass("collapsing").addClass("collapse in")[e]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return f.call(this);var g=a.camelCase(["scroll",e].join("-"));this.$element.one(a.support.transition.end,a.proxy(f,this)).emulateTransitionEnd(350)[e](this.$element[0][g])}}},b.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?void this.$element[c](0).one(a.support.transition.end,a.proxy(d,this)).emulateTransitionEnd(350):d.call(this)}}},b.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var c=a.fn.collapse;a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c);!e&&f.toggle&&"show"==c&&(c=!c),e||d.data("bs.collapse",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.collapse.Constructor=b,a.fn.collapse.noConflict=function(){return a.fn.collapse=c,this},a(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(b){var c,d=a(this),e=d.attr("data-target")||b.preventDefault()||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,""),f=a(e),g=f.data("bs.collapse"),h=g?"toggle":d.data(),i=d.attr("data-parent"),j=i&&a(i);g&&g.transitioning||(j&&j.find('[data-toggle=collapse][data-parent="'+i+'"]').not(d).addClass("collapsed"),d[f.hasClass("in")?"addClass":"removeClass"]("collapsed")),f.collapse(h)})}(jQuery),+function(a){"use strict";function b(b){a(d).remove(),a(e).each(function(){var d=c(a(this)),e={relatedTarget:this};d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown",e)),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown",e))})}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}var d=".dropdown-backdrop",e="[data-toggle=dropdown]",f=function(b){a(b).on("click.bs.dropdown",this.toggle)};f.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(''}),b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),b.prototype.constructor=b,b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content")[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},b.prototype.hasContent=function(){return this.getTitle()||this.getContent()},b.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},b.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var c=a.fn.popover;a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof c&&c;(e||"destroy"!=c)&&(e||d.data("bs.popover",e=new b(this,f)),"string"==typeof c&&e[c]())})},a.fn.popover.Constructor=b,a.fn.popover.noConflict=function(){return a.fn.popover=c,this}}(jQuery),+function(a){"use strict";function b(c,d){var e,f=a.proxy(this.process,this);this.$element=a(a(c).is("body")?window:c),this.$body=a("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",f),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||(e=a(c).attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=a([]),this.targets=a([]),this.activeTarget=null,this.refresh(),this.process()}b.DEFAULTS={offset:10},b.prototype.refresh=function(){var b=this.$element[0]==window?"offset":"position";this.offsets=a([]),this.targets=a([]);{var c=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[b]().top+(!a.isWindow(c.$scrollElement.get(0))&&c.$scrollElement.scrollTop()),e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){c.offsets.push(this[0]),c.targets.push(this[1])})}},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,d=c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(b>=d)return g!=(a=f.last()[0])&&this.activate(a);if(g&&b<=e[0])return g!=(a=f[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parentsUntil(this.options.target,".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")};var c=a.fn.scrollspy;a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=c,this},a(window).on("load",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(jQuery),+function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.parent("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},b.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one(a.support.transition.end,e).emulateTransitionEnd(150):e(),f.removeClass("in")};var c=a.fn.tab;a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new b(this)),"string"==typeof c&&e[c]()})},a.fn.tab.Constructor=b,a.fn.tab.noConflict=function(){return a.fn.tab=c,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})}(jQuery),+function(a){"use strict";var b=function(c,d){this.options=a.extend({},b.DEFAULTS,d),this.$window=a(window).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(c),this.affixed=this.unpin=this.pinnedOffset=null,this.checkPosition()};b.RESET="affix affix-top affix-bottom",b.DEFAULTS={offset:0},b.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(b.RESET).addClass("affix");var a=this.$window.scrollTop(),c=this.$element.offset();return this.pinnedOffset=c.top-a},b.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},b.prototype.checkPosition=function(){if(this.$element.is(":visible")){var c=a(document).height(),d=this.$window.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"top"==this.affixed&&(e.top+=d),"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top(this.$element)),"function"==typeof h&&(h=f.bottom(this.$element));var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=c-h?"bottom":null!=g&&g>=d?"top":!1;if(this.affixed!==i){this.unpin&&this.$element.css("top","");var j="affix"+(i?"-"+i:""),k=a.Event(j+".bs.affix");this.$element.trigger(k),k.isDefaultPrevented()||(this.affixed=i,this.unpin="bottom"==i?this.getPinnedOffset():null,this.$element.removeClass(b.RESET).addClass(j).trigger(a.Event(j.replace("affix","affixed"))),"bottom"==i&&this.$element.offset({top:c-h-this.$element.height()}))}}};var c=a.fn.affix;a.fn.affix=function(c){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof c&&c;e||d.data("bs.affix",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.affix.Constructor=b,a.fn.affix.noConflict=function(){return a.fn.affix=c,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var b=a(this),c=b.data();c.offset=c.offset||{},c.offsetBottom&&(c.offset.bottom=c.offsetBottom),c.offsetTop&&(c.offset.top=c.offsetTop),b.affix(c)})})}(jQuery); ------------yLsh28qWOSrurz6bIywB5L Content-Disposition: inline; filename=frasedehoy.min.js Content-Type: text/javascript; name=frasedehoy.min.js Content-Location: http://www.frasedehoy.com/js/frasedehoy.min.js Content-Transfer-Encoding: 8bit var fdh={};fdh.base="/";fdh.util={ajax:function(e,t,n,r,i,s){$.ajax({url:e,type:t,cache:false,dataType:r,data:n,beforeSend:function(){fdh.util.ajax_loading(i)},error:function(e,t,n){console.log(e);console.log(t);console.log(n)},success:function(e,t){if(e==null){return}$("#top_errors").hide();$("#top_errors").html("");if(typeof e=="object"){fdh.util.msg_ui.hide_fields_validation_errors();$.each(e,function(e,t){if(t!==null){if(t.hasOwnProperty("ui")){fdh.util.msg_ui.fields_validation(t.ui)}}})}$("#btn_save, .btn_save").button("reset");if(typeof s!="undefined"){s.success(e,t)}},complete:function(e,t){fdh.util.ajax_finish(i)}})},ajax_loading:function(e){if(typeof e!=null){$(e).html($("#ajax_loader").html()).fadeIn("fast")}},ajax_finish:function(e){if(typeof e!=null&&e!=""){$(e+" #ajax_loading_block").fadeOut("fast",function(){$(e+" #ajax_loader_block").remove()})}},translate:function(e,t){var n={success:function(e,n){t(e)}};var r={string:JSON.stringify(e)};fdh.util.ajax(fdh.base+"translate","POST",r,"","",n)},cancel_bubble_propagation:function(){if(!e)var e=window.event;e.cancelBubble=true;if(e.stopPropagation)e.stopPropagation()},remove_element:function(e,t){$(e).slideUp("medium",function(){$(this).remove();if(typeof t!="undefined"){t()}})},setup_number_elements:function(e){if(typeof e=="undefined"){e=$("form input")}$.each(e,function(e,t){if($(t).hasClass("awspay-input-type-decimal")){$(t).intOnly(4)}else if($(t).hasClass("awspay-input-type-price-int")){$(t).intOnly(15);var n=$(t).parent().children('input[class*="awspay-input-type-decimal"]');$(t).bind("keyup",{id:n},function(e){jump_decimal(e.data.id)})}})},log_comment:function(e){var t=FB.Data.query("SELECT text, fromid FROM comment WHERE post_fbid='"+e.commentID+"' AND object_id IN (SELECT comments_fbid FROM link_stat WHERE url='"+e.href+"')");var n=FB.Data.query("SELECT uid, name, first_name, middle_name, last_name, sex, locale, pic_small_with_logo, pic_big_with_logo, pic_square_with_logo, pic_with_logo, username, contact_email, username, birthday_date, email, quotes, timezone FROM user WHERE uid in (select fromid from {0})",t);FB.Data.waitOn([t,n],function(){var e=t.value[0];var r=n.value[0];fdh.util.ajax(fdh.base+"frase/comentario/save","POST",{user:JSON.stringify(r),comment:JSON.stringify(e),id:$("#id_frase").val(),uid:String(r.uid)},"json",null)})}};fdh.util.msg_ui={top_alerts:function(e){switch(e.property){case"top_alert":$.get(fdh.base+"ajax_response/views/"+e.type,function(e){$("#top_errors").prepend(e)}).success(function(){$("#error_msg").html(e.msg);$("#top_errors").fadeIn();$("html, body").animate({scrollTop:0},"fast")});break}},js_ready_messages:function(){fdh.util.ajax(fdh.base+"ajax_messages/ui/out","GET",null,"json",null)},hide_fields_validation_errors:function(){$('div[id^="div_"]').removeClass("has-error");$('div[id^="msg_error"]').hide().removeClass("help-block")},fields_validation:function(e){$.each(e,function(t,n){switch(t){case"property":if(n=="top_alert"){fdh.util.msg_ui.top_alerts(e)}else{$("#div_"+n).addClass("has-error");$("#msg_error_"+n).addClass("help-block").html(e.msg).fadeIn()}break}})}};fdh.util.alert={ok_function:false,cancel_function:"fdh.util.remove_element('#alert-container');",ok_label:"",cancel_label:"",head_text:"",body_text:"",type_class:"info-danger",target:"#top_errors",reset:function(){fdh.util.alert.ok_function=false;fdh.util.alert.cancel_function="fdh.util.remove_element('#alert-container');";fdh.util.alert.ok_label="";fdh.util.alert.cancel_label="";fdh.util.alert.head_text="";fdh.util.alert.body_text="";fdh.util.alert.type_class="info-danger";fdh.util.alert.target="#top_errors"},create:function(){var callback={success:function(data,textStatus){$(fdh.util.alert.target).html(data);$(fdh.util.alert.target+" .alert-heading").html(fdh.util.alert.head_text);$(fdh.util.alert.target+" .alert-body").html(fdh.util.alert.body_text);if(fdh.util.alert.ok_label!=""){$(fdh.util.alert.target+" .alert-button-ok").html(fdh.util.alert.ok_label);$(fdh.util.alert.target+" .alert-button-ok").click(function(){eval(fdh.util.alert.ok_function)})}else{$(fdh.util.alert.target+" .alert-button-ok").hide()}if(fdh.util.alert.cancel_label!=""){$(fdh.util.alert.target+" .alert-button-cancel").html(fdh.util.alert.cancel_label);$(fdh.util.alert.target+" .alert-button-cancel").click(function(){eval(fdh.util.alert.cancel_function)})}else{$(fdh.util.alert.target+" .alert-button-cancel").hide()}$(fdh.util.alert.target).fadeIn();$("html, body").animate({scrollTop:0},"fast")}};fdh.util.ajax(fdh.base+"ajax_response/views/alert","POST","","","",callback)}};fdh.frase={vote:function(e,t,n,r){var i={success:function(e,t){n.prop("disabled",true);if(typeof r!="undefined"){r()}}};var s=false;if(typeof r!="undefined"){s=true}var o={id:e,score:t,redirect:s};fdh.util.ajax(fdh.base+"votar/frase","POST",o,"json","",i)},load_seo_comment:function(){var e={success:function(e,t){$("#fb_seo").html(e.view)}};fdh.util.ajax(fdh.base+"frase/seo/comments","POST",{id:$("#id_frase").val()},"json","",e)},send_new:function(){var e=0;if($("#autor_check").val()==$("#autor").val()){e=$("#autor_id").val()}fdh.util.ajax(fdh.base+"frases/enviar_nueva/send","POST",{frase:$("#frase_nueva").val(),id_autor:e,autor:$("#autor").val()},"json","")},share:function(e){var t={success:function(t,n){if(t[0].data.hasOwnProperty("success")){if(t[0].data.success===true){$("#share_friend_div_"+e).slideToggle("fast");$("#share_friend_form_"+e+" input").val("")}}}};var n={share_url_from_name:$("#share_url_from_name_"+e).val(),share_url_from_email:$("#share_url_from_email_"+e).val(),share_url_friend_name:$("#share_url_friend_name_"+e).val(),share_url_friend_email:$("#share_url_friend_email_"+e).val(),id:e};fdh.util.ajax(fdh.base+"frases/share/friend","POST",n,"json","",t)}};fdh.login={login:function(){var e={success:function(e,t){if(e[0].hasOwnProperty("data")){if(e[0].data.success===true){location.reload()}}}};var t={username:$("#username").val(),password:$("#password").val(),remember:$("#remember").prop("checked")};fdh.util.ajax(fdh.base+"login/check","POST",t,"json","",e)},signup:function(){var e={success:function(e,t){if(e[0].hasOwnProperty("data")){if(e[0].data.success===true){$("#register_box form *").prop("disabled",true);if(e[0].data.elistas!==null){$("body").append('')}}}}};var t={username:$("#rusername").val(),email:$("#email").val(),pais:$("#pais").val(),frase_preferida:$("#frase").val(),mostrar_mail:$("#mostrar_mail").prop("checked"),recibir_frases:$("#recibir_frases").prop("checked")};fdh.util.ajax(fdh.base+"registro","POST",t,"json","",e)}};fdh.usuario={save:function(){var e={success:function(e,t){if(e[0].hasOwnProperty("data")){if(e[0].data.success===true){$("#password, #repassword").val("")}}}};var t={username:$("#username").val(),email:$("#email").val(),pais:$("#pais").val(),frase_preferida:$("#frase").val(),mostrar_email:$("#mostrar_email").prop("checked"),password:$("#password").val(),repassword:$("#repassword").val(),desconectar:$("#desconectar").prop("checked")};fdh.util.ajax(fdh.base+"usuario/perfil/save","POST",t,"json","",e)},rpass:function(){var e={success:function(e,t){if(e[0].hasOwnProperty("data")){if(e[0].data.success===true){$("#remail").prop("readonly",true);$("#btn_save").fadeOut("fast",function(){$(this).remove()})}}}};var t={remail:$("#remail").val()};fdh.util.ajax(fdh.base+"send_reset_key","POST",t,"json","",e)}} ------------yLsh28qWOSrurz6bIywB5L Content-Disposition: inline; filename=logo_frasedehoy.gif Content-Type: image/gif; name=logo_frasedehoy.gif Content-Location: http://www.frasedehoy.com/img/logo_frasedehoy.gif Content-Transfer-Encoding: Base64 R0lGODlhxgAoANUAAJuAFNrQpI12G6uaUr2iNKyRJKSJHMWtTOTk5MSpPLWaLdTF ifHx8erjxrmeMbikVJuEJevm06GHGtjKk8a6i9/Wsff056mOIsKmOfr48eTexca3 etG8ZK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/wNcVS3EOzXlIfadSX0m+45gi3ECLo6BB84RggQgJhkIF 6EDAjNYBCUCAlRaMATgBEAN2SiAGfMxfZL7mCxx9rhP/ZlECaOxTDlMJtJG+iAs8 S6OYd9EAJJVC5pZ28E//9ACi1SnkEEJwUUc1DXDiM4BJ2RmDqsbAiJlbaVZbSoQa QI86PVAqykJUkSPcAA1omUFRO5cGJ5yhXkxYAQscRS2o0k6PUnWlVa0Ky0aQTgkI 8AxLu1jWwjahARiFmF2HSEST7rWqAHBBYVFUSRSJybCYlaFiJRZVPTr2sQAILQDc iY6tbXEglcysapOwgIhxtrON1StoRRtawvgDZpJRx2VXy9tniY+xrZTtXmlL276+ 42M2GEmdeMvcI0SABRX0LFVnS9zQGvcdmYynWJvL21W4ILbCtSoAREBeCVT3uu+g RqchhMld7mYgACBwQXirKoINuFMDA6CtbdvLX/6WIAAB2MACAlABrBYBj6ElbX8X zOAkTAAAA2iwhCd8hApEisIYzjCGgwAAOw== ------------yLsh28qWOSrurz6bIywB5L Content-Disposition: inline; filename=icon_url.png Content-Type: image/png; name=icon_url.png Content-Location: http://www.frasedehoy.com/img/icon_url.png Content-Transfer-Encoding: Base64 iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAGXRFWHRTb2Z0d2Fy ZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAYhJREFUeNqc1E8oBFEcwHE7u0L5F7LG zcEFSbsHB1cn5agoctDe5M9RSjk5IAclF/aghBS5k4uDw1hcWMKFIgcucmDx/dVP vaadbWZ+9ck2897Pb977vRdJJBJFIaMP46hDBrOO41xHQiYcxIbr2TO6orZtB01W ij1UuZ6Xw7JCVBdHo8e7ZitgZSPYR8xjzF3MRyIZ048ptBQY94ZlM2E32vCia/SN IYzC3LkvbOMCvajHOebZ5awkjGINw8akS/ygw3j2i13MaZtILMh8EuXMz0m5kkm0 uyo6kApw6v5OM9l/wgGPNZEK01jEld+ds7QCr5BmfQ3SU5JwvcC7adxiCbbfhJu6 PmalslZP+rsaE7qrM6gxezOZTNaaCc2z3Iom7acTPfQpvQDixpxHrKJE26oCWfln bNChn8tBko1pP1YWGPeJTj+XwweOsKOT5LSU5RlXjFyQs3yvx69HmzxfNIS5bRy5 BDzeZcIklDM+qX/NOMNKmAtW4gbH+ukP2JJNY5ff/wQYAOdNXYq5rE/zAAAAAElF TkSuQmCC ------------yLsh28qWOSrurz6bIywB5L Content-Disposition: inline; filename=f.js Content-Type: text/javascript; charset=UTF-8; name=f.js Content-Location: http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js Content-Transfer-Encoding: Quoted-Printable (function(){var p=3Dthis,aa=3Dfunction(a){var b=3Dtypeof a;if("object"=3D= =3Db)if(a){if(a instanceof Array)return"array";if(a instanceof Object)re= turn b;var c=3DObject.prototype.toString.call(a);if("[object Window]"=3D= =3Dc)return"object";if("[object Array]"=3D=3Dc||"number"=3D=3Dtypeof a.l= ength&&"undefined"!=3Dtypeof a.splice&&"undefined"!=3Dtypeof a.propertyI= sEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object= Function]"=3D=3Dc||"undefined"!=3Dtypeof a.call&&"undefined"!=3Dtypeof = a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"= }else return"null"; else if("function"=3D=3Db&&"undefined"=3D=3Dtypeof a.call)return"object"= ;return b},ba=3Dfunction(a){var b=3Dtypeof a;return"object"=3D=3Db&&null= !=3Da||"function"=3D=3Db},ca=3Dfunction(a,b,c){return a.call.apply(a.bin= d,arguments)},da=3Dfunction(a,b,c){if(!a)throw Error();if(2a?0:a},y=3Dfunction(a= ,b){return/^true$/.test(a)?!0:/^false$/.test(a)?!1:b},ha=3D/^([\w-]+\.)*= ([\w-]{2,})(\:[0-9]+)?$/,ia=3Dfunction(a,b){if(!a)return b;var c=3Da.mat= ch(ha);return c?c[0]:b};var ja=3Dt("0.15"),ka=3Dt("0.0"),la=3Dt("0.01"),= ma=3Dt("0.001"),na=3Dt("0.01"),oa=3Dt("0.001"),pa=3Dt("0.2"),qa=3Dy("tru= e",!0),ra=3Dt("0.001");var sa=3Dy("false",!1),ta=3Dy("false",!1),ua=3Dy(= "false",!1),va=3Dua||!ta;var wa=3DString.prototype.trim?function(a){retu= rn a.trim()}:function(a){return a.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},= xa=3D/&/g,ya=3D//g,Aa=3D/"/g,Ba=3D/'/g,Ca=3D/\x00/g,Da=3D{"\x= 00":"\\0","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":= "\\x0B",'"':'\\"',"\\":"\\\\"},z=3D{"'":"\\'"},Ea=3Dfunction(a,b){return= ab?1:0};var D=3Dfunction(a){D[" "](a);return a};D[" "]=3Dfuncti= on(){};var F=3Dfunction(a){try{var b;if(b=3D!!a&&null!=3Da.location.href= )a:{try{D(a.foo);b=3D!0;break a}catch(c){}b=3D!1}return b}catch(d){retur= n!1}},G=3Dfunction(a,b){if(!(1E-4>Math.random())){var c=3DMath.random();= if(carguments.l= ength))for(var c=3D1,d=3Darguments.length;c>2)+a.charCodeAt(d)&4294= 967295;return 0");a=3Da.id;b=3D"bor= der:none;height:"+c+"px;margin:0;padding:0;position:relative;visibility:= visible;width:"+b+"px;background-color:transparent";return['',d.join(" "),""].joi= n("")};var Sa=3D!0,Ta=3DMath.random(),Ua=3D{},Xa=3Dfunction(a,b,c,d){var= e=3DVa,g,f=3DSa;try{g=3Db()}catch(h){try{var l=3DIa(h);b=3D"";h.fileNam= e&&(b=3Dh.fileName);var k=3D-1;h.lineNumber&&(k=3Dh.lineNumber);f=3De(a,= l,b,k,c)}catch(m){Wa("pAR",m)}if(!f)throw h;}finally{if(d)try{d()}catch(= n){}}return g},Va=3Dfunction(a,b,c,d,e,g){var f=3D{};if(e)try{e(f)}catch= (h){}f.context=3Da;f.msg=3Db.substring(0,512);c&&(f.file=3Dc);0b?e+=3D"00= 0":256>b?e+=3D"00":4096>b&&(e+=3D"0");return ib[a]=3De+b.toString(16)}))= ;b.push('"')};var kb=3Dfunction(a){var b=3Darguments.length;if(1=3D=3Db&= &"array"=3D=3Daa(arguments[0]))return kb.apply(null,arguments[0]);for(va= r c=3D{},d=3D0;dparseFloat(a))?S= tring(b):a}(),vb=3D{},wb=3Dfunction(a){if(!vb[a]){for(var b=3D0,c=3Dwa(S= tring(ub)).split("."),d=3Dwa(String(a)).split("."),e=3DMath.max(c.length= ,d.length),g=3D0;0=3D=3Db&&g"']/.test(X)&&(-1!=3DX.indexOf("&")&&(X=3DX.replace(xa,"&")= ),-1!=3DX.indexOf("<")&&(X=3DX.replace(ya,"<")),-1!=3DX.indexOf(">")&= &(X=3DX.replace(za,">")),-1!=3DX.indexOf('"')&&(X=3DX.replace(Aa,"&qu= ot;")),-1!=3DX.indexOf("'")&&(X=3DX.replace(Ba,"'")),-1!=3DX.indexOf= ("\x00")&&(X=3DX.replace(Ca,"�")));$b=3DX;Zb.prototype.set=3Dfunction= (a,b){this.N.handlers[a]=3Db;this.m.addEventListener&&this.m.addEventLis= tener("load",r(this.J,this,a),!1)}; Zb.prototype.J=3Dfunction(a){a=3Dthis.m.document.getElementById(a);try{v= ar b=3Da.contentWindow.document;if(a.onload&&b&&(!b.body||!b.body.firstC= hild))a.onload()}catch(c){}};Zb.prototype.R=3Dfunction(a,b){var c=3Dac("= rx",a),d;a:{if(a&&(d=3Da.match("dt=3D([^&]+)"))&&2=3D=3Dd.length){d=3Dd[= 1];break a}d=3D""}d=3D(new Date).getTime()-d;c=3Dc.replace(/&dtd=3D(\d+|= M)/,"&dtd=3D"+(1E4>d?d+"":"M"));this.set(b,c);return c};var ac=3Dfunctio= n(a,b){var c=3Dnew RegExp("\\b"+a+"=3D(\\d+)"),d=3Dc.exec(b);d&&(b=3Db.r= eplace(c,a+"=3D"+(+d[1]+1||1)));return b};var bc=3Dfunction(a){if(!a)ret= urn"";(a=3Da.toLowerCase())&&"ca-"!=3Da.substring(0,3)&&(a=3D"ca-"+a);re= turn a};var Y,Z=3Dfunction(a){this.u=3D[];this.m=3Da||window;this.l=3D0;= this.s=3Dnull;this.G=3D0},cc=3Dfunction(a,b){this.K=3Da;this.S=3Db};Z.pr= ototype.enqueue=3Dfunction(a,b){0!=3Dthis.l||0!=3Dthis.u.length||b&&b!=3D= window?this.B(a,b):(this.l=3D2,this.D(new cc(a,window)))};Z.prototype.B=3D= function(a,b){this.u.push(new cc(a,b||this.m));dc(this)};Z.prototype.L=3D= function(a){this.l=3D1;if(a){var b=3Dbb("sjr::timeout",r(this.C,this,!0)= );this.s=3Dthis.m.setTimeout(b,a)}}; Z.prototype.C=3Dfunction(a){a&&++this.G;1=3D=3Dthis.l&&(null!=3Dthis.s&&= (this.m.clearTimeout(this.s),this.s=3Dnull),this.l=3D0);dc(this)};Z.prot= otype.M=3Dfunction(){return!(!window||!Array)};Z.prototype.O=3Dfunction(= ){return this.G};Z.prototype.nq=3DZ.prototype.enqueue;Z.prototype.nqa=3D= Z.prototype.B;Z.prototype.al=3DZ.prototype.L;Z.prototype.rl=3DZ.prototyp= e.C;Z.prototype.sz=3DZ.prototype.M;Z.prototype.tc=3DZ.prototype.O;var dc= =3Dfunction(a){var b=3Dbb("sjr::tryrun",r(a.P,a));a.m.setTimeout(b,0)}; Z.prototype.P=3Dfunction(){if(0=3D=3Dthis.l&&this.u.length){var a=3Dthis= .u.shift();this.l=3D2;var b=3Dbb("sjr::run",r(this.D,this,a));a.S.setTim= eout(b,0);dc(this)}};Z.prototype.D=3Dfunction(a){this.l=3D0;a.K()}; var ec=3Dfunction(a){try{return a.sz()}catch(b){return!1}},fc=3Dfunction= (a){return!!a&&("object"=3D=3Dtypeof a||"function"=3D=3Dtypeof a)&&ec(a)= &&N(a.nq)&&N(a.nqa)&&N(a.al)&&N(a.rl)},gc=3Dfunction(){if(Y&&ec(Y))retur= n Y;var a=3Deb(),b=3Da.google_jobrunner;return fc(b)?Y=3Db:a.google_jobr= unner=3DY=3Dnew Z(a)},hc=3Dfunction(a,b){gc().nq(a,b)},ic=3Dfunction(a,b= ){gc().nqa(a,b)};var jc=3DQa?1=3D=3DP(J):!P(J),kc=3Dfunction(){var a=3Du= a?"https":"http",b=3DD("script"),c;c=3Dia("","pagead2.googlesyndication.= com");return["<",b,' src=3D"',Xb(c,"/pagead/js/r20150723/r20150728/show_= ads_impl.js",a),'">"].join("")},lc=3Dfunction(a,b,c,d){return fu= nction(){var e=3D!1;d&&gc().al(3E4);var g=3Da.document.getElementById(b)= ;g&&!F(g.contentWindow)&& 3=3D=3Da.google_top_js_status&&(a.google_top_js_status=3D6);try{var f=3D= a.document.getElementById(b).contentWindow;if(F(f)){var h=3Da.document.g= etElementById(b).contentWindow,l=3Dh.document;l.body&&l.body.firstChild|= |(l.open(),h.google_async_iframe_close=3D!0,l.write(c))}else{var k=3Da.d= ocument.getElementById(b).contentWindow,m;g=3Dc;g=3DString(g);if(g.quote= )m=3Dg.quote();else{f=3D['"'];for(h=3D0;hv)= x=3Dn;else{var u=3Dn;if(u in z)x=3Dz[u]; else if(u in Da)x=3Dz[u]=3DDa[u];else{var A=3Du,q=3Du.charCodeAt(0);if(3= 1q)A=3Du;else{if(256>q){if(A=3D"\\x",16>q||256q&&(A+=3D"0");A+=3Dq.toString(16).toUpperCase()}x=3Dz[u]=3D= A}}L=3Dx}f[l]=3DL}f.push('"');m=3Df.join("")}k.location.replace("javascr= ipt:"+m)}e=3D!0}catch(w){k=3Deb().google_jobrunner,fc(k)&&k.rl()}e&&(e=3D= ac("google_async_rrc",c),(new Zb(a)).set(b,lc(a,b,e,!1)))}},mc=3Dfunctio= n(a){var b=3D["");return b.join("")}, oc=3Dfunction(a,b,c){nc(a,b,c,function(a,b,g){a=3Da.document;for(var f=3D= b.id,h=3D0;!f||a.getElementById(f);)f=3D"aswift_"+h++;b.id=3Df;b.name=3D= f;f=3DNumber(g.google_ad_width);h=3DNumber(g.google_ad_height);16=3D=3Dg= .google_reactive_ad_format?(g=3Da.createElement("div"),g.innerHTML=3DRa(= b,f,h),c.appendChild(g.firstChild)):c.innerHTML=3DRa(b,f,h);return b.id}= )},nc=3Dfunction(a,b,c,d){var e=3DD("script"),g=3D{},f=3Db.google_ad_hei= ght;g.width=3D'"'+b.google_ad_width+'"';g.height=3D'"'+f+'"';g.framebord= er=3D'"0"';g.marginwidth=3D'"0"';g.marginheight=3D '"0"';g.vspace=3D'"0"';g.hspace=3D'"0"';g.allowtransparency=3D'"true"';g= .scrolling=3D'"no"';g.allowfullscreen=3D'"true"';g.onload=3D'"'+$b+'"';d= =3Dd(a,g,b);var g=3Dpc(b)?G(["c","e"],pa):null,h=3Db.google_ad_output,f=3D= b.google_ad_format;f||"html"!=3Dh&&null!=3Dh||(f=3Db.google_ad_width+"x"= +b.google_ad_height,"e"=3D=3Dg&&(f+=3D"_as"));h=3D!b.google_ad_slot||pc(= b);f=3Df&&h?f.toLowerCase():"";b.google_ad_format=3Df;for(var f=3D[b.goo= gle_ad_slot,b.google_ad_format,b.google_ad_type,b.google_ad_width,b.goog= le_ad_height],h=3D[],l=3D0,k=3Dc;k&&25>l;k=3D k.parentNode,++l)h.push(9!=3Dk.nodeType&&k.id||"");(h=3Dh.join())&&f.pus= h(h);b.google_ad_unit_key=3DMa(f.join(":")).toString();f=3Da.google_adk2= _experiment=3Da.google_adk2_experiment||G(["C","E"],oa)||"N";if("E"=3D=3D= f){f=3D[];for(h=3D0;c&&25>h;++h){l=3D"";l=3D(l=3D9!=3Dc.nodeType&&c.id)?= "/"+l:"";a:{if(c&&c.nodeName&&c.parentElement)for(var k=3Dc.nodeName.toS= tring().toLowerCase(),m=3Dc.parentElement.childNodes,n=3D0,v=3D0;vl;++l){for(var u=3Dx.frames,k=3D0;k>=3D8;f[h++]=3DH}var B=3Daa(= f);if("array"!=3DB&&("object"!=3DB||"number"!=3Dtypeof f.length))throw E= rror("encodeByteArray takes an array as a parameter");if(!zb)for(zb=3D{}= ,q=3D0;65>q;q++)zb[q]=3D"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstu= vwxyz0123456789+/=3D".charAt(q);q=3Dzb;H=3D[];for(B=3D0;B>2,l=3D(E&3)<<4|M>>4,k=3D(M&15)<<2|pb>> 6,m=3Dpb&63;S||(m=3D64,fa||(k=3D64));H.push(q[h],q[l],q[k],q[m])}w=3DH.j= oin("")}u=3Dw;break a}Za("sblob",{json:window.JSON?1:0,eURI:window.encod= eURIComponent?1:0})}catch(zc){Wa("sblob",zc)}u=3D""}u||(u=3D"{X}")}else"= C"=3D=3Dc&&(u=3D"{C}");var C;b=3Db.google_ad_client;if(w=3Djc){if(!Yb)b:= {E=3D[J.top];w=3D[];for(fa=3D0;M=3DE[fa++];){w.push(M);try{if(M.frames)f= or(var I=3DM.frames.length,S=3D0;SE.length;++S)E.push(M.frames[= S])}catch(Fc){}}for(I=3D0;I= ", C,"<",e,">",x,"google_show_ads_impl=3Dtrue;google_unique_id=3D",a.google= _unique_id,';google_async_iframe_id=3D"',d,'";google_start_time=3D',ea,"= ;",c?'google_pub_vars =3D "'+u+'";':"",b?'google_top_experiment=3D"'+b+'= ";':"",w?'google_async_for_oa_experiment=3D"'+w+'";':"",E?'google_always= _use_delayed_impressions_experiment=3D"'+E+'";':"",g?'google_append_as_f= or_format_override=3D"'+g+'";':"","google_bpp=3D",I>ea?I-ea:1,";google_a= sync_rrc=3D0;",kc(),""].join("");(a.document.getEl= ementById(d)?hc:ic)(lc(a, d,g,!0))},qc=3DMath.floor(1E6*Math.random()),rc=3Dfunction(a){var b;try{= b=3D{};for(var c=3Da.data.split("\n"),d=3D0;dV(c= ).clientWidth)&&.6=3Dl?4:3;else for(l in h=3D0,Qb)-1!=3Dg.index= Of(l)&&(h|=3DQb[l]);b&&(b.google_responsive_formats=3D h);a:{l=3D"number"=3D=3Dtypeof e?e:Infinity;if(Tb(c)){for(var f=3D1+P(c)= ,k=3DPb(a,c)/V(c).clientHeight,f=3D!Kb()&&(T("iPod")||T("iPhone")||T("An= droid")||T("IEMobile"))?1=3D=3Df?.22>k?[7,8,3,12,6,14,4,1,10,11,13,0,2,1= 5,5,9]:.7>k?[3,7,8,14,12,4,6,1,10,2,0,13,15,11,5,9]:[3,7,8,4,6,14,12,2,1= ,0,10,13,5,9,11,15]:2=3D=3Df?1.18>k?[3,7,8,14,12,4,1,0,6,2,10,9,5,15,11,= 13]:3.04>k?[3,7,8,14,4,2,1,6,0,12,10,5,9,11,15,13]:[3,7,8,4,6,1,2,14,12,= 0,5,10,11,9,15,13]:2.3>k?[3,7,14,8,1,12,0,2,6,4,10,5,13,11,9,15]:5.6>k?[= 3,7,8,14,1,2,12,4, 0,6,10,5,11,9,13,15]:[3,7,8,0,12,14,1,4,2,6,5,13,10,11,15,9]:Kb()?1=3D=3D= f?.18>k?[3,7,8,12,6,1,14,0,4,10,2,5,13,15,9,11]:.49>k?[3,8,6,7,12,1,0,14= ,2,10,4,5,13,9,11,15]:[3,8,7,6,1,12,0,2,14,4,10,5,9,13,15,11]:2=3D=3Df?.= 7>k?[3,8,6,7,1,0,12,2,14,10,4,9,5,13,11,15]:1.58>k?[3,8,7,6,1,12,0,2,14,= 10,4,9,5,13,11,15]:[3,8,7,6,1,12,0,2,14,4,10,9,5,11,13,15]:1.03>k?[3,12,= 6,8,1,7,0,14,2,10,4,5,9,11,15,13]:2.55>k?[3,8,6,7,12,1,2,0,14,4,10,5,9,1= 1,15,13]:[3,8,12,6,7,1,0,2,14,4,10,5,9,11,15,13]:1=3D=3Df?.21>k?[3,12,7,= 6,1,8,0, 4,2,10,14,11,5,15,9,13]:.54>k?[3,7,6,1,12,8,2,0,4,10,14,9,5,11,15,13]:[3= ,7,1,6,12,2,0,8,4,10,14,5,9,11,15,13]:2=3D=3Df?.6>k?[3,7,1,12,6,0,2,8,4,= 10,14,9,5,11,13,15]:1.53>k?[3,7,1,6,12,2,0,8,4,10,14,5,9,11,13,15]:[3,7,= 1,6,12,2,0,8,4,10,14,5,9,11,15,13]:.74>k?[3,7,12,6,1,2,8,0,4,14,10,9,13,= 5,11,15]:1.95>k?[3,7,6,12,1,2,8,0,4,10,14,5,9,11,13,15]:[3,7,6,12,1,2,8,= 0,4,14,10,5,9,11,15,13],k=3D[],m=3D0;mV(c).clientWidth)m=3DMath.min(V(c).clientHeight,16*V= (c).clientWidth/9),m=3DPb(a,c)e)||(e=3D/^E/.test(d),g=3DV(c),a&&a.getBoundingClientRect&&g&&g.get= BoundingClientRect?(c=3Da.getBoundingClientRect(),g=3Dg.getBoundingClien= tRect(),c=3DMath.min(c.right,g.right)-Math.max(c.left,g.left),c=3DMath.r= ound(Math.max(0,c))):c=3D0,160>c||15> b.google_ad_width-c?a=3D!1:(g=3Da.style.width||"",a.style.width=3D"100%"= ,l=3Da.offsetWidth,160>l||0>c-l?(a.style.width=3Dg,a=3D!1):(e?(b.google_= ad_width=3Dc,a.style.width=3Dc+"px"):a.style.width=3Dg,a=3D!0)),e=3D!a&&= "ED"!=3Dd),e||(b.google_overflowing_ads_experiment=3Dd));0a[y]("/")[0][q](":")&&(a= =3Dk+f[2][B](0,f[2].lastIndexOf("/"))+"/"+a):a=3Dk+f[2]+(a||Be);d.href=3D= a;e=3Dc(d);return{protocol:(d[A]||"")[D](),host:e[0], port:e[1],path:e[2],Oa:d[va]||"",url:a||""}}function Na(a,b){function c(= b,c){a.contains(b)||a.set(b,[]);a.get(b)[n](c)}for(var d=3DDa(b)[y]("&")= ,e=3D0;ef?c(d[e],"1"):c(d[e]= [B](0,f),d[e][B](f+1))}}function Pa(a,b){if(F(a)||"["=3D=3Da[ma](0)&&"]"= =3D=3Da[ma](a[w]-1))return"-";var c=3DJ.domain;return a[q](c+(b&&"/"!=3D= b?b:""))=3D=3D(0=3D=3Da[q]("http://")?7:0=3D=3Da[q]("https://")?8:0)?"0"= :a};var Qa=3D0;function Ra(a,b,c){1<=3DQa||1<=3D100*m.random()||ld()||(a= =3D["utmt=3Derror","utmerr=3D"+a,"utmwv=3D5.6.5","utmn=3D"+Ea(),"utmsp=3D= 1"],b&&a[n]("api=3D"+b),c&&a[n]("msg=3D"+G(c[B](0,100))),M.w&&a[n]("aip=3D= 1"),Sa(a[C]("&")),Qa++)};var Ta=3D0,Ua=3D{};function N(a){return Va("x"+= Ta++,a)}function Va(a,b){Ua[a]=3D!!b;return a} var Wa=3DN(),Xa=3DVa("anonymizeIp"),Ya=3DN(),$a=3DN(),ab=3DN(),bb=3DN(),= O=3DN(),P=3DN(),cb=3DN(),db=3DN(),eb=3DN(),fb=3DN(),gb=3DN(),hb=3DN(),ib= =3DN(),jb=3DN(),kb=3DN(),lb=3DN(),nb=3DN(),ob=3DN(),pb=3DN(),qb=3DN(),rb= =3DN(),sb=3DN(),tb=3DN(),ub=3DN(),vb=3DN(),wb=3DN(),xb=3DN(),yb=3DN(),zb= =3DN(),Ab=3DN(),Bb=3DN(),Cb=3DN(),Db=3DN(),Eb=3DN(),Fb=3DN(!0),Gb=3DVa("= currencyCode"),Hb=3DVa("page"),Ib=3DVa("title"),Jb=3DN(),Kb=3DN(),Lb=3DN= (),Mb=3DN(),Nb=3DN(),Ob=3DN(),Pb=3DN(),Qb=3DN(),Rb=3DN(),Q=3DN(!0),Sb=3D= N(!0),Tb=3DN(!0),Ub=3DN(!0),Vb=3DN(!0),Wb=3DN(!0),Zb=3DN(!0),$b=3DN(!0),= ac=3DN(!0),bc=3DN(!0),cc=3DN(!0),R=3DN(!0),dc=3DN(!0), ec=3DN(!0),fc=3DN(!0),gc=3DN(!0),hc=3DN(!0),ic=3DN(!0),jc=3DN(!0),S=3DN(= !0),kc=3DN(!0),lc=3DN(!0),mc=3DN(!0),nc=3DN(!0),oc=3DN(!0),pc=3DN(!0),qc= =3DN(!0),rc=3DVa("campaignParams"),sc=3DN(),tc=3DVa("hitCallback"),uc=3D= N();N();var vc=3DN(),wc=3DN(),xc=3DN(),yc=3DN(),zc=3DN(),Ac=3DN(),Bc=3DN= (),Cc=3DN(),Dc=3DN(),Ec=3DN(),Fc=3DN(),Gc=3DN(),Hc=3DN(),Ic=3DN();N();va= r Mc=3DN(),Nc=3DN(),Yb=3DN(),Jc=3DN(),Kc=3DN(),Lc=3DVa("utmtCookieName")= ,Cd=3DVa("displayFeatures"),Oc=3DN(),of=3DVa("gtmid"),Oe=3DVa("uaName"),= Pe=3DVa("uaDomain"),Qe=3DVa("uaPath"),pf=3DVa("linkid");var Re=3Dfunctio= n(){function a(a,c,d){T(qf[x],a,c,d)}a("_createTracker",qf[x].hb,55);a("= _getTracker",qf[x].oa,0);a("_getTrackerByName",qf[x].u,51);a("_getTracke= rs",qf[x].pa,130);a("_anonymizeIp",qf[x].aa,16);a("_forceSSL",qf[x].la,1= 25);a("_getPlugin",Pc,120)},Se=3Dfunction(){function a(a,c,d){T(U[x],a,c= ,d)}Qc("_getName",$a,58);Qc("_getAccount",Wa,64);Qc("_visitCode",Q,54);Q= c("_getClientInfo",ib,53,1);Qc("_getDetectTitle",lb,56,1);Qc("_getDetect= Flash",jb,65,1);Qc("_getLocalGifPath",wb,57);Qc("_getServiceMode", xb,59);V("_setClientInfo",ib,66,2);V("_setAccount",Wa,3);V("_setNamespac= e",Ya,48);V("_setAllowLinker",fb,11,2);V("_setDetectFlash",jb,61,2);V("_= setDetectTitle",lb,62,2);V("_setLocalGifPath",wb,46,0);V("_setLocalServe= rMode",xb,92,void 0,0);V("_setRemoteServerMode",xb,63,void 0,1);V("_setL= ocalRemoteServerMode",xb,47,void 0,2);V("_setSampleRate",vb,45,1);V("_se= tCampaignTrack",kb,36,2);V("_setAllowAnchor",gb,7,2);V("_setCampNameKey"= ,ob,41);V("_setCampContentKey",tb,38);V("_setCampIdKey",nb,39);V("_setCa= mpMediumKey", rb,40);V("_setCampNOKey",ub,42);V("_setCampSourceKey",qb,43);V("_setCamp= TermKey",sb,44);V("_setCampCIdKey",pb,37);V("_setCookiePath",P,9,0);V("_= setMaxCustomVariables",yb,0,1);V("_setVisitorCookieTimeout",cb,28,1);V("= _setSessionCookieTimeout",db,26,1);V("_setCampaignCookieTimeout",eb,29,1= );V("_setReferrerOverride",Jb,49);V("_setSiteSpeedSampleRate",Dc,132);a(= "_trackPageview",U[x].Fa,1);a("_trackEvent",U[x].F,4);a("_trackPageLoadT= ime",U[x].Ea,100);a("_trackSocial",U[x].Ga,104);a("_trackTrans",U[x].Ia,= 18);a("_sendXEvent",U[x].ib,78);a("_createEventTracker",U[x].ia,74);a("_= getVersion",U[x].qa,60);a("_setDomainName",U[x].B,6);a("_setAllowHash",U= [x].va,8);a("_getLinkerUrl",U[x].na,52);a("_link",U[x].link,101);a("_lin= kByPost",U[x].ua,102);a("_setTrans",U[x].za,20);a("_addTrans",U[x].$,21)= ;a("_addItem",U[x].Y,19);a("_clearTrans",U[x].ea,105);a("_setTransaction= Delim",U[x].Aa,82);a("_setCustomVar",U[x].wa,10);a("_deleteCustomVar",U[= x].ka,35);a("_getVisitorCustomVar",U[x].ra,50);a("_setXKey",U[x].Ca,83);= a("_setXValue",U[x].Da,84);a("_getXKey",U[x].sa,76);a("_getXValue",U[x].= ta,77);a("_clearXKey",U[x].fa,72);a("_clearXValue",U[x].ga,73);a("_creat= eXObj",U[x].ja,75);a("_addIgnoredOrganic",U[x].W,15);a("_clearIgnoredOrg= anic",U[x].ba,97);a("_addIgnoredRef",U[x].X,31);a("_clearIgnoredRef",U[x= ].ca,32);a("_addOrganic",U[x].Z,14);a("_clearOrganic",U[x].da,70);a("_co= okiePathCopy",U[x].ha,30);a("_get",U[x].ma,106);a("_set",U[x].xa,107);a(= "_addEventListener",U[x].addEventListener,108);a("_removeEventListener",= U[x].removeEventListener,109);a("_addDevId",U[x].V);a("_getPlugin",Pc,12= 2);a("_setPageGroup",U[x].ya,126);a("_trackTiming",U[x].Ha,124);a("_init= Data",U[x].initData,2);a("_setVar",U[x].Ba,22);V("_setSessionTimeout",db= ,27,3);V("_setCookieTimeout",eb,25,3);V("_setCookiePersistence",cb,24,1)= ;a("_setAutoTrackOutbound",Fa,79);a("_setTrackOutboundSubdomains",Fa,81)= ;a("_setHrefExamineLimit",Fa,80)};function Pc(a){var b=3Dthis.plugins_;i= f(b)return b.get(a)} var T=3Dfunction(a,b,c,d){a[b]=3Dfunction(){try{return void 0!=3Dd&&H(d)= ,c[ya](this,arguments)}catch(a){throw Ra("exc",b,a&&a[r]),a;}}},Qc=3Dfun= ction(a,b,c,d){U[x][a]=3Dfunction(){try{return H(c),Aa(this.a.get(b),d)}= catch(e){throw Ra("exc",a,e&&e[r]),e;}}},V=3Dfunction(a,b,c,d,e){U[x][a]= =3Dfunction(f){try{H(c),void 0=3D=3De?this.a.set(b,Aa(f,d)):this.a.set(b= ,e)}catch(Be){throw Ra("exc",a,Be&&Be[r]),Be;}}},Te=3Dfunction(a,b){retu= rn{type:b,target:a,stopPropagation:function(){throw"aborted";}}};var Rc=3D= new RegExp(/(^|\.)doubleclick\.net$/i),Sc=3Dfunction(a,b){return Rc[ia](= J[z].hostname)?!0:"/"!=3D=3Db?!1:0!=3Da[q]("www.google.")&&0!=3Da[q](".g= oogle.")&&0!=3Da[q]("google.")||-1b[w]||ad(b[0],c))return!1;b=3Db[ja](1)[C](".")[y]("|");0=3Db[w])return!0; b=3Db[1][y](-1=3D=3Db[1][q](",")?"^":",");for(c=3D0;cb[w]||ad(b[0],c))retu= rn a.set(ec,void 0),a.set(fc,void 0),a.set(gc,void 0),a.set(ic,void 0),a= .set(jc,void 0),a.set(nc,void 0),a.set(oc,void 0),a.set(pc,void 0),a.set= (qc,void 0),a.set(S,void 0),a.set(kc,void 0),a.set(lc,void 0),a.set(mc,v= oid 0),!1;a.set(ec,1*b[1]);a.set(fc,1*b[2]);a.set(gc,1*b[3]);Ve(a,b[ja](= 4)[C]("."));return!0},Ve=3Dfunction(a,b){function c(a){return(a=3Db[oa](= a+"=3D(.*?)(?:\\|utm|$)"))&& 2=3D=3Da[w]?a[1]:void 0}function d(b,c){c?(c=3De?I(c):c[y]("%20")[C](" "= ),a.set(b,c)):a.set(b,void 0)}-1=3D=3Db[q]("=3D")&&(b=3DI(b));var e=3D"2= "=3D=3Dc("utmcvr");d(ic,c("utmcid"));d(jc,c("utmccn"));d(nc,c("utmcsr"))= ;d(oc,c("utmcmd"));d(pc,c("utmctr"));d(qc,c("utmcct"));d(S,c("utmgclid")= );d(kc,c("utmgclsrc"));d(lc,c("utmdclid"));d(mc,c("utmdsid"))},ad=3Dfunc= tion(a,b){return b?a!=3Db:!/^\d+$/[ia](a)};var Uc=3Dfunction(){this.filt= ers=3D[]};Uc[x].add=3Dfunction(a,b){this.filters[n]({name:a,s:b})};Uc[x]= .cb=3Dfunction(a){try{for(var b=3D0;b= =3D100*a.get(vb)&&a[ta]()}function kd(a){ld(a.get(Wa))&&a[ta]()}function= md(a){"file:"=3D=3DJ[z][A]&&a[ta]()}function Ge(a){He()&&a[ta]()}functi= on nd(a){a.get(Ib)||a.set(Ib,J.title,!0);a.get(Hb)||a.set(Hb,J[z].pathna= me+J[z][va],!0)} function lf(a){a.get(Wa)&&"UA-XXXXX-X"!=3Da.get(Wa)||a[ta]()};var od=3Dn= ew function(){var a=3D[];this.set=3Dfunction(b){a[b]=3D!0};this.encode=3D= function(){for(var b=3D[],c=3D0;c=3Db[0]||0>=3Db[1]?"":b[C]("x");a.Wa=3Dd}catch(k){H(135)}qd=3Da}},td=3D= function(){sd(); for(var a=3Dqd,b=3DW[za],a=3Db.appName+b.version+a.language+b.platform+b= .userAgent+a.javaEnabled+a.jb+a.P+(J.cookie?J.cookie:"")+(J.referrer?J.r= eferrer:""),b=3Da[w],c=3DW.history[w];0d?(this.i=3Db[B](0,d),this.l=3Db[B](d+1,c),this.h=3Db[B= ](c+1)):(this.i=3Db[B](0,d),this.h=3Db[B](d+1));this.Xa=3Da[ja](1);this.= Ma=3D!this.l&&"_require"=3D=3Dthis.h;this.J=3D!this.i&&!this.l&&"_provid= e"=3D=3Dthis.h}},Y=3Dfunction(){T(Y[x],"push",Y[x][n],5);T(Y[x],"_getPlu= gin",Pc,121);T(Y[x], "_createAsyncTracker",Y[x].Sa,33);T(Y[x],"_getAsyncTracker",Y[x].Ta,34);= this.I=3Dnew nf;this.eb=3D[]};E=3DY[x];E.Na=3Dfunction(a,b,c){var d=3Dth= is.I.get(a);if(!Ba(d))return!1;b.plugins_=3Db.plugins_||new nf;b.plugins= _.set(a,new d(b,c||{}));return!0};E.push=3Dfunction(a){var b=3DZ.Va[ya](= this,arguments),b=3DZ.eb.concat(b);for(Z.eb=3D[];0e?b+"#"+d:b+"&"+d;c=3D= "";f=3Db[q]("?");0f?b+"?"+d+c:b= +"&"+d+c},$d=3Dfunction(a,b,c,d){for(var e=3D0;3>e;e++){for(var f=3D0;3>= f;f++){if(d=3D=3DYc(a+b+c))return H(127),[b,c]; var Be=3Db[p](/ /g,"%20"),k=3Dc[p](/ /g,"%20");if(d=3D=3DYc(a+Be+k))retu= rn H(128),[Be,k];Be=3DBe[p](/\+/g,"%20");k=3Dk[p](/\+/g,"%20");if(d=3D=3D= Yc(a+Be+k))return H(129),[Be,k];try{var Ja=3Db[oa]("utmctr=3D(.*?)(?:\\|= utm|$)");if(Ja&&2=3D=3DJa[w]&&(Be=3Db[p](Ja[1],G(I(Ja[1]))),d=3D=3DYc(a+= Be+c)))return H(139),[Be,c]}catch(t){}b=3DI(b)}c=3DI(c)}};var de=3D"|",f= e=3Dfunction(a,b,c,d,e,f,Be,k,Ja){var t=3Dee(a,b);t||(t=3D{},a.get(Cb)[n= ](t));t.id_=3Db;t.affiliation_=3Dc;t.total_=3Dd;t.tax_=3De;t.shipping_=3D= f;t.city_=3DBe;t.state_=3Dk;t.country_=3DJa;t.items_=3Dt.items_||[];retu= rn t},ge=3Dfunction(a,b,c,d,e,f,Be){a=3Dee(a,b)||fe(a,b,"",0,0,0,"","","= ");var k;a:{if(a&&a.items_){k=3Da.items_;for(var Ja=3D0;Jab[w]||!/^\d+$/[ia](b[0= ])||(b[0]=3D""+c,Fd(a,"__utmx",b[C]("."),void 0))},be=3Dfunction(a,b){va= r c=3D$c(a.get(O),pd("__utmx"));"-"=3D=3Dc&&(c=3D"");return b?G(c):c},Ye= =3Dfunction(a){try{var b=3DLa(J[z][xa],!1),c=3Dea(L(b.R.get("utm_referre= r")))||"";c&&a.set(Jb,c);var d=3Dea(K(b.R.get("utm_expid")))||"";d&&(d=3D= d[y](".")[0],a.set(Oc,""+d))}catch(e){H(146)}},l=3Dfunction(a){var b=3DW= .gaData&&W.gaData.expId;b&&a.set(Oc,""+b)};var ke=3Dfunction(a,b){var c=3D= m.min(a.b(Dc,0),100);if(a.b(Q,0)%100>=3Dc)return!1;c=3DZe()||$e();if(voi= d 0=3D=3Dc)return!1;var d=3Dc[0];if(void 0=3D=3Dd||d=3D=3Dba||da(d))retu= rn!1;0a[b])return!1;return!0},le=3Dfunction(= a){return da(a)|| 0>a?0:5E3>a?10*m[la](a/10):5E4>a?100*m[la](a/100):41E5>a?1E3*m[la](a/1E3= ):41E5},je=3Dfunction(a){for(var b=3Dnew yd,c=3D0;cc[w])= ){for(var d=3D[],e=3D0;e=3Df)return!1;c=3D1*(""+c);if= (""=3D=3Da||!wd(a)||""=3D=3Db||!wd(b)||!xd(c)||da(c)||0>c||0>f||100=3Da||a>e.get(yb))a=3D!1;else if(!b||!c||128<= b[w]+c[w])a=3D!1;else{1!=3Dd&&2!=3Dd&&(d=3D3);var f=3D{};ha(f,b);f.value= =3Dc;f.scope=3Dd;e.get(Fb)[a]=3Df;a=3D!0}a&&this.a.gb();return a};E.ka=3D= function(a){this.a.get(Fb)[a]=3Dvoid 0;this.a.gb()};E.ra=3Dfunction(a){r= eturn(a=3Dthis.a.get(Fb)[a])&&1=3D=3Da[ua]?a[na]:void 0}; E.Ca=3Dfunction(a,b,c){12=3D=3Da&&1=3D=3Db?this.set(pf,c):this.m().f(a,b= ,c)};E.Da=3Dfunction(a,b,c){this.m().o(a,b,c)};E.sa=3Dfunction(a,b){retu= rn this.m().getKey(a,b)};E.ta=3Dfunction(a,b){return this.m().N(a,b)};E.= fa=3Dfunction(a){this.m().L(a)};E.ga=3Dfunction(a){this.m().M(a)};E.ja=3D= function(){return new yd};E.W=3Dfunction(a){a&&this.get(Ab)[n](a[D]())};= E.ba=3Dfunction(){this.set(Ab,[])};E.X=3Dfunction(a){a&&this.get(Bb)[n](= a[D]())};E.ca=3Dfunction(){this.set(Bb,[])}; E.Z=3Dfunction(a,b,c,d,e){if(a&&b){a=3D[a,b[D]()][C](":");if(d||e)a=3D[a= ,d,e][C](":");d=3Dthis.get(zb);d.splice(c?0:d[w],0,a)}};E.da=3Dfunction(= ){this.set(zb,[])};E.ha=3Dfunction(a){this.a[ka]();var b=3Dthis.get(P),c= =3Dbe(this.a);this.set(P,a);this.a.gb();ae(this.a,c);this.set(P,b)};E.ya= =3Dfunction(a,b){if(0=3Da&&Ca(b)&&""!=3Db){var c=3Dthis.get(Fc)||[= ];c[a]=3Db;this.set(Fc,c)}};E.V=3Dfunction(a){a=3D""+a;if(a[oa](/^[A-Za-= z0-9]{1,5}$/)){var b=3Dthis.get(Ic)||[];b[n](a);this.set(Ic,b)}};E.initD= ata=3Dfunction(){this.a[ka]()}; E.Ba=3Dfunction(a){a&&""!=3Da&&(this.set(Tb,a),this.a.j("var"))};var ne=3D= function(a){"trans"!=3D=3Da.get(sc)&&500<=3Da.b(cc,0)&&a[ta]();if("event= "=3D=3D=3Da.get(sc)){var b=3D(new Date)[g](),c=3Da.b(dc,0),d=3Da.b(Zb,0)= ,c=3Dm[la]((b-(c!=3Dd?c:1E3*c))/1E3*1);0=3Da.b(R,0)&&a[ta]()}},pe=3Dfunction(a){"event"=3D=3D=3D= a.get(sc)&&a.set(R,m.max(0,a.b(R,10)-1))};var qe=3Dfunction(){var a=3D[]= ;this.add=3Dfunction(b,c,d){d&&(c=3DG(""+c));a[n](b+"=3D"+c)};this.toStr= ing=3Dfunction(){return a[C]("&")}},re=3Dfunction(a,b){(b||2!=3Da.get(xb= ))&&a.Za(cc)},se=3Dfunction(a,b){b.add("utmwv","5.6.5");b.add("utms",a.g= et(cc));b.add("utmn",Ea());var c=3DJ[z].hostname;F(c)||b.add("utmhn",c,!= 0);c=3Da.get(vb);100!=3Dc&&b.add("utmsp",c,!0)},te=3Dfunction(a,b){b.add= ("utmht",(new Date)[g]());b.add("utmac",Da(a.get(Wa)));a.get(Oc)&&b.add(= "utmxkey",a.get(Oc),!0);a.get(vc)&&b.add("utmni",1);a.get(of)&&b.add("ut= mgtm", a.get(of),!0);var c=3Da.get(Ic);c&&0=3Da[w])gf(a,b,c);else if(8192>=3Da[w]){if(0<=3DW[z= a].userAgent[q]("Firefox")&&![].reduce)throw new De(a[w]);df(a,b)||ef(a,= b)||Ee(a,b)||b()}else throw new Ce(a[w]);},gf=3Dfunction(a,b,c){c=3Dc||N= e()+"/__utm.gif?";var d=3Dnew Image(1,1);d.src=3Dc+ a;Ie(d,function(){Ie(d,null);Je(d,null);b()});Je(d,function(){Ie(d,null)= ;Je(d,null);b()})},ef=3Dfunction(a,b){if(0!=3DNe()[q](J[z][A]))return!1;= var c;c=3DW.XDomainRequest;if(!c)return!1;c=3Dnew c;c.open("POST",Ne()+"= /p/__utm.gif");Je(c,function(){b()});Ie(c,b);c.send(a);return!0},df=3Dfu= nction(a,b){var c=3DW.XMLHttpRequest;if(!c)return!1;var d=3Dnew c;if(!("= withCredentials"in d))return!1;d.open("POST",Ne()+"/p/__utm.gif",!0);d.w= ithCredentials=3D!0;d.setRequestHeader("Content-Type","text/plain");d.on= readystatechange=3D function(){4=3D=3Dd.readyState&&(b(),d=3Dnull)};d.send(a);return!0},Ee=3D= function(a,b){if(!J.body)return We(function(){Ee(a,b)},100),!0;a=3Daa(a)= ;try{var c=3DJ[qa]('')}catch(d){c=3DJ[qa= ]("iframe"),ha(c,a)}c.height=3D"0";c.width=3D"0";c.style.display=3D"none= ";c.style.visibility=3D"hidden";var e=3DNe()+"/u/post_iframe.html";Ga(W,= "beforeunload",function(){c.src=3D"";c.parentNode&&c.parentNode.removeCh= ild(c)});ca(b,1E3);J.body.appendChild(c);c.src=3De;return!0};var qf=3Dfu= nction(){this.G=3Dthis.w=3D!1;0=3D=3DEa()%1E4&&(H(142),this.G=3D!0);this= .C=3D{};this.D=3D[];this.U=3D0;this.S=3D[["www.google-analytics.com","",= "/plugins/"]];this._gasoCPath=3Dthis._gasoDomain=3Dthis.bb=3Dvoid 0;Re()= ;Se()};E=3Dqf[x];E.oa=3Dfunction(a,b){return this.hb(a,void 0,b)};E.hb=3D= function(a,b,c){b&&H(23);c&&H(67);void 0=3D=3Db&&(b=3D"~"+M.U++);a=3Dnew= U(b,a,c);M.C[b]=3Da;M.D[n](a);return a};E.u=3Dfunction(a){a=3Da||"";ret= urn M.C[a]||M.hb(void 0,a)};E.pa=3Dfunction(){return M.D[ja](0)};E.ab=3D= function(){return M.D[w]}; E.aa=3Dfunction(){this.w=3D!0};E.la=3Dfunction(){this.G=3D!0};var Fe=3Df= unction(a){if("prerender"=3D=3DJ.visibilityState)return!1;a();return!0};= var M=3Dnew qf;var Ha=3DW._gat;Ha&&Ba(Ha._getTracker)?M=3DHa:W._gat=3DM;= var Z=3Dnew Y;(function(a){if(!Fe(a)){H(123);var b=3D!1,c=3Dfunction(){i= f(!b&&Fe(a)){b=3D!0;var d=3DJ,e=3Dc;d.removeEventListener?d.removeEventL= istener("visibilitychange",e,!1):d.detachEvent&&d.detachEvent("onvisibil= itychange",e)}};Ga(J,"visibilitychange",c)}})(function(){var a=3DW._gaq,= b=3D!1;if(a&&Ba(a[n])&&(b=3D"[object Array]"=3D=3DObject[x][v].call(Obje= ct(a)),!b)){Z=3Da;return}W._gaq=3DZ;b&&Z[n][ya](Z,a)});function Yc(a){va= r b=3D1,c=3D0,d;if(a)for(b=3D0,d=3Da[w]-1;0<=3Dd;d--)c=3Da.charCodeAt(d)= ,b=3D(b<<6&268435455)+c+(c<<14),c=3Db&266338304,b=3D0!=3Dc?b^c>>21:b;ret= urn b};})(); ------------yLsh28qWOSrurz6bIywB5L--