// source --> https://h2ofrance.com/wp-content/plugins/rem-wishlist.off/js/scripts.js?ver=7.0.3 
jQuery(document).ready(function($) {

	/*
	 *
	 * Check user loged status 
	 *
	*/
	var data = {
    	action: 'is_user_logged_in'
	};
	var is_user_logged_in = '';
	$.post(rem_wishlist_var.ajaxurl, data, function(response) {

	    is_user_logged_in = response;
	});
	/*
	 *
	 * ADD TICK ICON ON EVERY WISHLIST PROPERTY
	 *
	*/var a =0;
	$('.rem-wishlist-btn').each(function(index, val){
		var existing_prop = rem_get_wishlist_property();
		var prop_id = $(this).data('id');
		
		if ( existing_prop != undefined ) {

			if (existing_prop.indexOf(prop_id) !== -1) {
				$(this).html("");
				$(this).addClass('active');
				//if ($('body').hasClass('single-rem_property') ) {
					if (($('a').hasClass('ajouter') )&&(a!=1)) { a = 1;
	            	$(this).append( '<i class="fas fa-heart"></i>  '+rem_wishlist_var.icon_title_attr_remove );	
	            }else {
	            	
					$(this).append( '<i class="fas fa-heart"></i>' );
	            }
				$(this).attr( "title", rem_wishlist_var.icon_title_attr_remove );
			};
		};
	});

	/*
	 *
	 * ADDING PROPERTY IN WISHLIST ( LOCAL STORAGE )
	 *
	*/
	function rem_set_wishlist( pid ) {
		var stored = false;
		var existing_prop = store.get('rem_wishlist_properties_test');
		if (existing_prop == undefined) {
			var prop_array = [pid];
			store.set('rem_wishlist_properties_test', prop_array);
			stored = true;
		}
		else {
			// check if already exists
			if (existing_prop.indexOf(pid) === -1) {
				existing_prop.push(pid);
				store.set('rem_wishlist_properties_test', existing_prop);
				stored = true;
			}else {
				swal({
				    title: rem_wishlist_var.already_exist_title,
				    text: rem_wishlist_var.already_exist_text,
				    timer: 2000,
				    button: false
				});
			}
		}
		
		return stored;
	}

	/*
	 *
	 * REMOVEING PROPERTY FORM WISHLIST ( LOCAL STORAGE )
	 *
	 *
	*/
	function rem_reset_wishlist(pid) {
		var existing_prop = rem_get_wishlist_property();
		//removing index
		var prop_index = existing_prop.indexOf(pid);
		existing_prop.splice(prop_index, 1);
		// now updating fav local storage
		store.set('rem_wishlist_properties_test', existing_prop);	
		
		if( existing_prop.length == 0 ){
			rem_clear_prop_wishlist();
		}
	}

	/*
	 *
	 * GET ALL STORED WISHLIST PROPERTIES
	 *
	*/
	function rem_get_wishlist_property() {
		$('.rem-loading-img').css({'display': 'inline-block'});
		var existing_prop = store.get('rem_wishlist_properties_test');
		if( existing_prop !== undefined ){
			return existing_prop;
		} else {
			return null;
		}
	}

	/*
	 *
	 * CLEAR WISHLIST PROERTIES FORM LOCAL STORAGE 
	 *
	*/
	function rem_clear_prop_wishlist() {
		store.remove('rem_wishlist_properties_test');
	}

	/*
	 *
	 * LOAD ALL WISHLIST PROPERTIES IN SHORTCODE
	 *
	*/
	var property_ids = rem_get_wishlist_property();
	if (property_ids != undefined ) {
		var data = {
			"action" : "rem_get_wishlist_properties",
			"property_ids" : property_ids,
		}
		// $(".rem-wishlist-table").hide();
		$.post(rem_wishlist_var.ajaxurl, data, function(resp) {
	        // console.log(resp);
	        $('.loading-table').remove();
	        $('.wishlist_table_boday').append(resp.html)
			$('.rem-wishlist-table').slideDown("slow");
	    });
	}else {
		if ($('body').hasClass('logged-in')) {
			var data = {
			"action" : "rem_get_wishlist_properties",
			}
			// $(".rem-wishlist-table").hide();
			$.post(rem_wishlist_var.ajaxurl, data, function(resp) {
		        $('.loading-table').remove();
		        if (resp.html != '') {

			        $('.wishlist_table_boday').append(resp.html)
					$('.rem-wishlist-table').slideDown("slow");
					$.each(resp.ids, function(index, id) {
						rem_set_wishlist(id);
					});
		        }else{
		        	var not_found_msg = '<p class="alert alert-danger"><strong>'+rem_wishlist_var.empty_list_msg+'</strong></p>';
					$('.wishlist-box').html(not_found_msg);
		        };
		    });
		}else{

			var not_found_msg = '<p class="alert alert-danger"><strong>'+rem_wishlist_var.empty_list_msg+'</strong></p>';
			$('.wishlist-box').html(not_found_msg);
		}
	};
	/*
	 *
	 * REMOVE PROPERTY FORM SHORTCOED BIN BUTTON 
	 *
	*/
	$(document).on("click", ".remove-property-btn", function(event){
		event.preventDefault();
		var prop_id = $(this).data('id');
		rem_reset_wishlist(prop_id);	
		$(this).closest("tr").remove();
		if (is_user_logged_in && is_user_logged_in != '') {

        	wishlist_in_user_profile();
        }
		var property_ids = rem_get_wishlist_property();
		if (property_ids == undefined) {

			var not_found_msg = '<p class="alert alert-danger"><strong>'+rem_wishlist_var.empty_list_msg+'</strong></p>';
			$('.wishlist-box').html(not_found_msg);
		};
	});

	/*
	 *
	 * WISHLIST BUTTON CLICK 
	 *
	*/
	$(document).on('click', '.rem-wishlist-btn', function(event){

		event.preventDefault();
		var btn  = $(this);
		var property_id = $(this).data('id');
		var already_in_wishlist = $(this).children("i.fas.fa-heart").length > 0 ? true : false;
		
		if ( !already_in_wishlist ) {
			// seting in local storage
			var stored = rem_set_wishlist(property_id);
			if (stored) {
	            // add icon by ajax
	            btn.html("");
	            btn.addClass('active');
	            //if ($('body').hasClass('single-rem_property') ) {
					if ($('p').hasClass('ajouter') ) {
	            	btn.append( '<i class="fas fa-heart"></i>  '+rem_wishlist_var.icon_title_attr_remove );	
	            }else {
	            	
	            	btn.append( '<i class="fas fa-heart"></i>' );	
	            }
	            btn.attr( "data-original-title", rem_wishlist_var.icon_title_attr_remove );
	            btn.attr( "title", rem_wishlist_var.icon_title_attr_remove );
				if (is_user_logged_in && is_user_logged_in != '') {

	            	wishlist_in_user_profile();
	            	swal({
					    title: rem_wishlist_var.add_property_title,
					    text: rem_wishlist_var.add_property_text,
					    timer: 2000,
					    icon: "success",
					    button: false
					});
				}else{
		            swal({
					    title: rem_wishlist_var.add_property_title,
					    text: rem_wishlist_var.add_property_text,
					    timer: 2000,
					    icon: "success",
					    button: false
					});
				};
			}else {
	            
			};
		}else{
			rem_reset_wishlist(property_id);
			// btn.children("i.fas.fa-heart").remove();
			btn.html("");
			btn.removeClass('active');
			if ($('body').hasClass('single-rem_property') ) {
				btn.append( '<i class="far fa-heart"></i> '+ rem_wishlist_var.icon_title_attr_added );
			}else{

				btn.append( '<i class="far fa-heart"></i>' );
			}
			btn.attr( "data-original-title", rem_wishlist_var.icon_title_attr_added );
			btn.attr( "title", rem_wishlist_var.icon_title_attr_added );
			if (is_user_logged_in && is_user_logged_in != '') {

				wishlist_in_user_profile();

				swal({
				    title: rem_wishlist_var.removed_property_title,
				    text: rem_wishlist_var.removed_property_text,
				    timer: 2000,
				    icon: "success",
				    button: false
				});
			}else {

				swal({
				    title: rem_wishlist_var.removed_property_title,
				    text: rem_wishlist_var.removed_property_text,
				    timer: 2000,
				    icon: "success",
				    button: false
				});
			};
		}
	});
	/*
	 *
	 * SEND AJAX REQUEST FOR ADDING WISHLISTING IN USER PROFILE 
	 *
	*/
	function wishlist_in_user_profile() {
		var property_ids = rem_get_wishlist_property();
		var data = {
			action : "wishlist_in_user_profile",
			property_ids : property_ids,
		}

		$.post(rem_wishlist_var.ajaxurl, data, function(response) {
		})
	}


	/*
	 *
	 * INQUERY FORM 
	 *
	*/
	$(document).on('submit', '.rem-wishlist-inquiry-frm', function(event){
		event.preventDefault();
		var selected_properties = $('.rem-wishlist-table .property-check:checked').map(function() {
        	return $(this).val();
       	}).get();

		if ( selected_properties.length != 0 ) {

			var loading_img = $(this).find('.form-loader');	
			var ajaxurl = $('.ajaxurl').val();
			var data = $(this).serialize();
			var data = data+'&ids='+selected_properties;

			loading_img.css({'display': 'inline-block'});
			
			$.post(ajaxurl, data, function(resp) {
		            
	            // hide loading
	            loading_img.hide();
	            var css_class = 'alert alert-success';
	            $.each( resp ,function( index, val ){
	            	if (val.status == 'Fail') {
	            		css_class = 'alert alert-danger';
	            	};
	            	$( ".responce-mesages" ).append( "<p class='"+css_class+"'><strong>"+val.msg+"</strong></p>" );
	            });
	        });

	    }else {
			swal({
			    title: rem_wishlist_var.form_property_empty_title,
			    text: rem_wishlist_var.form_property_empty_text,
			    timer: 2000,
			    button: false
			});
		};
	});
});
// source --> https://h2ofrance.com/wp-content/plugins/rem-wishlist.off/js/store2.js?ver=7.0.3 
/*! store2 - v2.5.1 - 2017-03-28
* Copyright (c) 2017 Nathan Bubna; Licensed ,  */
;(function(window, define) {
    var _ = {
        version: "2.5.1",
        areas: {},
        apis: {},

        // utilities
        inherit: function(api, o) {
            for (var p in api) {
                if (!o.hasOwnProperty(p)) {
                    o[p] = api[p];
                }
            }
            return o;
        },
        stringify: function(d) {
            return d === undefined || typeof d === "function" ? d+'' : JSON.stringify(d);
        },
        parse: function(s) {
            // if it doesn't parse, return as is
            try{ return JSON.parse(s); }catch(e){ return s; }
        },

        // extension hooks
        fn: function(name, fn) {
            _.storeAPI[name] = fn;
            for (var api in _.apis) {
                _.apis[api][name] = fn;
            }
        },
        get: function(area, key){ return area.getItem(key); },
        set: function(area, key, string){ area.setItem(key, string); },
        remove: function(area, key){ area.removeItem(key); },
        key: function(area, i){ return area.key(i); },
        length: function(area){ return area.length; },
        clear: function(area){ area.clear(); },

        // core functions
        Store: function(id, area, namespace) {
            var store = _.inherit(_.storeAPI, function(key, data, overwrite) {
                if (arguments.length === 0){ return store.getAll(); }
                if (typeof data === "function"){ return store.transact(key, data, overwrite); }// fn=data, alt=overwrite
                if (data !== undefined){ return store.set(key, data, overwrite); }
                if (typeof key === "string" || typeof key === "number"){ return store.get(key); }
                if (!key){ return store.clear(); }
                return store.setAll(key, data);// overwrite=data, data=key
            });
            store._id = id;
            try {
                var testKey = '_safariPrivate_';
                area.setItem(testKey, 'sucks');
                store._area = area;
                area.removeItem(testKey);
            } catch (e) {}
            if (!store._area) {
                store._area = _.inherit(_.storageAPI, { items: {}, name: 'fake' });
            }
            store._ns = namespace || '';
            if (!_.areas[id]) {
                _.areas[id] = store._area;
            }
            if (!_.apis[store._ns+store._id]) {
                _.apis[store._ns+store._id] = store;
            }
            return store;
        },
        storeAPI: {
            // admin functions
            area: function(id, area) {
                var store = this[id];
                if (!store || !store.area) {
                    store = _.Store(id, area, this._ns);//new area-specific api in this namespace
                    if (!this[id]){ this[id] = store; }
                }
                return store;
            },
            namespace: function(namespace, noSession) {
                if (!namespace){
                    return this._ns ? this._ns.substring(0,this._ns.length-1) : '';
                }
                var ns = namespace, store = this[ns];
                if (!store || !store.namespace) {
                    store = _.Store(this._id, this._area, this._ns+ns+'.');//new namespaced api
                    if (!this[ns]){ this[ns] = store; }
                    if (!noSession){ store.area('session', _.areas.session); }
                }
                return store;
            },
            isFake: function(){ return this._area.name === 'fake'; },
            toString: function() {
                return 'store'+(this._ns?'.'+this.namespace():'')+'['+this._id+']';
            },

            // storage functions
            has: function(key) {
                if (this._area.has) {
                    return this._area.has(this._in(key));//extension hook
                }
                return !!(this._in(key) in this._area);
            },
            size: function(){ return this.keys().length; },
            each: function(fn, and) {
                for (var i=0, m=_.length(this._area); i<m; i++) {
                    var key = this._out(_.key(this._area, i));
                    if (key !== undefined) {
                        if (fn.call(this, key, and || this.get(key)) === false) {
                            break;
                        }
                    }
                    if (m > _.length(this._area)) { m--; i--; }// in case of removeItem
                }
                return and || this;
            },
            keys: function() {
                return this.each(function(k, list){ list.push(k); }, []);
            },
            get: function(key, alt) {
                var s = _.get(this._area, this._in(key));
                return s !== null ? _.parse(s) : alt || s;// support alt for easy default mgmt
            },
            getAll: function() {
                return this.each(function(k, all){ all[k] = this.get(k); }, {});
            },
            transact: function(key, fn, alt) {
                var val = this.get(key, alt),
                    ret = fn(val);
                this.set(key, ret === undefined ? val : ret);
                return this;
            },
            set: function(key, data, overwrite) {
                var d = this.get(key);
                if (d != null && overwrite === false) {
                    return data;
                }
                return _.set(this._area, this._in(key), _.stringify(data), overwrite) || d;
            },
            setAll: function(data, overwrite) {
                var changed, val;
                for (var key in data) {
                    val = data[key];
                    if (this.set(key, val, overwrite) !== val) {
                        changed = true;
                    }
                }
                return changed;
            },
            remove: function(key) {
                var d = this.get(key);
                _.remove(this._area, this._in(key));
                return d;
            },
            clear: function() {
                if (!this._ns) {
                    _.clear(this._area);
                } else {
                    this.each(function(k){ _.remove(this._area, this._in(k)); }, 1);
                }
                return this;
            },
            clearAll: function() {
                var area = this._area;
                for (var id in _.areas) {
                    if (_.areas.hasOwnProperty(id)) {
                        this._area = _.areas[id];
                        this.clear();
                    }
                }
                this._area = area;
                return this;
            },

            // internal use functions
            _in: function(k) {
                if (typeof k !== "string"){ k = _.stringify(k); }
                return this._ns ? this._ns + k : k;
            },
            _out: function(k) {
                return this._ns ?
                    k && k.indexOf(this._ns) === 0 ?
                        k.substring(this._ns.length) :
                        undefined : // so each() knows to skip it
                    k;
            }
        },// end _.storeAPI
        storageAPI: {
            length: 0,
            has: function(k){ return this.items.hasOwnProperty(k); },
            key: function(i) {
                var c = 0;
                for (var k in this.items){
                    if (this.has(k) && i === c++) {
                        return k;
                    }
                }
            },
            setItem: function(k, v) {
                if (!this.has(k)) {
                    this.length++;
                }
                this.items[k] = v;
            },
            removeItem: function(k) {
                if (this.has(k)) {
                    delete this.items[k];
                    this.length--;
                }
            },
            getItem: function(k){ return this.has(k) ? this.items[k] : null; },
            clear: function(){ for (var k in this.list){ this.removeItem(k); } },
            toString: function(){ return this.length+' items in '+this.name+'Storage'; }
        }// end _.storageAPI
    };

    var store =
        // safely set this up (throws error in IE10/32bit mode for local files)
        _.Store("local", (function(){try{ return localStorage; }catch(e){}})());
    store.local = store;// for completeness
    store._ = _;// for extenders and debuggers...
    // safely setup store.session (throws exception in FF for file:/// urls)
    store.area("session", (function(){try{ return sessionStorage; }catch(e){}})());

    if (typeof define === 'function' && define.amd !== undefined) {
        define('store2', [], function () {
            return store;
        });
    } else if (typeof module !== 'undefined' && module.exports) {
        module.exports = store;
    } else {
        // expose the primary store fn to the global object and save conflicts
        if (window.store){ _.conflict = window.store; }
        window.store = store;
    }

})(this, this.define);
// source --> https://h2ofrance.com/wp-content/plugins/wpfront-notification-bar/jquery-plugins/js-cookie.min.js?ver=2.2.1 
/**
 * Original file: /npm/js-cookie@2.2.1/src/js.cookie.js
 */
!function(e){var n;if("function"==typeof define&&define.amd&&(define(e),n=!0),"object"==typeof exports&&(module.exports=e(),n=!0),!n){var t=window.Cookies,o=window.Cookies=e();o.noConflict=function(){return window.Cookies=t,o}}}(function(){function e(){for(var e=0,n={};e<arguments.length;e++){var t=arguments[e];for(var o in t)n[o]=t[o]}return n}function n(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function t(o){function r(){}function i(n,t,i){if("undefined"!=typeof document){"number"==typeof(i=e({path:"/"},r.defaults,i)).expires&&(i.expires=new Date(1*new Date+864e5*i.expires)),i.expires=i.expires?i.expires.toUTCString():"";try{var c=JSON.stringify(t);/^[\{\[]/.test(c)&&(t=c)}catch(e){}t=o.write?o.write(t,n):encodeURIComponent(String(t)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),n=encodeURIComponent(String(n)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var f="";for(var u in i)i[u]&&(f+="; "+u,!0!==i[u]&&(f+="="+i[u].split(";")[0]));return document.cookie=n+"="+t+f}}function c(e,t){if("undefined"!=typeof document){for(var r={},i=document.cookie?document.cookie.split("; "):[],c=0;c<i.length;c++){var f=i[c].split("="),u=f.slice(1).join("=");t||'"'!==u.charAt(0)||(u=u.slice(1,-1));try{var a=n(f[0]);if(u=(o.read||o)(u,a)||n(u),t)try{u=JSON.parse(u)}catch(e){}if(r[a]=u,e===a)break}catch(e){}}return e?r[e]:r}}return r.set=i,r.get=function(e){return c(e,!1)},r.getJSON=function(e){return c(e,!0)},r.remove=function(n,t){i(n,"",e(t,{expires:-1}))},r.defaults={},r.withConverter=t,r}(function(){})});
// source --> https://h2ofrance.com/wp-content/plugins/wpfront-notification-bar/js/wpfront-notification-bar.min.js?ver=3.5.1.05102 
window.wpfront_notification_bar=function(i,t){var e=function(t){i.log&&console.log(i.log_prefix+" "+t)};if("undefined"==typeof jQuery||i.keep_closed&&"undefined"==typeof Cookies||i.set_max_views&&"undefined"==typeof Cookies)return e("Waiting for "+("undefined"==typeof jQuery?"jQuery.":"Cookies.")),void setTimeout((function(){wpfront_notification_bar(i,t)}),100);if(2!=i.position||!0===t){var o=function(t){return t+i.id_suffix},n=jQuery,s=i.keep_closed_cookie,a=0,r=i.max_views_cookie,c=n(o("#wpfront-notification-bar-spacer")).removeClass("hidden"),f=n(o("#wpfront-notification-bar")),p=n(o("#wpfront-notification-bar-open-button"));if(1==i.position){e("Setting notification bar at top.");var l=0;i.fixed_position&&i.is_admin_bar_showing&&("0px"==(l=n("html").css("margin-top"))&&(l=n("html").css("padding-top")),l=parseInt(l)),i.fixed_position&&(l+=i.position_offset),f.css("top",l+"px"),p.css("top",l+"px"),c.css("top",i.position_offset+"px");var d=(u=n("body")).children().first();if(d.hasClass("wpfront-notification-bar-spacer"))for(;;){var _=d.next();if(!_.hasClass("wpfront-notification-bar-spacer")){d.after(c);break}d=_}else u.prepend(c);n((function(){u.children().first().hasClass("wpfront-notification-bar-spacer")||i.fixed_position&&!u.children().first().is(c)&&u.prepend(c)}))}else{var u;e("Setting notification bar at bottom."),(u=n("body")).children().last().is(c)||u.append(c),n((function(){u.children().last().is(c)||u.append(c)}))}var h=f.height();i.height>0&&(h=i.height,f.find("table, tbody, tr").css("height","100%")),f.height(0).css({position:i.fixed_position?"fixed":"relative",visibility:"visible"}),p.css({position:i.fixed_position?"fixed":"absolute"});var b=!1,v=!1,g=null,m=0,x=i.fixed_position&&""!=i.theme_sticky_selector;if(x&&n(window).on("scroll resize",(function(){k()})),i.close_button&&c.on("click",".wpfront-close",(function(){w(0,null,!0)})),i.button_action_close_bar&&c.on("click",".wpfront-button",(function(){w(0,null,!0)})),i.display_open_button&&c.on("click",o("#wpfront-notification-bar-open-button"),(function(){w(h)})),i.keep_closed&&Cookies.get(s))return e("Keep closed enabled and keep closed cookie exists. Hiding notification bar."),void w(0,(function(){f.removeClass("keep-closed")}));if(f.removeClass("keep-closed"),i.set_max_views&&(void 0===(a=Cookies.get(r))&&(a=0),a>=i.max_views))return e("Reached max views, hiding notification bar."),void w(0,(function(){f.removeClass("max-views-reached")}));f.removeClass("max-views-reached"),b=!0,i.display_scroll?(e("Display on scroll enabled. Hiding notification bar."),w(0),n(window).on("scroll",(function(){v||(n(this).scrollTop()>i.display_scroll_offset?w(h):w(0))}))):(e("Setting notification bar open event after "+i.display_after+" second(s)."),setTimeout((function(){w(h,(function(){i.auto_close_after>0&&(e("Setting notification bar auto close event after "+i.auto_close_after+" second(s)."),setTimeout((function(){w(0,null,!0)}),1e3*i.auto_close_after))}))}),1e3*i.display_after))}else jQuery((function(){wpfront_notification_bar(i,!0)}));function w(t,o,l){if(o=o||n.noop,l&&(v=!0),0==t){if(b)return;b=!0}else{if(!b)return;b=!1}0==t&&i.keep_closed&&l&&(i.keep_closed_for>0?Cookies.set(s,1,{path:"/",expires:i.keep_closed_for,sameSite:"strict"}):Cookies.set(s,1,{path:"/",sameSite:"strict"})),0!==t&&i.set_max_views&&(a=void 0===(a=Cookies.get(r))?0:parseInt(a),i.max_views_for>0?Cookies.set(r,a+1,{path:"/",expires:i.max_views_for,sameSite:"strict"}):Cookies.set(r,a+1,{path:"/",sameSite:"strict"}),e("Setting view count to "+(a+1)+"."));var d=o;o=function(){d(),t>0&&(0==i.height&&f.height("auto"),i.display_open_button&&(e("Setting reopen button state to hidden."),p.addClass("hidden")),b=!1),0==t&&i.display_open_button&&(e("Setting reopen button state to visible."),p.removeClass("hidden")),t>0?f.removeClass("hidden"):f.addClass("hidden")},e(t>0?"Setting notification bar state to visible.":"Setting notification bar state to hidden."),i.animate_delay>0?f.stop().show().animate({height:t+"px"},{duration:1e3*i.animate_delay,easing:"swing",complete:function(){i.fixed_position&&c.height(t),k(t),o()},step:function(t){i.fixed_position&&c.height(t),k(t)}}):(f.height(t),i.fixed_position&&c.height(t),k(t),o())}function k(t){if(!x)return 0;if(!0!==t){clearInterval(m);var e=0;m=setInterval((function(){k(!0),++e>100&&clearInterval(m)}),10)}var o=n(i.theme_sticky_selector);if(0==o.length||"fixed"!==o.css("position"))return 0;1==i.position&&(null===g&&(g=o.position().top),f.is(":visible")?o.css("top",f.height()+f.position().top+"px"):o.css("top",g+"px")),2==i.position&&(null===g&&(g=o.height()+parseFloat(o.css("bottom"))),f.is(":visible")?o.css("bottom",f.height()+parseFloat(f.css("bottom"))+"px"):o.css("bottom",g+"px"))}};