//(function ($) {
	$(document).ready(function(){
		/* calendar popups */
		var _calendar_list = $("ul.calendar li");
		hiConfig = {
			sensitivity: 3, // number = sensitivity threshold (must be 1 or higher)
			interval: 200, // number = milliseconds for onMouseOver polling interval
			timeout: 200, // number = milliseconds delay before onMouseOut
			over: function() {
				_calendar_list.removeClass('active');
				$(this).addClass('active');
				calendarPopup = $("div.calendar-popup", this);
				calendarPopup.removeAttr("style");
				setObjectTooltipOrientation(calendarPopup);
			}, // function = onMouseOver callback (REQUIRED)
			out: function() { $(this).removeClass('active');  } // function = onMouseOut callback (REQUIRED)
		}
		_calendar_list.hoverIntent(hiConfig);
		
		$('#carousel').ready( function() {
			// New gallery functionality to meet the demands of the client
			initHmnqGallery();
		});
        
        initPopupFunc();
        $("*[lang*=popup]").easyTooltip({
            xOffset: 10,
            yOffset: 25,
            tooltipId: "easyTooltip",
            clickRemove: false,
            content: "lang",
            useElement: ""
        });
        initAddTag();
        initFacebookLogin();
    });
    
    function initHmnqGallery()
    {    
		gallery_nav_status = "idle";
    	slides_html = $('#carousel .gallery-slide-inner').html();
		slides = $('#carousel .gallery-slide-inner>li');
		start_num_slides = slides.size();
		slide_width = 615;
		start_margin = 615 * start_num_slides;
		
		max_margin = (start_margin * 4) - (slide_width * start_num_slides);
		max_margin = parseInt("-"+max_margin);
		min_margin = 2 * slide_width;
		min_margin = parseInt("-"+min_margin);
		
		reset_margin_next = start_margin + slide_width;
		reset_margin_prev = start_margin + ((slide_width * start_num_slides) + slide_width);
		
		$('#carousel .gallery-slide-inner').append(slides_html + slides_html + slides_html);
		if (start_num_slides == 1) {
			$('#carousel .gallery-slide-inner').append(slides_html);
		}
		$('#carousel .gallery-slide-inner').css("margin-left","-"+start_margin+"px");
		
		// navigation next
		$('#carousel a.next').click(function(){
			if (gallery_nav_status=="idle") {
				gallery_nav_status = "busy";
				current_margin = parseInt($("#carousel .gallery-slide-inner").css("margin-left").replace("px",""));
				new_margin = current_margin - slide_width;
				
				$("#carousel .gallery-slide-inner").animate({marginLeft: new_margin+"px" },"slow", function() {
					if (new_margin < max_margin) {
						$('#carousel .gallery-slide-inner').css("margin-left","-"+reset_margin_next+"px");
					}
					gallery_nav_status = "idle";
				});
			}
			return false;
		});
		
		// navigation prev
		$('#carousel a.prev').click(function(){
			if (gallery_nav_status=="idle") {
				gallery_nav_status = "busy";
				current_margin = parseInt($("#carousel .gallery-slide-inner").css("margin-left").replace("px",""));
				new_margin = current_margin + slide_width;
				
				$("#carousel .gallery-slide-inner").animate({marginLeft: new_margin+"px" },"slow", function() {
					if (new_margin > min_margin) {
						$('#carousel .gallery-slide-inner').css("margin-left","-"+reset_margin_prev+"px");
					}
					gallery_nav_status = "idle";
				});
			}
			return false;
		});
    }
    
    function setObjectTooltipOrientation(_popup)
	{
		if (!_popup.length) return;
	
		_el = _popup.parent("li");
		
		var _holder = $('#wrapper');
		var _holderPosR = _holder.offset().left + _holder.outerWidth();
		var _holderPosB = $(window).height() + $(window).scrollTop();
		
		if ((_popup.offset().left + _popup.outerWidth()) > _holderPosR) {
			_popup.css({
				marginLeft : '-280px'
			});
		}
		if ((_el.offset().top + 32 + _popup.outerHeight()) > _holderPosB) {
			_popup.css({
				marginTop : '-' + _popup.height() + 'px' // calculate the new marginTop from popup height;
			});
		}
	}

    /* Add tag to event */
    function initAddTag() {
    	$("div.popup2 > div.tags-box > ul.tags > li > a").click( function(){
    		tagName = $(this).html();
    		$("input#event-tag-input").val(tagName);
    		
    		return false;
    	});
    	
    	/* Autocomplete on input */
    	var data = "comedy tryout lachen".split(" ");
    	$("input#event-tag-input").autocomplete(site_url+"ajax/autocomplete_tag");
    }

    /* Tooltip */
    $.fn.easyTooltip = function (options) {

        // default configuration properties
        var defaults = {
            xOffset: 10,
            yOffset: 25,
            tooltipId: "easyTooltip",
            clickRemove: false,
            content: "",
            useElement: ""
        };

        var options = $.extend(defaults, options);
        var content, title1, title2, _t;
        var flag = true;

        this.each(function () {
            var title = $(this).attr("title");
            $(this).hover(function (e) {
                if (_t) clearTimeout(_t);
                content = (options.content != "") ? $("#" + $(this).attr('lang')).html() : lang;
                content = (options.useElement != "") ? $("#" + options.useElement).html() : content;
                if (content != "" && content != undefined) {
                    if ($("#" + options.tooltipId).length > 0) {
                        $("#" + options.tooltipId).eq(0).remove(0);
                    }
                    $("body").append("<div id='" + options.tooltipId + "'>" + content + "</div>");

                    $("#" + options.tooltipId)
							.css("position", "absolute")
                    if ($(window).height() < (e.pageY - options.yOffset + $("#" + options.tooltipId).children().outerHeight(true))) {
                        $("#" + options.tooltipId)
								.css("top", (e.pageY + options.yOffset - $("#" + options.tooltipId).children().outerHeight(true)) + "px")
                    } else {
                        $("#" + options.tooltipId)
								.css("top", (e.pageY - options.yOffset) + "px")
                    }
                    if ($(window).width() < (e.pageX + options.xOffset + $("#" + options.tooltipId).children().outerWidth(true))) {
                        $("#" + options.tooltipId)
								.css("left", (e.pageX - options.xOffset - $("#" + options.tooltipId).children().outerWidth(true)) + "px")
                    } else {
                        $("#" + options.tooltipId)
								.css("left", (e.pageX + options.xOffset) + "px")
                    }
                    if (flag) {
                        $("#" + options.tooltipId)
								.css("display", "none")
								.fadeIn("fast")
                    }
                }
            },
			function () {
			    if (_t) clearTimeout(_t);
			    flag = false;
			    _t = setTimeout(function () {
			        flag = true;
			        $("#" + options.tooltipId).remove();
			    }, 200);
			});
            $(this).mousemove(function (e) {
                if ($(window).width() < (e.pageX + options.xOffset + $("#" + options.tooltipId).children().outerWidth(true))) {
                    $("#" + options.tooltipId)
						.css("left", (e.pageX - options.xOffset - $("#" + options.tooltipId).children().outerWidth(true)) + "px")
                } else {
                    $("#" + options.tooltipId)
						.css("left", (e.pageX + options.xOffset) + "px")
                }
                if ($(window).height() < (e.pageY - options.yOffset + $("#" + options.tooltipId).children().outerHeight(true))) {
                    $("#" + options.tooltipId)
						.css("top", (e.pageY + options.yOffset - $("#" + options.tooltipId).children().outerHeight(true)) + "px")
                } else {
                    $("#" + options.tooltipId)
						.css("top", (e.pageY - options.yOffset) + "px")
                }
            });
            if (options.clickRemove) {
                $(this).mousedown(function (e) {
                    $("#" + options.tooltipId).remove();
                });
            }
        });

    };
    
    /* Facebook */

	function initFacebookLogin()
	{
		$("a.facebook").click(function() {
			FB.login(function(response) {
			  if (response.authResponse.accessToken) {
			    // user successfully logged in
				  FB.api('/me', function(response) {
					  document.location = site_url + "?ACT=" + facebook_login_action_id;
				  });
			  } else {
			    // user cancelled login
			  }
			}, {scope:"email,user_about_me,user_birthday,user_hometown"});
			
			return false;
		});
	}


    /* Popup */
    function initPopupFunc() {
        var open_class = 'open';
        var popup_open_links = $('.popup-open-link');
		
		$("a.fb_logout_link").live('click', function() {
			$.get(logout_path,
				function(data){
					$("span.fb_login_status").html('Let op: <a href="'+site_url+'page/tags-toevoegen">Facebook account vereist</a>');
					$("div#tag-message-container").html("<p>U bent nu uitgelogd.</p>");
					$("div#tag-message-container").fadeIn("fast").delay(5000).fadeOut("slow");
					return false;
				});
			return false;
		});
		
        popup_open_links.each(function () {

            var popup_open_link = $(this);
            var popup_open = $(popup_open_link.attr('href'));
            if (popup_open_links.filter('.' + open_class).length > 1) {
                popup_open_links.removeClass(open_class);
                popup_open_links.eq(0).addClass(open_class);
            }
            if (!popup_open_link.hasClass(open_class)) {
                popup_open.hide();
                popup_open_link.fadeIn();
            } else {
            	popup_open_link.fadeOut();
                popup_open.show();
            }
            popup_open_link.click(function () {
				tag_holder = $("div.event-info > div.tags-block");
				tags_list = $("div.event-info > div.tags-block > ul.tags");
				fb_status = $("span.fb_login_status");
                
				tag_holder.animate({
					opacity: 0.0
				}, 'fast', function() {
					// Animation complete.
					tag_holder.css("height","11px");
					popup_open.css("height","11px");
					popup_open.css("display","block");
					$("span.fb_login_status").css("display","none");
					tags_list.fadeOut(1);
					popup_open_link.fadeOut(1, function () {
						$.ajax({
					        url: site_url+'ajax/check_login',
					        dataType: 'xml',
					        async: false,
					        success: function (result) {
					        		if ($(result).find("result success").text() == "true") {
					        			member_id = $(result).find("result message").text();
					        			member_email = $(result).find("result email").text();
					        		}
					        		else {
					        			member_id = "0";
					        			member_email = "";
					        		}
					        	}
						});
						
						if (member_id==0) 
		                {
		                    // not logged in: perform facebook login
		                    FB.login(function (response) {
                                if (response.authResponse.accessToken) {
		                            // user successfully logged in
		                            FB.api('/me', function (response) {
										$.get(site_url, { ACT: facebook_login_action_id },
											function(data){
											
											$.ajax({
										        url: site_url+'ajax/check_login',
										        dataType: 'xml',
										        async: false,
										        success: function (result) {
										        		if ($(result).find("result success").text() == "true") {
										        			member_id = $(result).find("result message").text();
										        			member_email = $(result).find("result email").text();
										        			$("span.fb_login_status").html('Ingelogd met '+member_email+'<br/>(<a class="fb_logout_link" href="#">uitloggen</a>)');
										        		}
										        		else {
										        			member_id = "0";
										        			member_email = "";
										        		}
										        	}
											});

											$("div#tag-message-container").html("<p>U bent nu ingelogd met facebook.</p>");
											$("div#tag-message-container").fadeIn("fast").delay(5000).fadeOut("slow");
			                                
			                                if (popup_open.is(':hidden')) {
						                        popup_open_link.addClass(open_class);
						                        popup_open.addClass(open_class);
						                    }
						                    
						                    popup_open.animate({
				                            	height: "105px"
				                            });
						                    
						                    tag_holder.animate({
												opacity: 1.0,
												height: '1%'
											});
										});
		                            });
		                        }
		                        else {
		                            // user cancelled login
		                            tags_list.fadeIn(1);
		                            $("span.fb_login_status").css("display","inline");
		                            popup_open_link.fadeIn(1, function() {
		                            	tag_holder.css("height","1%");
		                            	popup_open.css("display","none");
		                            	
		                            	tag_holder.animate({
											opacity: 1.0
										}, 'fast');
		                            });
		                        }
		                    }, { perms: "email,publish_stream" });
		                }
		                else
		                {
		                    // already logged in
		                    if (popup_open.is(':hidden')) {
		                        popup_open_link.addClass(open_class);
		                        popup_open.addClass(open_class);
		                    }
		                    
		                    popup_open.animate({
                            	height: "105px"
                            });
		                    
		                    tag_holder.animate({
								opacity: 1.0,
								height: '1%'
							});
		                }
					});
					
				});
                
                return false;
            });
        });

        var popup_close_links = $('.popup-close-link');
        popup_close_links.each(function () {
            var popup_close_link = $(this);
            var popup_open_link = $('.popup-open-link');
            var popup_close = $(popup_close_link.attr('href'));
            popup_close_link.click(function () {
            	tag_holder = $("div.event-info > div.tags-block");
				tags_list = $("div.event-info > div.tags-block > ul.tags");
                
                // Start IE8 fix
				// This is only here because IE8 is a crappy browser!
				IE_hides = $("div.overflower, div.tags-box, div.tags-box > ul.tags > li > a");
				IE_hides.animate({opacity: 0.0},'fast'); 
				// End IE8 fix
				
				tag_holder.animate({
					opacity: 0.0
				}, 'fast', function() {
					 popup_close.animate({
                    	height: "11px"
                    }, 'slow', function () {
                    
						tag_holder.css("height","11px");
						popup_close.css("display","none");
						$("span.fb_login_status").css("display","inline");
						
						tags_list.fadeIn(1);
						popup_open_link.fadeIn(1, function() {
							tag_holder.animate({
								opacity: 1.0,
								height: '1%'
							},'fast');
							
							IE_hides.removeAttr("style"); // IE8 fix
						});

                    });
				});
            	
                popup_close_link.removeClass(open_class);
                popup_close.removeClass(open_class);

                $("input#event-tag-input").val("Vul de tags voor deze voorstelling in...");
                return false;
            });
        });
    }

    /* Gallery */
    function Gallery(el, options) {
        this._hold = $(el);
        this.initOptions(options);
        this._timer = options.autoRotation;
        this._t;
        this.initialize();
    }

    $.fn.gallery = function (options) {
        return new Gallery(this.get(0), options);
    };

    Gallery.prototype = {
        initOptions: function (_obj) {
            this.options = {
                randomSlide: false,
                changeHeight: false,
                duration: 700,
                slideElement: 1,
                event: 'click',
                autoRotation: false,
                effect: false,
                listOfSlides: 'ul > li',
                switcher: false,
                disableBtn: false,
                nextBtn: 'a.link-next, a.btn-next, a.next',
                prevBtn: 'a.link-prev, a.btn-prev, a.prev',
                circle: true,
                direction: false,
                IE: false,
                swicherReplace: false,
                titleReplace: false
            };
            for (key in _obj) this.options[key] = _obj[key];
        },
        initialize: function () {
            var _this = this;
            var _hold = _this._hold;
            var _speed = _this.options.duration;
            var _timer = _this.options.autoRotation;
            var _el = _hold.find(_this.options.listOfSlides);
            if (_el.length) {
                _el.css('display', 'block');
                if (_this.options.effect) {
                    _el.css('position', 'absolute');
                    var _list = _el;
                }
                else var _list = _el.parent();
                var _switcher = _hold.find(_this.options.switcher);
                var _next = _hold.find(_this.options.nextBtn);
                var _prev = _hold.find(_this.options.prevBtn);
                var _count = _el.index(_el.filter(':last'));
                var _w = _el.outerWidth(true);
                var _h = _el.outerHeight(true);
                if (_this.options.switcher) var _active = _switcher.index(_switcher.filter('.active:eq(0)'));
                else var _active = _el.index(_el.filter('.active:eq(0)'));
                if (_active < 0) _active = 0;
                var _last = _active;
                if (_this.options.swicherReplace) {
                    var switcherReplace = _hold.find(_this.options.switcher).parent();
                    switcherReplace.html('');
                    for (var i = 0; i < _el.length; i++) {
                        switcherReplace.append('<li><a href="#">' + (i + 1) + '</a></li>');
                        if (i == _active) {
                            switcherReplace.find('li').eq(_active).addClass('active');
                        }
                    };
                    _switcher = switcherReplace.find('li');
                }
                if (_this.options.titleReplace) {
                    var titleReplace = _hold.find(_this.options.titleReplace);
                    if (titleReplace.length) {
                        _el.each(function (i) {
                            var this_el = $(this);
                            var this_title = this_el.attr('title');
                            if (this_title.length) {
                                _el.eq(i).data("title", this_title);
                            } else {
                                _el.eq(i).data("title", 'No title');
                            }
                            this_el.removeAttr('title');
                        });
                        titleReplace.html(_el.eq(_active).data("title"));
                    }
                }

                // Installation directions
                if (!_this.options.direction) {
                    var _wrapHolderW = Math.ceil(_list.parent().width() / _w);
                    if (((_wrapHolderW - 1) * _w + _w / 2) > _list.parent().width()) _wrapHolderW--;
                }
                else {
                    var _wrapHolderW = Math.ceil(_list.parent().height() / _h);
                    if (((_wrapHolderW - 1) * _h + _h / 2) > _list.parent().height()) _wrapHolderW--;
                }

                // Setting "fade" or "slide" effect
                if (!_this.options.effect) var rew = _count - _wrapHolderW + 1;
                else var rew = _count;
                if (!_this.options.effect) {
                    if (!_this.options.direction) _list.css({ marginLeft: -(_w * _active) })
                    else _list.css({ marginTop: -(_h * _active) })
                }
                else {
                    _list.css({
                        opacity: 0
                    }).removeClass('active').eq(_active).addClass('active').css({
                        opacity: 1
                    }).css('opacity', 'auto');
                    _switcher.removeClass('active').eq(_active).addClass('active');
                }

                // Disable or enable buttons "prev next"
                if (_this.options.disableBtn) {
                    if (_count < _wrapHolderW) _next.addClass(_this.options.disableBtn);
                    _prev.addClass(_this.options.disableBtn);
                }

                // Function to "fade"
                if (_this.options.changeHeight) {
                    if (_this.options.effect) {
                        _el.parent().css({ height: _list.eq(_active).outerHeight(true), overflow: 'hidden' });
                    } else {
                        if (_this.options.slideElement > 1) {
                            var active_H = _list.children().eq(_active).outerHeight(true);
                            for (var i = 1; i < _this.options.slideElement; i++) {
                                if (active_H < _list.children().eq(_active + i).outerHeight(true)) {
                                    active_H = _list.children().eq(_active + i).outerHeight(true)
                                }
                            };
                            _el.parent().css({ height: active_H, overflow: 'hidden' });
                        } else _el.parent().css({ height: _list.children().eq(_active).outerHeight(true), overflow: 'hidden' });
                    }
                }
                function fadeElement() {
                    if ($.browser.msie && _this.options.IE) {
                        _list.eq(_last).css({ opacity: 0 });
                        _list.removeClass('active').eq(_active).addClass('active').css({ opacity: 'auto' });
                    }
                    else {
                        _list.eq(_last).animate({ opacity: 0 }, { queue: false, duration: _speed });
                        _list.removeClass('active').eq(_active).addClass('active').animate({
                            opacity: 1
                        }, { queue: false, duration: _speed, complete: function () {
                            $(this).css('opacity', 'auto');
                        }
                        });
                    }
                    if (_this.options.changeHeight) {
                        _el.parent().animate({
                            height: _list.eq(_active).outerHeight(true)
                        }, { queue: false, duration: _speed });
                    }
                    if (_this.options.switcher) _switcher.removeClass('active').eq(_active).addClass('active');
                    _last = _active;
                    if (titleReplace) {
                        titleReplace.html(_el.eq(_active).data("title"));
                    }
                }
                // Function for "slide"
                function scrollEl() {
                    if (!_this.options.direction) _list.animate({ marginLeft: -(_w * _active) }, { queue: false, duration: _speed })
                    else _list.animate({ marginTop: -(_h * _active) }, { queue: false, duration: _speed })
                    if (_this.options.switcher && _this.options.slideElement) _switcher.removeClass('active').eq(_active / _this.options.slideElement).addClass('active');
                    else {
                        if (_this.options.switcher) _switcher.removeClass('active').eq(_active).addClass('active');
                    }
                    if (_this.options.changeHeight) {
                        if (_this.options.slideElement > 1) {
                            var active_H = _list.children().eq(_active).outerHeight(true);
                            for (var i = 1; i < _this.options.slideElement; i++) {
                                if (active_H < _list.children().eq(_active + i).outerHeight(true)) {
                                    active_H = _list.children().eq(_active + i).outerHeight(true)
                                }
                            };
                            _el.parent().animate({
                                height: active_H
                            }, { queue: false, duration: _speed });
                        } else {
                            _el.parent().animate({
                                height: _list.children().eq(_active).outerHeight(true)
                            }, { queue: false, duration: _speed });
                        }
                    }
                    if (titleReplace) {
                        titleReplace.html(_el.eq(_active).data("title"));
                    }
                }
                function toPrepare() {
                    if ((_active == rew) && _this.options.circle) _active = -_this.options.slideElement;
                    for (var i = 0; i < _this.options.slideElement; i++) {
                        if (_this.options.randomSlide) {
                            var pre_active = _active;
                            if (_this.options.listOfSlides.length) {
                                while (pre_active == _active) {
                                    _active = parseInt(Math.random() * (_count + 1));
                                }
                            }
                        } else {
                            _active++;
                        }
                        if (_active > rew) {
                            _active--;
                            if (_this.options.disableBtn && (_count > _wrapHolderW)) _next.addClass(_this.options.disableBtn);
                        }
                    }
                    if (_active == rew) if (_this.options.disableBtn && (_count > _wrapHolderW)) _next.addClass(_this.options.disableBtn);
                    if (!_this.options.effect) scrollEl();
                    else fadeElement();
                }
                if (_this._timer) {
                    _this._hold.bind('runTimer', function () {
                        if (_this._t) clearTimeout(_this._t);
                        _this._t = setInterval(function () {
                            toPrepare();
                        }, _this._timer);
                    });
                }
                _next.click(function () {
                    if (_this._t) clearTimeout(_this._t);
                    if (_this.options.disableBtn && (_count > _wrapHolderW)) _prev.removeClass(_this.options.disableBtn);
                    toPrepare();
                    if (_this._timer) _this._hold.trigger('runTimer');
                    return false;
                });
                _prev.click(function () {
                    if (_this._t) clearTimeout(_this._t);
                    if (_this.options.disableBtn && (_count > _wrapHolderW)) _next.removeClass(_this.options.disableBtn);
                    if ((_active == 0) && _this.options.circle) _active = rew + _this.options.slideElement;
                    for (var i = 0; i < _this.options.slideElement; i++) {
                        _active--;
                        if (_active < 0) {
                            _active++;
                            if (_this.options.disableBtn && (_count > _wrapHolderW)) _prev.addClass(_this.options.disableBtn);
                        }
                    };
                    if (_active == 0) if (_this.options.disableBtn && (_count > _wrapHolderW)) _prev.addClass(_this.options.disableBtn);
                    if (!_this.options.effect) scrollEl();
                    else fadeElement();
                    if (_this._timer) _this._hold.trigger('runTimer');
                    return false;
                });
                if (_this.options.switcher) _switcher.click(function () {
                    if (_this.options.event == 'click') {
                        if (_this.options.slideElement) {
                            _active = _switcher.index($(this)) * _this.options.slideElement;
                        } else {
                            _active = _switcher.index($(this));
                        }
                        if (_this._t) clearTimeout(_this._t);
                        if (!_this.options.effect) scrollEl();
                        else fadeElement();
                        if (_this._timer) _this._hold.trigger('runTimer');
                    }
                    return false;
                }).mouseenter(function () {
                    if (_this.options.event == 'hover') {
                        if (_this.options.slideElement) {
                            _active = _switcher.index($(this)) * _this.options.slideElement;
                        } else {
                            _active = _switcher.index($(this));
                        }
                        if (_this._t) clearTimeout(_this._t);
                        if (!_this.options.effect) scrollEl();
                        else fadeElement();
                        if (_this._timer) _this._hold.trigger('runTimer');
                    }
                });
                if (_this._timer) _this._hold.trigger('runTimer');
            }
        },
        stop: function () {
            var _this = this;
            if (_this._t) clearTimeout(_this._t);
        },
        play: function () {
            var _this = this;
            if (_this._t) clearTimeout(_this._t);
            if (_this._timer) _this._hold.trigger('runTimer');
        }
    }
//})(jQuery);

function share_on_facebook(url,title) {
	
}

function check_login() {
	//var logged_in_member_id = 0;
	
	$.ajax({
        url: site_url+'ajax/check_login',
        dataType: 'xml',
        async: false,
        success: function (result) {
        	//logged_in_member_id = data;
        		if ($(result).find("result success").text() == "true") {
        			message = $(result).find("result message").text();
        			//return $(result).find("result message").text();
        			alert("hij komt hier!" + message);
        			return message;
        		}
        		else {
        			//alert("faal!");
        			return "0";
        		}
        	}
	});
	
	//alert("dat: "+logged_in_member_id);
	//return logged_in_member_id;
}

