Function.prototype.bind=function(b){
    var c=this,a=function(){
        return c.apply(b,arguments)
        };

    return(a)
    };

SEMods=function(){};

SEMods.TextAreaControl=function(a){
    this.obj=a;
    this.obj.style.overflow="hidden";
    this.originalHeight=this.obj.getStyle("height").toInt();
    var b=this.update.bind(this);
    a.addEvent("focus",this.onFocus.bind(this));
    a.addEvent("blur",this.onBlur.bind(this));
    this.update()
    };

SEMods.TextAreaControl.prototype={
    obj:null,
    updating:false,
    autoGrow:false,
    originalHeight:null,
    shadowElement:null,
    increment:0,
    timer:null,
    lastLength:0,
    setAutoGrow:function(a){
        this.autoGrow=a;
        this.createShadowElement();
        this.update()
        },
    onUpdate:function(){
        if(this.autoGrow&&this.lastLength!=this.obj.value.length){
            this.lastLength=this.obj.value.length;
            this.updateShadowElement();
            this.obj.style.height=Math.max(this.originalHeight,this.shadowElement.offsetHeight+this.increment)+"px"
            }
        },
beginUpdate:function(){
    if(this.updating){
        return false
        }
        this.updating=true;
    return true
    },
endUpdate:function(){
    this.updating=false
    },
update:function(){
    if(!this.beginUpdate()){
        return
    }
    this.onUpdate();
    this.endUpdate()
    },
createShadowElement:function(){
    if(this.shadowElement){
        return
    }
    this.shadowElement=document.createElement("DIV");
    this.shadowElement.style.position="absolute";
    this.shadowElement.style.top="-99999px";
    this.shadowElement.style.left="-99999px";
    document.body.appendChild(this.shadowElement)
    },
updateShadowElement:function(){
    if(this.shadowElement){
        text=this.obj.value+"<br>";
        this.shadowElement.innerHTML=text.toString().replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"<br />");
        var b=this.getPXMetrics(this.obj.getStyle("font-size"),10);
        var a=this.obj.getStyle("line-height");
        if((/Opera/i.test(navigator.userAgent))){
            a=this.getPXMetrics(a,0)+3+"px"
            }
            this.increment=b+10;
        this.shadowElement.style.width=this.obj.offsetWidth+"px";
        this.shadowElement.style.lineHeight=a;
        this.shadowElement.style.fontSize=this.obj.getStyle("font-size");
        this.shadowElement.style.fontFamily=this.obj.getStyle("font-family");
        this.shadowElement.style.paddingLeft=this.obj.getStyle("padding-left");
        this.shadowElement.style.paddingRight=this.obj.getStyle("padding-right")
        }
    },
onFocus:function(){
    this.timer=setInterval(this.update.bind(this),500)
    },
onBlur:function(){
    if(this.timer){
        clearInterval(this.timer);
        this.timer=null
        }
    },
getPXMetrics:function(c,b){
    var a=parseFloat(c);
    if(isNaN(a)){
        return b!=null?b:a
        }
        return/px/i.test(c)?a:/pt/i.test(c)?1.3333*a:a
    }
};

function textarea_autogrow(a){
    var b=$(a);
    if(b&&!b._controlled){
        b._controlled=true;
        new SEMods.TextAreaControl(b).setAutoGrow(true);
        return b.getStyle("height").toInt()
        }
    };

TB_WIDTH=0;
TB_HEIGHT=0;
var TB_doneOnce=0;
var TB_ready=false;
var TB_useReady=true;
function TB_init(){
    TB_ready=true;
    $$("a.smoothbox").each(function(a){
        a.onclick=TB_bind
        })
    }
    window.addEvent("domready",TB_init);
function TB_bind(b){
    if(TB_useReady&&!TB_ready){
        return
    }
    var b=new Event(b);
    b.preventDefault();
    this.blur();
    var a=this.title||this.name||"";
    var c=this.rel||false;
    TB_show(a,this.href,c);
    this.onclick=TB_bind;
    return false
    }
    function TB_show(j,b,k,e,h){
    if(TB_useReady&&!TB_ready){
        return
    }
    if(!h){
        h=0
        }
        if(!$("TB_overlay")){
        (new Element("div").setProperty("id","TB_overlay")).inject($("smoothbox_container")||document.body);
        $("TB_overlay").setOpacity(0.6);
        TB_overlaySize()
        }
        if(!$("TB_window")){
        (new Element("div").setProperty("id","TB_window")).inject($("smoothbox_container")||document.body);
        $("TB_window").setOpacity(0)
        }else{
        $("TB_window").destroy();
        (new Element("div").setProperty("id","TB_window")).inject($("smoothbox_container")||document.body);
        $("TB_window").setOpacity(0)
        }
        if(h==0){
        $("TB_overlay").onclick=TB_remove
        }else{
        $("TB_overlay").onclick=""
        }
        window.onscroll=TB_position;
    var c=b.match(/(.+)?/)[1]||b;
    var a=b.match(/\?(.+)/)[1];
    var f=TB_parseQuery(a);
    TB_WIDTH=(f.width*1)+30;
    TB_HEIGHT=(f.height*1)+40;
    var d=TB_WIDTH-30,i=TB_HEIGHT-45;
    if(b.indexOf("TB_iframe")!=-1){
        urlNoQuery=b.split("TB_");
        $("TB_window").innerHTML+="<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+j+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>X</a></div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"&in_smoothbox=true' id='TB_iframeContent' name='TB_iframeContent' scrolling='auto' style='width:"+(d+29)+"px;height:"+(i+17)+"px;' onload='TB_showWindow()'> </iframe>"
        }else{
        $("TB_window").innerHTML+="<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+j+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>X</a></div></div><div id='TB_ajaxContent' style='width:"+d+"px;height:"+i+"px;'></div>"
        }
        $("TB_closeWindowButton").onclick=TB_remove;
    if(b.indexOf("TB_inline")!=-1){
        $("TB_ajaxContent").innerHTML=($(f.inlineId).innerHTML);
        TB_position();
        TB_showWindow()
        }else{
        if(b.indexOf("TB_iframe")!=-1){
            TB_position();
            if(frames.TB_iframeContent==undefined){
                $(document).keyup(function(m){
                    var l=m.keyCode;
                    if(l==27){
                        TB_remove()
                        }
                    });
            TB_showWindow()
            }
        }else{
    var g=function(){
        TB_position();
        TB_showWindow()
        };

    new Request.HTML({
        method:"get",
        update:$("TB_ajaxContent"),
        onComplete:g
    }).get(b)
    }
}
window.onresize=function(){
    TB_position();
    TB_overlaySize()
    };

document.onkeyup=function(l){
    var l=new Event(l);
    if(l.code==27){
        TB_remove()
        }
    }
}
function TB_showWindow(){
    if(TB_useReady&&!TB_ready){
        return
    }
    if(TB_doneOnce==0){
        TB_doneOnce=1;
        $("TB_window").set("tween",{
            duration:250
        });
        $("TB_window").tween("opacity",0,1)
        }else{
        $("TB_window").setStyle("opacity",1)
        }
    }
function TB_remove(){
    if(TB_useReady&&!TB_ready){
        return
    }
    $("TB_overlay").onclick=null;
    document.onkeyup=null;
    document.onkeydown=null;
    if($("TB_closeWindowButton")){
        $("TB_closeWindowButton").onclick=null
        }
        $("TB_window").set("tween",{
        duration:250,
        onComplete:function(){
            $("TB_window").destroy()
            }
        });
$("TB_window").tween("opacity",1,0);
$("TB_overlay").set("tween",{
    duration:400,
    onComplete:function(){
        $("TB_overlay").destroy()
        }
    });
$("TB_overlay").tween("opacity",0.6,0);
window.onscroll=null;
window.onresize=null;
TB_init();
TB_doneOnce=0;
return false
}
function TB_position(){
    if(TB_useReady&&!TB_ready){
        return
    }
    $("TB_window").set("morph",{
        duration:75
    });
    $("TB_window").morph({
        width:TB_WIDTH+"px",
        left:(window.getScrollLeft()+(window.getWidth()-TB_WIDTH)/2)+"px",
        top:(window.getScrollTop()+(window.getHeight()-TB_HEIGHT)/2)+"px"
        })
    }
    function TB_overlaySize(){
    if(TB_useReady&&!TB_ready){
        return
    }
    $("TB_overlay").setStyles({
        height:"0px",
        width:"0px"
    });
    $("TB_overlay").setStyles({
        height:window.getScrollHeight()+"px",
        width:window.getScrollWidth()+"px"
        })
    }
    function TB_parseQuery(c){
    if(TB_useReady&&!TB_ready){
        return
    }
    if(!c){
        return{}
    }
    var e={};

var b=c.split(/[;&]/);
for(var a=0;a<b.length;a++){
    var d=b[a].split("=");
    if(!d||d.length!=2){
        continue
    }
    e[unescape(d[0])]=unescape(d[1]).replace(/\+/g," ")
    }
    return e
};

if(typeof(bsn)=="undefined"){
    _b=bsn={}
    }
    if(typeof(_b.Autosuggest)=="undefined"){
    _b.Autosuggest={}
    }else{
    alert("Autosuggest is already set!")
        }
        _b.AutoSuggest=function(e,d){
    if(!document.getElementById){
        return 0
        }
        this.fld=_b.DOM.gE(e);
    if(!this.fld){
        return 0
        }
        this.sInp="";
    this.nInpC=0;
    this.aSug=[];
    this.iHigh=0;
    this.oP=d?d:{};

    var a,b={
        minchars:1,
        meth:"get",
        varname:"input",
        className:"autosuggest",
        timeout:2500,
        delay:0,
        offsety:-5,
        shownoresults:true,
        noresults:"No results!",
        maxheight:250,
        cache:true,
        maxentries:25,
        blurtrigger:false,
        multisuggest:true
    };

    for(a in b){
        if(typeof(this.oP[a])!=typeof(b[a])){
            this.oP[a]=b[a]
            }
        }
    var c=this;
this.fld.onkeypress=function(f){
    return c.onKeyPress(f)
    };

this.fld.onkeyup=function(f){
    return c.onKeyUp(f)
    };

if(typeof(this.oP.callback)=="function"&&this.oP.blurtrigger){
    this.fld.onblur=function(g){
        if(document.activeElement&&typeof(g)==="undefined"){
            var f=document.activeElement
            }else{
            var f=g.explicitOriginalTarget;
            while(f.parentNode){
                if(f.tagName=="A"&&typeof(f.id)=="string"){
                    if(f.id.substring(0,10)=="bsnsuggest"){
                        break
                    }
                }
                f=f.parentNode
            }
            if(typeof(f.id)!="string"){
            f.id=""
            }
        }
    if(f.id.substring(0,10)!="bsnsuggest"){
    c.oP.callback({
        id:c.fld.value,
        value:c.fld.value
        });
    c.clearSuggestions()
    }
}
}
this.fld.setAttribute("autocomplete","off")
};

_b.AutoSuggest.prototype.onKeyPress=function(f){
    var e=(window.event)?window.event.keyCode:f.keyCode;
    var d=13;
    var c=9;
    var g=27;
    var b=186;
    var a=1;
    switch(e){
        case d:
            if(this.aSug.length!=0&&this.iHigh){
            this.setHighlightedValue();
            a=false
            }else{
            if(this.fld.value.length>0){
                if(typeof(this.oP.callback)=="function"){
                    this.clearSuggestions();
                    this.oP.callback({
                        id:this.fld.value,
                        value:this.fld.value
                        })
                    }
                    a=false
                }else{
                a=false
                }
            }
        break;
    case g:
        this.clearSuggestions();
        break
        }
        return a
};

_b.AutoSuggest.prototype.onKeyUp=function(f){
    var d=(window.event)?window.event.keyCode:f.keyCode;
    var c=38;
    var e=40;
    var a=1;
    switch(d){
        case c:
            this.changeHighlight(d);
            a=0;
            break;
        case e:
            this.changeHighlight(d);
            a=0;
            break;
        default:
            var b=this.fld.value.split(/[;]+/ig);
            this.getSuggestions(b[b.length-1])
            }
            return a
    };

_b.AutoSuggest.prototype.getSuggestions=function(g){
    if(g==this.sInp){
        return 0
        }
        _b.DOM.remE(this.idAs);
    this.sInp=g;
    if(g.length<this.oP.minchars){
        this.aSug=[];
        this.nInpC=g.length;
        return 0
        }
        var d=this.nInpC;
    this.nInpC=g.length?g.length:0;
    var b=this.aSug.length;
    if(this.nInpC>d&&b&&b<this.oP.maxentries&&this.oP.cache){
        var a=[];
        for(var e=0;e<b;e++){
            if(this.aSug[e].value.substr(0,g.length).toLowerCase()==g.toLowerCase()||this.aSug[e].info.substr(0,g.length).toLowerCase()==g.toLowerCase()){
                a.push(this.aSug[e])
                }
            }
        this.aSug=a;
    if(this.aSug.length<b){
        var f=this;
        var c=this.sInp;
        clearTimeout(this.ajID);
        this.ajID=setTimeout(function(){
            f.doAjaxRequest(c)
            },this.oP.delay)
        }else{
        this.createList(this.aSug)
        }
        return false
    }else{
    var f=this;
    var c=this.sInp;
    clearTimeout(this.ajID);
    this.ajID=setTimeout(function(){
        f.doAjaxRequest(c)
        },this.oP.delay)
    }
    return false
};

_b.AutoSuggest.prototype.doAjaxRequest=function(c){
    var e=this.fld.value.split(/[;]+/ig);
    if(c!=e[e.length-1]){
        return false
        }
        var h=this;
    if(typeof(this.oP.script)=="function"){
        var d=this.oP.script(encodeURIComponent(this.sInp))
        }else{
        var d=this.oP.script+this.oP.varname+"="+encodeURIComponent(this.sInp)
        }
        if(!d){
        return false
        }
        var b=this.oP.meth;
    var c=this.sInp;
    var a=function(i){
        h.setSuggestions(i,c)
        };

    var f=function(i){};

    var g=new _b.Ajax();
    g.makeRequest(d,b,a,f)
    };

_b.AutoSuggest.prototype.setSuggestions=function(req,input){
    var new_value=this.fld.value.split(/[;]+/ig);
    if(input!=new_value[new_value.length-1]){
        return false
        }
        this.aSug=[];
    if(this.oP.json){
        var jsondata=eval("("+req.responseText+")");
        for(var i=0;i<jsondata.results.length;i++){
            this.aSug.push({
                id:jsondata.results[i].id,
                value:jsondata.results[i].value,
                info:jsondata.results[i].info,
                photo:jsondata.results[i].photo,
                photo_width:jsondata.results[i].photo_width
                })
            }
        }else{
    var xml=req.responseXML;
    var results=xml.getElementsByTagName("results")[0].childNodes;
    for(var i=0;i<results.length;i++){
        if(results[i].hasChildNodes()){
            this.aSug.push({
                id:results[i].getAttribute("id"),
                value:results[i].childNodes[0].nodeValue,
                info:results[i].getAttribute("info")
                })
            }
        }
    }
this.idAs="as_"+this.fld.id;
this.createList(this.aSug)
};

_b.AutoSuggest.prototype.createList=function(b){
    var r=this;
    _b.DOM.remE(this.idAs);
    this.killTimeout();
    if(b.length==0&&!this.oP.shownoresults){
        return false
        }
        var m=_b.DOM.cE("div",{
        id:this.idAs,
        className:this.oP.className
        });
    var e=_b.DOM.cE("div",{
        className:"as_corner"
    });
    var h=_b.DOM.cE("div",{
        className:"as_bar"
    });
    var t=_b.DOM.cE("div",{
        className:"as_header"
    });
    t.appendChild(e);
    t.appendChild(h);
    m.appendChild(t);
    var l=_b.DOM.cE("ul",{
        id:"as_ul"
    });
    for(var u=0;u<b.length;u++){
        var z=b[u].value;
        var x=b[u].info;
        var q=z.toLowerCase().indexOf(this.sInp.toLowerCase());
        var c=x.toLowerCase().indexOf(this.sInp.toLowerCase());
        if(q!=-1){
            var j=z.substring(0,q)+"<em>"+z.substring(q,q+this.sInp.length)+"</em>"+z.substring(q+this.sInp.length);
            var p=x
            }else{
            var j=z;
            var p=x.substring(0,c)+"<em>"+x.substring(q,c+this.sInp.length)+"</em>"+x.substring(c+this.sInp.length)
            }
            if(z!=x){
            j=p+" ("+j+")"
            }
            var s=_b.DOM.cE("span",{},j,true);
        var n=_b.DOM.cE("img",{
            src:b[u].photo,
            width:b[u].photo_width,
            border:"0"
        });
        n.removeAttribute("height");
        s.insertBefore(n,s.childNodes[0]);
        var w=_b.DOM.cE("a",{
            href:"javascript:void(0);"
        });
        var f=_b.DOM.cE("span",{
            className:"tl"
        }," ");
        var d=_b.DOM.cE("span",{
            className:"tr"
        }," ");
        w.appendChild(f);
        w.appendChild(d);
        w.appendChild(s);
        w.name=u+1;
        w.id="bsnsuggest_"+(u+1);
        w.onclick=function(){
            r.setHighlightedValue();
            return false
            };

        w.onmouseover=function(){
            r.setHighlight(this.name)
            };

        var k=_b.DOM.cE("li",{},w);
        l.appendChild(k)
        }
        if(b.length==0&&this.oP.shownoresults){
        var k=_b.DOM.cE("li",{
            className:"as_warning"
        },this.oP.noresults);
        l.appendChild(k)
        }
        m.appendChild(l);
    var v=_b.DOM.cE("div",{
        className:"as_corner"
    });
    var y=_b.DOM.cE("div",{
        className:"as_bar"
    });
    var o=_b.DOM.cE("div",{
        className:"as_footer"
    });
    o.appendChild(v);
    o.appendChild(y);
    m.appendChild(o);
    var g=_b.DOM.getPos(this.fld);
    m.style.left=g.x+"px";
    m.style.top=(g.y+this.fld.offsetHeight+this.oP.offsety)+"px";
    m.style.width=this.fld.offsetWidth+"px";
    m.onmouseover=function(){
        r.killTimeout()
        };

    m.onmouseout=function(){
        r.resetTimeout()
        };

    document.getElementsByTagName("body")[0].appendChild(m);
    this.iHigh=0;
    var r=this;
    this.toID=setTimeout(function(){
        r.clearSuggestions()
        },this.oP.timeout)
    };

_b.AutoSuggest.prototype.changeHighlight=function(a){
    var b=_b.DOM.gE("as_ul");
    if(!b){
        return false
        }
        var c;
    if(a==40){
        c=this.iHigh+1
        }else{
        if(a==38){
            c=this.iHigh-1
            }
        }
    if(c>b.childNodes.length){
    c=b.childNodes.length
    }
    if(c<1){
    c=1
    }
    this.setHighlight(c)
    };

_b.AutoSuggest.prototype.setHighlight=function(b){
    var a=_b.DOM.gE("as_ul");
    if(!a){
        return false
        }
        if(this.iHigh>0){
        this.clearHighlight()
        }
        this.iHigh=Number(b);
    a.childNodes[this.iHigh-1].className="as_highlight";
    this.killTimeout()
    };

_b.AutoSuggest.prototype.clearHighlight=function(){
    var a=_b.DOM.gE("as_ul");
    if(!a){
        return false
        }
        if(this.iHigh>0){
        a.childNodes[this.iHigh-1].className="";
        this.iHigh=0
        }
    };

_b.AutoSuggest.prototype.setHighlightedValue=function(){
    if(this.iHigh){
        var a=this.fld.value.split(/[;]+/ig);
        a.pop();
        a.push(this.aSug[this.iHigh-1].value);
        if(this.oP.multisuggest){
            var b=";"
            }else{
            var b=""
            }
            this.sInp=this.fld.value=a.join(";")+b;
        this.fld.focus();
        if(this.fld.selectionStart){
            this.fld.setSelectionRange(this.sInp.length,this.sInp.length)
            }
            if(typeof(this.oP.callback)=="function"){
            this.oP.callback(this.aSug[this.iHigh-1])
            }
            this.clearSuggestions()
        }
    };

_b.AutoSuggest.prototype.killTimeout=function(){
    clearTimeout(this.toID)
    };

_b.AutoSuggest.prototype.resetTimeout=function(){
    clearTimeout(this.toID);
    var a=this;
    this.toID=setTimeout(function(){
        a.clearSuggestions()
        },1000)
    };

_b.AutoSuggest.prototype.clearSuggestions=function(){
    this.killTimeout();
    this.aSug=[];
    var a=_b.DOM.gE(this.idAs);
    var c=this;
    if(a){
        var b=new _b.Fader(a,1,0,250,function(){
            _b.DOM.remE(c.idAs)
            })
        }
    };

if(typeof(_b.Ajax)=="undefined"){
    _b.Ajax={}
    }
    _b.Ajax=function(){
    this.req={};

    this.isIE=false
    };

_b.Ajax.prototype.makeRequest=function(c,b,a,d){
    if(b!="POST"){
        b="GET"
        }
        this.onComplete=a;
    this.onError=d;
    var e=this;
    if(window.XMLHttpRequest){
        this.req=new XMLHttpRequest();
        this.req.onreadystatechange=function(){
            e.processReqChange()
            };

        this.req.open("GET",c,true);
        this.req.send(null)
        }else{
        if(window.ActiveXObject){
            this.req=new ActiveXObject("Microsoft.XMLHTTP");
            if(this.req){
                this.req.onreadystatechange=function(){
                    e.processReqChange()
                    };

                this.req.open(b,c,true);
                this.req.send()
                }
            }
    }
};

_b.Ajax.prototype.processReqChange=function(){
    if(this.req.readyState==4){
        if(this.req.status==200){
            this.onComplete(this.req)
            }else{
            this.onError(this.req.status)
            }
        }
};

if(typeof(_b.DOM)=="undefined"){
    _b.DOM={}
    }
    _b.DOM.cE=function(g,c,b,f){
    var h=document.createElement(g);
    if(!h){
        return 0
        }
        for(var d in c){
        h[d]=c[d]
        }
        var e=typeof(b);
    if(e=="string"&&!f){
        h.appendChild(document.createTextNode(b))
        }else{
        if(e=="string"&&f){
            h.innerHTML=b
            }else{
            if(e=="object"){
                h.appendChild(b)
                }
            }
    }
return h
};

_b.DOM.gE=function(c){
    var a=typeof(c);
    if(a=="undefined"){
        return 0
        }else{
        if(a=="string"){
            var b=document.getElementById(c);
            if(!b){
                return 0
                }else{
                if(typeof(b.appendChild)!="undefined"){
                    return b
                    }else{
                    return 0
                    }
                }
        }else{
    if(typeof(c.appendChild)!="undefined"){
        return c
        }else{
        return 0
        }
    }
}
};

_b.DOM.remE=function(a){
    var b=this.gE(a);
    if(!b){
        return 0
        }else{
        if(b.parentNode.removeChild(b)){
            return true
            }else{
            return 0
            }
        }
};

_b.DOM.getPos=function(c){
    var c=this.gE(c);
    var b=c;
    var d=0;
    if(b.offsetParent){
        while(b.offsetParent){
            d+=b.offsetLeft;
            b=b.offsetParent
            }
        }else{
    if(b.x){
        d+=b.x
        }
    }
var b=c;
var a=0;
if(b.offsetParent){
    while(b.offsetParent){
        a+=b.offsetTop;
        b=b.offsetParent
        }
    }else{
    if(b.y){
        a+=b.y
        }
    }
return{
    x:d,
    y:a
}
};

if(typeof(_b.Fader)=="undefined"){
    _b.Fader={}
    }
    _b.Fader=function(b,f,e,a,d){
    if(!b){
        return 0
        }
        this.e=b;
    this.from=f;
    this.to=e;
    this.cb=d;
    this.nDur=a;
    this.nInt=50;
    this.nTime=0;
    var c=this;
    this.nID=setInterval(function(){
        c._fade()
        },this.nInt)
    };

_b.Fader.prototype._fade=function(){
    this.nTime+=this.nInt;
    var a=Math.round(this._tween(this.nTime,this.from,this.to,this.nDur)*100);
    var c=a/100;
    if(this.e.filters){
        try{
            this.e.filters.item("DXImageTransform.Microsoft.Alpha").opacity=a
            }catch(b){
            this.e.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity="+a+")"
            }
        }else{
    this.e.style.opacity=c
    }
    if(this.nTime==this.nDur){
    clearInterval(this.nID);
    if(this.cb!=undefined){
        this.cb()
        }
    }
};

_b.Fader.prototype._tween=function(e,a,g,f){
    return a+((g-a)*(e/f))
    };

var vsprintf=function(n,j){
    if(!j||!j.length){
        return n
        }
        var e="";
    var b;
    var d=0;
    var g;
    var p;
    var o;
    var h;
    var a;
    while(n.length>0){
        if(!n.match(/[%]/)){
            e+=n;
            break
        }
        b=n.match(/^([^%]+?)([%].+)?$/);
        if(b){
            e+=b[1];
            n=typeof(b[2])?b[2]:"";
            if(n==""){
                break
            }
        }
        if(n.substring(0,2)=="%%"){
        n=n.substring(2);
        e+="%";
        continue
    }
    b=n.match(/^[%](?:([0-9]+)\x24)?(\x2B)?(\x30|\x27[^$])?(\x2D)?([0-9]+)?(?:\x2E([0-9]+))?([bcdeEfosuxX])/);
    if(b){
        o=b[7];
        h=b[6]||false;
        a=b[2]||false;
        g=(b[1]?b[1]-1:d++);
        if(j[g]){
            p=j[g]
            }else{
            throw ("Undefined argument for index "+g)
            }
            switch(typeof(p)){
            case"number":case"string":case"boolean":
                break;
            case"undefined":
                if(p==null){
                p="";
                break
            }
            default:
                throw ("Unknown argument type: "+typeof(p));
                break
                }
                switch(o){
            case"b":
                if(typeof(p)!="number"){
                p=parseInt(p)
                }
                p=p.toString(2);
                break;
            case"c":
                p=String.fromCharCode(p);
                break;
            case"d":
                p=parseInt(p);
                break;
            case"E":case"e":
                if(typeof(p)!="number"){
                p=parseFloat(p)
                }
                if(h){
                p=p.toExponential(h)
                }else{
                p=p.toExponential()
                }
                if(o=="E"){
                p=p.toUpperCase()
                }
                break;
            case"u":
                p=Math.abs(parseInt(p));
                break;
            case"f":
                if(h){
                p=parseFloat(p).toFixed(h)
                }else{
                p=parseFloat(p)
                }
                break;
            case"o":
                if(typeof(p)!="number"){
                p=parseInt(p)
                }
                p=p.toString(8);
                break;
            case"s":
                if(typeof(p)!="string"){
                p=String(p)
                }
                if(h){
                p=p.substring(0,h)
                }
                break;
            case"x":case"X":
                if(typeof(p)!="number"){
                p=parseInt(p)
                }
                p=p.toString(8);
                if(o=="X"){
                p=p.toUpperCase()
                }
                break
            }
            if((o=="d"||o=="e"||o=="f")&&a&&p>0){
            p="+"+p
            }
            var c,f;
        if(b[3]){
            c=b[3]
            }else{
            c=" "
            }
            if(b[5]){
            f=b[5]
            }else{
            f=0
            }
            f-=p.length;
        if(f>0){
            var k=function(r,q){
                var m="";
                while(q>0){
                    m+=r;
                    q--
                }
                return m
                }(c,f);
            if(b[4]){
                e+=p+k
                }else{
                e+=k+p
                }
            }else{
        e+=p
        }
        n=n.substring(b[0].length)
    }else{
    throw ("Malformed expression in string: "+n)
    }
}
return e
};

var sprintf=function(){
    var a=[];
    var b=arguments[0];
    for(i=1,l=arguments.length;i<l;i++){
        a[i-1]=arguments[i]
        }
        return vsprintf(b,a)
    };

var SocialEngineAPI={
    version:"0.1.0alpha"
};

SocialEngineAPI.Base=new Class({
    initialize:function(){
        this.version=SocialEngineAPI.version
        },
    RegisterModule:function(a){
        a.Base=this
        }
    });
SocialEngineAPI.Core=new Class({
    Base:{},
    settings:{},
    plugins:{},
    options:{
        ajaxURL:"js_api.php"
    },
    initialize:function(){},
    ImportSettings:function(a){
        this.settings=a
        },
    ImportPlugins:function(a){
        this.plugins=a
        }
    });
if(typeof(SocialEngineAPI)=="undefined"){
    var SocialEngineAPI={}
}
SocialEngineAPI.Language=new Class({
    Base:{},
    initialize:function(){
        this.languageVariables=new Hash()
        },
    Translate:function(b){
        var a=this.languageVariables.get(b)||"Missing Language Variable #"+b;
        return a
        },
    TranslateFormatted:function(d,c){
        var b=this.languageVariables.get(d)||"Missing Language Variable #"+d;
        c.unshift(b);
        var a=sprintf.run(c);
        return a
        },
    Import:function(a){
        if($type(a)=="object"){
            this.languageVariables.extend(a)
            }
        }
});
var SocialEngineLanguage=SocialEngineAPI.Language;
SocialEngineAPI.URL=new Class({
    Base:{},
    url_base:null,
    url_info:{},
    initialize:function(){},
    url_create:function(c,a,e,d,b){
        var f=(SocialEngine.Core.settings.setting_url?this.url_info[c].url_subdirectory:this.url_info[c].url_regular);
        if(!f){
            return false
            }
            f=f.replace("$user",a);
        f=f.replace("$id1",e);
        f=f.replace("$id2",d);
        f=f.replace("$id3",b);
        return this.url_base+f
        },
    url_userdir:function(a){
        return"uploads_user/"+(a+999-((a-1)%1000)).toString()+"/"+a+"/"
        },
    ImportURLBase:function(a){
        this.url_base=a
        },
    ImportURLInfo:function(a){
        this.url_info=a
        }
    });
SocialEngineAPI.Comments=new Class({
    Implements:[Options],
    Base:{},
    page:1,
    total:0,
    changed:false,
    isEditing:false,
    options:{
        ajaxURL:"misc_js.php",
        ajaxMethod:"post",
        ajaxSecure:false,
        canComment:false,
        commentHTML:false,
        commentCode:false,
        originalHeight:70,
        type:false,
        typeIdentifier:false,
        typeID:false,
        paginate:false,
        cpp:false,
        commentLinks:{
            reply:false,
            walltowall:false
        },
        object_owner:false,
        object_owner_id:false,
        typeTab:false,
        typeCol:false,
        typeTabParent:false,
        typeColParent:false,
        typeChild:false
    },
    initialize:function(a){
        this.setOptions(a);
        if(this.options.initialTotal){
            this.total=this.options.initialTotal
            }
            var b=this;
        window.addEvent("domready",function(){
            b.showPostComment();
            b.options.originalHeight=textarea_autogrow("comment_body");
            b.getComments(1)
            })
        },
    showPostComment:function(){
        var c="";
        c+="<div class='comment_headline'>"+this.Base.Language.Translate(854)+" (<span class='tc' id='"+this.options.type+"_"+this.options.typeID+"_totalcomments'>"+this.total+"</span>)</div>";
        if(this.options.canComment){
            c+="<form action='misc_js.php' method='post' target='ajaxframe' name='comment_post_form'><div class='profile_postcomment'><textarea name='comment_body' id='comment_body' cols='25' class='comment_area'>"+this.Base.Language.Translate(829)+"</textarea>";
            if(this.options.commentHTML){
                c+="<div style='margin-top: 5px;'>"+this.Base.Language.TranslateFormatted(1034,[this.options.commentHTML])+"</div>"
                }
                if(this.options.commentCode){
                c+="<div style='float: left; margin-top: 5px;'><a href='javascript:void(0);' onClick=\"this.blur();$('secure_image').src=$('secure_image').src+'?'+(new Date()).getTime();\"><img src='./images/secure.php' id='secure_image' border='0' height='20' width='67' class='signup_code'></a> <input type='text' name='comment_secure' id='comment_secure' class='text' size='6' maxlength='10' /> <img src='./images/icons/tip.gif' border='0' class='Tips1' style='vertical-align: middle;' title='"+this.Base.Language.Translate(856)+"' /></div>"
                }
                c+="<div style='text-align: right; margin-top: 5px;'><input type='submit' id='comment_submit' class='button' value='"+this.Base.Language.Translate(833)+"' /><input type='hidden' name='task' value='comment_post' /><input type='hidden' name='type' value='"+this.options.type+"' /><input type='hidden' name='iden' value='"+this.options.typeIdentifier+"' /><input type='hidden' name='value' value='"+this.options.typeID+"' />";
            if(this.options.object_owner&&this.options.object_owner_id){
                c+='<input type="hidden" name="object_owner" value="'+this.options.object_owner+'"><input type="hidden" name="object_owner_id" value="'+this.options.object_owner_id+'">'
                }else{
                c+='<input type="hidden" name="user" value="'+this.Base.Owner.user_info.user_username+'">'
                }
                if(this.options.typeTab){
                c+="<input type='hidden' name='tab' value='"+this.options.typeTab+"'>"
                }
                if(this.options.typeCol){
                c+="<input type='hidden' name='col' value='"+this.options.typeCol+"'>"
                }
                if(this.options.typeTabParent){
                c+='<input type="hidden" name="tab_parent" value="'+this.options.typeTabParent+'">'
                }
                if(this.options.typeColParent){
                c+='<input type="hidden" name="col_parent" value="'+this.options.typeColParent+'">'
                }
                if(this.options.typeChild){
                c+='<input type="hidden" name="child" value="1">'
                }
                c+="</div><div id='comment_error' style='color: #FF0000; display: none;'></div></div></form>"
            }
            c+='<div style="display: none;" id="confirmcommentdelete"><div style="margin-top: 10px;">'+this.Base.Language.Translate(1026)+'</div><br /><form action="misc_js.php" method="post" target="ajaxframe"><input type="submit" class="button" value="'+this.Base.Language.Translate(175)+'" onClick="parent.TB_remove();"> <input type="button" class="button" value="'+this.Base.Language.Translate(39)+'" onClick="parent.TB_remove();"><input type="hidden" name="task" value="comment_delete"><input type="hidden" name="comment_id" id="del_comment_id" value="0"><input type="hidden" name="type" value="'+this.options.type+'"><input type="hidden" name="iden" value="'+this.options.typeIdentifier+'"><input type="hidden" name="value" value="'+this.options.typeID+'">';
        if(this.options.object_owner&&this.options.object_owner_id){
            c+='<input type="hidden" name="object_owner" value="'+this.options.object_owner+'"><input type="hidden" name="object_owner_id" value="'+this.options.object_owner_id+'">'
            }else{
            c+='<input type="hidden" name="user" value="'+this.Base.Owner.user_info.user_username+'">'
            }
            if(this.options.typeTab){
            c+='<input type="hidden" name="tab" value="'+this.options.typeTab+'">'
            }
            if(this.options.typeCol){
            c+='<input type="hidden" name="col" value="'+this.options.typeCol+'">'
            }
            if(this.options.typeTabParent){
            c+='<input type="hidden" name="tab_parent" value="'+this.options.typeTabParent+'">'
            }
            if(this.options.typeColParent){
            c+='<input type="hidden" name="col_parent" value="'+this.options.typeColParent+'">'
            }
            if(this.options.typeChild){
            c+='<input type="hidden" name="child" value="1">'
            }
            c+="</form></div>";
        var a=$(this.options.type+"_"+this.options.typeID+"_postcomment");
        a.innerHTML=c;
        var b=this;
        if(this.options.canComment){
            a.getElement("form").addEvent("submit",function(d){
                b.checkText(d)
                });
            a.getElement("textarea").addEvent("focus",function(){
                b.removeText(this)
                });
            a.getElement("textarea").addEvent("blur",function(){
                b.addText(this)
                });
            a.getElement("form").addEvent("submit",function(d){
                b.doCommentPost(d)
                })
            }
        },
doCommentPost:function(d){
    var c=new Event(d);
    var a={
        task:"comment_post",
        type:this.options.type,
        iden:this.options.typeIdentifier,
        value:this.options.typeID,
        tab:this.options.typeTab,
        col:this.options.typeCol
        };

    if(this.options.typeTabParent){
        a.tab_parent=this.options.typeTabParent
        }
        if(this.options.typeColParent){
        a.col_parent=this.options.typeColParent
        }
        if(this.options.typeChild){
        a.child=this.options.typeChild
        }
        if(this.options.object_owner&&this.options.object_owner_id){
        a.object_owner=this.options.object_owner;
        a.object_owner_id=this.options.object_owner_id
        }else{
        a.user=this.Base.Owner.user_info.user_username
        }
        if($type(document.comment_post_form.comment_body)){
        a.comment_body=document.comment_post_form.comment_body.value
        }
        if($type(document.comment_post_form.comment_secure)){
        a.comment_secure=document.comment_post_form.comment_secure.value
        }
        var f=this;
    var b=new Request.JSON({
        url:this.options.ajaxURL,
        method:this.options.ajaxMethod,
        secure:this.options.ajaxSecure,
        data:a,
        onComplete:function(e,g){
            f.addComment(e.is_error,e.comment_body,e.comment_date)
            }
        }).send();
    c.stop()
    },
doCommentEdit:function(){
    var a={
        task:"comment_edit",
        type:this.options.type,
        iden:this.options.typeIdentifier,
        value:this.options.typeID,
        user:this.Base.Owner.user_info.user_username
        };

    if($type(document.editCommentForm.comment_id)){
        a.comment_id=document.editCommentForm.comment_id.value
        }
        if($type(document.editCommentForm.comment_edit)){
        a.comment_edit=document.editCommentForm.comment_edit.value
        }
        var c=this;
    var b=new Request.JSON({
        url:this.options.ajaxURL,
        method:this.options.ajaxMethod,
        secure:this.options.ajaxSecure,
        data:a,
        onComplete:function(d,e){
            c.getComments()
            }
        }).send()
    },
doCommentDelete:function(f,b){
    var d=new Event(f);
    var a={
        task:"comment_delete",
        comment_id:b,
        type:this.options.type,
        iden:this.options.typeIdentifier,
        value:this.options.typeID,
        tab:this.options.typeTab,
        col:this.options.typeCol,
        user:this.Base.Owner.user_info.user_username
        };

    if(this.options.typeTabParent){
        a.tab_parent=this.options.typeTabParent
        }
        if(this.options.typeColParent){
        a.col_parent=this.options.typeColParent
        }
        if(this.options.typeChild){
        a.child=this.options.typeChild
        }
        if(this.options.object_owner){
        a.object_owner=this.options.object_owner
        }
        if(this.options.object_owner_id){
        a.object_owner_id=this.options.object_owner_id
        }
        if($type(document.commentDeleteForm.comment_body)){
        a.comment_body=document.commentDeleteForm.comment_body.value
        }
        if($type(document.commentDeleteForm.comment_secure)){
        a.comment_secure=document.commentDeleteForm.comment_secure.value
        }
        var g=this;
    var c=new Request.JSON({
        url:this.options.ajaxURL,
        method:this.options.ajaxMethod,
        secure:this.options.ajaxSecure,
        data:a,
        onComplete:function(e,h){
            g.getComments()
            }
        }).send();
d.stop()
},
getComments:function(e){
    if(e=="next"){
        this.page++
    }else{
        if(e=="previous"){
            this.page--
        }else{
            if($type(e)){
                this.page=e
                }
            }
    }
if(this.options.paginate){
    window.scroll(0,0)
    }else{
    this.options.cpp=this.total
    }
    if(this.options.object_owner&&this.options.object_owner_id){
    var d=this.options.object_owner;
    var a=this.options.object_owner_id;
    var b=""
    }else{
    var d="";
    var a="";
    var b=this.Base.Owner.user_info.user_username
    }
    var f=this;
var c=new Request.JSON({
    url:this.options.ajaxURL,
    method:this.options.ajaxMethod,
    secure:this.options.ajaxSecure,
    data:{
        task:"comment_get",
        user:b,
        object_owner:d,
        object_owner_id:a,
        type:this.options.type,
        iden:this.options.typeIdentifier,
        value:this.options.typeID,
        cpp:this.options.cpp,
        p:this.page
        },
    onComplete:function(g,h){
        f.updateComments(g)
        }
    });
c.send()
},
updateComments:function(b){
    if($type(b)!="object"){
        alert("There was an error processing the request.");
        return false
        }

        if(b.total_comments==0 && document.getElementById('tabcom')){
            document.getElementById('tabcom').style.display='none';
        }

        this.total=parseInt(b.total_comments)||0;
    this.page=b.p;
    var a=b.maxpage;
    var n=b.p_start;
    var m=b.p_end;
    var h=$(this.options.type+"_"+this.options.typeID+"_totalcomments");
    var g=$(this.options.type+"_"+this.options.typeID+"_comments");
    var k=$H(b.comments);
    h.innerHTML=this.total;
    var f=document.createElement("div");
    g.empty();
    var l=this;
    if(l.Base.Core.settings.setting_url){
        var e="?"
        }else{
        var e="&"
        }
        k.each(function(o,q){
        var r=new Element("div",{
            id:"comment_"+q
            });
        var s="<div style='margin-top: 10px; margin-bottom: 20px;'>";
        if(o.comment_authoruser_id&&o.comment_authoruser_exists){
            s+="<div style='float: left; text-align: center; width: 90px;'><a href='"+o.comment_authoruser_url+"'><img src='"+o.comment_authoruser_photo+"' class='photo' width='"+o.comment_authoruser_photo_width+"' border='0'></a></div>"
            }else{
            s+="<div style='float: left; text-align: center; width: 90px;'><img src='./images/nophoto.gif' class='photo' width='75' border='0'></div>"
            }
            s+="<div style='overflow: hidden;'>";
        if(!o.comment_authoruser_id){
            s+="<div class='profile_comment_author'><b>"+l.Base.Language.Translate(835)+"</b></div>"
            }else{
            if(!o.comment_authoruser_exists){
                s+="<div class='profile_comment_author'><b>"+l.Base.Language.Translate(1071)+"</b></div>"
                }else{
                s+="<div class='profile_comment_author'><a href='"+o.comment_authoruser_url+"'><b>"+o.comment_authoruser_displayname+"</b></a></div>"
                }
            }
        s+="<div class='profile_comment_date'>"+o.comment_date+"</div>";
    r.setProperty("html",o.comment_body);
        s+="<div class='profile_comment_body' id='profile_comment_body_"+q+"'>"+o.comment_body+"&nbsp;</div>";
        s+="<div class='profile_comment_links'>";
        var p=new Array();
        if(l.Base.Viewer.user_exists&&o.comment_authoruser_id&&o.comment_authoruser_exists){
        if(l.options.commentLinks.reply&&l.Base.Viewer.user_info.user_id==l.Base.Owner.user_info.user_id&&l.Base.Viewer.user_info.user_id!=o.comment_authoruser_id){
            p.push("<a href='profile.php?user="+o.comment_authoruser_username+"&v=comments'>"+l.Base.Language.Translate(787)+"</a>")
            }
            if(l.options.commentLinks.walltowall&&o.comment_authoruser_id!=l.Base.Owner.user_info.user_id&&o.comment_authoruser_private==false){
            p.push("<a href=\"javascript:TB_show('"+l.Base.Language.Translate(1032)+"', 'profile_comments.php?user="+l.Base.Owner.user_info.user_username+"&user2="+o.comment_authoruser_username+"&TB_iframe=true&height=450&width=550', '', './images/trans.gif');\">"+l.Base.Language.Translate(891)+"</a>")
            }
            if(o.comment_authoruser_id!=l.Base.Viewer.user_info.user_id){
            p.push("<a href=\"javascript:TB_show('"+l.Base.Language.Translate(784)+"', 'user_messages_new.php?to_user="+o.comment_authoruser_displayname+"&to_id="+o.comment_authoruser_username+"&TB_iframe=true&height=400&width=450', '', './images/trans.gif');\">"+l.Base.Language.Translate(834)+"</a>")
            }
            if(o.comment_authoruser_id==l.Base.Viewer.user_info.user_id){
            p.push('<a class="commentEditLink" href="javascript:void(0);" id=\'comment_edit_link_'+q+"'>"+l.Base.Language.Translate(187)+"</a>")
            }
        }
    if((o.comment_authoruser_exists&&o.comment_authoruser_id==l.Base.Viewer.user_info.user_id)||(l.Base.Viewer.user_exists&&l.Base.Viewer.user_info.user_id==l.Base.Owner.user_info.user_id)){
        p.push('<a class="commentDeleteLink" href="javascript:void(0);" id=\'comment_delete_link_'+q+"'>"+l.Base.Language.Translate(155)+"</a>")
        }
        s+=p.join("&nbsp;-&nbsp;");
    s+="&nbsp;</div></div></div>";
    r.setProperty("html",s);
    r.inject(g);
    if(r.getElement(".commentEditLink")){
        r.getElement(".commentEditLink").addEvent("click",function(){
            l.editComment(q)
            })
        }
        if(r.getElement(".commentDeleteLink")){
        r.getElement(".commentDeleteLink").addEvent("click",function(){
            l.confirmDelete(q)
            })
        }
    });
if(this.options.paginate&&this.total>this.options.cpp){
    var i=new Element("div",{
        styles:{
            "text-align":"center"
        }
    });
var j=new Element("div",{
    styles:{
        "text-align":"center"
    }
});
if(this.page>1){
    var d="<a href='javascript:void(0);' id='comment_last_page_top'>&#171; "+l.Base.Language.Translate(182)+"</a>";
    var c="<a href='javascript:void(0);' id='comment_last_page_bottom'>&#171; "+l.Base.Language.Translate(182)+"</a>"
    }else{
    var d="<font class='disabled'>&#171; "+l.Base.Language.Translate(182)+"</font>";
    var c="<font class='disabled'>&#171; "+l.Base.Language.Translate(182)+"</font>"
    }
    if(n==m){
    d+="&nbsp;|&nbsp; "+this.Base.Language.TranslateFormatted(184,[n,this.total])+"&nbsp;|&nbsp;";
    c+="&nbsp;|&nbsp; "+this.Base.Language.TranslateFormatted(184,[n,this.total])+"&nbsp;|&nbsp;"
    }else{
    d+="&nbsp;|&nbsp; "+this.Base.Language.TranslateFormatted(185,[n,m,this.total])+"&nbsp;|&nbsp;";
    c+="&nbsp;|&nbsp; "+this.Base.Language.TranslateFormatted(185,[n,m,this.total])+"&nbsp;|&nbsp;"
    }
    if(this.page!=a){
    d+="<a href='javascript:void(0);' id='comment_next_page_top'>"+l.Base.Language.Translate(183)+" &#187;</a>";
    c+="<a href='javascript:void(0);' id='comment_next_page_bottom'>"+l.Base.Language.Translate(183)+" &#187;</a>"
    }else{
    d+="<font class='disabled'>"+l.Base.Language.Translate(183)+" &#187;</font>";
    c+="<font class='disabled'>"+l.Base.Language.Translate(183)+" &#187;</font>"
    }
    i.setProperty("html",d);
j.setProperty("html",c);
i.inject(g,"top");
j.inject(g);
if(i.getElement("a[id=comment_last_page_top]")){
    i.getElement("a[id=comment_last_page_top]").addEvent("click",function(){
        l.getComments("previous")
        })
    }
    if(j.getElement("a[id=comment_last_page_bottom]")){
    j.getElement("a[id=comment_last_page_bottom]").addEvent("click",function(){
        l.getComments("previous")
        })
    }
    if(i.getElement("a[id=comment_next_page_top]")){
    i.getElement("a[id=comment_next_page_top]").addEvent("click",function(){
        l.getComments("next")
        })
    }
    if(j.getElement("a[id=comment_next_page_bottom]")){
    j.getElement("a[id=comment_next_page_bottom]").addEvent("click",function(){
        l.getComments("next")
        })
    }
}
},
addComment:function(c,a,b){
    if(!this.options.canComment){
        return false
        }
        if(c){
        $("comment_error").style.display="block";
        if(!a.trim()){
            this.addText($("comment_body"));
            $("comment_error").innerHTML=this.Base.Language.Translate(831)
            }else{
            $("comment_error").innerHTML=this.Base.Language.Translate(832)
            }
            $("comment_submit").value=this.Base.Language.Translate(833);
        $("comment_submit").disabled=false
        }else{
        $("comment_error").style.display="none";
        $("comment_error").innerHTML="";
        $("comment_body").value="";
        $("comment_body").style.height=this.options.originalHeight+"px";
        this.addText($("comment_body"));
        $("comment_submit").value=this.Base.Language.Translate(833);
        $("comment_submit").disabled=false;
        if($("comment_secure")){
            $("comment_secure").value="";
            $("secure_image").src=$("secure_image").src+"?"+(new Date()).getTime()
            }
            this.page=1;
        this.total++;
        this.getComments()
        }
    },
editComment:function(c){
    var f=this;
    if(this.isEditing){
        return false
        }
        this.isEditing=true;
    var b=$("profile_comment_body_"+c);
    var a=b.offsetHeight+10;
    var d=b.innerHTML.replace(/<br>/gi,"\r\n").replace(/>/gi,"&gt;");
    var e="";
    e+="<form action='misc_js.php' method='post' target='ajaxframe' name='editCommentForm'>";
    e+="<textarea name='comment_edit' id='comment_edit_"+c+"' style='height: "+a+" px; width: 100%;'>"+d+"</textarea>";
    e+="<input type='hidden' name='task' value='comment_edit'>";
    e+="<input type='hidden' name='comment_id' value='"+c+"'>";
    e+="<input type='hidden' name='type' value='"+this.options.type+"'>";
    e+="<input type='hidden' name='iden' value='"+this.options.typeIdentifier+"'>";
    e+="<input type='hidden' name='value' value='"+this.options.typeID+"'>";
    if(this.options.typeTab){
        e+='<input type="hidden" name="tab" value="'+this.options.typeTab+'">'
        }
        if(this.options.typeCol){
        e+='<input type="hidden" name="col" value="'+this.options.typeCol+'">'
        }
        if(this.options.typeTabParent){
        e+='<input type="hidden" name="tab_parent" value="'+this.options.typeTabParent+'">'
        }
        if(this.options.typeColParent){
        e+='<input type="hidden" name="col_parent" value="'+this.options.typeColParent+'">'
        }
        if(this.options.typeChild){
        e+='<input type="hidden" name="child" value="1">'
        }
        e+="</form>";
    b.innerHTML=e;
    textarea_autogrow("comment_edit_"+c);
    $("comment_edit_"+c).focus();
    $("comment_edit_"+c).addEvent("blur",function(){
        f.doCommentEdit();
        f.isEditing=false
        })
    },
confirmDelete:function(a){
    $("del_comment_id").value=a;
    TB_show(this.Base.Language.Translate(1025),"#TB_inline?height=100&width=300&inlineId=confirmcommentdelete","","../images/trans.gif");
    var b=this;
    $("TB_window").getElement("form").name="commentDeleteForm";
    $("TB_window").getElement("form").addEvent("submit",function(c){
        b.doCommentDelete(c,a)
        })
    },
removeText:function(a){
    if(!this.changed){
        a.value="";
        a.style.color="#000000";
        this.changed=true
        }
    },
addText:function(a){
    if(!a.value.trim()){
        a.value=this.Base.Language.Translate(829);
        a.style.color="#888888";
        this.changed=false
        }
    },
checkText:function(a){
    if(!this.changed){
        $("comment_body").value=""
        }
        $("comment_submit").value=this.Base.Language.Translate(830);
    $("comment_submit").disabled=true
    }
});
SocialEngineAPI.Tags=new Class({
    Implements:[Options],
    Base:{},
    isTagging:false,
    newtag:false,
    tags:[],
    options:{
        ajaxURL:"misc_js.php",
        ajaxMethod:"post",
        ajaxSecure:false,
        canTag:false,
        type:false,
        media_id:false,
        media_dir:false,
        object_owner:false,
        object_owner_id:false
    },
    initialize:function(a){
        this.setOptions(a);
        if(this.options.initialTotal){
            this.total=this.options.initialTotal
            }
            var b=this;
        window.addEvent("domready",function(){
            b.showTagForm()
            })
        },
    showTagForm:function(){
        var e="";
        var d=this;
        if(this.options.canTag){
            e+="<div class='media_photo_tagform_titlebar'><img src='images/icons/photos16.gif' class='icon' />"+this.Base.Language.Translate(1212)+"</div><div style='padding: 7px;'><div style='text-align: left;'><div style='font-size: 7pt; margin-bottom: 5px;'>"+this.Base.Language.Translate(1213)+"</div><div style='text-align: center;'><input type='text' style='width: 130px; padding-left: 4px; font-size: 8pt;' name='media_photo_tag' id='media_photo_tag' class='text' maxlength='40'/></div></div><div id='media_photo_friendlist' class='media_photo_friendlist'>";
            if(d.Base.Viewer.user_exists){
                e+="<div><a href='javascript:void(0)' id='tag_me'>"+d.Base.Viewer.user_displayname+d.Base.Language.Translate(1214)+"</a></div>"
                }
                e+="</div><div><input type='button' class='button' name='save' id='tag_save' value='"+d.Base.Language.Translate(1215)+"' />&nbsp;&nbsp;<input type='button' class='button' id='tag_cancel' name='cancel' value='"+d.Base.Language.Translate(39)+"' /></div></div>";
            var a=new Element("div",{
                id:"media_photo_tagform",
                "class":"media_photo_tagform",
                html:e
            });
            var c=$("media_photo_div");
            a.inject(c);
            if(a.getElement("input[id=tag_cancel]")){
                a.getElement("input[id=tag_cancel]").addEvent("click",function(){
                    d.cancelTag()
                    })
                }
                if(a.getElement("input[id=tag_save]")){
                a.getElement("input[id=tag_save]").addEvent("click",function(){
                    d.saveTag(0)
                    })
                }
                if(a.getElement("a[id=tag_me]")){
                a.getElement("a[id=tag_me]").addEvent("click",function(){
                    d.saveTag(d.Base.Viewer.user_info.user_id)
                    })
                }
                var b=new Request.JSON({
                url:"misc_js.php?task=friends_all",
                secure:this.options.ajaxSecure,
                onComplete:function(f){
                    d.addFriendToList(f.friends)
                    }
                }).send()
        }
    },
addFriendToList:function(a){
    var b=this;
    a.each(function(f){
        for(var c in f){
            var e=new Element("div",{
                id:"friend_div_"+c
                });
            var d=new Element("a",{
                href:"javascript:void(0)",
                id:"friend_link_"+c,
                html:f[c]
                }).inject(e);
            e.inject($("media_photo_friendlist"));
            $("friend_link_"+c).addEvent("click",function(){
                b.saveTag(c)
                })
            }
        })
},
insertTag:function(a,l,m,j,h,k,i,c){
    var f="";
    var g=this;
    if($("media_tags").style.display=="none"){
        $("media_tags").style.display="block"
        }else{
        if(g.tags.length!=0){
            f='<span id="tag_comma_'+a+'">, </span>'
            }
        }
    var d=new Element("span",{
    id:"full_tag_"+a,
    html:f
});
if(l!=""){
    var e=new Element("a",{
        href:l,
        id:"tag_link_"+a,
        html:m
    }).inject(d)
    }else{
    var e=new Element("span",{
        id:"tag_link_"+a,
        html:m,
        styles:{
            cursor:"pointer"
        }
    }).inject(d)
}
if(g.Base.Viewer.user_exists&&(g.Base.Viewer.user_info.user_username==c||g.Base.Viewer.user_info.user_username==g.Base.Owner.user_info.user_username)){
    var b=$(d).get("html");
    $(d).set("html",b," (<a href='javascript:void(0);' id='new_removetag_link'>"+g.Base.Language.Translate(1228)+"</a>)")
    }
    d.inject($("media_tags"));
g.createTag(a,m,j,h,k,i);
$("tag_link_"+a).addEvent("mouseover",function(){
    g.showTag(a)
    });
$("tag_link_"+a).addEvent("mouseout",function(){
    g.hideTag(a)
    });
if($("new_removetag_link")){
    $("new_removetag_link").addEvent("click",function(){
        g.removeTag(a)
        });
    $("new_removetag_link").set("id","removetag_link_"+a)
    }
    g.tags.push(a)
},
createTag:function(f,d,c,b,e,a){
    var g=this;
    new Element("div",{
        id:"tag_"+f,
        html:'<img src="./images/trans.gif" width="100%" height="100%" />',
        "class":"tag_div_hidden",
        styles:{
            width:(parseInt(e)-4)+"px",
            height:(parseInt(a)-4)+"px",
            top:c+"px",
            left:b+"px"
            }
        }).inject($("media_photo_div"));
new Element("div",{
    id:"tag_label_"+f,
    html:d,
    "class":"tag_label",
    styles:{
        display:"none",
        top:(parseInt(c)+parseInt(a)+10)+"px",
        left:b+"px"
        }
    }).inject($("media_photo_div"));
$("tag_"+f).addEvent("mouseover",function(){
    g.showTag(f)
    });
$("tag_"+f).addEvent("mouseout",function(){
    g.hideTag(f)
    })
},
showTag:function(a){
    $("tag_"+a).className="tag_div";
    $("tag_label_"+a).style.display="block"
    },
hideTag:function(a){
    $("tag_"+a).className="tag_div_hidden";
    $("tag_label_"+a).style.display="none"
    },
addTag:function(){
    if(!this.isTagging){
        this.isTagging=true;
        this.newtag=new MooCrop("media_photo");
        var b=this;
        var a=$("media_photo_tagform").inject(b.newtag.wrapper);
        a.setStyles({
            top:this.newtag.crop.bottom+10,
            left:this.newtag.crop.right+10,
            display:"block"
        });
        this.newtag.addEvent("onBegin",function(f,e,d,c){
            a.setStyle("display","none")
            });
        this.newtag.addEvent("onCrop",function(f,e,d,c){
            a.setStyles({
                top:e.bottom+10,
                left:e.right+10,
                display:"none"
            })
            });
        this.newtag.addEvent("onComplete",function(f,e,d,c){
            a.setStyle("display","block")
            })
        }
    },
cancelTag:function(){
    if(this.isTagging){
        $("media_photo_tag").value="";
        $("media_photo_tagform").inject("media_photo_div").setStyle("display","none");
        var a=this.newtag.removeOverlay.bind(this.newtag);
        a();
        this.isTagging=false
        }
    },
saveTag:function(d){
    if(this.isTagging){
        if(this.options.object_owner&&this.options.object_owner_id){
            var f=this.options.object_owner;
            var b=this.options.object_owner_id;
            var c=""
            }else{
            var f="";
            var b="";
            var c=this.Base.Owner.user_info.user_username
            }
            var g=this;
        var e=new Request.JSON({
            url:this.options.ajaxURL,
            method:this.options.ajaxMethod,
            secure:this.options.ajaxSecure,
            data:{
                task:"tag_do",
                ajax:true,
                mediatag_user_id:d,
                mediatag_text:$("media_photo_tag").value,
                mediatag_x:this.newtag.crop.top,
                mediatag_y:this.newtag.crop.left,
                mediatag_height:this.newtag.crop.height,
                mediatag_width:this.newtag.crop.width,
                user:c,
                object_owner:f,
                object_owner_id:b,
                type:this.options.type,
                media_id:this.options.media_id,
                media_dir:this.options.media_dir
                },
            onComplete:function(h){
                if($type(h.mediatag_id)){
                    g.insertTag(h.mediatag_id,h.mediatag_link,h.mediatag_text,h.mediatag_x,h.mediatag_y,h.mediatag_width,h.mediatag_height,h.mediatag_user_username)
                    }
                }
        }).send();
$("media_photo_tag").value="";
$("media_photo_tagform").inject("media_photo_div").setStyle("display","none");
var a=this.newtag.removeOverlay.bind(this.newtag);
a();
this.isTagging=false
}
},
removeTag:function(e){
    if(this.options.object_owner&&this.options.object_owner_id){
        var d=this.options.object_owner;
        var a=this.options.object_owner_id;
        var b=""
        }else{
        var d="";
        var a="";
        var b=this.Base.Owner.user_info.user_username
        }
        var f=this;
    var c=new Request.JSON({
        url:this.options.ajaxURL,
        method:this.options.ajaxMethod,
        secure:this.options.ajaxSecure,
        data:{
            task:"tag_remove",
            ajax:true,
            mediatag_id:e,
            user:b,
            object_owner:d,
            object_owner_id:a,
            type:this.options.type,
            media_id:this.options.media_id
            }
        }).send();
$("tag_"+e).destroy();
$("tag_label_"+e).destroy();
$("full_tag_"+e).destroy();
if(this.tags.indexOf(e)==0&&$("tag_comma_"+this.tags[1])){
    $("tag_comma_"+this.tags[1]).destroy()
    }
    this.tags.splice(this.tags.indexOf(e),1);
if(this.tags.length==0){
    $("media_tags").style.display="none"
    }
}
});
var MooCrop=new Class({
    calculateHandles:true,
    current:{},
    options:{
        maskColor:"black",
        maskOpacity:".3",
        handleColor:"#FFFFFF",
        handleWidth:"5px",
        handleHeight:"5px",
        cropBorder:"1px dashed #FFFFFF",
        min:{
            width:50,
            height:50
        },
        showMask:true,
        showHandles:false
    },
    initialize:function(b,a){
        this.setOptions(a);
        this.img=$(b);
        if(this.img.get("tag")!="img"){
            return false
            }
            this.resizeFunc=this.refresh.bindWithEvent(this);
        this.removeFunc=this.removeListener.bind(this);
        this.buildOverlay();
        this.setup()
        },
    setup:function(){
        $(this.cropArea).setStyles({
            width:this.options.min.width,
            height:this.options.min.height,
            top:(this.img.height-this.options.min.height)/2,
            left:(this.img.width-this.options.min.width)/2
            });
        this.current.crop=this.crop=this.getCropArea();
        this.handleWidthOffset=this.options.handleWidth.toInt()/2;
        this.handleHeightOffset=this.options.handleHeight.toInt()/2;
        this.fixBoxModel();
        this.drawMasks();
        this.positionHandles()
        },
    getCropArea:function(){
        var a=this.cropArea.getCoordinates();
        a.left-=this.offsets.x;
        a.right-=this.offsets.x;
        a.top-=this.offsets.y;
        a.bottom-=this.offsets.y;
        return a
        },
    fixBoxModel:function(){
        var c=this.boxDiff=(this.crop.width-this.options.min.width)/2;
        var a=this.bounds={
            top:c,
            left:c,
            right:this.img.width+(c*2),
            bottom:this.img.height+(c*2),
            width:this.options.min.width+(c*2),
            height:this.options.min.height+(c*2)
            };

        this.wrapper.setStyles({
            width:a.right,
            height:a.bottom,
            background:"url("+this.img.src+") no-repeat "+c+"px "+c+"px"
            });
        this.north.setStyle("width",a.right);
        this.south.setStyle("width",a.right)
        },
    activate:function(a,b){
        a.stop();
        this.current={
            x:a.page.x,
            y:a.page.y,
            handle:b,
            crop:this.current.crop
            };

        if(this.current.handle=="NESW"&&!this.options.showHandles){
            this.hideHandles()
            }
            this.fireEvent("onBegin",[this.img.src,this.getCropInfo(),this.bounds,b]);
        document.addEvent("mousemove",this.resizeFunc);
        document.addEvent("mouseup",this.removeFunc)
        },
    removeListener:function(){
        if(this.current.handle=="NESW"&&!this.options.showHandles){
            this.showHandles()
            }
            document.removeEvent("mousemove",this.resizeFunc);
        document.removeEvent("mouseup",this.removeFunc);
        this.crop=this.current.crop;
        this.fireEvent("onComplete",[this.img.src,this.getCropInfo(),this.bounds,this.current.handle])
        },
    refresh:function(a){
        var e=this.current.x-a.page.x;
        var d=this.current.y-a.page.y;
        var i=this.bounds;
        var h=this.crop;
        var f=this.current.handle;
        var k={};

        var j=(f.length>2)?true:false;
        if(f.contains("S")){
            if(h.bottom-d>i.bottom){
                d=h.bottom-i.bottom
                }
                if(!j){
                if((h.height-d)<i.height){
                    d=h.height-i.height
                    }
                    k.height=h.height-d
                }
            }
        if(f.contains("N")){
        if(h.top-d<i.top){
            d=h.top
            }
            if(!j){
            if((h.height+d)<i.height){
                d=i.height-h.height
                }
                k.height=h.height+d
            }
            k.top=h.top-d
        }
        if(f.contains("E")){
        if(h.right-e>i.right){
            e=h.right-i.right
            }
            if(!j){
            if((h.width-e)<i.width){
                e=h.width-i.width
                }
                k.width=h.width-e
            }
        }
    if(f.contains("W")){
    if(h.left-e<i.left){
        e=h.left
        }
        if(!j){
        if((h.width+e)<i.width){
            e=i.width-h.width
            }
            k.width=h.width+e
        }
        k.left=h.left-e
    }
    var g=$merge(k);
    if($defined(k.width)){
    k.width-=this.boxDiff*2
    }
    if($defined(k.height)){
    k.height-=this.boxDiff*2
    }
    this.cropArea.setStyles(k);
    this.getCurrentCoords(g);
    this.drawMasks();
    this.positionHandles();
    this.fireEvent("onCrop",[this.img.src,this.getCropInfo(),i,f])
    },
getCurrentCoords:function(b){
    var a=$merge(this.crop);
    if($defined(b.left)){
        a.left=b.left;
        if($defined(b.width)){
            a.width=b.width
            }else{
            a.right=a.left+a.width
            }
        }
    if($defined(b.top)){
    a.top=b.top;
    if($defined(b.height)){
        a.height=b.height
        }else{
        a.bottom=a.top+a.height
        }
    }
if($defined(b.width)&&!$defined(b.left)){
    a.width=b.width;
    a.right=a.left+a.width
    }
    if($defined(b.height)&&!$defined(b.top)){
    a.height=b.height;
    a.bottom=a.top+a.height
    }
    this.current.crop=a
},
drawMasks:function(){
    if(!this.options.showMask){
        return
    }
    var a=this.bounds;
    var e=this.current.crop;
    var d=this.current.handle;
    this.north.setStyle("height",e.top+"px");
    this.south.setStyle("height",a.bottom-e.bottom+"px");
    this.east.setStyles({
        height:e.height+"px",
        width:a.right-e.right+"px",
        top:e.top+"px",
        left:e.right+"px"
        });
    this.west.setStyles({
        height:e.height+"px",
        width:e.left+"px",
        top:e.top+"px"
        })
    },
positionHandles:function(){
    if(!this.calculateHandles){
        return
    }
    var d=this.current.crop;
    var a=this.handleWidthOffset;
    var b=this.handleHeightOffset;
    this.handles.get("N").setStyles({
        left:d.width/2-a+"px",
        top:-b+"px"
        });
    this.handles.get("NE").setStyles({
        left:d.width-a+"px",
        top:-b+"px"
        });
    this.handles.get("E").setStyles({
        left:d.width-a+"px",
        top:d.height/2-b+"px"
        });
    this.handles.get("SE").setStyles({
        left:d.width-a+"px",
        top:d.height-b+"px"
        });
    this.handles.get("S").setStyles({
        left:d.width/2-a+"px",
        top:d.height-b+"px"
        });
    this.handles.get("SW").setStyles({
        left:-a+"px",
        top:d.height-b+"px"
        });
    this.handles.get("W").setStyles({
        left:-a+"px",
        top:d.height/2-b+"px"
        });
    this.handles.get("NW").setStyles({
        left:-a+"px",
        top:-b+"px"
        })
    },
hideHandles:function(){
    this.calculateHandles=false;
    this.handles.each(function(a){
        a.setStyle("display","none")
        })
    },
showHandles:function(){
    this.calculateHandles=true;
    this.positionHandles();
    this.handles.each(function(a){
        a.setStyle("display","block")
        })
    },
buildOverlay:function(){
    var b=this.options;
    this.wrapper=new Element("div",{
        styles:{
            "z-index":100,
            position:"relative",
            width:this.img.width,
            height:this.img.height,
            background:"url("+this.img.src+") no-repeat",
            "float":this.img.getStyle("float"),
            "margin-left":"auto",
            "margin-right":"auto"
        }
    }).injectBefore(this.img);
this.img.setStyle("display","none");
this.offsets={
    x:this.wrapper.getLeft(),
    y:this.wrapper.getTop()
    };

this.wrapper.addEvent("mouseover",function(c){
    return false
    });
if(this.options.showMask){
    var a={
        position:"absolute",
        overflow:"hidden",
        "background-color":b.maskColor,
        opacity:b.maskOpacity
        };

    this.north=new Element("div",{
        styles:$merge(a,{
            left:"0px"
        })
        }).injectInside(this.wrapper);
    this.south=new Element("div",{
        styles:$merge(a,{
            bottom:"0px",
            left:"0px"
        })
        }).injectInside(this.wrapper);
    this.east=new Element("div",{
        styles:a
    }).injectInside(this.wrapper);
    this.west=new Element("div",{
        styles:$merge(a,{
            left:"0px"
        })
        }).injectInside(this.wrapper)
    }
    this.cropArea=new Element("div",{
    styles:{
        position:"absolute",
        top:"0px",
        left:"0px",
        border:b.cropBorder,
        cursor:"move"
    },
    events:{
        dblclick:function(){
            this.fireEvent("onDblClk",[this.img.src,this.getCropInfo(),this.bounds])
            }.bind(this),
        mousedown:this.activate.bindWithEvent(this,"NESW")
        }
    }).injectInside(this.wrapper);
this.handles=new Hash();
["N","NE","E","SE","S","SW","W","NW"].each(function(c){
    this.handles.set(c,new Element("div",{
        styles:{
            position:"absolute",
            "background-color":b.handleColor,
            width:b.handleWidth,
            height:b.handleHeight,
            overflow:"hidden",
            cursor:(c.toLowerCase()+"-resize")
            },
        events:{
            mousedown:this.activate.bindWithEvent(this,c)
            }
        }).injectInside(this.cropArea))
},this)
},
getCropInfo:function(){
    var a=$merge(this.current.crop);
    a.width-=this.boxDiff*2;
    a.height-=this.boxDiff*2;
    return a
    },
removeOverlay:function(){
    this.wrapper.destroy();
    this.img.setStyle("display","")
    }
});
MooCrop.implement(new Events,new Options);
SocialEngineAPI.User=new Class({
    Base:{},
    user_exists:false,
    user_displayname:false,
    user_displayname_short:false,
    user_info:{},
    profile_info:{},
    level_info:{},
    usersetting_info:{},
    options:{
        ajaxURL:"misc_js.php",
        ajaxMethod:"post",
        ajaxSecure:false,
        displayname_order:"standard"
    },
    user_status:"",
    user_notify_cookie:{},
    user_notify_count:0,
    initialize:function(){},
    userPhotoFullPath:function(){
        if(!this.Base.URL){
            return false
            }
            if(!this.user_info.user_photo){
            return this.Base.URL.url_base+"images/nophoto.gif"
            }
            return this.Base.URL.url_base+this.Base.URL.url_userdir(this.user_info.user_id)+this.user_info.user_photo
        },
    userStatusChange:function(){
        if(!$("ajax_status")){
            return false
            }
            var b=this.user_status.replace(/<wbr>/g,"").replace(/&shy;/g,"");
        var a=this.user_displayname_short+" <input type='text' class='text_small' name='status_new' id='status_new' maxlength='100' value='";
        a+=(b==""?this.Base.Language.Translate(744):b);
        a+="' size='10' style='width: 140px; margin: 2px 0px 2px 0px;' onkeypress='return ( (new Event(event)).key==\"enter\" ? SocialEngine.Viewer.userStatusChangeSubmit() : true );'><br /><a href='javascript:void(0);' onclick='SocialEngine.Viewer.userStatusChangeSubmit(); return false;'>"+this.Base.Language.Translate(746)+"</a> | <a href='javascript:void(0);' onclick='SocialEngine.Viewer.userStatusChangeReturn(); return false;'>"+this.Base.Language.Translate(747)+"</a>";
        $("ajax_status").innerHTML=a;
        $("status_new").focus();
        $("status_new").select()
        },
    userStatusChangeReturn:function(){
        if(!$("ajax_status")){
            return false
            }
            if(this.user_status==""){
            $("ajax_status").innerHTML="<a href='javascript:void(0);' onclick='SocialEngine.Viewer.userStatusChange(); return false;'>"+this.Base.Language.Translate(743)+"</a>"
            }else{
            $("ajax_status").innerHTML="<div id='ajax_status'>"+this.user_displayname_short+" <span id='ajax_currentstatus_value'>"+this.user_status+"</span><br /><div style='padding-top: 5px;'><div style='float: left; padding-right: 5px;'>[ <a href='javascript:void(0);' onClick='SocialEngine.Viewer.userStatusChange(); return false;'>"+this.Base.Language.Translate(745)+"</a> ]</div><div class='home_updated'><span id='ajax_currentstatus_date'>"+this.Base.Language.Translate(1113)+" "+this.Base.Language.TranslateFormatted(773,[1])+"</span></div><div style='clear: both; height: 0px;'></div></div></div>"
            }
        },
userStatusChangeSubmit:function(){
    if(!$("ajax_status")){
        return false
        }
        var b=this;
    var a=new Request.JSON({
        url:this.options.ajaxURL,
        method:this.options.ajaxMethod,
        secure:this.options.ajaxSecure,
        data:{
            task:"status_change",
            status:$("status_new").value
            },
        onComplete:function(c,d){
            b.user_status=c.status;
            b.userStatusChangeReturn()
            }
        }).send()
    },
userDelete:function(){
    TB_show(this.Base.Language.Translate(759),"#TB_inline?height=100&width=300&inlineId=confirmdelete","","../images/trans.gif")
    },
userDeleteConfirm:function(b){
    var c=this;
    var a=new Request.JSON({
        url:"user_account_delete.php",
        method:this.options.ajaxMethod,
        secure:this.options.ajaxSecure,
        data:{
            task:"dodelete",
            token:b
        },
        onComplete:function(d,e){
            window.location="home.php"
            }
        }).send()
    },
userActionDelete:function(a){
    var c=this;
    var b=new Request.JSON({
        url:this.options.ajaxURL,
        method:this.options.ajaxMethod,
        secure:this.options.ajaxSecure,
        data:{
            task:"action_delete",
            action_id:a
        },
        onComplete:function(d,e){
            if($("action_"+a)){
                $("action_"+a).style.display="none";
                total_actions--;
                if(total_actions==0){
                    $("actions").style.display="none"
                    }
                }
        }
    }).send()
},
userNotifyShow:function(){
    this.user_notify_cookie=new Hash.Cookie("se_show_newupdates",{
        duration:3600
    });
    var a=parseInt(this.user_notify_cookie.get("total"));
    if(!$type(a)){
        a=0
        }
        if(a<this.user_notify_count){
        this.user_notify_cookie.set("total",0);
        $("newupdates").style.display="block";
        $("newupdates").fade("in")
        }
    },
userNotifyPopup:function(){
    TB_show(this.Base.Language.Translate(1198),"#TB_inline?height=150&width=300&inlineId=newupdates_popup","","./images/trans.gif")
    },
userNotifyUpdate:function(){
    var b=this;
    var a=new Request.JSON({
        url:this.options.ajaxURL,
        method:this.options.ajaxMethod,
        secure:this.options.ajaxSecure,
        data:{
            task:"notify_get"
        },
        onComplete:function(c,d){
            b.userNotifyGenerate(c);
            b.userNotifyShow()
            }
        }).send()
},
userNotifyGenerate:function(a){
    if(!$type(a.notifys)||a.notifys.length==0||!$("newupdates_popup")){
        $("notify_total").innerHTML=this.user_notify_count=0;
        return
    }
    $("notify_total").innerHTML=this.user_notify_count=a.total;
    var b="<div style='margin-top: 10px;'>"+this.Base.Language.TranslateFormatted(1199,["<span id='notifyscount'>"+a.total_grouped+"</span>"])+"</div>";
    a.notifys.each(function(c){
        b+="<div style='font-weight: bold; padding-top: 5px;' id='notify_"+c.notifytype_id+"_"+c.notify_grouped+"'><a href='javascript:void(0);' onClick=\"SocialEngine.Viewer.userNotifyDelete('"+c.notifytype_id+"', '"+c.notify_grouped+"');\">X</a><img src='./images/icons/"+c.notify_icon+"' border='0' style='border: none; margin: 0px 5px 0px 5px; display: inline; vertical-align: middle;' class='icon' /><a href='"+c.notify_url+"'>"+c.notify_text_output+"</a></div>"
        });
    $("newupdates_popup").innerHTML=b
    },
userNotifyDelete:function(a,c){
    var d=this;
    var b=new Request.JSON({
        url:this.options.ajaxURL,
        method:this.options.ajaxMethod,
        secure:this.options.ajaxSecure,
        data:{
            task:"notify_delete",
            notifytype_id:a,
            notify_grouped:c
        },
        onComplete:function(e,f){
            $("TB_window").getElements("div[id=notify_"+a+"_"+c+"]").each(function(g){
                if(g.id=="notify_"+a+"_"+c){
                    g.style.display="none";
                    d.user_notify_count--
                }
            });
        $("newupdates_popup").getElements("div[id=notify_"+a+"_"+c+"]").each(function(g){
            if(g.id=="notify_"+a+"_"+c){
                g.style.display="none"
                }
            });
    $("notify_total").innerHTML=d.user_notify_count;
        $("TB_window").getElements("span[id=notifyscount]").each(function(g){
        if(g.id=="notifyscount"){
            g.innerHTML=d.user_notify_count
            }
        });
    if(d.user_notify_count==0){
        TB_remove();
        $("newupdates").style.display="none"
        }
    }
}).send()
},
userNotifyHide:function(){
    $("newupdates").fade("out");
    this.user_notify_cookie.set("total",this.user_notify_count)
    },
userPhotoRemove:function(){
    var b=this;
    var a=new Request.JSON({
        url:"user_editprofile_photo.php",
        method:this.options.ajaxMethod,
        secure:this.options.ajaxSecure,
        data:{
            task:"remove"
        }
    }).send();
if($("userEditRemovePhotoLink")&&$("userEditPhotoImg")){
    $("userEditRemovePhotoLink").destroy();
    $("userEditPhotoImg").src="images/nophoto.gif"
    }else{
    window.location.reload(false)
    }
},
ImportUserInfo:function(a){
    if(!a||$type(a)!="object"||!a.user_exists){
        this.user_exists=false;
        return
    }
    this.user_exists=true;
    a.user_id=parseInt(a.user_id);
    delete a.user_exists;
    this.user_info=a;
    this.user_info.user_fname=this.user_info.user_fname.trim();
    this.user_info.user_lname=this.user_info.user_lname.trim();
    if(this.user_info.user_fname&&this.user_info.user_lname){
        if(this.options.displayname_order=="asian"){
            this.user_displayname_short=this.user_info.user_lname;
            this.user_displayname=this.user_info.user_lname+" "+this.user_info.user_fname
            }else{
            this.user_displayname_short=this.user_info.user_fname;
            this.user_displayname=this.user_info.user_fname+" "+this.user_info.user_lname
            }
        }else{
    if(this.user_info.user_fname){
        this.user_displayname=this.user_displayname_short=this.user_info.user_fname
        }else{
        if(this.user_info.user_lname){
            this.user_displayname=this.user_displayname_short=this.user_info.user_lname
            }else{
            if(this.user_info.user_username){
                this.user_displayname=this.user_displayname_short=this.user_info.user_username
                }
            }
    }
}
}
});