/**
 * Copyright (c) 2010 Wilker Lúcio
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

var __hasProp=Object.prototype.hasOwnProperty;(function($){Array.wrap=function(data){return $.isArray(data)?data:[data];};Array.prototype.extract_options=function(){return $.isPlainObject(this[this.length-1])?this.pop():{};};Array.prototype.isEqual=function(other){var _a,_b,key,value;if(!($.isArray(other))){return false;}
if(this.length!==other.length){return false;}
_a=this;for(key=0,_b=_a.length;key<_b;key++){value=_a[key];if(value!==other[key]){return false;}}
return true;};String.prototype.simple_template_replace=function(options){var _a,key,replacement,text;text=this+"";_a=options;for(key in _a){if(!__hasProp.call(_a,key))continue;replacement=_a[key];text=text.replace(("%{"+(key)+"}"),replacement);}
return text;};String.prototype.uc_first=function(){return this.charAt(0).toUpperCase()+this.substr(1);};String.prototype.camelize=function(){var _a,_b,_c,_d,parts,str;parts=(function(){_a=[];_c=this.split("_");for(_b=0,_d=_c.length;_b<_d;_b++){str=_c[_b];_a.push(str.uc_first());}
return _a;}).call(this);return parts.join('');};$.isString=function(value){return(typeof value)==="string";};window.is_blank=function(object){if(!((typeof object!=="undefined"&&object!==null))){return true;}
if($.isString(object)&&object.replace(/^\s+|\s+$/,'').length===0){return true;}
return false;};window.delete_object_property=function(object,property){var value;value=object[property]||null;delete object[property];return value;};window.object_without_properties=function(object,properties){var _a,_b,_c,obj,property;obj=$.extend({},object);_b=properties;for(_a=0,_c=_b.length;_a<_c;_a++){property=_b[_a];delete obj[property];}
return obj;};window.extract_keys=function(object){var _a,_b,_c,key;_b=[];_c=object;for(key in _c){if(!__hasProp.call(_c,key))continue;_a=_c[key];_b.push(key);}
return _b;};window.slice_object=function(object,keys){var _a,_b,_c,_d,key,obj;obj={};_b=keys;for(_a=0,_c=_b.length;_a<_c;_a++){key=_b[_a];if((typeof(_d=object[key])!=="undefined"&&_d!==null)){obj[key]=object[key];}}
return obj;};return(window.slice_object_and_remove=function(object,keys){var _a,k,obj,v;obj={};_a=object;for(k in _a){if(!__hasProp.call(_a,k))continue;v=_a[k];if($.inArray(k,keys)===-1){obj[k]=object[k];delete object[k];}}
return obj;});})(jQuery);var __bind=function(func,context){return function(){return func.apply(context,arguments);};};(function($){$.FormCheck=function(form,options){this.form=form;this.options=$.extend({prevent_submit:true,field_prefix:null,notifiers:$.FormCheck.default_notifiers,live_notifiers:$.FormCheck.default_live_notifiers,language:$.FormCheck.default_locale},options||{});this.field_cache={};this.errors=new $.FormCheck.Errors(this);this.validations=[];this.hook_events();this.setup_notifiers();return this;};$.FormCheck.prototype.hook_events=function(){var self;this.form.submit(__bind(function(e){var _a,_b,_c,_d,notifier;if(!(this.is_valid())){if(this.options.prevent_submit){e.preventDefault();}
_a=[];_c=this.notifiers;for(_b=0,_d=_c.length;_b<_d;_b++){notifier=_c[_b];_a.push(notifier.notify());}
return _a;}},this));self=this;return this.form.find(":input").each(function(){var field,name;name=self.parse_field_name($(this));if(name){field=self.field(name);return self.options.live_notifiers?(function(el){var f,n;n=name;f=field;el.focus(function(e){self.is_valid();return self.dispatch_live_notifiers("focus",n,e,f.live_notifiers);});return el.blur(function(e){self.is_valid();return self.dispatch_live_notifiers("blur",n,e,f.live_notifiers);});})($(this)):null;}});};$.FormCheck.prototype.dispatch_live_notifiers=function(callback,attribute,event,notifiers){var _a,_b,_c,_d,_e,_f,_g,current_notifiers,n,notifier;current_notifiers=[];_b=notifiers;for(_a=0,_c=_b.length;_a<_c;_a++){n=_b[_a];if(n===":parent"){current_notifiers=current_notifiers.concat(this.live_notifiers);}else{current_notifiers.push(this.get_notifier(n));};}
_d=[];_f=current_notifiers;for(_e=0,_g=_f.length;_e<_g;_e++){notifier=_f[_e];_d.push(notifier[callback](attribute,event));}
return _d;};$.FormCheck.prototype.setup_notifiers=function(){var _a,_b,_c,_d,_e,_f,_g,_h,kind,type;_a=[];_c=["notifiers","live_notifiers"];for(_b=0,_d=_c.length;_b<_d;_b++){type=_c[_b];_a.push((function(){this[type]=[];if(this.options[type]){return(this[type]=(function(){_e=[];_g=this.options[type];for(_f=0,_h=_g.length;_f<_h;_f++){kind=_g[_f];_e.push(this.get_notifier(kind));}
return _e;}).call(this));}}).call(this));}
return _a;};$.FormCheck.prototype.get_notifier=function(notifier){var creator,notifier_class,parameters;parameters=[this];if($.isArray(notifier)){parameters=parameters.concat(notifier.slice(1));notifier=notifier[0];}
if($.isString(notifier)){notifier_class=$.FormCheck.find_notifier(notifier);creator=function(){return notifier_class.apply(this,parameters);};creator.prototype=notifier_class.prototype;return new creator();}else{notifier.form=this;return notifier;}};$.FormCheck.prototype.validate=function(validator){return this.validations.push(validator);};$.FormCheck.prototype.field=function(name){this.field_cache[name]=(typeof this.field_cache[name]!=="undefined"&&this.field_cache[name]!==null)?this.field_cache[name]:new $.FormCheck.Field(this,this.field_name(name),name);return this.field_cache[name];};$.FormCheck.prototype.is_valid=function(){var _a,_b,_c,validation;this.errors.clear();_b=this.validations;for(_a=0,_c=_b.length;_a<_c;_a++){validation=_b[_a];validation(this);}
return this.errors.size()===0;};$.FormCheck.prototype.parse_field_name=function(input){var name;name=input.attr("name");if(!(name)){return null;}
return this.reverse_field_name(name);};$.FormCheck.prototype.reverse_field_name=function(name){var matches;if(this.options.field_prefix){if((matches=name.match(new RegExp((""+(this.options.field_prefix)+"\\[(.+?)\\](.*)"))))){name=matches[1]+(matches[2]||"");}else{name=":"+name;};};return name;};$.FormCheck.prototype.field_name=function(name){var matches,subparts;if((matches=name.match(/^:(.+)/))){return matches[1];}
if(this.options.field_prefix){subparts="";if((matches=name.match(/(.+?)(\[.+)$/))){name=matches[1];subparts=matches[2];}
return""+(this.options.field_prefix)+"["+(name)+"]"+(subparts);}else{return name;}};$.FormCheck.default_locale="en";$.FormCheck.default_notifiers=["notification_dialog"];$.FormCheck.default_live_notifiers=["tip_balloons"];$.FormCheck.Field=function(form,name,attribute){var _a,_b,_c;this.form_checker=form;this.field_name=name;this.attribute=attribute;this.live_notifiers=[":parent"];this.element=this.form_checker.form.find((":input[name='"+(name)+"']"));this.custom_label=null;if(this.form_checker.options.live_notifiers){_b=this.events_for_element();for(_a=0,_c=_b.length;_a<_c;_a++){(function(){var evt=_b[_a];return this.element[evt](__bind(function(e){this.form_checker.is_valid();return this.form_checker.dispatch_live_notifiers("notify",this.attribute,e,this.live_notifiers);},this));}).call(this);}}
return this;};$.FormCheck.Field.prototype.events_for_element=function(){if(this.element.length===0){return[];}
if(this.element.attr("type")==="radio"||this.element.attr("type")==="checkbox"){return["change"];}
if(this.element[0].tagName.toLowerCase()==="select"){return["keyup","change"];}
return["keyup"];};$.FormCheck.Field.prototype.value=function(){if(this.element.attr("type")==="radio"){return this.value_for_radio();}
if(this.element.attr("type")==="checkbox"){return this.value_for_checkbox();}
return this.value_for_text();};$.FormCheck.Field.prototype.value_for_text=function(){return this.element.val()||"";};$.FormCheck.Field.prototype.value_for_radio=function(){return this.element.filter(":checked").val()||"";};$.FormCheck.Field.prototype.value_for_checkbox=function(){return this.element.length>1?$.makeArray(this.element.filter(":checked").map(function(){return $(this).val();})):this.element[0].checked?this.element.val():"";};$.FormCheck.Field.prototype.label=function(){var field_id,label_element,matches;if(!(this.custom_label===null)){if($.isFunction(this.custom_label)){return this.custom_label.call(this);}else{return this.custom_label;}}
field_id=this.element.attr("id");if(this.element.length>1){if((matches=field_id.match(/(.+)_.+$/))){field_id=matches[1];}}
label_element=this.form_checker.form.find(("label[for='"+(field_id)+"']"));return label_element.length>0?label_element.text():this.field_name;};return($.fn.jcheck=function(options){return new $.FormCheck($(this),options||{});});})(jQuery);var __hasProp=Object.prototype.hasOwnProperty,__bind=function(func,context){return function(){return func.apply(context,arguments);};};(function($){$.FormCheck.Errors=function(form){this.form_checker=form;this.clear();return this;};$.FormCheck.Errors.prototype.clear=function(){return(this.errors={});};$.FormCheck.Errors.prototype.add=function(field,message,options){var _a;options=(typeof options!=="undefined"&&options!==null)?options:{};message=(typeof message!=="undefined"&&message!==null)?message:":invalid";this.errors[field]=(typeof this.errors[field]!=="undefined"&&this.errors[field]!==null)?this.errors[field]:[];if((typeof(_a=options.message)!=="undefined"&&_a!==null)){message=options.message;}
message=this.generate_message(message,options);message=message.simple_template_replace(options);return this.errors[field].push(message);};$.FormCheck.Errors.prototype.attributes_with_errors=function(){var _a,attribute,attributes,errors;attributes=[];_a=this.errors;for(attribute in _a){if(!__hasProp.call(_a,attribute))continue;errors=_a[attribute];if(errors.length>0){attributes.push(attribute);}}
return attributes;};$.FormCheck.Errors.prototype.on=function(attribute){this.errors[attribute]=(typeof this.errors[attribute]!=="undefined"&&this.errors[attribute]!==null)?this.errors[attribute]:[];return this.errors[attribute];};$.FormCheck.Errors.prototype.each=function(fn){var _a,_b,_c,_d,_e,_f,attribute,error,errors;_a=[];_b=this.errors;for(attribute in _b){if(!__hasProp.call(_b,attribute))continue;errors=_b[attribute];_a.push((function(){_c=[];_e=errors;for(_d=0,_f=_e.length;_d<_f;_d++){error=_e[_d];_c.push(fn(attribute,error));}
return _c;})());}
return _a;};$.FormCheck.Errors.prototype.size=function(){var _a,attribute,messages,sum;sum=0;_a=this.errors;for(attribute in _a){if(!__hasProp.call(_a,attribute))continue;messages=_a[attribute];sum+=messages.length;}
return sum;};$.FormCheck.Errors.prototype.full_messages=function(){var messages;messages=[];this.each(__bind(function(attribute,message){attribute=this.form_checker.field(attribute).label();return messages.push((""+(attribute)+" "+(message)));},this));return messages;};$.FormCheck.Errors.prototype.generate_message=function(message){var match;return(match=message.match(/^:(.+)/))?$.FormCheck.i18n.translate(("errors.messages."+(match[1])),this.form_checker.options.language):message;};return $.FormCheck.Errors;})(jQuery);var __extends=function(child,parent){var ctor=function(){};ctor.prototype=parent.prototype;child.prototype=new ctor();child.prototype.constructor=child;if(typeof parent.extended==="function")parent.extended(child);child.__superClass__=parent.prototype;},__hasProp=Object.prototype.hasOwnProperty,__bind=function(func,context){return function(){return func.apply(context,arguments);};};(function($){$.FormCheck.Notifiers={};$.FormCheck.Notifiers.create=function(name,object,base){var class_name,notifier;object=$.extend({constructor:function(){},focus:function(){return this.notify.apply(this,arguments);},blur:function(){},notify:function(){}},object||{});base=(typeof base!=="undefined"&&base!==null)?base:$.FormCheck.Notifiers.Base;class_name=name.camelize()+"Notifier";notifier=function(){notifier.__superClass__.constructor.apply(this,arguments);this.constructor.apply(this,arguments);return this;};__extends(notifier,base);$.extend(notifier.prototype,object);notifier.kind=name;$.FormCheck.Notifiers[class_name]=notifier;return notifier;};$.FormCheck.find_notifier=function(kind){var _a,_b,name,notifier;_a=[];_b=$.FormCheck.Notifiers;for(name in _b){if(!__hasProp.call(_b,name))continue;notifier=_b[name];if(notifier.kind===kind){return notifier;}}
return _a;};$.FormCheck.Notifiers.Base=function(form){this.form=form;return this;};$.FormCheck.Notifiers.Base.prototype.focus=function(attribute){};$.FormCheck.Notifiers.Base.prototype.notify=function(attribute){};$.FormCheck.Notifiers.Base.prototype.blur=function(attribute){};$.FormCheck.Notifiers.DialogBase=function(){return $.FormCheck.Notifiers.Base.apply(this,arguments);};__extends($.FormCheck.Notifiers.DialogBase,$.FormCheck.Notifiers.Base);$.FormCheck.Notifiers.DialogBase.prototype.populate_dialog=function(dialog,messages){var _a,_b,_c,html,m;html="<ul>";_b=messages;for(_a=0,_c=_b.length;_a<_c;_a++){m=_b[_a];html+=("<li>* "+(m)+"</li>");}
html+="</ul>";return dialog.html(html);};$.FormCheck.Notifiers.NotificationDialog=function(form,options){$.FormCheck.Notifiers.NotificationDialog.__superClass__.constructor.call(this,form);this.options=$.extend({autoclose_in:4000},options||{});return this;};__extends($.FormCheck.Notifiers.NotificationDialog,$.FormCheck.Notifiers.DialogBase);$.FormCheck.Notifiers.NotificationDialog.prototype.notify=function(){var dialog;dialog=this.generate_dialog();dialog.css({left:"-1000px"});this.populate_dialog(dialog,this.form.errors.full_messages());dialog.css({"margin-top":("-"+(dialog.outerHeight()+10)+"px"),left:"50%","margin-left":("-"+(Math.round(dialog.outerWidth()/2))+"px")});dialog.show();dialog.animate({"margin-top":"0px"});return dialog.mouseout();};$.FormCheck.Notifiers.NotificationDialog.prototype.close_dialog=function(){return this.current_dialog.animate({"margin-top":("-"+(this.current_dialog.outerHeight()+10)+"px")},{complete:function(){return $(this).hide();}});};$.FormCheck.Notifiers.NotificationDialog.prototype.generate_dialog=function(){var dialog,dialog_id;if($.FormCheck.Notifiers.NotificationDialog.dialog_timer){clearTimeout($.FormCheck.Notifiers.NotificationDialog.dialog_timer);}
dialog_id="jcheck-error-dialog";$(("#"+(dialog_id))).remove();dialog=$(document.createElement("div"));dialog.attr("id",dialog_id);this.current_dialog=dialog;if($.browser.msie&&parseInt($.browser.version)<7){dialog.addClass("ie-fixed");}
dialog.click(__bind(function(){return this.close_dialog();},this));if(this.options.autoclose_in){dialog.mouseover(__bind(function(){if($.FormCheck.Notifiers.NotificationDialog.dialog_timer){return clearTimeout($.FormCheck.Notifiers.NotificationDialog.dialog_timer);}},this));dialog.mouseout(__bind(function(){var callback,self;self=this;callback=function(){return self.close_dialog();};return($.FormCheck.Notifiers.NotificationDialog.dialog_timer=setTimeout(callback,this.options.autoclose_in));},this));}
$(document.body).append(dialog);return dialog;};$.FormCheck.Notifiers.NotificationDialog.dialog_timer=0;$.FormCheck.Notifiers.NotificationDialog.kind="notification_dialog";$.FormCheck.Notifiers.TipBalloons=function(form){$.FormCheck.Notifiers.TipBalloons.__superClass__.constructor.call(this,form);this.balloons={};return this;};__extends($.FormCheck.Notifiers.TipBalloons,$.FormCheck.Notifiers.DialogBase);$.FormCheck.Notifiers.TipBalloons.prototype.focus=function(attribute,evt){return this.notify(attribute,evt||null);};$.FormCheck.Notifiers.TipBalloons.prototype.notify=function(attribute,evt){var dialog,element,messages,offset;dialog=this.dialog_for_attribute(attribute);messages=this.form.errors.on(attribute);if(messages.isEqual(dialog.messages)){return null;}
element=evt&&evt.target?$(evt.target):this.form.element;offset=element.offset();if(messages.length>0){if(dialog.messages&&dialog.messages.length>0){this.populate_dialog(dialog,messages);dialog.css({top:(""+(offset.top-dialog.outerHeight())+"px"),left:(""+(offset.left+Math.round(element.outerWidth()*0.9))+"px")});}else{dialog.css({left:"-1000px",top:"-1000px"});dialog.hide();this.populate_dialog(dialog,messages);dialog.css({top:(""+(offset.top-dialog.outerHeight())+"px"),left:(""+(offset.left+Math.round(element.outerWidth()*0.9))+"px")});dialog.fadeIn("fast");}}else{this.close_dialog(attribute);}
return(dialog.messages=messages);};$.FormCheck.Notifiers.TipBalloons.prototype.blur=function(attribute){return this.close_dialog(attribute);};$.FormCheck.Notifiers.TipBalloons.prototype.dialog_for_attribute=function(attribute){if(!(this.balloons[attribute])){this.balloons[attribute]=this.generate_dialog();}
return this.balloons[attribute];};$.FormCheck.Notifiers.TipBalloons.prototype.close_dialog=function(attribute){var dialog;dialog=this.dialog_for_attribute(attribute);dialog.messages=null;return dialog.fadeOut("fast");};$.FormCheck.Notifiers.TipBalloons.prototype.generate_dialog=function(){var arrow,content_area,dialog;dialog=null;dialog=$(document.createElement("div"));dialog.addClass("jcheck-inline-balloon-tip");dialog.css({position:"absolute",top:"-1000px",left:"-1000px"});content_area=$(document.createElement("div"));content_area.addClass("content");dialog.append(content_area);arrow=this.generate_arrow();dialog.append(arrow);$(document.body).append(dialog);return dialog;};$.FormCheck.Notifiers.TipBalloons.prototype.generate_arrow=function(){var center,container,i,line,max_width,x;i=10;container=$(document.createElement("div"));container.addClass("arrow-container");center=i/2;max_width=null;while(i>0){x=i*2-center;if(x<0){x=center+x-1;}
line=$(document.createElement("div"));line.addClass(("line"+(i)));line.css({'font-size':0,width:(""+(x)+"px"),height:"1px",margin:"0 auto"});container.append(line);i-=1;}
return container;};$.FormCheck.Notifiers.TipBalloons.prototype.populate_dialog=function(dialog,messages){return $.FormCheck.Notifiers.TipBalloons.__superClass__.populate_dialog.call(this,dialog.find(".content"),messages);};return($.FormCheck.Notifiers.TipBalloons.kind="tip_balloons");})(jQuery);var __hasProp=Object.prototype.hasOwnProperty,__extends=function(child,parent){var ctor=function(){};ctor.prototype=parent.prototype;child.prototype=new ctor();child.prototype.constructor=child;if(typeof parent.extended==="function")parent.extended(child);child.__superClass__=parent.prototype;},__slice=Array.prototype.slice;(function($){$.FormCheck.Validations={};$.FormCheck.find_validator=function(kind){var _a,k,validator;_a=$.FormCheck.Validations;for(k in _a){if(!__hasProp.call(_a,k))continue;validator=_a[k];if(validator.kind===kind){return validator;}}
return null;};$.FormCheck.Validator=function(options){this.options=options;return this;};$.FormCheck.Validator.prototype.kind=function(){};$.FormCheck.Validator.prototype.validate=function(form){};$.FormCheck.EachValidator=function(options){this.attributes=Array.wrap(delete_object_property(options,"attributes"));if(options["allow_nil"]){options["allow_blank"]=true;}
if(options["allow_blank"]){options["allow_nil"]=true;}
$.FormCheck.EachValidator.__superClass__.constructor.call(this,options);this.check_valitity();return this;};__extends($.FormCheck.EachValidator,$.FormCheck.Validator);$.FormCheck.EachValidator.prototype.validate=function(form){var _a,_b,_c,_d,attribute,value;_a=[];_c=this.attributes;for(_b=0,_d=_c.length;_b<_d;_b++){attribute=_c[_b];value=form.field(attribute).value();if(is_blank(value)&&this.options["allow_blank"]){continue;}
this.validate_each(form,attribute,value);}
return _a;};$.FormCheck.EachValidator.prototype.validate_each=function(record,attribute,value){};$.FormCheck.EachValidator.prototype.check_valitity=function(){};$.FormCheck.prototype.validates_with=function(){var _c,_d,_e,_f,validators;var _a=arguments.length,_b=_a>=2,options=arguments[_b?_a-1:0];validators=__slice.call(arguments,0,_a-1);_c=[];_e=validators;for(_d=0,_f=_e.length;_d<_f;_d++){(function(){var validator;var validator_klass=_e[_d];return _c.push((function(){validator=new validator_klass(options);return this.validate(function(form){return validator.validate(form);});}).call(this));}).call(this);}
return _c;};$.FormCheck.prototype.attributes_for_with=function(attributes){var options;options=attributes.extract_options();return $.extend(options,{attributes:attributes});};$.FormCheck.Validator.create=function(name,object,base){var class_name,validator;object=$.extend({constructor:function(){}},object||{});base=(typeof base!=="undefined"&&base!==null)?base:$.FormCheck.EachValidator;class_name=name.camelize()+"Validator";validator=function(){validator.__superClass__.constructor.apply(this,arguments);this.constructor.apply(this,arguments);return this;};__extends(validator,base);$.extend(validator.prototype,object);validator.kind=name;$.FormCheck.Validations[class_name]=validator;$.FormCheck.prototype[("validates_"+(name)+"_of")]=function(){var attributes;attributes=__slice.call(arguments,0);return this.validates_with(validator,this.attributes_for_with(attributes));};return validator;};$.FormCheck.Validations.BlockValidator=function(options){this.callback=delete_object_property(options,'callback')||$.noop;$.FormCheck.Validations.BlockValidator.__superClass__.constructor.call(this,options);return this;};__extends($.FormCheck.Validations.BlockValidator,$.FormCheck.EachValidator);$.FormCheck.Validations.BlockValidator.prototype.validate_each=function(form,attribute,value){return this.callback.call(this,form,attribute,value);};$.FormCheck.prototype.validates_each=function(){var attributes,options;attributes=__slice.call(arguments,0);options=this.attributes_for_with(attributes);if($.isFunction(options.attributes[options.attributes.length-1])){options.callback=attributes.pop();};return this.validates_with($.FormCheck.Validations.BlockValidator,options);};$.FormCheck.Validations.AcceptanceValidator=function(options){$.FormCheck.Validations.AcceptanceValidator.__superClass__.constructor.call(this,$.extend({accept:'1'},options));return this;};__extends($.FormCheck.Validations.AcceptanceValidator,$.FormCheck.EachValidator);$.FormCheck.Validations.AcceptanceValidator.prototype.validate_each=function(form,attribute,value){if(!(value===this.options.accept)){return form.errors.add(attribute,":accepted",object_without_properties(this.options,['accept','allow_nil']));}};$.FormCheck.Validations.AcceptanceValidator.kind="acceptance";$.FormCheck.prototype.validates_acceptance_of=function(){var attributes;attributes=__slice.call(arguments,0);return this.validates_with($.FormCheck.Validations.AcceptanceValidator,this.attributes_for_with(attributes));};$.FormCheck.Validations.ConfirmationValidator=function(){return $.FormCheck.EachValidator.apply(this,arguments);};__extends($.FormCheck.Validations.ConfirmationValidator,$.FormCheck.EachValidator);$.FormCheck.Validations.ConfirmationValidator.prototype.validate_each=function(form,attribute,value){var confirmed,confirmed_field_name;confirmed_field_name=attribute+"_confirmation";confirmed=form.field(confirmed_field_name).value();if(!(value===confirmed)){return form.errors.add(confirmed_field_name,":confirmation",this.options);}};$.FormCheck.Validations.ConfirmationValidator.kind="confirmation";$.FormCheck.prototype.validates_confirmation_of=function(){var attributes;attributes=__slice.call(arguments,0);return this.validates_with($.FormCheck.Validations.ConfirmationValidator,this.attributes_for_with(attributes));};$.FormCheck.Validations.ExclusionValidator=function(){return $.FormCheck.EachValidator.apply(this,arguments);};__extends($.FormCheck.Validations.ExclusionValidator,$.FormCheck.EachValidator);$.FormCheck.Validations.ExclusionValidator.prototype.validate_each=function(form,attribute,value){if($.inArray(value,this.options["in"])>-1){return form.errors.add(attribute,":exclusion",$.extend(object_without_properties(this.options,['in']),{value:value}));}};$.FormCheck.Validations.ExclusionValidator.kind="exclusion";$.FormCheck.prototype.validates_exclusion_of=function(){var attributes;attributes=__slice.call(arguments,0);return this.validates_with($.FormCheck.Validations.ExclusionValidator,this.attributes_for_with(attributes));};$.FormCheck.Validations.FormatValidator=function(options){var _a,_b,_c,_d,opt;_b=["with","without"];for(_a=0,_c=_b.length;_a<_c;_a++){opt=_b[_a];if((typeof(_d=options[opt])!=="undefined"&&_d!==null)&&$.isString(options[opt])){options[opt]=$.FormCheck.Validations.FormatValidator.FORMATS[options[opt]];}}
$.FormCheck.Validations.FormatValidator.__superClass__.constructor.call(this,options);return this;};__extends($.FormCheck.Validations.FormatValidator,$.FormCheck.EachValidator);$.FormCheck.Validations.FormatValidator.prototype.validate_each=function(form,attribute,value){if(this.options["with"]&&!((value+"").match(this.options["with"]))){form.errors.add(attribute,":invalid",$.extend(object_without_properties(this.options,['with']),{value:value}));};return this.options["without"]&&(value+"").match(this.options["without"])?form.errors.add(attribute,":invalid",$.extend(object_without_properties(this.options,['without']),{value:value})):null;};$.FormCheck.Validations.FormatValidator.FORMATS={email:/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i,url:/^[A-Za-z]+:\/\/[A-Za-z0-9-_]+(\.[a-zA-Z0-9]+)+(:\d+)?[A-Za-z0-9-_%&\?\/.=]+$/};$.FormCheck.Validations.FormatValidator.kind="format";$.FormCheck.prototype.validates_format_of=function(){var attributes;attributes=__slice.call(arguments,0);return this.validates_with($.FormCheck.Validations.FormatValidator,this.attributes_for_with(attributes));};$.FormCheck.Validations.InclusionValidator=function(){return $.FormCheck.EachValidator.apply(this,arguments);};__extends($.FormCheck.Validations.InclusionValidator,$.FormCheck.EachValidator);$.FormCheck.Validations.InclusionValidator.prototype.validate_each=function(form,attribute,value){if($.inArray(value,this.options["in"])===-1){return form.errors.add(attribute,":inclusion",$.extend(object_without_properties(this.options,['in']),{value:value}));}};$.FormCheck.Validations.InclusionValidator.kind="inclusion";$.FormCheck.prototype.validates_inclusion_of=function(){var attributes;attributes=__slice.call(arguments,0);return this.validates_with($.FormCheck.Validations.InclusionValidator,this.attributes_for_with(attributes));};$.FormCheck.Validations.LengthValidator=function(options){$.FormCheck.Validations.LengthValidator.__superClass__.constructor.call(this,$.extend({tokenizer:$.FormCheck.Validations.LengthValidator.DEFAULT_TOKENIZER},options));return this;};__extends($.FormCheck.Validations.LengthValidator,$.FormCheck.EachValidator);$.FormCheck.Validations.LengthValidator.prototype.validate_each=function(form,attribute,value){var _a,_b,_c;if($.isString(value)){value=this.options.tokenizer(value);}
if(this.options["is"]&&this.options["is"]!==value.length){if((typeof(_a=this.options["wrong_length"])!=="undefined"&&_a!==null)){this.options["message"]=(typeof this.options["message"]!=="undefined"&&this.options["message"]!==null)?this.options["message"]:this.options["wrong_length"];}
form.errors.add(attribute,":wrong_length",$.extend(object_without_properties(this.options,$.FormCheck.Validations.LengthValidator.RESERVED_OPTIONS),{count:this.options["is"]}));}
if(this.options["minimum"]&&this.options["minimum"]>value.length){if((typeof(_b=this.options["too_short"])!=="undefined"&&_b!==null)){this.options["message"]=(typeof this.options["message"]!=="undefined"&&this.options["message"]!==null)?this.options["message"]:this.options["too_short"];}
form.errors.add(attribute,":too_short",$.extend(object_without_properties(this.options,$.FormCheck.Validations.LengthValidator.RESERVED_OPTIONS),{count:this.options["minimum"]}));}
if(this.options["maximum"]&&this.options["maximum"]<value.length){if((typeof(_c=this.options["too_long"])!=="undefined"&&_c!==null)){this.options["message"]=(typeof this.options["message"]!=="undefined"&&this.options["message"]!==null)?this.options["message"]:this.options["too_long"];}
return form.errors.add(attribute,":too_long",$.extend(object_without_properties(this.options,$.FormCheck.Validations.LengthValidator.RESERVED_OPTIONS),{count:this.options["maximum"]}));}};$.FormCheck.Validations.LengthValidator.DEFAULT_TOKENIZER=function(value){return value.split('');};$.FormCheck.Validations.LengthValidator.RESERVED_OPTIONS=["minimum","maximum","is","tokenizer","too_long","too_short"];$.FormCheck.Validations.LengthValidator.kind="length";$.FormCheck.prototype.validates_length_of=function(){var attributes;attributes=__slice.call(arguments,0);return this.validates_with($.FormCheck.Validations.LengthValidator,this.attributes_for_with(attributes));};$.FormCheck.Validations.NumericalityValidator=function(){return $.FormCheck.EachValidator.apply(this,arguments);};__extends($.FormCheck.Validations.NumericalityValidator,$.FormCheck.EachValidator);$.FormCheck.Validations.NumericalityValidator.prototype.validate_each=function(form,attribute,value){var _a,_b,check,raw_value,val;raw_value=value;value=parseFloat(value);if(isNaN(value)||!(raw_value.match(/\d+$/))){form.errors.add(attribute,":not_a_number",this.filtered_options(raw_value));return null;}
if(this.options.only_integer&&!(raw_value.match(/^[-]?\d+$/))){form.errors.add(attribute,":not_an_integer",this.filtered_options(raw_value));return null;}else{value=parseInt(value);}
_a=[];_b=slice_object(this.options,extract_keys($.FormCheck.Validations.NumericalityValidator.CHECKS));for(check in _b){if(!__hasProp.call(_b,check))continue;val=_b[check];_a.push((function(){if(check==="odd"||check==="even"){if(!($.FormCheck.Validations.NumericalityValidator.CHECKS[check](value))){return form.errors.add(attribute,":"+check,this.filtered_options(val));}}else{if(!($.FormCheck.Validations.NumericalityValidator.CHECKS[check](value,val))){return form.errors.add(attribute,":"+check,this.filtered_options(val));}}}).call(this));}
return _a;};$.FormCheck.Validations.NumericalityValidator.prototype.filtered_options=function(value){return $.extend(object_without_properties(this.options,$.FormCheck.Validations.NumericalityValidator.RESERVED_OPTIONS),{count:value});};$.FormCheck.Validations.NumericalityValidator.CHECKS={greater_than:function(a,b){return a>b;},greater_than_or_equal_to:function(a,b){return a>=b;},equal_to:function(a,b){return a===b;},less_than:function(a,b){return a<b;},less_than_or_equal_to:function(a,b){return a<=b;},odd:function(n){return(n%2)===1;},even:function(n){return(n%2)===0;}};$.FormCheck.Validations.NumericalityValidator.RESERVED_OPTIONS=extract_keys($.FormCheck.Validations.NumericalityValidator.CHECKS).concat(["only_integer"]);$.FormCheck.Validations.NumericalityValidator.kind="numericality";$.FormCheck.prototype.validates_numericality_of=function(){var attributes;attributes=__slice.call(arguments,0);return this.validates_with($.FormCheck.Validations.NumericalityValidator,this.attributes_for_with(attributes));};$.FormCheck.Validations.PresenceValidator=function(){return $.FormCheck.EachValidator.apply(this,arguments);};__extends($.FormCheck.Validations.PresenceValidator,$.FormCheck.EachValidator);$.FormCheck.Validations.PresenceValidator.prototype.validate_each=function(form,attribute,value){if(is_blank(value)){return form.errors.add(attribute,":blank",this.options);}};$.FormCheck.Validations.PresenceValidator.kind='presence';$.FormCheck.prototype.validates_presence_of=function(){var attributes;attributes=__slice.call(arguments,0);return this.validates_with($.FormCheck.Validations.PresenceValidator,this.attributes_for_with(attributes));};$.FormCheck.prototype.validates=function(){var _a,_b,attributes,current_options,defaults,kind,options,validations,validator;attributes=__slice.call(arguments,0);defaults=attributes.extract_options();validations=slice_object_and_remove(defaults,["if","unless","allow_blank","allow_nil"]);$.extend(defaults,{attributes:attributes});_a=[];_b=validations;for(kind in _b){if(!__hasProp.call(_b,kind))continue;options=_b[kind];_a.push((function(){validator=$.FormCheck.find_validator(kind);current_options=$.extend({},defaults);return validator?this.validates_with(validator,$.extend(current_options,$.FormCheck.parse_validates_options(options))):null;}).call(this));}
return _a;};return($.FormCheck.parse_validates_options=function(options){var _a;if($.isArray(options)){return{"in":options};}
if((typeof(_a=options.test)!=="undefined"&&_a!==null)){return{"with":options};}
if(options===true){return{};}
if($.isPlainObject){return options;}
return{};});})(jQuery);(function($){return($.FormCheck.i18n={default_language:"en",translate:function(path,language){var steps;language=(typeof language!=="undefined"&&language!==null)?language:$.FormCheck.i18n.default_language;steps=path.split(".");steps.unshift(language);return $.FormCheck.i18n.translation_from_path(steps);},translation_from_path:function(steps){var _a,_b,_c,current,step;current=$.FormCheck.i18n.languages;_b=steps;for(_a=0,_c=_b.length;_a<_c;_a++){step=_b[_a];current=current[step];if(!((typeof current!=="undefined"&&current!==null))){return"";}}
return current;},languages:{}});})(jQuery);jQuery.FormCheck.i18n.languages["en"]={errors:{messages:{inclusion:"%{value} is not a valid option",exclusion:"%{value} is reserved",email:"e-mail is not valid",invalid:"is invalid",confirmation:"doesn't match confirmation",accepted:"must be accepted",empty:"can't be empty",blank:"can't be blank",too_long:"is too long (maximum is %{count} characters)",too_short:"is too short (minimum is %{count} characters)",wrong_length:"is the wrong length (should be %{count} characters)",not_a_number:"is not a number",not_an_integer:"must be an integer",greater_than:"must be greater than %{count}",greater_than_or_equal_to:"must be greater than or equal to %{count}",equal_to:"must be equal to %{count}",less_than:"must be less than %{count}",less_than_or_equal_to:"must be less than or equal to %{count}",odd:"must be odd",even:"must be even"}}};
/*
 * jQuery Cycle Plugin (with Transition Definitions)
 * Examples and documentation at: http://jquery.malsup.com/cycle/
 * Copyright (c) 2007-2010 M. Alsup
 * Version: 2.88 (08-JUN-2010)
 * Dual licensed under the MIT and GPL licenses.
 * http://jquery.malsup.com/license.html
 * Requires: jQuery v1.2.6 or later
 */
(function($){var ver="2.88";if($.support==undefined){$.support={opacity:!($.browser.msie)};}function debug(s){if($.fn.cycle.debug){log(s);}}function log(){if(window.console&&window.console.log){window.console.log("[cycle] "+Array.prototype.join.call(arguments," "));}}$.fn.cycle=function(options,arg2){var o={s:this.selector,c:this.context};if(this.length===0&&options!="stop"){if(!$.isReady&&o.s){log("DOM not ready, queuing slideshow");$(function(){$(o.s,o.c).cycle(options,arg2);});return this;}log("terminating; zero elements found by selector"+($.isReady?"":" (DOM not ready)"));return this;}return this.each(function(){var opts=handleArguments(this,options,arg2);if(opts===false){return;}opts.updateActivePagerLink=opts.updateActivePagerLink||$.fn.cycle.updateActivePagerLink;if(this.cycleTimeout){clearTimeout(this.cycleTimeout);}this.cycleTimeout=this.cyclePause=0;var $cont=$(this);var $slides=opts.slideExpr?$(opts.slideExpr,this):$cont.children();var els=$slides.get();if(els.length<2){log("terminating; too few slides: "+els.length);return;}var opts2=buildOptions($cont,$slides,els,opts,o);if(opts2===false){return;}var startTime=opts2.continuous?10:getTimeout(els[opts2.currSlide],els[opts2.nextSlide],opts2,!opts2.rev);if(startTime){startTime+=(opts2.delay||0);if(startTime<10){startTime=10;}debug("first timeout: "+startTime);this.cycleTimeout=setTimeout(function(){go(els,opts2,0,(!opts2.rev&&!opts.backwards));},startTime);}});};function handleArguments(cont,options,arg2){if(cont.cycleStop==undefined){cont.cycleStop=0;}if(options===undefined||options===null){options={};}if(options.constructor==String){switch(options){case"destroy":case"stop":var opts=$(cont).data("cycle.opts");if(!opts){return false;}cont.cycleStop++;if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);}cont.cycleTimeout=0;$(cont).removeData("cycle.opts");if(options=="destroy"){destroy(opts);}return false;case"toggle":cont.cyclePause=(cont.cyclePause===1)?0:1;checkInstantResume(cont.cyclePause,arg2,cont);return false;case"pause":cont.cyclePause=1;return false;case"resume":cont.cyclePause=0;checkInstantResume(false,arg2,cont);return false;case"prev":case"next":var opts=$(cont).data("cycle.opts");if(!opts){log('options not found, "prev/next" ignored');return false;}$.fn.cycle[options](opts);return false;default:options={fx:options};}return options;}else{if(options.constructor==Number){var num=options;options=$(cont).data("cycle.opts");if(!options){log("options not found, can not advance slide");return false;}if(num<0||num>=options.elements.length){log("invalid slide index: "+num);return false;}options.nextSlide=num;if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);cont.cycleTimeout=0;}if(typeof arg2=="string"){options.oneTimeFx=arg2;}go(options.elements,options,1,num>=options.currSlide);return false;}}return options;function checkInstantResume(isPaused,arg2,cont){if(!isPaused&&arg2===true){var options=$(cont).data("cycle.opts");if(!options){log("options not found, can not resume");return false;}if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);cont.cycleTimeout=0;}go(options.elements,options,1,(!opts.rev&&!opts.backwards));}}}function removeFilter(el,opts){if(!$.support.opacity&&opts.cleartype&&el.style.filter){try{el.style.removeAttribute("filter");}catch(smother){}}}function destroy(opts){if(opts.next){$(opts.next).unbind(opts.prevNextEvent);}if(opts.prev){$(opts.prev).unbind(opts.prevNextEvent);}if(opts.pager||opts.pagerAnchorBuilder){$.each(opts.pagerAnchors||[],function(){this.unbind().remove();});}opts.pagerAnchors=null;if(opts.destroy){opts.destroy(opts);}}function buildOptions($cont,$slides,els,options,o){var opts=$.extend({},$.fn.cycle.defaults,options||{},$.metadata?$cont.metadata():$.meta?$cont.data():{});if(opts.autostop){opts.countdown=opts.autostopCount||els.length;}var cont=$cont[0];$cont.data("cycle.opts",opts);opts.$cont=$cont;opts.stopCount=cont.cycleStop;opts.elements=els;opts.before=opts.before?[opts.before]:[];opts.after=opts.after?[opts.after]:[];opts.after.unshift(function(){opts.busy=0;});if(!$.support.opacity&&opts.cleartype){opts.after.push(function(){removeFilter(this,opts);});}if(opts.continuous){opts.after.push(function(){go(els,opts,0,(!opts.rev&&!opts.backwards));});}saveOriginalOpts(opts);if(!$.support.opacity&&opts.cleartype&&!opts.cleartypeNoBg){clearTypeFix($slides);}if($cont.css("position")=="static"){$cont.css("position","relative");}if(opts.width){$cont.width(opts.width);}if(opts.height&&opts.height!="auto"){$cont.height(opts.height);}if(opts.startingSlide){opts.startingSlide=parseInt(opts.startingSlide);}else{if(opts.backwards){opts.startingSlide=els.length-1;}}if(opts.random){opts.randomMap=[];for(var i=0;i<els.length;i++){opts.randomMap.push(i);}opts.randomMap.sort(function(a,b){return Math.random()-0.5;});opts.randomIndex=1;opts.startingSlide=opts.randomMap[1];}else{if(opts.startingSlide>=els.length){opts.startingSlide=0;}}opts.currSlide=opts.startingSlide||0;var first=opts.startingSlide;$slides.css({position:"absolute",top:0,left:0}).hide().each(function(i){var z;if(opts.backwards){z=first?i<=first?els.length+(i-first):first-i:els.length-i;}else{z=first?i>=first?els.length-(i-first):first-i:els.length-i;}$(this).css("z-index",z);});$(els[first]).css("opacity",1).show();removeFilter(els[first],opts);if(opts.fit&&opts.width){$slides.width(opts.width);}if(opts.fit&&opts.height&&opts.height!="auto"){$slides.height(opts.height);}var reshape=opts.containerResize&&!$cont.innerHeight();if(reshape){var maxw=0,maxh=0;for(var j=0;j<els.length;j++){var $e=$(els[j]),e=$e[0],w=$e.outerWidth(),h=$e.outerHeight();if(!w){w=e.offsetWidth||e.width||$e.attr("width");}if(!h){h=e.offsetHeight||e.height||$e.attr("height");}maxw=w>maxw?w:maxw;maxh=h>maxh?h:maxh;}if(maxw>0&&maxh>0){$cont.css({width:maxw+"px",height:maxh+"px"});}}if(opts.pause){$cont.hover(function(){this.cyclePause++;},function(){this.cyclePause--;});}if(supportMultiTransitions(opts)===false){return false;}var requeue=false;options.requeueAttempts=options.requeueAttempts||0;$slides.each(function(){var $el=$(this);this.cycleH=(opts.fit&&opts.height)?opts.height:($el.height()||this.offsetHeight||this.height||$el.attr("height")||0);this.cycleW=(opts.fit&&opts.width)?opts.width:($el.width()||this.offsetWidth||this.width||$el.attr("width")||0);if($el.is("img")){var loadingIE=($.browser.msie&&this.cycleW==28&&this.cycleH==30&&!this.complete);var loadingFF=($.browser.mozilla&&this.cycleW==34&&this.cycleH==19&&!this.complete);var loadingOp=($.browser.opera&&((this.cycleW==42&&this.cycleH==19)||(this.cycleW==37&&this.cycleH==17))&&!this.complete);var loadingOther=(this.cycleH==0&&this.cycleW==0&&!this.complete);if(loadingIE||loadingFF||loadingOp||loadingOther){if(o.s&&opts.requeueOnImageNotLoaded&&++options.requeueAttempts<100){log(options.requeueAttempts," - img slide not loaded, requeuing slideshow: ",this.src,this.cycleW,this.cycleH);setTimeout(function(){$(o.s,o.c).cycle(options);},opts.requeueTimeout);requeue=true;return false;}else{log("could not determine size of image: "+this.src,this.cycleW,this.cycleH);}}}return true;});if(requeue){return false;}opts.cssBefore=opts.cssBefore||{};opts.animIn=opts.animIn||{};opts.animOut=opts.animOut||{};$slides.not(":eq("+first+")").css(opts.cssBefore);if(opts.cssFirst){$($slides[first]).css(opts.cssFirst);}if(opts.timeout){opts.timeout=parseInt(opts.timeout);if(opts.speed.constructor==String){opts.speed=$.fx.speeds[opts.speed]||parseInt(opts.speed);}if(!opts.sync){opts.speed=opts.speed/2;}var buffer=opts.fx=="shuffle"?500:250;while((opts.timeout-opts.speed)<buffer){opts.timeout+=opts.speed;}}if(opts.easing){opts.easeIn=opts.easeOut=opts.easing;}if(!opts.speedIn){opts.speedIn=opts.speed;}if(!opts.speedOut){opts.speedOut=opts.speed;}opts.slideCount=els.length;opts.currSlide=opts.lastSlide=first;if(opts.random){if(++opts.randomIndex==els.length){opts.randomIndex=0;}opts.nextSlide=opts.randomMap[opts.randomIndex];}else{if(opts.backwards){opts.nextSlide=opts.startingSlide==0?(els.length-1):opts.startingSlide-1;}else{opts.nextSlide=opts.startingSlide>=(els.length-1)?0:opts.startingSlide+1;}}if(!opts.multiFx){var init=$.fn.cycle.transitions[opts.fx];if($.isFunction(init)){init($cont,$slides,opts);}else{if(opts.fx!="custom"&&!opts.multiFx){log("unknown transition: "+opts.fx,"; slideshow terminating");return false;}}}var e0=$slides[first];if(opts.before.length){opts.before[0].apply(e0,[e0,e0,opts,true]);}if(opts.after.length>1){opts.after[1].apply(e0,[e0,e0,opts,true]);}if(opts.next){$(opts.next).bind(opts.prevNextEvent,function(){return advance(opts,opts.rev?-1:1);});}if(opts.prev){$(opts.prev).bind(opts.prevNextEvent,function(){return advance(opts,opts.rev?1:-1);});}if(opts.pager||opts.pagerAnchorBuilder){buildPager(els,opts);}exposeAddSlide(opts,els);return opts;}function saveOriginalOpts(opts){opts.original={before:[],after:[]};opts.original.cssBefore=$.extend({},opts.cssBefore);opts.original.cssAfter=$.extend({},opts.cssAfter);opts.original.animIn=$.extend({},opts.animIn);opts.original.animOut=$.extend({},opts.animOut);$.each(opts.before,function(){opts.original.before.push(this);});$.each(opts.after,function(){opts.original.after.push(this);});}function supportMultiTransitions(opts){var i,tx,txs=$.fn.cycle.transitions;if(opts.fx.indexOf(",")>0){opts.multiFx=true;opts.fxs=opts.fx.replace(/\s*/g,"").split(",");for(i=0;i<opts.fxs.length;i++){var fx=opts.fxs[i];tx=txs[fx];if(!tx||!txs.hasOwnProperty(fx)||!$.isFunction(tx)){log("discarding unknown transition: ",fx);opts.fxs.splice(i,1);i--;}}if(!opts.fxs.length){log("No valid transitions named; slideshow terminating.");return false;}}else{if(opts.fx=="all"){opts.multiFx=true;opts.fxs=[];for(p in txs){tx=txs[p];if(txs.hasOwnProperty(p)&&$.isFunction(tx)){opts.fxs.push(p);}}}}if(opts.multiFx&&opts.randomizeEffects){var r1=Math.floor(Math.random()*20)+30;for(i=0;i<r1;i++){var r2=Math.floor(Math.random()*opts.fxs.length);opts.fxs.push(opts.fxs.splice(r2,1)[0]);}debug("randomized fx sequence: ",opts.fxs);}return true;}function exposeAddSlide(opts,els){opts.addSlide=function(newSlide,prepend){var $s=$(newSlide),s=$s[0];if(!opts.autostopCount){opts.countdown++;}els[prepend?"unshift":"push"](s);if(opts.els){opts.els[prepend?"unshift":"push"](s);}opts.slideCount=els.length;$s.css("position","absolute");$s[prepend?"prependTo":"appendTo"](opts.$cont);if(prepend){opts.currSlide++;opts.nextSlide++;}if(!$.support.opacity&&opts.cleartype&&!opts.cleartypeNoBg){clearTypeFix($s);}if(opts.fit&&opts.width){$s.width(opts.width);}if(opts.fit&&opts.height&&opts.height!="auto"){$slides.height(opts.height);}s.cycleH=(opts.fit&&opts.height)?opts.height:$s.height();s.cycleW=(opts.fit&&opts.width)?opts.width:$s.width();$s.css(opts.cssBefore);if(opts.pager||opts.pagerAnchorBuilder){$.fn.cycle.createPagerAnchor(els.length-1,s,$(opts.pager),els,opts);}if($.isFunction(opts.onAddSlide)){opts.onAddSlide($s);}else{$s.hide();}};}$.fn.cycle.resetState=function(opts,fx){fx=fx||opts.fx;opts.before=[];opts.after=[];opts.cssBefore=$.extend({},opts.original.cssBefore);opts.cssAfter=$.extend({},opts.original.cssAfter);opts.animIn=$.extend({},opts.original.animIn);opts.animOut=$.extend({},opts.original.animOut);opts.fxFn=null;$.each(opts.original.before,function(){opts.before.push(this);});$.each(opts.original.after,function(){opts.after.push(this);});var init=$.fn.cycle.transitions[fx];if($.isFunction(init)){init(opts.$cont,$(opts.elements),opts);}};function go(els,opts,manual,fwd){if(manual&&opts.busy&&opts.manualTrump){debug("manualTrump in go(), stopping active transition");$(els).stop(true,true);opts.busy=false;}if(opts.busy){debug("transition active, ignoring new tx request");return;}var p=opts.$cont[0],curr=els[opts.currSlide],next=els[opts.nextSlide];if(p.cycleStop!=opts.stopCount||p.cycleTimeout===0&&!manual){return;}if(!manual&&!p.cyclePause&&!opts.bounce&&((opts.autostop&&(--opts.countdown<=0))||(opts.nowrap&&!opts.random&&opts.nextSlide<opts.currSlide))){if(opts.end){opts.end(opts);}return;}var changed=false;if((manual||!p.cyclePause)&&(opts.nextSlide!=opts.currSlide)){changed=true;var fx=opts.fx;curr.cycleH=curr.cycleH||$(curr).height();curr.cycleW=curr.cycleW||$(curr).width();next.cycleH=next.cycleH||$(next).height();next.cycleW=next.cycleW||$(next).width();if(opts.multiFx){if(opts.lastFx==undefined||++opts.lastFx>=opts.fxs.length){opts.lastFx=0;}fx=opts.fxs[opts.lastFx];opts.currFx=fx;}if(opts.oneTimeFx){fx=opts.oneTimeFx;opts.oneTimeFx=null;}$.fn.cycle.resetState(opts,fx);if(opts.before.length){$.each(opts.before,function(i,o){if(p.cycleStop!=opts.stopCount){return;}o.apply(next,[curr,next,opts,fwd]);});}var after=function(){$.each(opts.after,function(i,o){if(p.cycleStop!=opts.stopCount){return;}o.apply(next,[curr,next,opts,fwd]);});};debug("tx firing; currSlide: "+opts.currSlide+"; nextSlide: "+opts.nextSlide);opts.busy=1;if(opts.fxFn){opts.fxFn(curr,next,opts,after,fwd,manual&&opts.fastOnEvent);}else{if($.isFunction($.fn.cycle[opts.fx])){$.fn.cycle[opts.fx](curr,next,opts,after,fwd,manual&&opts.fastOnEvent);}else{$.fn.cycle.custom(curr,next,opts,after,fwd,manual&&opts.fastOnEvent);}}}if(changed||opts.nextSlide==opts.currSlide){opts.lastSlide=opts.currSlide;if(opts.random){opts.currSlide=opts.nextSlide;if(++opts.randomIndex==els.length){opts.randomIndex=0;}opts.nextSlide=opts.randomMap[opts.randomIndex];if(opts.nextSlide==opts.currSlide){opts.nextSlide=(opts.currSlide==opts.slideCount-1)?0:opts.currSlide+1;}}else{if(opts.backwards){var roll=(opts.nextSlide-1)<0;if(roll&&opts.bounce){opts.backwards=!opts.backwards;opts.nextSlide=1;opts.currSlide=0;}else{opts.nextSlide=roll?(els.length-1):opts.nextSlide-1;opts.currSlide=roll?0:opts.nextSlide+1;}}else{var roll=(opts.nextSlide+1)==els.length;if(roll&&opts.bounce){opts.backwards=!opts.backwards;opts.nextSlide=els.length-2;opts.currSlide=els.length-1;}else{opts.nextSlide=roll?0:opts.nextSlide+1;opts.currSlide=roll?els.length-1:opts.nextSlide-1;}}}}if(changed&&opts.pager){opts.updateActivePagerLink(opts.pager,opts.currSlide,opts.activePagerClass);}var ms=0;if(opts.timeout&&!opts.continuous){ms=getTimeout(els[opts.currSlide],els[opts.nextSlide],opts,fwd);}else{if(opts.continuous&&p.cyclePause){ms=10;}}if(ms>0){p.cycleTimeout=setTimeout(function(){go(els,opts,0,(!opts.rev&&!opts.backwards));},ms);}}$.fn.cycle.updateActivePagerLink=function(pager,currSlide,clsName){$(pager).each(function(){$(this).children().removeClass(clsName).eq(currSlide).addClass(clsName);});};function getTimeout(curr,next,opts,fwd){if(opts.timeoutFn){var t=opts.timeoutFn.call(curr,curr,next,opts,fwd);while((t-opts.speed)<250){t+=opts.speed;}debug("calculated timeout: "+t+"; speed: "+opts.speed);if(t!==false){return t;}}return opts.timeout;}$.fn.cycle.next=function(opts){advance(opts,opts.rev?-1:1);};$.fn.cycle.prev=function(opts){advance(opts,opts.rev?1:-1);};function advance(opts,val){var els=opts.elements;var p=opts.$cont[0],timeout=p.cycleTimeout;if(timeout){clearTimeout(timeout);p.cycleTimeout=0;}if(opts.random&&val<0){opts.randomIndex--;if(--opts.randomIndex==-2){opts.randomIndex=els.length-2;}else{if(opts.randomIndex==-1){opts.randomIndex=els.length-1;}}opts.nextSlide=opts.randomMap[opts.randomIndex];}else{if(opts.random){opts.nextSlide=opts.randomMap[opts.randomIndex];}else{opts.nextSlide=opts.currSlide+val;if(opts.nextSlide<0){if(opts.nowrap){return false;}opts.nextSlide=els.length-1;}else{if(opts.nextSlide>=els.length){if(opts.nowrap){return false;}opts.nextSlide=0;}}}}var cb=opts.onPrevNextEvent||opts.prevNextClick;if($.isFunction(cb)){cb(val>0,opts.nextSlide,els[opts.nextSlide]);}go(els,opts,1,val>=0);return false;}function buildPager(els,opts){var $p=$(opts.pager);$.each(els,function(i,o){$.fn.cycle.createPagerAnchor(i,o,$p,els,opts);});opts.updateActivePagerLink(opts.pager,opts.startingSlide,opts.activePagerClass);}$.fn.cycle.createPagerAnchor=function(i,el,$p,els,opts){var a;if($.isFunction(opts.pagerAnchorBuilder)){a=opts.pagerAnchorBuilder(i,el);debug("pagerAnchorBuilder("+i+", el) returned: "+a);}else{a='<a href="#">'+(i+1)+"</a>";}if(!a){return;}var $a=$(a);if($a.parents("body").length===0){var arr=[];if($p.length>1){$p.each(function(){var $clone=$a.clone(true);$(this).append($clone);arr.push($clone[0]);});$a=$(arr);}else{$a.appendTo($p);}}opts.pagerAnchors=opts.pagerAnchors||[];opts.pagerAnchors.push($a);$a.bind(opts.pagerEvent,function(e){e.preventDefault();opts.nextSlide=i;var p=opts.$cont[0],timeout=p.cycleTimeout;if(timeout){clearTimeout(timeout);p.cycleTimeout=0;}var cb=opts.onPagerEvent||opts.pagerClick;if($.isFunction(cb)){cb(opts.nextSlide,els[opts.nextSlide]);}go(els,opts,1,opts.currSlide<i);});if(!/^click/.test(opts.pagerEvent)&&!opts.allowPagerClickBubble){$a.bind("click.cycle",function(){return false;});}if(opts.pauseOnPagerHover){$a.hover(function(){opts.$cont[0].cyclePause++;},function(){opts.$cont[0].cyclePause--;});}};$.fn.cycle.hopsFromLast=function(opts,fwd){var hops,l=opts.lastSlide,c=opts.currSlide;if(fwd){hops=c>l?c-l:opts.slideCount-l;}else{hops=c<l?l-c:l+opts.slideCount-c;}return hops;};function clearTypeFix($slides){debug("applying clearType background-color hack");function hex(s){s=parseInt(s).toString(16);return s.length<2?"0"+s:s;}function getBg(e){for(;e&&e.nodeName.toLowerCase()!="html";e=e.parentNode){var v=$.css(e,"background-color");if(v.indexOf("rgb")>=0){var rgb=v.match(/\d+/g);return"#"+hex(rgb[0])+hex(rgb[1])+hex(rgb[2]);}if(v&&v!="transparent"){return v;}}return"#ffffff";}$slides.each(function(){$(this).css("background-color",getBg(this));});}$.fn.cycle.commonReset=function(curr,next,opts,w,h,rev){$(opts.elements).not(curr).hide();opts.cssBefore.opacity=1;opts.cssBefore.display="block";if(w!==false&&next.cycleW>0){opts.cssBefore.width=next.cycleW;}if(h!==false&&next.cycleH>0){opts.cssBefore.height=next.cycleH;}opts.cssAfter=opts.cssAfter||{};opts.cssAfter.display="none";$(curr).css("zIndex",opts.slideCount+(rev===true?1:0));$(next).css("zIndex",opts.slideCount+(rev===true?0:1));};$.fn.cycle.custom=function(curr,next,opts,cb,fwd,speedOverride){var $l=$(curr),$n=$(next);var speedIn=opts.speedIn,speedOut=opts.speedOut,easeIn=opts.easeIn,easeOut=opts.easeOut;$n.css(opts.cssBefore);if(speedOverride){if(typeof speedOverride=="number"){speedIn=speedOut=speedOverride;}else{speedIn=speedOut=1;}easeIn=easeOut=null;}var fn=function(){$n.animate(opts.animIn,speedIn,easeIn,cb);};$l.animate(opts.animOut,speedOut,easeOut,function(){if(opts.cssAfter){$l.css(opts.cssAfter);}if(!opts.sync){fn();}});if(opts.sync){fn();}};$.fn.cycle.transitions={fade:function($cont,$slides,opts){$slides.not(":eq("+opts.currSlide+")").css("opacity",0);opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.cssBefore.opacity=0;});opts.animIn={opacity:1};opts.animOut={opacity:0};opts.cssBefore={top:0,left:0};}};$.fn.cycle.ver=function(){return ver;};$.fn.cycle.defaults={fx:"fade",timeout:4000,timeoutFn:null,continuous:0,speed:1000,speedIn:null,speedOut:null,next:null,prev:null,onPrevNextEvent:null,prevNextEvent:"click.cycle",pager:null,onPagerEvent:null,pagerEvent:"click.cycle",allowPagerClickBubble:false,pagerAnchorBuilder:null,before:null,after:null,end:null,easing:null,easeIn:null,easeOut:null,shuffle:null,animIn:null,animOut:null,cssBefore:null,cssAfter:null,fxFn:null,height:"auto",startingSlide:0,sync:1,random:0,fit:0,containerResize:1,pause:0,pauseOnPagerHover:0,autostop:0,autostopCount:0,delay:0,slideExpr:null,cleartype:!$.support.opacity,cleartypeNoBg:false,nowrap:0,fastOnEvent:0,randomizeEffects:1,rev:0,manualTrump:true,requeueOnImageNotLoaded:true,requeueTimeout:250,activePagerClass:"activeSlide",updateActivePagerLink:null,backwards:false};})(jQuery);
/*
 * jQuery Cycle Plugin Transition Definitions
 * This script is a plugin for the jQuery Cycle Plugin
 * Examples and documentation at: http://malsup.com/jquery/cycle/
 * Copyright (c) 2007-2010 M. Alsup
 * Version:	 2.72
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 */
(function($){$.fn.cycle.transitions.none=function($cont,$slides,opts){opts.fxFn=function(curr,next,opts,after){$(next).show();$(curr).hide();after();};};$.fn.cycle.transitions.scrollUp=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var h=$cont.height();opts.cssBefore={top:h,left:0};opts.cssFirst={top:0};opts.animIn={top:0};opts.animOut={top:-h};};$.fn.cycle.transitions.scrollDown=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var h=$cont.height();opts.cssFirst={top:0};opts.cssBefore={top:-h,left:0};opts.animIn={top:0};opts.animOut={top:h};};$.fn.cycle.transitions.scrollLeft=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var w=$cont.width();opts.cssFirst={left:0};opts.cssBefore={left:w,top:0};opts.animIn={left:0};opts.animOut={left:0-w};};$.fn.cycle.transitions.scrollRight=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var w=$cont.width();opts.cssFirst={left:0};opts.cssBefore={left:-w,top:0};opts.animIn={left:0};opts.animOut={left:w};};$.fn.cycle.transitions.scrollHorz=function($cont,$slides,opts){$cont.css("overflow","hidden").width();opts.before.push(function(curr,next,opts,fwd){$.fn.cycle.commonReset(curr,next,opts);opts.cssBefore.left=fwd?(next.cycleW-1):(1-next.cycleW);opts.animOut.left=fwd?-curr.cycleW:curr.cycleW;});opts.cssFirst={left:0};opts.cssBefore={top:0};opts.animIn={left:0};opts.animOut={top:0};};$.fn.cycle.transitions.scrollVert=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push(function(curr,next,opts,fwd){$.fn.cycle.commonReset(curr,next,opts);opts.cssBefore.top=fwd?(1-next.cycleH):(next.cycleH-1);opts.animOut.top=fwd?curr.cycleH:-curr.cycleH;});opts.cssFirst={top:0};opts.cssBefore={left:0};opts.animIn={top:0};opts.animOut={left:0};};$.fn.cycle.transitions.slideX=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$(opts.elements).not(curr).hide();$.fn.cycle.commonReset(curr,next,opts,false,true);opts.animIn.width=next.cycleW;});opts.cssBefore={left:0,top:0,width:0};opts.animIn={width:"show"};opts.animOut={width:0};};$.fn.cycle.transitions.slideY=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$(opts.elements).not(curr).hide();$.fn.cycle.commonReset(curr,next,opts,true,false);opts.animIn.height=next.cycleH;});opts.cssBefore={left:0,top:0,height:0};opts.animIn={height:"show"};opts.animOut={height:0};};$.fn.cycle.transitions.shuffle=function($cont,$slides,opts){var i,w=$cont.css("overflow","visible").width();$slides.css({left:0,top:0});opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,true,true);});if(!opts.speedAdjusted){opts.speed=opts.speed/2;opts.speedAdjusted=true;}opts.random=0;opts.shuffle=opts.shuffle||{left:-w,top:15};opts.els=[];for(i=0;i<$slides.length;i++){opts.els.push($slides[i]);}for(i=0;i<opts.currSlide;i++){opts.els.push(opts.els.shift());}opts.fxFn=function(curr,next,opts,cb,fwd){var $el=fwd?$(curr):$(next);$(next).css(opts.cssBefore);var count=opts.slideCount;$el.animate(opts.shuffle,opts.speedIn,opts.easeIn,function(){var hops=$.fn.cycle.hopsFromLast(opts,fwd);for(var k=0;k<hops;k++){fwd?opts.els.push(opts.els.shift()):opts.els.unshift(opts.els.pop());}if(fwd){for(var i=0,len=opts.els.length;i<len;i++){$(opts.els[i]).css("z-index",len-i+count);}}else{var z=$(curr).css("z-index");$el.css("z-index",parseInt(z)+1+count);}$el.animate({left:0,top:0},opts.speedOut,opts.easeOut,function(){$(fwd?this:curr).hide();if(cb){cb();}});});};opts.cssBefore={display:"block",opacity:1,top:0,left:0};};$.fn.cycle.transitions.turnUp=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false);opts.cssBefore.top=next.cycleH;opts.animIn.height=next.cycleH;});opts.cssFirst={top:0};opts.cssBefore={left:0,height:0};opts.animIn={top:0};opts.animOut={height:0};};$.fn.cycle.transitions.turnDown=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false);opts.animIn.height=next.cycleH;opts.animOut.top=curr.cycleH;});opts.cssFirst={top:0};opts.cssBefore={left:0,top:0,height:0};opts.animOut={height:0};};$.fn.cycle.transitions.turnLeft=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true);opts.cssBefore.left=next.cycleW;opts.animIn.width=next.cycleW;});opts.cssBefore={top:0,width:0};opts.animIn={left:0};opts.animOut={width:0};};$.fn.cycle.transitions.turnRight=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true);opts.animIn.width=next.cycleW;opts.animOut.left=curr.cycleW;});opts.cssBefore={top:0,left:0,width:0};opts.animIn={left:0};opts.animOut={width:0};};$.fn.cycle.transitions.zoom=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,false,true);opts.cssBefore.top=next.cycleH/2;opts.cssBefore.left=next.cycleW/2;opts.animIn={top:0,left:0,width:next.cycleW,height:next.cycleH};opts.animOut={width:0,height:0,top:curr.cycleH/2,left:curr.cycleW/2};});opts.cssFirst={top:0,left:0};opts.cssBefore={width:0,height:0};};$.fn.cycle.transitions.fadeZoom=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,false);opts.cssBefore.left=next.cycleW/2;opts.cssBefore.top=next.cycleH/2;opts.animIn={top:0,left:0,width:next.cycleW,height:next.cycleH};});opts.cssBefore={width:0,height:0};opts.animOut={opacity:0};};$.fn.cycle.transitions.blindX=function($cont,$slides,opts){var w=$cont.css("overflow","hidden").width();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.animIn.width=next.cycleW;opts.animOut.left=curr.cycleW;});opts.cssBefore={left:w,top:0};opts.animIn={left:0};opts.animOut={left:w};};$.fn.cycle.transitions.blindY=function($cont,$slides,opts){var h=$cont.css("overflow","hidden").height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.animIn.height=next.cycleH;opts.animOut.top=curr.cycleH;});opts.cssBefore={top:h,left:0};opts.animIn={top:0};opts.animOut={top:h};};$.fn.cycle.transitions.blindZ=function($cont,$slides,opts){var h=$cont.css("overflow","hidden").height();var w=$cont.width();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.animIn.height=next.cycleH;opts.animOut.top=curr.cycleH;});opts.cssBefore={top:h,left:w};opts.animIn={top:0,left:0};opts.animOut={top:h,left:w};};$.fn.cycle.transitions.growX=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true);opts.cssBefore.left=this.cycleW/2;opts.animIn={left:0,width:this.cycleW};opts.animOut={left:0};});opts.cssBefore={width:0,top:0};};$.fn.cycle.transitions.growY=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false);opts.cssBefore.top=this.cycleH/2;opts.animIn={top:0,height:this.cycleH};opts.animOut={top:0};});opts.cssBefore={height:0,left:0};};$.fn.cycle.transitions.curtainX=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true,true);opts.cssBefore.left=next.cycleW/2;opts.animIn={left:0,width:this.cycleW};opts.animOut={left:curr.cycleW/2,width:0};});opts.cssBefore={top:0,width:0};};$.fn.cycle.transitions.curtainY=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false,true);opts.cssBefore.top=next.cycleH/2;opts.animIn={top:0,height:next.cycleH};opts.animOut={top:curr.cycleH/2,height:0};});opts.cssBefore={left:0,height:0};};$.fn.cycle.transitions.cover=function($cont,$slides,opts){var d=opts.direction||"left";var w=$cont.css("overflow","hidden").width();var h=$cont.height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);if(d=="right"){opts.cssBefore.left=-w;}else{if(d=="up"){opts.cssBefore.top=h;}else{if(d=="down"){opts.cssBefore.top=-h;}else{opts.cssBefore.left=w;}}}});opts.animIn={left:0,top:0};opts.animOut={opacity:1};opts.cssBefore={top:0,left:0};};$.fn.cycle.transitions.uncover=function($cont,$slides,opts){var d=opts.direction||"left";var w=$cont.css("overflow","hidden").width();var h=$cont.height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,true,true);if(d=="right"){opts.animOut.left=w;}else{if(d=="up"){opts.animOut.top=-h;}else{if(d=="down"){opts.animOut.top=h;}else{opts.animOut.left=-w;}}}});opts.animIn={left:0,top:0};opts.animOut={opacity:1};opts.cssBefore={top:0,left:0};};$.fn.cycle.transitions.toss=function($cont,$slides,opts){var w=$cont.css("overflow","visible").width();var h=$cont.height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,true,true);if(!opts.animOut.left&&!opts.animOut.top){opts.animOut={left:w*2,top:-h/2,opacity:0};}else{opts.animOut.opacity=0;}});opts.cssBefore={left:0,top:0};opts.animIn={left:0};};$.fn.cycle.transitions.wipe=function($cont,$slides,opts){var w=$cont.css("overflow","hidden").width();var h=$cont.height();opts.cssBefore=opts.cssBefore||{};var clip;if(opts.clip){if(/l2r/.test(opts.clip)){clip="rect(0px 0px "+h+"px 0px)";}else{if(/r2l/.test(opts.clip)){clip="rect(0px "+w+"px "+h+"px "+w+"px)";}else{if(/t2b/.test(opts.clip)){clip="rect(0px "+w+"px 0px 0px)";}else{if(/b2t/.test(opts.clip)){clip="rect("+h+"px "+w+"px "+h+"px 0px)";}else{if(/zoom/.test(opts.clip)){var top=parseInt(h/2);var left=parseInt(w/2);clip="rect("+top+"px "+left+"px "+top+"px "+left+"px)";}}}}}}opts.cssBefore.clip=opts.cssBefore.clip||clip||"rect(0px 0px 0px 0px)";var d=opts.cssBefore.clip.match(/(\d+)/g);var t=parseInt(d[0]),r=parseInt(d[1]),b=parseInt(d[2]),l=parseInt(d[3]);opts.before.push(function(curr,next,opts){if(curr==next){return;}var $curr=$(curr),$next=$(next);$.fn.cycle.commonReset(curr,next,opts,true,true,false);opts.cssAfter.display="block";var step=1,count=parseInt((opts.speedIn/13))-1;(function f(){var tt=t?t-parseInt(step*(t/count)):0;var ll=l?l-parseInt(step*(l/count)):0;var bb=b<h?b+parseInt(step*((h-b)/count||1)):h;var rr=r<w?r+parseInt(step*((w-r)/count||1)):w;$next.css({clip:"rect("+tt+"px "+rr+"px "+bb+"px "+ll+"px)"});(step++<=count)?setTimeout(f,13):$curr.css("display","none");})();});opts.cssBefore={display:"block",opacity:1,top:0,left:0};opts.animIn={left:0};opts.animOut={left:0};};})(jQuery);

/*
 * FancyBox - jQuery Plugin
 * Simple and fancy lightbox alternative
 *
 * Examples and documentation at: http://fancybox.net
 * 
 * Copyright (c) 2008 - 2010 Janis Skarnelis
 * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
 * 
 * Version: 1.3.4 (11/11/2010)
 * Requires: jQuery v1.3+
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */

;(function(b){var m,t,u,f,D,j,E,n,z,A,q=0,e={},o=[],p=0,d={},l=[],G=null,v=new Image,J=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,W=/[^\.]\.(swf)\s*$/i,K,L=1,y=0,s="",r,i,h=false,B=b.extend(b("<div/>")[0],{prop:0}),M=b.browser.msie&&b.browser.version<7&&!window.XMLHttpRequest,N=function(){t.hide();v.onerror=v.onload=null;G&&G.abort();m.empty()},O=function(){if(false===e.onError(o,q,e)){t.hide();h=false}else{e.titleShow=false;e.width="auto";e.height="auto";m.html('<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>');
F()}},I=function(){var a=o[q],c,g,k,C,P,w;N();e=b.extend({},b.fn.fancybox.defaults,typeof b(a).data("fancybox")=="undefined"?e:b(a).data("fancybox"));w=e.onStart(o,q,e);if(w===false)h=false;else{if(typeof w=="object")e=b.extend(e,w);k=e.title||(a.nodeName?b(a).attr("title"):a.title)||"";if(a.nodeName&&!e.orig)e.orig=b(a).children("img:first").length?b(a).children("img:first"):b(a);if(k===""&&e.orig&&e.titleFromAlt)k=e.orig.attr("alt");c=e.href||(a.nodeName?b(a).attr("href"):a.href)||null;if(/^(?:javascript)/i.test(c)||
c=="#")c=null;if(e.type){g=e.type;if(!c)c=e.content}else if(e.content)g="html";else if(c)g=c.match(J)?"image":c.match(W)?"swf":b(a).hasClass("iframe")?"iframe":c.indexOf("#")===0?"inline":"ajax";if(g){if(g=="inline"){a=c.substr(c.indexOf("#"));g=b(a).length>0?"inline":"ajax"}e.type=g;e.href=c;e.title=k;if(e.autoDimensions)if(e.type=="html"||e.type=="inline"||e.type=="ajax"){e.width="auto";e.height="auto"}else e.autoDimensions=false;if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick=
false;e.enableEscapeButton=false;e.showCloseButton=false}e.padding=parseInt(e.padding,10);e.margin=parseInt(e.margin,10);m.css("padding",e.padding+e.margin);b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){b(this).replaceWith(j.children())});switch(g){case "html":m.html(e.content);F();break;case "inline":if(b(a).parent().is("#fancybox-content")===true){h=false;break}b('<div class="fancybox-inline-tmp" />').hide().insertBefore(b(a)).bind("fancybox-cleanup",function(){b(this).replaceWith(j.children())}).bind("fancybox-cancel",
function(){b(this).replaceWith(m.children())});b(a).appendTo(m);F();break;case "image":h=false;b.fancybox.showActivity();v=new Image;v.onerror=function(){O()};v.onload=function(){h=true;v.onerror=v.onload=null;e.width=v.width;e.height=v.height;b("<img />").attr({id:"fancybox-img",src:v.src,alt:e.title}).appendTo(m);Q()};v.src=c;break;case "swf":e.scrolling="no";C='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+e.width+'" height="'+e.height+'"><param name="movie" value="'+c+
'"></param>';P="";b.each(e.swf,function(x,H){C+='<param name="'+x+'" value="'+H+'"></param>';P+=" "+x+'="'+H+'"'});C+='<embed src="'+c+'" type="application/x-shockwave-flash" width="'+e.width+'" height="'+e.height+'"'+P+"></embed></object>";m.html(C);F();break;case "ajax":h=false;b.fancybox.showActivity();e.ajax.win=e.ajax.success;G=b.ajax(b.extend({},e.ajax,{url:c,data:e.ajax.data||{},error:function(x){x.status>0&&O()},success:function(x,H,R){if((typeof R=="object"?R:G).status==200){if(typeof e.ajax.win==
"function"){w=e.ajax.win(c,x,H,R);if(w===false){t.hide();return}else if(typeof w=="string"||typeof w=="object")x=w}m.html(x);F()}}}));break;case "iframe":Q()}}else O()}},F=function(){var a=e.width,c=e.height;a=a.toString().indexOf("%")>-1?parseInt((b(window).width()-e.margin*2)*parseFloat(a)/100,10)+"px":a=="auto"?"auto":a+"px";c=c.toString().indexOf("%")>-1?parseInt((b(window).height()-e.margin*2)*parseFloat(c)/100,10)+"px":c=="auto"?"auto":c+"px";m.wrapInner('<div style="width:'+a+";height:"+c+
";overflow: "+(e.scrolling=="auto"?"auto":e.scrolling=="yes"?"scroll":"hidden")+';position:relative;"></div>');e.width=m.width();e.height=m.height();Q()},Q=function(){var a,c;t.hide();if(f.is(":visible")&&false===d.onCleanup(l,p,d)){b.event.trigger("fancybox-cancel");h=false}else{h=true;b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");f.is(":visible")&&d.titlePosition!=="outside"&&f.css("height",f.height());l=o;p=q;d=e;if(d.overlayShow){u.css({"background-color":d.overlayColor,
opacity:d.overlayOpacity,cursor:d.hideOnOverlayClick?"pointer":"auto",height:b(document).height()});if(!u.is(":visible")){M&&b("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"});u.show()}}else u.hide();i=X();s=d.title||"";y=0;n.empty().removeAttr("style").removeClass();if(d.titleShow!==false){if(b.isFunction(d.titleFormat))a=d.titleFormat(s,l,p,d);else a=s&&s.length?
d.titlePosition=="float"?'<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">'+s+'</td><td id="fancybox-title-float-right"></td></tr></table>':'<div id="fancybox-title-'+d.titlePosition+'">'+s+"</div>":false;s=a;if(!(!s||s==="")){n.addClass("fancybox-title-"+d.titlePosition).html(s).appendTo("body").show();switch(d.titlePosition){case "inside":n.css({width:i.width-d.padding*2,marginLeft:d.padding,marginRight:d.padding});
y=n.outerHeight(true);n.appendTo(D);i.height+=y;break;case "over":n.css({marginLeft:d.padding,width:i.width-d.padding*2,bottom:d.padding}).appendTo(D);break;case "float":n.css("left",parseInt((n.width()-i.width-40)/2,10)*-1).appendTo(f);break;default:n.css({width:i.width-d.padding*2,paddingLeft:d.padding,paddingRight:d.padding}).appendTo(f)}}}n.hide();if(f.is(":visible")){b(E.add(z).add(A)).hide();a=f.position();r={top:a.top,left:a.left,width:f.width(),height:f.height()};c=r.width==i.width&&r.height==
i.height;j.fadeTo(d.changeFade,0.3,function(){var g=function(){j.html(m.contents()).fadeTo(d.changeFade,1,S)};b.event.trigger("fancybox-change");j.empty().removeAttr("filter").css({"border-width":d.padding,width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2});if(c)g();else{B.prop=0;b(B).animate({prop:1},{duration:d.changeSpeed,easing:d.easingChange,step:T,complete:g})}})}else{f.removeAttr("style");j.css("border-width",d.padding);if(d.transitionIn=="elastic"){r=V();j.html(m.contents());
f.show();if(d.opacity)i.opacity=0;B.prop=0;b(B).animate({prop:1},{duration:d.speedIn,easing:d.easingIn,step:T,complete:S})}else{d.titlePosition=="inside"&&y>0&&n.show();j.css({width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2}).html(m.contents());f.css(i).fadeIn(d.transitionIn=="none"?0:d.speedIn,S)}}}},Y=function(){if(d.enableEscapeButton||d.enableKeyboardNav)b(document).bind("keydown.fb",function(a){if(a.keyCode==27&&d.enableEscapeButton){a.preventDefault();b.fancybox.close()}else if((a.keyCode==
37||a.keyCode==39)&&d.enableKeyboardNav&&a.target.tagName!=="INPUT"&&a.target.tagName!=="TEXTAREA"&&a.target.tagName!=="SELECT"){a.preventDefault();b.fancybox[a.keyCode==37?"prev":"next"]()}});if(d.showNavArrows){if(d.cyclic&&l.length>1||p!==0)z.show();if(d.cyclic&&l.length>1||p!=l.length-1)A.show()}else{z.hide();A.hide()}},S=function(){if(!b.support.opacity){j.get(0).style.removeAttribute("filter");f.get(0).style.removeAttribute("filter")}e.autoDimensions&&j.css("height","auto");f.css("height","auto");
s&&s.length&&n.show();d.showCloseButton&&E.show();Y();d.hideOnContentClick&&j.bind("click",b.fancybox.close);d.hideOnOverlayClick&&u.bind("click",b.fancybox.close);b(window).bind("resize.fb",b.fancybox.resize);d.centerOnScroll&&b(window).bind("scroll.fb",b.fancybox.center);if(d.type=="iframe")b('<iframe id="fancybox-frame" name="fancybox-frame'+(new Date).getTime()+'" frameborder="0" hspace="0" '+(b.browser.msie?'allowtransparency="true""':"")+' scrolling="'+e.scrolling+'" src="'+d.href+'"></iframe>').appendTo(j);
f.show();h=false;b.fancybox.center();d.onComplete(l,p,d);var a,c;if(l.length-1>p){a=l[p+1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}if(p>0){a=l[p-1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}},T=function(a){var c={width:parseInt(r.width+(i.width-r.width)*a,10),height:parseInt(r.height+(i.height-r.height)*a,10),top:parseInt(r.top+(i.top-r.top)*a,10),left:parseInt(r.left+(i.left-r.left)*a,10)};if(typeof i.opacity!=="undefined")c.opacity=a<0.5?0.5:a;f.css(c);
j.css({width:c.width-d.padding*2,height:c.height-y*a-d.padding*2})},U=function(){return[b(window).width()-d.margin*2,b(window).height()-d.margin*2,b(document).scrollLeft()+d.margin,b(document).scrollTop()+d.margin]},X=function(){var a=U(),c={},g=d.autoScale,k=d.padding*2;c.width=d.width.toString().indexOf("%")>-1?parseInt(a[0]*parseFloat(d.width)/100,10):d.width+k;c.height=d.height.toString().indexOf("%")>-1?parseInt(a[1]*parseFloat(d.height)/100,10):d.height+k;if(g&&(c.width>a[0]||c.height>a[1]))if(e.type==
"image"||e.type=="swf"){g=d.width/d.height;if(c.width>a[0]){c.width=a[0];c.height=parseInt((c.width-k)/g+k,10)}if(c.height>a[1]){c.height=a[1];c.width=parseInt((c.height-k)*g+k,10)}}else{c.width=Math.min(c.width,a[0]);c.height=Math.min(c.height,a[1])}c.top=parseInt(Math.max(a[3]-20,a[3]+(a[1]-c.height-40)*0.5),10);c.left=parseInt(Math.max(a[2]-20,a[2]+(a[0]-c.width-40)*0.5),10);return c},V=function(){var a=e.orig?b(e.orig):false,c={};if(a&&a.length){c=a.offset();c.top+=parseInt(a.css("paddingTop"),
10)||0;c.left+=parseInt(a.css("paddingLeft"),10)||0;c.top+=parseInt(a.css("border-top-width"),10)||0;c.left+=parseInt(a.css("border-left-width"),10)||0;c.width=a.width();c.height=a.height();c={width:c.width+d.padding*2,height:c.height+d.padding*2,top:c.top-d.padding-20,left:c.left-d.padding-20}}else{a=U();c={width:d.padding*2,height:d.padding*2,top:parseInt(a[3]+a[1]*0.5,10),left:parseInt(a[2]+a[0]*0.5,10)}}return c},Z=function(){if(t.is(":visible")){b("div",t).css("top",L*-40+"px");L=(L+1)%12}else clearInterval(K)};
b.fn.fancybox=function(a){if(!b(this).length)return this;b(this).data("fancybox",b.extend({},a,b.metadata?b(this).metadata():{})).unbind("click.fb").bind("click.fb",function(c){c.preventDefault();if(!h){h=true;b(this).blur();o=[];q=0;c=b(this).attr("rel")||"";if(!c||c==""||c==="nofollow")o.push(this);else{o=b("a[rel="+c+"], area[rel="+c+"]");q=o.index(this)}I()}});return this};b.fancybox=function(a,c){var g;if(!h){h=true;g=typeof c!=="undefined"?c:{};o=[];q=parseInt(g.index,10)||0;if(b.isArray(a)){for(var k=
0,C=a.length;k<C;k++)if(typeof a[k]=="object")b(a[k]).data("fancybox",b.extend({},g,a[k]));else a[k]=b({}).data("fancybox",b.extend({content:a[k]},g));o=jQuery.merge(o,a)}else{if(typeof a=="object")b(a).data("fancybox",b.extend({},g,a));else a=b({}).data("fancybox",b.extend({content:a},g));o.push(a)}if(q>o.length||q<0)q=0;I()}};b.fancybox.showActivity=function(){clearInterval(K);t.show();K=setInterval(Z,66)};b.fancybox.hideActivity=function(){t.hide()};b.fancybox.next=function(){return b.fancybox.pos(p+
1)};b.fancybox.prev=function(){return b.fancybox.pos(p-1)};b.fancybox.pos=function(a){if(!h){a=parseInt(a);o=l;if(a>-1&&a<l.length){q=a;I()}else if(d.cyclic&&l.length>1){q=a>=l.length?0:l.length-1;I()}}};b.fancybox.cancel=function(){if(!h){h=true;b.event.trigger("fancybox-cancel");N();e.onCancel(o,q,e);h=false}};b.fancybox.close=function(){function a(){u.fadeOut("fast");n.empty().hide();f.hide();b.event.trigger("fancybox-cleanup");j.empty();d.onClosed(l,p,d);l=e=[];p=q=0;d=e={};h=false}if(!(h||f.is(":hidden"))){h=
true;if(d&&false===d.onCleanup(l,p,d))h=false;else{N();b(E.add(z).add(A)).hide();b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");j.find("iframe").attr("src",M&&/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank");d.titlePosition!=="inside"&&n.empty();f.stop();if(d.transitionOut=="elastic"){r=V();var c=f.position();i={top:c.top,left:c.left,width:f.width(),height:f.height()};if(d.opacity)i.opacity=1;n.empty().hide();B.prop=1;
b(B).animate({prop:0},{duration:d.speedOut,easing:d.easingOut,step:T,complete:a})}else f.fadeOut(d.transitionOut=="none"?0:d.speedOut,a)}}};b.fancybox.resize=function(){u.is(":visible")&&u.css("height",b(document).height());b.fancybox.center(true)};b.fancybox.center=function(a){var c,g;if(!h){g=a===true?1:0;c=U();!g&&(f.width()>c[0]||f.height()>c[1])||f.stop().animate({top:parseInt(Math.max(c[3]-20,c[3]+(c[1]-j.height()-40)*0.5-d.padding)),left:parseInt(Math.max(c[2]-20,c[2]+(c[0]-j.width()-40)*0.5-
d.padding))},typeof a=="number"?a:200)}};b.fancybox.init=function(){if(!b("#fancybox-wrap").length){b("body").append(m=b('<div id="fancybox-tmp"></div>'),t=b('<div id="fancybox-loading"><div></div></div>'),u=b('<div id="fancybox-overlay"></div>'),f=b('<div id="fancybox-wrap"></div>'));D=b('<div id="fancybox-outer"></div>').append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>').appendTo(f);
D.append(j=b('<div id="fancybox-content"></div>'),E=b('<a id="fancybox-close"></a>'),n=b('<div id="fancybox-title"></div>'),z=b('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),A=b('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>'));E.click(b.fancybox.close);t.click(b.fancybox.cancel);z.click(function(a){a.preventDefault();b.fancybox.prev()});A.click(function(a){a.preventDefault();b.fancybox.next()});
b.fn.mousewheel&&f.bind("mousewheel.fb",function(a,c){if(h)a.preventDefault();else if(b(a.target).get(0).clientHeight==0||b(a.target).get(0).scrollHeight===b(a.target).get(0).clientHeight){a.preventDefault();b.fancybox[c>0?"prev":"next"]()}});b.support.opacity||f.addClass("fancybox-ie");if(M){t.addClass("fancybox-ie6");f.addClass("fancybox-ie6");b('<iframe id="fancybox-hide-sel-frame" src="'+(/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank")+'" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(D)}}};
b.fn.fancybox.defaults={padding:10,margin:40,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.7,overlayColor:"#777",titleShow:true,titlePosition:"float",titleFormat:null,titleFromAlt:false,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing",
easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,enableKeyboardNav:true,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};b(document).ready(function(){b.fancybox.init()})})(jQuery);

/*
* Print Element Plugin 0.9
*
* Copyright (c) 2009 Erik Zaadi
*
* Inspired by PrintArea (http://plugins.jquery.com/project/PrintArea) and
* http://stackoverflow.com/questions/472951/how-do-i-print-an-iframe-from-javascript-in-safari-chrome
*
* $Id: jquery.printElement.js PENDING ID ErikZ $
*
* Dual licensed under the MIT and GPL licenses:
*   http://www.opensource.org/licenses/mit-license.php
*   http://www.gnu.org/licenses/gpl.html
*/
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}('(4($){$.k.q=4(w){3 o=$.F({},$.k.q.Y,w);$("[G^=\'H\']").1d();m a.V(4(){3 1=$.1c?$.F({},o,$a.19()):o;N($(a),1)})};$.k.q.Y={K:\'5\',10:\'\',b:[],u:{c:\'16:B;1a:B;\',d:\'\'},E:15,l:{c:\'1b:1e;J:M;S:M;\',d:\'\'}};4 N(e,1){3 $9=$(e);3 2=C($9,1);3 f=L;3 8=L;12(1.K.T()==\'I\'){f=18.A(\'\',\'14\',\'J=17,S=1q,1x=1B\');8=I.6}Q{3 h="H"+(1v.1u()*1t).1s();5=6.1A(\'1z\');$(5).g({U:1.l.c,G:h,1y:1.l.d});6.t.1w(5);8=5.y.6;3 5=6.z?6.z[h]:6.1r(h);f=5.y||5}8.A();8.1j(2);8.X();f.11()};4 C(e,1){3 $9=$(e);3 2=1f 1h();2.7(\'<2><O><Z>\'+1.10+\'</Z>\');12(1.b&&1.b.W>0){1g(3 x=0;x<1.b.W;x++){2.7(\'<p v="s/D" j="i" n="\'+1.b[x]+\'" >\')}}Q{$(6).1k("p ").1l(4(){m $(a).g("j").T()=="i"}).V(4(){2.7(\'<p v="s/D" j="i" n="\'+$(a).g("n")+\'" >\')})}2.7(\'</O><t 1p="13();" U="\'+1.u.c+\'" r="\'+1.u.d+\'">\');2.7(\'<R r="\'+$9.g("r")+\'">\'+$9.2()+\'</R>\');2.7(\'<P v="s/1o">4 13() { 11();1n();\'+(1.E?\'\':\'X();\')+\'}</P></t></2>\');m 2.1m(\'\')}})(1i);',62,100,'|opts|html|var|function|iframe|document|push|documentToWriteTo|elementToPrint|this|overrideElementCSS|styleToAdd|classNameToAdd|element|popupOrIframe|attr|printElementID|stylesheet|rel|fn|iframeElementOptions|return|href|mainOptions|link|printElement|class|text|body|printBodyOptions|type|options||contentWindow|frames|open|10px|_getMarkup|css|leaveOpen|extend|id|printElement_|popup|width|printMode|null|0px|_printElement|head|script|else|div|height|toLowerCase|style|each|length|close|defaults|title|pageTitle|focus|if|printPage|printElementWindow|false|padding|650|window|data|margin|position|meta|remove|absolute|new|for|Array|jQuery|write|find|filter|join|print|javascript|onload|440|getElementById|toString|99999|random|Math|appendChild|scrollbars|className|IFRAME|createElement|yes'.split('|'),0,{}))

