﻿/**
 * @copyright  Copyright (c) 2008-2011 Nette Interactive (http://www.nette.com.tr/)
 * @author Nette IT | info@nette.com.tr
 */
 
function getIdStr(i, sDelim) {
    if (typeof i != "string") {
        var i = $(i).attr("id");
    }
    var arr = i.split(sDelim || /_|-/);
    if (arr.length > 1) {
        return arr[arr.length-1];
    } else {
        return "";
    }
}
/**
* @param  int|string  i  id string or the element itself (eg .. id="test_7" .. -> 7).
*/
function getIdNo(i, sDelim) {
    return parseInt(getIdStr(i, sDelim), 10);
}
/**
* ?asd=1&qwe=rty -> {asd:1, qwe:"rty"}
*/
function getUrlParams(url){
    var search;
    if (url) {
        var start = url.indexOf("?");
        if (start == -1) {
            start = 0;
        }
        end = url.lastIndexOf("#");
        if (end == -1) {
            end = url.length;
        }
        search = url.substring(start, end);
    } else {
        search = location.search;
    }
    var
    settingsObject = {},
    hash,
    hashes = search.substring(1).split(/&amp;|&/);	
    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        settingsObject[hash[0]] = hash[1];
    }
    return settingsObject;	
}

// http://github.com/halilim/Javascript-Simple-Object-Inspect
function simpleObjInspect(b,a,c){a=a||"";c=c||1;for(var f="",d=1;d<c;d++)f+="\t";d=" ("+typeof a+")";if(c==1)d="(self)";a=f+a+d+" : ";if(typeof b=="object"&&b!==null){a+=typeof b+"\n";for(var e in b)if(b.hasOwnProperty(e))a+=simpleObjInspect(b[e],e,c+1)}else a+=""+b+" ("+typeof b+") \n";return a};

/*JQUERY PLUGIN - MOUSE WHEEL */(function($){$.fn.extend({mousewheel:function(f){if(!f.guid)f.guid=$.event.guid++;if(!$.event._mwCache)$.event._mwCache=[];return this.each(function(){if(this._mwHandlers)return this._mwHandlers.push(f);else this._mwHandlers=[];this._mwHandlers.push(f);var s=this;this._mwHandler=function(e){e=$.event.fix(e||window.event);$.extend(e,this._mwCursorPos||{});var delta=0,returnValue=true;if(e.wheelDelta)delta=e.wheelDelta/120;if(e.detail)delta=-e.detail/3;if(window.opera)delta=-e.wheelDelta;for(var i=0;i<s._mwHandlers.length;i++)if(s._mwHandlers[i])if(s._mwHandlers[i].call(s,e,delta)===false){returnValue=false;e.preventDefault();e.stopPropagation();}return returnValue;};if($.browser.mozilla&&!this._mwFixCursorPos){this._mwFixCursorPos=function(e){this._mwCursorPos={pageX:e.pageX,pageY:e.pageY,clientX:e.clientX,clientY:e.clientY};};$(this).bind('mousemove',this._mwFixCursorPos);}if(this.addEventListener)if($.browser.mozilla)this.addEventListener('DOMMouseScroll',this._mwHandler,false);else this.addEventListener('mousewheel',this._mwHandler,false);else this.onmousewheel=this._mwHandler;$.event._mwCache.push($(this));});},unmousewheel:function(f){return this.each(function(){if(f&&this._mwHandlers){for(var i=0;i<this._mwHandlers.length;i++)if(this._mwHandlers[i]&&this._mwHandlers[i].guid==f.guid)delete this._mwHandlers[i];}else{if($.browser.mozilla&&!this._mwFixCursorPos)$(this).unbind('mousemove',this._mwFixCursorPos);if(this.addEventListener)if($.browser.mozilla)this.removeEventListener('DOMMouseScroll',this._mwHandler,false);else this.removeEventListener('mousewheel',this._mwHandler,false);else this.onmousewheel=null;this._mwHandlers=this._mwHandler=this._mwFixCursorPos=this._mwCursorPos=null;}});}});$(window).one('unload',function(){var els=$.event._mwCache||[];for(var i=0;i<els.length;i++)els[i].unmousewheel();});})(jQuery);

// jCarouselLite 1.3 from http://github.com/halilim/jquery-carousel-lite
(function(d){function n(q,a){return parseInt(d.css(q[0],a),10)||0}d.jCarouselLite={version:"1.3"};d.fn.jCarouselLite=function(q){var a=d.extend({},d.fn.jCarouselLite.defaults,q);return this.each(function(){function m(b){if(!r){if(a.circular){f=b<=0-c?b==0-c?h-c*2-1:h-c*2-a.scroll:b>=h-c+1?b==h-c+1?c+1:c+a.scroll:b;if(f<0)f+=h-1}else f=b<0?0:b>h-c?h-c:b;var e=0;if(a.circular){e=(b-c)%o;if(e<0)e+=o}else e=f;a.beforeStart&&a.beforeStart.call(this,g.slice(f).slice(0,c),e);if(a.circular)if(b<=a.start- c-1)j.css(p,-((h-c*2)*k)+"px");else b>=h-c+1&&j.css(p,-(c*k)+"px");else{a.$btnPrev.toggleClass(a.btnDisabledClass,a.btnPrev&&b<=0);a.$btnNext.toggleClass(a.btnDisabledClass,a.btnNext&&b>h-c)}r=true;if(a.btnGo){d.each(a.btnGo,function(z,x){d(x).removeClass(a.currentClass)});d(a.btnGo[e]).addClass(a.currentClass)}j.animate(p=="left"?{left:-(f*k)}:{top:-(f*k)},a.speed,a.easing,function(){a.afterEnd&&a.afterEnd.call(this,g.slice(f).slice(0,c),e);r=false})}return false}var r=false,p=a.vertical?"top":"left", t=a.vertical?"height":"width",i=d(this),j=i.find("ul:eq(0)"),l=j.children("li"),o=l.length,c=a.visible;a.start=Math.min(a.start,l.length-1);if(a.circular){j.prepend(l.slice(o-c-1+1).clone(true)).append(l.slice(0,c).clone(true));a.start+=c}var g=j.children("li"),h=g.length,f=a.start;i.css("visibility","visible");g.css({overflow:a.vertical?"hidden":"visible","float":a.vertical?"none":"left"});j.css({margin:"0",padding:"0",position:"relative","list-style-type":"none","z-index":"1"});i.css({overflow:"hidden", position:"relative","z-index":"2",left:"0px"});var k=a.vertical?g[0].offsetHeight+n(g,"marginTop")+n(g,"marginBottom"):g[0].offsetWidth+n(g,"marginLeft")+n(g,"marginRight");l=k*h;var y=k*c;a.setDivWidth&&g.css({width:g.width()});a.setDivHeight&&g.css({height:g.height()});j.css(t,l+"px").css(p,-(f*k));i.css(t,y+"px");d.each(["btnPrev","btnNext"],function(b,e){if(a[e]){a["$"+e]=d.isFunction(a[e])?a[e].call(i[0]):d(a[e]);a["$"+e].click(function(){return m(b==0?f-a.scroll:f+a.scroll)})}});if(!a.circular){a.btnPrev&& a.start==0&&a.$btnPrev.addClass(a.btnDisabledClass);a.btnNext&&a.start+a.visible>=h&&a.$btnNext.addClass(a.btnDisabledClass)}if(a.btnGo){d(a.btnGo[a.start-(a.circular?c:0)]).addClass(a.currentClass);d.each(a.btnGo,function(b,e){d(e).click(function(){return m(a.circular?a.visible+b:b)})})}a.mouseWheel&&i.mousewheel&&i.mousewheel(function(b,e){return e>0?m(f-a.scroll):m(f+a.scroll)});if(a.auto){var u,v=0,w=a.autoStop&&(a.circular?a.autoStop:Math.min(o,a.autoStop)),s=function(){u=setTimeout(function(){if(!w|| w>v){m(f+a.scroll);v++;s()}},a.timeout+a.speed)};s();d(document).bind("pauseCarousel",function(b){clearTimeout(u);d(b.target).data("paused",true)}).bind("resumeCarousel",function(b){s();d(b.target).data("paused",false)});a.pause&&i.mouseenter(function(){i.trigger("pauseCarousel")}).mouseleave(function(){i.trigger("resumeCarousel")})}})};d.fn.jCarouselLite.defaults={btnPrev:null,btnNext:null,btnDisabledClass:"disabled",btnGo:null,mouseWheel:false,speed:200,easing:null,auto:false,autoStop:false,timeout:4E3, pause:true,vertical:false,circular:true,visible:3,start:0,scroll:1,beforeStart:null,afterEnd:null,setDivWidth:true,setDivHeight:true,currentClass:"current"}})(jQuery);

//jQuery - Textbox Hinter plugin v1.0 from http://github.com/halilim/textbox-hinter
(function(a){a.fn.tbHinter=function(b){function d(c){if(c.val()==b.text){c.val("");c.removeClass(b["class"])}}b=a.extend({text:"Enter a text ...","class":""},b);return this.each(function(){a(this).focus(function(){d(a(this))});a(this).blur(function(){if(a(this).val()==""){a(this).val(b.text);a(this).addClass(b["class"])}});var c=a(this);a(this).parents("form").submit(function(){d(c)});a(this).blur()})}})(jQuery);

/* Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
 * Licensed under the MIT License (LICENSE.txt).
 *
 * Version 1.0
 *
 * Based on Making Compact Forms More Accessible by Mike Brittain (http://alistapart.com/articles/makingcompactformsmoreaccessible)
 */
(function(a){a.fn.overlabel=function(){this.each(function(){var b=a(this),c=a("#"+b.attr("for"));b.addClass("overlabel").bind("click",function(d){c.focus()});c.bind("focus blur",function(d){b.css("display",(d.type=="blur"&&!c.val()?"":"none"))}).trigger("blur")})}})(jQuery);

/*JQUERY TIMER */jQuery.timer = function (interval, callback){var interval = interval || 100;if (!callback){return false;} _timer=function(interval, callback) {this.stop = function () {clearInterval(self.id);};this.internalCallback = function () {callback(self);};this.reset = function (val) {if (self.id){clearInterval(self.id);}var val = val || 100;this.id = setInterval(this.internalCallback, val);};this.interval = interval;this.id = setInterval(this.internalCallback, this.interval);var self = this;};return new _timer(interval, callback); };
/*JQUERY SCROLL TO JOEL */(function($){eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('3.R=6(e){7 l=0;7 t=0;7 w=3.a(3.X(e,\'1e\'));7 h=3.a(3.X(e,\'1f\'));7 m=e.L;7 B=e.F;1a(e.S){l+=e.T+(e.8?3.a(e.8.W):0);t+=e.V+(e.8?3.a(e.8.10):0);e=e.S}l+=e.T+(e.8?3.a(e.8.W):0);t+=e.V+(e.8?3.a(e.8.10):0);c{x:l,y:t,w:w,h:h,m:m,B:B}};3.1d=6(e){b(e){w=e.k;h=e.C}f{w=(d.Y)?d.Y:(1.4&&1.4.k)?1.4.k:1.9.L;h=(d.H)?d.H:(1.4&&1.4.C)?1.4.C:1.9.F}c{w:w,h:h}};3.U=6(e){b(e){t=e.i;l=e.A;w=e.r;h=e.D}f{b(1.4&&1.4.i){t=1.4.i;l=1.4.A;w=1.4.r;h=1.4.D}f b(1.9){t=1.9.i;l=1.9.A;w=1.9.r;h=1.9.D}}c{t:t,l:l,w:w,h:h}};3.a=6(v){v=12(v);c 14(v)?0:v};3.16.E=6(s){o=3.17(s);c u.18(6(){n 3.P.E(u,o)})};3.P.E=6(e,o){7 z=u;z.o=o;z.e=e;z.p=3.R(e);z.s=3.U();z.J=6(){1b(z.j);z.j=1c};z.t=(n N).Z();z.M=6(){7 t=(n N).Z();7 p=(t-z.t)/z.o.I;b(t>=z.o.I+z.t){z.J();11(6(){z.q(z.p.y,z.p.x)},13)}f{G=((-g.O(p*g.Q)/2)+0.5)*(z.p.y-z.s.t)+z.s.t;K=((-g.O(p*g.Q)/2)+0.5)*(z.p.x-z.s.l)+z.s.l;z.q(G,K)}};z.q=6(t,l){d.19(l,t)};z.j=15(6(){z.M()},13)};',62,78,'|document||jQuery|documentElement||function|var|currentStyle|body|intval|if|return|window||else|Math||scrollTop|timer|clientWidth||wb|new|||scroll|scrollWidth|||this||||||scrollLeft|hb|clientHeight|scrollHeight|ScrollTo|offsetHeight|st|innerHeight|duration|clear|sl|offsetWidth|step|Date|cos|fx|PI|getPos|offsetParent|offsetLeft|getScroll|offsetTop|borderLeftWidth|css|innerWidth|getTime|borderTopWidth|setTimeout|parseInt||isNaN|setInterval|fn|speed|each|scrollTo|while|clearInterval|null|getClient|width|height'.split('|'),0,{}));})(jQuery);
/* Auto Expanding Text Area (1.2.2) */ /* $('#yorumkutusu').autogrow({lineHeight:14,minHeight:80}); */  (function(jQuery){var self=null;jQuery.fn.autogrow=function(o){return this.each(function(){new jQuery.autogrow(this,o)})};jQuery.autogrow=function(e,o){this.options=o||{};this.dummy=null;this.interval=null;this.line_height=this.options.lineHeight||parseInt(jQuery(e).css('line-height'));this.min_height=this.options.minHeight||parseInt(jQuery(e).css('min-height'));this.max_height=this.options.maxHeight||parseInt(jQuery(e).css('max-height'));this.textarea=jQuery(e);if(this.line_height==NaN)this.line_height=0;this.init()};jQuery.autogrow.fn=jQuery.autogrow.prototype={autogrow:'1.2.2'};jQuery.autogrow.fn.extend=jQuery.autogrow.extend=jQuery.extend;jQuery.autogrow.fn.extend({init:function(){var self=this;this.textarea.css({overflow:'hidden',display:'block'});this.textarea.bind('focus',function(){self.startExpand()}).bind('blur',function(){self.stopExpand()});this.checkExpand()},startExpand:function(){var self=this;this.interval=window.setInterval(function(){self.checkExpand()},400)},stopExpand:function(){clearInterval(this.interval)},checkExpand:function(){if(this.dummy==null){this.dummy=jQuery('<div></div>');this.dummy.css({'font-size':this.textarea.css('font-size'),'font-family':this.textarea.css('font-family'),'width':this.textarea.css('width'),'padding':this.textarea.css('padding'),'line-height':this.line_height+'px','overflow-x':'hidden','position':'absolute','top':0,'left':-9999}).appendTo('body')}var html=this.textarea.val().replace(/(<|>)/g,'');if($.browser.msie){html=html.replace(/\n/g,'<BR>new')}else{html=html.replace(/\n/g,'<br>new')}if(this.dummy.html()!=html){this.dummy.html(html);if(this.max_height>0&&(this.dummy.height()+this.line_height>this.max_height)){this.textarea.css('overflow-y','auto')}else{this.textarea.css('overflow-y','hidden');if(this.textarea.height()<this.dummy.height()+this.line_height||(this.dummy.height()<this.textarea.height())){this.textarea.animate({height:(this.dummy.height()+this.line_height)+'px'},100)}}}}})})(jQuery);
/* Textarea character counter http://www.tomdeater.com */ (function($){$.fn.charCounter=function(max,settings){max=max||100;settings=$.extend({container:'<span class="charcounter"></span>',classname:"charcounter",format:"%1",pulse:true,delay:0},settings);var p,timeout;function count(el,container){el=$(el);if(el.val().length>max){el.val(el.val().substring(0,max));if(settings.pulse&&!p){pulse(container,true);};};if(settings.delay>0){if(timeout){window.clearTimeout(timeout);} timeout=window.setTimeout(function(){container.html(settings.format.replace(/%1/,(max-el.val().length)));},settings.delay);}else{container.html(settings.format.replace(/%1/,(max-el.val().length)));}};function pulse(el,again){if(p){window.clearTimeout(p);p=null;};el.animate({opacity:0.1},100,function(){$(this).animate({opacity:1.0},100);});if(again){p=window.setTimeout(function(){pulse(el)},200);};};return this.each(function(){var container=(!settings.container.match(/^<.+>$/))?$(settings.container):$(settings.container).insertAfter(this).addClass(settings.classname);$(this).bind("keydown",function(){count(this,container);}).bind("keypress",function(){count(this,container);}).bind("keyup",function(){count(this,container);}).bind("focus",function(){count(this,container);}).bind("mouseover",function(){count(this,container);}).bind("mouseout",function(){count(this,container);}).bind("paste",function(){var me=this;setTimeout(function(){count(me,container);},10);});if(this.addEventListener){this.addEventListener('input',function(){count(this,container);},false);};count(this,container);});};})(jQuery);

// ColorBox v1.3.17 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+
// Copyright (c) 2011 Jack Moore - jack@colorpowered.com
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
(function(a,b,c){function bc(b){if(!T){O=b,_(a.extend(J,a.data(O,e))),x=a(O),P=0,J.rel!=="nofollow"&&(x=a("."+X).filter(function(){var b=a.data(this,e).rel||this.rel;return b===J.rel}),P=x.index(O),P===-1&&(x=x.add(O),P=x.length-1));if(!R){R=S=!0,q.show();if(J.returnFocus)try{O.blur(),a(O).one(k,function(){try{this.focus()}catch(a){}})}catch(c){}p.css({opacity:+J.opacity,cursor:J.overlayClose?"pointer":"auto"}).show(),J.w=Z(J.initialWidth,"x"),J.h=Z(J.initialHeight,"y"),W.position(0),n&&y.bind("resize."+o+" scroll."+o,function(){p.css({width:y.width(),height:y.height(),top:y.scrollTop(),left:y.scrollLeft()})}).trigger("resize."+o),ba(g,J.onOpen),I.add(C).hide(),H.html(J.close).show()}W.load(!0)}}function bb(){var a,b=f+"Slideshow_",c="click."+f,d,e,g;J.slideshow&&x[1]?(d=function(){E.text(J.slideshowStop).unbind(c).bind(i,function(){if(P<x.length-1||J.loop)a=setTimeout(W.next,J.slideshowSpeed)}).bind(h,function(){clearTimeout(a)}).one(c+" "+j,e),q.removeClass(b+"off").addClass(b+"on"),a=setTimeout(W.next,J.slideshowSpeed)},e=function(){clearTimeout(a),E.text(J.slideshowStart).unbind([i,h,j,c].join(" ")).one(c,d),q.removeClass(b+"on").addClass(b+"off")},J.slideshowAuto?d():e()):q.removeClass(b+"off "+b+"on")}function ba(b,c){c&&c.call(O),a.event.trigger(b)}function _(b){for(var c in b)a.isFunction(b[c])&&c.substring(0,2)!=="on"&&(b[c]=b[c].call(O));b.rel=b.rel||O.rel||"nofollow",b.href=b.href||a(O).attr("href"),b.title=b.title||O.title,typeof b.href=="string"&&(b.href=a.trim(b.href))}function $(a){return J.photo||/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(a)}function Z(a,b){b=b==="x"?y.width():y.height();return typeof a=="string"?Math.round(/%/.test(a)?b/100*parseInt(a,10):parseInt(a,10)):a}function Y(c,d){var e=b.createElement("div");c&&(e.id=f+c),e.style.cssText=d||"";return a(e)}var d={transition:"elastic",speed:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,inline:!1,html:!1,iframe:!1,fastIframe:!0,photo:!1,href:!1,title:!1,rel:!1,opacity:.9,preloading:!0,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:!1,returnFocus:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:!1},e="colorbox",f="cbox",g=f+"_open",h=f+"_load",i=f+"_complete",j=f+"_cleanup",k=f+"_closed",l=f+"_purge",m=a.browser.msie&&!a.support.opacity,n=m&&a.browser.version<7,o=f+"_IE6",p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J={},K,L,M,N,O,P,Q,R,S,T,U,V,W,X=f+"Element";W=a.fn[e]=a[e]=function(b,c){var f=this,g;if(!f[0]&&f.selector)return f;b=b||{},c&&(b.onComplete=c);if(!f[0]||f.selector===undefined)f=a("<a/>"),b.open=!0;f.each(function(){a.data(this,e,a.extend({},a.data(this,e)||d,b)),a(this).addClass(X)}),g=b.open,a.isFunction(g)&&(g=g.call(f)),g&&bc(f[0]);return f},W.init=function(){y=a(c),q=Y().attr({id:e,"class":m?f+(n?"IE6":"IE"):""}),p=Y("Overlay",n?"position:absolute":"").hide(),r=Y("Wrapper"),s=Y("Content").append(z=Y("LoadedContent","width:0; height:0; overflow:hidden"),B=Y("LoadingOverlay").add(Y("LoadingGraphic")),C=Y("Title"),D=Y("Current"),F=Y("Next"),G=Y("Previous"),E=Y("Slideshow").bind(g,bb),H=Y("Close")),r.append(Y().append(Y("TopLeft"),t=Y("TopCenter"),Y("TopRight")),Y(!1,"clear:left").append(u=Y("MiddleLeft"),s,v=Y("MiddleRight")),Y(!1,"clear:left").append(Y("BottomLeft"),w=Y("BottomCenter"),Y("BottomRight"))).children().children().css({"float":"left"}),A=Y(!1,"position:absolute; width:9999px; visibility:hidden; display:none"),a("body").prepend(p,q.append(r,A)),s.children().hover(function(){a(this).addClass("hover")},function(){a(this).removeClass("hover")}).addClass("hover"),K=t.height()+w.height()+s.outerHeight(!0)-s.height(),L=u.width()+v.width()+s.outerWidth(!0)-s.width(),M=z.outerHeight(!0),N=z.outerWidth(!0),q.css({"padding-bottom":K,"padding-right":L}).hide(),F.click(function(){W.next()}),G.click(function(){W.prev()}),H.click(function(){W.close()}),I=F.add(G).add(D).add(E),s.children().removeClass("hover"),p.click(function(){J.overlayClose&&W.close()}),a(b).bind("keydown."+f,function(a){var b=a.keyCode;R&&J.escKey&&b===27&&(a.preventDefault(),W.close()),R&&J.arrowKey&&x[1]&&(b===37?(a.preventDefault(),G.click()):b===39&&(a.preventDefault(),F.click()))})},W.remove=function(){q.add(p).remove(),a("."+X).removeData(e).removeClass(X)},W.position=function(a,c){function g(a){t[0].style.width=w[0].style.width=s[0].style.width=a.style.width,B[0].style.height=B[1].style.height=s[0].style.height=u[0].style.height=v[0].style.height=a.style.height}var d,e=0,f=0;q.hide(),J.fixed&&!n?q.css({position:"fixed"}):(e=y.scrollTop(),f=y.scrollLeft(),q.css({position:"absolute"})),J.right!==!1?f+=Math.max(y.width()-J.w-N-L-Z(J.right,"x"),0):J.left!==!1?f+=Z(J.right,"x")/2:f+=Math.max(y.width()-J.w-N-L,0)/2,J.bottom!==!1?e+=Math.max(b.documentElement.clientHeight-J.h-M-K-Z(J.bottom,"y"),0):J.top!==!1?e+=Z(J.top,"y")/2:e+=Math.max(b.documentElement.clientHeight-J.h-M-K,0)/2,q.show(),d=q.width()===J.w+N&&q.height()===J.h+M?0:a,r[0].style.width=r[0].style.height="9999px",q.dequeue().animate({width:J.w+N,height:J.h+M,top:e,left:f},{duration:d,complete:function(){g(this),S=!1,r[0].style.width=J.w+N+L+"px",r[0].style.height=J.h+M+K+"px",c&&c()},step:function(){g(this)}})},W.resize=function(a){if(R){a=a||{},a.width&&(J.w=Z(a.width,"x")-N-L),a.innerWidth&&(J.w=Z(a.innerWidth,"x")),z.css({width:J.w}),a.height&&(J.h=Z(a.height,"y")-M-K),a.innerHeight&&(J.h=Z(a.innerHeight,"y"));if(!a.innerHeight&&!a.height){var b=z.wrapInner("<div style='overflow:auto'></div>").children();J.h=b.height(),b.replaceWith(b.children())}z.css({height:J.h}),W.position(J.transition==="none"?0:J.speed)}},W.prep=function(b){function h(b){W.position(b,function(){function o(){m&&q[0].style.removeAttribute("filter")}var b,d,g,h,j=x.length,k,n;!R||(n=function(){clearTimeout(V),B.hide(),ba(i,J.onComplete)},m&&Q&&z.fadeIn(100),C.html(J.title).add(z).show(),j>1?(typeof J.current=="string"&&D.html(J.current.replace(/\{current\}/,P+1).replace(/\{total\}/,j)).show(),F[J.loop||P<j-1?"show":"hide"]().html(J.next),G[J.loop||P?"show":"hide"]().html(J.previous),b=P?x[P-1]:x[j-1],g=P<j-1?x[P+1]:x[0],J.slideshow&&E.show(),J.preloading&&(h=a.data(g,e).href||g.href,d=a.data(b,e).href||b.href,h=a.isFunction(h)?h.call(g):h,d=a.isFunction(d)?d.call(b):d,$(h)&&(a("<img/>")[0].src=h),$(d)&&(a("<img/>")[0].src=d))):I.hide(),J.iframe?(k=a("<iframe/>").addClass(f+"Iframe")[0],J.fastIframe?n():a(k).one("load",n),k.name=f+ +(new Date),k.src=J.href,J.scrolling||(k.scrolling="no"),m&&(k.frameBorder=0,k.allowTransparency="true"),a(k).appendTo(z).one(l,function(){k.src="//about:blank"})):n(),J.transition==="fade"?q.fadeTo(c,1,o):o(),y.bind("resize."+f,function(){W.position(0)}))})}function g(){J.h=J.h||z.height(),J.h=J.mh&&J.mh<J.h?J.mh:J.h;return J.h}function d(){J.w=J.w||z.width(),J.w=J.mw&&J.mw<J.w?J.mw:J.w;return J.w}if(!!R){var c=J.transition==="none"?0:J.speed;y.unbind("resize."+f),z.remove(),z=Y("LoadedContent").html(b),z.hide().appendTo(A.show()).css({width:d(),overflow:J.scrolling?"auto":"hidden"}).css({height:g()}).prependTo(s),A.hide(),a(Q).css({"float":"none"}),n&&a("select").not(q.find("select")).filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one(j,function(){this.style.visibility="inherit"}),J.transition==="fade"?q.fadeTo(c,0,function(){h(0)}):h(c)}},W.load=function(b){var c,d,g=W.prep;S=!0,Q=!1,O=x[P],b||_(a.extend(J,a.data(O,e))),ba(l),ba(h,J.onLoad),J.h=J.height?Z(J.height,"y")-M-K:J.innerHeight&&Z(J.innerHeight,"y"),J.w=J.width?Z(J.width,"x")-N-L:J.innerWidth&&Z(J.innerWidth,"x"),J.mw=J.w,J.mh=J.h,J.maxWidth&&(J.mw=Z(J.maxWidth,"x")-N-L,J.mw=J.w&&J.w<J.mw?J.w:J.mw),J.maxHeight&&(J.mh=Z(J.maxHeight,"y")-M-K,J.mh=J.h&&J.h<J.mh?J.h:J.mh),c=J.href,V=setTimeout(function(){B.show()},100),J.inline?(Y().hide().insertBefore(a(c)[0]).one(l,function(){a(this).replaceWith(z.children())}),g(a(c))):J.iframe?g(" "):J.html?g(J.html):$(c)?(a(Q=new Image).addClass(f+"Photo").error(function(){J.title=!1,g(Y("Error").text("This image could not be loaded"))}).load(function(){var a;Q.onload=null,J.scalePhotos&&(d=function(){Q.height-=Q.height*a,Q.width-=Q.width*a},J.mw&&Q.width>J.mw&&(a=(Q.width-J.mw)/Q.width,d()),J.mh&&Q.height>J.mh&&(a=(Q.height-J.mh)/Q.height,d())),J.h&&(Q.style.marginTop=Math.max(J.h-Q.height,0)/2+"px"),x[1]&&(P<x.length-1||J.loop)&&(Q.style.cursor="pointer",Q.onclick=function(){W.next()}),m&&(Q.style.msInterpolationMode="bicubic"),setTimeout(function(){g(Q)},1)}),setTimeout(function(){Q.src=c},1)):c&&A.load(c,J.data,function(b,c,d){g(c==="error"?Y("Error").text("Request unsuccessful: "+d.statusText):a(this).contents())})},W.next=function(){!S&&x[1]&&(P<x.length-1||J.loop)&&(P=P<x.length-1?P+1:0,W.load())},W.prev=function(){!S&&x[1]&&(P||J.loop)&&(P=P?P-1:x.length-1,W.load())},W.close=function(){R&&!T&&(T=!0,R=!1,ba(j,J.onCleanup),y.unbind("."+f+" ."+o),p.fadeTo(200,0),q.stop().fadeTo(300,0,function(){q.add(p).css({opacity:1,cursor:"auto"}).hide(),ba(l),z.remove(),setTimeout(function(){T=!1,ba(k,J.onClosed)},1)}))},W.element=function(){return a(O)},W.settings=d,U=function(a){a.button!==0&&typeof a.button!="undefined"||a.ctrlKey||a.shiftKey||a.altKey||(a.preventDefault(),bc(this))},a.fn.delegate?a(b).delegate("."+X,"click",U):a("."+X).live("click",U),a(W.init)})(jQuery,document,this);

function cBoxAlert(html){
    $.colorbox({html:html, transition: "none"});
}

function cBoxErr(html){
    cBoxAlert('<div class="msg-err" style="min-width:300px">'+html+'</div>');
}

function cBoxConfirm(baslik, msg, url){
    cBoxAlert('<h3><strong>' + baslik + '</strong></h3><div class="msg-ask">' + msg + '</div><br /><a href="' + url + '" class="contactButton">Evet</a> &nbsp; <a href="#" class="contactButtonGreen cBoxCloseNoCss">Hayır</a>');
}

// Takes an ISO time and returns a string representing how
// long ago the date represents.
function prettyDate(time){
	var date = new Date((time || "").replace(/-/g,"/").replace(/[TZ]/g," ")),diff = (((new Date()).getTime() - date.getTime()) / 1000),day_diff = Math.floor(diff / 86400);
	if ( isNaN(day_diff) || day_diff < 0 || day_diff >= 31 ){return;}
    
	return day_diff == 0 &&
    (
			diff < 10 && "Şimdi" ||
            diff < 60 && Math.floor(diff) + " sn. önce" ||
			diff < 120 && "1 dk. önce" ||
			diff < 3600 && Math.floor( diff / 60 ) + " dk. önce" ||
            diff < 3660 && " 1 saat önce" ||
			diff < 86400 && Math.floor( diff / 3600 ) + " saat "+ Math.floor((diff%3600)/60) + " dk. önce"
    ) || day_diff == 1 && "Dün "+ date.getHours()+':'+date.getMinutes();
}
// If jQuery is included in the page, adds a jQuery plugin to handle it as well
if ( typeof jQuery != "undefined" ) {
	jQuery.fn.prettyDate = function(){
		return this.each(function(){
			var date = prettyDate(this.title);
			if ( date )
				jQuery(this).text( date );
		});
	};
}

/* COOKIES */
function setCookie(c_name,value,expiredays){var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString()+';')+'path=/;';}
function setCookieTime(c_name,value,minutes){var exdate=new Date();exdate.setTime( exdate.getTime() );var exdate = new Date( exdate.getTime() + (minutes * 1000 * 60) );document.cookie=c_name+ "=" +escape(value)+((minutes==null) ? "" : ";expires="+exdate.toGMTString());}
function getCookie(c_name){if(document.cookie.length>0){c_start=document.cookie.indexOf(c_name + "=");if (c_start!=-1){c_start=c_start + c_name.length+1;c_end=document.cookie.indexOf(";",c_start);if (c_end==-1) c_end=document.cookie.length;return unescape(document.cookie.substring(c_start,c_end));}}return "";}

/* JSON */ /* $.JSON.encode(JSONDATA); $.JSON.decode(STRING); */
jQuery.JSON={useHasOwn:({}.hasOwnProperty?true:false),pad:function(n){return n<10?"0"+n:n;},m:{"\b":'\\b',"\t":'\\t',"\n":'\\n',"\f":'\\f',"\r":'\\r','"':'\\"',"\\":'\\\\'},encodeString : function(s){if(/["\\\x00-\x1f]/.test(s)){return '"'+s.replace(/([\x00-\x1f\\"])/g,function(a,b){var c=m[b];if(c){return c;}c=b.charCodeAt();return "\\u00"+Math.floor(c/16).toString(16)+(c%16).toString(16);})+'"';}return '"'+s+'"';},encodeArray : function(o){var a = ["["],b,i,l=o.length,v;for (i=0;i<l;i+=1){v=o[i];switch(typeof v){case "undefined":case "function":case "unknown":break;default:if(b){a.push(',');}a.push(v===null?"null":this.encode(v));b=true;}}a.push("]");return a.join("");},encodeDate:function(o){return '"'+o.getFullYear()+"-"+pad(o.getMonth()+1)+"-"+pad(o.getDate())+"T"+pad(o.getHours())+":"+pad(o.getMinutes())+":"+pad(o.getSeconds())+'"';},encode:function(o){if(typeof o=="undefined"||o===null){return "null";}else if(o instanceof Array){return this.encodeArray(o);}else if(o instanceof Date){return this.encodeDate(o);}else if(typeof o=="string"){return this.encodeString(o);}else if(typeof o=="number"){return isFinite(o)?String(o):"null";}else if(typeof o=="boolean"){return String(o);}else{var self=this;var a=["{"],b,i,v;for(i in o){if(!this.useHasOwn||o.hasOwnProperty(i)){v=o[i];switch (typeof v) {case "undefined":case "function":case "unknown":break;default:if(b){a.push(',');}a.push(self.encode(i),":",v===null?"null":self.encode(v));b=true;}}}a.push("}");return a.join("");}},decode:function(json){return eval("("+json+')');}};

function randomString(length){var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz'.split('');if (! length) {length = Math.floor(Math.random() * chars.length);}
    var str = '';for (var i = 0; i < length; i++) {str += chars[Math.floor(Math.random() * chars.length)];}return str;
}

/* Array Works */
function reorganize(formObj, stepUp) {
  stepUp = (Math.abs(parseInt(stepUp)) > 0 ? Math.abs(parseInt(stepUp)) : 1);
  var nextRound = 1;
  var idx = 0;
  var tempArray = new Array();

  for (var i = 0; i < formObj.length; i++) {
    tempArray[i] = formObj[idx];
    if (idx + stepUp >= formObj.length) {
      idx = nextRound;
      nextRound++;
      }
    else {
      idx += stepUp;
      }
    }
  return tempArray;
}

/**
 * @param  string|selector  exclude  Selector to exclude from smooth scrolling
 */
function enable_smooth_scroll(exclude) {
    function filterPath(string) {
        return string
                .replace(/^\//,'')
                .replace(/(index|default).[a-zA-Z]{3,4}$/,'')
                .replace(/\/$/,'');
    }

    var locationPath = filterPath(location.pathname);
    
    var scrollElement = 'html, body';
    $('html, body').each(function () {
        var initScrollTop = $(this).attr('scrollTop');
        $(this).attr('scrollTop', initScrollTop + 1);
        if ($(this).attr('scrollTop') == initScrollTop + 1) {
            scrollElement = this.nodeName.toLowerCase();
            $(this).attr('scrollTop', initScrollTop);
            return false;
        }    
    });
    
    $('a[href*=#]').not(exclude || null).each(function() {
        var thisPath = filterPath(this.pathname) || locationPath;
        if  (   locationPath == thisPath
                && (location.hostname == this.hostname || !this.hostname)
                && this.hash.replace(/#/, '')
            ) {
                if ($(this.hash).length) {
                    $(this).click(function(event) {
                        var targetOffset = $(this.hash).offset().top;
                        var target = this.hash;
                        event.preventDefault();
                        $(scrollElement).animate(
                            {scrollTop: targetOffset},
                            500,
                            function() {
                                location.hash = target;
                        });
                    });
                }
        }
    });
}

/*!
 * jQuery Countdown plugin v1.0
 * http://www.littlewebthings.com/projects/countdown/
 * modified : Scripts\Javascript\jQuery'ler\plugins\lwtCountdown\modified.js
 */
(function(c){c.fn.countDown=function(b){var a={animType:"default"};a=c.extend(true,{},a,b);c(this[0]).data("config",a);diffSecs=this.setCountDown(a);a.onComplete&&c.data(c(this)[0],"callback",a.onComplete);a.omitWeeks&&c.data(c(this)[0],"omitWeeks",a.omitWeeks);c(this).find(".digit").html('<div class="top"></div><div class="bottom"></div>');c(this).doCountDown(this,diffSecs,500);return this};c.fn.stopCountDown=function(){clearTimeout(c.data(this[0],"timer"))};c.fn.startCountDown=function(){this.doCountDown(this,
c.data(this[0],"diffSecs"),500)};c.fn.setCountDown=function(b){var a=new Date;if(b.targetDate)a=new Date(b.targetDate.month+"/"+b.targetDate.day+"/"+b.targetDate.year+" "+b.targetDate.hour+":"+b.targetDate.min+":"+b.targetDate.sec+(b.targetDate.utc?" UTC":""));else if(b.targetOffset){a.setFullYear(b.targetOffset.year+a.getFullYear());a.setMonth(b.targetOffset.month+a.getMonth());a.setDate(b.targetOffset.day+a.getDate());a.setHours(b.targetOffset.hour+a.getHours());a.setMinutes(b.targetOffset.min+
a.getMinutes());a.setSeconds(b.targetOffset.sec+a.getSeconds())}b=new Date;diffSecs=Math.floor((a.valueOf()-b.valueOf())/1E3);c(this[0]).data("diffSecs",diffSecs);return diffSecs};c.fn.doCountDown=function(b,a,d){$this=c(b);if(a<=0){a=0;c.data($this[0],"timer")&&clearTimeout(c.data($this[0],"timer"))}secs=a%60;mins=Math.floor(a/60)%60;hours=Math.floor(a/60/60)%24;days=c.data($this[0],"omitWeeks")==true?Math.floor(a/60/60/24):Math.floor(a/60/60/24)%7;weeks=Math.floor(a/60/60/24/7);$this.dashChangeTo(b,
"seconds_dash",secs,d?d:800);$this.dashChangeTo(b,"minutes_dash",mins,d?d:1200);$this.dashChangeTo(b,"hours_dash",hours,d?d:1200);$this.dashChangeTo(b,"days_dash",days,d?d:1200);$this.dashChangeTo(b,"weeks_dash",weeks,d?d:1200);c.data($this[0],"diffSecs",a);if(a>0){e=$this;t=setTimeout(function(){e.doCountDown(b,a-1)},1E3);c.data(e[0],"timer",t)}else if(cb=c.data($this[0],"callback"))c.data($this[0],"callback").call($this[0])};c.fn.dashChangeTo=function(b,a,d,g){$this=c(b);for(b=$this.find("."+a+
" .digit").length-1;b>=0;b--){var f=d%10;d=(d-f)/10;$this.digitChangeTo($this.find("."+a+" .digit:eq("+b+")"),f,g,($this.data("config")||{animType:""}).animType)}};c.fn.digitChangeTo=function(b,a,d,g){var f=b.find(".top"),h=b.find(".bottom");d=d||800;if(f.html()!=a+""){f.html(a?a:"0");switch(g){case "simple":break;default:f.css({display:"none"});f.slideDown(d);h.animate({height:""},d,function(){h.html(f.html());h.css({display:"block",height:""});f.hide().slideUp(10)})}}}})(jQuery);

function sayacCalistir(cont){
	$(".jsSayacNoCss").each(function (){
        if (!$(this).data("countDownized")) {
            $(this).data("countDownized", true);
            var td = {
    			'day': 		parseInt($(this).find(".gun").text(), 10),
    			'month': 	parseInt($(this).find(".ay").text(), 10),
    			'year': 	parseInt($(this).find(".yil").text(), 10),
    			'hour': 	parseInt($(this).find(".saat").text(), 10),
    			'min': 		parseInt($(this).find(".dakika").text(), 10),
    			'sec': 		parseInt($(this).find(".saniye").text(), 10)
      		};
            //console.log(td);
            $(this).countDown({
        		targetDate: td
                ,onComplete: function (){
                    $(this).parents(".fContNoCss").find(".fBitenNoCss").slideDown("normal");
                }
                ,animType: $(this).hasClass("geriSay") ? "" : "simple"
                ,omitWeeks: true
        	});
        }
    });
}

// BeZoom 0.2 (Modified) - jQuery plugin http://benjaminmock.de/bezoom-jquery-plugin
(function(a){a.fn.bezoom=function(d){var b={marginLeft:10,identifier:"bezoom",height:200,width:200,titleSource:"title",imgSource:"href",bgColor:"#5398EE",color:"#ffffff",size:"0.8em"},d=d||{};a.extend(b,d);this.each(function(){var d=a(this).attr(b.titleSource),g=a(this).attr(b.imgSource),k=a(this).attr("title"),l=a(this).find("img");a(this).mouseenter(function(){a("#"+b.identifier).remove();a(this).attr("title","");var c=a(this).find("img").height(),f=a(this).find("img").width(),h=a(this).position(),
c=Math.ceil(h.top-0)-c,f=Math.ceil(h.left-0)+f+b.marginLeft;a("body").append('<div id="'+b.identifier+'" style="position:absolute; top:'+c+"px;left:"+f+"px;width:"+b.width+'px;"><div class="beZoomTitle" style="background-color:'+b.bgColor+";color:"+b.color+";font-size:"+b.size+';">'+d+'</div><div style="width:'+b.width+"px;height:"+b.height+'px;overflow:hidden;position:relative;"><img id="'+b.identifier+'_img" src="'+g+'" style="position:relative;"></div></div>')}).mouseleave(function(){a("#"+b.identifier).remove();
a(this).attr("title",k)});a(this).mousemove(function(c){var f=a(this).find("img").height(),d=a(this).find("img").width(),e=a("#"+b.identifier+"_img").width(),i=a("#"+b.identifier+"_img").height();d/=e;f/=i;var j=l.position(),g=c.pageY-j.top,c=Math.ceil((c.pageX-j.left)/d-b.width/2)*-1,c=Math.max(-1*e+b.width,c),c=Math.min(0,c),e=Math.ceil(g/f-b.height*0.5)*-1,e=Math.min(0,e),e=Math.max(-1*i+b.height,e);a("#"+b.identifier+"_img").css("left",c);a("#"+b.identifier+"_img").css("top",e)})});return this}})(jQuery);

// addLens http://www.examplet.buss.hk/jquery/lens.php
(function(b){function e(a,b){var c=0;a.css(b).replace(/\b(\d+)px\b/,function(a,b){c=parseInt(b)});return c}function d(a,f,c,d){if(a)f=f||100,c=c||100,this.callBack=typeof d=="function"?d:function(){},this.target=b(a),this.disabled=!1,this.callBack=d||function(){},this.anchor=this.target.wrap(document.createElement("a")).closest("a").data("Lens",this).unbind("mouseover").unbind("mouseout").unbind("mousemove").hover(function(a){b(this).data("Lens").show(a)},function(){b(this).data("Lens").hide()}).mousemove(function(a){b(this).data("Lens").show(a)}),
this.jNode=b('<div style="background-color:#FFF;-moz-opacity:0.6;opacity:0.6;filter:alpha(opacity=60);position:absolute;z-index:900;cursor:crosshair;"></div>').css({width:f,height:c}).appendTo(this.anchor).hide().css({top:this.target.offset().top,left:this.target.offset().left}),this.offset={top:this.target.offset().top+e(this.target,"borderTopWidth"),left:this.target.offset().left+e(this.target,"borderLeftWidth"),width:f,height:c},this.adjustedTarget={top:this.target.offset().top+e(this.target,"borderTopWidth"),
left:this.target.offset().left+e(this.target,"borderLeftWidth")},this.target.data("Lens",this)}d.prototype.remove=function(){this.jNode.remove()};d.prototype.show=function(a){if(!this.disabled)this.mouseX=a.pageX,this.mouseY=a.pageY,this.offset.left=parseInt(this.mouseX-this.offset.width/2),this.offset.left=this.offset.left<this.adjustedTarget.left?this.adjustedTarget.left:this.offset.left,this.offset.left=this.offset.left>this.adjustedTarget.left+this.target.width()-this.offset.width?this.adjustedTarget.left+
this.target.width()-this.offset.width:this.offset.left,this.offset.top=parseInt(this.mouseY-this.offset.height/2),this.offset.top=this.offset.top<this.adjustedTarget.top?this.adjustedTarget.top:this.offset.top,this.offset.top=this.offset.top>this.adjustedTarget.top+this.target.height()-this.offset.height?this.adjustedTarget.top+this.target.height()-this.offset.height:this.offset.top,this.jNode.css({top:this.offset.top,left:this.offset.left}),this.relative={top:parseInt(this.offset.top-this.adjustedTarget.top),
left:parseInt(this.offset.left-this.adjustedTarget.left)},this.jNode.show(),typeof this.callBack=="function"&&this.callBack.apply(this.target)};d.prototype.hide=function(){this.jNode.hide()};d.prototype.disable=function(){this.disabled=!0};d.prototype.enable=function(){this.disabled=!1};b.fn.addLens=function(a,b,c){new d(this,typeof a!="number"?100:a,typeof b!="number"?100:b,typeof a=="function"?a:typeof c=="function"?c:function(){})};b.fn.showLens=function(){this.data("Lens").show()};b.fn.hideLens=
function(){this.data("Lens").hide()};b.fn.removeLens=function(){this.data("Lens").remove()}})(jQuery);

// https://github.com/halilim/js-funcs/blob/master/dropdownize.js
(function(a){a.fn.dropdownize=function(f){var b=a.extend(true,{},{hideAfter:400,showOn:"mouseenter",showFn:function(){a(this).slideDown("fast")},hideFn:function(){a(this).slideUp("fast")}},f);return this.each(function(){function g(){b.hideFn.call(d);e.removeClass("hover");c=0}var e=a(this),d;d=a.isFunction(b.menuEl)?b.menuEl.call(e):a(b.menuEl);var c=0;e.bind(b.showOn+".dropdownize",function(){b.showFn.call(d);a(this).addClass("hover")});e.add(d).bind("mouseleave.dropdownize",function(){c=setTimeout(g,
b.hideAfter)}).bind("mouseenter.dropdownize",function(){if(c!=0){clearTimeout(c);c=0}})})}})(jQuery);

/*select works http://www.texotela.co.uk/code/jquery/select/ */(function(h){h.fn.addOption=function(){var j=function(a,f,c,g){var d=document.createElement("option");d.value=f,d.text=c;var b=a.options;var e=b.length;if(!a.cache){a.cache={};for(var i=0;i<e;i++){a.cache[b[i].value]=i}}if(typeof a.cache[f]=="undefined")a.cache[f]=e;a.options[a.cache[f]]=d;if(g){d.selected=true}};var k=arguments;if(k.length==0)return this;var l=true;var m=false;var n,o,p;if(typeof(k[0])=="object"){m=true;n=k[0]}if(k.length>=2){if(typeof(k[1])=="boolean")l=k[1];else if(typeof(k[2])=="boolean")l=k[2];if(!m){o=k[0];p=k[1]}}this.each(function(){if(this.nodeName.toLowerCase()!="select")return;if(m){for(var a in n){j(this,a,n[a],l)}}else{j(this,o,p,l)}});return this};h.fn.ajaxAddOption=function(c,g,d,b,e){if(typeof(c)!="string")return this;if(typeof(g)!="object")g={};if(typeof(d)!="boolean")d=true;this.each(function(){var f=this;h.getJSON(c,g,function(a){h(f).addOption(a,d);if(typeof b=="function"){if(typeof e=="object"){b.apply(f,e)}else{b.call(f)}}})});return this};h.fn.removeOption=function(){var d=arguments;if(d.length==0)return this;var b=typeof(d[0]);var e,i;if(b=="string"||b=="object"||b=="function"){e=d[0];if(e.constructor==Array){var j=e.length;for(var k=0;k<j;k++){this.removeOption(e[k],d[1])}return this}}else if(b=="number")i=d[0];else return this;this.each(function(){if(this.nodeName.toLowerCase()!="select")return;if(this.cache)this.cache=null;var a=false;var f=this.options;if(!!e){var c=f.length;for(var g=c-1;g>=0;g--){if(e.constructor==RegExp){if(f[g].value.match(e)){a=true}}else if(f[g].value==e){a=true}if(a&&d[1]===true)a=f[g].selected;if(a){f[g]=null}a=false}}else{if(d[1]===true){a=f[i].selected}else{a=true}if(a){this.remove(i)}}});return this};h.fn.sortOptions=function(e){var i=h(this).selectedValues();var j=typeof(e)=="undefined"?true:!!e;this.each(function(){if(this.nodeName.toLowerCase()!="select")return;var c=this.options;var g=c.length;var d=[];for(var b=0;b<g;b++){d[b]={v:c[b].value,t:c[b].text}}d.sort(function(a,f){o1t=a.t.toLowerCase(),o2t=f.t.toLowerCase();if(o1t==o2t)return 0;if(j){return o1t<o2t?-1:1}else{return o1t>o2t?-1:1}});for(var b=0;b<g;b++){c[b].text=d[b].t;c[b].value=d[b].v}}).selectOptions(i,true);return this};h.fn.selectOptions=function(g,d){var b=g;var e=typeof(g);if(e=="object"&&b.constructor==Array){var i=this;h.each(b,function(){i.selectOptions(this,d)})};var j=d||false;if(e!="string"&&e!="function"&&e!="object")return this;this.each(function(){if(this.nodeName.toLowerCase()!="select")return this;var a=this.options;var f=a.length;for(var c=0;c<f;c++){if(b.constructor==RegExp){if(a[c].value.match(b)){a[c].selected=true}else if(j){a[c].selected=false}}else{if(a[c].value==b){a[c].selected=true}else if(j){a[c].selected=false}}}});return this};h.fn.copyOptions=function(g,d){var b=d||"selected";if(h(g).size()==0)return this;this.each(function(){if(this.nodeName.toLowerCase()!="select")return this;var a=this.options;var f=a.length;for(var c=0;c<f;c++){if(b=="all"||(b=="selected"&&a[c].selected)){h(g).addOption(a[c].value,a[c].text)}}});return this};h.fn.containsOption=function(g,d){var b=false;var e=g;var i=typeof(e);var j=typeof(d);if(i!="string"&&i!="function"&&i!="object")return j=="function"?this:b;this.each(function(){if(this.nodeName.toLowerCase()!="select")return this;if(b&&j!="function")return false;var a=this.options;var f=a.length;for(var c=0;c<f;c++){if(e.constructor==RegExp){if(a[c].value.match(e)){b=true;if(j=="function")d.call(a[c],c)}}else{if(a[c].value==e){b=true;if(j=="function")d.call(a[c],c)}}}});return j=="function"?this:b};h.fn.selectedValues=function(){var a=[];this.selectedOptions().each(function(){a[a.length]=this.value});return a};h.fn.selectedTexts=function(){var a=[];this.selectedOptions().each(function(){a[a.length]=this.text});return a};h.fn.selectedOptions=function(){return this.find("option:selected")}})(jQuery);

// http://www.filamentgroup.com/lab/accessible_custom_designed_checkbox_radio_button_inputs_styled_css_jquery/
jQuery.fn.customInput=function(){$(this).each(function(){if($(this).is("[type=checkbox],[type=radio]")){var a=$(this),b=$("label[for="+a.attr("id")+"]"),c=a.is("[type=checkbox]")?"checkbox":"radio";$('<div class="custom-'+c+'"></div>').insertBefore(a).append(a,b);var d=$("input[name="+a.attr("name")+"]");b.hover(function(){$(this).addClass("hover");c=="checkbox"&&a.is(":checked")&&$(this).addClass("checkedHover")},function(){$(this).removeClass("hover checkedHover")});a.bind("updateState",function(){a.is(":checked")?
(a.is(":radio")&&d.each(function(){$("label[for="+$(this).attr("id")+"]").removeClass("checked")}),b.addClass("checked")):b.removeClass("checked checkedHover checkedFocus")}).trigger("updateState").click(function(){$(this).trigger("updateState")}).focus(function(){b.addClass("focus");c=="checkbox"&&a.is(":checked")&&$(this).addClass("checkedFocus")}).blur(function(){b.removeClass("focus checkedFocus")})}})};

// Autotab - jQuery plugin 1.1b http://www.lousyllama.com/sandbox/jquery-autotab
(function(d){var e=function(c){var a=null,b=d("#"+c),c=d("input[name="+c+"]");b.length?a=b:c!=void 0&&(a=c);return a};d.fn.autotab_magic=function(c){for(var a=0;a<this.length;a++){var b=a+1,f=a-1;a>0&&b<this.length?d(this[a]).autotab({target:d(this[b]),previous:d(this[f])}):a>0?d(this[a]).autotab({previous:d(this[f])}):d(this[a]).autotab({target:d(this[b])});(c!=null&&isNaN(c)&&c==d(this[a]).attr("id")||!isNaN(c)&&c==a)&&d(this[a]).focus()}return this};d.fn.autotab_filter=function(c){var a={format:"all",
uppercase:!1,lowercase:!1,nospace:!1,pattern:null};typeof c=="string"||typeof c=="function"?a.format=c:d.extend(a,c);for(c=0;c<this.length;c++)d(this[c]).bind("keyup",function(){var b=this.value;switch(a.format){case "text":var c,b=b.replace(RegExp("[0-9]+","g"),"");break;case "alpha":b=b.replace(RegExp("[^a-zA-Z]+","g"),"");break;case "number":case "numeric":b=b.replace(RegExp("[^0-9]+","g"),"");break;case "alphanumeric":b=b.replace(RegExp("[^0-9a-zA-Z]+","g"),"");break;case "custom":c=RegExp(a.pattern,
"g");b=b.replace(c,"");break;default:typeof a.format=="function"&&(b=a.format(b))}a.nospace&&(b=b.replace(RegExp("[ ]+","g"),""));a.uppercase&&(b=b.toUpperCase());a.lowercase&&(b=b.toLowerCase());if(b!=this.value)this.value=b})};d.fn.autotab=function(c){var a={format:"all",maxlength:2147483647,uppercase:!1,lowercase:!1,nospace:!1,target:null,previous:null,pattern:null};d.extend(a,c);if(typeof a.target=="string")a.target=e(a.target);if(typeof a.previous=="string")a.previous=e(a.previous);c=d(this).attr("maxlength");
a.maxlength==2147483647&&c!=2147483647?a.maxlength=c:a.maxlength>0?d(this).attr("maxlength",a.maxlength):a.target=null;a.format!="all"&&d(this).autotab_filter(a);return d(this).bind("keydown",function(b){b.which==8&&this.value.length==0&&a.previous&&a.previous.focus().val(a.previous.val())}).bind("keyup",function(b){var c=[8,9,16,17,18,19,20,27,33,34,35,36,37,38,39,40,45,46,144,145];if(b.which!=8){var e=d(this).val();d.inArray(b.which,c)==-1&&e.length==a.maxlength&&a.target&&a.target.focus()}})}})(jQuery);

