document.domain = "static.findmelove.com";
var FmlObject = {
    version: '1.0',
    profile_base: 'http://profile.static.findmelove.com/',
    static_base: 'http://static.static.findmelove.com/',
    template_base: 'http://static.static.findmelove.com/b/',
    search_base: 'http://www.static.findmelove.com/s/',
    secure_base: 'https://secure.static.findmelove.com/',
    site_url: 'http://www.static.findmelove.com/'
};

if (window.location.host.search('fbdatesecure') > 0)
{
	FmlObject.static_base = 'https://static.static.findmelove.com/';
}

FmlObject.sidebar = {
    update_frequency: 180000,
    IM_frequency: 45000
};

FmlObject.Actions = {};
var $newHeightMargin = 26;
$(document).ready(function() {
    $('div.round').append('<div class="round-tl"></div><div class="round-bl"></div><div class="round-tr"></div><div class="round-br"></div>');
    $('div.bround').append('<div class="round-bl"></div><div class="round-br"></div>');
    $('form table tr td div').hide();

    $('.content_tabs li a').click(function()
    {
        if ($(this).parent().attr('class') != 'noswitch')
        {
            TabChange($(this));
        }
    });

	if (location.hash != '' && location.hash != '#') {
        if ($('#' + location.hash + '-t.content_tabs_box').text() != '') {
            $('a[href|=' + location.hash + ']').click();
        }
        else if ($('#' + location.hash + '.content_tabs_box').text() != '') {
            $('a[href|=' + location.hash + ']').click();
        }
    }
    
    $('a[href^="http://www.date-support"], a[href^="http://date-support"]').each(function(){
		if($.browser.msie){
			$(this).attr('target','_blank')
		}else{
			$(this).attr('onclick','window.open(\''+$(this).attr('href')+'\'); return false; ')
		}
	});
    
    $('.safe-mode-container').mouseover(function(){
    	$('#safe-mode-popup').fadeIn('slow');
    }).mouseout(function(){
    	$('#safe-mode-popup').fadeOut('slow');
    });
    
    $('#safe-mode-popup').click(function(){
    	$('#safe-mode-popup').fadeOut('slow');
    });
});

FmlObject.LinkGo = function(link)
{
    if(typeof(link) == "string")
    {
        var href = link;
    }
    else
    {
        var href = link.attr('href');
    }
    if (in_array(href, ['/online','/home','/winks','/views','/favoursme','/messages','/favourites','/contacts','/blacklisted']) && (!window.location.indexOf('xxxbanners?lg') || !window.location.indexOf('2girlsteach?lg'))) {

        var loading = '<div class="center"><h3>Loading Page, Please Wait</h3><img src="'+ FmlObject.static_base +'img/blue-loader.gif" alt="Loading Images" /><p>This should only take a few moments.</p></div>';

        $('#content').html(loading);

        window.location.hash = '?' + href;
        $('#content').load(href + '?pagelet');
        $('#header_center ul li').removeClass('active');
        
        if(typeof(link) != "string")
        {
            link.parent().addClass('active');
        }

        return false;
    }
    else
    {
        return true;
    }
}

function TabChange(data)
{

    $prevHeight = $('.content_tabs li.active a').height();
    $currentTab = $('.content_tabs li.active a').attr('title');
    $('.content_tabs li').removeClass('active');
    $newHeight = $('#' + data.attr('title') + '.content_tabs_box').height();
    if($newHeight < 1)
    {
        $newHeight = $('#' + data.attr('title') + '-t.content_tabs_box').height();
    }
    $newHeight += $newHeightMargin;
    $prevThis   = data;

    if($.browser.msie && $.browser.version.substr(0,1) < 8)
    {
        $('.content_tabs_wrap:first').show(200, function() {

            $(this).height($newHeight + 'px');

            $('.content_tabs_box').hide();

            $('#' + $currentTab).hide();
            $('#' + $currentTab + '-t').hide();
            $('#' + $($prevThis).attr('title') + '.content_tabs_box').show();
            $('#' + $($prevThis).attr('title') + '-t.content_tabs_box').show();
        });
    }
    else
    {
        $('.content_tabs_wrap:first').animate({
            height: $newHeight + 'px'
        }, 200, function() {

            $('.content_tabs_box').hide();

            $('#' + $currentTab).hide();
            $('#' + $currentTab + '-t').hide();
            $('#' + $($prevThis).attr('title') + '.content_tabs_box').show();
            $('#' + $($prevThis).attr('title') + '-t.content_tabs_box').show();

        });
    }


    data.parent().addClass('active');
}

var allowed = false;

function isAllowed()
{
	return allowed;
}

FmlObject.Actions.Do = function(script,querystring){
    if (script == 'block') {
        var output = $.ajax({async:false, url: '/actions/'+ script +'.php?' + querystring}).responseText;
        window.location = '/?block=' + querystring.replace('profile_id=','');
    } else if (in_array(script, ['wink', 'favourite', 'like', 'warn', 'request-photos', 'send-gift'])) {
        var $title = '';
        switch (script) {
            case 'wink' :
                $title = 'Wink Sent';
            break;
            case 'like' :
                $title = 'Picture liked';
            break;
            case 'favourite' :
                $title = 'Favourite Added';
            break;
            case 'warn' :
                $title = 'Warning Sent';
            break;
            case 'request-photos' :
                $title = 'Photo Request Sent';
            break;
            case 'send-gift' :
                $title = 'Gift Sent';
            break;
        }

        var output = $.ajax({async:false, url: '/actions/'+ script +'.php?' + querystring}).responseText;
        if(output.substr(0,5) == 'eval|')
        {
            eval(output.substr(5));
        }
        else
        {
           FmlObject.Actions.ShowAlert(output);
        }
    }
    else
    {
        var output = $.ajax({async:false, url: '/actions/'+ script +'.php?' + querystring}).responseText;

        if(script == 'delete.message')
        {
            window.location = '/messages';
        }

        return output;
    }
}

FmlObject.Actions.GetResponse = function(script,querystring){
    var output = $.ajax({async:false, url: '/actions/'+ script +'.php?' + querystring}).responseText;
    return output;
}

FmlObject.Actions.MakeCall = function(script,querystring){
    $.ajax({async:true, url: '/actions/'+ script +'.php?' + querystring});
}

FmlObject.Actions.ValidateEmail = function(email){
   var reg = /^([a-z0-9_\-\.])+\@([a-z0-9_\-\.])+\.([a-z]{2,4})$/gim;
   return reg.test(email);
}

FmlObject.Actions.ClickTrack = function(ajaxurl){
    $.ajax({async:true, url: ajaxurl});
}

FmlObject.Actions.toJson = function(arr){
    var parts = [];
    var is_list = (Object.prototype.toString.apply(arr) === '[object Array]');

    for(var key in arr) {
        var value = arr[key];
        if(typeof value == "object") { //Custom handling for arrays
            if(is_list) parts.push(FmlObject.Actions.toJson(value)); /* :RECURSION: */
            else parts[key] = FmlObject.Actions.toJson(value); /* :RECURSION: */
        } else {
            var str = "";
            if(!is_list) str = '"' + key + '":';

            //Custom handling for multiple data types
            if(typeof value == "number") str += value; //Numbers
            else if(value === false) str += 'false'; //The booleans
            else if(value === true) str += 'true';
            else str += '"' + value + '"'; //All other things
            // :TODO: Is there any more datatype we should be in the lookout for? (Functions?)

            parts.push(str);
        }
    }
    var json = parts.join(",");

    if(is_list) return '[' + json + ']';//Return numerical JSON
    return '{' + json + '}';//Return associative JSON
}

FmlObject.Actions.UpgradeRequired = function(mode)
{
    var message = 'You must be a subscribed member to use this feature.  Would you like to upgrade now?';
    if(mode == 'stealth') message = 'The "Stealth Mode" upgrade must be on your account before you can use this feature.';
    if(confirm(message))
    {
        window.location = FmlObject.site_url + '/b?a=' + mode;
    }
}

var alertTimer = null;

FmlObject.Actions.ShowAlert = function(content,caption)
{
    if(content == 'null' || !(content != "undefined" && content && content.length > 0)) return true;
    if(!caption || caption.length < 1)
    {
        caption = 'Notification';
        if (content != "undefined" && content && content.length > 0) {
            var split = content.split("||", 2);
            if(split[1] != "undefined" && split[1] && split[1].length > 0)
            {
                caption = split[0];
                content = split[1];
            }
        }
    }
    clearTimeout(alertTimer);
    $('#popcontent').html(content);
    
	$('#alertpop').click(function(){
        //window.location = $('#alertpop .green-continue').attr('href');
	});
    
    $('#alertpop h1 em').text(caption);
    $('#alertpop').animate({height: 160},'slow',function(){
        $('#alertpop').css('display','block');
        $('#alertpop .green-continue').show();
    });
	if($("em").text() == 'Free Live Cams') {
		alertTimer = setTimeout("FmlObject.Actions.HideAlert()",40000);
	} else {
		alertTimer = setTimeout("FmlObject.Actions.HideAlert()",20000);
	}  
}

FmlObject.Actions.HideAlert = function()
{
    $('#alertpop .green-continue').hide();
    $('#alertpop').animate({height: 0},'slow',function(){
        $('#alertpop').css('display','none');
    });
}


function DoFmlAction(script,querystring,object)
{
	var scr 		= script;
	var script 		= script.replace('-button','');
    FmlObject.Actions.Do(script,querystring);

    if (object && in_array(scr, ['wink','favourite','block'])) object.children().animate({ opacity:0.3 },500);
    if (object && in_array(scr, ['request-photos', 'favourited-button'])) object.parent().animate({ opacity:0.3 },500);
    if (object && in_array(scr, ['wink-button'])) object.animate({ opacity:0.3 },500);
}


function resizeTab() {
    $currentTab = $('.content_tabs li.active a').attr('title');
    $newHeight = $('#' + $currentTab + '.content_tabs_box').height();
    if($newHeight < 1)
    {
        $newHeight = $('#' + $currentTab + '-t.content_tabs_box').height();
    }

    $newHeight  = $newHeight + 46;
    $('.content_tabs_wrap').animate({
        height: $newHeight + 'px'
    }, 200);
}



$(document).ready(function(){
    $('span').click(function(){
        if($(this).attr('title') != '')
        {
           var tmp = $(this).attr('title');
            $(this).attr('title',$(this).text());
            $(this).text(tmp);
            if($(this).hasClass('error'))
            {
                $(this).removeClass('error');
            }
            else
            {
                $(this).addClass('error');
            }
        }
    })


    $('input#subject').focus(function(){
        if($(this).val() == 'No Subject') $(this).val('');
    });

    $('input#subject').blur(function(){
        if($(this).val() == '') $(this).val('No Subject');
    });
    
    if(window.location.hash.length > 3)
    {
        if(window.location.hash.substr(0,3) == "#?/")
        {
            FmlObject.LinkGo(window.location.hash.substr(2));
        }
    }


});

function URLEncode(clearString) {
    var output = '';
    var x = 0;
    clearString = clearString.toString();
    var regex = /(^[a-zA-Z0-9_.]*)/;
    while (x < clearString.length) {
        var match = regex.exec(clearString.substr(x));
        if (match != null && match.length > 1 && match[1] != '') {
            output += match[1];
            x += match[1].length;
        } else {
            if (clearString[x] == ' ' || clearString[x] == 'ï¿½' || clearString[x] == "\n" || clearString[x] == "\r")
            output += '+';
            else {
                var charCode = clearString.charCodeAt(x);
                var hexVal = charCode.toString(16);
                output += '%' + ( hexVal.length < 2 ? '0' : '' ) + hexVal.toUpperCase();
            }
            x++;
        }
    }
    return output;
}
function in_array (needle, haystack, argStrict)
{
    var key = '', strict = !!argStrict;
    if (strict) { for (key in haystack) { if (haystack[key] === needle) { return true; } }
    } else { for (key in haystack) { if (haystack[key] == needle) { return true; } } }
    return false;
}

function createCookie(name,value,days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime()+(days*24*60*60*1000));
        var expires = "; expires="+date.toGMTString();
    }
    else var expires = "";
    document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++) {
        var c = ca[i];
        while (c.charAt(0)==' ') c = c.substring(1,c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
}

function eraseCookie(name) {
    createCookie(name,"",-1);
}

// * simple popup, PHP part in common.php
function DatingPopup(id)
{
	$('.dating-pop').hide();
	$('.dating-pop-overlay:first').fadeIn();
	$('#dating-pop-'+id).fadeIn();
}
function DatingPopupClose()
{
	$('.dating-pop').fadeOut();
	$('.dating-pop-overlay').fadeOut();
	
}

function ShowLifetimePopup(ajax_buy_tracking)
{
    if ($('#xmasPop').html().length > 0)
    {
        Lightbox.display('xmasPop','',650,false);
        $('#shadow').click(function(){ Lightbox.hideLightBox('xmasPop'); });
    }
    else
    {
        window.location.href = '/?ltime&source='+ajax_buy_tracking;
    }
}

function LaunchPopUnder(url)
{
	myWin = window.open('', 'winin','top=5,left=35,toolbar=0,menubar=0,scrollbars=1,status=1,resizable=1,location=0,height=800,width=665'); 
	myWin.focus(); 
	window.focus(); 
	myWin.location = url; 
	myWin.document.close();
}

var mood_status_offclick = true;
function MoodUpdate(mood_id, title)
{
	DoFmlAction('mood_status','mood='+mood_id);
	if ($('#sidebar #mood_status p').html() == 'How are you feeling?') { $('#sidebar #mood_status p').html('I\'m feeling...'); }
	$('#sidebar #mood_status h4#current_mood').html(title + '<img src="' + FmlObject.static_base + 'img/mood/arrow.png" />');
	$('#sidebar #mood_status img#current_mood_icon').attr('src',FmlObject.static_base + 'img/mood/' + mood_id + '.png');
}

var mood_status_hover = false;
$(document).ready(function() {
	mood_status_offclick = true;
	$('#sidebar #mood_status, #sidebar #mood_selection').mouseover(function(){
		mood_status_offclick = true
	});
	$('#sidebar #mood_status').click(function(){
		mood_status_offclick = false;
		$('#mood_selection').slideToggle();
	});
	
	$('#mood_status').mouseover(function(){
		mood_status_hover = true;
	}).mouseout(function(){
		mood_status_hover = false;
	});
	
	$(document).click(function(){
		if(!mood_status_hover)
			$("#sidebar #mood_selection").slideUp();
	});
});

;

/*
* bubbletip
*
* Copyright (c) 2009-2010, UhLeeKa.
* Version: 
*      1.0.6
* Licensed under the GNU Lesser General Public License:
*     http://www.gnu.org/licenses/lgpl-3.0.html
* Author Website: 
*     http://www.uhleeka.com
* Project Hosting on Google Code: 
*     http://code.google.com/p/bubbletip/
*/
; (function($) {
	var bindIndex = 0;
	$.fn.extend({
		bubbletip: function(tip, options) {
			// check to see if the tip is a descendant of 
			// a table.bubbletip element and therefore
			// has already been instantiated as a bubbletip
			if ($('table.bubbletip #' + $(tip).get(0).id).length > 0) {
				return this;
			}

			var _this, _tip, _options, _calc, _timeoutAnimate, _timeoutRefresh, _isActive, _isHiding, _wrapper, _bindIndex;
			// hack for IE6,IE7
			var _windowWidth, _windowHeight;

			_this = $(this);
			_tip = $(tip);
			_bindIndex = bindIndex++;  // for window.resize namespace binding
			_options = {
				positionAt: 'element', // element | body | mouse
				positionAtElement: _this,
				offsetTop: 0,
				offsetLeft: 0,
				deltaPosition: 30,
				deltaDirection: 'up', // direction: up | down | left | right
				animationDuration: 250,
				animationEasing: 'swing', // linear | swing
				bindShow: 'mouseover', // mouseover | focus | click | etc.
				bindHide: 'mouseout', // mouseout | blur | etc.
				delayShow: 0,
				delayHide: 800,
				calculateOnShow: false
			};
			if (options) {
				_options = $.extend(_options, options);
			}
			// calculated values
			_calc = {
				top: 0,
				left: 0,
				delta: 0,
				mouseTop: 0,
				mouseLeft: 0,
				tipHeight: 0,
				bindShow: (_options.bindShow + ' ').replace(/ +/g, '.bubbletip' + _bindIndex),
				bindHide: (_options.bindHide + ' ').replace(/ +/g, '.bubbletip' + _bindIndex)
			};
			_timeoutAnimate = null;
			_timeoutRefresh = null;
			_isActive = false;
			_isHiding = false;

			// store the tip id for removeBubbletip
			if (!_this.data('bubbletip_tips')) {
				_this.data('bubbletip_tips', [[_tip.get(0).id, _bindIndex]]);
			} else {
				_this.data('bubbletip_tips', $.merge(_this.data('bubbletip_tips'), [[_tip.get(0).id, _bindIndex]]));
			}


			// validate _options
			if (!_options.positionAt.match(/^element|body|mouse$/i)) {
				_options.positionAt = 'element';
			}
			if (!_options.deltaDirection.match(/^up|down|left|right$/i)) {
				_options.deltaDirection = 'up';
			}

			// create the wrapper table element
			if (_options.deltaDirection.match(/^up$/i)) {
				_wrapper = $('<table class="bubbletip" cellspacing="0" cellpadding="0"><tbody><tr><td class="bt-topleft"></td><td class="bt-top"></td><td class="bt-topright"></td></tr><tr><td class="bt-left"></td><td class="bt-content"></td><td class="bt-right"></td></tr><tr><td class="bt-bottomleft"></td><td><table class="bt-bottom" cellspacing="0" cellpadding="0"><tr><th></th><td><div></div></td><th></th></tr></table></td><td class="bt-bottomright"></td></tr></tbody></table>');
			} else if (_options.deltaDirection.match(/^down$/i)) {
				_wrapper = $('<table class="bubbletip" cellspacing="0" cellpadding="0"><tbody><tr><td class="bt-topleft"></td><td><table class="bt-top" cellspacing="0" cellpadding="0"><tr><th></th><td><div></div></td><th></th></tr></table></td><td class="bt-topright"></td></tr><tr><td class="bt-left"></td><td class="bt-content"></td><td class="bt-right"></td></tr><tr><td class="bt-bottomleft"></td><td class="bt-bottom"></td><td class="bt-bottomright"></td></tr></tbody></table>');
			} else if (_options.deltaDirection.match(/^left$/i)) {
				_wrapper = $('<table class="bubbletip" cellspacing="0" cellpadding="0"><tbody><tr><td class="bt-topleft"></td><td class="bt-top"></td><td class="bt-topright"></td></tr><tr><td class="bt-left"></td><td class="bt-content"></td><td class="bt-right-tail"><div class="bt-right"></div><div class="bt-right-tail"></div><div class="bt-right"></div></td></tr><tr><td class="bt-bottomleft"></td><td class="bt-bottom"></td><td class="bt-bottomright"></td></tr></tbody></table>');
			} else if (_options.deltaDirection.match(/^right$/i)) {
				_wrapper = $('<table class="bubbletip" cellspacing="0" cellpadding="0"><tbody><tr><td class="bt-topleft"></td><td class="bt-top"></td><td class="bt-topright"></td></tr><tr><td class="bt-left-tail"><div class="bt-left"></div><div class="bt-left-tail"></div><div class="bt-left"></div></td><td class="bt-content"></td><td class="bt-right"></td></tr><tr><td class="bt-bottomleft"></td><td class="bt-bottom"></td><td class="bt-bottomright"></td></tr></tbody></table>');
			}

			// append the wrapper to the document body
			_wrapper.appendTo('body');

			// apply IE filters to _wrapper elements


			// move the tip element into the content section of the wrapper
			$('.bt-content', _wrapper).append(_tip);
			// show the tip (in case it is hidden) so that we can calculate its dimensions
			_tip.show();
			// handle left|right delta
			if (_options.deltaDirection.match(/^left|right$/i)) {
				// tail is 40px, so divide height by two and subtract 20px;
				// ~~ daze : added +25 to overcome line-height issues.
				_calc.tipHeight = parseInt((_tip.height() + 25) / 2);
				// handle odd integer height
				if ((_tip.height() % 2) == 1) {
					_calc.tipHeight++;
				}
				_calc.tipHeight = (_calc.tipHeight < 20) ? 1 : _calc.tipHeight - 20;
				if (_options.deltaDirection.match(/^left$/i)) {
					$('div.bt-right', _wrapper).css('height', _calc.tipHeight + 'px');
				} else {
					$('div.bt-left', _wrapper).css('height', _calc.tipHeight + 'px');
				}
			}
			// set the opacity of the wrapper to 0
			_wrapper.css('opacity', 0);
			// hack for FF 3.6
			_wrapper.css({ 'width': _wrapper.width(), 'height': _wrapper.height() });
			// execute initial calculations
			_Calculate();
			_wrapper.hide();

			// handle window.resize
			$(window).bind('resize.bubbletip' + _bindIndex, function() {
				var w = $(window).width();
				var h = $(window).height();

				if ((w === _windowWidth) && (h === _windowHeight)) {
					return;
				}
				_windowWidth = w;
				_windowHeight = h;

				if (_timeoutRefresh) {
					clearTimeout(_timeoutRefresh);
				}
				_timeoutRefresh = setTimeout(function() {
					_Calculate();
				}, 250);
			});

			// handle mouseover and mouseout events
			$([_wrapper.get(0), this.get(0)]).bind(_calc.bindShow, function() {
				if (_timeoutAnimate) {
					clearTimeout(_timeoutAnimate);
				}
				if (_options.delayShow === 0) {
					_Show();
				} else {
					_timeoutAnimate = setTimeout(function() {
						_Show();
					}, _options.delayShow);
				}
				return false;
			}).bind(_calc.bindHide, function() {
				if (_timeoutAnimate) {
					clearTimeout(_timeoutAnimate);
				}
				if (_options.delayHide === 0) {
					_Hide();
				} else {
					_timeoutAnimate = setTimeout(function() {
						_Hide();
					}, _options.delayHide);
				}
				return false;
			});

			function _Show() {
				var animation;

				if (_isActive) { // the tip is currently showing; do nothing
					return;
				}
				_isActive = true;
				if (_isHiding) { // the tip is currently hiding; interrupt and start showing again
					_wrapper.stop(true, false);
				}

				if (_options.calculateOnShow) {
					_Calculate();
				}
				if (_options.positionAt.match(/^element|body$/i)) {
					if (_options.deltaDirection.match(/^up|down$/i)) {
						if (!_isHiding) {
							_wrapper.css('top', parseInt(_calc.top + _calc.delta) + 'px');
						}
						animation = { 'top': _calc.top + 'px' };
					} else {
						if (!_isHiding) {
							_wrapper.css('left', parseInt(_calc.left + _calc.delta) + 'px');
						}
						animation = { 'left': _calc.left + 'px' };
					}
				} else {
					if (_options.deltaDirection.match(/^up|down$/i)) {
						if (!_isHiding) {
							_calc.mouseTop = e.pageY + _calc.top;
							_wrapper.css({ 'top': parseInt(_calc.mouseTop + _calc.delta) + 'px', 'left': parseInt(e.pageX - (_wrapper.width() / 2)) + 'px' });
						}
						animation = { 'top': _calc.mouseTop + 'px' };
					} else {
						if (!_isHiding) {
							_calc.mouseLeft = e.pageX + _calc.left;
							_wrapper.css({ 'left': parseInt(_calc.mouseLeft + _calc.delta) + 'px', 'top': parseInt(e.pageY - (_wrapper.height() / 2)) + 'px' });
						}
						animation = { 'left': _calc.left + 'px' };
					}
				}

				// daze modification -- fixed a bug with the tabs hiding div's inside codabubble? weird.
				$('table.bubbletip td div').show();

				_isHiding = false;
				_wrapper.show();
				animation = $.extend(animation, { 'opacity': 1 });
				_wrapper.animate(animation, _options.animationDuration, _options.animationEasing, function() {
					_wrapper.css('opacity', '');
					_isActive = true;
				});
			};
			function _Hide() {
				var animation;

				_isActive = false;
				_isHiding = true;
				if (_options.positionAt.match(/^element|body$/i)) {
					if (_options.deltaDirection.match(/^up|down$/i)) {
						animation = { 'top': parseInt(_calc.top - _calc.delta) + 'px' };
					} else {
						animation = { 'left': parseInt(_calc.left - _calc.delta) + 'px' };
					}
				} else {
					if (_options.deltaDirection.match(/^up|down$/i)) {
						animation = { 'top': parseInt(_calc.mouseTop - _calc.delta) + 'px' };
					} else {
						animation = { 'left': parseInt(_calc.mouseLeft - _calc.delta) + 'px' };
					}
				}
				animation = $.extend(animation, { 'opacity': 0 });
				_wrapper.animate(animation, _options.animationDuration, _options.animationEasing, function() {
					_wrapper.hide();
					_isHiding = false;
				});
			};
			function _Calculate() {
				// calculate values
				if (_options.positionAt.match(/^element$/i)) {
					var offset = _options.positionAtElement.offset();
					if (_options.deltaDirection.match(/^up$/i)) {
						_calc.top = offset.top + _options.offsetTop - _wrapper.outerHeight();
						_calc.left = offset.left + _options.offsetLeft + ((_options.positionAtElement.outerWidth() - _wrapper.outerWidth()) / 2);
						_calc.delta = _options.deltaPosition;
					} else if (_options.deltaDirection.match(/^down$/i)) {
						_calc.top = offset.top + _options.positionAtElement.outerHeight() + _options.offsetTop;
						_calc.left = offset.left + _options.offsetLeft + ((_options.positionAtElement.outerWidth() - _wrapper.outerWidth()) / 2);
						_calc.delta = -_options.deltaPosition;
					} else if (_options.deltaDirection.match(/^left$/i)) {
						_calc.top = offset.top + _options.offsetTop + ((_options.positionAtElement.outerHeight() - _wrapper.outerHeight()) / 2);
						_calc.left = offset.left + _options.offsetLeft - _wrapper.outerWidth();
						_calc.delta = _options.deltaPosition;
					} else if (_options.deltaDirection.match(/^right$/i)) {
						_calc.top = offset.top + _options.offsetTop + ((_options.positionAtElement.outerHeight() - _wrapper.outerHeight()) / 2);
						_calc.left = offset.left + _options.positionAtElement.outerWidth() + _options.offsetLeft;
						_calc.delta = -_options.deltaPosition;
					}
				} else if (_options.positionAt.match(/^body$/i)) {
					if (_options.deltaDirection.match(/^up|left$/i)) {
						_calc.top = _options.offsetTop;
						_calc.left = _options.offsetLeft;
						// up or left
						_calc.delta = _options.deltaPosition;
					} else {
						if (_options.deltaDirection.match(/^down$/i)) {
							_calc.top = parseInt(_options.offsetTop + _wrapper.outerHeight());
							_calc.left = _options.offsetLeft;
						} else {
							_calc.top = _options.offsetTop;
							_calc.left = parseInt(_options.offsetLeft + _wrapper.outerWidth());
						}
						// down or right
						_calc.delta = -_options.deltaPosition;
					}
				} else if (_options.positionAt.match(/^mouse$/i)) {
					if (_options.deltaDirection.match(/^up|left$/i)) {
						if (_options.deltaDirection.match(/^up$/i)) {
							_calc.top = -(_options.offsetTop + _wrapper.outerHeight());
							_calc.left = _options.offsetLeft;
						} else if (_options.deltaDirection.match(/^left$/i)) {
							_calc.top = _options.offsetTop;
							_calc.left = -(_options.offsetLeft + _wrapper.outerWidth());
						}
						// up or left
						_calc.delta = _options.deltaPosition;
					} else {
						_calc.top = _options.offsetTop;
						_calc.left = _options.offsetLeft;
						// down or right
						_calc.delta = -_options.deltaPosition;
					}
				}
				// handle the wrapper (element|body) positioning
				if (_options.positionAt.match(/^element|body$/i)) {
					_wrapper.css({
						'position': 'absolute',
						'top': _calc.top + 'px',
						'left': _calc.left + 'px'
					});
				}
			};
			return this;
		},
		removeBubbletip: function(tips) {
			var tipsActive;
			var tipsToRemove = new Array();
			var tipsActiveAdjusted = new Array();
			var arr, i, ix;
			var elem;

			tipsActive = $.makeArray($(this).data('bubbletip_tips'));

			// convert the parameter array of tip id's or elements to id's
			arr = $.makeArray(tips);
			for (i = 0; i < arr.length; i++) {
				tipsToRemove.push($(arr[i]).get(0).id);
			}

			for (i = 0; i < tipsActive.length; i++) {
				ix = null;
				if ((tipsToRemove.length == 0) || ((ix = $.inArray(tipsActive[i][0], tipsToRemove)) >= 0)) {
					// remove all tips if there are none specified
					// otherwise, remove only specified tips

					// find the surrounding table.bubbletip
					elem = $('#' + tipsActive[i][0]).get(0).parentNode;
					while (elem.tagName.toLowerCase() != 'table') {
						elem = elem.parentNode;
					}
					// attach the tip element to body and hide
					$('#' + tipsActive[i][0]).appendTo('body').hide();
					// remove the surrounding table.bubbletip
					$(elem).remove();

					// unbind show/hide events
					$(this).unbind('.bubbletip' + tipsActive[i][1]);

					// unbind window.resize event
					$(window).unbind('.bubbletip' + tipsActive[i][1]);
				} else {
					// tip is not being removed, so add it to the adjusted array
					tipsActiveAdjusted.push(tipsActive[i]);
				}
			}
			$(this).data('bubbletip_tips', tipsActiveAdjusted);

			return this;
		}
	});
})(jQuery);;

(function($) {
  $.facebox = function(data, klass,caption) {
    $.facebox.loading()

    if (data.ajax) fillFaceboxFromAjax(data.ajax, klass,caption)
    else if (data.image) fillFaceboxFromImage(data.image, klass,caption)
    else if (data.div) fillFaceboxFromHref(data.div, klass,caption)
    else if ($.isFunction(data)) data.call($)
    else $.facebox.reveal(data, klass,caption)
  }


  $.extend($.facebox, {
    settings: {
      opacity      : 0.1,
      overlay      : true,
      loadingImage : 'http://static.static.findmelove.com//img/facebox/loading.gif',
      closeImage   : 'http://static.static.findmelove.com//img/facebox/close.png',
      imageTypes   : [ 'png', 'jpg', 'jpeg', 'gif' ],
      faceboxHtml  : '\
    <div id="facebox" style="display:none;"> \
      <div class="popup"> \
        <table> \
          <tbody> \
            <tr> \
              <td class="tl"/><td class="b"/><td class="tr"/> \
            </tr> \
            <tr> \
              <td class="b"/> \
              <td class="body"> \
              <div class="facebox-notification">\
              <a href="#" class="close"> \
                    <img src="http://static.static.findmelove.com//img/facebox/close.png" title="close" class="close_image" /> \
                  </a> \
              <span id="facebox-notify-caption">Notification</span></div>\
                <div class="content"> \
                </div> \
              </td> \
              <td class="b"/> \
            </tr> \
            <tr> \
              <td class="bl"/><td class="b"/><td class="br"/> \
            </tr> \
          </tbody> \
        </table> \
      </div> \
    </div>'
    },

    loading: function() {
      init()
      if ($('#facebox .loading').length == 1) return true
      showOverlay()

      $('#facebox .content').empty()
      $('#facebox .body').children().hide().end().
        append('<div class="loading"><img src="'+$.facebox.settings.loadingImage+'"/></div>')

      $('#facebox').css({
        top:	getPageScroll()[1] + (getPageHeight() / 10),
        left:	385.5
      }).show()

      $(document).bind('keydown.facebox', function(e) {
        if (e.keyCode == 27) $.facebox.close()
        return true
      })
      $(document).trigger('loading.facebox')
    },

    reveal: function(data, klass,caption) {
      $(document).trigger('beforeReveal.facebox')
      if (klass) $('#facebox .content').addClass(klass)
      $('#facebox .content').append(data)
      $('#facebox .loading').remove()
      $('#facebox .body').children().fadeIn('normal')
      $('#facebox').css('left', $(window).width() / 2 - ($('#facebox table').width() / 2))
      $(document).trigger('reveal.facebox').trigger('afterReveal.facebox')
      
      if(!caption) var caption = 'Notification';
      $('#facebox-notify-caption').text(caption);
    },

    close: function() {
      $(document).trigger('close.facebox')
      return false
    }
  })

  /*
   * Public, $.fn methods
   */

  $.fn.facebox = function(settings) {
    init(settings)

    function clickHandler() {
      $.facebox.loading(true)

      // support for rel="facebox.inline_popup" syntax, to add a class
      // also supports deprecated "facebox[.inline_popup]" syntax
      var klass = this.rel.match(/facebox\[?\.(\w+)\]?/)
      if (klass) klass = klass[1]

      fillFaceboxFromHref(this.href, klass)
      return false
    }

    return this.click(clickHandler)
  }

  /*
   * Private methods
   */

  // called one time to setup facebox on this page
  function init(settings) {
    if ($.facebox.settings.inited) return true
    else $.facebox.settings.inited = true

    $(document).trigger('init.facebox')
    makeCompatible()

    var imageTypes = $.facebox.settings.imageTypes.join('|')
    $.facebox.settings.imageTypesRegexp = new RegExp('\.' + imageTypes + '$', 'i')

    if (settings) $.extend($.facebox.settings, settings)
    $('body').append($.facebox.settings.faceboxHtml)

    var preload = [ new Image(), new Image() ]
    preload[0].src = $.facebox.settings.closeImage
    preload[1].src = $.facebox.settings.loadingImage

    $('#facebox').find('.b:first, .bl, .br, .tl, .tr').each(function() {
      preload.push(new Image())
      preload.slice(-1).src = $(this).css('background-image').replace(/url\((.+)\)/, '$1')
    })

    $('#facebox .close').click($.facebox.close)
    $('#facebox .close_image').attr('src', $.facebox.settings.closeImage)
  }
  
  // getPageScroll() by quirksmode.com
  function getPageScroll() {
    var xScroll, yScroll;
    if (self.pageYOffset) {
      yScroll = self.pageYOffset;
      xScroll = self.pageXOffset;
    } else if (document.documentElement && document.documentElement.scrollTop) {	 // Explorer 6 Strict
      yScroll = document.documentElement.scrollTop;
      xScroll = document.documentElement.scrollLeft;
    } else if (document.body) {// all other Explorers
      yScroll = document.body.scrollTop;
      xScroll = document.body.scrollLeft;	
    }
    return new Array(xScroll,yScroll) 
  }

  // Adapted from getPageSize() by quirksmode.com
  function getPageHeight() {
    var windowHeight
    if (self.innerHeight) {	// all except Explorer
      windowHeight = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
      windowHeight = document.documentElement.clientHeight;
    } else if (document.body) { // other Explorers
      windowHeight = document.body.clientHeight;
    }	
    return windowHeight
  }

  // Backwards compatibility
  function makeCompatible() {
    var $s = $.facebox.settings

    $s.loadingImage = $s.loading_image || $s.loadingImage
    $s.closeImage = $s.close_image || $s.closeImage
    $s.imageTypes = $s.image_types || $s.imageTypes
    $s.faceboxHtml = $s.facebox_html || $s.faceboxHtml
  }

  // Figures out what you want to display and displays it
  // formats are:
  //     div: #id
  //   image: blah.extension
  //    ajax: anything else
  function fillFaceboxFromHref(href, klass,caption) {
    // div
    if (href.match(/#/)) {
      var url    = window.location.href.split('#')[0]
      var target = href.replace(url,'')
      $.facebox.reveal($(target).clone().show(), klass,caption)

    // image
    } else if (href.match($.facebox.settings.imageTypesRegexp)) {
      fillFaceboxFromImage(href, klass,caption)
    // ajax
    } else {
      fillFaceboxFromAjax(href, klass,caption)
    }
  }

  function fillFaceboxFromImage(href, klass,caption) {
    var image = new Image()
    image.onload = function() {
      $.facebox.reveal('<div class="image"><img src="' + image.src + '" /></div>', klass,caption)
    }
    image.src = href
  }

  function fillFaceboxFromAjax(href, klass,caption) {
    $.get(href, function(data) { $.facebox.reveal(data, klass,caption) })
  }

  function skipOverlay() {
    return $.facebox.settings.overlay == false || $.facebox.settings.opacity === null 
  }

  function showOverlay() {
    if (skipOverlay()) return

    if ($('facebox_overlay').length == 0) 
      $("body").append('<div id="facebox_overlay" class="facebox_hide"></div>')

    $('#facebox_overlay').hide().addClass("facebox_overlayBG")
      .css('opacity', $.facebox.settings.opacity)
      .fadeIn(200);
      //.click(function() { $(document).trigger('close.facebox') })
    return false
  }

  function hideOverlay() {
    if (skipOverlay()) return

    $('#facebox_overlay').fadeOut(200, function(){
      $("#facebox_overlay").removeClass("facebox_overlayBG")
      $("#facebox_overlay").addClass("facebox_hide") 
      $("#facebox_overlay").remove()
      if($('#facebox input#no_remind').attr('checked'))
      {
		document.cookie="no-photo-remind=1";
      }
    })
    
    return false
  }

  /*
   * Bindings
   */

  $(document).bind('close.facebox', function() {
    $(document).unbind('keydown.facebox')
    $('#facebox').fadeOut(function() {
      $('#facebox .content').removeClass().addClass('content')
      hideOverlay()
      $('#facebox .loading').remove()
    })
  })

})(jQuery);
;

//setting lightbox
var Lightbox = {
    tempHTML: '',
    shadow: function() {
        var my_div = document.createElement('div');
        my_div.setAttribute('id', 'shadow');
        return my_div;
    },
    box: function(id, noclose) {
        var my_div = document.createElement('div');
        my_div.setAttribute('id', 'shadowBox');
        if (noclose != true) {
            my_div.innerHTML = '<div id="facebox" class="' + (typeof id != 'undefined' ? 'lightbox_'+id : '') + '"><div class="popup"> \
            <table> \
                <tbody> \
                    <tr> \
                        <td class="tl"/><td class="b"/><td class="tr"/> \
                    </tr> \
                    <tr> \
                        <td class="b"/> \
                        <td class="body"> \
                            <div class="facebox-notification">\
                                ' + ((typeof Lightbox.name != 'undefined') ? Lightbox.name : 'Edit Your Photos') + '\
                                <a href="javascript:Lightbox.hideLightBox(\'' + id + '\')" id="lightbox_close" style="margin:7px"> \
                                <img src="http://static.static.findmelove.com//img/facebox/close.png" title="close" class="close_image" /> \
                                </a> \
                            </div>\
                            <div class="content"> \
                            </div> \
                        </td> \
                        <td class="b"/> \
                    </tr> \
                    <tr> \
                        <td class="bl"/><td class="b"/><td class="br"/> \
                    </tr> \
                </tbody> \
            </table> \
        </div> \
        </div>';
        }
        return my_div;
    },
    hideLightBox: function(id) {
		$('#' + id).html($('#shadowBox td.body .content').html());
        $('#shadow').remove();
        $('#shadowBox').remove();
    },
    display: function(id, height, width, noclose){
    	
		this.tempHTML = $('#' + id).html();
		if (this.tempHTML.length > 0)
		{
			$('#' + id).html('');
	        var shadowEl         = this.shadow();
	        var boxEl            = this.box(id, noclose);
	        $(boxEl).find('.content').html(this.tempHTML);
	        if(height != '')
	            boxEl.style.height   = height + 'px';
	        boxEl.style.width    = width + 'px';
	        boxEl.style.position = 'absolute';
	        boxEl.style.zIndex   = 9999;
	        document.body.appendChild(shadowEl);
	        document.body.appendChild(boxEl);
	        window.location = '#';
	        this.center(boxEl);
	        if (typeof this.callback == 'function') {
	            this.callback();
	        }
		}
        

    },
    center: function(element){
        var my_width  = 0;
        var my_height = 0;

        if ( typeof( window.innerWidth ) == 'number' ){
            my_width  = window.innerWidth;
            my_height = window.innerHeight;
        }else if ( document.documentElement &&
                 ( document.documentElement.clientWidth ||
                   document.documentElement.clientHeight ) ){
            my_width  = document.documentElement.clientWidth;
            my_height = document.documentElement.clientHeight;
        }
        else if ( document.body &&
                ( document.body.clientWidth || document.body.clientHeight ) ){
            my_width  = document.body.clientWidth;
            my_height = document.body.clientHeight;
        }

        var scrollY = 0;

        if ( document.documentElement && document.documentElement.scrollTop ) {
            scrollY = document.documentElement.scrollTop;
        } else if ( document.body && document.body.scrollTop ) {
            scrollY = document.body.scrollTop;
        } else if ( window.pageYOffset ) {
            scrollY = window.pageYOffset;
        } else if ( window.scrollY ) {
            scrollY = window.scrollY;
        }

        var setX = ( my_width  - $(element).width()  ) / 2;
        var setY = ( my_height - $(element).height() ) / 4 + scrollY;

        setX = ( setX < 0 ) ? 0 : setX;
        setY = ( setY < 0 ) ? 0 : setY;

        element.style.left = setX + "px";
        element.style.top  = 50 + "px";

        element.style.display  = 'block';
    }
};

function PopUnder(url)
{
    return;
	if (window.SymRealWinOpen) { window.open = SymRealWinOpen; }
	if (window.NS_ActualOpen) { window.open = NS_ActualOpen; }

	popunder_win = window.open(url, '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,top=30,left=30,width=1100,height=800');

	if (popunder_win)
	{
		popunder_win.blur();
		popunder_win.window.opener.blur(); // Chrome
		window.focus();
	}
};

;

;

;

;

;

;

;

