/*
Macromedia(r) Flash(r) JavaScript Integration Kit License
Copyright (c) 2005 Macromedia, inc. All rights reserved.

/**
 * Create a new Exception object.
 * name: The name of the exception.
 * message: The exception message.
 */
function Exception(name, message)
{
    if (name)
        this.name = name;
    if (message)
        this.message = message;
}

/**
 * Set the name of the exception. 
 */
Exception.prototype.setName = function(name)
{
    this.name = name;
}

/**
 * Get the exception's name. 
 */
Exception.prototype.getName = function()
{
    return this.name;
}

/**
 * Set a message on the exception. 
 */
Exception.prototype.setMessage = function(msg)
{
    this.message = msg;
}

/**
 * Get the exception message. 
 */
Exception.prototype.getMessage = function()
{
    return this.message;
}

/**
 * Generates a browser-specific Flash tag. Create a new instance, set whatever
 * properties you need, then call either toString() to get the tag as a string, or
 * call write() to write the tag out.
 */

/**
 * Creates a new instance of the FlashTag.
 * src: The path to the SWF file.
 * width: The width of your Flash content.
 * height: the height of your Flash content.
 */
function FlashTag(src, width, height)
{
    this.src       = src;
    this.width     = width;
    this.height    = height;
    this.version   = '7,0,14,0';
    this.id        = null;
    this.style     = null;
    this.bgcolor   = 'ffffff';
	this.flashVars = null;
	this.allowNetworking = null;
    this.wmode     = null; // MSI
    this.base      = null; // MSI
    this.allowscriptaccess      = null; // MSI
}

/**
 * Sets the Flash version used in the Flash tag.
 */
FlashTag.prototype.setVersion = function(v)
{
    this.version = v;
}

/**
 * Sets the ID used in the Flash tag.
 */
FlashTag.prototype.setId = function(id)
{
    this.id = id;
}


/**
 * Sets the ID used in the Flash tag.
 */
FlashTag.prototype.setStyle = function(style)
{
    this.style = style;
}

/**
 * Sets the background color used in the Flash tag.
 */
FlashTag.prototype.setBgcolor = function(bgc)
{
    this.bgcolor = bgc;
}



/**
 * Sets any variables to be passed into the Flash content. 
 */
FlashTag.prototype.setFlashvars = function(fv)
{
    this.flashVars = fv;
}

// Begin MSI



FlashTag.prototype.setAllowNetworking = function(n)
{
    this.allowNetworking = n;
}

/**
 * Sets wmode
 */
FlashTag.prototype.setWmode = function(wm)
{
    this.wmode = wm;
}

/**
 * Sets base
 */
FlashTag.prototype.setBase = function(b)
{
    this.base = b;
}

/**
 * Sets allowscriptaccess
 */
FlashTag.prototype.setAllowScriptAccess = function(b)
{
    this.allowscriptaccess = b;
}

// End MSI

/**
 * Get the Flash tag as a string. 
 */
FlashTag.prototype.toString = function()
{
    var ie = (navigator.appName.indexOf ("Microsoft") != -1) ? 1 : 0;
    var flashTag = new String();
    if (ie)
    {
        flashTag += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
        if (this.id != null)
        {
           flashTag += 'name="'+this.id+'" ';
           flashTag += 'id="'+this.id+'" ';
        }
        if (this.style != null)
        {
            flashTag += 'style="'+this.style+'" ';
		}
		flashTag += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+this.version+'" ';
        flashTag += 'width="'+this.width+'" ';
        flashTag += 'height="'+this.height+'">';
        flashTag += '<param name="movie" value="'+this.src+'"/>';
        flashTag += '<param name="quality" value="high"/>';
        flashTag += '<param name="bgcolor" value="#'+this.bgcolor+'"/>';
        if (this.flashVars != null)
        {
            flashTag += '<param name="flashvars" value="'+this.flashVars+'"/>';
        }
        // Begin MSI
        if (this.allowNetworking != null)
        {
            flashTag += '<param name="allowNetworking" value="'+this.allowNetworking+'"/>';
        }
        if (this.wmode != null)
        {
            flashTag += '<param name="wmode" value="'+this.wmode+'"/>';
        }
        if (this.base != null)
        {
            flashTag += '<param name="base" value="'+this.base+'"/>';
        }
        if (this.allowscriptaccess != null)
        {
            flashTag += '<param name="allowscriptaccess" value="'+this.allowscriptaccess+'"/>';
        }
        // End MSI
        flashTag += '</object>';
    }
    else
    {
        flashTag += '<embed src="'+this.src+'" ';
        flashTag += 'quality="high" '; 
        flashTag += 'bgcolor="#'+this.bgcolor+'" ';
        flashTag += 'width="'+this.width+'" ';
        flashTag += 'height="'+this.height+'" ';
        flashTag += 'type="application/x-shockwave-flash" ';
        if (this.flashVars != null)
        {
           flashTag += 'flashvars="'+this.flashVars+'" ';
        }
        if (this.style != null)
        {
            flashTag += 'style="'+this.style+'" ';
		}
      // Begin MSI
        if (this.allowNetworking != null)
        {
           flashTag += 'allowNetworking="'+this.allowNetworking+'" ';
        }
		if (this.wmode != null)
        {
            flashTag += 'wmode="'+this.wmode+'" ';
        }
        if (this.base != null)
        {
            flashTag += 'base="'+this.base+'" ';
        }
        if (this.allowscriptaccess != null)
        {
            flashTag += 'allowscriptaccess="'+this.allowscriptaccess+'" ';
        }
        // End MSI
        if (this.id != null)
        {
            flashTag += 'name="'+this.id+'" ';
            flashTag += 'id="'+this.id+'" ';
        }
        flashTag += 'pluginspage="http://www.macromedia.com/go/getflashplayer">';
        flashTag += '</embed>';
    }
    return flashTag;
}

/**
 * Write the Flash tag out. Pass in a reference to the document to write to. 
 */
FlashTag.prototype.write = function(doc)
{
    doc.write(this.toString());
}

/**
 * The FlashSerializer serializes JavaScript variables of types object, array, string,
 * number, date, boolean, null or undefined into XML. 
 */

/**
 * Create a new instance of the FlashSerializer.
 * useCdata: Whether strings should be treated as character data. If false, strings are simply XML encoded.
 */
function FlashSerializer(useCdata)
{
    this.useCdata = useCdata;
}

/**
 * Serialize an array into a format that can be deserialized in Flash. Supported data types are object,
 * array, string, number, date, boolean, null, and undefined. Returns a string of serialized data.
 */
FlashSerializer.prototype.serialize = function(args)
{
    var qs = new String();

    for (var i = 0; i < args.length; ++i)
    {
        switch(typeof(args[i]))
        {
            case 'undefined':
                qs += 't'+(i)+'=undf';
                break;
            case 'string':
                qs += 't'+(i)+'=str&d'+(i)+'='+escape(args[i]);
                break;
            case 'number':
                qs += 't'+(i)+'=num&d'+(i)+'='+escape(args[i]);
                break;
            case 'boolean':
                qs += 't'+(i)+'=bool&d'+(i)+'='+escape(args[i]);
                break;
            case 'object':
                if (args[i] == null)
                {
                    qs += 't'+(i)+'=null';
                }
                else if (args[i] instanceof Date)
                {
                    qs += 't'+(i)+'=date&d'+(i)+'='+escape(args[i].getTime());
                }
                else // array or object
                {
                    try
                    {
                        qs += 't'+(i)+'=xser&d'+(i)+'='+escape(this._serializeXML(args[i]));
                    }
                    catch (exception)
                    {
                        throw new Exception("FlashSerializationException",
                                            "The following error occurred during complex object serialization: " + exception.getMessage());
                    }
                }
                break;
            default:
                throw new Exception("FlashSerializationException",
                                    "You can only serialize strings, numbers, booleans, dates, objects, arrays, nulls, and undefined.");
        }

        if (i != (args.length - 1))
        {
            qs += '&';
        }
    }

    return qs;
}

/**
 * Private
 */
FlashSerializer.prototype._serializeXML = function(obj)
{
    var doc = new Object();
    doc.xml = '<fp>'; 
    this._serializeNode(obj, doc, null);
    doc.xml += '</fp>'; 
    return doc.xml;
}

/**
 * Private
 */
FlashSerializer.prototype._serializeNode = function(obj, doc, name)
{
    switch(typeof(obj))
    {
        case 'undefined':
            doc.xml += '<undf'+this._addName(name)+'/>';
            break;
        case 'string':
            doc.xml += '<str'+this._addName(name)+'>'+this._escapeXml(obj)+'</str>';
            break;
        case 'number':
            doc.xml += '<num'+this._addName(name)+'>'+obj+'</num>';
            break;
        case 'boolean':
            doc.xml += '<bool'+this._addName(name)+' val="'+obj+'"/>';
            break;
        case 'object':
            if (obj == null)
            {
                doc.xml += '<null'+this._addName(name)+'/>';
            }
            else if (obj instanceof Date)
            {
                doc.xml += '<date'+this._addName(name)+'>'+obj.getTime()+'</date>';
            }
            else if (obj instanceof Array)
            {
                doc.xml += '<array'+this._addName(name)+'>';
                for (var i = 0; i < obj.length; ++i)
                {
                    this._serializeNode(obj[i], doc, null);
                }
                doc.xml += '</array>';
            }
            else
            {
                doc.xml += '<obj'+this._addName(name)+'>';
                for (var n in obj)
                {
                    if (typeof(obj[n]) == 'function')
                        continue;
                    this._serializeNode(obj[n], doc, n);
                }
                doc.xml += '</obj>';
            }
            break;
        default:
            throw new Exception("FlashSerializationException",
                                "You can only serialize strings, numbers, booleans, objects, dates, arrays, nulls and undefined");
            break;
    }
}

/**
 * Private
 */
FlashSerializer.prototype._addName= function(name)
{
    if (name != null)
    {
        return ' name="'+name+'"';
    }
    return '';
}

/**
 * Private
 */
FlashSerializer.prototype._escapeXml = function(str)
{
    if (this.useCdata)
        return '<![CDATA['+str+']]>';
    else
        return str.replace(/&/g,'&amp;').replace(/</g,'&lt;');
}

/**
 * The FlashProxy object is what proxies function calls between JavaScript and Flash.
 * It handles all argument serialization issues.
 */

/**
 * Instantiates a new FlashProxy object. Pass in a uniqueID and the name (including the path)
 * of the Flash proxy SWF. The ID is the same ID that needs to be passed into your Flash content as lcId.
 */
function FlashProxy(uid, proxySwfName)
{
    this.uid = uid;
    this.proxySwfName = proxySwfName;
    this.flashSerializer = new FlashSerializer(false);
}

/**
 * Call a function in your Flash content.  Arguments should be:
 * 1. ActionScript function name to call,
 * 2. any number of additional arguments of type object,
 *    array, string, number, boolean, date, null, or undefined. 
 */
FlashProxy.prototype.call = function()
{
    if (arguments.length == 0)
    {
        throw new Exception("Flash Proxy Exception",
                            "The first argument should be the function name followed by any number of additional arguments.");
    }

    var qs = 'lcId=' + escape(this.uid) + '&functionName=' + escape(arguments[0]);

    if (arguments.length > 1)
    {
        var justArgs = new Array();
        for (var i = 1; i < arguments.length; ++i)
        {
            justArgs.push(arguments[i]);
        }
        qs += ('&' + this.flashSerializer.serialize(justArgs));
    }

	var divName = '_flash_proxy_' + this.uid;
    if(!document.getElementById(divName))
    {
        var newTarget = document.createElement("div");
        newTarget.id = divName;
        document.body.appendChild(newTarget);
    }
    var target = document.getElementById(divName);
    var ft = new FlashTag(this.proxySwfName, 1, 1);
    ft.setVersion('6,0,65,0');
    ft.setFlashvars(qs);
	ft.setId('tempObj');
	target.innerHTML = ft.toString();
}


/**
 * This is the function that proxies function calls from Flash to JavaScript.
 * It is called implicitly.
 */
FlashProxy.callJS = function()
{
    var functionToCall = eval(arguments[0]);
    var argArray = new Array();
    for (var i = 1; i < arguments.length; ++i)
    {
        argArray.push(arguments[i]);
    }
    functionToCall.apply(functionToCall, argArray);
}



/***************************************************************************************************************
************	OmniDate Include
***************************************************************************************************************/
var Omni_BannerProxy;
var Omni_AppProxy;
var Omni_lcId = new Date().getTime();
var Omni_Unique = 1;

var Omni_data = "";

var Omni_DefaultFreq = 10;
var Omni_Frequency = Omni_DefaultFreq;
var PingInterval = 0;
var Omni_ArStatus = [];
var Omni_Unique = 0;

var Omni_userid = "";
var username = "";
var Omni_gender = "";
var Omni_dbid = "";
var siteCode = "";
var dating = "";

var You = "";
var YourId = "";
var YourName = "";
var YourGender = "";
var YourGraphicServer = "64.34.169.15";

var YourDate = "";
var YourDateId = "";
var YourDateName = "";
var YourDateGender = "";
var YourDateGraphicServer = "64.34.169.15";

var Omni_Table = "";
var StorylineFile = "";
var Omni_premium = "";
var Omni_premiumpop = false;
var Omni_premiumxml = "";
var Omni_userxml = ""
var DateStatus = "";
var Omni_avatars = "";
var Omni_survey = "";
var Omni_lang = "";
var Omni_verb = "";
var Omni_Popup = "";
var Omni_alert = "";
var Omni_appver = "";
var Omni_chatver = "";
var Omni_abver = "";
var Omni_mode = ""
var Omni_ProfileAr = new Object;

var Omni_ChatServer = "";
var Omni_ShowDate = "";
var Omni_profiletype = "userid";
var Omni_setcaller = "";
var Omni_movetype = "window.location.href";
var Omni_sound = "true";
var Omni_AppMode = null;
var Omni_userclass = "";
var Omni_regurl = "";

var LoadStarted = false;
var InviteOverShowing = false;
var DateHasBeenRequested = false;
var TimeRemaining = "";
var BannerShowing = false;
var AreWeOnADate = false

var Omnidate_Server_1 = "70.33.254.125";
var Omnidate_Server_2 = "66.135.38.88";
var Omnidate_Server = Omnidate_Server_2;
var Omni_Server = "http://www.omnidate.net/";
var Omni_PFServer = "98.175.249.86";
var Omni_postdate = "";
var Omni_bannerStyle = "";
var Omni_profile = "";
var Omni_RTL = "";
var Omni_RTL2 = "";
var Omni_RTL3 = "";

var IgnorePingReturn = false;
var InviteInProgress = false;
var UserInfoSetOnPing = false;
var Omni_Debugging = false;
var Omni_isChrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
var Omni_isSafari = (navigator.userAgent.toLowerCase().indexOf('safari') > -1) && (navigator.userAgent.toLowerCase().indexOf('chrome') == -1);
var Omni_isFirefox = (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent));
var Omni_isExplorer = (/MSIE (\d+\.\d+);/.test(navigator.userAgent));
var Omni_QuirksMode = (document.compatMode != 'CSS1Compat');
var Omni_Safari_Hitch = false;
if (Omni_isSafari)
{
	var Omni_Safari_Ver = navigator.appVersion.substr(navigator.appVersion.toLowerCase().indexOf('version/')+8, 3);
	if (Omni_Safari_Ver.charAt(0) == '5' && Omni_Safari_Ver.charAt(0) != 0)
		Omni_Safari_Hitch = true;
}


var Omni_nAgt = navigator.userAgent;
var Omni_browserName  = navigator.appName;
var Omni_fullVersion  = ''+parseFloat(navigator.appVersion); 
var Omni_majorVersion = parseInt(navigator.appVersion,10);
var Omni_nameOffset,Omni_verOffset,Omni_ix;

if ((Omni_verOffset=Omni_nAgt.indexOf("MSIE"))!=-1) {
 Omni_browserName = "MSIE";
 Omni_fullVersion = Omni_nAgt.substring(Omni_verOffset+5);
}
else if ((Omni_verOffset=Omni_nAgt.indexOf("Opera"))!=-1) {
 Omni_browserName = "Opera";
 Omni_fullVersion = Omni_nAgt.substring(Omni_verOffset+6);
}
else if ((Omni_verOffset=Omni_nAgt.indexOf("Chrome"))!=-1) {
 Omni_browserName = "Chrome";
 Omni_fullVersion = Omni_nAgt.substring(Omni_verOffset+7);
}
else if ((Omni_verOffset=Omni_nAgt.indexOf("Safari"))!=-1) {
 Omni_browserName = "Safari";
 Omni_fullVersion = Omni_nAgt.substring(Omni_verOffset+7);
}
else if ((Omni_verOffset=Omni_nAgt.indexOf("Firefox"))!=-1) {
 Omni_browserName = "Firefox";
 Omni_fullVersion = Omni_nAgt.substring(Omni_verOffset+8);
}
else if ( (Omni_nameOffset=Omni_nAgt.lastIndexOf(' ')+1) < (Omni_verOffset=Omni_nAgt.lastIndexOf('/')) ) 
{
 Omni_browserName = Omni_nAgt.substring(Omni_nameOffset,Omni_verOffset);
 Omni_fullVersion = Omni_nAgt.substring(Omni_verOffset+1);
 if (Omni_browserName.toLowerCase()==Omni_browserName.toUpperCase()) {
  Omni_browserName = navigator.appName;
 }
}
if ((Omni_ix=Omni_fullVersion.indexOf(";"))!=-1) Omni_fullVersion=Omni_fullVersion.substring(0,Omni_ix);
if ((Omni_ix=Omni_fullVersion.indexOf(" "))!=-1) Omni_fullVersion=Omni_fullVersion.substring(0,Omni_ix);

Omni_majorVersion = parseInt(''+Omni_fullVersion,10);
if (isNaN(Omni_majorVersion)) {
 Omni_fullVersion  = ''+parseFloat(navigator.appVersion); 
 Omni_majorVersion = parseInt(navigator.appVersion,10);
}


/***************************************************************************************************************
************	Button UI Default Values
***************************************************************************************************************/
var Button01 = new Object;
Button01.offline = Omni_Server + "images/od-offline.gif";
Button01.online = Omni_Server + "images/od-online.gif";
Button01.inactive = Omni_Server + "images/od-online2.gif";
Button01.dating = Omni_Server + "images/od-dating.gif";
Button01.info = Omni_Server + "images/info04.png";
Button01.height = "18";
Button01.width = "65";
Button01.iheight = "18";
Button01.iwidth = "18";

var Button02 = new Object;
Button02.offline = Omni_Server + "images/od2-offline.gif";
Button02.online = Omni_Server + "images/od2-online.gif";
Button02.inactive = Omni_Server + "images/od2-online2.gif";
Button02.dating = Omni_Server + "images/od2-dating.gif";
Button02.info = Omni_Server + "images/od2-info.gif";
Button02.iposition = "bottom";
Button02.height = "37";
Button02.width = "41";
Button02.iheight = "12";
Button02.iwidth = "41";

var Button03 = new Object;
Button03.offline = Omni_Server + "images/pq-offline.gif";
Button03.online = Omni_Server + "images/pq-online.gif";
Button03.inactive = Omni_Server + "images/pq-inactive.gif";
Button03.dating = Omni_Server + "images/pq-dating.gif";
Button03.info = Omni_Server + "images/info04.png";
Button03.height = "18";
Button03.width = "84";
Button03.iheight = "18";
Button03.iwidth = "18";

var Button04 = new Object;
Button04.offline = Omni_Server + "images/btn04-offline.gif";
Button04.online = Omni_Server + "images/btn04-online.gif";
Button04.inactive = Omni_Server + "images/btn04-inactive.gif";
Button04.dating = Omni_Server + "images/btn04-dating.gif";
Button04.info = Omni_Server + "images/info06.png";
Button04.height = "28";
Button04.width = "170";
Button04.iheight = "28";
Button04.iwidth = "28";

var Button05 = new Object;
Button05.offline = Omni_Server + "images/btn05-offline.gif";
Button05.online = Omni_Server + "images/btn05-online.gif";
Button05.inactive = Omni_Server + "images/btn05-inactive.gif";
Button05.dating = Omni_Server + "images/btn05-dating.gif";
Button05.info = Omni_Server + "images/info05.png";
Button05.height = "25";
Button05.width = "160";
Button05.iheight = "25";
Button05.iwidth = "25";

var Button06 = new Object;
Button06.offline = Omni_Server + "images/btn06-offline.gif";
Button06.online = Omni_Server + "images/btn06-online.gif";
Button06.inactive = Omni_Server + "images/btn06-inactive.gif";
Button06.dating = Omni_Server + "images/btn06-dating.gif";
Button06.info = Omni_Server + "images/info06.png";
Button06.height = "30";
Button06.width = "90";
Button06.iheight = "28";
Button06.iwidth = "28";

var Button07 = new Object;
Button07.offline = Omni_Server + "images/btn07-offline.png";
Button07.online = Omni_Server + "images/btn07-online.png";
Button07.inactive = Omni_Server + "images/btn07-inactive.png";
Button07.dating = Omni_Server + "images/btn07-dating.png";
Button07.info = Omni_Server + "images/info06.png";
Button07.height = "28";
Button07.width = "86";
Button07.iheight = "28";
Button07.iwidth = "28";

var Button08 = new Object;
Button08.offline = Omni_Server + "images/btn08-offline.png";
Button08.online = Omni_Server + "images/btn08-online.png";
Button08.inactive = Omni_Server + "images/btn08-inactive.png";
Button08.dating = Omni_Server + "images/btn08-dating.png";
Button08.info = Omni_Server + "images/info05.png";
Button08.height = "28";
Button08.width = "124";
Button08.iheight = "25";
Button08.iwidth = "25";

var ButtonSTB01 = new Object;
ButtonSTB01.offline = Omni_Server + "images/stb1-offline.gif";
ButtonSTB01.online = Omni_Server + "images/stb1-online.gif";
ButtonSTB01.inactive = Omni_Server + "images/stb1-inactive.gif";
ButtonSTB01.dating = Omni_Server + "images/stb1-dating.gif";
ButtonSTB01.info = Omni_Server + "images/info04.png";
ButtonSTB01.height = "18";
ButtonSTB01.width = "135";
ButtonSTB01.iheight = "18";
ButtonSTB01.iwidth = "18";

var ButtonSTB02 = new Object;
ButtonSTB02.offline = Omni_Server + "images/stb2-inactive.gif";
ButtonSTB02.online = Omni_Server + "images/stb2-online.gif";
ButtonSTB02.inactive = Omni_Server + "images/stb2-inactive.gif";
ButtonSTB02.dating = Omni_Server + "images/stb2-dating.gif";
ButtonSTB02.info = Omni_Server + "images/stb2-info.gif";
ButtonSTB02.height = "20";
ButtonSTB02.width = "62";
ButtonSTB02.iheight = "20";
ButtonSTB02.iwidth = "20";

var AFui01 = new Object;
AFui01.offline = Omni_Server + "images/af-offline.gif";
AFui01.online = Omni_Server + "images/af-online.gif";
AFui01.inactive = Omni_Server + "images/af-inactive.gif";
AFui01.dating = Omni_Server + "images/af-dating.gif";
AFui01.info = Omni_Server + "images/info04.png";
AFui01.height = "18";
AFui01.width = "65";
AFui01.iheight = "18";
AFui01.iwidth = "18";

var AFui02 = new Object;
AFui02.offline = Omni_Server + "images/af-offline2.gif";
AFui02.online = Omni_Server + "images/af-online2.gif";
AFui02.inactive = Omni_Server + "images/af-inactive2.gif";
AFui02.dating = Omni_Server + "images/af-dating2.gif";
AFui02.info = Omni_Server + "images/info04.png";
AFui02.height = "29";
AFui02.width = "129";
AFui02.iheight = "18";
AFui02.iwidth = "18";

var ButtonTW01 = new Object;
ButtonTW01.offline = Omni_Server + "images/od-offline.gif";
ButtonTW01.online = Omni_Server + "images/od-online.gif";
ButtonTW01.inactive = Omni_Server + "images/od-online2.gif";
ButtonTW01.dating = Omni_Server + "images/od-dating.gif";
ButtonTW01.info = "";
ButtonTW01.height = "18";
ButtonTW01.width = "65";
ButtonTW01.iheight = "0";
ButtonTW01.iwidth = "0";


var ButtonTW02 = new Object;
ButtonTW02.offline = Omni_Server + "images/btnTW-offline.png";
ButtonTW02.online = Omni_Server + "images/btnTW-online.png";
ButtonTW02.inactive = Omni_Server + "images/btnTW-inactive.png";
ButtonTW02.dating = Omni_Server + "images/btnTW-dating.png";
ButtonTW02.info = "";
ButtonTW02.height = "24";
ButtonTW02.width = "89";
ButtonTW02.iheight = "0";
ButtonTW02.iwidth = "0";


var ButtonSpark01 = new Object;
ButtonSpark01.offline = Omni_Server + "images/btn-offline.png";
ButtonSpark01.online = Omni_Server + "images/btn-date-me.png";
ButtonSpark01.inactive = Omni_Server + "images/btn-inactive.png";
ButtonSpark01.dating = Omni_Server + "images/btn-dating.png";
ButtonSpark01.info = Omni_Server + "images/info03.png";
ButtonSpark01.height = "16";
ButtonSpark01.width = "78";
ButtonSpark01.iheight = "16";
ButtonSpark01.iwidth = "20";

// Add to master array
var uiDefaults = new Object;
uiDefaults['Button01'] = Button01;
uiDefaults['Button02'] = Button02;
uiDefaults['Button03'] = Button03;
uiDefaults['Button04'] = Button04;
uiDefaults['Button05'] = Button05;
uiDefaults['Button06'] = Button06;
uiDefaults['Button07'] = Button07;
uiDefaults['Button08'] = Button08;
uiDefaults['ButtonSTB01'] = ButtonSTB01;
uiDefaults['ButtonSTB02'] = ButtonSTB02;
uiDefaults['AFui01'] = AFui01;
uiDefaults['AFui02'] = AFui02;
uiDefaults['ButtonTW01'] = ButtonTW01;
uiDefaults['ButtonTW02'] = ButtonTW02;
uiDefaults['Spark01'] = ButtonSpark01;

var uiObj;
var btnUiAr = new Object;

var Hover01 = new Object;
if (Omni_lang == "he")
{
	Hover01.offline = "";
	Hover01.online = "הזמן את החבר לאון-ליין דייט";
	Hover01.inactive = "לא ניתן להזמין את החבר הזה כרגע";
	Hover01.dating = "החבר באון ליין דייט";
	Hover01.info = "לבחירת הדמות האישית שלך";
}


else
{
	Hover01.offline = "Unavailable for a Virtual Date. Message them now to schedule a date.";
	Hover01.online = "Invite this user on a Virtual Date now!";
	Hover01.inactive = "You cannot Invite this user right now.";
	Hover01.dating = "This user is on a Virtual Date.";
	Hover01.info = "Select Your Virtual Avatar";
}

var Hover02 = new Object;
Hover02.offline = "Unavailable for a Virtual Chat. Message them now to schedule a chat later.";
Hover02.online = "Invite this user to Virtually Chat now!";
Hover02.inactive = "You cannot invite this user right now.";
Hover02.dating = "This user is busy in a Virtual Chat.";
Hover02.info = "";


// Add to master array
var omniHoverAr = new Object;
omniHoverAr['Hover01'] = Hover01;
omniHoverAr['Hover02'] = Hover02;
var btnTextObj;
var btnHoverAr = new Object;

function OmniTime()
{
	var d = new Date();
	var time = ((d.getHours() < 10) ? ("0"+d.getHours()) : d.getHours()) + ":";
	time += ((d.getMinutes() < 10) ? ("0"+d.getMinutes()) : d.getMinutes()) + ":";
	time += ((d.getSeconds() < 10) ? ("0"+d.getSeconds()) : d.getSeconds()) + ".";
	if (d.getMilliseconds() < 10)
		time += "00" + d.getMilliseconds();
	else if (d.getMilliseconds() < 100)
		time += "0" + d.getMilliseconds();
	else
		time += d.getMilliseconds();

	return "[" + time + "] ";
}

function StopStartTrace()
{
	Omni_Debugging = !Omni_Debugging;
}

/***************************************************************************************************************
************	Registration and Broadcasting
***************************************************************************************************************/

/**************/
WriteCounter("Waiting to start ping...");
var SinceLastPing = 0;
var StartPing = 0; // interval
var OmniEvent700Logged = false;

function CountPings()
{
	SinceLastPing++;

	var event700 = SinceLastPing;
	WriteCounter(event700);
	event700 += "/" + OmniPageAge.toString();
	event700 += "/" + BeenOnADateThisSession.toString();
	event700 += "/" + AreWeOnADate.toString();
	event700 += "/" + Omni_NumPingsSent.toString();
	event700 += "/" + Omni_NumPingsReturned.toString();
	event700 += ", " + OmniTime();

	if (SinceLastPing % 30 == 0 && !OmniEvent700Logged)
	{
		var event700Str = "http://" + Omnidate_Server + "/od/log.aspx?dbid=" + Omni_dbid +"&userid=" + Omni_userid + "&eventid=700";
		event700Str += '&data=' + encodeURIComponent(Omni_browserName + " " + Omni_fullVersion + ", " + Omni_lcId.toString().substr(8) + ", " + event700);
		event700Str += "&jsonp=?";

		jQuery.getJSON(event700Str, 
			function(p)
			{
				ResetPings("Event 700 Logged");
				OmniEvent700Logged = true;
				ReestablishPings();
			}
		);
	}
}
function ResetPings(_s)
{
	SinceLastPing = 0;
	clearInterval(StartPing)
	StartPing = 0;
	WriteCounter(_s);
}
var s_debug = "";
function WriteCounter(_s)
{
	if (Omni_Debugging)
	{
		s_debug += _s + "<br />";
		jQuery("#counter").html(s_debug);
	}
}
/**************/




var SendingPing = false;
var Omni_NumPingsSent = 0;
var Omni_NumPingsReturned = 0;

// Pinging function
function Send()
{
	if (Omni_userid == "")
		return;

	if (SendingPing)
		return;
	SendingPing = true;

	Omni_data = "";
	if (PingInterval != 0)
	{
		clearInterval(PingInterval);
		PingInterval = 0;
	}

	// Accumulate a string of the active users (defined by the number of dynamic buttons)
	var interests = "";
	for (i = 0; i < Omni_ArStatus.length; i++)
	{
		interests += Omni_ArStatus[i] + (i < Omni_ArStatus.length-1 ? "," : "");
	}

	var registerStr = "http://" + Omnidate_Server + "/od/GetStatus.aspx?userid=" + Omni_userid;

	if (dating != "")
	{	// dating
		registerStr += "&isdating=true";
	}
	else
	{	// not dating
		// show interests only when not dating
		if (interests != "")
		{
			registerStr += '&interests=' + interests;
		}
	}
	if (Omni_dbid != "")
	{
		registerStr += '&dbid=' + Omni_dbid;
	}
	if (Omni_lcId != "")
	{
		registerStr += '&browser=' + Omni_lcId;
	}
	if (Omni_ShowDate != "")
	{
		registerStr += '&showdate=false';
	}

	// Construct list of user ids you are interested in. Each user id is taken from a button in the class omnidate_button
	if (!UserInfoSetOnPing)
	{
		registerStr += '&username=' + username;
		if (Omni_gender=='male' || Omni_gender=='m') registerStr += '&gender=m';
		else if (Omni_gender=='female' || Omni_gender=='f') registerStr += '&gender=f';
	}
	registerStr += "&jsonp=?";


	ResetPings("New ping sent!");
	StartPing = setInterval("CountPings()", 1000);


	Omni_NumPingsSent++;

	// Call register.php and parse the return xml using OnSendComplete.
	var XmlHttpRequest = jQuery.getJSON(registerStr, 
	function(p)
	{
		if (Omni_Debugging)
		{
			Omni_data += "<br />" + OmniTime() + registerStr + "<br />";		
			jQuery("#containerX").html(Omni_data);
		}

		ResetPings("Ping Response Receivied.");
		StartPing = setInterval("CountPings()", 1000);

		Omni_NumPingsReturned++
		OnSendComplete(p);
	}
	);
}


var ajaxCount = 0;
var AjaxSuccessDefined = false;
var processRegistered = false; // for popups - to ensure no fast close
var Omni_JobID = "";

var passedParamAr = new Object();

// Parse the return XML
function OnSendComplete(_this)
{
	SendingPing = false;

	if (Omni_Debugging) Omni_data += "OnSendComplete <br />";
	Omni_Frequency = Omni_DefaultFreq;

	if (!IgnorePingReturn)
	{
		if (Omni_Debugging) Omni_data += "RETURN: ";
		if (Omni_Debugging) Omni_data += "InvitationStatus: "+_this.InvitationStatus+", ";
		if (Omni_Debugging) Omni_data += "RetCode: "+_this.RetCode+"<br />";
		
		if (_this.RetCode == "SUCCESS") // Stop setting username, gender, etc
		{
			UserInfoSetOnPing = true;
		}
		if (_this.Avatar) // Stop setting username, gender, etc
		{
			You = _this.Avatar;
		}

		if (_this.JobID) // Job in progress
		{
			Omni_JobID = _this.JobID;
			var OmniJobFile = "CheckJobJSON.asp";
			var OmniJobServer = YourGraphicServer;

			if (Omni_JobID.substr(0,3) == "FRQ")
			{
				OmniJobFile = "CheckPhotoFitJSON.asp";
				OmniJobServer = Omni_PFServer;
			}

			var jobcheckStr = "http://" + OmniJobServer + "/PhotoFit/"+OmniJobFile+"?id=" + Omni_JobID + "&jsonp=?";

			if (Omni_Debugging)
			{
				Omni_data += "<br />JOB CALL:" + jobcheckStr + "<br /><br />";
				jQuery("#containerX").html(Omni_data);
			}

			var XmlHttpRequest = jQuery.getJSON(jobcheckStr, 
				function(p)
				{
					if (Omni_Debugging)
					{
						Omni_data += "<br />JOB RETURN:" + p.RetCode + "<br /><br />";
						jQuery("#containerX").html(Omni_data);
					}

					if (p.RetCode.substr(0,10) != "INCOMPLETE")
						 MoreInfo();
				}
			);
		}
		else
			Omni_JobID = "";

		if (Omni_Debugging) Omni_data += "MembersStatus: => ";
		var ResultOnline = "";

		var firstreturned = true;
		for ( var i in _this.MembersStatus )
		{	
			if (!firstreturned) ResultOnline += ",";
			ResultOnline += i+"="+_this.MembersStatus[i];
			firstreturned = false;
		}
		if (Omni_Debugging)
		{
			Omni_data += "ResultOnline:" + ResultOnline + "<br />";
			jQuery("#containerX").html(Omni_data);
		}

		var buttonCode = "";
		var messageIn = "";
		var showBanner = "";
		var inviteStatus = "";
		var TimeRem = "";
		var ResultStatus = "";
		passedParamAr = new Object();

		DateStatus = "";

		if (_this.InvitationStatus != null && !PremiumShowing)
		{
			var InviteStatus = _this.InvitationStatus;
			ResultStatus = InviteStatus.Status;
			processRegistered = true;

			if (Omni_Debugging)
			{
				Omni_data += "Status: " +ResultStatus+ "<br />";
				jQuery("#containerX").html(Omni_data);
			}

			var ResultInviteMsg = InviteStatus.InviteMsg;
			var ResultDeclineMsg = InviteStatus.DeclineMsg;
			var ResultMsg = (ResultInviteMsg == "") ? ResultDeclineMsg : ResultInviteMsg;

			var ResultMode = Omni_AppMode = InviteStatus.Mode;
			var ResultInviter = InviteStatus.InviterID;
			var ResultInvitee = InviteStatus.InviteeID;
			var ResultTime = TimeRemaining = InviteStatus.TimeToExpiry;
			var ResultParam = InviteStatus.Param;

			if (ResultParam != "")
			{

				if (Omni_Debugging) Omni_data += "ResultParam: " +ResultParam+ "<br />";
				passedParamAr = ResultParam.split(",");

				/*
				var tempparameters = online.split(",");
				
				for (var i = 0; i < tempparameters.length; i++)
				{
					tempPassParamAr[i] = tempparameters[i];;
				}
				*/
			}


			if (Omni_Debugging) 
			{
				Omni_data += "ResultInviter/ResultInvitee/ResultTime: " +ResultInviter+"/"+ResultInvitee+"/"+ResultTime+ "<br />";
				jQuery("#containerX").html(Omni_data);
			}

			var MyDatesInfo = _this.InvitationStatus.UserInfo;				if (Omni_Debugging) Omni_data += "MyDatesInfo: " +MyDatesInfo+ "<br />";
				var ResultDateId = YourDateId = MyDatesInfo.UserID;			if (Omni_Debugging) Omni_data += "ResultDateId: " +ResultDateId+ "<br />";
				var ResultReqName = YourDateName = MyDatesInfo.UserName;	if (Omni_Debugging) Omni_data += "ResultReqName: " +ResultReqName+ "<br />";
				var ResultGender = YourDateGender = MyDatesInfo.Gender;						if (Omni_Debugging) Omni_data += "ResultGender: " +ResultGender+ "<br />";
				var ResultChar = YourDate = MyDatesInfo.Avatar;				if (Omni_Debugging) Omni_data += "ResultChar: " +ResultChar+ "<br />";
			if (Omni_Debugging) 
			{
				Omni_data += "MyDatesInfo/ResultDateId/ResultReqName/ResultGender/ResultChar: " +MyDatesInfo+"/"+ResultInvitee+"/"+ResultReqName+"/"+ResultGender+"/"+ResultChar+ "<br />";
				jQuery("#containerX").html(Omni_data);
			}

			var MyTableInfo = _this.InvitationStatus.DateInfo;
				var ResultTable = Omni_Table = MyTableInfo.TableNum;
				var ResultVenue = StorylineFile = MyTableInfo.Venue;
				var ResultChatServer = Omni_ChatServer = MyTableInfo.CS;
			if (Omni_Debugging)
			{
				Omni_data += "MyTableInfo/ResultTable/ResultVenue: " +MyTableInfo+"/"+ResultTable+"/"+ResultVenue+ "<br />";
				jQuery("#containerX").html(Omni_data);
			}


			if (ResultStatus == "WaitingForResponse")
			{
				// This state applies to the inviter only. The user has invited someone on a date and is awaiting an answer. This user can terminate the request by cancelling the invitation.
				ResultOnline = ReturnOffline(ResultOnline);

				if (!LoadStarted) { /*StartLoading();*/ LoadStarted = true; }

				showBanner = "1";
				buttonCode = "2";
				messageIn = (ResultMode == "1") ? "1" : "0";
				inviteStatus = "1";
				
				ShowDateAlert(true);

				// Speed up the Frequency while we wait for the accept
				Omni_Frequency = 3.33;
				if (Omni_ShowDate == "")
					OmniGetProfile(YourDateId)
			}
			else if (ResultStatus == "Invited")
			{
				// This state applies to the invitee only. The user has been invited on a date and is expected to accept or decline the invitation.
				ResultOnline = ReturnOffline(ResultOnline);

				if (!LoadStarted) { /*StartLoading();*/ LoadStarted = true; }

				showBanner = "1";
				buttonCode = ""; 
				messageIn = "";
				inviteStatus = (ResultMode == "1") ? "3" : "2"; // if chat, return 3, else 2

				if (Omni_ShowDate == "")
				{
					// Speed up the Frequency for the page getting the invites ONLY for the ShowDate page
					Omni_Frequency = 5;
					OmniGetProfile(YourDateId)
				}
			}
			else if (ResultStatus == "Dating")
			{
				// The invitation has been accepted and the user is now dating. While in this state, a user must ping the server letting it know that he is dating.
				showBanner = "0";
				buttonCode = "";
				messageIn = "3";
				inviteStatus = "";


				if (Omni_ShowDate == "")
				{
					TakeMeOnTheDate();
				}
				else
				{
					dating = "true";
					AreWeOnADate = true;
				}
			}
			else if (ResultStatus == "ExpiredAck" && ResultInviter == Omni_userid)
			{
				// A invitation request expired before a response. The user must acknowledge to complete the date.
				showBanner = "1";
				buttonCode = "1"; 
				messageIn = "2";
				inviteStatus = "0";
				ShowDateAlert(false);
				
				if (Omni_ShowDate == "")
					OmniGetProfile(YourDateId)

			}
			else if (ResultStatus == "ExpiredAck" && ResultInvitee == Omni_userid)
			{
				// A invitation request expired before a response. The user must acknowledge to complete the date.
				showBanner = "1";
				buttonCode = "1"; 
				messageIn = "8";
				inviteStatus = "0";
				ShowDateAlert(false);

				if (Omni_ShowDate == "")
					OmniGetProfile(YourDateId)
			}
			else if (ResultStatus == "DeclinedAck")
			{
				// This state applies to the inviter only. The invitee has declined your request. The user must acknowledge to complete the date.
				showBanner = "1";
				buttonCode = "1";
				messageIn = "5";
				inviteStatus = "0";
				ShowDateAlert(false);
				if (Omni_ShowDate == "")
					OmniGetProfile(YourDateId)
			}
			else if (ResultStatus == "CanceledAck")
			{
				// This state applies to the invitee only. The inviter has canceled the request while waiting for a response. The user must acknowledge to complete the date.
				showBanner = "1";
				buttonCode = "1";
				messageIn = "7";
				inviteStatus = "0";
				ShowDateAlert(false);
				if (Omni_ShowDate == "")
					OmniGetProfile(YourDateId)
			}

			else if (ResultStatus == "TimedOutAck")
			{
				// Acknowledge Timed Out - The other user has become offline while in the negotiation phase of the  invitation. The user must acknowledge to complete the date.
				showBanner = "1";
				buttonCode = "1";
				messageIn = "9";
				inviteStatus = "0";
				ShowDateAlert(false);
				if (Omni_ShowDate == "")
					OmniGetProfile(YourDateId)
			}
			else if (ResultStatus == "DatingFinishedAck" && Omni_ShowDate == "")
			{
				// Acknowledge End Date - The other user has ended the date. The user must acknowledge to complete the date.
				if (Omni_Popup == "" || window.self.name == "omnidate")
				{
					Omni_SetWindowUnload(false);
					DateStatus = "DatingFinishedAck";
					if (AreWeOnADate)
						CallFinished();
					TakeMeOnTheDate();
				}
				else if (typeof(omnidateWindow)=="undefined") 
				{
					ShowDateAlert(true);
				}
				else if (omnidateWindow.closed)
				{
					ShowDateAlert(false);
					onEndNotify(ResultDateId, ResultReqName); //hard close
				}
			}
			else if (ResultStatus == "DatingTimedOutAck" && Omni_ShowDate == "")
			{
				// Acknowledge Dating Timed Out - The other user has stopped sending "I am Dating" pings. The user must acknowledge to exit the date.
				if (Omni_Popup == "" || window.self.name == "omnidate")
				{
					Omni_SetWindowUnload(false);
					DateStatus = "DatingTimedOutAck";
					if (AreWeOnADate)
						CallTimeout();
					TakeMeOnTheDate();
				}
				else if (typeof(omnidateWindow)!="undefined" && !omnidateWindow.closed) 
				{
				}
				else
				{
					ShowDateAlert(false);
					onEndNotify(ResultDateId, ResultReqName); //hard close
				}
			}
			else if ((ResultStatus == "DatingFinishedAck" || ResultStatus == "DatingTimedOutAck") && Omni_ShowDate != "")
			{
				// Popup open
				dating = "";
				AreWeOnADate = true;
			}
			else // SOME OTHER CASE => BROKEN!
			{
				if (Omni_Debugging) Omni_data += "OnSendComplete---->ERROR!<br />";
				showBanner = "1";
				buttonCode = "1";
				messageIn = "6";
				inviteStatus = "0";
				ShowDateAlert(false);
			}
		}
		else if (_this.InvitationStatus != null && PremiumShowing)
		{
			ShowDateAlert(false);
			Omni_Frequency = 5;
		}
		else
		{	// Here we know we're just idle
			ShowDateAlert(false);

			if (AreWeOnADate)
			{
				dating = "";
				AreWeOnADate = false;

				OmniDate_ShowHide("OmniFloatingLayerDate", false);
				OmniDate_ShowHide("OmniFloatingLayerChat", false);

				Omni_Modal(false);

				var target = document.getElementById('OmniFloatingLayerDate');
				
				if (Omni_isChrome && Omni_lang == "he")
					Omni_ShowAdverts(true);

				if (Omni_Debugging) Omni_data += "<br /><br />DATE IS OVER, CLEAR OUT<br /><br />";
				
				if (window.self.name == "omnidate")
				{
					Omni_SetWindowUnload(false);
					window.self.close();
				}
			}

			DateHasBeenRequested = false;
			showBanner = "0";
			buttonCode = ""; 
			messageIn = "";
			inviteStatus = "";
			OmniCurrentDate = new Object();
	
			OmniInviteIntv = clearTimeout(OmniInviteIntv);

			OmniDate_HideBanner();
			Omni_AppMode = null;


			if (window.self.name == "omnidate" && processRegistered)
			{
				Omni_SetWindowUnload(false);
				window.self.close();
			}
		}
	
		if (Omni_Debugging)
			jQuery("#containerX").html(Omni_data);


		// Broadcast the online status of the buttons + communicate with the banner
		BroadcastStatus(showBanner, buttonCode, messageIn, inviteStatus, YourDateName, YourDateId, ResultMsg, TimeRemaining, ResultStatus, ResultOnline);
	}

	// Define the next ping interval
	if (PingInterval == 0)
	{
		PingInterval = setInterval( "Send()", Omni_Frequency * 1000 );
	}
}

function ReestablishPings()
{
	SendingPing = false;
	Send();
}

function ReturnOffline(OnlineString)
{
	InactiveAll();
	return OnlineString;
}




var BannerStatusShown = null;
var BannerButtonStatus = null;
var BannerMessageNumber = null;

function BroadcastStatus(showBanner, buttonCode, messageIn, inviteStatus, DateName, DateId, InviteMsg, TimeRem, ResStatus, online)
{

	if (Omni_Debugging) 
	{
		Omni_data += "BroadcastStatus("+showBanner+", "+buttonCode+", "+messageIn+", "+inviteStatus+", "+DateName+", "+DateId+", "+InviteMsg+", "+TimeRem+", "+ResStatus+", "+online+")<br />";
		jQuery("#containerX").html(Omni_data);
	}

	// Broadcast to Banner
	if (showBanner == "1")
	{
		if (!BannerShowing || (inviteStatus != BannerStatusShown))
		{
			if (Omni_Debugging) 
			{
				Omni_data += "BroadcastStatus(1)<br />";
				jQuery("#containerX").html(Omni_data);
			}
			OmniDate_VisibleBanner('OmniFloatingLayer', true);
			var target = document.getElementById('OmniFloatingLayer');
			target.innerHTML = omnidateBanner(buttonCode, messageIn, inviteStatus, DateName, DateId, TimeRem, InviteMsg);
		}
		else
		{
			if (Omni_Debugging)
			{
				Omni_data += "BroadcastStatus(2)<br />";
				jQuery("#containerX").html(Omni_data);
			}
			OmniDate_VisibleBanner('OmniFloatingLayer', true);
		}

		OmniDate_ShowHide("OmniFloatingLayerInvite", false);
		BannerStatusShown = inviteStatus;
	}
	else if (showBanner == "0")
	{
		if (Omni_Debugging)
		{
			Omni_data += "BroadcastStatus(0)<br />";
			jQuery("#containerX").html(Omni_data);
		}
		if (BannerShowing && ResStatus != "")
			OmniDate_HideBanner();
		BannerStatusShown = 0;
	}

	// Broadcast to Buttons
	if (online != "")
	{
		var onlineusers = Array();
		var temponlineusers = online.split(",")
		
		for (var i = 0; i < temponlineusers.length; i++)
		{
			var oneonlineuser = temponlineusers[i].split("=");
			onlineusers[oneonlineuser[0]] = oneonlineuser[1];
		}

		if (Omni_Debugging) Omni_data += "Users Online Status ("+online+"): ";

		for (var j = 0; j < Omni_ArStatus.length; j++)
		{
			if (typeof(onlineusers[Omni_ArStatus[j]]) != "undefined")
			{
				updateButton(Omni_ArStatus[j], onlineusers[Omni_ArStatus[j]]);
				if (Omni_Debugging) Omni_data += Omni_ArStatus[j]+"="+onlineusers[Omni_ArStatus[j]]+", ";
			}
			else
			{
				updateButton(Omni_ArStatus[j], '0');
				if (Omni_Debugging) Omni_data += Omni_ArStatus[j]+"=0, ";
			}
		}
		if (Omni_Debugging)
		{
			Omni_data += "<br />";
			jQuery("#containerX").html(Omni_data);
		}
	}
}


// Update the button text and enable/disable
function updateButton(buttonid, status)
{
	var numButtonsWithThisName = OmniGetNumButtons(buttonid);

	var btnIndex;
	for (btnIndex=0; btnIndex < numButtonsWithThisName; btnIndex++)
	{
		var btnNum = btnIndex + 1;
		var btnPrintId = buttonid + "_" + btnNum;
		

		if (Omni_Debugging)
		{
			Omni_data += "AreWeOnADate="+AreWeOnADate+"<br />";
			jQuery("#containerX").html(Omni_data);
		}

		var Status = "";
		var Disabled = true;

		if (status == "0")
		{
			Status = "Offline";
			if (typeof(btnUiAr[btnPrintId]['offline']) != "undefined")
				swapImage(btnPrintId, btnUiAr[btnPrintId]['offline'], 'offline');
		}
		else if (status == "1")
		{
			Status = "Date Me";
			if (!BannerShowing && !AreWeOnADate)
			{
				Disabled = false;
				if (typeof(btnUiAr[btnPrintId]['online']) != "undefined")
					swapImage(btnPrintId, btnUiAr[btnPrintId]['online'], 'online');
			}
			else
			{
				if (typeof(btnUiAr[btnPrintId]['inactive']) != "undefined")
					swapImage(btnPrintId, btnUiAr[btnPrintId]['inactive'], 'inactive');
			}
		}
		else if (status == "2")
		{	
			Status = "Dating";
			if (typeof(btnUiAr[btnPrintId]['dating']) != "undefined")
				swapImage(btnPrintId, btnUiAr[btnPrintId]['dating'], 'dating');
		}

		if (document.getElementById(btnPrintId) != null)
		{
			var obj = document.getElementById(btnPrintId);
			obj.style.cursor = (Disabled) ? "default" : "pointer";
			obj.disabled = Disabled;
		}
	}
}


/***************************************************************************************************************
************	Button Functions
***************************************************************************************************************/
function Omni_Button()
{
	var btnUserId = "";
	var btncontainer = "";
	var btnreturn = "";
	var Omni_CustomButton = false;
	var Omni_CustomHover = false;
	var buttonType = "";

	uiObj = new Object();
	btnTextObj = new Object();

	for (var i=0; i < arguments.length; i=i+2)
	{
		var currArg = arguments[i].toLowerCase();

		switch (currArg){	
			case "user":
			case "userid":
				btnUserId = arguments[i+1];
				break;
			case "style":
			case "uiobj":
				Omni_CustomButton = true;
				if (typeof(uiDefaults[arguments[i+1]]) == "undefined")
				{
					// Check if it's an object and check if it has all the right parameters
						uiDefaults["custom"] = arguments[i+1];
						uiObj = uiDefaults["custom"];
				}
				else
					uiObj = uiDefaults[arguments[i+1]];
				break;
			case "hover":
				Omni_CustomHover = true;
				if (typeof(omniHoverAr[arguments[i+1]]) == "undefined")
				{
					// Check if it's an object and check if it has all the right parameters
						omniHoverAr["custom"] = arguments[i+1];
						btnTextObj = omniHoverAr["custom"];
				}
				else
					btnTextObj = omniHoverAr[arguments[i+1]];
				break;
			case "container":
				btncontainer = arguments[i+1];
				break;
			case "type":
				if (arguments[i+1] == "chat")
					buttonType = "chat";
				else if (arguments[i+1] == "date")
					buttonType = "date";
				break;
			case "profile":
				Omni_ProfileAr[btnUserId] = arguments[i+1];
				break;
			case "return":
				btnreturn = arguments[i+1];
				break;
			default:
		}
	}

	// If we defined a username create the button
	if (btnUserId != "")
	{
		Omni_ArStatus[Omni_ArStatus.length] = btnUserId; // thereby increasing length by 1
		// If we didn't specify ANY definition, use a default
		if (!Omni_CustomButton) {
			uiObj = new Object();
			uiObj = uiDefaults['Button01'];
		}
		// Check each specific image, if there is one missing, set a default
		else
		{
			if (typeof(uiObj['offline']) == "undefined")
				uiObj['offline'] = Button01['offline'];
			if (typeof(uiObj['online']) == "undefined")
				uiObj['online'] = Button01['online'];
			if (typeof(uiObj['inactive']) == "undefined")
				uiObj['inactive'] = Button01['inactive'];
			if (typeof(uiObj['dating']) == "undefined")
				uiObj['dating'] = Button01['dating'];
			if (typeof(uiObj['info']) == "undefined")
			{
				uiObj['info'] = Button01['info'];
				uiObj['iheight'] = Button01['iheight'];
				uiObj['iwidth'] = Button01['iwidth'];
			}
			if (typeof(uiObj['height']) == "undefined")
				uiObj['height'] = Button01['height'];
			if (typeof(uiObj['width']) == "undefined")
				uiObj['width'] = Button01['width'];
		}


		var numButtonsWithThisName = OmniGetNumButtons(btnUserId);
		var btnPrintId = btnUserId + "_" + numButtonsWithThisName++;
		
		// Add the UI obj to the array
		btnUiAr[btnPrintId] = uiObj;


		// If we didn't specify ANY definition, use a default
		if (!Omni_CustomHover) {
			btnTextObj = new Object();
			if (buttonType == "chat")
				btnTextObj = omniHoverAr['Hover02'];
			else
				btnTextObj = omniHoverAr['Hover01'];
		}
		else
		{
			if (typeof(btnTextObj['offline']) == "undefined")
				btnTextObj['offline'] = Hover01['offline'];
			if (typeof(btnTextObj['online']) == "undefined")
				btnTextObj['online'] = Hover01['online'];
			if (typeof(btnTextObj['inactive']) == "undefined")
				btnTextObj['inactive'] = btnTextObj['online']; // default to online
			if (typeof(btnTextObj['dating']) == "undefined")
				btnTextObj['dating'] = Hover01['dating'];
			if (typeof(btnTextObj['info']) == "undefined")
				btnTextObj['info'] = Hover01['info'];
		}

		// Add the UI obj to the array
		btnHoverAr[btnPrintId] = btnTextObj;



		var printOmniButton = ''
		if (uiObj['iposition'] == 'bottom') { printOmniButton += '<span style="float:none;"><div>'; }
		var inviteButton = '<input type="button" id="' + btnPrintId + '" name="' + btnPrintId + '" onclick="OnDate(\''+btnUserId+'\',\''+buttonType+'\');" '
			+ 'value="" disabled="true" style="height:'+uiObj['height']+'px;width:'+uiObj['width']+'px;background:url(\'' + uiObj['offline'] + '\');border:0px;margin:0px;padding:0px;" title="' + btnTextObj['offline'] + '" />';
		printOmniButton += inviteButton;
		if (uiObj['iposition'] == 'bottom') { printOmniButton += '</div><div>'; }
		// if not button off

		if (uiObj['info'] != "" && uiObj['info'] != "undefined")
		{
			var infoButton = '<input type="button" id="' + btnPrintId + '_Info" name="' + btnPrintId + '+Info" onclick="MoreInfo();" '
				+' value="" style="cursor:pointer;height:'+uiObj['iheight']+'px;width:'+uiObj['iwidth']+'px;background:url(\'' + uiObj['info'] + '\');border:0px;margin:0px;padding:0px;" title="' + btnTextObj['info'] + '" />';
			printOmniButton += infoButton;
			if (uiObj['iposition'] == 'bottom') { printOmniButton += '</div></span>'; }
		}
		
		if (btncontainer != "")
			document.getElementById(btncontainer).innerHTML += printOmniButton;
		else if (btnreturn != "")
			return printOmniButton;
		else
			document.write(printOmniButton);
	}
}

function OmniGetNumButtons(_buttonName)
{
	var btnOccurs = 0;
	var btnIndex;
	for (btnIndex=0; btnIndex < Omni_ArStatus.length; btnIndex++)
	{
		if (Omni_ArStatus[btnIndex] == _buttonName)
		{
			btnOccurs++;
		}
	}
	return btnOccurs;
}

function swapImage (imgName, imgSrc, statusType)
{
	if (document.getElementById(imgName) != null)
	{
		var obj = document.getElementById(imgName);
		obj.style.background = "url('"+imgSrc+"')";
		obj.style.height = btnUiAr[imgName]['height'] + "px";
		obj.style.width = btnUiAr[imgName]['width'] + "px";
		obj.title = btnHoverAr[imgName][statusType];
		obj.disabled = (statusType == "online") ? false : true;
	}
}

function InactiveAll()
{
	if (Omni_Debugging) Omni_data += "InactiveAll()<br />";
	for (i = 0; i < btnUiAr.length; i++)
	{
		document.getElementById(btnUiAr[i]).disabled = true;
	}
}

function ActiveAll()
{
	if (Omni_Debugging) Omni_data += "ActiveAll()<br />";
	for (i = 0; i < btnUiAr.length; i++)
	{
		document.getElementById(btnUiAr[i]).disabled = false;
	}
}


// The MoreInfo
function MoreInfo()
{

	if (Omni_userid == "")
		return;

	var flashVarStr = "lcId=" + Omni_lcId+"_"+Omni_Unique + "&userid="+Omni_userid+"&username="+username+"&gender="+Omni_gender+"&avatar="+You+"&GraphicServer="+YourGraphicServer+"&PingServer="+Omnidate_Server+"&Style="+Omni_bannerStyle;


	var tag = new FlashTag(Omni_Server+"InfoBox_"+Omni_abver+".swf", 575, 455, "10,0,0,0");


	if (Omni_dbid != "")
	{
		flashVarStr += "&DbId=" + Omni_dbid;
	}
	if (arguments[0] != null)
	{
		flashVarStr += "&tab=" + arguments[0];
	}
	if (Omni_JobID != "")
	{
		flashVarStr += "&JobID=" + Omni_JobID;
	}
	if (Omni_avatars != "")
	{
		flashVarStr += "&phase=" + Omni_avatars;
	}
	if (Omni_verb != "")
	{
		flashVarStr += "&verb=" + Omni_verb;
	}
	if (Omni_lang != "")
	{
		flashVarStr += "&lang=" + Omni_lang;
	}
	flashVarStr += "&CustomServer=64.34.169.15";


	if (Omni_Debugging)
	{
		Omni_data += "<br />HERE IT IS: " + flashVarStr + "<br />";
		jQuery("#containerX").html(Omni_data);
	}

	tag.setFlashvars(flashVarStr);
	tag.setAllowScriptAccess("always");
	tag.setWmode("transparent");
	tag.setId("InfoBox");
	Omni_Unique++;

	var target = document.getElementById('OmniFloatingLayerInfo');
	target.innerHTML = tag.toString();

	if (BannerShowing == false)
	{
		if (Omni_Debugging) 
			Omni_data += "<br />!BannerShowing > ";

		OmniDate_ShowHide("OmniFloatingLayerInfo", true);
		
		if (Omni_Debugging)
			jQuery("#containerX").html(Omni_data);
	}
}

function HideInfo()
{
	OmniDate_ShowHide("OmniFloatingLayerInfo", false);
}


var PremiumShowing = false;

function ShowRegisterBox()
{
	if (!BannerShowing)
	{
		if (Omni_Debugging) Omni_data += "<br />ShowRegisterBox() > ";
		PremiumShowing = true;

		SetPremiumHTML();
		OmniDate_ShowHide("OmniFloatingLayerRegister"+Omni_verb, true);

		if (Omni_Debugging)
			jQuery("#containerX").html(Omni_data);
	}
}
function HideRegisterBox()
{
	PremiumShowing = false;

	OmniDate_ShowHide("OmniFloatingLayerRegister"+Omni_verb, false);

	if (Omni_Debugging)
		jQuery("#containerX").html(Omni_data);
}


function YesRegisterPremium()
{
	var premiumStr = "http://" + Omnidate_Server + "/od/LogGenericUserAction.aspx?userid=" + Omni_userid + "&action=1";
	if (Omni_dbid != "")
		premiumStr += '&dbid=' + Omni_dbid;
	premiumStr += "&jsonp=?";
	
	jQuery.getJSON( premiumStr, 
		function(p)
		{
		} 
	);

	if (Omni_premiumpop || Omni_ShowDate != "")
	{
		Omni_PremiumPopup();
		HideRegisterBox();
	}
	else
		Omni_MoveTo(Omni_premium, Omni_movetype);
}

function NoRegisterPremium()
{
	var premiumStr = "http://" + Omnidate_Server + "/od/LogGenericUserAction.aspx?userid=" + Omni_userid + "&action=2";
	if (Omni_dbid != "")
		premiumStr += '&dbid=' + Omni_dbid;
	premiumStr += "&jsonp=?";
	
	jQuery.getJSON( premiumStr, 
		function(p)
		{
		}
	);

	HideRegisterBox();
}


function Omni_PremiumPopup()
{
	var WindowConfig = 'status=no, toolbar=no, location=no, directories=no, menubar=no, scrollbars=yes';

	if (navigator.appName.indexOf("Microsoft") >= 0)
	{
		WindowConfig += ',left=150,top=20,width=650,height=600';
	}
	else
	{
		WindowConfig += ',screenX=150,screenY=20,width=650,height=600';
	}

	window.open(Omni_premium, 'omniregister', WindowConfig);
}

var Omni_ChatShowing = true;
var Omni_ieVirginModeChat = true;
var chatScrollTimer = null;
var chatScrollDefined = false;

function Omni_ShowHideChat()
{
	var _show;
	if (arguments[0] == true || arguments[0] == false)
		Omni_ChatShowing = _show = arguments[0];
	else
		Omni_ChatShowing = _show = !Omni_ChatShowing;
	

	var obj = document.getElementById('OmniFloatingLayerChat');


	if (Omni_mode == "facebook")
	{
		obj.style.top = (_show) ? '0px' : '100%';
		obj.style.marginTop = (_show) ? '10px' : '-45px';
		obj.style.height = (_show) ? '450px' : '45px';
	}
	else
	{			
		if (getMyHeight() < 450 && _show)
		{
			var ScrollTop = document.body.scrollTop;
	
			if (ScrollTop == 0)
			{
				if (window.pageYOffset)
					ScrollTop = window.pageYOffset;
				else
					ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
			}
			var heightFix = ((getMyHeight() - 45 + ScrollTop) + "px");

			if (!Omni_QuirksMode || !Omni_isExplorer && obj.style.position != 'absolute')
			{
				if (Omni_isFirefox)
					Omni_ReplaceState('OmniFloatingLayerChat', _show);
				obj.style.position = 'absolute';
			}

			obj.style.top = ScrollTop + "px";
			obj.style.marginTop = '0px';
			obj.style.height = '450px';

			Omni_ieVirginModeChat = false;
		}
		else 
		{
			if (getMyHeight() < 450)
				Omni_ieVirginModeChat = false;


			if (Omni_QuirksMode && Omni_isExplorer && Omni_ieVirginModeChat)
			{
				var heightFix = ((getMyHeight() / 2 - 45) + "px");
				obj.style.marginTop = (_show) ? '-225px' : heightFix;
				obj.style.height = (_show) ? '450px' : '45px';
			}
			else if (Omni_QuirksMode && Omni_isExplorer)
			{
				var ScrollTop = document.body.scrollTop;
		
				if (ScrollTop == 0)
				{
					if (window.pageYOffset)
						ScrollTop = window.pageYOffset;
					else
						ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
				}

				ScrollTop = (_show) ? ScrollTop + (getMyHeight() / 2 - 225) : ScrollTop + (getMyHeight() - 45);
				obj.style.position = 'absolute';
				obj.style.top = ScrollTop + "px";
				obj.style.marginTop = '0px';
				obj.style.height = (_show) ? '450px' : '45px';

				if (!chatScrollDefined)
				{
					jQuery(window).scroll(function() {
						if (chatScrollTimer) clearTimeout(chatScrollTimer);
						chatScrollTimer = setTimeout(Omni_ChatScrolled, 300);
						chatScrollDefined = true;
					});
				}
			}
			else
			{
				var heightFix = ((getMyHeight() / 2 - 45) + "px");
					
				if (obj.style.position != 'fixed')
				{
					if (Omni_isFirefox)
							Omni_ReplaceState('OmniFloatingLayerChat', _show);
					obj.style.position = 'fixed';
				}
				obj.style.top = '50%';
				obj.style.marginTop = (_show) ? '-225px' : heightFix;
				obj.style.height = (_show) ? '450px' : '45px';
			}
		}
	}
}


var Omni_DateShowing = true;
var Omni_ieVirginModeDate = true;
var dateScrollTimer = null;
var dateScrollDefined = false;

function Omni_ShowHideDate()
{
	if (window.self.name != "omnidate" && Omni_Popup == "")
	{
		var _show;
		if (arguments[0] == true || arguments[0] == false)
			Omni_DateShowing = _show = arguments[0];
		else
			Omni_DateShowing = _show = !Omni_DateShowing;
		

		var obj = document.getElementById('OmniFloatingLayerDate');


		if (Omni_mode == "facebook")
		{
			obj.style.top = (_show) ? '0px' : '100%';
			obj.style.marginTop = (_show) ? '10px' : '-45px';
			obj.style.height = (_show) ? '570px' : '45px';
		}
		else
		{
			if (getMyHeight() < 570 && _show)
			{
				var ScrollTop = document.body.scrollTop;
		
				if (ScrollTop == 0)
				{
					if (window.pageYOffset)
						ScrollTop = window.pageYOffset;
					else
						ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
				}
				var heightFix = ((getMyHeight() - 45 + ScrollTop) + "px");

				if (!Omni_QuirksMode || !Omni_isExplorer && obj.style.position != 'absolute')
				{
					if (Omni_isFirefox)
						Omni_ReplaceState('OmniFloatingLayerDate', _show);
					obj.style.position = 'absolute';
				}

				obj.style.top = ScrollTop + "px";
				obj.style.marginTop = '0px';
				obj.style.height = '570px';

				Omni_ieVirginModeDate = false;
			}
			else 
			{
				if (getMyHeight() < 570)
					Omni_ieVirginModeDate = false;


				if (Omni_QuirksMode && Omni_isExplorer && Omni_ieVirginModeDate)
				{
					var heightFix = ((getMyHeight() / 2 - 45) + "px");
					obj.style.marginTop = (_show) ? '-285px' : heightFix;
					obj.style.height = (_show) ? '570px' : '45px';
				}
				else if (Omni_QuirksMode && Omni_isExplorer)
				{
					var ScrollTop = document.body.scrollTop;
			
					if (ScrollTop == 0)
					{
						if (window.pageYOffset)
							ScrollTop = window.pageYOffset;
						else
							ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
					}

					ScrollTop = (_show) ? ScrollTop + (getMyHeight() / 2 - 285) : ScrollTop + (getMyHeight() - 45);
					obj.style.position = 'absolute';
					obj.style.top = ScrollTop + "px";
					obj.style.marginTop = '0px';
					obj.style.height = (_show) ? '570px' : '45px';

					if (!dateScrollDefined)
					{
						jQuery(window).scroll(function() {
							if (dateScrollTimer) clearTimeout(dateScrollTimer);
							dateScrollTimer = setTimeout(Omni_DateScrolled, 300);
							dateScrollDefined = true;
						});
					}
				}
				else
				{
					var heightFix = ((getMyHeight() / 2 - 45) + "px");
						
					if (obj.style.position != 'fixed')
					{
						if (Omni_isFirefox)
								Omni_ReplaceState('OmniFloatingLayerDate', _show);
						obj.style.position = 'fixed';
					}
					obj.style.top = '50%';
					obj.style.marginTop = (_show) ? '-285px' : heightFix;
					obj.style.height = (_show) ? '570px' : '45px';
				}
			}


		}

		Omni_Modal(Omni_DateShowing);
	}
}


function Omni_ReplaceState(_addstate, _state)
{
	if (document.getElementById(_addstate) != null)
	{
		var _obj = document.getElementById(_addstate);
		var targetInnerHtml = _obj.innerHTML;
		var StateEquals = targetInnerHtml.indexOf('State=');
		if (StateEquals != -1)
			targetInnerHtml = targetInnerHtml.replace(targetInnerHtml.substring(StateEquals, targetInnerHtml.indexOf("&amp;", StateEquals) + 5), '');
		var Omni_CurrState = (_state) ? 'max' : 'min';
		var FlashVarReplace = 'flashvars="State=' + Omni_CurrState + '&amp;';
		targetInnerHtml = targetInnerHtml.replace('flashvars="', FlashVarReplace);
		_obj.innerHTML = targetInnerHtml;
	}
}







function OmniDate_ShowHide(OmniLayer, ShowOnScreen)
{
	if (Omni_Debugging) 
	{
		Omni_data += "OmniDate_ShowHide(" + OmniLayer +", "+ ShowOnScreen + ")<br />";
		jQuery("#containerX").html(Omni_data);
	}

	if (document.getElementById(OmniLayer) != null)
	{
		var obj = document.getElementById(OmniLayer);
		obj.style.visibility = ShowOnScreen ? "visible" : "hidden";
		obj.style.display = ShowOnScreen ? "block" : "none";
	}
	
	if (ShowOnScreen && Omni_mode == "facebook")
	{
		if (Omni_isFirefox)
			top.location.hash = "#";
		else if (!Omni_isExplorer)
		{
			if (window.location.href.charAt(window.location.href.length-1) == "#")
				window.location.href = window.location.href;
			else
				window.location.href = window.location.href + "#";
		}
		else
		{
			window.location.hash = 'top';
		}
	}
}

/***************************************************************************************************************
************	Request Date
***************************************************************************************************************/
function OnDate(useridIn, buttonType)
{
	if (Omni_userid == "")
		return;

	if (Omni_Debugging)
	{
		Omni_data += "OnDate("+useridIn+") Pressed, BannerShowing = " + BannerShowing + "<br />";
		jQuery("#containerX").html(Omni_data);
	}

	if (!BannerShowing && (useridIn != Omni_userid))
	{

		if(buttonType == "chat")
		{
			OnRequest(useridIn, "1");
		}
		else
		{
			Omni_Destination = "";
			BannerShowing = true;
			InactiveAll();

			if (Omni_lang == "he")
				Omni_RTL2 = "text-align:right;";
			else
				Omni_RTL2 = "text-align:left;";


			OmniDate_VisibleBanner('OmniFloatingLayerInvite', true);

			var target = document.getElementById('OmniFloatingLayerInvite');

			target.innerHTML = ""+
				"<div class='OmniTopBg01 OmniTop"+Omni_bannerStyle+"B'>"+
				"		<div class='OmniHeading01'>"+
				"			"+OmniLangAr["SelectDest"]+
				"		</div>"+
				"		<div class='OmniClose01' onclick='ActiveAll();OmniDate_VisibleBanner(\"OmniFloatingLayerInvite\", false);Send();'></div>"+
				"</div>"+
				"<div class='OmniBottomBg01' style='"+Omni_RTL2+"'>"+  //text-align:right;
				"	<div style='padding:15px 50px 0px 50px;'>"+
				"		<div style='width:400px;height:130px;margin-top:5px;'>"+Omni_Destinations()+"</div>"+
				"		<div class='OmniHeading02' style='margin:-5px 0px 5px 0px;'>"+OmniLangAr["PersonalMsg"]+"</div>"+
				"		<textarea name='OmniInviteText' id='OmniInviteText' class='OmniInviteText' onClick='OmniSelectAll(\"OmniInviteText\");' onKeyDown='OmniTextCounter(this,140);' onKeyUp='OmniTextCounter(this,140);'>"+OmniLangAr["DefaultInv"]+"</textarea>"+
				"		<div>"+
				"			<div style='float:left; text-align:center;'>"+
				"				<div id='btnOmniAvatar' name='btnOmniAvatar' onclick='MoreInfo(\"2\");' class='OmniLargeBtn01'>"+OmniLangAr["SelectAvatar"]+"</div>"+
				"			</div>"+
				"			<div style='float:right;'>"+
				"				<div id='btnOmniInvite' name='btnOmniInvite' onclick='AcceptDate(\"inviter\",\""+useridIn+"\");' class='OmniSmallBtn02'>"+OmniLangAr["Invite"]+"</div>"+
				"			</div>"+
				"		</div>"+
				"	</div>"+
				"</div>";
	
			if ((Omni_dbid == "JDUK" || Omni_dbid == "JDFR" || Omni_dbid == "JDIL") && (typeof(s_gi) != 'undefined') && (typeof(s_account) != 'undefined'))
			{		
				var s = s_gi(s_account);
				s.linkTrackVars = 'events';
				s.linkTrackEvents = 'event55';
				s.events = 'event55';
				s.tl(true, 'o', 'Click to Initiate OmniDate_55');
			}

		}
	}
	Send();
}

function OmniTextCounter(field, maxlimit)
{
	if (field.value.length > maxlimit)
		field.value = field.value.substring(0, maxlimit);
}

function OmniSelectAll(id)
{
    document.getElementById(id).focus();
    document.getElementById(id).select();
}

var Omni_Destination = "";
function OmniSetDestination(_Destination)
{
	Omni_Destination = _Destination;
}

function OnRequest(useridIn, _Mode)
{
	if (Omni_Debugging)
	{
		Omni_data += "OnRequest (BannerShowing = " + BannerShowing + ", "+_Mode+")<br />";
		jQuery("#containerX").html(Omni_data);
	}
	OmniDate_VisibleBanner('OmniFloatingLayerInvite', false);
	
	if (useridIn != Omni_userid)
	{
		if (Omni_premium == "")
		{
			var Omni_action = "invite";
			BannerShowing = true;

			InactiveAll();
			var requestStr = "http://" + Omnidate_Server + "/od/DoAction.aspx?userid=" + Omni_userid + "&action=" + Omni_action + "&userid2=" + useridIn + "&mode=" + _Mode;
			if (Omni_dbid != "")
			{
				requestStr += '&dbid=' + Omni_dbid;
			}
			if (Omni_lcId != "")
			{
				requestStr += '&browser=' + Omni_lcId;
			}
			if (Omni_ShowDate != "")
			{
				requestStr += '&showdate=false';
			}
			if (Omni_Destination != "")
			{
				requestStr += '&venue=' + Omni_Destination;
			}
			if (document.getElementById('OmniInviteText') != null && _Mode != "1")
			{
				var target = document.getElementById('OmniInviteText');
				requestStr += '&invitemsg=' + encodeURIComponent(target.value);
			}

			if (typeof(Omni_ProfileAr[useridIn]) != "undefined")
				paramStr = Omni_ProfileAr[useridIn] + ",";
			else
				paramStr = ",";

			if (Omni_userclass != "")
				paramStr += Omni_userclass;

			if (paramStr != "")
			{
				requestStr += '&param=' + paramStr;
			}



			requestStr += "&jsonp=?";


			if (Omni_Debugging) 
			{
				Omni_data += requestStr + "<br />";
				jQuery("#containerX").html(Omni_data);
			}

			// Call request.php and parse the return xml using OnRequestComplete.
			jQuery.getJSON(requestStr, 
			function(p)
			{
				if (Omni_Debugging)
				{ 
					Omni_data += "RETURN:" + p.Status + "<br />";
					jQuery("#containerX").html(Omni_data);
				}
				OnRequestComplete(p);
			}
			);
		}
		else
		{
			Omni_AppMode = _Mode;
			ShowRegisterBox();
		}
	}
	else
	{
		if (Omni_Debugging)
		{
			Omni_data += "OnDate() > Invalid Button!<br />";
			jQuery("#containerX").html(Omni_data);
		}
	}
}

function OnRequestComplete(_this)
{
	if (Omni_Debugging)
	{
		Omni_data += _this + "-OnRequestComplete(Success="+_this.Status+")<br />";
		jQuery("#containerX").html(Omni_data);
	}


	if (_this.Status == "ERROR")
	{
		BroadcastStatus("1", "1", "6", "0", "", "", "", "", "", "");
	}
	else if (_this.Status != "SUCCESS")
	{
		BroadcastStatus("1", "1", "10", "0", "", "", "", "", "", "");
	}

	Send();
}


/***************************************************************************************************************
************	Avatar Selector
***************************************************************************************************************/
var Avatar01 = new Object;
Avatar01.imageM = Omni_Server+"images/Avatar01.png";
Avatar01.imageF = Omni_Server+"images/Avatar02.png";
Avatar01.text = "Select Your Virtual Character";
Avatar01.height = "76";
Avatar01.width = "160";

var AvatarSpark01 = new Object;
AvatarSpark01.imageM = Omni_Server+"images/btn-edit-avatar.png";
AvatarSpark01.imageF = Omni_Server+"images/btn-edit-avatar.png";
AvatarSpark01.text = "Select Your Virtual Character";
AvatarSpark01.height = "25";
AvatarSpark01.width = "95";

var AvatarSpark02 = new Object;
AvatarSpark02.imageM = Omni_Server+"images/btn-edit-avatar-he.png";
AvatarSpark02.imageF = Omni_Server+"images/btn-edit-avatar-he.png";
AvatarSpark02.text = "בחר וערוך את הדמות הוירטואלית שלך";
AvatarSpark02.height = "25";
AvatarSpark02.width = "95";


// Add to master array
var omniAvatarAr = new Object;  // Contains all the presets
omniAvatarAr['Avatar01'] = Avatar01;
omniAvatarAr['Spark01'] = AvatarSpark01;
omniAvatarAr['Spark02'] = AvatarSpark02;

var avatarObj; // our current


function Omni_Avatar()
{
	var avtcontainer = "";
	var avtreturn = "";
	var AvatarGender = "male";

	for (var i=0; i < arguments.length; i=i+2)
	{
		var currArg = arguments[i].toLowerCase();

		switch (currArg)
		{	
			case "style":
				avatarObj = new Object();			
				if (typeof(omniAvatarAr[arguments[i+1]]) == "undefined")
					avatarObj = Avatar01;
				else
					avatarObj = omniAvatarAr[arguments[i+1]];
				break;
			case "gender":
				AvatarGender = arguments[i+1];
				break;
			case "container":
				avtcontainer = arguments[i+1];
				break;
			case "return":
				avtreturn = arguments[i+1];
				break;
			default:
		}
	}

	if (avatarObj == null || avatarObj == undefined)
	{
		avatarObj = Avatar01;
	}

	if (AvatarGender == "female")
		avatarObj['image'] = avatarObj['imageF'];
	else
		avatarObj['image'] = avatarObj['imageM'];


	Omni_Unique++;

	var printOmniAvatar = '<input type="button" id="Avatar' + Omni_Unique + '" name="Avatar' + Omni_Unique + '" onclick="MoreInfo(\'2\');" '
		+ 'value="" style="cursor:pointer;height:'+avatarObj['height']+'px;width:'+avatarObj['width']+'px;background:url(\'' + avatarObj['image'] + '\');border:0px;margin:0px;padding:0px;" title="' + avatarObj['text'] + '" />';

	if (avtcontainer != "")
		document.getElementById(avtcontainer).innerHTML += printOmniAvatar;
	else if (avtreturn != "")
		return printOmniAvatar;
	else
		document.write(printOmniAvatar);
}

function SetAvatar(AvatarIn)
{
	You = AvatarIn;

	var charStr = "http://" + Omnidate_Server + "/od/SetAvatar.aspx?userid=" + Omni_userid + "&avatar=" + AvatarIn;
	if (Omni_dbid != "")
	{
		charStr += '&dbid=' + Omni_dbid;
	}
	if (Omni_lcId != "")
	{
		charStr += '&browser=' + Omni_lcId;
	}
	if (Omni_ShowDate != "")
	{
		charStr += '&showdate=false';
	}
	charStr += "&jsonp=?";

	// Call request.php and parse the return xml using OnRequestComplete.
	jQuery.getJSON(charStr, 
	function(p)
	{
		if (Omni_Debugging)
		{
			Omni_data += "SetAvatar("+AvatarIn+")<br />";
			jQuery("#containerX").html(Omni_data);
		}
	}
	);
}

function SetJobId(JobIn)
{
	Omni_JobID = JobIn;

	var jobStr = "http://" + Omnidate_Server + "/od/SetJobID.aspx?userid=" + Omni_userid + "&jobid=" + JobIn;
	if (Omni_dbid != "")
	{
		jobStr += '&dbid=' + Omni_dbid;
	}
	jobStr += "&jsonp=?";


	if (Omni_Debugging) 
	{
		Omni_data += "SetJobId("+jobStr+")<br />";
		jQuery("#containerX").html(Omni_data);
	}

	jQuery.getJSON(jobStr, 
		function(p)
		{
			// Do nothing
		}
	);
}

function Omni_ShowAvatar()
{
	MoreInfo('2');
}

/***************************************************************************************************************
************	Banner Functions
***************************************************************************************************************/

var BannerObj = new Object;
BannerObj['Grey01'] = true;
BannerObj['Magenta01'] = true;
BannerObj['Blue01'] = true;
BannerObj['Red01'] = true;
BannerObj['Brown01'] = true;



var MessageAr = new Array();
var OmniLangAr = new Array();
OmniLangAr["Inviting"] = "Inviting";
OmniLangAr["Invite"] = "Invite";
OmniLangAr["Cancel"] = "Cancel";
OmniLangAr["Okay"] = "Okay";
OmniLangAr["Accept"] = "Accept"
OmniLangAr["Decline"] = "Decline"
OmniLangAr["SecsRem"] = "Seconds Remaining";
OmniLangAr["Secs"] = "Seconds";
OmniLangAr["SelectDest"] = "Select a Destination";
OmniLangAr["PersonalMsg"] = "Personal Message";
OmniLangAr["Decline0"] = "Decline by selecting a response";
OmniLangAr["Decline1"] = "No, thank you.";
OmniLangAr["Decline2"] = "Sorry, not right now.";
OmniLangAr["Decline3"] = "You're not really my type.";
OmniLangAr["Decline4"] = "Let's reschedule.";
OmniLangAr["ViewProfile"] = "view profile";
OmniLangAr["SelectAvatar"] = "Select Avatar";




function Omni_Language()
{
	if (Omni_lang == "fr")
	{
		OmniLangAr["Inviting"] = "Inviter"
		OmniLangAr["Invite"] = "Inviter";
		OmniLangAr["Cancel"] = "Annuler";
		OmniLangAr["Okay"] = "Okay";
		OmniLangAr["Accept"] = "Accepter"
		OmniLangAr["Decline"] = "Refuser";
		OmniLangAr["SecsRem"] = "Secondes Restantes";
		OmniLangAr["Secs"] = "Secondes";
		OmniLangAr["SelectDest"] = "Choisissez une Destination";
		OmniLangAr["PersonalMsg"] = "Message Personnel";
		OmniLangAr["Decline0"] = "Déclin, avec réponse.";
		OmniLangAr["Decline1"] = "Non, merci.";
		OmniLangAr["Decline2"] = "Désolé, pas maintenant.";
		OmniLangAr["Decline3"] = "Vous ne me correspondez pas vraiment.";
		OmniLangAr["Decline4"] = "Une autre fois, oui.";
		OmniLangAr["DefaultInv"] = "Hey, voulez-vous me joindre pour un Date Virtuel?";
		OmniLangAr["InvDate"] = "Vous êtes invité à un DATE VIRTUEL!";
		OmniLangAr["ViewProfile"] = "voir profil";
		OmniLangAr["SelectAvatar"] = "Choisissez Avatar";
	
		// French
		MessageAr["0"] = "à un Date Virtuel";
		MessageAr["1"] = "à un Chat";
		MessageAr["2"] = "Votre demande est expirée.";
		MessageAr["3"] = "Vous êtes actuellement occupé.";
		MessageAr["4"] = "Vous emmène à l'application...";
		MessageAr["5"] = "n'est pas disponible maintenant."; // _____ declined...
		MessageAr["6"] = "Oops, une erreur est survenue.";
		MessageAr["7"] = "a refusé votre demande.";  // _____ has cancelled...
		MessageAr["8"] = "Vous venez de rater une invitation de"; // from _____.
		MessageAr["9"] = "n'est plus disponible pour le moment."; // _____ no longer...
		MessageAr["10"] = "Cet utilisateur n'est plus disponible pour le moment.";
	}
	else if (Omni_lang == "he")
	{
		OmniLangAr["Inviting"] = "מזמין את"
		OmniLangAr["Invite"] = "הזמנה";
		OmniLangAr["Cancel"] = "ביטול";
		OmniLangAr["Okay"] = "סגירה";
		OmniLangAr["Accept"] = "לקבלת הזמנה"
		OmniLangAr["Decline"] = "סירוב";
		OmniLangAr["SecsRem"] = "שניות נותרו";
		OmniLangAr["Secs"] = "שניות";
		OmniLangAr["SelectDest"] = "בחירת מקום לדייט";
		OmniLangAr["PersonalMsg"] = "פנייה אישית";
		OmniLangAr["Decline0"] = "בחר תגובה";
		OmniLangAr["Decline1"] = "לא תודה, גלישה נעימה";
		OmniLangAr["Decline2"] = "סליחה, לא כרגע";
		OmniLangAr["Decline3"] = "אני אוותר בשלב זה";
		OmniLangAr["Decline4"] = "אולי בזמן אחר?";
		OmniLangAr["DefaultInv"] = "רוצה להשתתף באון-ליין דייט";
		OmniLangAr["InvDate"] = "קיבלת הזמנה לאון-ליין דייט";
		OmniLangAr["ViewProfile"] = "לצפייה בפרופיל";
		OmniLangAr["SelectAvatar"] = "לבחירת דמות";

		// Hebrew
		MessageAr["0"] = "לדייט";
		MessageAr["1"] = "לצ'אט";
		MessageAr["2"] = "החבר/ה לא הגיב, באפשרותך לפנות לחברים אחרים";
		MessageAr["3"] = "הסטאטוס שלך מוגדר כ-\"עסוק\"";
		MessageAr["4"] = "מעבירים אותך לאפליקציה";
		MessageAr["5"] = "החבר אינו יכול לקבל את הזמנתך כרגע"; // _____ declined...
		MessageAr["6"] = "אופס, קרתה תקלה";
		MessageAr["7"] = "ההזמנה מ-___ בוטלה";  // _____ has cancelled...
		MessageAr["8"] = "פיספסת הזמנה לאון-ליין דייט מאת-"; // from _____.
		MessageAr["9"] = "לא זמין כרגע"; // _____ no longer...
		MessageAr["10"] = "חבר זה אינו זמין כרגע";
	}
	else
	{
		// English

		if (Omni_verb == "chat")
		{
			MessageAr["0"] = "to Chat";
			MessageAr["1"] = "to Chat";
			MessageAr["2"] = "Your request has expired.";
			MessageAr["3"] = "You are currently occupied.";
			MessageAr["4"] = "Taking you to the chat...";
			MessageAr["5"] = "is not available right now."; // _____ declined...
			MessageAr["6"] = "Woops, error detected.";
			MessageAr["7"] = "has cancelled their request.";  // _____ has cancelled...
			MessageAr["8"] = "You missed an invitation from"; // from _____.
			MessageAr["9"] = "is no longer available."; // _____ no longer...
			MessageAr["10"] = "That user is no longer available.";

			OmniLangAr["DefaultInv"] = "Hi, I was wondering if you would like to chat?";
			OmniLangAr["InvDate"] = "You are being invited to Chat!";		
		}
		else
		{
			MessageAr["0"] = "on a Virtual Date";
			MessageAr["1"] = "to Chat";
			MessageAr["2"] = "Your request has expired.";
			MessageAr["3"] = "You are currently occupied.";
			MessageAr["4"] = "Taking you to the application...";
			MessageAr["5"] = "is not available right now."; // _____ declined...
			MessageAr["6"] = "Woops, error detected.";
			MessageAr["7"] = "has cancelled their request.";  // _____ has cancelled...
			MessageAr["8"] = "You missed an invitation from"; // from _____.
			MessageAr["9"] = "is no longer available."; // _____ no longer...
			MessageAr["10"] = "That user is no longer available.";

			OmniLangAr["DefaultInv"] = "Hi, would you like to join me on a virtual date?";
			OmniLangAr["InvDate"] = "You are being invited on a VIRTUAL DATE!";
		}
	}
}

function OmniGetBannerMessage(_MessageIn, _DateId, _DateName)
{
	var txtOmniStatus = "";

	if (_MessageIn != null && _MessageIn != "")
	{
		if (_MessageIn == "8")
		{
			if (Omni_profile != "")
				txtOmniStatus = MessageAr[_MessageIn] + " <a style='color:#0077cc;' href='#' onclick='onOkayClick();GoToProfile(\""+_DateId+"\",\""+_DateName+"\");'>"+ _DateName +"</a>";
			else
				txtOmniStatus = MessageAr[_MessageIn] + " " + _DateName;
		}
		else if (_MessageIn == "7" && Omni_lang == "he")
			txtOmniStatus =  MessageAr["7"].replace("___", _DateName);
		else if (_MessageIn == "7" || _MessageIn == "9" || (_MessageIn == "5" && Omni_lang != "he"))
			txtOmniStatus =  _DateName + " " + MessageAr[_MessageIn];
		else if (_MessageIn == "5" && Omni_lang == "he")
			txtOmniStatus = MessageAr[_MessageIn];
		else if ((_MessageIn == "0" || _MessageIn == "1") && Omni_lang == "he")
			txtOmniStatus = OmniLangAr["Inviting"] + " " + _DateName + " " + MessageAr[_MessageIn];
		else if (_MessageIn == "0" || _MessageIn == "1")
			txtOmniStatus =  OmniLangAr["Inviting"] + " " + _DateName + " " + MessageAr[_MessageIn];
		else
			txtOmniStatus = MessageAr[_MessageIn];
	}

	return txtOmniStatus;
}

function OmniGetBannerButton(buttonCode)
{
	// Button Codes (buttonCode)
	// 0 - Hide Both
	// 1 - Show "Okay"
	// 2 - Show "Cancel"
	var buttonhtml = "";
	
	if (buttonCode == "1")
	{
		buttonhtml = "<div style='float:left;' id='btnOmniDecline' name='btnOmniDecline' onclick='javascript:onOkayClick();' class='OmniSmallBtn01'>"+OmniLangAr["Okay"]+"</div>";
	}
	else if (buttonCode == "2")
	{
		buttonhtml = "<div style='float:left;' id='btnOmniDecline' name='btnOmniDecline' onclick='javascript:onCancelClick();' class='OmniSmallBtn01'>"+OmniLangAr["Cancel"]+"</div>";
	}
	else
	{
		buttonhtml = "";
	}

	return buttonhtml;
}


function OmniGetViewProfile(_DateId, _DateName)
{
	//return "";
	if (_DateName != "" && _DateId != "" && Omni_profile != "")
		return "<a style='font-size:11px; color:#0077cc;' href='javascript:GoToProfile(\""+_DateId+"\",\""+_DateName+"\");'>"+OmniLangAr["ViewProfile"]+"</a>";
	else
		return "";
}



var OmniCurrentDate = new Object();

function OmniGetProfile(_DateId)
{
	return;
}

function OmniGetProfileUrl(_DateId, _DateName)
{
	if (Omni_profiletype == "username")		
		ProfileId = _DateName;
	else		
		ProfileId = _DateId;

	//if (Omni_Debugging) 
	//{
		Omni_data += "<h2>OmniGetProfile(_DateName="+_DateName+", _DateId="+_DateId+", ProfileId="+ProfileId+");</h2>";
		jQuery("#containerX").html(Omni_data);
	//}

	var profileurl = "";
	if (Omni_userxml != "" && ProfileId != "")
		profileurl = Omni_userxml + ProfileId;
	
	// Add paramater to LavaLife call
	if (profileurl != "" && passedParamAr[0] != "" && Omni_dbid != "TEST")
		profileurl += "_" + passedParamAr[0];

	// Add caller id when specified
	if (Omni_setcaller != "" && Omni_profiletype == "username")
		profileurl += "&userid2=" + YourName;
	else if (Omni_setcaller != "")
		profileurl += "&userid2=" + YourId;

	return encodeURIComponent(profileurl);
}

function Omni_ProfileXml(_DateId, _DateName)
{
	if (OmniCurrentDate.YourDateId != _DateId)
	{
		var tag = new FlashTag("http://www.omnidate.net/OmniXmlProfileLoader.swf", "1", "1", "10,0,0,0");
		tag.setAllowScriptAccess("always");
		tag.setId("OmniXmlProfileLoader");
		tag.setWmode("transparent");

		var profileUrl = OmniGetProfileUrl(_DateId, _DateName);

		if (profileUrl != "")
			tag.setFlashvars("profileurl="+profileUrl);

		OmniCurrentDate = new Object();
		OmniCurrentDate.YourDateId = _DateId;

		return tag.toString();
	}
	return "";
}

function Omni_SetProfile(data)
{
	OmniCurrentDate.profileName = data.name;
	OmniCurrentDate.profileGender = data.gender;
	OmniCurrentDate.profileAge = data.age;
	OmniCurrentDate.profileLocation = data.location;
	OmniCurrentDate.profilePhoto = data.photo;

	Omni_ProfileName("OmniBannerName");
	Omni_ProfileASL("OmniBannerASL");
	Omni_ProfilePhoto("OmniBannerPhoto");
}

var OmniTimeRemaining = 0;
var OmniInviteIntv = null;

function OmniCountdownTimer() 
{
	if (Omni_Debugging)
	{
		Omni_data += "OmniCountdownTimer("+OmniTimeRemaining+");<br />";
		jQuery("#containerX").html(Omni_data);
	}

	OmniInviteIntv = clearTimeout(OmniInviteIntv);

	OmniTimeRemaining--;

	if (OmniTimeRemaining > 0 && document.getElementById('OmniBannerTimeRem') != null)
	{
		document.getElementById('OmniBannerTimeRem').innerHTML = OmniTimeRemaining;
		OmniInviteIntv = setTimeout( "OmniCountdownTimer()", 1000 );
	}
	else
	{
		if (document.getElementById('OmniBannerTimeRem') != null)
			document.getElementById('OmniBannerTimeRem').innerHTML = "0";
		if (document.getElementById('OmniBannerAcceptDecline') != null)
			document.getElementById('OmniBannerAcceptDecline').innerHTML = "";
	}
}

function Omni_ProfileName()
{
	if (arguments[0] != null && document.getElementById(arguments[0]) != null && OmniCurrentDate.profileName != null)
	{
		if (document.getElementById('OmniViewProfile') != null && OmniCurrentDate.profileName != "")
			document.getElementById('OmniViewProfile').style.display = "block";
		
		document.getElementById(arguments[0]).innerHTML = OmniCurrentDate.profileName;
		return true;
	}
	else if (OmniCurrentDate.profileName != null)
	{
		if (document.getElementById('OmniViewProfile') != null && OmniCurrentDate.profileName != "")
			document.getElementById('OmniViewProfile').style.display = "block";

		return OmniCurrentDate.profileName;
	}
	else
		return false;
}
function Omni_ProfilePhoto()
{
	if (arguments[0] != null && document.getElementById(arguments[0]) != null && OmniCurrentDate.profilePhoto != null && OmniCurrentDate.profilePhoto != "")
	{
		document.getElementById(arguments[0]).innerHTML = "<img src='"+OmniCurrentDate.profilePhoto+"' id='omniProfilePhoto' />";
		return true;
	}
	else if (OmniCurrentDate.profilePhoto == "")
		return "";
	else if (OmniCurrentDate.profilePhoto != null)
		return "<img src='"+OmniCurrentDate.profilePhoto+"' id='omniProfilePhoto' />";
	else
		return false;
}
function Omni_ProfileASL()
{
	var bannerASL = "";
	var firstone = true;

	if (OmniCurrentDate.profileGender != null && OmniCurrentDate.profileGender != "")
	{
		bannerASL += OmniCurrentDate.profileGender;
		firstone = false;
	}
	if (OmniCurrentDate.profileAge != null && OmniCurrentDate.profileAge != "")
	{
		bannerASL += (firstone) ? "" : " / ";
		bannerASL += OmniCurrentDate.profileAge;
		firstone = false;
	}
	if (OmniCurrentDate.profileLocation != null && OmniCurrentDate.profileLocation != "")
	{
		bannerASL += (firstone) ? "" : "<br />";
		bannerASL += OmniCurrentDate.profileLocation;
		firstone = false;
	}

	if (arguments[0] != null && document.getElementById(arguments[0]) != null)
	{
		document.getElementById(arguments[0]).innerHTML = bannerASL;
		return true;
	}
	else if (OmniCurrentDate.profileGender != null && OmniCurrentDate.profileAge != null && OmniCurrentDate.profileLocation != null)
		return bannerASL;
	else
		return false;
}


function omnidateBanner(buttonCode, messageIn, inviteStatus, DateName, DateId, TimeRem, InviteMsg)
{
	// Invite Status
	// 0 = Notifiation
	// 1 = Sending Invite
	// 2 = VDate
	// 3 = VChat

	if (Omni_Debugging)
	{
		Omni_data += "omnidateBanner("+buttonCode+", "+messageIn+", "+inviteStatus+", "+DateName+", "+DateId+", "+TimeRem+", "+InviteMsg+");<br />";
		jQuery("#containerX").html(Omni_data);
	}


	var txtTimeRem = "0";
	// Set Time
	if (parseInt(TimeRem) > 0)
	{
		txtTimeRem = OmniTimeRemaining = parseInt(TimeRem);
		OmniInviteIntv = setTimeout( "OmniCountdownTimer()", 1000 );
	}
	else
	{
		txtTimeRem = "0";
		OmniInviteIntv = clearTimeout(OmniInviteIntv);
	}


	// Set Profile
	var ASLhtml = Omni_ProfileASL() || "";
	var profilePhoto = Omni_ProfilePhoto() || "";
	var profileName = Omni_ProfileName() || "";

	var passName = (profileName == "") ? DateName : profileName
	
	// Set Message
	var txtOmniStatus = OmniGetBannerMessage(messageIn, DateId, passName);
	BannerMessageNumber = messageIn;

	// Set Button
	var buttonhtml = OmniGetBannerButton(buttonCode);
	BannerButtonStatus = buttonCode;


	if (InviteMsg != "")
		InviteMsg = "\"" + InviteMsg + "\"";
	
	if (Omni_lang == "he")
	{
		Omni_RTL2 = "text-align:right;";
		Omni_RTL3 = "margin-left:40px;";
	}
	else
		Omni_RTL2 = "text-align:left;";

	if (inviteStatus == "1") // Sending
	{
		return ""+
			"<div class='OmniTopBg01 OmniTop"+Omni_bannerStyle+"B'>"+
			"		<div class='OmniHeading01'>"+
			"			"+txtOmniStatus+
			"			"+Omni_ProfileXml(DateId, DateName)+"</div>"+
			"</div>"+
			"<div class='OmniBottomBg01'>"+
			"	<div style='padding:15px 30px 0px 30px;'>"+
			"		<table cellpadding='5' class='OmniTable01' style='"+Omni_RTL2+"'>"+
			"			<tr>"+
			"				<td rowspan='2'><div style='padding-right:10px;'><div id='OmniBannerPhoto'>"+profilePhoto+"</div></div></td>"+
			"				<td width='100%'><div id='OmniBannerInvMsg'><em>"+InviteMsg+"</em></div></td>"+
			"			</tr>"+
			"			<tr>"+
			"				<td><span style='font-size:18px;' id='OmniBannerName'>"+profileName+"</span> <span id='OmniViewProfile'>"+OmniGetViewProfile(DateId, DateName)+"</span><div id='OmniBannerASL'>"+ASLhtml+"</div></td>"+
			"			</tr>"+
			"		</table>"+

			"		<div style='width:440px; margin-top:10px; padding-top:20px; border-top:1px dotted #666666;'>"+
			"			<div style='text-align:center;'><span id='OmniBannerTimeRem' class='OmniTimeRem01'>"+txtTimeRem+"</span> <span class='OmniTimeRem02'>"+OmniLangAr["SecsRem"]+"</span></div>"+
			"			<div style='margin:20px 0px 0px 170px;' id='btnOmniCancel' onclick='onCancelClick();' class='OmniSmallBtn01'>"+OmniLangAr["Cancel"]+"</div>"+
			"		</div>"+
					Omni_AudioPreloader("false") +
			"	</div>"+
			"</div>";
	}
	else if (inviteStatus == "2" || inviteStatus == "3") // Receiving
	{
		var txtInviteType = "";
		
		if (inviteStatus == "2") // Receving Virtual Date Invite
			txtInviteType = OmniLangAr["InvDate"]; // by "+DateName+"!";
		else if (inviteStatus == "3") // Receiving Chat Invite
			txtInviteType = "You are being invited to CHAT!"; // by "+DateName+"!";

		return ""+
			"<div class='OmniTopBg01 OmniTop"+Omni_bannerStyle+"A'>"+
			"		<div class='OmniHeading01'>"+
			"			"+txtInviteType+
			"			"+Omni_ProfileXml(DateId, DateName)+"</div>"+
			//"		<div class='Omni"+Omni_bannerStyle+"Close' onclick='onCancelClick();'></div>"+
			"</div>"+
			"<div class='OmniBottomBg01'>"+
			"	<div style='padding:15px 30px 0px 30px;'>"+
			"		<table cellpadding='5' class='OmniTable01' style='"+Omni_RTL2+"'>"+
			"			<tr>"+
			"				<td rowspan='2'><div style='padding-right:10px;'><div id='OmniBannerPhoto'>"+profilePhoto+"</div></div></td>"+
			"				<td width='100%'><div id='OmniBannerInvMsg'><em>"+InviteMsg+"</em></div></td>"+
			"			</tr>"+
			"			<tr>"+
			"				<td><span style='font-size:18px;' id='OmniBannerName'>"+profileName+"</span> <span id='OmniViewProfile'>"+OmniGetViewProfile(DateId, DateName)+"</span><div id='OmniBannerASL'>"+ASLhtml+"</div></td>"+
			"			</tr>"+
			"		</table>"+

			"		<div style='width:440px; margin-top:10px; padding-top:15px; border-top:1px dotted #666666;'>"+
			"			<div>"+
			"				<div style='text-align:center;'><span id='OmniBannerTimeRem' class='OmniTimeRem01'>"+txtTimeRem+"</span> <span class='OmniTimeRem02'>"+OmniLangAr["SecsRem"]+"</span></div>"+
			"			</div>"+
			"			<div style='width:440px; margin-top:10px; id='OmniBannerAcceptDecline'>"+
			"				<div style='height:25px; width:180px; float:left; "+Omni_RTL2+Omni_RTL3+"'><span class='OmniHeading04'>"+OmniLangAr["Decline"]+"</span><br />"+
			"					<select name='OmniDeclineDrop' id='OmniDeclineDrop' class='limited-width' onchange=\"acceptOrDecline('false');\" onMouseDown=\"if(document.all) this.className='expanded-width';\" onBlur=\"if(document.all) this.className='limited-width';\" onChange=\"if(document.all) this.className='limited-width';\" >"+
			"						<option value=\""+OmniLangAr["Decline0"]+"\">"+OmniLangAr["Decline0"]+"</option>"+
			"						<option value=\""+OmniLangAr["Decline1"]+"\">"+OmniLangAr["Decline1"]+"</option>"+
			"						<option value=\""+OmniLangAr["Decline2"]+"\">"+OmniLangAr["Decline2"]+"</option>"+
			"						<option value=\""+OmniLangAr["Decline3"]+"\">"+OmniLangAr["Decline3"]+"</option>"+
			"						<option value=\""+OmniLangAr["Decline4"]+"\">"+OmniLangAr["Decline4"]+"</option>"+
			"					</select>"+
			"				</div>"+
			"				<div id='btnOmniAccept' name='btnOmniAccept' class='OmniLargestBtn02' style='float:right; margin:4px 0px 0px 0px;' onclick='AcceptDate(\"invitee\",\""+DateId+"\");'>"+OmniLangAr["Accept"]+"</div>"+
			"			</div>"+
			"		</div>"+
					Omni_AudioPreloader("true") +
			"	</div>"+
			"</div>";
	}
	else if (inviteStatus == "0")
	{
		// Status Notification
		//alert(DateName);
		var printthistable = "";
		if (InviteMsg != "")
		{

			printthistable = "			<tr><td rowspan='2'><div style='padding-right:10px;'><div id='OmniBannerPhoto'>"+profilePhoto+"</div></div></td>"+
							"				<td width='100%'><div id='OmniBannerInvMsg'><em>"+InviteMsg+"</em></div></td></tr>"+
							"			<tr><td><span style='font-size:18px;' id='OmniBannerName'>"+profileName+"</span> <span id='OmniViewProfile'>"+OmniGetViewProfile(DateId, DateName)+"</span><div id='OmniBannerASL'>"+ASLhtml+"</div></td></tr>";
		}
		else
		{
			printthistable = "			<tr><td><div style='padding-right:10px;'><div id='OmniBannerPhoto'>"+profilePhoto+"</div></div></td>"+
							"			<td width='100%'><span style='font-size:18px;' id='OmniBannerName'>"+profileName+"</span> <span id='OmniViewProfile'>"+OmniGetViewProfile(DateId, DateName)+"</span><div id='OmniBannerASL'>"+ASLhtml+"</div></td></tr>";
		}

		return ""+
			"<div class='OmniTopBg01 OmniTop"+Omni_bannerStyle+"A'>"+
			"		<div class='OmniHeading01'>"+Omni_ProfileXml(DateId, DateName)+"</div>"+
			"</div>"+
			"<div class='OmniBottomBg01'>"+
			"	<div style='padding:15px 30px 0px 30px;'>"+

			"		<table cellpadding='5' class='OmniTable01' style='"+Omni_RTL2+"'>"+
						printthistable +
			"		</table>"+

			"		<div style='width:440px; margin-top:10px; padding-top:25px; border-top:1px dotted #666666;'>"+
			"			<div style='text-align:center;'><span class='OmniHeading03'>"+txtOmniStatus+"</span></div>"+
			"			<div style='margin:25px 0px 0px 170px;'>" + buttonhtml + "</div>"+
			"		</div>"+
					Omni_AudioPreloader("false") +
			"	</div>"+
			"</div>";
	
	}


	OmniDate_HideBanner();
	return "";
}




function Omni_Destinations()
{
	var tag = new FlashTag("http://www.omnidate.net/destinations_1_1.swf", "400", "130", "10,0,0,0");
	tag.setAllowScriptAccess("always");
	tag.setId("OmniDestinations");
	tag.setWmode("transparent");

	if (Omni_appver.charAt(0) == "5" || Omni_appver.charAt(0) == "6")
		tag.setFlashvars("XMLinput=destinationsAS3.xml");

	Omni_Unique++;
	return tag.toString();
}

function Omni_AudioPreloader(_PlayInvite)
{
	var flashVars = "You=" + You + "&YourDate=" + YourDate + "&PlayInvite=" + _PlayInvite + "&SoundStart=" + Omni_sound;
	if (Omni_appver != "")
		flashVars += "&App=OmniDate_"+Omni_appver+".swf";		
	
	if (Omni_alert != "")
		flashVars += "&AlertSound=" + Omni_alert;
	else if (Omni_AppMode == "1")
		flashVars += "&AlertSound=chime";

	if (Omni_AppMode == "1")
		flashVars += "&Preload=false";

	var YourDateGraphicServerLoader = (YourDate.substr(0,4) == "User") ? YourDateGraphicServer : "www.omnidate.net"; // All presets are on omnidate.net
	var YourGraphicServerLoader = (You.substr(0,4) == "User") ? YourGraphicServer : "www.omnidate.net"; // All presets are on omnidate.net;
	flashVars += "&YourDateGraphicServer=" + YourDateGraphicServerLoader;
	flashVars += "&YourGraphicServer=" + YourGraphicServerLoader;
	
	var tag = new FlashTag("http://www.omnidate.net/OmniAudioPreloader.swf", "1", "1", "10,0,0,0");
	tag.setAllowScriptAccess("always");
	tag.setId("OmniAudioPreloader");
	tag.setWmode("transparent");
	tag.setFlashvars(flashVars);

	Omni_Unique++;
	return tag.toString();
}












function OmniDate_HideBanner()
{
	if (Omni_Debugging) Omni_data += "OmniDate_HideBanner()<br />";
	OmniInviteIntv = clearTimeout(OmniInviteIntv);
	OmniDate_VisibleBanner('OmniFloatingLayer', false);
	var target = document.getElementById('OmniFloatingLayer');
	target.innerHTML = "";
}

function OmniDate_VisibleBanner(OmniLayer, ShowOnScreen)
{
	if (Omni_Debugging)
	{
		Omni_data += "OmniDate_VisibleBanner(" + OmniLayer +", "+ ShowOnScreen + ")<br />";
		jQuery("#containerX").html(Omni_data);
	}


	// Banner starts "visible=true" and off the page at -750px (see CSS)
	// This function hides the banner "visible=false" and moves it to the center of the page.
	BannerShowing = false;
	if (ShowOnScreen) {
		BannerShowing = true;
		InactiveAll();
	}

	OmniDate_ShowHide(OmniLayer, ShowOnScreen);
}


function onEndNotify(_omniuserid, _omniusername)
{
	if (Omni_Debugging) Omni_data += "onEndNotify()<br />";
	OmniDate_HideBanner();
	
	var cancelStr = "http://" + Omnidate_Server + "/od/DoAction.aspx?userid=" + Omni_userid + "&action=exitnow";
	if (Omni_dbid != "")
	{
		cancelStr += '&dbid=' + Omni_dbid;
	}
	if (Omni_lcId != "")
	{
		cancelStr += '&browser=' + Omni_lcId;
	}
	if (Omni_ShowDate != "")
	{
		cancelStr += '&showdate=false';
	}
	cancelStr += "&jsonp=?";


	jQuery.getJSON(cancelStr, 
	function(p)
	{
		OnEndNotifyComplete(_omniuserid, _omniusername);
		if (Omni_Debugging)
		{
			Omni_data += cancelStr + "<br />";
			jQuery("#containerX").html(Omni_data);
		}
	}
	);
}
function OnEndNotifyComplete(_omniuserid, _omniusername)
{
	if (Omni_Debugging) Omni_data += "OnEndNotifyComplete()<br />";

	dating = "";
	AreWeOnADate = false;
	Send();

	if (Omni_postdate != "")
		Omni_MoveTo(Omni_postdate + "?dateid=" + _omniuserid, Omni_movetype);
	else if (Omni_premium !== "")
		ShowRegisterBox();
	else if (Omni_dbid == "IS")
	{
		GoToProfile (_omniuserid, _omniusername);
	}
}


function onCancelClick()
{
	if (Omni_Debugging) Omni_data += "onCancelClick()<br />";
	OmniDate_HideBanner();
	
	var cancelStr = "http://" + Omnidate_Server + "/od/DoAction.aspx?userid=" + Omni_userid + "&action=exitnow";
	if (Omni_dbid != "")
	{
		cancelStr += '&dbid=' + Omni_dbid;
	}
	if (Omni_lcId != "")
	{
		cancelStr += '&browser=' + Omni_lcId;
	}
	if (Omni_ShowDate != "")
	{
		cancelStr += '&showdate=false';
	}
	cancelStr += "&jsonp=?";


	jQuery.getJSON(cancelStr, 
	function(p)
	{
		OnCancelComplete(p);
		if (Omni_Debugging)
		{
			Omni_data += cancelStr + "<br />";
			jQuery("#containerX").html(Omni_data);
		}
	}
	);
}
function OnCancelComplete(_this)
{
	if (Omni_Debugging) Omni_data += "OnCancelComplete()<br />";
	Send();
}

function onOkayClick()
{
	if (Omni_Debugging) Omni_data += "onOkayClick()<br />";
	OmniDate_HideBanner();

	var clearStr = "http://" + Omnidate_Server + "/od/DoAction.aspx?userid=" + Omni_userid + "&action=exitnow";
	if (Omni_dbid != "")
	{
		clearStr += '&dbid=' + Omni_dbid;
	}
	if (Omni_lcId != "")
	{
		clearStr += '&browser=' + Omni_lcId;
	}
	if (Omni_ShowDate != "")
	{
		clearStr += '&showdate=false';
	}
	clearStr += "&jsonp=?";

	
	jQuery.getJSON(clearStr, 
	function(p)
	{
		OnOkayComplete(p);
		if (Omni_Debugging)
		{
			Omni_data += clearStr + "<br />";
			jQuery("#containerX").html(Omni_data);
		}
	}
	);
}
function OnOkayComplete(_this)
{
	if (Omni_Debugging) Omni_data += "OnOkayComplete()<br />";
	Send();
}

/***************************************************************************************************************
************	Accept/Decline Dates
***************************************************************************************************************/
function acceptOrDecline(acceptdecline)
{
	var doAction = "";
	var acceptdeclineStr = "";
	var declineStr = "";


	if (acceptdecline == "false")
	{
		doAction = "exitnow";

		if (arguments.length > 1)
			declineStr = '&declinemsg=' + encodeURIComponent(arguments[1]);
		else
		{
			var target = document.getElementById("OmniDeclineDrop");
			declineStr = '&declinemsg=' + encodeURIComponent(target.options[target.selectedIndex].value);
		}

		OmniDate_HideBanner();
	}
	else if (acceptdecline == "true")
	{
		doAction = "accept";
		InactiveAll();
		if (Omni_ShowDate == "")
		{
			Omni_Modal(true);
		}
		BroadcastStatus("1", "0", "4", "0", "", "", "", "", "", "");

		if ((Omni_dbid == "JDUK" || Omni_dbid == "JDFR" || Omni_dbid == "JDIL") && (typeof(s_gi) != 'undefined') && (typeof(s_account) != 'undefined'))
		{		
			var s = s_gi(s_account);
			s.linkTrackVars = 'events';
			s.linkTrackEvents = 'event56';
			s.events = 'event56';
			s.tl(true, 'o', 'Click to Accept OmniDate_56');
		}
	}

	if (doAction != "") {
		acceptdeclineStr = "http://" + Omnidate_Server + "/od/DoAction.aspx?userid=" + Omni_userid + "&action=" + doAction;
		if (Omni_dbid != "")
		{
			acceptdeclineStr += '&dbid=' + Omni_dbid;
		}
		if (Omni_lcId != "")
		{
			acceptdeclineStr += '&browser=' + Omni_lcId;
		}
		if (Omni_ShowDate != "")
		{
			acceptdeclineStr += '&showdate=false';
		}
		if (declineStr != "")
		{
			acceptdeclineStr += declineStr;
		}
		acceptdeclineStr += "&jsonp=?";
	}

	jQuery.getJSON(acceptdeclineStr, 
	function(p)
	{
		if (acceptdecline == "true")
			OnAcceptComplete(p);
		else if (acceptdecline == "false")
			OnDeclineComplete(p);

		if (Omni_Debugging)
		{
			Omni_data += acceptdeclineStr + "<br />";
			jQuery("#containerX").html(Omni_data);
		}
	}
	);
}

function OnAcceptComplete(_this)
{
	if (Omni_Debugging) Omni_data += "OnAcceptComplete(Success="+_this.Status+")<br />";
	if (_this.Status == "SUCCESS" && Omni_ShowDate == "")
	{
		TakeMeOnTheDate();
	}
	else
	{
		// Woops, there was an error.
		if (_this.Status != "SUCCESS")
			BroadcastStatus("1", "1", "6", "0", "", "", "", "", "", "");
	}
}
function OnDeclineComplete(_this)
{
	if (Omni_Debugging) Omni_data += "OnDeclineComplete(Success="+_this.Status+")<br />";
	BroadcastStatus("0", "", "", "", "", "", "", "", "", "")
	Send();
}



/***************************************************************************************************************
************	POPUP Functions
***************************************************************************************************************/
var omnidateWindow;

function AcceptDate(_type, _dateid)
{
	if (Omni_Popup != "")
	{
		var popupstringvars = "user="+YourId+"&username="+YourName+"&gender="+YourGender+"&dbid="+Omni_dbid+"&jsver=6_2_1&cssver=6";
		var WindowConfig = 'status=no, toolbar=no, location=no, directories=no, menubar=no, scrollbars=no';

		if (navigator.appName.indexOf("Microsoft")>=0)
		{
			WindowConfig+=',left=10,top=10,width=740,height=570';
		}
		else
		{
			WindowConfig += ',screenX=10,screenY=10,width=740,height=570';
		}

		if (Omni_dbid == "TEST") omnidateWindow = window.open(Omni_Popup+"?"+popupstringvars, 'omnidate', WindowConfig);
		else omnidateWindow = window.open(Omni_Popup, 'omnidate', WindowConfig);

		if (omnidateWindow == null || typeof(omnidateWindow) == "undefined")
		{
			// Popups are blocked

			if (_type == "inviter")
			{
				OmniDate_VisibleBanner('OmniFloatingLayerNotification', true);
				var target = document.getElementById('OmniFloatingLayerNotification');
				target.innerHTML = ""+
					"<div class='OmniTopBg01 OmniTop"+Omni_bannerStyle+"B'>"+
					"		<div class='OmniHeading01'>Pop-ups Are Blocked</div>"+
					"</div>"+
					"<div class='OmniBottomBg01'>"+
					"	<div style='padding:15px 30px 0px 30px;'>"+
					"		To enable Virtual Dating...<ol>"+
					"			<li>Click \"Tools\" from the top right of your browser.</li>"+
					"			<li>Select \"Internet Options\" from the Tools drop down.</li>"+
					"			<li>In the \"Privacy\" tab click \"Setting\" under the \"Pop-up Blocker\" section.</li>"+
					"			<li>Ensure the \"Blocking Level\" drop-down is set either \"Medium\" or \"Low\".</li>"+
					"			<li>Press \"Close\" and \"Okay\" on the two open windows respectively.</li>"+
					"		</ol>"+
					"		<div style='width:440px; margin-top:10px; padding-top:15px; border-top:1px dotted #666666;'>"+
					"			<div style='text-align:center;'><span class='OmniHeading03'>You are now ready to create an invite!</span></div>"+
					"			<div style='margin:15px 0px 0px 170px;'><div style='float:left;' id='btnOmniDecline' name='btnOmniDecline' onclick='javascript:OmniDate_VisibleBanner(\"OmniFloatingLayerNotification\", false);' class='OmniSmallBtn01'>"+OmniLangAr["Okay"]+"</div></div>"+
					"		</div>"+
					"	</div>"+
					"</div>";
			}
			else if (_type == "invitee")
			{
				acceptOrDecline("false", "Your date is unable to accept your invitation because they do not have popups enabled.");


				OmniDate_VisibleBanner('OmniFloatingLayerNotification', true);
				var target = document.getElementById('OmniFloatingLayerNotification');
				target.innerHTML = ""+
					"<div class='OmniTopBg01 OmniTop"+Omni_bannerStyle+"B'>"+
					"		<div class='OmniHeading01'>Pop-ups Are Blocked</div>"+
					"</div>"+
					"<div class='OmniBottomBg01'>"+
					"	<div style='padding:12px 30px 0px 30px;'>"+
					"		<div style='text-align:center; border-bottom:1px dotted #666666; padding-bottom:8px; margin-bottom:8px;'><span class='OmniHeading03'>You were unable to accept the Virtual Date invite.</span></div>"+
					"		To enable Virtual Dating...<ol>"+
					"			<li>Click \"Tools\" from the top right of your browser.</li>"+
					"			<li>Select \"Internet Options\" from the Tools drop down.</li>"+
					"			<li>In the \"Privacy\" tab click \"Setting\" under the \"Pop-up Blocker\" section.</li>"+
					"			<li>Ensure the \"Blocking Level\" drop-down is set either \"Medium\" or \"Low\".</li>"+
					"			<li>Press \"Close\" and \"Okay\" on the two open windows respectively.</li>"+
					"		</ol>"+
					"		<div style='width:440px; margin-top:8px; border-top:1px dotted #666666;'>"+
					"			<div style='margin:12px 0px 0px 170px;'><div style='float:left;' id='btnOmniDecline' name='btnOmniDecline' onclick='javascript:OmniDate_VisibleBanner(\"OmniFloatingLayerNotification\", false);' class='OmniSmallBtn01'>"+OmniLangAr["Okay"]+"</div></div>"+
					"		</div>"+
					"	</div>"+
					"</div>";
			}

			var logpopupStr = "http://" + Omnidate_Server + "/od/log.aspx?dbid=" + Omni_dbid +"&userid=" + Omni_userid + "&eventid=505";
			logpopupStr += '&data=' + encodeURIComponent(Omni_browserName + " " + Omni_fullVersion + ", " + _type);
			logpopupStr += "&jsonp=?";
			
			jQuery.getJSON( logpopupStr, 
				function(p)
				{
				}
			);

		}
		else
		{
			if (_type == "inviter")
				OnRequest(_dateid, "0");
			else if (_type == "invitee")
				acceptOrDecline("true");
		}
	}
	else if (Omni_userclass != "")
	{

		// 1 - Non-Subscriber, can not invite, and can accept from Premium only
		// 2 - Subscriber, can invite all and accept all invites, but subs can't accept
		// 3 - Premium, can invite all, accept all
		
		if (_type == "inviter" && Omni_userclass == "1")
		{
			OmniDate_VisibleBanner('OmniFloatingLayerNotification', true);
			var target = document.getElementById('OmniFloatingLayerNotification');
			target.innerHTML = ""+
				"<div class='OmniTopBg01 OmniTop"+Omni_bannerStyle+"A'>"+
				"		<div class='OmniHeading01'>Sign Up Now to Enjoy Virtual Dating!</div>"+
				"</div>"+
				"<div class='OmniBottomBg01'>"+
				"	<div style='padding:15px 30px 0px 30px;'>"+
				"		<div style='text-align:center; border-bottom:1px dotted #666666; padding-bottom:10px; margin-bottom:10px;'><span class='OmniHeading03'>You were unable to create the Virtual Date invite.</span></div>"+
				"		By registering for a jDate account, you will enjoy all of the benefits of <i>Virtual Dating</i>, as well as:"+
				"<ul><li>Connect with hundreds of thousands of Jewish singles around the world</li>"+
				"<li>View 1,000s of new members added each week</li>"+
				"<li>Receive matches for free</li></ul>"+
				"		<div style='width:440px; margin-top:10px; border-top:1px dotted #666666;'>"+
				"			<div style='text-align:center; margin-top:10px;'><span class='OmniHeading03'>Sign Up Now!</span></div>"+
				"			<div style='margin:15px 0px 0px 170px;'><div style='float:left;' id='btnOmniRegister' name='btnOmniRegister' onclick='javascript:SparkRegister(\""+_dateid+"\");' class='OmniSmallBtn01'>"+OmniLangAr["Okay"]+"</div></div>"+
				"		</div>"+
				"	</div>"+
				"</div>";
		}
		else if (_type == "inviter" && (Omni_userclass == "2" || Omni_userclass == "3"))
			OnRequest(_dateid, "0");


		else if (_type == "invitee" && Omni_userclass == "1")
		{
			if (passedParamAr[1] == "3")
			{
				acceptOrDecline("true");
			}
			else
			{
				if (Omni_lang == "he")
				{
					acceptOrDecline("false", "אין באפשרותי להענות להזמנתך כרגע, אני אנסה לחזור אלייך בעוד מספר דקות במידה ותהיה זמין.");
			
					var target = document.getElementById('OmniFloatingLayerNotification');
					target.innerHTML = ""+
						"<div class='OmniTopBg01 OmniTop"+Omni_bannerStyle+"A'>"+
						"		<div class='OmniHeading01'>הצטרף כעת ותוכל להינות משירות הדייט הוירטואלי החדשני</div>"+
						"</div>"+
						"<div class='OmniBottomBg01' style='text-align:right;'>"+
						"	<div style='padding:15px 30px 0px 30px; line-height:110%;'>"+
						"		<div style='text-align:center; border-bottom:1px dotted #666666; padding-bottom:10px; margin-bottom:10px;'><span class='OmniHeading03'>אין באפשרותך כרגע לקבל את הזמנת הדייט הוירטואלי</span></div>"+
						"		מייד עם הצטרפותך לשירות תוכל לחוות את הדייט הוירטואלי ובנוסף להינות מכל יתרונות המנוי:"+
						"<ul style='margin-right:20px; line-height:110%; list-style-type: circle;'><li>תוכל ליצור קשר עם כלל חברי האתר.</li>"+
						"<li>תוכל להשיב לכל פניה שתקבל, ואתה תקבל.</li>"+
						"<li>תוכל לפתוח בשיחת מסנג'ר און ליין עם מי שימצא חן בעיניך.</li></ul>נגמר לנו המקום אבל יש לנו עוד יתרונות בפנים..."+
						"		<div style='width:440px; margin-top:10px; border-top:1px dotted #666666;'>"+
						"			<div style='text-align:center; margin-top:10px;'><span class='OmniHeading03'>הצטרף כעת</span></div>"+
						"			<div style='margin:15px 0px 0px 170px;'><div style='float:left;' id='btnOmniRegister' name='btnOmniRegister' onclick='javascript:SparkRegister(\""+_dateid+"\");' class='OmniSmallBtn01'>לרכישה</div></div>"+
						"		</div>"+
						"	</div>"+
						"</div>";
				}

				else if (Omni_lang == "fr")
				{
					acceptOrDecline("false", "Je ne peux pas répondre à ton invitation dans l'immédiat. J'espère pouvoir revenir vers toi dans quelques minutes, si tu es disponible.");
			
					var target = document.getElementById('OmniFloatingLayerNotification');
					target.innerHTML = ""+
						"<div class='OmniTopBg01 OmniTop"+Omni_bannerStyle+"A'>"+
						"		<div class='OmniHeading01' style='font-size:13px; padding-top:32px;'>Souscrivez dès maintenant et profitez de notre service de Rencontre Virtuelle!</div>"+
						"</div>"+
						"<div class='OmniBottomBg01' style='font-size:11px;'>"+
						"	<div style='padding:15px 30px 0px 30px;'>"+
						"		<div style='text-align:center; border-bottom:1px dotted #666666; padding-bottom:10px; margin-bottom:10px;'><span class='OmniHeading03' style='font-size:14px;'>Nous nous excusons, pour le moment vous ne pouvez pas recevoir d’invitation de rencontre virtuelle.</span></div>"+
						"		Immédiatement après votre souscription à ce service, vous pourrez expérimenter la rencontre virtuelle et bénéficier en plus de tous les avantages de l’abonnement:"+
						"<ul><li>Envoyer des emails à n’importe quel membre du site</li>"+
						"<li>Répondre aux emails de membres qui s'intéressent à vous.</li>"+
						"<li>Entrer en contact grâce à notre service de messagerie instantanée</li></ul>... et encore de nombreux avantages!"+
						"		<div style='width:440px; margin-top:10px; border-top:1px dotted #666666;'>"+
						"			<div style='text-align:center; margin-top:10px;'><span class='OmniHeading03'>Inscrivez-vous dès maintenant</span></div>"+
						"			<div style='margin:15px 0px 0px 170px;'><div style='float:left;' id='btnOmniRegister' name='btnOmniRegister' onclick='javascript:SparkRegister(\""+_dateid+"\");' class='OmniSmallBtn01'>Acheter</div></div>"+
						"		</div>"+
						"	</div>"+
						"</div>";
				}

				else
				{
					acceptOrDecline("false", "I'm unable to accept your invitiation currently. I may invite you again in a few minutes if you're still free.");
				
					var target = document.getElementById('OmniFloatingLayerNotification');
					target.innerHTML = ""+
						"<div class='OmniTopBg01 OmniTop"+Omni_bannerStyle+"A'>"+
						"		<div class='OmniHeading01'>Sign Up Now to Enjoy Virtual Dating!</div>"+
						"</div>"+
						"<div class='OmniBottomBg01'>"+
						"	<div style='padding:15px 30px 0px 30px;'>"+
						"		<div style='text-align:center; border-bottom:1px dotted #666666; padding-bottom:10px; margin-bottom:10px;'><span class='OmniHeading03'>You were unable to accept the Virtual Date invite.</span></div>"+
						"		By registering for a jDate account, you will enjoy all of the benefits of <i>Virtual Dating</i>, as well as:"+
						"<ul><li>Connect with hundreds of thousands of Jewish singles around the world</li>"+
						"<li>View 1,000s of new members added each week</li>"+
						"<li>Receive matches for free</li></ul>"+
						"		<div style='width:440px; margin-top:10px; border-top:1px dotted #666666;'>"+
						"			<div style='text-align:center; margin-top:10px;'><span class='OmniHeading03'>Sign Up Now!</span></div>"+
						"			<div style='margin:15px 0px 0px 170px;'><div style='float:left;' id='btnOmniRegister' name='btnOmniRegister' onclick='javascript:SparkRegister(\""+_dateid+"\");' class='OmniSmallBtn01'>"+OmniLangAr["Okay"]+"</div></div>"+
						"		</div>"+
						"	</div>"+
						"</div>";
				}
				OmniDate_VisibleBanner('OmniFloatingLayerNotification', true);
			}
		}
		else if (_type == "invitee" && (Omni_userclass == "2" || Omni_userclass == "3"))
			acceptOrDecline("true");
	}
	else
	{
		if (_type == "inviter")
			OnRequest(_dateid, "0");
		else if (_type == "invitee")
			acceptOrDecline("true");
	}
}

function SparkRegister(_user)
{
	OmniDate_VisibleBanner("OmniFloatingLayerNotification", false);
	if (Omni_regurl != "")
	{
		Omni_regurl += _user;
		Omni_MoveTo(Omni_regurl, Omni_movetype);
	}
}

function AssociateDateWindow()
{
	omnidateWindow = window.open('', 'omnidate');
}


function ShowDateAlert(ShowOnScreen)
{
	if (window.self.name != "omnidate" && (Omni_Popup != ""))
	{

		if (typeof(omnidateWindow)=="undefined" && ShowOnScreen)
		{
			//AssociateDateWindow();
			//AcceptDate();
		}

		OmniDate_ShowHide("OmniFloatingLayerDateAlert", ShowOnScreen);

		var target = document.getElementById('OmniFloatingLayerDateAlert');
		if (ShowOnScreen)
		{
			target.innerHTML = 'You are currently on a Virtual Date';
		}
		else
			target.innerHTML = '';
	}
}

/*
function DateWindowFocus()
{
	if (typeof(omnidateWindow)!="undefined" && !omnidateWindow.closed){
		omnidateWindow.blur();
		omnidateWindow.focus();
	}
	else {
		AcceptDate();
	}
}
*/

function Omni_SetWindowUnload(_set)
{
	if (_set == true && window.self.name == "omnidate")
	{
		window.onbeforeunload = function () {
			return "Clicking the 'End Date' button (top right corner) is a friendlier way to end your date. Are you sure you want to close it this way?";
		};
	}
	else
	{
		window.onbeforeunload = function () {};
	}
}
Omni_SetWindowUnload(true);


/***************************************************************************************************************
************	Go On The Date
***************************************************************************************************************/
function TakeMeOnTheDate()
{
	if (!AreWeOnADate) // This is NO window open
	{
		if (Omni_Popup == "" || window.self.name == "omnidate")
		{
			dating = "true";
			AreWeOnADate = true;
		}
		if (window.self.name == "omnidate")
		{
			document.body.style.overflow = "hidden";
		}

		IgnorePingReturn = true;

		OmniDate_HideBanner();
		Omni_Modal(true);

		if (Omni_Debugging)
		{
			Omni_data += "TakeMeOnTheDate()<br />";
			jQuery("#containerX").html(Omni_data);
		}

		TakeMeOnTheDateComplete(null)
	}
}


var BeenOnADateThisSession = 0;
function TakeMeOnTheDateComplete(_this) 
{
	if (Omni_Debugging)
	{
		Omni_data += "TakeMeOnTheDateComplete()<br />";
		jQuery("#containerX").html(Omni_data);
	}

	var LocationString = "";

	var dateObj = new Object();
	dateObj.You = You;
	dateObj.YourDate = YourDate;
	dateObj.Table = Omni_Table;
	dateObj.ChatServer = Omni_ChatServer;
	dateObj.YourId = YourId;
	dateObj.YourName = YourName;
	dateObj.YourGender = YourGender;
	dateObj.YourDateId = YourDateId;
	dateObj.YourDateName = YourDateName;
	dateObj.YourDateGender = YourDateGender;
	dateObj.StorylineFile = StorylineFile;
	dateObj.DbId = Omni_dbid;
	dateObj.DateStatus = DateStatus;
	dateObj.YourDateGraphicServer = (YourDate.substr(0,4) == "User") ? YourDateGraphicServer : "www.omnidate.net"; // All presets are on omnidate.net
	dateObj.YourGraphicServer = (You.substr(0,4) == "User") ? YourGraphicServer : "www.omnidate.net"; // All presets are on omnidate.net;
	dateObj.SoundStart = Omni_sound;
	dateObj.LoggingServer = Omnidate_Server;
	dateObj.Verb = Omni_verb;
	dateObj.lang = Omni_lang;
	dateObj.Style = Omni_bannerStyle;
	if (window.self.name == "omnidate") dateObj.Popup = "true";

	BeenOnADateThisSession = 0;
	


	if (Omni_userxml != "")
	{
		dateObj.ProfileURL = OmniGetProfileUrl(YourDateId, YourDateName);
	}

	if (Omni_survey != "")
	{
		dateObj.Survey = "true";
	}

	// Compound the object variables.
	var flashVars = ""; 
	var firstVar = true;
	for (OmniDate_i in dateObj) {
		flashVars += (firstVar) ? "" : "&";
		flashVars += OmniDate_i + "=" + dateObj[OmniDate_i];
		firstVar = false;
	};


	if (Omni_Popup == "")
	{
		GoToDate(flashVars);
	}
	else 
	{
		ShowDateAlert(true);
	}

	IgnorePingReturn = false;
	
	if (Omni_Popup == "")
		Send();
}


function GoToDate(OmniDate_variables)
{
	if (Omni_Debugging) 
	{
		Omni_data += "GoToDate()<br />";
		jQuery("#containerX").html(Omni_data);
		jQuery("#msgX").html(OmniDate_variables);
	}

	dating = "true";

	Omni_AppProxy = new FlashProxy(Omni_lcId+"_"+Omni_Unique, Omni_Server+"JavaScriptFlashGateway.swf"); 
	var omniapptype = "";


	if (Omni_AppMode == "1")
	{
		omniapptype = "OmniFloatingLayerChat";

		var target = document.getElementById('OmniFloatingLayerChat');
		Omni_chatver
		var tag = new FlashTag("http://www.omnidate.net/Omnichat_"+Omni_chatver+".swf", "250", "450", "10,0,0,0");
		if (!Omni_Safari_Hitch)
			tag.setWmode("transparent");
		tag.setBgcolor("FFFFFF");
		tag.setId("OmniChatMovie1");
		tag.setFlashvars("lcId=" + Omni_lcId+"_"+Omni_Unique+"&"+OmniDate_variables);
		tag.setAllowScriptAccess("always");
		tag.setAllowNetworking("all");

		if (getMyHeight() < 450 && Omni_Popup == "")
		{
			var target2 = document.getElementById('OmniFloatingLayerChat');
			target2.style.position = "absolute";
			target2.style.top = "0px";
			target2.style.marginTop = "0px";
		}

		target.innerHTML = tag.toString();
		Omni_ShowHideChat(true);
	}
	else
	{
		omniapptype = "OmniFloatingLayerDate";
		var target = document.getElementById(omniapptype);
		target.innerHTML = "";

		if (Omni_appver.charAt(0) == "4" || Omni_appver.charAt(0) == "5")
			var tag = new FlashTag("http://www.omnidate.net/OmniDate_"+Omni_appver+".swf", "820", "570", "10,0,0,0");
		else if (Omni_appver.charAt(0) == "6")
			var tag = new FlashTag("http://www.omnidate.net/OmniDate_"+Omni_appver+".swf", "740", "570", "10,0,0,0");
		
		if (Omni_isChrome && Omni_lang != "he")
			tag.setWmode("transparent");
		else if (Omni_isChrome && Omni_lang == "he")
			Omni_ShowAdverts(false);

		tag.setBgcolor("474747");
		tag.setId("OmniDateMovie1");
		tag.setFlashvars("lcId=" + Omni_lcId+"_"+Omni_Unique+"&"+OmniDate_variables);
		tag.setAllowScriptAccess("always");


		if ((getMyHeight() < 570) && Omni_Popup == "")
		{
			var target2 = document.getElementById('OmniFloatingLayerDate');
			if (target2.style.position != "absolute")
				target2.style.position = "absolute";
			target2.style.top = "0px";
			target2.style.marginTop = "0px";
		}

		target.innerHTML += tag.toString();
		Omni_ShowHideDate(true);	
	
	}
	Omni_Unique++;


	OmniDate_HideBanner();

	OmniDate_ShowHide("OmniFloatingLayerInfo", false);
	OmniDate_ShowHide(omniapptype, true);
	
	Omni_SetWindowUnload(true);
}


function FilterValues(WinParam, DocParam, BodyParam)
{
		var FilterResult = WinParam ? WinParam : 0;
		if (DocParam && (!FilterResult || (FilterResult > DocParam))) FilterResult = DocParam;
		return BodyParam && (!FilterResult || (FilterResult > BodyParam)) ? BodyParam : FilterResult;
}
function GetClientAreaWidth()
{
	return FilterValues (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}

function GetClientAreaHeight()
{
	return FilterValues (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}


var ModalShowing = false;
function Omni_Modal()
{
	if (arguments[0] == true || arguments[0] == false)
		ModalShowing = arguments[0];

	var ShowOnScreen = ModalShowing;

	if (Omni_Popup == "" && (Omni_AppMode != "1" || Omni_mode == "facebook") && window.self.name != "omnidate")
	{
		if (document.getElementById('OmniFloatingLayerModal') != null)
		{
			var clientHeight = GetClientAreaHeight();
			var clientWidth = GetClientAreaWidth();

			var obj = document.getElementById('OmniFloatingLayerModal');
			obj.style.visibility = ShowOnScreen ? "visible" : "hidden";
			obj.style.display = ShowOnScreen ? "block" : "none";
			obj.style.width = Math.max(document.body.scrollWidth, clientWidth) +'px';
			obj.style.height = Math.max(document.body.scrollHeight, clientHeight) + 'px';
			if (Omni_mode == "facebook")
			{

				if (Omni_AppMode == "1")
					obj.style.backgroundImage="url('http://www.omnidate.net/images/bgStarted-Chat.png')";
				else
				{
					obj.style.backgroundImage="url('http://www.omnidate.net/images/bgStarted.png')";
					obj.style.backgroundPositionY="150px";
				}
				obj.style.backgroundRepeat="repeat-y";
				obj.style.backgroundPositionX="center";
				obj.style.backgroundColor="#333333";
			}

		}
	}
}

function Quit()
{
	EndTheDate("1", null, null);
}

function EndTheDate(redirect, _omniuserid, _omniusername)
{

	if (Omni_Debugging)
	{
		Omni_data += "EndTheDate("+redirect+")<br />";
		jQuery("#containerX").html(Omni_data);
	}


	if (Omni_isChrome && Omni_lang == "he")
		Omni_ShowAdverts(true);


	if (redirect == "1" && window.self.name == "omnidate")
	{
		OnEndDate(_omniuserid, _omniusername);
	}
	else if (redirect == "1" || Omni_dbid == "IS")
	{
		OmniDate_ShowHide("OmniFloatingLayerDate", false);
		OmniDate_ShowHide("OmniFloatingLayerChat", false);

		Omni_Modal(false);

		var target = document.getElementById('OmniFloatingLayerDate');
		target.innerHTML = "";
		var target = document.getElementById('OmniFloatingLayerChat');
		target.innerHTML = "";

		if (Omni_Debugging) Omni_data += "<br /><br />END THE DATE<br /><br />";

		onEndNotify(_omniuserid, _omniusername); //hard close
		// This is the same as OnEndDate, except without redirection
		
	}
	else if (redirect == "2")
	{
		//Send();
		OnEndDate(_omniuserid, _omniusername);
	}

}

function OnEndDate(_omniuserid, _omniusername)
{
	if (Omni_Debugging) 
	{
		Omni_data += "onEndDate("+_omniuserid+","+_omniusername+")<br />";
		jQuery("#containerX").html(Omni_data);
	}

	var cancelStr = "http://" + Omnidate_Server + "/od/DoAction.aspx?userid=" + Omni_userid + "&action=exitnow";
	if (Omni_dbid != "")
	{
		cancelStr += '&dbid=' + Omni_dbid;
	}
	if (Omni_lcId != "")
	{
		cancelStr += '&browser=' + Omni_lcId;
	}
	if (Omni_ShowDate != "")
	{
		cancelStr += '&showdate=false';
	}
	cancelStr += "&jsonp=?";

	jQuery.getJSON(cancelStr, 
	function(p)
	{
		if (Omni_Debugging)
		{
			Omni_data += cancelStr + "<br />";
			jQuery("#containerX").html(Omni_data);
		}

		dating = "";
		AreWeOnADate = false;

		if (window.self.name == "omnidate")
		{
			Omni_SetWindowUnload(false);
			window.self.close();
		}
		else if (Omni_premium !== "")
			Omni_MoveTo(Omni_premium, Omni_movetype);
		else
			GoToProfile (_omniuserid, _omniusername);
	}
	);
}

function GoToProfile(_omniuserid, _omniusername)
{
	if (Omni_Debugging)
	{
		Omni_data += "<br />GoToProfile<br /><br />";
		jQuery("#containerX").html(Omni_data);
	}

	if (Omni_dbid == "IS")
		OpenDetailsWindowOD(_omniuserid);
	else if (Omni_profiletype == "username" || Omni_dbid == "PQ" && Omni_profile != "")
		Omni_MoveTo(Omni_profile + _omniusername, Omni_movetype);
	else if (Omni_profile != "")
		Omni_MoveTo(Omni_profile + _omniuserid, Omni_movetype);
}

var TakingSurvey = "";
function CallSurvey(DateNumber)
{
	if (Omni_survey != "" && DateNumber != TakingSurvey)
	{
		TakingSurvey = DateNumber;
		var WindowConfig = 'status=no, toolbar=no, location=no, directories=no, menubar=no, scrollbars=yes';

		if (navigator.appName.indexOf("Microsoft") >= 0)
			WindowConfig += ',left=150,top=20,width=570,height=375';
		else
			WindowConfig += ',screenX=150,screenY=20,width=570,height=375';

		window.open(Omni_survey+Omni_userid,'surveyWindow','location=0,status=0,scrollbars=1,width=570,height=375');
	}
}

function CallTimeout()
{
	if (Omni_Debugging) Omni_data += "CallTimeout();<br />";

	if (Omni_AppMode == "1")
	{
		Omni_getFlashMovie("OmniChatMovie1").CallTimeout();
	}
	else
	{
		if (Omni_appver.charAt(0) == "4")
			Omni_AppProxy.call('CallTimeout');
		else if(Omni_appver.charAt(0) == "5" || Omni_appver.charAt(0) == "6")
			Omni_getFlashMovie("OmniDateMovie1").CallTimeout();
	}
	
	if (Omni_Debugging)
		jQuery("#containerX").html(Omni_data);
}
function CallFinished()
{
	if (Omni_Debugging) Omni_data += "CallFinished();<br />";
	
	if (Omni_AppMode == "1")
	{
		Omni_getFlashMovie("OmniChatMovie1").CallFinished();
	}
	else
	{
		if (Omni_appver.charAt(0) == "4")
			Omni_AppProxy.call('CallFinished');
		else if(Omni_appver.charAt(0) == "5" || Omni_appver.charAt(0) == "6")
			Omni_getFlashMovie("OmniDateMovie1").CallFinished();
	}

	if (Omni_Debugging)
		jQuery("#containerX").html(Omni_data);
}


function Omni_getFlashMovie(movieName)
{
	var omni_isIE = navigator.appName.indexOf("Microsoft") != -1;
	return (omni_isIE) ? window[movieName] : document[movieName];
}
/*
function Omni_getFlashMovie(objectId, embedId) {
  return (window[objectId]) ? window[objectId] : document[embedId];
}
*/

function TraceDebug(s)
{
	var target = document.getElementById('OmniDateTraceOutput');
	target.innerHTML += s + "</br>";
}


/***************************************************************************************************************
************	Ajax Solution Functions
***************************************************************************************************************/
function clearContainer(container) {
	document.getElementById(container).innerHTML = '';
}
function clearButtons() {
	Omni_ArStatus = new Array();
}
function refreshButtons() {
	if (Omni_dbid != "")
	{
		Send();
	}
}

/***************************************************************************************************************
************ Use to dynamically write Pop Divs
***************************************************************************************************************/


var Omni_maintext =	"";
var Omni_subtext = ""
var Omni_question = "";
var Omni_buttonyes = "";
var Omni_buttonno = "";



function OmniWriteDivs()
{

	if (Omni_lang == "he")
		Omni_RTL = " dir='RTL'";

    var strPopUpElement = "<div id='OmniFloatingLayerOuter'"+Omni_RTL+"><div id='OmniFloatingLayer' style='display: none;'></div></div>";
	jQuery("body").append(strPopUpElement);

	var strPopUpElement2 = "<div id='OmniFloatingLayerInfoOuter'"+Omni_RTL+"><div id='OmniFloatingLayerInfo' style='display: none;'></div></div>";
	jQuery("body").append(strPopUpElement2);

	var strPopUpElement3 = "<div id='OmniFloatingLayerDateOuter'"+Omni_RTL+"><div id='OmniFloatingLayerDate' style='display: none;'></div></div>";
	jQuery("body").append(strPopUpElement3);

	var strPopUpElement4 = "<div id='OmniFloatingLayerModalOuter'"+Omni_RTL+"><div id='OmniFloatingLayerModal' style='display: none;'></div></div>";
	jQuery("body").append(strPopUpElement4);

	var strPopUpElement5 = "<div id='OmniFloatingLayerRegisterOuter"+Omni_verb+"'"+Omni_RTL+"><div id='OmniFloatingLayerRegister"+Omni_verb+"' style='display: none;'></div></div>";
	jQuery("body").append(strPopUpElement5);
	if (Omni_premiumxml != "")
	{
		GetPremiumHTML();
	}
	else
	{
		SetPremiumHTML();
	}

	var strPopUpElement6 = "<div id='OmniFloatingLayerDateAlertOuter'"+Omni_RTL+"><div id='OmniFloatingLayerDateAlert' style='display: none;'></div></div>";
	jQuery("body").append(strPopUpElement6);

	var strPopUpElement7 = "<div id='OmniFloatingLayerInviteOuter'"+Omni_RTL+"><div id='OmniFloatingLayerInvite' style='display: none;'></div></div>";
	jQuery("body").append(strPopUpElement7);

	var strPopUpElement8 = "<div id='OmniFloatingLayerChatOuter'"+Omni_RTL+"><div id='OmniFloatingLayerChat' style='display: none;'></div></div>";
	jQuery("body").append(strPopUpElement8);

	var strPopUpElement9 = "<div id='OmniFloatingLayerNotificationOuter'"+Omni_RTL+"><div id='OmniFloatingLayerNotification' style='display: none;'></div></div>";
	jQuery("body").append(strPopUpElement9);



	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
        var ieversion = new Number(RegExp.$1) // capture x.x portion and store as a number
        if (ieversion < 7 || (ieversion >= 7 && document.compatMode == "BackCompat")) {
            var ele = document.getElementById("OmniFloatingLayer");
            if (ele) {
                ele.className = "OmniPopUpHack";
            }
            var ele2 = document.getElementById("OmniFloatingLayerInfo");
            if (ele2) {
                ele2.className = "OmniPopUpHack";
            }
			var ele3 = document.getElementById("OmniFloatingLayerDate");
            if (ele3) {
                ele3.className = "OmniPopUpHack";
            }
            var ele4 = document.getElementById("OmniFloatingLayerModal");
            if (ele4) {
                ele4.className = "OmniPopUpHack";
            }
            var ele5 = document.getElementById("OmniFloatingLayerRegister"+Omni_verb);
            if (ele5) {
                ele5.className = "OmniPopUpHack";
            }
            var ele6 = document.getElementById("OmniFloatingLayerDateAlert");
            if (ele6) {
                ele6.className = "OmniPopUpHack";
            }
            var ele7 = document.getElementById("OmniFloatingLayerInvite");
            if (ele7) {
                ele7.className = "OmniPopUpHack";
            }
            var ele8 = document.getElementById("OmniFloatingLayerChat");
            if (ele8) {
                ele8.className = "OmniPopUpHack";
            }
            var ele9 = document.getElementById("OmniFloatingLayerNotification");
            if (ele9) {
                ele9.className = "OmniPopUpHack";
            }
        }
    }
}


function GetPremiumHTML()
{
	jQuery(document).ready(function(){
		jQuery.ajax
		(
			{
				url: Omni_premiumxml,
				dataType: "xml",
				success: Omni_SetDataXML,
				error: Omni_SetDataError
			}
		);
	});
}

function Omni_SetDataError(xhr, reason, ex) 
{ 
	SetPremiumHTML();
}


function Omni_SetDataXML(xml)
{
	var maintext = jQuery(xml).find("maintext").text();
		if (maintext != "" && maintext != null) Omni_maintext = maintext;
	var subtext = jQuery(xml).find("subtext").text();
		if (subtext != null) Omni_subtext = subtext;
	var question = jQuery(xml).find("question").text();
		if (question != null) Omni_question = question;
	var buttonyes = jQuery(xml).find("button-yes").text();
		if (buttonyes != "" && buttonyes != null) Omni_buttonyes = buttonyes;
	var buttonno = jQuery(xml).find("button-no").text();
		if (buttonno != "" && buttonno != null) Omni_buttonno = buttonno;

	if (Omni_subtext != "")
		Omni_subtext = "<div style='padding-top:6px; font-size:11px;'>"+Omni_subtext+"</div>";
	if (Omni_question != "")
		Omni_question = "<div style='padding-top:6px;'><em>"+Omni_question+"</em></div>";

	SetPremiumHTML();
}

function SetPremiumHTML()
{
	if (Omni_premiumxml == "")
	{
		if (Omni_AppMode == "1")
		{
			Omni_maintext =		"		Please upgrade your account to invite someone on a virtual chat now.<br />" +
									"		<br /><img src='http://www.omnidate.net/images/asseenon.gif' />";
			Omni_subtext =		"";
			Omni_question =		"";
			Omni_buttonyes =	"Okay";
			Omni_buttonno =		"Maybe Later";
		}
		else
		{
			Omni_maintext =		"		Please upgrade your account to invite someone on a <a href='javascript:MoreInfo(\"1\")'>virtual date</a> now.<br />" +
									"		<img src='http://www.omnidate.net/images/screen2a.jpg' /><img src='http://www.omnidate.net/images/asseenon.gif' />";
			Omni_subtext =		"<div style='padding-top:7px; font-size:11px;'><a href='javascript:MoreInfo(\"2\")'>Choose your virtual character now</a></div>";
			Omni_question =		"";
			Omni_buttonyes =	"Okay";
			Omni_buttonno =		"Maybe Later";
		}
	}

	var OmniPremiumWriteHTML = 
			"	<div style='height:160px; width:340px; margin-left:30px; text-align:center;'>" + Omni_maintext +
			"		" + Omni_subtext +
			"		" + Omni_question +
			"	</div>" +
			"	<div style='height:70px; text-align:center;'>" +
			"		<div style='clear:both; padding-bottom:13px;'></div>" +
			"		<div onclick='YesRegisterPremium();' class='OmniRegisterButton1' style='margin-left:40px;'>" + Omni_buttonyes + "</div>" +
			"		<div onclick='NoRegisterPremium();' class='OmniRegisterButton2' style='margin-left:20px;'>" + Omni_buttonno + "</div>" +
			"	</div>";

	document.getElementById("OmniFloatingLayerRegister"+Omni_verb).innerHTML = OmniPremiumWriteHTML;
}



/***************************************************************************************************************
************	Initialization
***************************************************************************************************************/
var UnlimitedAccess = false;
var UnlimitedUsers = new Array(
	'834ea544-909c-4dd4-9cd3-dcfd167b20a6', // roger@gmail.com
	'f272f6e9-e378-4a6d-8c48-5730368a201e', // ella@gmail.com
	'f968a91b-4924-4c29-8c5f-40c9d551b8de', // jack@gmail.com
	'497c73bb-3c2f-404b-be9e-378af1339457' // julie@gmail.com
	);


var resizeTimer = null;

function Omni_Initialize()
{
	var argObj = new Object();

	for (var i=0; i < arguments.length; i=i+2)
	{
		var currArg = arguments[i].toLowerCase();

		switch (currArg){	
			case "user":
			case "userid":
				YourId = Omni_userid = arguments[i+1];
				var unlimitedX = 0;
				for (unlimitedX; unlimitedX < UnlimitedUsers.length; unlimitedX++)
				{
					if (UnlimitedUsers[unlimitedX] == Omni_userid)
						UnlimitedAccess = true;
				}
				break;
			case "name":
			case "username":
				YourName = username = arguments[i+1];
				break;
			case "gender":
			case "usergender":
				YourGender = Omni_gender = arguments[i+1].toLowerCase();
				break;
			case "account":
				if (arguments[i+1] != "")
					Omni_dbid = arguments[i+1];
				break;
			case "popup":
				Omni_Popup = arguments[i+1];
				break;
			case "postdate":
				Omni_postdate = arguments[i+1];
				break;
			case "premium":
				if (arguments[i+1] != "true" && arguments[i+1] != "")
				{
					Omni_premium = arguments[i+1];
				}
				break;
			case "premiumpop":
				if (arguments[i+1] != "true" && arguments[i+1] != "")
				{
					Omni_premium = arguments[i+1];
					Omni_premiumpop = true;
				}
				break;
			case "premiumxml":
				if (arguments[i+1] != "")
					Omni_premiumxml = "http://" + location.host + "/" +arguments[i+1];
				break;
			case "userclass":
				Omni_userclass = arguments[i+1];
				break;
			case "registerurl":
				Omni_regurl = arguments[i+1];
				break;
			case "dating":
				dating = arguments[i+1];
				break;
			case "showdate":
				Omni_ShowDate = arguments[i+1];
				break;
			case "profile":
				Omni_profile = arguments[i+1];
				break;
			case "sound":
				if (Omni_sound == "true" || Omni_sound == "false")
					Omni_sound = arguments[i+1];
				break;
			case "alert":
				Omni_alert = arguments[i+1];
				break;
			case "profiletype":
				Omni_profiletype = arguments[i+1];
				break;
			case "setcaller":
				Omni_setcaller = arguments[i+1];
				break;
			case "style":
			case "banner":
				Omni_bannerStyle = arguments[i+1];
				break;
			case "avatars":
				Omni_avatars = arguments[i+1];
				break;
			case "verb":
				arguments[i+1] = arguments[i+1].toLowerCase();
				if (arguments[i+1] == "chat")
					Omni_verb = arguments[i+1];
				break;
			case "language":
				arguments[i+1] = arguments[i+1].toLowerCase();
				Omni_lang = arguments[i+1];
				break;
			case "userxml":
				Omni_userxml = arguments[i+1];
				break;
			case "survey":
				Omni_survey = arguments[i+1];
				break;
			case "appver":
				Omni_appver = arguments[i+1];
				break;
			case "chatver":
				Omni_chatver = arguments[i+1];
				break;
			case "abver":
				Omni_abver = arguments[i+1];
				break;
			case "mode":
				Omni_mode = arguments[i+1];
				break;
			default:
				argObj[arguments[i]] = arguments[i+1];
		}
	}

	if (Omni_avatars == "")
		Omni_avatars = "3";

	if (Omni_abver == "")
		Omni_abver = "2_3"; //2_3

	if (Omni_lang == "he")
		Omni_appver = "6_10_Hebrew";
	else if (Omni_appver == "")
		Omni_appver = "6"; // 6_12
	

	if (Omni_chatver == "")
		Omni_chatver = "2"; // 2_8

	if (Omni_gender != "female" && Omni_gender != "male" && Omni_gender != "m" && Omni_gender != "f")
		YourGender = Omni_gender = 'female';


	// Set the language
	Omni_Language();


	// Default Banner Style
	if (Omni_bannerStyle == "Banner01")
		Omni_bannerStyle = "Grey01";
	else if (Omni_bannerStyle == "Spark01")
		Omni_bannerStyle = "Magenta01";
	else if (Omni_bannerStyle == "" || typeof(BannerObj[Omni_bannerStyle]) == "undefined")
		Omni_bannerStyle = "Grey01";

	
	OmniWriteDivs();

	if (Omni_mode == "facebook") {
		var fbtarget = document.getElementById('OmniFloatingLayerDate');
		fbtarget.style.position = "absolute";
		fbtarget.style.top = "0px";
		fbtarget.style.marginTop = "10px";

		var fbtarget = document.getElementById('OmniFloatingLayerChat');
		fbtarget.style.position = "absolute";
		fbtarget.style.top = "0px";
		fbtarget.style.marginTop = "10px";

		var fbtarget = document.getElementById('OmniFloatingLayerInvite');
		fbtarget.style.position = "absolute";
		fbtarget.style.top = "195px";

		var fbtarget = document.getElementById('OmniFloatingLayer');
		fbtarget.style.position = "absolute";
		fbtarget.style.top = "195px";

		var fbtarget = document.getElementById('OmniFloatingLayerInfo');
		fbtarget.style.position = "absolute";
		fbtarget.style.top = "238px";

		var fbtarget = document.getElementById('OmniFloatingLayerNotification');
		fbtarget.style.position = "absolute";
		fbtarget.style.top = "195px";
	}

	jQuery("#msgX").ajaxSuccess(function(event, request, settings)
	{
		if (Omni_Debugging)
			jQuery("#msgX").html("<b>Number of Successful Ajax Calls:</b> " + ++ajaxCount + " Updated: " + OmniTime());
	});


	jQuery(window).resize(function() {
		if (resizeTimer) clearTimeout(resizeTimer);
		resizeTimer = setTimeout(Omni_Resized, 200);
	});

	if (Omni_userid != "")
		Send();

	var OmniPageAgeInt = setInterval("Omni_PageAge()", 1000);
}

var OmniPageAge = 0;
function Omni_PageAge()
{
	OmniPageAge++;
}

function Omni_Resized()
{
	if (AreWeOnADate && Omni_AppMode == "1") // We are currently in a CHAT
	{
		Omni_ShowHideChat(Omni_ChatShowing);
	}
	else if (AreWeOnADate) // We are currently in a DATE
	{
		//Omni_Modal();
		Omni_ShowHideDate(Omni_DateShowing);
	}
	if (resizeTimer) clearTimeout(resizeTimer);
}

function Omni_ChatScrolled()
{
	if (AreWeOnADate && Omni_AppMode == "1" && (getMyHeight() > 450 || !Omni_ChatShowing))
	{
		Omni_ShowHideChat(Omni_ChatShowing);
		if (chatScrollTimer) clearTimeout(chatScrollTimer);
	}
}
function Omni_DateScrolled()
{
	if (AreWeOnADate && Omni_AppMode != "1" && (getMyHeight() > 570 || !Omni_DateShowing))
	{
		Omni_ShowHideDate(Omni_DateShowing);
		if (datetScrollTimer) clearTimeout(dateScrollTimer);
	}
}

function Omni_MoveTo(url, type)
{
	if (type == "window.location.href")
		window.location.href = url;
	else if (type == "window.location")
		window.location = url;
	else if (type == "window.location.pathname")
		window.location.pathname = url;
	else if (type == "top.location.href")
		top.location.href = url;
	else if (type == "self.location")
		self.location = url;
	else if (type == "self.location.href")
		self.location.href = url;
}


/***************************************************************************************************************
************	Ajax Testing
***************************************************************************************************************/

// This is just sample data for lack of a database. 
// Just used JS Object and Multidementional Arrays to house sample data.
function AButton( btnUser, btnName, btnUI ) {
	this.btnUser = btnUser;
	this.btnName = btnName;
	this.btnUI = btnUI;
}

var myPages = new Array();
myPages[0] = new Array();
myPages[0][0] = new AButton ( 'b6b4155a-f6b9-4173-a621-8b05d9ef36d7', 'JM', 'Button01' );
myPages[0][1] = new AButton ( 'jake', 'Jake', 'Button02' );
myPages[0][2] = new AButton ( '57876226-b3ad-429a-9a9f-adf469fe2399', 'Rocco', 'Button02' );

myPages[1] = new Array();
myPages[1][0] = new AButton ( '57876226-b3ad-429a-9a9f-adf469fe2399', 'Rocco', 'Button02' );
myPages[1][1] = new AButton ( 'jenny', 'Jake', 'Button02' );
myPages[1][2] = new AButton ( 'b6b4155a-f6b9-4173-a621-8b05d9ef36d7', 'JM', 'Button01' );

myPages[2] = new Array();
myPages[2][0] = new AButton ( '57876226-b3ad-429a-9a9f-adf469fe2399', 'Rocco', 'Button01' );
myPages[2][1] = new AButton ( 'b6b4155a-f6b9-4173-a621-8b05d9ef36d7', 'JM', 'Button01' );
myPages[2][2] = new AButton ( 'jamal', 'Jamal', 'Button01' );

// This code would be executed by the site. 
// I've created this function for quick pagination through the test arrays.
function ChangePage(page)
{
	//Clears the container HTML. This would typically be done by the site on their own
	clearContainer('refresh');
	// Reset the button array.
	clearButtons();

	for (i = 0; i < myPages[page].length; i++)
	{
		// Just for visual effect, print the username beside the button.
		document.getElementById('refresh').innerHTML += " " + myPages[page][i].btnName + ": ";
		// The site would recall the omnidateButton function with the usual parameters.
		// A new parameter "container", specifies where the buttons will be written to (appended).
		document.getElementById('refresh').innerHTML += Omni_Button('userid', myPages[page][i].btnUser, 'style', myPages[page][i].btnUI, 'return','true');
	}

	// Calls the "Send()" funtion to update the buttons.
	refreshButtons();
}


function OmniPrint(inputit)
{
	if (Omni_Debugging)
	{
		Omni_data += inputit;
		jQuery("#containerX").html(Omni_data);
	}

}


function getMyWidth()
{
	var myWidth = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
	}

	return myWidth;
}
function getMyHeight()
{
	var myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myHeight = document.body.clientHeight;
	}

	return myHeight;
}




var Omni_Hide_Advert = new Array();

Omni_Hide_Advert[0] = "google_ads_iframe_il_jdateil_subnow_top_592x60";
Omni_Hide_Advert[1] = "google_ads_iframe_il_jdateil_subnow_top_590x60";
Omni_Hide_Advert[2] = "ias";
Omni_Hide_Advert[3] = "_ctl0__ctl3_adSquareRight_iframeGAM";
Omni_Hide_Advert[4] = "_ctl0_adLeaderboardHeaderTop_iframeGAM";
/////
/////
Omni_Hide_Advert[5] = "google_ads_div_il_jdateil_subnow_top_592x60_ad_container";
Omni_Hide_Advert[6] = "google_ads_div_il_jdateil_subnow_top_590x60_ad_container";
Omni_Hide_Advert[7] = "google_ads_div_il_jdateil_subnow_top_592x60";
Omni_Hide_Advert[8] = "google_ads_div_il_jdateil_subnow_top_590x60";
/////
Omni_Hide_Advert[9] = "google_ads_div_il_jdateil_home_bottom2_520x125_ad_container";
Omni_Hide_Advert[10] = "google_ads_div_il_jdateil_home_bottom2_520x125";
/////
Omni_Hide_Advert[11] = "google_ads_div_il_jdateil_home_right_channel3_300x250_ad_container";
Omni_Hide_Advert[12] = "google_ads_div_il_jdateil_home_right_channel4_300x250_ad_container";
Omni_Hide_Advert[13] = "google_ads_div_il_jdateil_home_right_channel5_300x250_ad_container";
Omni_Hide_Advert[14] = "google_ads_div_il_jdateil_home_right_channel3_300x250";
Omni_Hide_Advert[15] = "google_ads_div_il_jdateil_home_right_channel4_300x250";
Omni_Hide_Advert[16] = "google_ads_div_il_jdateil_home_right_channel5_300x250";
/////
Omni_Hide_Advert[17] = "google_ads_div_il_jdateil_home_bottom2_300x250_ad_container";
Omni_Hide_Advert[18] = "google_ads_div_il_jdateil_home_bottom2_300x250";
/////
Omni_Hide_Advert[19] = "google_ads_div_il_jdateil_profile_basics_bottom2_300x250_ad_container";
Omni_Hide_Advert[20] = "google_ads_div_il_jdateil_profile_basics_bottom2_300x250";
/////
Omni_Hide_Advert[21] = "google_ads_div_il_jdateil_mol_top_728x90_ad_container";
Omni_Hide_Advert[22] = "google_ads_div_il_jdateil_mol_right_300x250_ad_container";
Omni_Hide_Advert[23] = "google_ads_div_il_jdateil_mol_bottom2_300x250_ad_container";
Omni_Hide_Advert[24] = "google_ads_div_il_jdateil_mol_top_728x90";
Omni_Hide_Advert[25] = "google_ads_div_il_jdateil_mol_right_300x250";
Omni_Hide_Advert[26] = "google_ads_div_il_jdateil_mol_bottom2_300x250";
/////
Omni_Hide_Advert[27] = "google_ads_div_il_jdateil_hotlist_top_728x90_ad_container";
Omni_Hide_Advert[28] = "google_ads_div_il_jdateil_hotlist_right_300x250_ad_container";
Omni_Hide_Advert[29] = "google_ads_div_il_jdateil_hotlist_bottom2_300x250_ad_container";
Omni_Hide_Advert[30] = "google_ads_div_il_jdateil_hotlist_top_728x90";
Omni_Hide_Advert[31] = "google_ads_div_il_jdateil_hotlist_right_300x250";
Omni_Hide_Advert[32] = "google_ads_div_il_jdateil_hotlist_bottom2_300x250";



function Omni_ShowAdverts(_hide)
{
	var omni_vis = "hidden";
	
	if (_hide)
		omni_vis = "visible";

	for (var a = 0; a < Omni_Hide_Advert.length; a++)
	{
		if (document.getElementById(Omni_Hide_Advert[a]) != null)
			document.getElementById(Omni_Hide_Advert[a]).style.visibility = omni_vis;
	}
}
