/*
 * CometChat 
 * Copyright (c) 2009 Inscripts - support@inscripts.com | http://www.cometchat.com | http://www.inscripts.com
 * Version: 1.1
 */

(function (a) {
    a.cometchat = function () {
		
    	//var profile_id = member_id
		var profile_id = 1799
        // Update the following line to point to the CometChat directory (trailing slash mandatory)
        var h = "/im/";

        var D = new Array();
        var O = {};
        var ai = new Array();
        var I = new Array();

        // Translate the text below to the language of your preference
        // If you specify a different encoding, you will have to save this file in that encoding
		D[0] = "YUMROO Çatın Seçimləri";
		D[1] = 'Statusunuzu qeyd edin və Daxil ol düyməsinə basın!';
		D[2] = "Statusum";
		D[3] = "Yerimdə";
		D[4] = "Məşğul";
		D[5] = "Gizli";
		//D[6] = "Dost əlavə et";
		//D[7] = '<a href="faq.php?faq=vb3_user_profile#faq_vb3_friends_contacts">Dostları necə əlavə etmək olar</a>';
		D[6] = '';
		D[7] = '';
		D[8] = "Daxil olun";
		D[9] = "YUMROO Çat";
		D[10] = "<span style='color: #F00'>Mən</span>";
		D[11] = "Offline göstər";
		D[12] = "İnisializasiya...";
		D[13] = "Səs bildirişlərini söndür";
		D[14] = "Kontakt siyahınızda dost yoxdur. Çatdan istifadə etmək üçün dost əlavə edin";

        // Specify the number of icons you would like to display on the left side of the bar
        if(profile_id == "undefined"){
        	var ao = 2;      	
        }
        else {
        	var ao = 3;
	        O[1] = new Array("add.png", "Kontakt siyahısına dəvət", "add.php?id=" + profile_id);
        }


        // Specify the image, tooltip name, link and the target
        // By default target is considered as _self i.e. the same page as itself
        O[0] = new Array("home.png", "YUMROO", "http://www.yumroo.az", "_self");
        O[2] = new Array("friends.png", "Kontakt siyahısı", "friends.php");
      //  O[3] = new Array("faq.png", "Informasiya", "faq.php");
      //  O[2] = new Array("buy.png", "Buy CometChat!", "http://www.cometchat.com/buy");

        // Auto-Popup Chatbox
        // Set to 1, if you want the chatbox to automatically popup when a new message arrives
        var W = 1;

        // Beep on new messages
        // Set to 1, if you want to play a sound when a new message arrives
        // User can always override this value
        var R = 1;

        // Minimum poll time
        // In milliseconds
        var ap = 3000;

        // Maximum poll time
        // In milliseconds
        var P = 12000;

        var z = {};
        var v = {};
        var g = {};
        var ak = "";
        var u = 0;
        var s = 0;
        var U = true;
        var m = 0;
        var A = false;
        var al;
        var V = ap;
        var j = 1;
        var ag = 0;
        var q = 0;
        var E = 0;
        var o = {};
        var n = {};
        var aq = {};
        a("<div/>").attr("id", "cometchat_base").appendTo(a("body"));
        if (R == 1) {
            a('<div id="cometchatflashcontent"></div>').appendTo(a("body"));
            var ah = {};
            var d = {};
            var ab = {
                id: "cometchatbeep",
                name: "cometchatbeep"
            };
            var w;
            w = new SWFObject(h + "swf/sound.swf", "cometchatbeep", "1", "1", "8", "#ffffff");
            w.write("cometchatflashcontent")
        }
        function am(at) {
            var ar = navigator.appName.indexOf("Microsoft") != -1;
            return (ar) ? window[at] : document[at]
        }
        function M() {
            try {
                am("cometchatbeep").cometchatbeep()
            } catch(ar) {}
        }
        function T(ax, au, ar) {
            if (a("#cometchat_tooltip").length > 0) {
                a("#cometchat_tooltip .cometchat_tooltip_content").html(au)
            } else {
                a("body").append('<div id="cometchat_tooltip"><div class="cometchat_tooltip_content">' + au + "</div></div>")
            }
            var aw = a("#" + ax).offset();
            var at = a("#" + ax).width();
            var av = a("#cometchat_tooltip").width();
            if (ar == 1) {
                a("#cometchat_tooltip").css("bottom", 29).css("left", (aw.left + at) - 16).css("display", "block").addClass("cometchat_tooltip_left")
            } else {
                a("#cometchat_tooltip").css("bottom", 29).css("left", (aw.left + at) - av + 12).css("display", "block").removeClass("cometchat_tooltip_left")
            }
            if (A) {
                a("#cometchat_tooltip").css("position", "absolute");
                a("#cometchat_tooltip").css("top", parseInt(a(window).height()) - parseInt(a("#cometchat_tooltip").css("bottom")) - parseInt(a("#cometchat_tooltip").height()) + a(window).scrollTop() + "px")
            }
        }
        function H(at, ar, au) {
            if (at.keyCode == 13 && at.shiftKey == 0) {
                message = a(ar).val();
                message = message.replace(/^\s+|\s+$/g, "");
                a(ar).val("");
                a(ar).css("height", "18px");
                a("#cometchat_user_" + au + "_popup .cometchat_tabcontenttext").css("height", "200px");
                a(ar).css("overflow-y", "hidden");
                a(ar).focus();
                if (message != "") {
                    a.post(h + "cometchat_send.php", {
                        to: au,
                        message: message
                    },
                    function (av) {
                        if (av) {
                            Y(au, message, "1", "1", av, 1);
                            a("#cometchat_user_" + au + "_popup .cometchat_tabcontenttext").scrollTop(a("#cometchat_user_" + au + "_popup .cometchat_tabcontenttext")[0].scrollHeight)
                        }
                        j = 1;
                        if (V > ap) {
                            V = ap;
                            clearTimeout(al);
                            al = setTimeout(function () {
                                F()
                            },
                            ap)
                        }
                    })
                }
                return false
            }
        }
        function af(at, ar) {
            if (at.keyCode == 13 && at.shiftKey == 0) {
                message = a(ar).val();
                if (message != "") {
                    a.post(h + "cometchat_send.php", {
                        statusmessage: message
                    },
                    function (au) {
                        a(ar).blur()
                    })
                }
                return false
            }
        }
        function ac(av, au, aw) {
            var at = au.clientHeight;
            var ar = 94;
            if (ar > at) {
                at = Math.max(au.scrollHeight, at);
                if (ar) {
                    at = Math.min(ar, at)
                }
                if (at > au.clientHeight) {
                    a(au).css("height", at + 4 + "px");
                    a("#cometchat_user_" + aw + "_popup .cometchat_tabcontenttext").css("height", 218 - (at + 4) + "px")
                }
            } else {
                a(au).css("overflow-y", "auto")
            }
            a("#cometchat_user_" + aw + "_popup .cometchat_tabcontenttext").scrollTop(a("#cometchat_user_" + aw + "_popup .cometchat_tabcontenttext")[0].scrollHeight)
        }
        function B() {
            a("#cometchat_optionsbutton_popup .busy").css("text-decoration", "none");
            a("#cometchat_optionsbutton_popup .invisible").css("text-decoration", "none");
            a("#cometchat_optionsbutton_popup .available").css("text-decoration", "none");
            a("#cometchat_userstab_icon").removeClass("cometchat_user_available2");
            a("#cometchat_userstab_icon").removeClass("cometchat_user_busy2");
            a("#cometchat_userstab_icon").removeClass("cometchat_user_invisible2")
        }
        function aj(ar) {
            a.post(h + "cometchat_send.php", {
                status: ar
            },
            function (at) {})
        }
        function X(ar) {
            s = 1;
            B();
            a("#cometchat_userstab_icon").addClass("cometchat_user_invisible2");
            if (ar != 1) {
                aj("offline")
            }
            a("#cometchat_userstab_popup").removeClass("cometchat_tabopen");
            a("#cometchat_userstab").removeClass("cometchat_userstabclick").removeClass("cometchat_tabclick");
            a("#cometchat_optionsbutton_popup").removeClass("cometchat_tabopen");
            a("#cometchat_optionsbutton").removeClass("cometchat_tabclick");
            K("buddylist", "0");
            a("#cometchat_userstab_text").html("Offline")
        }
        function S() {
            a("<span/>").attr("id", "cometchat_optionsbutton").addClass("cometchat_tab").addClass("cometchat_optionsimages").appendTo(a("#cometchat_base"));
            a("<div/>").attr("id", "cometchat_optionsbutton_popup").addClass("cometchat_tabpopup").css("display", "none").html('<div class="cometchat_userstabtitle">' + D[0] + '</div><div class="cometchat_tabsubtitle">' + D[1] + '</div><div class="cometchat_tabcontent" style="background-image: url(' + h + 'images/tabbottomoptions.gif);padding:5px;padding-bottom:10px;"><strong>' + D[2] + '</strong><br/><textarea class="cometchat_statustextarea"></textarea><span style="float:left" class="cometchat_user_available"></span><span class="cometchat_optionsstatus available">' + D[3] + '</span><span class="cometchat_optionsstatus2 cometchat_user_busy"></span><span class="cometchat_optionsstatus busy">' + D[4] + '</span><span class="cometchat_optionsstatus2 cometchat_user_invisible"></span><span class="cometchat_optionsstatus invisible">' + D[5] + '</span><br clear="all"/><div style="border-top:1px solid #eeeeee;margin-top:10px;padding-top:4px;"><span><input type="checkbox" id="cometchat_soundnotifications" style="vertical-align: -2px;">' + D[13] + '</span></div><div style="border-top:1px solid #eeeeee;padding-top:10px;margin-top:4px;"><span><strong>' + D[6] + "</strong><br/><br/>" + D[7] + "</span></div>").appendTo(a("body"));
            a("#cometchat_soundnotifications").click(function (ar) {
                a.cookie("cometchat_sound", a("#cometchat_soundnotifications").attr("checked"), {
                    expires: 365
                })
            });
            a("#cometchat_optionsbutton_popup .available").click(function (ar) {
                B();
                a("#cometchat_userstab_icon").addClass("cometchat_user_available2");
                a(this).css("text-decoration", "underline");
                aj("available")
            });
            a("#cometchat_optionsbutton_popup .busy").click(function (ar) {
                B();
                a("#cometchat_userstab_icon").addClass("cometchat_user_busy2");
                a(this).css("text-decoration", "underline");
                aj("busy")
            });
            a("#cometchat_optionsbutton_popup .invisible").click(function (ar) {
                B();
                a("#cometchat_userstab_icon").addClass("cometchat_user_invisible2");
                a(this).css("text-decoration", "underline");
                aj("invisible")
            });
            a("#cometchat_optionsbutton_popup .cometchat_statustextarea").keydown(function (ar) {
                return af(ar, this)
            });
            a("#cometchat_optionsbutton").mouseover(function () {
                if (!a("#cometchat_optionsbutton_popup").hasClass("cometchat_tabopen")) {
                    if (u == 0) {
                        T("cometchat_optionsbutton", D[0])
                    } else {
                        T("cometchat_optionsbutton", D[8])
                    }
                }
                a(this).addClass("cometchat_tabmouseover")
            }); 

			a("#cometchat_optionsbutton").click(function () {
                if (!a("#cometchat_optionsbutton_popup").hasClass("cometchat_tabopen")) {
                    if (u == 0) {
                    } else {
                        location.href="http://login.yumroo.az/?return=" + return_link;
                    }
                }
                a(this).addClass("cometchat_tabmouseover")
            });
			
            a("#cometchat_optionsbutton").mouseout(function () {
                a(this).removeClass("cometchat_tabmouseover");
                a("#cometchat_tooltip").css("display", "none")
            });
            a("#cometchat_optionsbutton").click(function () {
                if (u == 0) {
                    if (s == 1) {
                        s = 0;
                        a("#cometchat_userstab_text").html(D[9] + " (" + E + ")");
                        F();
                        a("#cometchat_optionsbutton_popup .available").click()
                    }
                    a("#cometchat_tooltip").css("display", "none");
                    a("#cometchat_optionsbutton_popup").css("left", a("#cometchat_optionsbutton").position().left - 171).css("bottom", "24px");
                    a(this).toggleClass("cometchat_tabclick");
                    a("#cometchat_optionsbutton_popup").toggleClass("cometchat_tabopen");
                    a("#cometchat_optionsbutton").toggleClass("cometchat_optionsimages_click");
                    a("#cometchat_userstab_popup").removeClass("cometchat_tabopen");
                    a("#cometchat_userstab").removeClass("cometchat_userstabclick").removeClass("cometchat_tabclick");
                    K("buddylist", "0");
                    if (a.cookie("cometchat_sound")) {
                        if (a.cookie("cometchat_sound") == "true") {
                            a("#cometchat_soundnotifications").attr("checked", true)
                        } else {
                            a("#cometchat_soundnotifications").attr("checked", false)
                        }
                    }
                }
            });
            a("#cometchat_optionsbutton_popup .cometchat_userstabtitle").click(function () {
                a("#cometchat_optionsbutton").click()
            });
            a("#cometchat_optionsbutton_popup .cometchat_userstabtitle").mouseenter(function () {
                a(this).addClass("cometchat_chatboxtabtitlemouseover2")
            });
            a("#cometchat_optionsbutton_popup .cometchat_userstabtitle").mouseleave(function () {
                a(this).removeClass("cometchat_chatboxtabtitlemouseover2")
            })
        }
        function c() {
            var ar = "";
            a("#cometchat_chatboxes_wide span").each(function () {
                var au = a(this).attr("id").substr(15);
                var at = 0;
                if (a("#cometchat_user_" + au + " .cometchat_tabalert").length > 0) {
                    at = parseInt(a("#cometchat_user_" + au + " .cometchat_tabalert").html())
                }
                ar += au + "|" + at + ","
            });
            ar = ar.slice(0, -1);
            K("activeChatboxes", ar)
        }
        function L(ay, av, ar, ax, at, aw) {
            if (av == null || ay == null || ay == "" || av == "") {
                return
            }
            if (a("#cometchat_user_" + ay).length > 0) {
                if (!a("#cometchat_user_" + ay).hasClass("cometchat_tabclick")) {
                    if (at != 1) {
                        if (ak != "") {
                            a("#cometchat_user_" + ak + "_popup").removeClass("cometchat_tabopen");
                            a("#cometchat_user_" + ak).removeClass("cometchat_tabclick").removeClass("cometchat_usertabclick");
                            ak = ""
                        }
                        if ((a("#cometchat_user_" + ay).offset().left < (a("#cometchat_chatboxes").offset().left + a("#cometchat_chatboxes").width())) && (a("#cometchat_user_" + ay).offset().left - a("#cometchat_chatboxes").offset().left) >= 0) {
                            a("#cometchat_user_" + ay).click()
                        } else {
                            a(".cometchat_tabalert").css("display", "none");
                            var au = 800;
                            if (f("initialize") == 1 || f("updatesession") == 1) {
                                au = 0
                            }
                            a("#cometchat_chatboxes").scrollTo("#cometchat_user_" + ay, au, function () {
                                a("#cometchat_user_" + ay).click();
                                an();
                                G()
                            })
                        }
                    }
                }
                an();
                return
            }
            a("#cometchat_chatboxes_wide").width(a("#cometchat_chatboxes_wide").width() + 152);
            t();
            if (av.length > 14) {
                shortname = av.substr(0, 14) + "..."
            } else {
                shortname = av
            }
            if (av.length > 24) {
                longname = av.substr(0, 24) + "..."
            } else {
                longname = av
            }
            a("<span/>").attr("id", "cometchat_user_" + ay).addClass("cometchat_tab").html('<div style="float:left">' + shortname + "</div>").appendTo(a("#cometchat_chatboxes_wide"));
            a("#cometchat_user_" + ay).append('<div class="cometchat_closebox_bottom_status cometchat_' + ar + '"></div>');
            a("#cometchat_user_" + ay).append('<div class="cometchat_closebox_bottom"></div>');
            a("#cometchat_user_" + ay + " .cometchat_closebox_bottom").mouseenter(function () {
                a(this).addClass("cometchat_closebox_bottomhover")
            });
            a("#cometchat_user_" + ay + " .cometchat_closebox_bottom").mouseleave(function () {
                a(this).removeClass("cometchat_closebox_bottomhover")
            });
            a("#cometchat_user_" + ay + " .cometchat_closebox_bottom").click(function () {
                a("#cometchat_user_" + ay + "_popup").remove();
                a("#cometchat_user_" + ay).remove();
                if (ak == ay) {
                    ak = "";
                    K("openChatboxId", "")
                }
                a("#cometchat_chatboxes_wide").width(a("#cometchat_chatboxes_wide").width() - 152);
                a("#cometchat_chatboxes").scrollTo("-=152px");
                t();
                c()
            });
            a("<div/>").attr("id", "cometchat_user_" + ay + "_popup").addClass("cometchat_tabpopup").css("display", "none").html('<div class="cometchat_tabtitle"><div class="cometchat_name">' + longname + '</div></div><div class="cometchat_tabsubtitle">' + ax + '</div><div class="cometchat_tabcontent"><div class="cometchat_tabcontenttext"></div><div class="cometchat_tabcontentinput"><textarea class="cometchat_textarea" ></textarea></div></div>').appendTo(a("body"));
            a("#cometchat_user_" + ay + "_popup .cometchat_textarea").keydown(function (az) {
                return H(az, this, ay)
            });
            a("#cometchat_user_" + ay + "_popup .cometchat_textarea").keyup(function (az) {
                return ac(az, this, ay)
            });
            a("#cometchat_user_" + ay + "_popup .cometchat_tabtitle").append('<div class="cometchat_closebox"></div><br clear="all"/>');
            a("#cometchat_user_" + ay + "_popup .cometchat_tabtitle .cometchat_closebox").mouseenter(function () {
                a(this).addClass("cometchat_chatboxmouseoverclose");
                a("#cometchat_user_" + ay + "_popup .cometchat_tabtitle").removeClass("cometchat_chatboxtabtitlemouseover")
            });
            a("#cometchat_user_" + ay + "_popup .cometchat_tabtitle .cometchat_closebox").mouseleave(function () {
                a(this).removeClass("cometchat_chatboxmouseoverclose");
                a("#cometchat_user_" + ay + "_popup .cometchat_tabtitle").addClass("cometchat_chatboxtabtitlemouseover")
            });
            a("#cometchat_user_" + ay + "_popup .cometchat_tabtitle .cometchat_closebox").click(function () {
                a("#cometchat_user_" + ay + "_popup").remove();
                a("#cometchat_user_" + ay).remove();
                if (ak == ay) {
                    ak = "";
                    K("openChatboxId", "")
                }
                a("#cometchat_chatboxes_wide").width(a("#cometchat_chatboxes_wide").width() - 152);
                a("#cometchat_chatboxes").scrollTo("-=152px");
                t();
                c()
            });
            a("#cometchat_user_" + ay + "_popup .cometchat_tabtitle").click(function () {
                a("#cometchat_user_" + ay).click()
            });
            a("#cometchat_user_" + ay + "_popup .cometchat_tabtitle").mouseenter(function () {
                a(this).addClass("cometchat_chatboxtabtitlemouseover")
            });
            a("#cometchat_user_" + ay + "_popup .cometchat_tabtitle").mouseleave(function () {
                a(this).removeClass("cometchat_chatboxtabtitlemouseover")
            });
            a("#cometchat_user_" + ay).mouseenter(function () {
                a(this).addClass("cometchat_tabmouseover");
                a("#cometchat_user_" + ay + " div").addClass("cometchat_tabmouseovertext")
            });
            a("#cometchat_user_" + ay).mouseleave(function () {
                a(this).removeClass("cometchat_tabmouseover");
                a("#cometchat_user_" + ay + " div").removeClass("cometchat_tabmouseovertext")
            });
            a("#cometchat_user_" + ay).click(function () {
                if (a("#cometchat_user_" + ay + " .cometchat_tabalert").length > 0) {
                    a("#cometchat_user_" + ay + " .cometchat_tabalert").remove();
                    c()
                }
                if (a(this).hasClass("cometchat_tabclick")) {
                    a(this).removeClass("cometchat_tabclick").removeClass("cometchat_usertabclick");
                    a("#cometchat_user_" + ay + "_popup").removeClass("cometchat_tabopen");
                    a("#cometchat_user_" + ay + " .cometchat_closebox_bottom").removeClass("cometchat_closebox_bottom_click");
                    ak = "";
                    K("openChatboxId", "")
                } else {
                    if (ak != "") {
                        a("#cometchat_user_" + ak + "_popup").removeClass("cometchat_tabopen");
                        a("#cometchat_user_" + ak).removeClass("cometchat_tabclick").removeClass("cometchat_usertabclick");
                        a("#cometchat_user_" + ak + " .cometchat_closebox_bottom").removeClass("cometchat_closebox_bottom_click");
                        ak = ""
                    }
                    if ((a("#cometchat_user_" + ay).offset().left - a("#cometchat_chatboxes").offset().left) < 0) {
                        a("#cometchat_chatboxes").scrollTo("#cometchat_user_" + ay);
                        an()
                    }
                    a("#cometchat_user_" + ay + "_popup").css("left", a("#cometchat_user_" + ay).position().left - 62).css("bottom", "24px");
                    a(this).addClass("cometchat_tabclick").addClass("cometchat_usertabclick");
                    a("#cometchat_user_" + ay + "_popup").addClass("cometchat_tabopen");
                    a("#cometchat_user_" + ay + " .cometchat_closebox_bottom").addClass("cometchat_closebox_bottom_click");
                    K("openChatboxId", ay);
                    ak = ay;
                    if (a("#cometchat_user_" + ay + "_popup .cometchat_tabcontenttext").html() == "" && f("initialize") != 1) {
                        N(ay)
                    }
                    if (A) {
                        a("#cometchat_user_" + ak + "_popup").css("position", "absolute");
                        a("#cometchat_user_" + ak + "_popup").css("top", parseInt(a(window).height()) - parseInt(a("#cometchat_user_" + ak + "_popup").css("bottom")) - parseInt(a("#cometchat_user_" + ak + "_popup").height()) + a(window).scrollTop() + "px")
                    }
                }
                a("#cometchat_user_" + ay + "_popup .cometchat_tabcontenttext").scrollTop(a("#cometchat_user_" + ay + "_popup .cometchat_tabcontenttext")[0].scrollHeight);
                a("#cometchat_user_" + ay + "_popup .cometchat_textarea").focus()
            });
            if (at != 1) {
                a("#cometchat_user_" + ay).click()
            }
            c();
            if (a("#cometchat_user_" + ay + "_popup .cometchat_tabcontenttext").html() == "" && f("initialize") != 1) {
                N(ay)
            }
        }
        function N(ar) {
            a.ajax({
                url: h + "cometchat_receive.php",
                data: {
                    chatbox: ar
                },
                type: "post",
                cache: false,
                dataType: "json",
                success: function (av) {
                    if (av) {
                        a("#cometchat_user_" + ar + "_popup .cometchat_tabcontenttext").html("");
                        var at = "";
                        var au = o[ar];
                        a.each(av, function (aw, ax) {
                            if (aw == "messages") {
                                a.each(ax, function (az, ay) {
                                    if (ay.self == 1) {
                                        fromname = D[10]
                                    } else {
                                        fromname = au
                                    }
                                    at += ('<div class="cometchat_chatboxmessage" id="cometchat_message_' + ay.id + '"><span class="cometchat_chatboxmessagefrom"><strong>' + fromname + '</strong>:&nbsp;&nbsp;</span><span class="cometchat_chatboxmessagecontent">' + ay.message + "</span></div>")
                                })
                            }
                        });
                        a("#cometchat_user_" + ar + "_popup .cometchat_tabcontenttext").append(at);
                        a("#cometchat_user_" + ar + "_popup .cometchat_tabcontenttext").scrollTop(a("#cometchat_user_" + ar + "_popup .cometchat_tabcontenttext")[0].scrollHeight)
                    }
                }
            })
        }
        function ae(au, ar, at) {
            Z(au);
            if (at == 1) {
                if (a("#cometchat_user_" + au + " .cometchat_tabalert").length > 0) {
                    ar = parseInt(a("#cometchat_user_" + au + " .cometchat_tabalert").html()) + parseInt(ar)
                }
            }
            if (ar == 0) {
                a("#cometchat_user_" + au + " .cometchat_tabalert").remove()
            } else {
                if (a("#cometchat_user_" + au + " .cometchat_tabalert").length > 0) {
                    a("#cometchat_user_" + au + " .cometchat_tabalert").html(ar)
                } else {
                    a("<div/>").css("top", "-5px").addClass("cometchat_tabalert").html(ar).appendTo(a("#cometchat_user_" + au))
                }
            }
            c();
            G()
        }
        function Q() {
            a("<span/>").attr("id", "cometchat_userstab").addClass("cometchat_tab").html('<span id="cometchat_userstab_icon"></span><span id="cometchat_userstab_text" style="float:left">' + D[12] + "</span>").appendTo(a("#cometchat_base"));
            a("<div/>").attr("id", "cometchat_userstab_popup").addClass("cometchat_tabpopup").css("display", "none").html('<div class="cometchat_userstabtitle">' + D[9] + '</div><div class="cometchat_tabsubtitle"><a class="cometchat_gooffline">' + D[11] + '</a></div><div class="cometchat_tabcontent" style="background-image: url(' + h + 'images/tabbottomwhosonline.gif);height:200px;padding-top:5px;padding-bottom:5px;"><div class="cometchat_userscontent"><div class="cometchat_userslist_available"></div><div class="cometchat_userslist_busy"></div><div class="cometchat_userslist_away"></div><div class="cometchat_userslist_offline"></div></div>').appendTo(a("body"));
            a("#cometchat_userstab_popup .cometchat_gooffline").click(function () {
                X()
            });
            a("#cometchat_userstab_popup .cometchat_userstabtitle").click(function () {
                a("#cometchat_userstab").click()
            });
            a("#cometchat_userstab_popup .cometchat_userstabtitle").mouseenter(function () {
                a(this).addClass("cometchat_chatboxtabtitlemouseover2")
            });
            a("#cometchat_userstab_popup .cometchat_userstabtitle").mouseleave(function () {
                a(this).removeClass("cometchat_chatboxtabtitlemouseover2")
            });
            a("#cometchat_userstab").mouseover(function () {
                a(this).addClass("cometchat_tabmouseover")
            });
            a("#cometchat_userstab").mouseout(function () {
                a(this).removeClass("cometchat_tabmouseover")
            });
            a("#cometchat_userstab").click(function () {
                if (s == 1) {
                    s = 0;
                    a("#cometchat_userstab_text").html(D[9] + " (" + E + ")");
                    F();
                    a("#cometchat_optionsbutton_popup .available").click()
                }
                a("#cometchat_optionsbutton_popup").removeClass("cometchat_tabopen");
                a("#cometchat_optionsbutton").removeClass("cometchat_tabclick");
                if (a(this).hasClass("cometchat_tabclick")) {
                    K("buddylist", "0")
                } else {
                    K("buddylist", "1")
                }
                a("#cometchat_userstab_popup").css("left", a("#cometchat_userstab").position().left + 16).css("bottom", "24px");
                a(this).toggleClass("cometchat_tabclick").toggleClass("cometchat_userstabclick");
                a("#cometchat_userstab_popup").toggleClass("cometchat_tabopen")
            })
        }
        function t() {
            var at = a(window).width();
            if (at < 520) {
                at = 520
            }
            a("#cometchat_base").css("width", at - 31);
            var av = 0;
            if (!a("#cometchat_chatbox_right").hasClass("cometchat_chatbox_lr")) {
                av = 19
            }
            if (ao > 0) {
                av += (ao - 1) * 30
            }
            if (a("#cometchat_chatboxes_wide").width() <= (a("#cometchat_base").width() - 226 - av - 75)) {
                a("#cometchat_chatboxes").css("width", a("#cometchat_chatboxes_wide").width());
                a("#cometchat_chatboxes").scrollTo("0px", 0)
            } else {
                var aw = a("#cometchat_chatboxes").width();
                a("#cometchat_chatboxes").css("width", Math.floor((a("#cometchat_base").width() - 226 - av - 75) / 152) * 152);
                var ar = a("#cometchat_chatboxes").width();
                if (aw != ar) {
                    a("#cometchat_chatboxes").scrollTo("-=152px", 0)
                }
            }
            a("#cometchat_optionsbutton_popup").css("left", a("#cometchat_optionsbutton").position().left - 171).css("bottom", "24px");
            a("#cometchat_userstab_popup").css("left", a("#cometchat_userstab").position().left + 16).css("bottom", "24px");
            if (ak != "") {
                if ((a("#cometchat_user_" + ak).offset().left < (a("#cometchat_chatboxes").offset().left + a("#cometchat_chatboxes").width())) && (a("#cometchat_user_" + ak).offset().left - a("#cometchat_chatboxes").offset().left) >= 0) {
                    a("#cometchat_user_" + ak + "_popup").css("left", a("#cometchat_user_" + ak).position().left - 62).css("bottom", "24px")
                } else {
                    a("#cometchat_user_" + ak + "_popup").removeClass("cometchat_tabopen");
                    a("#cometchat_user_" + ak).removeClass("cometchat_tabclick").removeClass("cometchat_usertabclick");
                    var au = ((a("#cometchat_user_" + ak).offset().left - a("#cometchat_chatboxes_wide").offset().left)) - ((Math.floor((a("#cometchat_chatboxes").width() / 152)) - 1) * 152);
                    a("#cometchat_chatboxes").scrollTo(au, 0, function () {
                        a("#cometchat_user_" + ak).click()
                    })
                }
            }
            G();
            an();
            if (A) {
                J()
            }
        }
        function G() {
            a("#cometchat_chatbox_left .cometchat_tabalertlr").html("0");
            a("#cometchat_chatbox_right .cometchat_tabalertlr").html("0");
            a("#cometchat_chatbox_left .cometchat_tabalertlr").css("display", "none");
            a("#cometchat_chatbox_right .cometchat_tabalertlr").css("display", "none");
            a(".cometchat_tabalert").each(function () {
                if ((a(this).parent().offset().left < (a("#cometchat_chatboxes").offset().left + a("#cometchat_chatboxes").width())) && (a(this).parent().offset().left - a("#cometchat_chatboxes").offset().left) >= 0) {
                    a(this).css("display", "block");
                    a(this).css("left", a(this).parent().offset().left + a(this).parent().width() - 30)
                } else {
                    a(this).css("display", "none");
                    if ((a(this).parent().offset().left - a("#cometchat_chatboxes").offset().left) >= 0) {
                        var ar = a("#cometchat_chatbox_right").offset().left + a("#cometchat_chatbox_right").width() - 30;
                        a("#cometchat_chatbox_right .cometchat_tabalertlr").css("left", ar);
                        a("#cometchat_chatbox_right .cometchat_tabalertlr").html(parseInt(a("#cometchat_chatbox_right .cometchat_tabalertlr").html()) + parseInt(a(this).html()));
                        a("#cometchat_chatbox_right .cometchat_tabalertlr").css("display", "block")
                    } else {
                        var ar = a("#cometchat_chatbox_left").offset().left + a("#cometchat_chatbox_left").width() - 22;
                        a("#cometchat_chatbox_left .cometchat_tabalertlr").css("left", ar);
                        a("#cometchat_chatbox_left .cometchat_tabalertlr").html(parseInt(a("#cometchat_chatbox_left .cometchat_tabalertlr").html()) + parseInt(a(this).html()));
                        a("#cometchat_chatbox_left .cometchat_tabalertlr").css("display", "block")
                    }
                }
            })
        }
        function an() {
            var au = 0;
            var av = 0;
            var ar = 0;
            if (a("#cometchat_chatbox_right").hasClass("cometchat_chatbox_right_last")) {
                av = 1
            }
            if (a("#cometchat_chatbox_right").hasClass("cometchat_chatbox_lr")) {
                ar = 1
            }
            if (a("#cometchat_chatboxes").scrollLeft() == 0) {
                a("#cometchat_chatbox_left").unbind("click", e);
                a("#cometchat_chatbox_left .cometchat_tabtext").html("0");
                a("#cometchat_chatbox_left").addClass("cometchat_chatbox_left_last");
                au++
            } else {
                var at = Math.floor(a("#cometchat_chatboxes").scrollLeft() / 152);
                a("#cometchat_chatbox_left").bind("click", e);
                a("#cometchat_chatbox_left .cometchat_tabtext").html(at);
                a("#cometchat_chatbox_left").removeClass("cometchat_chatbox_left_last")
            }
            if ((a("#cometchat_chatboxes").scrollLeft() + a("#cometchat_chatboxes").width()) == a("#cometchat_chatboxes_wide").width()) {
                a("#cometchat_chatbox_right").unbind("click", l);
                a("#cometchat_chatbox_right .cometchat_tabtext").html("0");
                a("#cometchat_chatbox_right").addClass("cometchat_chatbox_right_last");
                au++
            } else {
                var at = Math.floor((a("#cometchat_chatboxes_wide").width() - (a("#cometchat_chatboxes").scrollLeft() + a("#cometchat_chatboxes").width())) / 152);
                a("#cometchat_chatbox_right").bind("click", l);
                a("#cometchat_chatbox_right .cometchat_tabtext").html(at);
                a("#cometchat_chatbox_right").removeClass("cometchat_chatbox_right_last")
            }
            if (au == 2) {
                a("#cometchat_chatbox_right").addClass("cometchat_chatbox_lr");
                a("#cometchat_chatbox_left").addClass("cometchat_chatbox_lr")
            } else {
                a("#cometchat_chatbox_right").removeClass("cometchat_chatbox_lr");
                a("#cometchat_chatbox_left").removeClass("cometchat_chatbox_lr")
            }
            if ((!a("#cometchat_chatbox_right").hasClass("cometchat_chatbox_right_last") && av == 1) || (a("#cometchat_chatbox_right").hasClass("cometchat_chatbox_right_last") && av == 0) || (!a("#cometchat_chatbox_right").hasClass("cometchat_chatbox_lr") && ar == 1) || (a("#cometchat_chatbox_right").hasClass("cometchat_chatbox_lr") && ar == 0)) {
                t()
            }
        }
        function r(at) {
            if (ak != "") {
                a("#cometchat_user_" + ak + "_popup").removeClass("cometchat_tabopen");
                a("#cometchat_user_" + ak).removeClass("cometchat_tabclick").removeClass("cometchat_usertabclick")
            }
            a(".cometchat_tabalert").css("display", "none");
            var ar = 800;
            if (f("initialize") == 1 || f("updatesession") == 1) {
                ar = 0
            }
            a("#cometchat_chatboxes").scrollTo(at, ar, function () {
                if (ak != "") {
                    if ((a("#cometchat_user_" + ak).offset().left < (a("#cometchat_chatboxes").offset().left + a("#cometchat_chatboxes").width())) && (a("#cometchat_user_" + ak).offset().left - a("#cometchat_chatboxes").offset().left) >= 0) {
                        a("#cometchat_user_" + ak).click()
                    } else {
                        ak = ""
                    }
                }
                G();
                an()
            })
        }
        function e() {
            r("-=152px")
        }
        function l() {
            r("+=152px")
        }
        function b(ar, at) {
            z[ar] = at
        }
        function f(ar) {
            if (z[ar]) {
                return z[ar]
            } else {
                return ""
            }
        }
        function aa(ar, at) {
            g[ar] = at
        }
        function ad(ar) {
            if (g[ar]) {
                return g[ar]
            } else {
                return ""
            }
        }
        function K(ar, at) {
            v[ar] = at;
            if (f("initialize") != 1 && f("updatesession") != 1 && ad("updatingsession") != 1) {
                ag = 1;
                clearTimeout(al);
                al = setTimeout(function () {
                    F()
                },
                1000)
            }
        }
        function p(ar, at) {
            if (v[ar]) {
                return v[ar]
            } else {
                return ""
            }
        }
        function C(at) {
            var ar = a(at).attr("id").substr(19);
            L(ar, o[ar], buddylistStatus[ar], n[ar])
        }
        function Z(at) {
            var ar = at;
            L(ar, o[ar], buddylistStatus[ar], n[ar], 1)
        }
        function Y(ax, ar, av, au, at, aw) {
            L(ax, o[ax], buddylistStatus[ax], n[ax], 1, 1);
            if (parseInt(av) == 1) {
                fromname = D[10]
            } else {
                fromname = o[ax]
            }
            if (aw == 1) {
                ar = ar.replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\n/g, "<br>").replace(/\"/g, "&quot;")
            }
            if (av != 1 && R == 1) {
                if (a.cookie("cometchat_sound") && a.cookie("cometchat_sound") == "true") {} else {
                    M()
                }
            }
            if (a("#cometchat_message_" + at).length > 0) {
                a("#cometchat_message_" + at + " .cometchat_chatboxmessagecontent").html(ar)
            } else {
                a("#cometchat_user_" + ax + "_popup .cometchat_tabcontenttext").append('<div class="cometchat_chatboxmessage" id="cometchat_message_' + at + '"><span class="cometchat_chatboxmessagefrom"><strong>' + fromname + '</strong>:&nbsp;&nbsp;</span><span class="cometchat_chatboxmessagecontent">' + ar + "</span></div>")
            }
            if (ak != ax && au != 1) {
                ae(ax, 1, 1)
            }
        }
        function F() {
            for (vars in v) {
                z["sessionvars[" + vars + "]"] = v[vars]
            }
            if (ag == 1) {
                b("updatesession", "1");
                ag = 0
            }
            z.timestamp = q;
            var ar = "";
            var at = {};
            at.available = "";
            at.busy = "";
            at.offline = "";
            buddylistreceived = 0;
            tempBuddylistStatus = {};
            tempBuddylistMessage = {};
            tempBuddylistName = {};
            onlineNumber = 0;
            a.ajax({
                url: h + "cometchat_receive.php",
                data: z,
                type: "post",
                cache: false,
                dataType: "json",
                success: function (av) {
                    if (av) {
                        var au = 0;
                        a.each(av, function (aw, ax) {
                            if (aw == "buddylist") {
                                buddylistreceived = 1;
                                onlineNumber = 0;
                                totalFriendsNumber = 0;
                                a.each(ax, function (az, ay) {
                                    if (ay.name.length > 24) {
                                        longname = ay.name.substr(0, 24) + "..."
                                    } else {
                                        longname = ay.name
                                    }
                                    if (a("#cometchat_user_" + ay.id).length > 0) {
                                        a("#cometchat_user_" + ay.id + " .cometchat_closebox_bottom_status").removeClass("cometchat_available");
                                        a("#cometchat_user_" + ay.id + " .cometchat_closebox_bottom_status").removeClass("cometchat_busy");
                                        a("#cometchat_user_" + ay.id + " .cometchat_closebox_bottom_status").removeClass("cometchat_offline");
                                        a("#cometchat_user_" + ay.id + " .cometchat_closebox_bottom_status").addClass("cometchat_" + ay.status);
                                        if (a("#cometchat_user_" + ay.id + "_popup").length > 0) {
                                            a("#cometchat_user_" + ay.id + "_popup .cometchat_tabsubtitle").html(ay.message)
                                        }
                                    }
                                    if (ay.status == "available") {
                                        onlineNumber++
                                    }
                                    totalFriendsNumber++;
                                    at[ay.status] += '<div id="cometchat_userlist_' + ay.id + '" class="cometchat_userlist" onmouseover="jQuery(this).addClass(\'cometchat_userlist_hover\');" onmouseout="jQuery(this).removeClass(\'cometchat_userlist_hover\');"><span class="cometchat_userscontentname">' + longname + '</span><span class="cometchat_userscontentdot cometchat_' + ay.status + '"></span></div>';
                                    tempBuddylistStatus[ay.id] = ay.status;
                                    tempBuddylistMessage[ay.id] = ay.message;
                                    tempBuddylistName[ay.id] = ay.name
                                })
                            }
                            if (buddylistreceived == 1) {
                                buddylistStatus = tempBuddylistStatus;
                                n = tempBuddylistMessage;
                                o = tempBuddylistName;
                                for (buddystatus in at) {
                                    a("#cometchat_userstab_popup .cometchat_tabcontent .cometchat_userscontent .cometchat_userslist_" + buddystatus).html(at[buddystatus]);
                                    a("#cometchat_userstab_popup .cometchat_tabcontent .cometchat_userscontent .cometchat_userslist_" + buddystatus).children().click(function () {
                                        C(this)
                                    })
                                }
                                a("#cometchat_userstab_text").html(D[9] + " (" + onlineNumber + ")");
                                E = onlineNumber;
                                if (totalFriendsNumber == 0) {
                                    a("#cometchat_userstab_popup .cometchat_tabcontent .cometchat_userscontent .cometchat_userslist_available").html('<div class="cometchat_nofriends">' + D[14] + "</div>")
                                }
                                buddylistreceived = 0
                            }
                            if (aw == "loggedout") {
                                a("#cometchat_optionsbutton").addClass("cometchat_optionsimages_exclamation");
                                a("#cometchat_userstab").hide();
                                a("#cometchat_chatboxes").hide();
                                a("#cometchat_chatbox_left").hide();
                                a("#cometchat_chatbox_right").hide();
                                a("#cometchat_optionsbutton_popup").hide();
                                a("#cometchat_userstab_popup").hide();
                                a(".cometchat_tabopen").css("cssText", "display: none !important;");
                                if (ak != "") {
                                    a("#cometchat_user_" + ak + "_popup").hide();
                                    ak = ""
                                }
                                u = 1
                            }
                            if (aw == "userstatus") {
                                a.each(ax, function (ay, az) {
                                    if (ay == "message") {
                                        a("#cometchat_optionsbutton_popup .cometchat_statustextarea").val(az)
                                    }
                                    if (ay == "status") {
                                        if (az == "offline") {
                                            X(1)
                                        } else {
                                            B();
                                            a("#cometchat_userstab_icon").addClass("cometchat_user_" + az + "2");
                                            a("#cometchat_optionsbutton_popup ." + az).css("text-decoration", "underline")
                                        }
                                    }
                                })
                            }
                            if (aw == "initialize") {
                                a.each(ax, function (ay, aA) {
                                    if (ay == "buddylist") {
                                        if (aA == 1) {
                                            a("#cometchat_userstab").click()
                                        }
                                    }
                                    if (ay == "activeChatboxes") {
                                        var aB = aA.split(/,/);
                                        for (i = 0; i < aB.length; i++) {
                                            var az = aB[i].split(/\|/);
                                            Z(az[0]);
                                            if (parseInt(az[1]) > 0) {
                                                ae(az[0], az[1], 0)
                                            }
                                        }
                                    }
                                    if (ay == "openChatboxId") {
                                        if (aA != "") {
                                            a("#cometchat_userlist_" + aA).click()
                                        }
                                    }
                                });
                                b("initialize", "0")
                            }
                            if (aw == "updatesession" && ag != 1 && f("updatesession") != 1) {
                                aa("updatingsession", "1");
                                a.each(ax, function (ay, aB) {
                                    if (ay == "buddylist") {
                                        if ((aB == 0 && a("#cometchat_userstab").hasClass("cometchat_tabclick")) || (aB == 1 && !(a("#cometchat_userstab").hasClass("cometchat_tabclick")))) {
                                            a("#cometchat_userstab").click()
                                        }
                                    }
                                    if (ay == "activeChatboxes") {
                                        if (aB != aC) {
                                            var aD = new Array;
                                            var aA = new Array;
                                            if (aB != "") {
                                                var aC = aB.split(/,/);
                                                for (i = 0; i < aC.length; i++) {
                                                    var az = aC[i].split(/\|/);
                                                    aD[az[0]] = az[1]
                                                }
                                            }
                                            if (p("activeChatboxes") != "") {
                                                var aC = p("activeChatboxes").split(/,/);
                                                for (i = 0; i < aC.length; i++) {
                                                    var az = aC[i].split(/\|/);
                                                    aA[az[0]] = az[1]
                                                }
                                            }
                                            for (x in aD) {
                                                if (a("#cometchat_user_" + x).length > 0) {} else {
                                                    Z(x)
                                                }
                                            }
                                            for (y in aA) {
                                                if (aD[y] == null) {
                                                    a("#cometchat_user_" + y + "_popup .cometchat_tabtitle .cometchat_closebox").click()
                                                }
                                            }
                                        }
                                    }
                                    if (ay == "openChatboxId") {
                                        if (aB != ak) {
                                            if (ak != "") {
                                                a("#cometchat_user_" + ak).click()
                                            }
                                            if (aB != "") {
                                                a("#cometchat_user_" + aB).click()
                                            }
                                        }
                                    }
                                });
                                aa("updatingsession", "0");
                                b("updatesession", "0")
                            }
                            if (aw == "messages") {
                                a.each(ax, function (aA, ay) {
                                    q = ay.id;
                                    if ((ak) == (ay.from)) {++au;
                                        var az = o[ay.from];
                                        if (ay.self == 1) {
                                            fromname = D[10]
                                        } else {
                                            fromname = az
                                        }
                                        if (a("#cometchat_message_" + ay.id).length > 0) {
                                            a("#cometchat_message_" + ay.id + " .cometchat_chatboxmessagecontent").html(ay.message)
                                        } else {
                                            ar += ('<div class="cometchat_chatboxmessage" id="cometchat_message_' + ay.id + '"><span class="cometchat_chatboxmessagefrom"><strong>' + fromname + '</strong>:&nbsp;&nbsp;</span><span class="cometchat_chatboxmessagecontent">' + ay.message + "</span></div>")
                                        }
                                    } else {
                                        var aB = 0;
                                        if (a("#cometchat_user_" + ay.from).length > 0) {} else {
                                            aB = 1
                                        }
                                        Y(ay.from, ay.message, ay.self, ay.old, ay.id);
                                        if (ak == "" && W == 1 && aB == 1) {
                                            a("#cometchat_user_" + ay.from).click()
                                        }
                                    }
                                });
                                j = 1;
                                V = ap
                            }
                        });
                        if (ak != "" && au > 0) {
                            a("#cometchat_user_" + ak + "_popup .cometchat_tabcontenttext").append(ar);
                            a("#cometchat_user_" + ak + "_popup .cometchat_tabcontenttext").scrollTop(a("#cometchat_user_" + ak + "_popup .cometchat_tabcontenttext")[0].scrollHeight)
                        }
                    }
                    b("initialize", "0");
                    b("updatesession", "0");
                    if (u != 1 && s != 1) {
                        j++;
                        if (j > 4) {
                            V *= 2;
                            j = 1
                        }
                        if (V > P) {
                            V = P
                        }
                        clearTimeout(al);
                        al = setTimeout(function () {
                            F()
                        },
                        V)
                    }
                }
            })
        }
        function k() {
            S();
            Q();
            for (var ar = 0; ar < ao; ar++) {
                var at = O[ar];
                var str = O[1][2]      
                var fff = str.substr(0,7)

				if (fff == 'add.php') {
                	a("#cometchat_base").append('<div id="cometchat_trayicon_' + ar + '" class="cometchat_trayicon"><img src=' + h + "images/icons/" + at[0] + "></div>")
				}
				else {
                	a("#cometchat_base").append('<div id="cometchat_trayicon_' + ar + '" class="cometchat_trayicon"><img src=' + h + "images/icons/" + at[0] + "></div>")
                }
            }
            a(".cometchat_trayicon").mouseover(function () {
                var au = a(this).attr("id").substr(19);
                T("cometchat_trayicon_" + au, O[au][1], 1);
                a(this).addClass("cometchat_tabmouseover")
            });
            a(".cometchat_trayicon").mouseout(function () {
                a(this).removeClass("cometchat_tabmouseover");
                a("#cometchat_tooltip").css("display", "none")
            });
            a(".cometchat_trayicon").click(function () {
                var av = a(this).attr("id").substr(19);
                var au = "_self";
                if (O[av][3]) {
                    au = O[av][3]
                }

				if (O[av][2].substr(0,7) == 'add.php') {
					GB_showCenter('Kontakt siyahısına dəvət', "http://news.yumroo.az/im/"+O[av][2], 350, 400);
                	//window.open(O[av][2], "xxx","width=400,height=300,status=no,toolbar=no,menubar=no", au)
            	}
             	else if (O[av][2].substr(0,11) == 'friends.php'){
					GB_showCenter('Kontakt siyahısı', "http://www.yumroo.az/im/"+O[av][2], 480, 640);
            	}           	
            	else if (O[av][2].substr(0,7) == 'faq.php'){
					GB_showCenter('İnformasiya', "http://www.yumroo.az/im/"+O[av][2], 480, 640);
            	}
				else {
                	window.open(O[av][2], au)
            	}                	
            	});
            a("<div/>").attr("id", "cometchat_chatbox_right").appendTo(a("#cometchat_base"));
            a("<span/>").addClass("cometchat_tabtext").appendTo(a("#cometchat_chatbox_right"));
            a("<span/>").css("top", "-5px").css("display", "none").addClass("cometchat_tabalertlr").appendTo(a("#cometchat_chatbox_right"));
            a("#cometchat_chatbox_right").bind("click", l);
            a("<div/>").attr("id", "cometchat_chatboxes").appendTo(a("#cometchat_base"));
            a("<div/>").attr("id", "cometchat_chatboxes_wide").appendTo(a("#cometchat_chatboxes"));
            a("<div/>").attr("id", "cometchat_chatbox_left").appendTo(a("#cometchat_base"));
            a("<span/>").addClass("cometchat_tabtext").appendTo(a("#cometchat_chatbox_left"));
            a("<span/>").css("top", "-5px").css("display", "none").addClass("cometchat_tabalertlr").appendTo(a("#cometchat_chatbox_left"));
            a("#cometchat_chatbox_left").bind("click", e);
            t();
            an();
            a("#cometchat_chatbox_right").mouseover(function () {
                a(this).addClass("cometchat_chatbox_lr_mouseover")
            });
            a("#cometchat_chatbox_right").mouseout(function () {
                a(this).removeClass("cometchat_chatbox_lr_mouseover")
            });
            a("#cometchat_chatbox_left").mouseover(function () {
                a(this).addClass("cometchat_chatbox_lr_mouseover")
            });
            a("#cometchat_chatbox_left").mouseout(function () {
                a(this).removeClass("cometchat_chatbox_lr_mouseover")
            });
            a(window).bind("resize", t);
            b("buddylist", "1");
            b("initialize", "1");
            b("updatesession", "0");
            if (typeof document.body.style.maxHeight === "undefined") {
                A = true;
                a("#cometchat_base").css("position", "absolute");
                a("#cometchat_tooltip").css("position", "absolute");
                a("#cometchat_userstab_popup").css("position", "absolute");
                a("#cometchat_optionsbutton_popup").css("position", "absolute");
                a(window).bind("scroll", function () {
                    J()
                })
            }
            a([window, document]).blur(function () {
                U = false
            }).focus(function () {
                if (U == false) {
                    m = 1
                }
                U = true
            });
            F()
        }
        function J() {
            a("#cometchat_base").css("top", a(window).scrollTop() + a(window).height() - 25);
            a("#cometchat_userstab_popup").css("top", parseInt(a(window).height()) - parseInt(a("#cometchat_userstab_popup").css("bottom")) - parseInt(a("#cometchat_userstab_popup").height()) + a(window).scrollTop() + "px");
            a("#cometchat_optionsbutton_popup").css("top", parseInt(a(window).height()) - parseInt(a("#cometchat_optionsbutton_popup").css("bottom")) - parseInt(a("#cometchat_optionsbutton_popup").height()) + a(window).scrollTop() + "px");
            if (a("#cometchat_tooltip").length > 0) {
                a("#cometchat_tooltip").css("top", parseInt(a(window).height()) - parseInt(a("#cometchat_tooltip").css("bottom")) - parseInt(a("#cometchat_tooltip").height()) + a(window).scrollTop() + "px")
            }
            if (ak != "") {
                a("#cometchat_user_" + ak + "_popup").css("position", "absolute");
                a("#cometchat_user_" + ak + "_popup").css("top", parseInt(a(window).height()) - parseInt(a("#cometchat_user_" + ak + "_popup").css("bottom")) - parseInt(a("#cometchat_user_" + ak + "_popup").height()) + a(window).scrollTop() + "px")
            }
        }
        k()
    }
})(jQuery);

/**
 * Cookie plugin
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 */

jQuery.cookie = function (b, j, m) {
    if (typeof j != "undefined") {
        m = m || {};
        if (j === null) {
            j = "";
            m.expires = -1
        }
        var e = "";
        if (m.expires && (typeof m.expires == "number" || m.expires.toUTCString)) {
            var f;
            if (typeof m.expires == "number") {
                f = new Date();
                f.setTime(f.getTime() + (m.expires * 24 * 60 * 60 * 1000))
            } else {
                f = m.expires
            }
            e = "; expires=" + f.toUTCString()
        }
        var l = m.path ? "; path=" + (m.path) : "";
        var g = m.domain ? "; domain=" + (m.domain) : "";
        var a = m.secure ? "; secure": "";
        document.cookie = [b, "=", encodeURIComponent(j), e, l, g, a].join("")
    } else {
        var d = null;
        if (document.cookie && document.cookie != "") {
            var k = document.cookie.split(";");
            for (var h = 0; h < k.length; h++) {
                var c = jQuery.trim(k[h]);
                if (c.substring(0, b.length + 1) == (b + "=")) {
                    d = decodeURIComponent(c.substring(b.length + 1));
                    break
                }
            }
        }
        return d
    }
};

/*
 * jQuery.ScrollTo
 * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 5/25/2009
 */

(function (c) {
    var a = c.scrollTo = function (f, e, d) {
        c(window).scrollTo(f, e, d)
    };
    a.defaults = {
        axis: "xy",
        duration: parseFloat(c.fn.jquery) >= 1.3 ? 0 : 1
    };
    a.window = function (d) {
        return c(window)._scrollable()
    };
    c.fn._scrollable = function () {
        return this.map(function () {
            var e = this,
            d = !e.nodeName || c.inArray(e.nodeName.toLowerCase(), ["iframe", "#document", "html", "body"]) != -1;
            if (!d) {
                return e
            }
            var f = (e.contentWindow || e).document || e.ownerDocument || e;
            return c.browser.safari || f.compatMode == "BackCompat" ? f.body: f.documentElement
        })
    };
    c.fn.scrollTo = function (f, e, d) {
        if (typeof e == "object") {
            d = e;
            e = 0
        }
        if (typeof d == "function") {
            d = {
                onAfter: d
            }
        }
        if (f == "max") {
            f = 9000000000
        }
        d = c.extend({},
        a.defaults, d);
        e = e || d.speed || d.duration;
        d.queue = d.queue && d.axis.length > 1;
        if (d.queue) {
            e /= 2
        }
        d.offset = b(d.offset);
        d.over = b(d.over);
        return this._scrollable().each(function () {
            var l = this,
            j = c(l),
            k = f,
            i,
            g = {},
            m = j.is("html,body");
            switch (typeof k) {
            case "number":
            case "string":
                if (/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(k)) {
                    k = b(k);
                    break
                }
                k = c(k, this);
            case "object":
                if (k.is || k.style) {
                    i = (k = c(k)).offset()
                }
            }
            c.each(d.axis.split(""), function (q, r) {
                var s = r == "x" ? "Left": "Top",
                u = s.toLowerCase(),
                p = "scroll" + s,
                o = l[p],
                n = a.max(l, r);
                if (i) {
                    g[p] = i[u] + (m ? 0 : o - j.offset()[u]);
                    if (d.margin) {
                        g[p] -= parseInt(k.css("margin" + s)) || 0;
                        g[p] -= parseInt(k.css("border" + s + "Width")) || 0
                    }
                    g[p] += d.offset[u] || 0;
                    if (d.over[u]) {
                        g[p] += k[r == "x" ? "width": "height"]() * d.over[u]
                    }
                } else {
                    var t = k[u];
                    g[p] = t.slice && t.slice( - 1) == "%" ? parseFloat(t) / 100 * n: t
                }
                if (/^\d+$/.test(g[p])) {
                    g[p] = g[p] <= 0 ? 0 : Math.min(g[p], n)
                }
                if (!q && d.queue) {
                    if (o != g[p]) {
                        h(d.onAfterFirst)
                    }
                    delete g[p]
                }
            });
            h(d.onAfter);
            function h(n) {
                j.animate(g, e, d.easing, n &&
                function () {
                    n.call(this, f, d)
                })
            }
        }).end()
    };
    a.max = function (j, i) {
        var h = i == "x" ? "Width": "Height",
        e = "scroll" + h;
        if (!c(j).is("html,body")) {
            return j[e] - c(j)[h.toLowerCase()]()
        }
        var g = "client" + h,
        f = j.ownerDocument.documentElement,
        d = j.ownerDocument.body;
        return Math.max(f[e], d[e]) - Math.min(f[g], d[g])
    };
    function b(d) {
        return typeof d == "object" ? d: {
            top: d,
            left: d
        }
    }
})(jQuery);

/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if (typeof deconcept == "undefined") {
    var deconcept = new Object();
}
if (typeof deconcept.util == "undefined") {
    deconcept.util = new Object();
}
if (typeof deconcept.SWFObjectUtil == "undefined") {
    deconcept.SWFObjectUtil = new Object();
}
deconcept.SWFObject = function (_1, id, w, h, _5, c, _7, _8, _9, _a) {
    if (!document.getElementById) {
        return;
    }
    this.DETECT_KEY = _a ? _a: "detectflash";
    this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);
    this.params = new Object();
    this.variables = new Object();
    this.attributes = new Array();
    if (_1) {
        this.setAttribute("swf", _1);
    }
    if (id) {
        this.setAttribute("id", id);
    }
    if (w) {
        this.setAttribute("width", w);
    }
    if (h) {
        this.setAttribute("height", h);
    }
    if (_5) {
        this.setAttribute("version", new deconcept.PlayerVersion(_5.toString().split(".")));
    }
    this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion();
    if (!window.opera && document.all && this.installedVer.major > 7) {
        deconcept.SWFObject.doPrepUnload = true;
    }
    if (c) {
        this.addParam("bgcolor", c);
    }
    var q = _7 ? _7: "high";
    this.addParam("quality", q);
    this.setAttribute("useExpressInstall", false);
    this.setAttribute("doExpressInstall", false);
    var _c = (_8) ? _8: window.location;
    this.setAttribute("xiRedirectUrl", _c);
    this.setAttribute("redirectUrl", "");
    if (_9) {
        this.setAttribute("redirectUrl", _9);
    }
};
deconcept.SWFObject.prototype = {
    useExpressInstall: function (_d) {
        this.xiSWFPath = !_d ? "expressinstall.swf": _d;
        this.setAttribute("useExpressInstall", true);
    },
    setAttribute: function (_e, _f) {
        this.attributes[_e] = _f;
    },
    getAttribute: function (_10) {
        return this.attributes[_10];
    },
    addParam: function (_11, _12) {
        this.params[_11] = _12;
    },
    getParams: function () {
        return this.params;
    },
    addVariable: function (_13, _14) {
        this.variables[_13] = _14;
    },
    getVariable: function (_15) {
        return this.variables[_15];
    },
    getVariables: function () {
        return this.variables;
    },
    getVariablePairs: function () {
        var _16 = new Array();
        var key;
        var _18 = this.getVariables();
        for (key in _18) {
            _16[_16.length] = key + "=" + _18[key];
        }
        return _16;
    },
    getSWFHTML: function () {
        var _19 = "";
        if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) {
            if (this.getAttribute("doExpressInstall")) {
                this.addVariable("MMplayerType", "PlugIn");
                this.setAttribute("swf", this.xiSWFPath);
            }
            _19 = "<embed type=\"application/x-shockwave-flash\" src=\"" + this.getAttribute("swf") + "\" width=\"" + this.getAttribute("width") + "\" height=\"" + this.getAttribute("height") + "\" style=\"" + this.getAttribute("style") + "\"";
            _19 += " id=\"" + this.getAttribute("id") + "\" name=\"" + this.getAttribute("id") + "\" ";
            var _1a = this.getParams();
            for (var key in _1a) {
                _19 += [key] + "=\"" + _1a[key] + "\" ";
            }
            var _1c = this.getVariablePairs().join("&");
            if (_1c.length > 0) {
                _19 += "flashvars=\"" + _1c + "\"";
            }
            _19 += "/>";
        } else {
            if (this.getAttribute("doExpressInstall")) {
                this.addVariable("MMplayerType", "ActiveX");
                this.setAttribute("swf", this.xiSWFPath);
            }
            _19 = "<object id=\"" + this.getAttribute("id") + "\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\"" + this.getAttribute("width") + "\" height=\"" + this.getAttribute("height") + "\" style=\"" + this.getAttribute("style") + "\">";
            _19 += "<param name=\"movie\" value=\"" + this.getAttribute("swf") + "\" />";
            var _1d = this.getParams();
            for (var key in _1d) {
                _19 += "<param name=\"" + key + "\" value=\"" + _1d[key] + "\" />";
            }
            var _1f = this.getVariablePairs().join("&");
            if (_1f.length > 0) {
                _19 += "<param name=\"flashvars\" value=\"" + _1f + "\" />";
            }
            _19 += "</object>";
        }
        return _19;
    },
    write: function (_20) {
        if (this.getAttribute("useExpressInstall")) {
            var _21 = new deconcept.PlayerVersion([6, 0, 65]);
            if (this.installedVer.versionIsValid(_21) && !this.installedVer.versionIsValid(this.getAttribute("version"))) {
                this.setAttribute("doExpressInstall", true);
                this.addVariable("MMredirectURL", escape(this.getAttribute("xiRedirectUrl")));
                document.title = document.title.slice(0, 47) + " - Flash Player Installation";
                this.addVariable("MMdoctitle", document.title);
            }
        }
        if (this.skipDetect || this.getAttribute("doExpressInstall") || this.installedVer.versionIsValid(this.getAttribute("version"))) {
            var n = (typeof _20 == "string") ? document.getElementById(_20) : _20;
            n.innerHTML = this.getSWFHTML();
            return true;
        } else {
            if (this.getAttribute("redirectUrl") != "") {
                document.location.replace(this.getAttribute("redirectUrl"));
            }
        }
        return false;
    }
};
deconcept.SWFObjectUtil.getPlayerVersion = function () {
    var _23 = new deconcept.PlayerVersion([0, 0, 0]);
    if (navigator.plugins && navigator.mimeTypes.length) {
        var x = navigator.plugins["Shockwave Flash"];
        if (x && x.description) {
            _23 = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
        }
    } else {
        if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0) {
            var axo = 1;
            var _26 = 3;
            while (axo) {
                try {
                    _26++;
                    axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + _26);
                    _23 = new deconcept.PlayerVersion([_26, 0, 0]);
                } catch(e) {
                    axo = null;
                }
            }
        } else {
            try {
                var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
            } catch(e) {
                try {
                    var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
                    _23 = new deconcept.PlayerVersion([6, 0, 21]);
                    axo.AllowScriptAccess = "always";
                } catch(e) {
                    if (_23.major == 6) {
                        return _23;
                    }
                }
                try {
                    axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
                } catch(e) {}
            }
            if (axo != null) {
                _23 = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
            }
        }
    }
    return _23;
};
deconcept.PlayerVersion = function (_29) {
    this.major = _29[0] != null ? parseInt(_29[0]) : 0;
    this.minor = _29[1] != null ? parseInt(_29[1]) : 0;
    this.rev = _29[2] != null ? parseInt(_29[2]) : 0;
};
deconcept.PlayerVersion.prototype.versionIsValid = function (fv) {
    if (this.major < fv.major) {
        return false;
    }
    if (this.major > fv.major) {
        return true;
    }
    if (this.minor < fv.minor) {
        return false;
    }
    if (this.minor > fv.minor) {
        return true;
    }
    if (this.rev < fv.rev) {
        return false;
    }
    return true;
};
deconcept.util = {
    getRequestParameter: function (_2b) {
        var q = document.location.search || document.location.hash;
        if (_2b == null) {
            return q;
        }
        if (q) {
            var _2d = q.substring(1).split("&");
            for (var i = 0; i < _2d.length; i++) {
                if (_2d[i].substring(0, _2d[i].indexOf("=")) == _2b) {
                    return _2d[i].substring((_2d[i].indexOf("=") + 1));
                }
            }
        }
        return "";
    }
};
deconcept.SWFObjectUtil.cleanupSWFs = function () {
    var _2f = document.getElementsByTagName("OBJECT");
    for (var i = _2f.length - 1; i >= 0; i--) {
        _2f[i].style.display = "none";
        for (var x in _2f[i]) {
            if (typeof _2f[i][x] == "function") {
                _2f[i][x] = function () {};
            }
        }
    }
};
if (deconcept.SWFObject.doPrepUnload) {
    if (!deconcept.unloadSet) {
        deconcept.SWFObjectUtil.prepUnload = function () {
            __flash_unloadHandler = function () {};
            __flash_savedUnloadHandler = function () {};
            window.attachEvent("onunload", deconcept.SWFObjectUtil.cleanupSWFs);
        };
        window.attachEvent("onbeforeunload", deconcept.SWFObjectUtil.prepUnload);
        deconcept.unloadSet = true;
    }
}
if (!document.getElementById && document.all) {
    document.getElementById = function (id) {
        return document.all[id];
    };
}
var getQueryParamValue = deconcept.util.getRequestParameter;
var FlashObject = deconcept.SWFObject;
var SWFObject = deconcept.SWFObject;

jQuery(document).ready(function () {
    jQuery.cometchat();
});
