(function(a){
    a.fn.extend({
        autocomplete:function(b,c){
            var d=typeof b=="string";
            c=a.extend({},a.Autocompleter.defaults,{
                url:d?b:null,
                data:d?null:b,
                delay:d?a.Autocompleter.defaults.delay:10,
                max:c&&!c.scroll?10:150
                },c);
            c.highlight=c.highlight||function(e){
                return e
                };

            c.formatMatch=c.formatMatch||c.formatItem;
            return this.each(function(){
                new a.Autocompleter(this,c)
                })
            },
        result:function(b){
            return this.bind("result",b)
            },
        search:function(b){
            return this.trigger("search",[b])
            },
        flushCache:function(){
            return this.trigger("flushCache")
            },
        setOptions:function(b){
            return this.trigger("setOptions",[b])
            },
        unautocomplete:function(){
            return this.trigger("unautocomplete")
            }
        });
a.Autocompleter=function(l,g){
    var c={
        UP:38,
        DOWN:40,
        DEL:46,
        TAB:9,
        RETURN:13,
        ESC:27,
        COMMA:188,
        PAGEUP:33,
        PAGEDOWN:34,
        BACKSPACE:8
    };

    var b=a(l).attr("autocomplete","off").addClass(g.inputClass);
    var j;
    var p="";
    var m=a.Autocompleter.Cache(g);
    var e=0;
    var u;
    var x={
        mouseDownOnSelect:false
    };

    var r=a.Autocompleter.Select(g,l,d,x);
    var w;
    a.browser.opera&&a(l.form).bind("submit.autocomplete",function(){
        if(w){
            w=false;
            return false
            }
        });
b.bind((a.browser.opera?"keypress":"keydown")+".autocomplete",function(y){
    e=1;
    u=y.keyCode;
    switch(y.keyCode){
        case c.UP:
            y.preventDefault();
            if(r.visible()){
            r.prev()
            }else{
            t(0,true)
            }
            break;
        case c.DOWN:
            y.preventDefault();
            if(r.visible()){
            r.next()
            }else{
            t(0,true)
            }
            break;
        case c.PAGEUP:
            y.preventDefault();
            if(r.visible()){
            r.pageUp()
            }else{
            t(0,true)
            }
            break;
        case c.PAGEDOWN:
            y.preventDefault();
            if(r.visible()){
            r.pageDown()
            }else{
            t(0,true)
            }
            break;
        case g.multiple&&a.trim(g.multipleSeparator)==","&&c.COMMA:case c.TAB:case c.RETURN:
            if(d()){
            y.preventDefault();
            w=true;
            return false
            }
            break;
        case c.ESC:
            r.hide();
            break;
        default:
            clearTimeout(j);
            j=setTimeout(t,g.delay);
            break
            }
        }).focus(function(){
    e++
}).blur(function(){
    e=0;
    if(!x.mouseDownOnSelect){
        s()
        }
    }).click(function(){
    if(e++>1&&!r.visible()){
        t(0,true)
        }
    }).bind("search",function(){
    var y=(arguments.length>1)?arguments[1]:null;
    function z(D,C){
        var A;
        if(C&&C.length){
            for(var B=0;B<C.length;B++){
                if(C[B].result.toLowerCase()==D.toLowerCase()){
                    A=C[B];
                    break
                }
            }
            }
        if(typeof y=="function"){
    y(A)
    }else{
    b.trigger("result",A&&[A.data,A.value])
    }
}
a.each(h(b.val()),function(A,B){
    f(B,z,z)
    })
}).bind("flushCache",function(){
    m.flush()
    }).bind("setOptions",function(){
    a.extend(g,arguments[1]);
    if("data" in arguments[1]){
        m.populate()
        }
    }).bind("unautocomplete",function(){
    r.unbind();
    b.unbind();
    a(l.form).unbind(".autocomplete")
    });
function d(){
    var B=r.selected();
    if(!B){
        return false
        }
        var y=B.result;
    p=y;
    if(g.multiple){
        var E=h(b.val());
        if(E.length>1){
            var A=g.multipleSeparator.length;
            var D=a(l).selection().start;
            var C,z=0;
            a.each(E,function(F,G){
                z+=G.length;
                if(D<=z){
                    C=F;
                    return false
                    }
                    z+=A
                });
            E[C]=y;
            y=E.join(g.multipleSeparator)
            }
            y+=g.multipleSeparator
        }
        b.val(y);
    v();
    b.trigger("result",[B.data,B.value]);
    return true
    }
    function t(A,z){
    if(u==c.DEL){
        r.hide();
        return
    }
    var y=b.val();
    if(!z&&y==p){
        return
    }
    p=y;
    y=i(y);
    if(y.length>=g.minChars){
        b.addClass(g.loadingClass);
        if(!g.matchCase){
            y=y.toLowerCase()
            }
            f(y,k,v)
        }else{
        n();
        r.hide()
        }
    }
function h(y){
    if(!y){
        return[""]
        }
        if(!g.multiple){
        return[a.trim(y)]
        }
        return a.map(y.split(g.multipleSeparator),function(z){
        return a.trim(y).length?a.trim(z):null
        })
    }
    function i(y){
    if(!g.multiple){
        return y
        }
        var A=h(y);
    if(A.length==1){
        return A[0]
        }
        var z=a(l).selection().start;
    if(z==y.length){
        A=h(y)
        }else{
        A=h(y.replace(y.substring(z),""))
        }
        return A[A.length-1]
    }
    function q(y,z){
    if(g.autoFill&&(i(b.val()).toLowerCase()==y.toLowerCase())&&u!=c.BACKSPACE){
        b.val(b.val()+z.substring(i(p).length));
        a(l).selection(p.length,p.length+z.length)
        }
    }
function s(){
    clearTimeout(j);
    j=setTimeout(v,200)
    }
    function v(){
    var y=r.visible();
    r.hide();
    clearTimeout(j);
    n();
    if(g.mustMatch){
        b.search(function(z){
            if(!z){
                if(g.multiple){
                    var A=h(b.val()).slice(0,-1);
                    b.val(A.join(g.multipleSeparator)+(A.length?g.multipleSeparator:""))
                    }else{
                    b.val("");
                    b.trigger("result",null)
                    }
                }
        })
}
}
function k(z,y){
    if(y&&y.length&&e){
        n();
        r.display(y,z);
        q(z,y[0].value);
        r.show()
        }else{
        v()
        }
    }
function f(z,B,y){
    if(!g.matchCase){
        z=z.toLowerCase()
        }
        var A=m.load(z);
    if(A&&A.length){
        B(z,A)
        }else{
        if((typeof g.url=="string")&&(g.url.length>0)){
            var C={
                timestamp:+new Date()
                };

            a.each(g.extraParams,function(D,E){
                C[D]=typeof E=="function"?E():E
                });
            a.ajax({
                mode:"abort",
                port:"autocomplete"+l.name,
                dataType:g.dataType,
                url:g.url,
                data:a.extend({
                    q:i(z),
                    limit:g.max
                    },C),
                success:function(E){
                    var D=g.parse&&g.parse(E)||o(E);
                    m.add(z,D);
                    B(z,D)
                    }
                })
        }else{
        r.emptyList();
        y(z)
        }
    }
}
function o(B){
    var y=[];
    var A=B.split("\n");
    for(var z=0;z<A.length;z++){
        var C=a.trim(A[z]);
        if(C){
            C=C.split("|");
            y[y.length]={
                data:C,
                value:C[0],
                result:g.formatResult&&g.formatResult(C,C[0])||C[0]
                }
            }
    }
    return y
}
function n(){
    b.removeClass(g.loadingClass)
    }
};

a.Autocompleter.defaults={
    inputClass:"ac_input",
    resultsClass:"ac_results",
    loadingClass:"ac_loading",
    minChars:1,
    delay:400,
    matchCase:false,
    matchSubset:true,
    matchContains:false,
    cacheLength:10,
    max:100,
    mustMatch:false,
    extraParams:{},
    selectFirst:true,
    formatItem:function(b){
        return b[0]
        },
    formatMatch:null,
    autoFill:false,
    width:0,
    multiple:false,
    multipleSeparator:", ",
    highlight:function(c,b){
        return c.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)("+b.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,"\\$1")+")(?![^<>]*>)(?![^&;]+;)","gi"),"<strong>$1</strong>")
        },
    scroll:true,
    scrollHeight:180
};

a.Autocompleter.Cache=function(c){
    var f={};

    var d=0;
    function h(l,k){
        if(!c.matchCase){
            l=l.toLowerCase()
            }
            var j=l.indexOf(k);
        if(c.matchContains=="word"){
            j=l.toLowerCase().search("\\b"+k.toLowerCase())
            }
            if(j==-1){
            return false
            }
            return j==0||c.matchContains
        }
        function g(j,i){
        if(d>c.cacheLength){
            b()
            }
            if(!f[j]){
            d++
        }
        f[j]=i
        }
        function e(){
        if(!c.data){
            return false
            }
            var k={},j=0;
        if(!c.url){
            c.cacheLength=1
            }
            k[""]=[];
        for(var m=0,l=c.data.length;m<l;m++){
            var p=c.data[m];
            p=(typeof p=="string")?[p]:p;
            var o=c.formatMatch(p,m+1,c.data.length);
            if(o===false){
                continue
            }
            var n=o.charAt(0).toLowerCase();
            if(!k[n]){
                k[n]=[]
                }
                var q={
                value:o,
                data:p,
                result:c.formatResult&&c.formatResult(p)||o
                };

            k[n].push(q);
            if(j++<c.max){
                k[""].push(q)
                }
            }
        a.each(k,function(r,s){
        c.cacheLength++;
        g(r,s)
        })
    }
    setTimeout(e,25);
function b(){
    f={};

    d=0
    }
    return{
    flush:b,
    add:g,
    populate:e,
    load:function(n){
        if(!c.cacheLength||!d){
            return null
            }
            if(!c.url&&c.matchContains){
            var m=[];
            for(var j in f){
                if(j.length>0){
                    var o=f[j];
                    a.each(o,function(p,k){
                        if(h(k.value,n)){
                            m.push(k)
                            }
                        })
                }
            }
            return m
    }else{
    if(f[n]){
        return f[n]
        }else{
        if(c.matchSubset){
            for(var l=n.length-1;l>=c.minChars;l--){
                var o=f[n.substr(0,l)];
                if(o){
                    var m=[];
                    a.each(o,function(p,k){
                        if(h(k.value,n)){
                            m[m.length]=k
                            }
                        });
                return m
                }
            }
        }
}
}
return null
}
}
};

a.Autocompleter.Select=function(e,j,l,p){
    var i={
        ACTIVE:"ac_over"
    };

    var k,f=-1,r,m="",s=true,c,o;
    function n(){
        if(!s){
            return
        }
        c=a("<div/>").hide().addClass(e.resultsClass).css("position","absolute").appendTo(document.body);
        o=a("<ul/>").appendTo(c).mouseover(function(t){
            if(q(t).nodeName&&q(t).nodeName.toUpperCase()=="LI"){
                f=a("li",o).removeClass(i.ACTIVE).index(q(t));
                a(q(t)).addClass(i.ACTIVE)
                }
            }).click(function(t){
        a(q(t)).addClass(i.ACTIVE);
        l();
        return false
        }).mousedown(function(){
        p.mouseDownOnSelect=true
        }).mouseup(function(){
        p.mouseDownOnSelect=false
        });
    if(e.width>0){
        c.css("width",e.width)
        }
        s=false
    }
    function q(u){
    var t=u.target;
    while(t&&t.tagName!="LI"){
        t=t.parentNode
        }
        if(!t){
        return[]
        }
        return t
    }
    function h(t){
    k.slice(f,f+1).removeClass(i.ACTIVE);
    g(t);
    var v=k.slice(f,f+1).addClass(i.ACTIVE);
    if(e.scroll){
        var u=0;
        k.slice(0,f).each(function(){
            u+=this.offsetHeight
            });
        if((u+v[0].offsetHeight-o.scrollTop())>o[0].clientHeight){
            o.scrollTop(u+v[0].offsetHeight-o.innerHeight())
            }else{
            if(u<o.scrollTop()){
                o.scrollTop(u)
                }
            }
    }
}
function g(t){
    f+=t;
    if(f<0){
        f=k.size()-1
        }else{
        if(f>=k.size()){
            f=0
            }
        }
}
function b(t){
    return e.max&&e.max<t?e.max:t
    }
    function d(){
    o.empty();
    var u=b(r.length);
    for(var v=0;v<u;v++){
        if(!r[v]){
            continue
        }
        var w=e.formatItem(r[v].data,v+1,u,r[v].value,m);
        if(w===false){
            continue
        }
        var t=a("<li/>").html(e.highlight(w,m)).addClass(v%2==0?"ac_even":"ac_odd").appendTo(o)[0];
        a.data(t,"ac_data",r[v])
        }
        k=o.find("li");
    if(e.selectFirst){
        k.slice(0,1).addClass(i.ACTIVE);
        f=0
        }
        if(a.fn.bgiframe){
        o.bgiframe()
        }
    }
return{
    display:function(u,t){
        n();
        r=u;
        m=t;
        d()
        },
    next:function(){
        h(1)
        },
    prev:function(){
        h(-1)
        },
    pageUp:function(){
        if(f!=0&&f-8<0){
            h(-f)
            }else{
            h(-8)
            }
        },
pageDown:function(){
    if(f!=k.size()-1&&f+8>k.size()){
        h(k.size()-1-f)
        }else{
        h(8)
        }
    },
hide:function(){
    c&&c.hide();
    k&&k.removeClass(i.ACTIVE);
    f=-1
    },
visible:function(){
    return c&&c.is(":visible")
    },
current:function(){
    return this.visible()&&(k.filter("."+i.ACTIVE)[0]||e.selectFirst&&k[0])
    },
show:function(){
    var v=a(j).offset();
    c.css({
        width:typeof e.width=="string"||e.width>0?e.width:a(j).width(),
        top:v.top+j.offsetHeight,
        left:v.left
        }).show();
    if(e.scroll){
        o.scrollTop(0);
        o.css({
            maxHeight:e.scrollHeight,
            overflow:"auto"
        });
        if(a.browser.msie&&typeof document.body.style.maxHeight==="undefined"){
            var t=0;
            k.each(function(){
                t+=this.offsetHeight
                });
            var u=t>e.scrollHeight;
            o.css("height",u?e.scrollHeight:t);
            if(!u){
                k.width(o.width()-parseInt(k.css("padding-left"))-parseInt(k.css("padding-right")))
                }
            }
    }
},
selected:function(){
    var t=k&&k.filter("."+i.ACTIVE).removeClass(i.ACTIVE);
    return t&&t.length&&a.data(t[0],"ac_data")
    },
emptyList:function(){
    o&&o.empty()
    },
unbind:function(){
    c&&c.remove()
    }
}
};

a.fn.selection=function(i,b){
    if(i!==undefined){
        return this.each(function(){
            if(this.createTextRange){
                var j=this.createTextRange();
                if(b===undefined||i==b){
                    j.move("character",i);
                    j.select()
                    }else{
                    j.collapse(true);
                    j.moveStart("character",i);
                    j.moveEnd("character",b);
                    j.select()
                    }
                }else{
            if(this.setSelectionRange){
                this.setSelectionRange(i,b)
                }else{
                if(this.selectionStart){
                    this.selectionStart=i;
                    this.selectionEnd=b
                    }
                }
        }
    })
}
var g=this[0];
if(g.createTextRange){
    var c=document.selection.createRange(),h=g.value,f="<->",d=c.text.length;
    c.text=f;
    var e=g.value.indexOf(f);
    g.value=h;
    this.selection(e,e+d);
    return{
        start:e,
        end:e+d
        }
    }else{
    if(g.selectionStart!==undefined){
        return{
            start:g.selectionStart,
            end:g.selectionEnd
            }
        }
}
}
})(jQuery);
/*corner*/(function($){
    var ua=navigator.userAgent;
    var moz=$.browser.mozilla&&/gecko/i.test(ua);
    var webkit=$.browser.safari&&/Safari\/[5-9]/.test(ua);
    var expr=$.browser.msie&&(function(){
        var div=document.createElement("div");
        try{
            div.style.setExpression("width","0+0");
            div.style.removeExpression("width")
            }catch(e){
            return false
            }
            return true
        })();
    function sz(el,p){
        return parseInt($.css(el,p))||0
        }
        function hex2(s){
        var s=parseInt(s).toString(16);
        return(s.length<2)?"0"+s:s
        }
        function gpc(node){
        for(;node&&node.nodeName.toLowerCase()!="html";node=node.parentNode){
            var v=$.css(node,"backgroundColor");
            if(v=="rgba(0, 0, 0, 0)"){
                continue
            }
            if(v.indexOf("rgb")>=0){
                var rgb=v.match(/\d+/g);
                return"#"+hex2(rgb[0])+hex2(rgb[1])+hex2(rgb[2])
                }
                if(v&&v!="transparent"){
                return v
                }
            }
        return"#ffffff"
    }
    function getWidth(fx,i,width){
    switch(fx){
        case"round":
            return Math.round(width*(1-Math.cos(Math.asin(i/width))));
        case"cool":
            return Math.round(width*(1+Math.cos(Math.asin(i/width))));
        case"sharp":
            return Math.round(width*(1-Math.cos(Math.acos(i/width))));
        case"bite":
            return Math.round(width*(Math.cos(Math.asin((width-i-1)/width))));
        case"slide":
            return Math.round(width*(Math.atan2(i,width/i)));
        case"jut":
            return Math.round(width*(Math.atan2(width,(width-i-1))));
        case"curl":
            return Math.round(width*(Math.atan(i)));
        case"tear":
            return Math.round(width*(Math.cos(i)));
        case"wicked":
            return Math.round(width*(Math.tan(i)));
        case"long":
            return Math.round(width*(Math.sqrt(i)));
        case"sculpt":
            return Math.round(width*(Math.log((width-i-1),width)));
        case"dog":
            return(i&1)?(i+1):width;
        case"dog2":
            return(i&2)?(i+1):width;
        case"dog3":
            return(i&3)?(i+1):width;
        case"fray":
            return(i%2)*width;
        case"notch":
            return width;
        case"bevel":
            return i+1
            }
        }
$.fn.corner=function(options){
    if(this.length==0){
        if(!$.isReady&&this.selector){
            var s=this.selector,c=this.context;
            $(function(){
                $(s,c).corner(options)
                })
            }
            return this
        }
        return this.each(function(index){
        var $this=$(this);
        var o=[options||"",$this.attr($.fn.corner.defaults.metaAttr)||""].join(" ").toLowerCase();
        var keep=/keep/.test(o);
        var cc=((o.match(/cc:(#[0-9a-f]+)/)||[])[1]);
        var sc=((o.match(/sc:(#[0-9a-f]+)/)||[])[1]);
        var width=parseInt((o.match(/(\d+)px/)||[])[1])||10;
        var re=/round|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dog/;
        var fx=((o.match(re)||["round"])[0]);
        var edges={
            T:0,
            B:1
        };

        var opts={
            TL:/top|tl|left/.test(o),
            TR:/top|tr|right/.test(o),
            BL:/bottom|bl|left/.test(o),
            BR:/bottom|br|right/.test(o)
            };

        if(!opts.TL&&!opts.TR&&!opts.BL&&!opts.BR){
            opts={
                TL:1,
                TR:1,
                BL:1,
                BR:1
            }
        }
        if($.fn.corner.defaults.useNative&&fx=="round"&&(moz||webkit)&&!cc&&!sc){
        if(opts.TL){
            $this.css(moz?"-moz-border-radius-topleft":"-webkit-border-top-left-radius",width+"px")
            }
            if(opts.TR){
            $this.css(moz?"-moz-border-radius-topright":"-webkit-border-top-right-radius",width+"px")
            }
            if(opts.BL){
            $this.css(moz?"-moz-border-radius-bottomleft":"-webkit-border-bottom-left-radius",width+"px")
            }
            if(opts.BR){
            $this.css(moz?"-moz-border-radius-bottomright":"-webkit-border-bottom-right-radius",width+"px")
            }
            return
    }
    var strip=document.createElement("div");
        strip.style.overflow="hidden";
        strip.style.height="1px";
        strip.style.backgroundColor=sc||"transparent";
        strip.style.borderStyle="solid";
        var pad={
        T:parseInt($.css(this,"paddingTop"))||0,
        R:parseInt($.css(this,"paddingRight"))||0,
        B:parseInt($.css(this,"paddingBottom"))||0,
        L:parseInt($.css(this,"paddingLeft"))||0
        };

    if(typeof this.style.zoom!=undefined){
        this.style.zoom=1
        }
        if(!keep){
        this.style.border="none"
        }
        strip.style.borderColor=cc||gpc(this.parentNode);
        var cssHeight=$.curCSS(this,"height");
        for(var j in edges){
        var bot=edges[j];
        if((bot&&(opts.BL||opts.BR))||(!bot&&(opts.TL||opts.TR))){
            strip.style.borderStyle="none "+(opts[j+"R"]?"solid":"none")+" none "+(opts[j+"L"]?"solid":"none");
            var d=document.createElement("div");
            $(d).addClass("jquery-corner");
            var ds=d.style;
            bot?this.appendChild(d):this.insertBefore(d,this.firstChild);
            if(bot&&cssHeight!="auto"){
                if($.css(this,"position")=="static"){
                    this.style.position="relative"
                    }
                    ds.position="absolute";
                ds.bottom=ds.left=ds.padding=ds.margin="0";
                if(expr){
                    ds.setExpression("width","this.parentNode.offsetWidth")
                    }else{
                    ds.width="100%"
                    }
                }else{
            if(!bot&&$.browser.msie){
                if($.css(this,"position")=="static"){
                    this.style.position="relative"
                    }
                    ds.position="absolute";
                ds.top=ds.left=ds.right=ds.padding=ds.margin="0";
                if(expr){
                    var bw=sz(this,"borderLeftWidth")+sz(this,"borderRightWidth");
                    ds.setExpression("width","this.parentNode.offsetWidth - "+bw+'+ "px"')
                    }else{
                    ds.width="100%"
                    }
                }else{
            ds.position="relative";
            ds.margin=!bot?"-"+pad.T+"px -"+pad.R+"px "+(pad.T-width)+"px -"+pad.L+"px":(pad.B-width)+"px -"+pad.R+"px -"+pad.B+"px -"+pad.L+"px"
            }
        }
    for(var i=0;i<width;i++){
        var w=Math.max(0,getWidth(fx,i,width));
        var e=strip.cloneNode(false);
        e.style.borderWidth="0 "+(opts[j+"R"]?w:0)+"px 0 "+(opts[j+"L"]?w:0)+"px";
        bot?d.appendChild(e):d.insertBefore(e,d.firstChild)
        }
    }
    }
})
};

$.fn.uncorner=function(){
    if(moz||webkit){
        this.css(moz?"-moz-border-radius":"-webkit-border-radius",0)
        }
        $("div.jquery-corner",this).remove();
    return this
    };

$.fn.corner.defaults={
    useNative:true,
    metaAttr:"data-corner"
}
})(jQuery);
/*tooltip*/(function(e){
    var b={},k,m,o,j=e.browser.msie&&/MSIE\s(5\.5|6\.)/.test(navigator.userAgent),a=false;
    e.tooltip={
        blocked:false,
        defaults:{
            delay:200,
            fade:false,
            showURL:true,
            extraClass:"",
            top:15,
            left:15,
            id:"tooltip"
        },
        block:function(){
            e.tooltip.blocked=!e.tooltip.blocked
            }
        };

e.fn.extend({
    tooltip:function(p){
        p=e.extend({},e.tooltip.defaults,p);
        h(p);
        return this.each(function(){
            e.data(this,"tooltip",p);
            this.tOpacity=b.parent.css("opacity");
            this.tooltipText=this.title;
            //e(this).removeAttr("title");
            this.alt=""
            }).mouseover(l).mouseout(f).click(f)
        },
    fixPNG:j?function(){
        return this.each(function(){
            var p=e(this).css("backgroundImage");
            if(p.match(/^url\(["']?(.*\.png)["']?\)$/i)){
                p=RegExp.$1;
                e(this).css({
                    backgroundImage:"none",
                    filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='"+p+"')"
                    }).each(function(){
                    var q=e(this).css("position");
                    if(q!="absolute"&&q!="relative"){
                        e(this).css("position","relative")
                        }
                    })
            }
        })
}:function(){
    return this
    },
unfixPNG:j?function(){
    return this.each(function(){
        e(this).css({
            filter:"",
            backgroundImage:""
        })
        })
    }:function(){
    return this
    },
hideWhenEmpty:function(){
    return this.each(function(){
        e(this)[e(this).html()?"show":"hide"]()
        })
    },
url:function(){
    return this.attr("href")||this.attr("src")
    }
});
function h(p){
    if(b.parent){
        return
    }
    b.parent=e('<div id="'+p.id+'"><h3></h3><div class="body"></div><div class="url"></div></div>').appendTo(document.body).hide();
    if(e.fn.bgiframe){
        b.parent.bgiframe()
        }
        b.title=e("h3",b.parent);
    b.body=e("div.body",b.parent);
    b.url=e("div.url",b.parent)
    }
    function c(p){
    return e.data(p,"tooltip")
    }
    function g(p){
    if(c(this).delay){
        o=setTimeout(n,c(this).delay)
        }else{
        n()
        }
        a=!!c(this).track;
    e(document.body).bind("mousemove",d);
    d(p)
    }
    function l(){
    if(e.tooltip.blocked||this==k||(!this.tooltipText&&!c(this).bodyHandler)){
        return
    }
    k=this;
    m=this.tooltipText;
    if(c(this).bodyHandler){
        b.title.hide();
        var s=c(this).bodyHandler.call(this);
        if(s.nodeType||s.jquery){
            b.body.empty().append(s)
            }else{
            b.body.html(s)
            }
            b.body.show()
        }else{
        if(c(this).showBody){
            var r=m.split(c(this).showBody);
            b.title.html(r.shift()).show();
            b.body.empty();
            for(var q=0,p;(p=r[q]);q++){
                if(q>0){
                    b.body.append("<br/>")
                    }
                    b.body.append(p)
                }
                b.body.hideWhenEmpty()
            }else{
            b.title.html(m).show();
            b.body.hide()
            }
        }
    if(c(this).showURL&&e(this).url()){
    b.url.html(e(this).url().replace("http://","")).show()
    }else{
    b.url.hide()
    }
    b.parent.addClass(c(this).extraClass);
if(c(this).fixPNG){
    b.parent.fixPNG()
    }
    g.apply(this,arguments)
}
function n(){
    o=null;
    if((!j||!e.fn.bgiframe)&&c(k).fade){
        if(b.parent.is(":animated")){
            b.parent.stop().show().fadeTo(c(k).fade,k.tOpacity)
            }else{
            b.parent.is(":visible")?b.parent.fadeTo(c(k).fade,k.tOpacity):b.parent.fadeIn(c(k).fade)
            }
        }else{
    b.parent.show()
    }
    d()
}
function d(s){
    if(e.tooltip.blocked){
        return
    }
    if(s&&s.target.tagName=="OPTION"){
        return
    }
    if(!a&&b.parent.is(":visible")){
        e(document.body).unbind("mousemove",d)
        }
        if(k==null){
        e(document.body).unbind("mousemove",d);
        return
    }
    b.parent.removeClass("viewport-right").removeClass("viewport-bottom");
    var u=b.parent[0].offsetLeft;
    var t=b.parent[0].offsetTop;
    if(s){
        u=s.pageX+c(k).left;
        t=s.pageY+c(k).top;
        var q="auto";
        if(c(k).positionLeft){
            q=e(window).width()-u;
            u="auto"
            }
            b.parent.css({
            left:u,
            right:q,
            top:t
        })
        }
        var p=i(),r=b.parent[0];
    if(p.x+p.cx<r.offsetLeft+r.offsetWidth){
        u-=r.offsetWidth+20+c(k).left;
        b.parent.css({
            left:u+"px"
            }).addClass("viewport-right")
        }
        if(p.y+p.cy<r.offsetTop+r.offsetHeight){
        t-=r.offsetHeight+20+c(k).top;
        b.parent.css({
            top:t+"px"
            }).addClass("viewport-bottom")
        }
    }
function i(){
    return{
        x:e(window).scrollLeft(),
        y:e(window).scrollTop(),
        cx:e(window).width(),
        cy:e(window).height()
        }
    }
function f(r){
    if(e.tooltip.blocked){
        return
    }
    if(o){
        clearTimeout(o)
        }
        k=null;
    var q=c(this);
    function p(){
        b.parent.removeClass(q.extraClass).hide().css("opacity","")
        }
        if((!j||!e.fn.bgiframe)&&q.fade){
        if(b.parent.is(":animated")){
            b.parent.stop().fadeTo(q.fade,0,p)
            }else{
            b.parent.stop().fadeOut(q.fade,p)
            }
        }else{
    p()
    }
    if(c(this).fixPNG){
    b.parent.unfixPNG()
    }
}
})(jQuery);
(function($){
    $.fn.easySlider=function(options){
        var defaults={
            prevId:"prevBtn",
            prevText:"Previous",
            nextId:"nextBtn",
            nextText:"Next",
            controlsShow:true,
            controlsBefore:"",
            controlsAfter:"",
            controlsFade:true,
            firstId:"firstBtn",
            firstText:"First",
            firstShow:false,
            lastId:"lastBtn",
            lastText:"Last",
            lastShow:false,
            vertical:false,
            speed:800,
            auto:false,
            pause:2000,
            continuous:false,
            numeric:false,
            numericId:"controls"
        };

        var options=$.extend(defaults,options);
        this.each(function(){
            var obj=$(this);
            var s=$("li",obj).length;
            var w=$("li",obj).width();
            var h=$("li",obj).height();
            var clickable=true;
            obj.width(w);
            obj.height(h);
            obj.css("overflow","hidden");
            var ts=s-1;
            var t=0;
            $("ul",obj).css("width",s*w);
            if(options.continuous){
                $("ul",obj).prepend($("ul li:last-child",obj).clone().css("margin-left","-"+w+"px"));
                $("ul",obj).append($("ul li:nth-child(2)",obj).clone());
                $("ul",obj).css("width",(s+1)*w);
            }
            if(!options.vertical){
                $("li",obj).css("float","left");
            }
            if(options.controlsShow){
                var html=options.controlsBefore;
                if(options.numeric){
                    html+='<ol id="'+options.numericId+'"></ol>';
                }else{
                    if(options.firstShow){
                        html+='<span id="'+options.firstId+'"><a href="javascript:void(0);">'+options.firstText+"</a></span>";
                    }
                    html+=' <span id="'+options.prevId+'"><a href="javascript:void(0);">'+options.prevText+"</a></span>";
                    html+=' <span id="'+options.nextId+'"><a href="javascript:void(0);">'+options.nextText+"</a></span>";
                    if(options.lastShow){
                        html+=' <span id="'+options.lastId+'"><a href="javascript:void(0);">'+options.lastText+"</a></span>";
                    }
                }
                html+=options.controlsAfter;
            $(obj).after(html);
        }
        if(options.numeric){
            for(var i=0;i<s;i++){
                $(document.createElement("li")).attr("id",options.numericId+(i+1)).html("<a rel="+i+' href="javascript:void(0);">'+(i+1)+"</a>").appendTo($("#"+options.numericId)).click(function(){
                    animate($("a",$(this)).attr("rel"),true);
                });
            }
            }else{
            $("a","#"+options.nextId).click(function(){
                animate("next",true);
            });
            $("a","#"+options.prevId).click(function(){
                animate("prev",true);
            });
            $("a","#"+options.firstId).click(function(){
                animate("first",true);
            });
            $("a","#"+options.lastId).click(function(){
                animate("last",true);
            });
        }
        function setCurrent(i){
            i=parseInt(i)+1;
            $("li","#"+options.numericId).removeClass("current");
            $("li#"+options.numericId+i).addClass("current");
        }
        function adjust(){
            if(t>ts){
                t=0;
            }
            if(t<0){
                t=ts;
            }
            if(!options.vertical){
                $("ul",obj).css("margin-left",(t*w*-1));
            }else{
                $("ul",obj).css("margin-left",(t*h*-1));
            }
            clickable=true;
            if(options.numeric){
                setCurrent(t);
            }
        }
        function animate(dir,clicked){
        if(clickable){
            clickable=false;
            var ot=t;
            switch(dir){
                case"next":
                    t=(ot>=ts)?(options.continuous?t+1:ts):t+1;
                    break;
                case"prev":
                    t=(t<=0)?(options.continuous?t-1:0):t-1;
                    break;
                case"first":
                    t=0;
                    break;
                case"last":
                    t=ts;
                    break;
                default:
                    t=dir;
                    break;
            }
            var diff=Math.abs(ot-t);
            var speed=diff*options.speed;
            if(!options.vertical){
                p=(t*w*-1);
                $("ul",obj).animate({
                    marginLeft:p
                },{
                    queue:false,
                    duration:speed,
                    complete:adjust
                });
            }else{
                p=(t*h*-1);
                $("ul",obj).animate({
                    marginTop:p
                },{
                    queue:false,
                    duration:speed,
                    complete:adjust
                });
            }
            if(!options.continuous&&options.controlsFade){
                if(t==ts){
                    $("a","#"+options.nextId).hide();
                    $("a","#"+options.lastId).hide();
                }else{
                    $("a","#"+options.nextId).show();
                    $("a","#"+options.lastId).show();
                }
                if(t==0){
                    $("a","#"+options.prevId).hide();
                    $("a","#"+options.firstId).hide();
                }else{
                    $("a","#"+options.prevId).show();
                    $("a","#"+options.firstId).show();
                }
            }
            if(clicked){
            clearTimeout(timeout);
        }
        if(options.auto&&dir=="next"&&!clicked){
            timeout=setTimeout(function(){
                animate("next",false);
            },diff*options.speed+options.pause);
        }
    }
}
var timeout;
if(options.auto){
    timeout=setTimeout(function(){
        animate("next",false);
    },options.pause);
}
if(options.numeric){
    setCurrent(0);
}
if(!options.continuous&&options.controlsFade){
    $("a","#"+options.prevId).hide();
    $("a","#"+options.firstId).hide();
}
});
};

})(jQuery);
(function($){
    $.prettyPhoto={
        version:"2.5.6"
    };

    $.fn.prettyPhoto=function(settings){
        settings=jQuery.extend({
            animationSpeed:"normal",
            opacity:0.8,
            showTitle:true,
            allowresize:true,
            default_width:"auto",
            default_height:344,
            counter_separator_label:"/",
            theme:"light_rounded",
            hideflash:false,
            wmode:"opaque",
            autoplay:true,
            modal:false,
            changepicturecallback:function(){},
            callback:function(){},
            markup:'<div class="pp_pic_holder"> 						<div class="pp_top"> 							<div class="pp_left"></div> 							<div class="pp_middle"></div> 							<div class="pp_right"></div> 						</div> 						<div class="pp_content_container"> 							<div class="pp_left"> 							<div class="pp_right"> 								<div class="pp_content"> 									<div class="pp_loaderIcon"></div> 									<div class="pp_fade"> 										<a href="#" class="pp_expand" title="Expand the image">Expand</a> 										<div class="pp_hoverContainer"> 											<a class="pp_next" href="#">next</a> 											<a class="pp_previous" href="#">previous</a> 										</div> 										<div id="pp_full_res"></div> 										<div class="pp_details clearfix"> 											<a class="pp_close" href="#">Close</a> 											<p class="pp_description"></p> 											<div class="pp_nav"> 												<a href="#" class="pp_arrow_previous">Previous</a> 												<p class="currentTextHolder">0/0</p> 												<a href="#" class="pp_arrow_next">Next</a> 											</div> 										</div> 									</div> 								</div> 							</div> 							</div> 						</div> 						<div class="pp_bottom"> 							<div class="pp_left"></div> 							<div class="pp_middle"></div> 							<div class="pp_right"></div> 						</div> 					</div> 					<div class="pp_overlay"></div> 					<div class="ppt"></div>',
            image_markup:'<img id="fullResImage" src="" />',
            flash_markup:'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>',
            quicktime_markup:'<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}"><param name="src" value="{path}"><param name="autoplay" value="{autoplay}"><param name="type" value="video/quicktime"><embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>',
            iframe_markup:'<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>',
            inline_markup:'<div class="pp_inline clearfix">{content}</div>'
        },settings);
        if($.browser.msie&&parseInt($.browser.version)==6){
            settings.theme="light_square"
            }
            if($(".pp_overlay").size()==0){
            _buildOverlay()
            }
            var doresize=true,percentBased=false,correctSizes,$pp_pic_holder,$ppt,$pp_overlay,pp_contentHeight,pp_contentWidth,pp_containerHeight,pp_containerWidth,windowHeight=$(window).height(),windowWidth=$(window).width(),setPosition=0,scrollPos=_getScroll();
        $(window).scroll(function(){
            scrollPos=_getScroll();
            _centerOverlay();
            _resizeOverlay()
            });
        $(window).resize(function(){
            _centerOverlay();
            _resizeOverlay()
            });
        $(document).keydown(function(e){
            if($pp_pic_holder.is(":visible")){
                switch(e.keyCode){
                    case 37:
                        $.prettyPhoto.changePage("previous");
                        break;
                    case 39:
                        $.prettyPhoto.changePage("next");
                        break;
                    case 27:
                        if(!settings.modal){
                        $.prettyPhoto.close()
                        }
                        break
                    }
                    }
        });
$(this).each(function(){
    $(this).bind("click",function(){
        _self=this;
        theRel=$(this).attr("rel");
        galleryRegExp=/\[(?:.*)\]/;
        theGallery=galleryRegExp.exec(theRel);
        var images=new Array(),titles=new Array(),descriptions=new Array();
        if(theGallery){
            $("a[rel*="+theGallery+"]").each(function(i){
                if($(this)[0]===$(_self)[0]){
                    setPosition=i
                    }
                    images.push($(this).attr("href"));
                titles.push($(this).find("img").attr("alt"));
                descriptions.push($(this).attr("title"))
                })
            }else{
            images=$(this).attr("href");
            titles=($(this).find("img").attr("alt"))?$(this).find("img").attr("alt"):"";
            descriptions=($(this).attr("title"))?$(this).attr("title"):""
            }
            $.prettyPhoto.open(images,titles,descriptions);
        return false
        })
    });
$.prettyPhoto.open=function(gallery_images,gallery_titles,gallery_descriptions){
    if($.browser.msie&&$.browser.version==6){
        $("select").css("visibility","hidden")
        }
        if(settings.hideflash){
        $("object,embed").css("visibility","hidden")
        }
        images=$.makeArray(gallery_images);
    titles=$.makeArray(gallery_titles);
    descriptions=$.makeArray(gallery_descriptions);
    image_set=($(images).size()>0)?true:false;
    _checkPosition($(images).size());
    $(".pp_loaderIcon").show();
    $pp_overlay.show().fadeTo(settings.animationSpeed,settings.opacity);
    $pp_pic_holder.find(".currentTextHolder").text((setPosition+1)+settings.counter_separator_label+$(images).size());
    if(descriptions[setPosition]){
        $pp_pic_holder.find(".pp_description").show().html(unescape(descriptions[setPosition]))
        }else{
        $pp_pic_holder.find(".pp_description").hide().text("")
        }
        if(titles[setPosition]&&settings.showTitle){
        hasTitle=true;
        $ppt.html(unescape(titles[setPosition]))
        }else{
        hasTitle=false
        }
        if(settings.default_width=="auto"){
        var nuevowidth=500;
        movie_width=(parseFloat(grab_param("width",images[setPosition])))?grab_param("width",images[setPosition]):nuevowidth.toString()
        }else{
        movie_width=(parseFloat(grab_param("width",images[setPosition])))?grab_param("width",images[setPosition]):settings.default_width.toString()
        }
        movie_height=(parseFloat(grab_param("height",images[setPosition])))?grab_param("height",images[setPosition]):settings.default_height.toString();
    if(movie_width.indexOf("%")!=-1||movie_height.indexOf("%")!=-1){
        movie_height=parseFloat(($(window).height()*parseFloat(movie_height)/100)-100);
        movie_width=parseFloat(($(window).width()*parseFloat(movie_width)/100)-100);
        percentBased=true
        }
        $pp_pic_holder.fadeIn(function(){
        imgPreloader="";
        switch(_getFileType(images[setPosition])){
            case"image":
                imgPreloader=new Image();
                nextImage=new Image();
                if(image_set&&setPosition>$(images).size()){
                nextImage.src=images[setPosition+1]
                }
                prevImage=new Image();
                if(image_set&&images[setPosition-1]){
                prevImage.src=images[setPosition-1]
                }
                $pp_pic_holder.find("#pp_full_res")[0].innerHTML=settings.image_markup;
                $pp_pic_holder.find("#fullResImage").attr("src",images[setPosition]);
                imgPreloader.onload=function(){
                correctSizes=_fitToViewport(imgPreloader.width,imgPreloader.height);
                _showContent()
                };

            imgPreloader.onerror=function(){
                alert("Image cannot be loaded. Make sure the path is correct and image exist.");
                $.prettyPhoto.close()
                };

            imgPreloader.src=images[setPosition];
            break;
            case"youtube":
                correctSizes=_fitToViewport(movie_width,movie_height);
                movie="http://www.youtube.com/v/"+grab_param("v",images[setPosition]);
                if(settings.autoplay){
                movie+="&autoplay=1"
                }
                toInject=settings.flash_markup.replace(/{width}/g,correctSizes.width).replace(/{height}/g,correctSizes.height).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);
                break;
            case"vimeo":
                correctSizes=_fitToViewport(movie_width,movie_height);
                movie_id=images[setPosition];
                movie="http://vimeo.com/moogaloop.swf?clip_id="+movie_id.replace("http://vimeo.com/","");
                if(settings.autoplay){
                movie+="&autoplay=1"
                }
                toInject=settings.flash_markup.replace(/{width}/g,correctSizes.width).replace(/{height}/g,correctSizes.height).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);
                break;
            case"quicktime":
                correctSizes=_fitToViewport(movie_width,movie_height);
                correctSizes.height+=15;
                correctSizes.contentHeight+=15;
                correctSizes.containerHeight+=15;
                toInject=settings.quicktime_markup.replace(/{width}/g,correctSizes.width).replace(/{height}/g,correctSizes.height).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,images[setPosition]).replace(/{autoplay}/g,settings.autoplay);
                break;
            case"flash":
                correctSizes=_fitToViewport(movie_width,movie_height);
                flash_vars=images[setPosition];
                flash_vars=flash_vars.substring(images[setPosition].indexOf("flashvars")+10,images[setPosition].length);
                filename=images[setPosition];
                filename=filename.substring(0,filename.indexOf("?"));
                toInject=settings.flash_markup.replace(/{width}/g,correctSizes.width).replace(/{height}/g,correctSizes.height).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,filename+"?"+flash_vars);
                break;
            case"iframe":
                correctSizes=_fitToViewport(movie_width,movie_height);
                frame_url=images[setPosition];
                frame_url=frame_url.substr(0,frame_url.indexOf("iframe")-1);
                toInject=settings.iframe_markup.replace(/{width}/g,correctSizes.width).replace(/{height}/g,correctSizes.height).replace(/{path}/g,frame_url);
                break;
            case"inline":
                myClone=$(images[setPosition]).clone().css({
                width:settings.default_width
                }).wrapInner('<div id="pp_full_res"><div class="pp_inline clearfix"></div></div>').appendTo($("body"));
                correctSizes=_fitToViewport($(myClone).width(),$(myClone).height());
                $(myClone).remove();
                toInject=settings.inline_markup.replace(/{content}/g,$(images[setPosition]).html());
                break
                }
                if(!imgPreloader){
            $pp_pic_holder.find("#pp_full_res")[0].innerHTML=toInject;
            _showContent()
            }
        })
};

$.prettyPhoto.changePage=function(direction){
    if(direction=="previous"){
        setPosition--;
        if(setPosition<0){
            setPosition=0;
            return
        }
    }else{
    if($(".pp_arrow_next").is(".disabled")){
        return
    }
    setPosition++
}
if(!doresize){
    doresize=true
    }
    _hideContent(function(){
    $.prettyPhoto.open(images,titles,descriptions)
    });
$("a.pp_expand,a.pp_contract").fadeOut(settings.animationSpeed)
    };

$.prettyPhoto.close=function(){
    $pp_pic_holder.find("object,embed").css("visibility","hidden");
    $("div.pp_pic_holder,div.ppt,.pp_fade").fadeOut(settings.animationSpeed);
    $pp_overlay.fadeOut(settings.animationSpeed,function(){
        $("#pp_full_res").html("");
        $pp_pic_holder.attr("style","").find("div:not(.pp_hoverContainer)").attr("style","");
        _centerOverlay();
        if($.browser.msie&&$.browser.version==6){
            $("select").css("visibility","visible")
            }
            if(settings.hideflash){
            $("object,embed").css("visibility","visible")
            }
            setPosition=0;
        settings.callback()
        });
    doresize=true
    };

_showContent=function(){
    $(".pp_loaderIcon").hide();
    projectedTop=scrollPos.scrollTop+((windowHeight/2)-(correctSizes.containerHeight/2));
    if(projectedTop<0){
        projectedTop=0+$ppt.height()
        }
        $pp_pic_holder.find(".pp_content").animate({
        height:correctSizes.contentHeight
        },settings.animationSpeed);
    $pp_pic_holder.animate({
        top:projectedTop,
        left:(windowWidth/2)-(correctSizes.containerWidth/2),
        width:correctSizes.containerWidth
        },settings.animationSpeed,function(){
        $pp_pic_holder.find(".pp_hoverContainer,#fullResImage").height(correctSizes.height).width(correctSizes.width);
        $pp_pic_holder.find(".pp_fade").fadeIn(settings.animationSpeed);
        if(image_set&&_getFileType(images[setPosition])=="image"){
            $pp_pic_holder.find(".pp_hoverContainer").show()
            }else{
            $pp_pic_holder.find(".pp_hoverContainer").hide()
            }
            if(settings.showTitle&&hasTitle){
            $ppt.css({
                top:$pp_pic_holder.offset().top-25,
                left:$pp_pic_holder.offset().left+20,
                display:"none"
            });
            $ppt.fadeIn(settings.animationSpeed)
            }
            if(correctSizes.resized){
            $("a.pp_expand,a.pp_contract").fadeIn(settings.animationSpeed)
            }
            settings.changepicturecallback()
        })
    };

function _hideContent(callback){
    $pp_pic_holder.find("#pp_full_res object,#pp_full_res embed").css("visibility","hidden");
    $pp_pic_holder.find(".pp_fade").fadeOut(settings.animationSpeed,function(){
        $(".pp_loaderIcon").show();
        if(callback){
            callback()
            }
        });
$ppt.fadeOut(settings.animationSpeed)
}
function _checkPosition(setCount){
    if(setPosition==setCount-1){
        $pp_pic_holder.find("a.pp_next").css("visibility","hidden");
        $pp_pic_holder.find("a.pp_arrow_next").addClass("disabled").unbind("click")
        }else{
        $pp_pic_holder.find("a.pp_next").css("visibility","visible");
        $pp_pic_holder.find("a.pp_arrow_next.disabled").removeClass("disabled").bind("click",function(){
            $.prettyPhoto.changePage("next");
            return false
            })
        }
        if(setPosition==0){
        $pp_pic_holder.find("a.pp_previous").css("visibility","hidden");
        $pp_pic_holder.find("a.pp_arrow_previous").addClass("disabled").unbind("click")
        }else{
        $pp_pic_holder.find("a.pp_previous").css("visibility","visible");
        $pp_pic_holder.find("a.pp_arrow_previous.disabled").removeClass("disabled").bind("click",function(){
            $.prettyPhoto.changePage("previous");
            return false
            })
        }
        if(setCount>1){
        $(".pp_nav").show()
        }else{
        $(".pp_nav").hide()
        }
    }
function _fitToViewport(width,height){
    hasBeenResized=false;
    _getDimensions(width,height);
    imageWidth=width;
    imageHeight=height;
    if(((pp_containerWidth>windowWidth)||(pp_containerHeight>windowHeight))&&doresize&&settings.allowresize&&!percentBased){
        hasBeenResized=true;
        notFitting=true;
        while(notFitting){
            if((pp_containerWidth>windowWidth)){
                imageWidth=(windowWidth-200);
                imageHeight=(height/width)*imageWidth
                }else{
                if((pp_containerHeight>windowHeight)){
                    imageHeight=(windowHeight-200);
                    imageWidth=(width/height)*imageHeight
                    }else{
                    notFitting=false
                    }
                }
            pp_containerHeight=imageHeight;
        pp_containerWidth=imageWidth
        }
        _getDimensions(imageWidth,imageHeight)
    }
    return{
    width:Math.floor(imageWidth),
    height:Math.floor(imageHeight),
    containerHeight:Math.floor(pp_containerHeight),
    containerWidth:Math.floor(pp_containerWidth)+40,
    contentHeight:Math.floor(pp_contentHeight),
    contentWidth:Math.floor(pp_contentWidth),
    resized:hasBeenResized
}
}
function _getDimensions(width,height){
    width=parseFloat(width);
    height=parseFloat(height);
    $pp_details=$pp_pic_holder.find(".pp_details");
    $pp_details.width(width);
    detailsHeight=parseFloat($pp_details.css("marginTop"))+parseFloat($pp_details.css("marginBottom"));
    $pp_details=$pp_details.clone().appendTo($("body")).css({
        position:"absolute",
        top:-10000
    });
    detailsHeight+=$pp_details.height();
    detailsHeight=(detailsHeight<=34)?36:detailsHeight;
    if($.browser.msie&&$.browser.version==7){
        detailsHeight+=8
        }
        $pp_details.remove();
    pp_contentHeight=height+detailsHeight;
    pp_contentWidth=width;
    pp_containerHeight=pp_contentHeight+$ppt.height()+$pp_pic_holder.find(".pp_top").height()+$pp_pic_holder.find(".pp_bottom").height();
    pp_containerWidth=width
    }
    function _getFileType(itemSrc){
    if(itemSrc.match(/youtube\.com\/watch/i)){
        return"youtube"
        }else{
        if(itemSrc.match(/vimeo\.com/i)){
            return"vimeo"
            }else{
            if(itemSrc.indexOf(".mov")!=-1){
                return"quicktime"
                }else{
                if(itemSrc.indexOf(".swf")!=-1){
                    return"flash"
                    }else{
                    if(itemSrc.indexOf("iframe")!=-1){
                        return"iframe"
                        }else{
                        if(itemSrc.substr(0,1)=="#"){
                            return"inline"
                            }else{
                            return"image"
                            }
                        }
                }
        }
}
}
}
function _centerOverlay(){
    if(doresize){
        titleHeight=$ppt.height();
        contentHeight=$pp_pic_holder.height();
        contentwidth=$pp_pic_holder.width();
        projectedTop=(windowHeight/2)+scrollPos.scrollTop-((contentHeight+titleHeight)/2);
        $pp_pic_holder.css({
            top:projectedTop,
            left:(windowWidth/2)+scrollPos.scrollLeft-(contentwidth/2)
            });
        $ppt.css({
            top:projectedTop-titleHeight,
            left:(windowWidth/2)+scrollPos.scrollLeft-(contentwidth/2)+20
            })
        }
    }
function _getScroll(){
    if(self.pageYOffset){
        return{
            scrollTop:self.pageYOffset,
            scrollLeft:self.pageXOffset
            }
        }else{
    if(document.documentElement&&document.documentElement.scrollTop){
        return{
            scrollTop:document.documentElement.scrollTop,
            scrollLeft:document.documentElement.scrollLeft
            }
        }else{
    if(document.body){
        return{
            scrollTop:document.body.scrollTop,
            scrollLeft:document.body.scrollLeft
            }
        }
}
}
}
function _resizeOverlay(){
    windowHeight=$(window).height();
    windowWidth=$(window).width();
    $pp_overlay.css({
        height:$(document).height()
        })
    }
    function _buildOverlay(){
    $("body").append(settings.markup);
    $pp_pic_holder=$(".pp_pic_holder");
    $ppt=$(".ppt");
    $pp_overlay=$("div.pp_overlay");
    $pp_pic_holder.attr("class","pp_pic_holder "+settings.theme);
    $pp_overlay.css({
        opacity:0,
        height:$(document).height()
        }).bind("click",function(){
        if(!settings.modal){
            $.prettyPhoto.close()
            }
        });
$("a.pp_close").bind("click",function(){
    $.prettyPhoto.close();
    return false
    });
$("a.pp_expand").bind("click",function(){
    $this=$(this);
    if($this.hasClass("pp_expand")){
        $this.removeClass("pp_expand").addClass("pp_contract");
        doresize=false
        }else{
        $this.removeClass("pp_contract").addClass("pp_expand");
        doresize=true
        }
        _hideContent(function(){
        $.prettyPhoto.open(images,titles,descriptions)
        });
    $pp_pic_holder.find(".pp_fade").fadeOut(settings.animationSpeed);
    return false
    });
$pp_pic_holder.find(".pp_previous, .pp_arrow_previous").bind("click",function(){
    $.prettyPhoto.changePage("previous");
    return false
    });
$pp_pic_holder.find(".pp_next, .pp_arrow_next").bind("click",function(){
    $.prettyPhoto.changePage("next");
    return false
    })
}
_centerOverlay()
};

function grab_param(name,url){
    name=name.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");
    var regexS="[\\?&]"+name+"=([^&#]*)";
    var regex=new RegExp(regexS);
    var results=regex.exec(url);
    if(results==null){
        return""
        }else{
        return results[1]
        }
    }
})(jQuery);
/*liquid-canvas*/(function(h){
    var d=[];
    var g=0;
    var f={};

    function i(p){
        var o=[];
        h.extend(this,{
            width:p.width,
            height:p.height,
            ctx:p.getContext("2d"),
            save:function(){
                this.ctx.save();
                o.push({
                    width:this.width,
                    height:this.height
                    })
                },
            restore:function(){
                this.ctx.restore();
                h.extend(this,o.pop())
                }
            })
    }
    var m=(function(){
    var o=function(q,p){
        q.ctx.translate(p,p);
        q.width-=2*p;
        q.height-=2*p
        };

    return{
        action:{
            paint:function(){}
        },
    shrink:o,
    defaultShrink:o,
    setAction:function(p){
        this.action=p
        }
    }
})();
function l(p,o){
    return h.extend({},m,p,{
        opts:o,
        savedOpts:o
    })
    }
    function n(o){
    return l({
        paint:function(p){
            p.save();
            this.action.opts=h.extend(true,this.action.savedOpts);
            h.each(o,function(){
                this.paint(p)
                });
            p.restore()
            },
        setAction:function(p){
            this.action=p;
            h.each(o,function(){
                this.action=p
                })
            }
        })
}
var c=n;
function a(o,q){
    var p=f[o];
    if(!p){
        throw"Unknown plugin: "+o
        }
        q=h.extend({},p.defaultOpts||{},q);
    return l(p,q)
    }
    function e(z){
    z+=" ";
    var t=0;
    function q(s){
        msg=s+" at "+t+": ..."+z.substring(t)+"\nin "+z;
        alert(msg);
        throw msg
        }
        function p(){
        return z.charAt(t)
        }
        function C(){
        if(t>z.length){
            throw ("Unexpected end")
            }
            return z.charAt(t+1)
        }
        function w(){
        return z.charAt(t++)
        }
        function F(){
        while(/\s/.exec(p())){
            w()
            }
        }
    function G(J){
    F();
    for(var s=0;s<J.length;++s){
        if(p()!=J.charAt(s)){
            q("Expected '"+J.charAt(s)+"' found '"+p()+"'")
            }
            w()
        }
    }
    function I(){
    F();
    for(var s=[];/\w/.exec(p());s.push(w())){}
    return s.join("")
    }
    function v(){
    F();
    for(var s=[];/\d/.exec(p());s.push(w())){}
    return parseInt(s.join(""))
    }
    function u(){
    F();
    var J=[],K=p();
    if(/[^\'\"]/.exec(K)){
        q("String expected")
        }
        w();
    while(p()!=K){
        if(p()=="\\"){
            J.eat()
            }
            J.push(w())
        }
        G(K);
    return J.join("")
    }
    function E(){
    F();
    for(var J=[];/[^;}]/.exec(p());J.push(w())){}
    return J.join("")
    }
    function D(){
    F();
    if(/\d/.exec(p())){
        return v()
        }
        if(/['"]/.exec(p())){
        return u()
        }
        return E()
    }
    function B(){
    G("{");
    F();
    var J={};
    while(p()!="}"){
        var s=I();
        G(":");
        J[s]=D();
        F();
        if(p()=="}"){
            break
        }
        G(";")
        }
        G("}");
    return J
    }
    function x(){
    var s=I();
    F();
    opts=p()=="{"?B():{};

    return a(s,opts)
    }
    function y(){
    G("[");
    F();
    var s=[];
    while(p()!="]"){
        s.push(x());
        F()
        }
        G("]");
    return n(s)
    }
    function r(){
    F();
    return p()=="["?y():x()
    }
    function o(){
    var s;
    F();
    if(p()=="("){
        w();
        s=A();
        G(")")
        }else{
        s=x()
        }
        return s
    }
    function H(){
    var s=r();
    G("=>");
    var J=o();
    s.setAction(J);
    return s
    }
    function A(){
    var s=[];
    while(true){
        s.push(H());
        F();
        if(p()!=","){
            break
        }
        G(",")
        }
        return c(s)
    }
    return A()
}
function b(o,q){
    var x=h(o);
    var s=x.data("liquid-canvas");
    if(!s){
        return
    }
    var r=s.canvas;
    var u=h(r);
    var v=x.outerWidth();
    var t=x.outerHeight();
    if(q||r.width!=v||r.height!=t||r.offsetTop!=o.offsetTop||r.offsetLeft!=o.offsetLeft){
        g=100;
        u.css({
            left:o.offsetLeft+"px",
            top:o.offsetTop+"px"
            });
        r.width=v;
        r.height=t;
        var p=new i(r);
        p.save();
        s.paint(p);
        p.restore()
        }
    }
function j(o){
    h.each(d,function(){
        b(this,o)
        })
    }
    function k(){
    j();
    g--;
    if(g<0){
        g=0;
        setTimeout(k,1000)
        }else{
        setTimeout(k,1000/60)
        }
    }
jQuery.fn.extend({
    liquidCanvas:function(o){
        this.each(function(){
            var p;
            if(window.G_vmlCanvasManager){
                h(this).before('<div width="0" height="0" style="position:absolute; top:0px; left:0px;"></div>');
                p=G_vmlCanvasManager.initElement(h(this).prev("div").get(0))
                }else{
                h(this).before('<canvas width="0" height="0" style="position:absolute; top:0px; left:0px;"></canvas>');
                p=h(this).prev("canvas").get(0)
                }
                var r;
            if(h.isFunction(o)){
                r=o
                }else{
                var q=e(o);
                r=function(s){
                    q.paint(s)
                    }
                }
            h(this).data("liquid-canvas",{
            canvas:p,
            paint:r
        });
        h(this).css({
            background:"transparent"
        });
        if(h(this).css("position")!="absolute"){
            h(this).css({
                position:"relative"
            })
            }
            d.push(this);
            b(this,true)
            })
    }
});
jQuery.extend({
    registerLiquidCanvasPlugin:function(o){
        f[o.name]=h.extend({},m,o)
        }
    });
h(document).ready(j);
k()
})(jQuery);
/*liquid-canvas*/(function(a){
    a.registerLiquidCanvasPlugin({
        name:"rect",
        paint:function(b){
            b.ctx.beginPath();
            b.ctx.rect(0,0,b.width,b.height);
            b.ctx.closePath();
            if(this.action){
                this.action.paint(b)
                }
            }
    });
a.registerLiquidCanvasPlugin({
    name:"roundedRect",
    defaultOpts:{
        radius:20
    },
    paint:function(d){
        var b=d.ctx;
        var c=this.opts;
        b.beginPath();
        b.moveTo(0,c.radius);
        b.lineTo(0,d.height-c.radius);
        b.quadraticCurveTo(0,d.height,c.radius,d.height);
        b.lineTo(d.width-c.radius,d.height);
        b.quadraticCurveTo(d.width,d.height,d.width,d.height-c.radius);
        b.lineTo(d.width,c.radius);
        b.quadraticCurveTo(d.width,0,d.width-c.radius,0);
        b.lineTo(c.radius,0);
        b.quadraticCurveTo(0,0,0,c.radius);
        b.closePath();
        if(this.action){
            this.action.paint(d)
            }
        },
shrink:function(c,b){
    this.defaultShrink(c,b);
    this.opts.radius-=b
    }
});
a.registerLiquidCanvasPlugin({
    name:"fill",
    defaultOpts:{
        color:"#aaa"
    },
    paint:function(b){
        b.ctx.fillStyle=this.opts.color;
        this.action.paint(b);
        b.ctx.fill()
        }
    });
a.registerLiquidCanvasPlugin({
    name:"image",
    defaultOpts:{
        url:"http://www.ruzee.com/files/liquid-canvas-image.png"
    },
    paint:function(b){
        var c=new Image();
        c.src=this.opts.url;
        c.onload=function(){
            b.ctx.drawImage(this,0,0)
            }
        }
});
a.registerLiquidCanvasPlugin({
    name:"gradient",
    defaultOpts:{
        from:"#fff",
        to:"#666"
    },
    paint:function(b){
        var c=b.ctx.createLinearGradient(0,0,0,b.height);
        c.addColorStop(0,this.opts.from);
        c.addColorStop(1,this.opts.to);
        b.ctx.fillStyle=c;
        this.action.paint(b);
        b.ctx.fill()
        }
    });
a.registerLiquidCanvasPlugin({
    name:"shadow",
    defaultOpts:{
        width:3,
        color:"#000",
        shift:2
    },
    paint:function(d){
        var b=this.opts.width;
        d.ctx.fillStyle=this.opts.color;
        d.ctx.globalAlpha=1/b;
        for(var c=0;c<b;++c){
            this.action.paint(d);
            d.ctx.fill();
            this.action.shrink(d,1)
            }
            d.ctx.globalAlpha=1;
        d.ctx.translate(0,-this.opts.shift)
        }
    });
a.registerLiquidCanvasPlugin({
    name:"border",
    defaultOpts:{
        color:"#8f4",
        width:3
    },
    paint:function(b){
        var c=this.opts.width;
        b.ctx.strokeStyle=this.opts.color;
        b.ctx.lineWidth=c;
        this.action.shrink(b,c/2);
        this.action.paint(b);
        b.ctx.stroke();
        this.action.shrink(b,c/2)
        }
    })
})(jQuery);
/*Blink*/(function($){
    $.fn.blink = function(options){
        var defaults = {
            delay:500
        };

        var options = $.extend(defaults, options);
        return this.each(function(){
            var obj = $(this);
            setInterval(function(){
                if($(obj).css("visibility") == "visible"){
                    $(obj).css('visibility','hidden');
                } else {
                    $(obj).css('visibility','visible');
                }
            }, options.delay);
        });
}
}(jQuery));
