

 var   d  =  window["Spif"] = {
    e:"undefined",
    f:"*",
    g:" ",
    
    h:"none",

    j:"threadStart",
    k:"threadEnd",
    l:"beforeChangeClassName",
    m:"afterChangeClassName",
    n:"beforeHtmlChanged",
    o:"afterHtmlChanged",
    r:"beforeAction",
    t:"afterElementActivation",
    v:"linkExecuteRequest",
    w:  400,
    z:  "loaded",
    B:  "unloaded\\b|\\bloading\\b|\\bloaded",

    C:"load",
    D:"click",
    F:"keydown",
    G:"keypress",
    H:"mousedown",
    I:"mousemove",
    J:"mouseup",

    K:"DXImageTransform.Microsoft.Alpha",

    L:  true,
    M:  false,

    N:"onBefore",
    O:"onFinish",

    P:"-delay",


    Q:(typeof(window.opera) !=  "undefined"),
    R:(navigator.userAgent.indexOf("MSIE") != -1) && !window.opera,
    
    
    S:(navigator.userAgent.indexOf("MSIE") != -1) && !window.opera  && (typeof(XMLHttpRequest) !=  "undefined"),
    T:((navigator.userAgent.indexOf("Gecko") != -1) && (navigator.appVersion.indexOf("AppleWebKit") == -1)),
    U:(navigator.appVersion.indexOf("AppleWebKit") != -1),
    
    V:  document.documentElement,

    W:  function(X)
   {
      if  (d.Y)
        for  (var   Z   in   d)
          if  (d[Z] ==  X)
 
 
            d.Y.aa(X,  "Spif."  +  Z);
 
      if  (X.ba)
        X.ba();
   }
};

 d["isIE"] =  d.R;
 d["isIE7"] =  d.S;
 d["isOpera"] =  d.Q;
 d["isGecko"] =  d.T;
 d["isSafari"] =  d.U;
 d["DEFAULTMORPHDURATION"] =  d.w;
 d["SUPPRESSEVENTS"] =  d.L;
 d["FIREEVENTS"] =  d.M;
 d.ca  = {
    da:"Q42",
    get:  function(name,  defaultValue)
   {
      var   ea  =  this.fa();

      return   ea[name] ||  null;
   },
    ga:  function(name,  value)
   {
      var   ea  =  this.fa();

      delete   ea[name];

      if  (value  !=  null)
        ea[name] =  value;

      this.ha(ea);
   },
    remove:  function(name)
   {
      var   ea  =  this.fa();

      delete   ea[name];

      this.ha(ea);
   },
    fa:  function()
   {
      var   c  =  document.cookie  +  "|;";
      var   ia  =  c.indexOf(this.da  +  "=");

      if  (ia  == -1)
        return  {};

      var   ja  =  c.indexOf("|;",  ia);

      var   ka  =  c.substring(ia  +  this.da.length  +  1,  ja).split("|");

      var   ea  = {};
      for  (var   i=0;  i<ka.length;  i++)
     {
        var   la  =  ka[i].split(":");
        ea[la[0]] =  unescape(la[1]);
     }
      
      return   ea;
   },
    ha:  function(ea)
   {
      var   s  =  "";
      for  (var   ma   in   ea)
        if  (ma)
          s  +=  ma  +  ":"  +  escape(ea[ma]) +  "|";

      var   na  =  new   Date();
      na.setFullYear(na.getFullYear()+1);

      var   c  =  this.da  +  "="  +  s  +  "; expires="  +  na.toGMTString() +  "; path=/;";

 
      document.cookie  =  c;
   }
};

 d["Cookies"] =  d.ca;
 d.ca["get"] =  d.ca.get;
 d.ca["set"] =  d.ca.ga;
 d.ca["remove"] =  d.ca.remove;
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 d.oa  = {
    pa:  function(qa,  delay,  X,  ra)
   {
      if  (delay  >=  0)
        return   setTimeout(this.sa(qa,  X,  ra),  delay);
      else 
     {
        qa.apply(X  ||  window,  ra  || []);
        return   null;
     }
   },
    ta:  function(qa,  ua,  X,  ra)
   {
      var   va  =  this.sa(qa,  X,  ra);
      va();
      return   setInterval(va,  ua);
   },

    sa:  function(qa,  X,  ra)
   {
      return   function()
     {
        d.wa.xa(d.j,  null,  null);
        qa.apply(X  ||  window,  ra  || []);
        d.wa.xa(d.k,  null,  null);
     };
   },

    ya:  function(za,  Aa,  Ba,  Ca,  Da)
   {
      var   Ea  = {};
      Ea.Fa  =  d.Ga.Ha(za,  Aa);
      if  (Ea.Fa)
     {
        Ea.Ia  =  d.Ja.Ka(Ea.Fa,  Aa,  Ca);
        Ea.object  =  d.Ga.Ha(Ea.Fa,  Ba);
        if  (Ea.object)
          Ea.La  =  d.Ja.Ka(Ea.object,  Ba,  Da);
     }
      return   Ea;
   },
    Ma:  function(s,  Na)
   {
      return   s?Function("a",  "b",  "c",  "d",  "e",  "return "  +  s  +  "(a, b, c, d, e);"):Na;
   },
    Oa:  function(za,  Pa,  Qa,  Ra,  Sa)
   {
      return   this.Ta(za,  Pa,  Qa,  Ra,  Sa).Ua[0];
   },
    Va:  function(za,  Pa,  Qa,  Ra,  Sa)
   {
      return   this.Ta(za,  Pa,  Qa,  Ra,  Sa).Ua;
   },
    Ta:  function(za,  Pa,  Qa,  Ra,  Sa)
   {
      var   Wa  = {
        Ua:[],
        za:null 
     };
      var   Xa;
      do 
     {
        if  (!(Xa  =  d.Ja.match(za,  Pa  +  "-[\\w-]+")))
          za  =  za.parentNode;
     }
      while  (!Xa  && !Ra  &&  za  &&  za.nodeType  ==  1);

      if  (Xa)
        for  (var   i=0;  i<Xa.length;  i++)
       {
          var   s  =  Xa[i].substring(Pa.length+1);
          if  (!Sa  || !Sa[s])
         {
            Wa.Ua.push(s);
            Wa.za  =  za;
         }
       }

      if  ((Qa  !=  null) && (Wa.Ua.length  ==  0))
        Wa.Ua[0] =  Qa;
      return   Wa;
   },
    Ya:  function(za,  Za,  _b,  Ra)
   {
      var   Xa;
      do 
     {
        Xa  =  d.Ja.match(za,  Za  +  "-?\\d+");
        za  =  za.parentNode;
     }
      while  (!Ra  &&  za  &&  za.nodeType  ==  1  && !Xa);
      return  (Xa?parseInt(Xa[0].substring(Za.length)):_b);
   },
    ab:  function(a)
   {
      var   bb  = {};
      for  (var   i=0;  i<a.length;  i++)
        bb[a[i]] =  i;
      return   bb;
   },
    cb:  function(za,  Z,  db)
   {
      var   eb  =  za.fb;
      if  (!eb)
        eb  =  za.fb  = {};

      eb[Z] =  db;
   },
    gb:  function(za,  Z)
   {
      var   eb  =  za.fb;
      if  (!eb)
        return   null;
      else 
        return   eb[Z];
   }
};

 d.oa.platform  = (d.S?"ie ie7":(d.R?"ie ie6":(d.T?"gecko":(d.Q?"opera":(d.U?"safari":"unknown")))));



 if  (!Array.prototype.push)
{
    Array.prototype.push  =  function()
   {
      for  (var   i=0;  i<arguments.length;  i++)
        this[this.length] =  arguments[i];
   };
}

 if  (!Function.prototype.apply)
{
    Function.prototype.apply  =  function(X,  ra)
   {
      X.hb  =  this;
      var   ib  =  X.hb(ra[0],  ra[1],  ra[2],  ra[3],  ra[4]);
      X.hb  =  null;
      return   ib;
   }
}

 d.W(d.oa);

 d["Utils"] =  d.oa;
 d.oa["setTimeoutHandler"] =  d.oa.pa;
 d.oa["setIntervalHandler"] =  d.oa.ta;
 d.Ga  = {
    jb:  1,
    kb:{},

    lb:  function(za)
   {
      if  (!za.id)
     {
        var   id  =  "qid_"  +  this.jb++;
        za.id  =  id;
        this.kb[id] =  true;
     }

      return   za.id;
   },

    mb:  function(za)
   {
      var   nb  = [];

      if  (za.id  && !this.kb[za.id])
        nb[0] =  za;

      var   ob  =  za.getElementsByTagName(d.f);
      var   pb  =  ob.length;
      for  (var   i=0;  i<pb;  i++)
     {
        var   za  =  ob[i];
        if  (za.id  && !this.kb[za.id])
          nb[nb.length] =  za;
     }

      return   nb;
   },
    Ha:  function(za,  qb,  rb)
   {
      while  (za  &&  za.nodeType  ==  1)
     {
        if  (d.Ja.contains(za,  qb))
          return   za;

        za  =  za.parentNode;
        if  (rb  &&  za  &&  d.Ja.contains(za,  rb))
          return   null;
     }
   },
    sb:  function(za,  qb)
   {
      var   tb  =  za.getElementsByTagName("*");
      var   ub  =  tb.length;
      for  (var   i=0;  i<ub;  i++)
        if  (d.Ja.contains(tb[i],  qb))
          return   tb[i];
   },
    getElementsByTagName:  function(za,  tagName)
   {
      var   vb  = [];
      var   wb  =  za.getElementsByTagName(tagName);
      var   xb  =  wb.length;
      for  (var   i=0;  i<xb;  i++)
        vb.push(wb[i]);

      return   vb;
   },
    getBoxObjectFor:  function(za)
   {
      if  (d.R)
     {
        var   yb  =  za.getBoundingClientRect();
        return  {
          x:  yb.left,
          y:  yb.top,
          width:  yb.right  -  yb.left,
          height:  yb.bottom  -  yb.top 
       };
     }
      else   if  (d.T)
          return za.getBoundingClientRect();
        //return   za.ownerDocument.getBoxObjectFor(za);
      else   if  (d.Q)
     {
 zb("TO DO!!!");
        Ab  = {
          y:za.offsetTop,
          height:Bb.offsetHeight 
       };
     }
   },

    Cb:  function(za)
   {
      var   value  =  za.value;
      switch  (za.nodeName)
     {
        case   "SELECT":
          value  =  za.options[za.selectedIndex].value;
          break;
        case   "INPUT":
          switch  (za.type)
         {
            case   "checkbox":
              value  =  za.checked;
              break;
         }
          break;
     }
      
      return   value;
   },

    Db:  function(Eb,  Fb)
   {
      if  (d.R)
        return   Eb.contains(Fb);

      while  (Fb)
     {
        if  (Eb  ==  Fb)
          return   true;
        else 
          Fb  =  Fb.parentNode;
     }

      return   false;
   },
    Gb:  function(Hb,  Ib)
   {
      if  (!Hb  || !Ib  ||  Hb  ==  Ib)
        return   Hb  ||  Ib;

      while  (Hb)
     {
        if  (this.Db(Hb,  Ib))
          return   Hb;
        Hb  =  Hb.parentNode;
     }
   },
    Jb:  function(za)
   {
      if  (d.R)
        return   za.style.cssText;
      else 
        return   za.getAttribute("style");
   },
    Kb:  function(za,  s)
   {
      if  (d.R)
        za.style.cssText  =  s;
      else 
        za.setAttribute("style",  s);
   }
};

 d.W(d.Ga);

 d["HtmlDomUtils"] =  d.Ga;
 d.Ga["acquireIdForHtmlElement"] =  d.Ga.lb;
 
 d.Ga["getAncestorWithClassName"] =  d.Ga.Ha;



























































 d.Ja = {
   Lb: /\s+/,

   Mb: {},
   Nb: {},
   Ob: function(qb, Pb, ua) {
     this.Nb[qb] = {
       Pb: Pb,
       Qb: "(\\b" + Pb.join("-" + qb) + "-" + qb + "\\b|\\b" + qb + "\\b)",
       ua: ua || 1.1 * d.w
     };
   },

   contains: function(za, qb) {
     return this.Rb(za.className, qb);
   },
   Rb: function(s, qb) {

     return !!(s && s.match(this.Sb(qb)));
   },
   match: function(za, qb) {
   if (za.className)
     return za.className.match(this.Sb(qb));
   },
   add: function(za, Tb, Ub) {
     if (!this.contains(za, Tb))
       if (this.Nb[Tb])
       this.Vb(za, null, Tb, 0, Ub);
     else {
       var Wb = za.className;
       var Xb = Wb + d.g + Tb;
       this.Yb(za, Wb, Xb, Ub);
     }
   },
   replace: function(za, Zb, Tb, Ub, _c) {
     if (this.contains(za, Zb)) {
       if (this.Nb[Zb])
         Zb = this.Nb[Zb].Qb;

       if (!_c && this.Nb[Tb])
         this.Vb(za, Zb, Tb, 0, Ub);
       else
         this.Yb(za, za.className, this.ac(za.className, Zb, Tb), Ub);
     }
     else
       this.add(za, Tb, Ub);
   },
   ac: function(s, bc, cc) {
     var dc = s.replace(this.Sb(bc), cc);
     if (!dc.match(this.Sb(cc)))
       dc += d.g + cc;

     return dc;
   },
   ec: function(za, qb, fc, Ub) {
     if (fc)
       this.add(za, qb, Ub);
     else
       this.remove(za, qb, Ub);
   },
   gc: function(za, hc, ic, Ub, _c) {
     var jc = this.contains(za, hc);
     this.replace(za, (jc ? hc : ic), (jc ? ic : hc), Ub, _c);
   },
   remove: function(za, Zb, Ub) {
     if (this.Nb[Zb])
       Zb = this.Nb[Zb].Qb;

     this.Yb(za, za.className, za.className.replace(this.Sb(Zb), ""), Ub);
   },
   ga: function(za, Xb, Ub) {
     this.Yb(za, za.className, Xb, Ub);

     var qb;
     var kc = Xb.split(this.Lb);
     for (var i = 0; i < kc.length; i++, qb = kc[i])
       if (this.Nb[qb]) {
       this.Vb(za, qb, qb, 0, Ub);
       return;
     }
   },

   lc: new RegExp("(-[^_-]+)|(_-\\d+)|(_\\w+)", "g"),
   mc: {
     "delay": "int",
     "delayOn": "int",
     "delayOff": "int",
     "duration": "int",
     "delta": "int",
     "max": "int",
     "interval": "int",
     "step": "int",
     "onBefore": "function",
     "onFinish": "function",
     "props": "array",
     "classes": "array",
     "limitmorphto": "array",
     "replace": "array",
     "target": "array"
   },
   Ka: function(za, nc, oc) {
     var pc = null;
     var qc = this.Sb(nc + "\\b-?([\\w\\-\\_]*)\\b");

     if (!za.className)
       return;
       
     var matches = za.className.match(qc);
     if (matches) {
       pc = {};
       if (oc)
         for (var ma in oc)
         pc[ma] = oc[ma];

       pc.rc = matches[0].split("-")[0];

       for (var sc = 0; sc < matches.length; sc++) {
         var ea = matches[sc].match(this.lc);
         if (ea)
           for (var i = 0; i < ea.length; i++) {
           var Z = ea[i].substring(1);
           if (i < ea.length - 1 && ea[i + 1].charAt(0) == "_") {
             var db = ea[i++ + 1].substring(1);
             switch (this.mc[Z]) {
               case "function":
                 db = d.oa.Ma(db);
                 break;
               case "int":
                 db = parseInt(db);
                 break;
               case "array":
                 db = db.split("_");
                 break;
             }
             pc[Z] = db;
             if (!pc.action)
               pc.action = Z;
           }
           else {
             pc[Z] = true;
             pc.action = Z;
           }
         }
       }
     }

     return pc;
   },



   tc: null,
   uc: function() {
     this.tc = {
       vc: null,
       setData: []
     };
   },

   wc: function() {
     var xc = this.tc;

     this.tc = null;

     if (xc.setData.length > 0) {
       var yc = this.zc(xc.Ac, xc.vc.className, false);

       d.wa.xa(d.l, xc.vc, yc);

       for (var i = 0; i < xc.setData.length; i++) {
         var Bc = xc.setData[i];
         this.Yb(Bc.za, Bc.Wb, Bc.Xb, d.M, true);
       }

       d.wa.xa(d.m, xc.vc, yc);
     }
   },

   Cc: function(za, pc) {
     for (var name in pc)
       switch (name) {
       case "add":
         this.add(za, pc[name]);
         break;
       case "remove":
         this.remove(za, pc[name]);
         break;
       case "replace":
         this.replace(za, pc[name][0], pc[name][1]);
         break;
       case "set":
         this.ga(za, pc[name]);
         break;
       case "empty":
         this.ga(za, "");
         break;
     }
   },
   Sb: function(qb) {
     return this.Mb[qb] || (this.Mb[qb] = new RegExp("(?:^|\\b)" + qb + "(?:\\b|$)", "g"));
   },
   Yb: function(za, Wb, Xb, Ub, Dc) {
     Xb = Xb.replace(/^\s+|\s+$/g, "");
     if (Xb != Wb) {
       if (this.tc) {
         var Ec = d.Ga.Gb(this.tc.vc, za);
         if (Ec != this.tc.vc) {
           this.tc.vc = Ec;
           this.tc.Ac = Ec.className;
         }

         this.tc.setData.push(
           {
             za: za,
             Wb: Wb,
             Xb: Xb
           }
         );
       }
       else {
         if (!Ub) {
           var Fc = this.zc(Wb, Xb, Dc);
           d.wa.xa(d.l, za, Fc);
         }
         za.className = Xb;
         if (!Ub)
           d.wa.xa(d.m, za, Fc);

         if (d.R) {




           if (za.getAttribute("tabIndex", 2) == 0) {
             za.tabIndex = -1;
             setTimeout(function() { za.tabIndex = 0; }, 0);
           }
         }
       }
     }
   },
   Vb: function(za, Zb, qb, Gc, Ub) {
     var data = this.Nb[qb];
     var Pb = data.Pb;

     var Tb = Pb[Gc] + "-" + qb;

     d.oa.cb(za, d.w, data.ua);

     if (Zb && this.contains(za, Zb))
       this.replace(za, Zb, Tb, Ub, true);
     else
       this.add(za, Tb, Ub, true);

     var Hc = this;
     if (Gc < Pb.length - 1)
       d.oa.pa(function() { Hc.Vb(za, Tb, qb, Gc + 1, Ub); }, data.ua);
     else
       d.oa.pa(function() { if (Hc.contains(za, Tb)) Hc.replace(za, Tb, qb, Ub, true); }, data.ua);
   },

   zc: function(Wb, Xb, Dc) {
     var Ic = Wb.split(this.Lb);
     var Jc = Xb.split(this.Lb);

     var Kc = {};
     for (var i = 0; i < Ic.length; i++) {
       Kc[Ic[i]] = 1;

       var Lc = Ic[i].split(/[-_]/);
       for (var Mc = 0; Mc < Lc.length; Mc++)
         Kc[Lc[Mc]] = 1;
     }

     var addCNs = [];
     for (var i = 0; i < Jc.length; i++) {
       if (!Kc[Jc[i]])
         addCNs.push(Jc[i]);
       var Nc = Jc[i].split(/[-_]/);
       for (var Mc = 0; Mc < Nc.length; Mc++)
         if (!Kc[Nc[Mc]])
         addCNs.push(Nc[Mc]);
     }


     var delCNs = [];
     for (var i = 0; i < Ic.length; i++)
       if (!addCNs[Ic[i]])
       delCNs.push(Ic[i]);

     return { fromValue: Wb, toValue: Xb, delCNs: delCNs, addCNs: addCNs, Dc: Dc };
   }
 };

 d.W(d.Ja);

 d["ClassNameAbstraction"] =  d.Ja;
 d.Ja["addClassNameSequence"] =  d.Ja.Ob;
 d.Ja["contains"] =  d.Ja.contains;
 d.Ja["add"] =  d.Ja.add;
 d.Ja["replace"] =  d.Ja.replace;
 d.Ja["swap"] =  d.Ja.gc;
 d.Ja["toggle"] =  d.Ja.ec;
 d.Ja["remove"] =  d.Ja.remove;
 d.Ja["set"] =  d.Ja.ga;
 
 
 

 
 
 
 
 
 
 
 
 

 
 
 

 
 
 
 
 
 
 

 d.Oc  = {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

    Pc:  false,
    Qc: {},
    Rc:{},
    
    Sc:  function(Tc,  Uc,  qa,  X)
   {
      var   Vc  = {qa:qa,  X:X};
      var   Wc  =  d.Ga.lb(Tc) +  "-"  +  Uc;

      var   Xc  =  this.Qc[Wc];
      if  (this.Rc[Wc] ==  Tc  &&  Xc)
        Xc.push(Vc);
      else 
     {
        this.Rc[Wc] =  Tc;
        Xc  =  this.Qc[Wc] = [Vc];

        var   va  =  function(Yc)
       {
          
          
          
          
          if  ((typeof(d) !=  "undefined") && (!d.T  ||  document.defaultView))
         {
 

            
            d.wa.xa(d.j,  Yc);

            Yc  =  d.Oc.Zc(Yc);

            
            
            if  (Yc.type  ==  d.D  &&  d.T  &&  Yc._d)
              return   false;

            var   ib  =  false;

            var   ra  = [Yc,  Tc];
            for  (var   i=0;  i<Xc.length;  i++)
              ib  =  Xc[i].qa.apply(Xc[i].X  ||  Tc,  ra) &&  ib;

            if  (Yc.ad  ==  true)
              d.Oc.bd(Yc);

            
            d.wa.xa(d.k,  Yc);

            return   ib;
         }
       };
        if  (d.Y)
       {
          var   X  = {  cd:va  };
          d.Y.ed(X,  "eventHandler",  "Spif.DOMEvents."  +  Uc);
          va  =  X.cd;
       }

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

        if  (Tc.addEventListener)
          Tc.addEventListener(Uc,  va,  false);
        else 
       {
          if  (Uc  ==  "DOMMouseScroll")
            Uc  =  "mousewheel";
          Tc.attachEvent("on"  +  Uc,  va);
       }
     }
   },

    fd:  function()
   {
      this.ad  =  true;
   },
    bd:  function(Yc)
   {
      Yc.preventDefault();
      Yc.stopPropagation();

      if  (d.U  &&  this.type  ==  d.D)
     {
        var   za  =  Yc.subject;
        while  (za  &&  za.nodeName  !=  "A")
          za  =  za.parentNode;

        if  (za)
       {
          za.gd  =  za.href;
          za.href  =  "javascript://";
          setTimeout(function(){  za.href  =  za.gd; },  10);
       }
     }
   },
    hd:  function()
   {
      this.returnValue  =  false;
   },
    jd:  function()
   {
      this.cancelBubble  =  true;
   },

    Zc:  function(Yc)
   {
 
      if  (d.R)
     {
        Yc.subject  =  Yc.srcElement;
        Yc.preventDefault   =  this.hd;
        Yc.stopPropagation  =  this.jd;
     }
      else 
     {
        Yc.subject  =  Yc.target  ||  Yc.currentTarget;
        if  (Yc.subject  &&  Yc.subject.nodeType  ==  3)
          Yc.subject  =  Yc.subject.parentNode;
     }

      Yc.cancel  =  this.fd;

      switch  (Yc.type)
     {
        case   d.D:
        case   "mousedown":
        case   "mouseup":
        case   "mousemove":
          Yc.kd   = (d.R||d.U?Yc.button  ==  1:Yc.button  ==  0);
          Yc._d  =  Yc.button  ==  2;
          break;
        case   d.F:
        case   "keyup":
        case   d.G:
          if  (d.R  &&  Yc.subject.isContentEditable)
         {
            var   ld  =  document.selection.createRange();
            if  (ld.length)
              Yc.subject  =  ld.item(0);
            else 
              Yc.subject  =  ld.parentElement();
         }

          if  (d.T  &&  Yc.subject  ==  document.documentElement)
            
            
            Yc.subject  =  document.body;
          break;
        case   "mousewheel":
          if  (d.R)
            Yc.detail  = -Yc.wheelDelta/20;
          break;
     }

      return   Yc;
   }
};

 d["DOMEvents"] =  d.Oc;
 d.Oc["attach"] =  d.Oc.Sc;
 d.wa  = {
    md: {},
    nd:  function(Uc,  qa,  X)
   {
      var   od  =  this.md[Uc] =  this.md[Uc] || [];

      od[od.length] = {qa:qa,  X:X};
   },
    xa:  function(Uc,  subject,  ea)
   {
      var   ib  =  true;

      var   od  =  this.md[Uc];
      if  (od)
     {
        var   Yc  =  ea  || {};
        Yc.type  =  Uc;
        Yc.subject  =  subject;

        for  (var   i=od.length-1;  i>=0;  i--)
          ib  = (od[i].qa.apply(od[i].X  ||  subject, [Yc]) !=  false) &&  ib;
     }
    
      return   ib;
   }
};

 d["CustomEvents"] =  d.wa;
 d.wa["listen"] =  d.wa.nd;
 d.wa["fire"] =  d.wa.xa;
 
 
 
 
 
 
 
 
 


 d.pd  = {
    ba:  function()
   {
      d.wa.nd(d.m,  this.qd,  this);
      d.wa.nd(d.o,  this.rd,  this);
      d.Oc.Sc(document.documentElement,  "DOMMouseScroll",    this.sd,  this);
   },
    qd:  function(Yc)
   {
      if  (Yc.addCNs.length  >  0  &&  d.wa.xa(d.r,  Yc.subject))
        this.ud(Yc.subject,  Yc.addCNs);
   },
    rd:  function(Yc)
   {
      if  (d.wa.xa(d.r,  Yc.subject))
        this.ud(Yc.subject, [d.C]);
   },
    ud:  function(vd,  wd,  context)
   {
      var   xd  =  false;

      
      for  (var   i=0;  i<wd.length;  i++)
        d.wa.xa("on"  +  wd[i],  vd);

      var   yd  =  "\\bon"  +  wd.join("\\b|\\bon") +  "\\b";
      for  (var   zd  =  vd.firstChild;  zd;  zd  =  zd.nextSibling)
        if  (zd.nodeName  ==  "A"  &&  d.Ja.contains(zd,  yd))
       {
          d.wa.xa(d.v,  zd, {  context:context  });
          xd  =  true;
       }

      return   xd;
   },
    sd:  function(Yc)
   {
      var   Ad  =  false;
      var   Uc  = ["mousescroll"  + (Yc.detail>0?"down":"up")];
      for  (var   za  =  Yc.subject;  za;  za  =  za.parentNode)
        Ad  =  Ad  ||  this.ud(za,  Uc,  null);

      if  (Ad)
        Yc.cancel();
   }
};

 d.W(d.pd);
 
 
 
 
 
 
 
 
 
 
 
 
 

 d.Bd  = {
    Cd:[],
    Dd:  null,
    Ed:{},
    Fd:{},
    Gd:  null,
    Hd:  null,
    Id:  false,
    ba:  function()
   {
      d.Oc.Sc(document.documentElement,  d.D,    this.Jd,  this);

      
      
      
      d.Oc.Sc(document.documentElement, (d.R?d.F:d.G),  this.Jd,  this);
   },
    Kd:  function(qb,  qa,  X)
   {
      this.Ld(qb,  qa,  X,  true);
   },
    Md:  function(qb,  qa,  X)
   {
      this.Ld(qb,  qa,  X,  false);
      this.Id  =  true;
   },
    Ld:  function(qb,  qa,  X,  Nd)
   {
      this.Cd[this.Cd.length] =  qb;
      this.Ed[qb] = {  qa:qa,  X:X  };
      this.Fd[qb] =  Nd;

      this.Cd  =  this.Cd.sort().reverse();

      this.Dd  =  new   RegExp("(\\b"  +  this.Cd.join("\\b)|(\\b") +  "\\b)|(\\b[\\w\\-]+\\b|\\s+)",  "g");
   },
    Jd:  function(Yc)
   {
      this.Hd  = (Yc.type  ==  d.D  ||  Yc.keyCode  ==  13  ||  Yc.keyCode  ==  32);

      if  (!this.Id  && !this.Hd)
        return;

      this.Gd  =  Yc;
      var   ob  = [];

      for  (var   za  =  Yc.subject;  za  &&  za.nodeType  ==  1;  za  =  za.parentNode)
        ob[ob.length] =  za;

      for  (var   i=0;  i<ob.length;  i++)
     {
        this.Od  =  ob[i];
        if  (this.Od.className)
          this.Od.className.replace(this.Dd,  this.Pd);
     }
   },
    Pd:  function()
   {
      if  (!arguments[arguments.length-3])
     {
        var   Hc  =  d.Bd;
        for  (var   i=1;  i<arguments.length-3;  i++)
          if  (arguments[i])
         {
            var   qb  =  Hc.Cd[i-1];
            if  (Hc.Hd  || !Hc.Fd[qb])
           {
              if  (d.wa.xa(d.r,  Hc.Od))
             {
                var   qa  =  Hc.Ed[qb];
                qa.qa.apply(qa.X  ||  Hc.Od, [Hc.Od,  arguments[i],  Hc.Gd]);
             }
              return;
           }
         }
     }
   }
};

 d.W(d.Bd);
 
 
 


 d.Qd  = {
    Rd:[],
    Sd:"",
    Td:{},
    Ud:{},
    Vd:[],

    ba:  function()
   {
      d.Oc.Sc(document.documentElement,  d.D,      this.Wd,  this);
      d.Oc.Sc(document.documentElement,  "dblclick",      this.Wd,  this);
      d.Oc.Sc(document.documentElement,  "keyup",   this.Xd,  this);
      d.wa.nd(d.v,  this.Yd,  this);
   },
    Zd:  function(_e,  X)
   {
      this.Vd.push({qa:_e,  X:X});
   },
    ae:  function(be,  ce,  _e,  X)
   {
      var   de  =  "("  +  ce.join("|") +  ")";
      for  (var   i=0;  i<be.length;  i++)
     {
        var   nc  =  be[i];
        this.Rd[this.Rd.length] =  nc;
        this.Td[nc] =  de;
        this.Ud[nc] = {  qa:_e,  X:X};
     }

      this.Sd  =  "(\\b"  +  this.Rd.join("\\b|\\b") +  "\\b)";
   },
    Wd:  function(Yc)
   {
      this.Yd(Yc);
   },
    Xd:  function(Yc)
   {
      if  (Yc.keyCode  ==  32  ||  Yc.keyCode  ==  13)
        this.Yd(Yc);
   },
    Yd:  function(Yc)
   {
 
      var   be;
      var   za  =  Yc.subject;

      
      while  (za  &&  za.nodeType  ==  1)
     {
        
        
        if  (Yc.type  ==  d.G  &&  za.nodeName  ==  "A")
          return;

        if  ((be  =  d.Ja.match(za,  this.Sd)) &&  d.wa.xa(d.r,  za))
       {
          var   ee  = {};

          for  (var   i=0;  i<be.length;  i++)
         {
            var   nc  =  be[i];
            if  (nc  && !ee[nc])
           {
              var   fe  =  d.Ja.Ka(za,  nc);
              if  (
               (!fe["require"] ||  d.Ga.Ha(za,  fe["require"]))
               &&
               (!fe["disallow"] || !d.Ga.Ha(za,  fe["disallow"]))
             )
             {
                var   ge  =  this.he(za,  nc,  Yc.context);
                if  (!ge  || !ge.za  || !d.wa.xa(d.r,  ge.za))
                  continue;

                var   ie  =  d.Ja.Ka(ge.za,  ge.je);
                if  (
                  ie 
                 &&
                 (!ie["require"] ||  d.Ga.Ha(za,  ie["require"]))
                 &&
                 (!ie["disallow"] || !d.Ga.Ha(za,  ie["disallow"]))
               )
                  ee[nc] = {
                    ke:  this.Ud[nc],
                    ge:  ge,
                    fe:  fe,
                    ie:  ie 
                 };
           }
           }
         }

          for  (nc   in   ee)
         {
            var   le  =  ee[nc];
            d.oa.pa(this.me(Yc,  za,  nc,  le),  1*le.fe.delay||-1);
         }
       }

        if  (za.nodeName  ==  "A")
       {
          for  (var   i=0;  i<this.Vd.length;  i++)
         {
            var   qa  =  this.Vd[i];
            qa.qa.apply(qa.X  ||  za, [za,  Yc]);
         }
          
          
          if  (Yc.cancel  &&  be  &&  be.length  >  0  &&  za.getAttribute("href",  2).charAt(0) ==  "#")
            Yc.cancel();
       }

        za  =  za.parentNode;
     }
   },

    me:  function(Yc,  za,  nc,  le)
   {
      return   function()
     {
        le.ke.qa.apply(le.ke.X  ||  za, [za,  nc,  le.ge.za,  le.ge.je,  Yc,  le.fe,  le.ie]);
     };
   },

    he:  function(ne,  nc,  context)
   {
      var   oe  =  this.pe(ne,  nc,  context);

      if  (oe)
     {
        var   qe  =  d.Ja.match(oe,  this.Td[nc]);
        return  {  za:oe,  je:(qe?qe[0]:null) };
     }
   },
    pe:  function(ne,  nc,  context)
   {
      var   re  =  ne.href;
      if  (re)
        var   se  =  re.split("#")[1];
      
      if  (se)
        return   document.getElementById(se);

      
      for  (var   za  =  context  ||  ne;  za  !=  document.documentElement;  za  =  za.parentNode)
        if  (d.Ja.match(za,  this.Td[nc]))
          return   za;
   }
};

 d.W(d.Qd);
 
 
 
 
 
 
 
 
 
 
 

 d.wa.nd(
    d.r,
    function(Yc)
   {
      return  !d.Ga.Ha(Yc.subject,  "(^|\\s)disabled(\\s|$)");
   }
);
(function(){
 d.te  = {
    ue:"exclusive-",
    ve:"(allexclusive-|exclusive-)",
    we:"delayexclusive",
    xe:"exclusive-reset",

    ye:1,
    ze:{},
    Ae:{},
    Be:{},
    Ce:{},
    De:{},
    Ee:{},
    Fe:{},
    Ge: {},

    ba:  function()
   {
      d.wa.nd(d.j,  this.He,  this);
      d.wa.nd(d.m,  this.qd,  this);
   },

    Ie:  function(be,  Je,  Ke,  Le)
   {
      var   id  =  this.ye++;
      var   Me  =  Je[Je.length  -  1];
      for  (var   i=0;  i<be.length;  i++)
     {
        var   nc  =  be[i];
        var   Ne  =  Je[i];

        this.Be[Me] =  Ne;
        this.Ce[Ne] =  Me;

        Me  =  Ne;

        this.ze[nc] =  Ne;
        this.Ae[Ne] =  nc;
        this.De[nc] =  id;
     }

      if  (Ke)
     {
        for  (var   i=0;  i<Ke.length;  i++)
       {
          be[be.length] =  Ke[i];
          this.Ee[Ke[i]] =  true;
          this.ze[Ke[i]] =  Je[0];
       }
     }
      if  (Le)
     {
        for  (var   i=0;  i<Le.length;  i++)
       {
          be[be.length] =  Le[i];
          this.Fe[Le[i]] =  true;
          this.ze[Le[i]] =  Je[0];
       }
     }

      d.Qd.ae(be,  Je,  this.Oe,  this);
   },

    He:  function()
   {
      this.Ge  = {};
   },
    qd:  function(Yc)
   {
      var   Pe  = [];

      for  (var   i=0;  i<Yc.addCNs.length;  i++)
        this.Qe(Yc.subject,  Yc.addCNs[i],  Pe);

      for  (var   i=Pe.length-1;  i>=0;  i--)
        this.Re(Pe[i]);
   },
    Oe:  function(ne,  nc,  oe,  Se)
   {
      var   Pe  = [];
      this.Te(Pe,  nc,  oe,  Se);

      d.Ja.uc();
      for  (var   i=Pe.length-1;  i>=0;  i--)
        this.Re(Pe[i]);
      d.Ja.wc();
   },     
    Te:  function(Pe,  nc,  oe,  Se)
   {
      var   Ue  =  this.ze[nc];

      if  (this.Ee[nc])
     {
        Ue  =  this.Be[Se];
        nc  =  this.Ae[Ue];
     }
      else   if  (this.Fe[nc])
     {
        Ue  =  this.Ce[Se];
        nc  =  this.Ae[Ue];
     }

      if  (!d.Ja.contains(oe,  Ue))
     {
        Pe[Pe.length] = {
          nc:nc,
          oe:oe,
          Ve:Se,
          Ue:Ue,
          delay:-1 
       };

        this.Qe(oe,  Ue,  Pe);
     }
   },

    Qe:  function(oe,  Ue,  Pe)
   {
      var   We,  Xe;
      
      if  (We  =  d.Ga.Ha(oe,  this.ve  +  Ue,  this.xe))
        if  (d.Ja.contains(We,  this.ue  +  Ue))
          Xe  =  oe.parentNode.childNodes;
        else 
          Xe  =  d.Ga.getElementsByTagName(We,  d.f);
      
      if  (Xe)
     {
        var   Ye  =  this.Be[Ue];
        var   Ze  =  this.Ae[Ye];

        var   _f  =  Xe.length;
        for  (var   i=0;  i<_f;  i++)
       {
          var   af  =  Xe[i];

          if  (af.nodeType  ==  1  &&  af  !=  oe  &&  d.Ja.contains(af,  Ue))
            if  (d.wa.xa(d.r,  af))
           {
              if  (Pe.length  >  0  &&  Pe[Pe.length-1].delay  == -1)
                Pe[Pe.length-1].delay  =  d.oa.Ya(oe.parentNode,  this.we, -1);

              this.Te(Pe,  Ze,  af,  Ue);
           }
       }
     }
   },
    
    Re:  function(bf)
   {
      var   cf  =  d.Ga.lb(bf.oe) +  "-"  +  this.De[bf.nc];
      if  (!this.Ge[cf])
     {
        this.Ge[cf] =  true;
        
        d.oa.pa(
          function()
         {
            
            d.Ja.replace(bf.oe,  bf.Ve,  bf.Ue,  d.M);
         },
          bf.delay 
       );
   }
   }
};

 d.W(d.te);

 d["Behaviors"] =  d.te;
 d.te["addStateSequence"] =  d.te.Ie;

 
 d.te.Ie(["collapser",  "expander"],    ["collapsed",  "expanded"],   ["expandedToggle",  "expandcollapser"]);
 d.te.Ie(["opener",     "closer"],      ["open",       "close"],      ["openToggle"]);
 d.te.Ie(["selector",   "unselector"],  ["selected",   "unselected"], ["selectedToggle"]);
 d.te.Ie(["shower",     "hider"],       ["shown",      "hidden"],     ["shownToggle",  "showswitch"]);
 d.te.Ie(["focuser",    "blurrer"],     ["focus",      "blur"],       ["focusToggle"]);
 d.te.Ie(["onswitch",   "offswitch"],   ["on",         "off"],        ["onToggle"]);
 d.te.Ie(["enabler",    "disabler"],    ["enabled",    "disabled"],   ["enabledToggle"]);
 d.te.Ie(["checker",    "unchecker"],   ["checked",    "unchecked"],  ["checkedToggle"]);
})();
 d.Qd.ae(
   ["classchanger"],
   [],
    function(ne,  x,  oe,  Se,  Yc,  fe,  ie)
   {
      d.oa.pa(
        function()
       {
          d.Ja.Cc(oe,  fe);
       },
        fe["delay"]
     );
   }
);
 d.Qd.ae(
   ["execute"],
   [],
    function(ne,  nc,  oe,  Se,  Yc,  fe,  ie)
   {
      var   ra  =  fe[fe.action];
      ra  = (ra!=true?ra.split("_"):null);
      d.oa.Ma(fe.action)(ne,  oe,  ra);
   }
);
 d.df  =
{
    ef:  "activation-inert",
    ff:  "delayOn",
    gf:  "delayOff",
    hf:  "delaySwitch",
    jf: [],
    kf: [],
    lf:{},
    mf: [],
    nf: {},
    of: {},
    pf:  null,

    qf: {},
    rf: {},
    sf: {},
    tf: {},
    uf: {},
    vf: {},

    ba:  function()
   {
      
      this.wf("unhover",  "hover");
      this.wf("mouseout",  "mouseover");
      this.wf("neverhovered",  "");

      
      this.xf("inactive",  "active",  "activator",  "inactivator");
      this.xf("blurred",  "focused",  "focuser",  "blurrer");

      d.Oc.Sc(document.documentElement,  "mouseover",  this.yf,  this);

      d.Oc.Sc(document.documentElement,  d.D,  this.Yd,  this);
      d.Oc.Sc(document.documentElement,  "contextmenu",  this.Yd,  this);
      d.Oc.Sc(document.documentElement,  "keyup",  this.Yd,  this);

      d.wa.nd(d.m,  this.qd,  this);
   },
    wf:  function(zf,  Af)
   {
      if  (zf)
     {
        this.jf.push(zf);
        this.lf[zf] =  Af;
     }
      if  (Af)
     {
        this.jf.push(Af);
        this.lf[Af] =  Af;
     }
      this.Bf  =  "("  +  this.jf.join("\\b|\\b") +  ")";
      this.of[zf] =  Af;
      this.of[Af] =  zf;
   },
    xf:  function(Cf,  Df,  Ef,  Ff)
   {
      if  (Cf)
        this.mf.push(Cf);
      if  (Df)
     {
        this.lf[Df] =  Df;
        if  (Cf)
          this.lf[Cf] =  Df;
        this.kf.push(Df);
     }
      this.Gf  =  "("  +  this.kf.join("\\b|\\b") +  ")";
      this.Hf  =  "("  +  this.mf.join("\\b|\\b") +  ")";
      this.If  =  "("  +  this.kf.join("\\b|\\b") +  "\\b|\\b"  +  this.mf.join("\\b|\\b") +  ")";
      this.of[Cf] =  Df;
      this.of[Df] =  Cf;

      if  (Ef  &&  Ff)
     {
        this.nf[Ef] =  Ef;
        d.Qd.ae([Ef,  Ff], [Df,  Cf],  this.Jf,  this);
     }
   },

    Jf:  function(ne,  nc,  oe,  Se)
   {
      var   Kf  =  d.Ga.lb(oe);
      var   pc  =  d.Ja.Ka(oe,  this.If);
      var   data  = {  za:oe,  pc:pc  };
      if  (this.nf[nc])
        this.Lf(Kf,  data,  this.uf,  this.tf,  this.vf);
      else 
     {
        pc.rc  =  this.of[pc.rc];
        this.Mf(Kf,  data,  this.uf,  this.tf,  this.vf);
     }
   },

    yf:  function(Yc)
   {
      this.Nf(Yc,  this.Bf,  this.rf,  this.qf,  this.sf);
   },

    Yd:  function(Yc)
   {
      var   za  =  Yc.subject;
      
      if  (za  !=  this.pf)
     {
        this.pf  =  za;

        if  (!d.Ga.Ha(za,  this.ef))
       {
          this.Nf(
            Yc,
            this.If,
            this.uf,
            this.tf,
            this.vf,
            d.Ga.Ha(za,  this.ef) !=  null,
            Yc.ctrlKey  ||  d.Ga.Ha(za,  this.ef) !=  null,
            d.Ga.Ha(za,  "activation-box")
         );

          d.wa.xa("afterActivationChange",  Yc.subject);
       }
     }
   },

    qd:  function(Yc)
   {
      if  (!d.Ja.Rb(Yc.fromValue,  this.Gf) &&  d.Ja.Rb(Yc.toValue,  this.Gf))
        
        this.Yd(Yc);
      else   if  (d.Ja.Rb(Yc.fromValue,  this.Gf) && !d.Ja.Rb(Yc.toValue,  this.Gf))
     {
        var   Kf  =  d.Ga.lb(Yc.subject);
        delete   this.qf[Kf];
     }
   },

    Nf:  function(Yc,  Of,  Pf,  Qf,  Rf,  Sf,  Tf,  Uf)
   {
      var   Vf  = {};

 
 
      var   za  =  Yc.subject;
      while  (za  &&  za.nodeType  ==  1)
     {
        var   pc  =  d.Ja.Ka(za,  Of);
        if  (
          pc 
         && (!pc["require"]  ||   d.Ga.Ha(za,  pc["require"]))
         && (!pc["disallow"] || !d.Ga.Ha(za,  pc["disallow"]))
       )
          Vf[d.Ga.lb(za)] = {  za:za,  pc:pc  };

        za  =  za.parentNode;
     }   

      this.Wf  =  false;

 
 
      if  (!Tf)
        for  (var   Kf   in   Qf)
          if  (!Vf[Kf] && (!Uf  ||  d.Ga.Db(Uf,  Qf[Kf].za)))
            this.Mf(Kf,  Qf[Kf],  Pf,  Qf,  Rf);

      if  (!Sf)
        for  (var   Kf   in   Vf)
          if  (!Qf[Kf] && (!Uf  ||  d.Ga.Db(Uf,  Vf[Kf].za)))
            this.Lf(Kf,  Vf[Kf],  Pf,  Qf,  Rf);
   },
    
    Lf:  function(Kf,  data,  Pf,  Qf,  Rf)
   {
 
      if  (!Qf[Kf] &&  d.wa.xa(d.r,  data.za))
     {
        if  (Rf[Kf])
          this.Xf(Kf,  Rf);
        else 
       {
          var   delay  = (this.Wf?data.pc[this.hf]:0) ||  data.pc[this.ff];
          if  (delay)
         {
            Pf[Kf] =  data;
            data.Yf  =  d.oa.pa(this.Zf,  delay,  this, [Kf,  data,  Pf,  Rf]);
         }
          else 
            this._g(Kf,  data,  Rf);
       }
        Qf[Kf] =  data;
     }
   },
    Mf:  function(Kf,  data,  Pf,  Qf,  Rf)
   {
 
      if  (Qf[Kf] &&  d.wa.xa(d.r,  data.za))
     {
        if  (Pf[Kf])
          this.ag(Kf,  Pf[Kf],  Pf,  Qf);
        else 
       {
          this.Wf  =  true  &&  data.pc[this.hf];
          if  (data.pc[this.gf])
         {
            Rf[Kf] =  data;
            data.Yf  =  d.oa.pa(this.bg,  data.pc[this.gf],  this, [Kf,  Rf]);
         }
          else 
            this.cg(Kf,  data);

          delete   Qf[Kf];
       }
     }
   },
    ag:  function(Kf,  data,  Pf,  Qf)
   {
      clearTimeout(data.Yf);
      delete   Pf[Kf];
      delete   Qf[Kf];
   },
    Zf:  function(Kf,  data,  Pf,  Rf)
   {
      delete   Pf[Kf];
      this._g(Kf,  data,  Rf);
   },
    _g:  function(Kf,  data,  Rf)
   {
      d.Ja.replace(data.za,  this.of[this.lf[data.pc.rc]],  this.lf[data.pc.rc]);

      var   We  =  d.Ga.Ha(data.za,  "exclusive"  +  this.of[data.pc.rc]);
      for  (var   Kf   in   Rf)
        if  (We  &&  d.Ga.Ha(Rf[Kf].za,  "exclusive"  +  this.of[data.pc.rc]) ==  We)
       {
          this.cg(Kf,  Rf[Kf]);
          this.Xf(Kf,  Rf);
       }
   },
    bg:  function(Kf,  Rf)
   {
      this.cg(Kf,  Rf[Kf]);
      delete   Rf[Kf];
   },
    Xf:  function(Kf,  Rf)
   {
      clearTimeout(Rf[Kf].Yf);
      delete   Rf[Kf];
   },
    cg:  function(Kf,  data)
   {
      d.Ja.replace(data.za,  this.lf[data.pc.rc],  this.of[this.lf[data.pc.rc]]);
   }
};

 d.W(d.df);

 
 
 
 

 

 d.dg  = {
    eg:1,
    fg:2,
    gg:3,
    hg:4,
    ig:5,
    jg:6,
    kg:7,
    lg:8,
    mg:9,
    ng:null,
    ba:  function()
   {
      if  (d.R)
     {
        this.og  =  this.pg;
        this.qg  =  this.rg;
     }
      d.dg["getRawComputedStyleProperty"] =  d.dg.og;

      this.ng  = {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
        "borderWidth":this.fg,
        "borderTopWidth":this.fg,
        "borderRightWidth":this.fg,
        "borderBottomWidth":this.fg,
        "borderLeftWidth":this.fg,
        "width":this.gg,
        "height":this.gg,
        "scrollTop":this.hg,
        "scrollLeft":this.hg,
        "color":this.ig,
        "backgroundColor":this.ig,
        "borderColor":this.ig,
        "borderTopColor":this.ig,
        "borderRightColor":this.ig,
        "borderBottomColor":this.ig,
        "borderLeftColor":this.ig,
        "opacity":this.jg,
        "zoom":this.kg,
        "display":this.lg,
        "overflow":this.lg,
        "position":this.lg,
        "visibility":this.lg,
        "zIndex":this.mg 
     };

      this.sg  = {};
      this.sg[this.eg] =  "px";
      this.sg[this.fg] =  "px";
      this.sg[this.gg] =  "px";
      this.sg[this.hg] =  "px";
      this.sg[this.ig] =  "";
      this.sg[this.jg] =  "%";
      this.sg[this.kg] =  "%";
      this.sg[this.lg] =  "";
      this.sg[this.mg] =  "";
   },
    tg:{
      "width":["offsetWidth"],
      "height":["offsetHeight"]
   },
    ug:{
      "width":["height",  "offsetHeight"],
      "height":["width",  "offsetWidth"]
   },

    vg:  function(za,  Z)
   {
      var   wg  =  this.og(za,  Z);
      return   this.qg(za,  Z,  wg).value;
   },

    og:  function(za,  Z,  xg)
   {
      var   yg  =  this.zg(Z);
      var   Ag  =  document.defaultView.getComputedStyle(za,  "");

      if  (Ag)
        switch  (this.Bg(Z))
       {
          case   this.gg:
            if  (d.Q)
           {
              var   Cg  =  this.tg[Z];
              var   db  =  za[Cg[0]];
              for  (var   i=1;  i<Cg.length;  i++)
                db  -=  parseInt(za.currentStyle[Cg[i]]);
              return   Math.max(0,  db);
           }
          case   this.fg:
            if  (Ag.getPropertyValue(yg.replace(/width/,  "style")) ==  d.h)
              return   0;
          case   this.mg:
          case   this.eg:
          case   this.kg:
          case   this.jg:
            return   Ag.getPropertyValue(yg);
          case   this.hg:
            return   za[Z];
            break;
          case   this.ig:
            if  (
              yg.indexOf("border") != -1 
             &&  Ag.getPropertyValue(yg.replace(/color/,  "style")) ==  d.h 
           )
              return   null;
            
          case   this.lg:
            return   Ag.getPropertyValue(yg);
       }

      return   null;
   },
    qg:  function(za,  Z,  wg)
   {
      var   Dg  =  this.Bg(Z);

      var   X  = {  value:  wg  };

      switch  (Dg)
     {
        case   this.mg:
        case   this.eg:
        case   this.kg:
          var   Eg  =  parseInt(wg);
          if  (isNaN(Eg))
            switch  (wg)
           {
              case   "auto":  X.value  =  0;  break;
              default:  X.value  =  null;
           }
          else 
            X.Fg  = (""  +  wg).replace(/^[-\d]+/,  "") ||  null;
          X.value  =  Eg;
          break;
        case   this.jg:
          X.value  =  Math.round(100*wg);
          break;
        case   this.ig:
          X.value  =  this.Gg(wg);
          break;
        case   this.gg:
        case   this.hg:
          X.value  =  parseInt(wg);
     }

      return   X;
   },


    pg:  function(za,  Z)
   {
      
      if  (!za.currentStyle)
        return   null;

      switch  (this.Bg(Z))
     {
        case   this.gg:
 
 
 
            
            
            var   Hg  =  za[this.ug[Z][1]] ==  0;
            if  (Hg)
              za.runtimeStyle[this.ug[Z][0]] =  "1px";

            var   db  =  za[this.tg[Z]];

 za.runtimeStyle[Z] =  db;
 db  +=  db  -  za[this.tg[Z]];
 za.runtimeStyle[Z] =  "";

            if  (Hg)
              za.runtimeStyle[this.ug[Z][0]] =  "";
 

          return   db;
        case   this.hg:
          return   za[Z];
          break;
        case   this.jg:
          try 
         {
            return   za.filters.item(d.K).opacity;
         }
          catch(Ig)
         {
            return   100;
         }
          break;
        case   this.eg:
        case   this.kg:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
        default:
          return   za.currentStyle[Z];
     }
   },

    rg:  function(za,  Z,  wg)
   {
      var   Dg  =  this.Bg(Z);

      var   X  = {  value:  wg  };
      var   Eg  =  null;

      if  (wg  ==  "0px")
        wg  =  "0";

      switch  (Dg)
     {
        case   this.gg:

 Eg  =  parseInt(wg);

          X.Fg  = (""  +  wg).replace(/^[-\d\.]+/,  "") ||  null;
          X.value  =  Math.max(0,  Eg);
          break;
        case   this.ig:
          X.value  =  this.Gg(wg);
          break;
        case   this.fg:
        case   this.mg:
        case   this.eg:
        case   this.kg:
          Eg  =  parseInt(wg);
          if  (isNaN(Eg))
            switch  (wg)
           {
              case   "auto":  Eg  =  0;  break;
              case   "thin":  Eg  =  2;  break;
              case   "medium":  Eg  =  4;  break;
              case   "thick":Eg  =  6;  break;
              default:  Eg  =  parseInt(wg);
           }
          else 
            X.Fg  = (""  +  wg).replace(/^[-\d\.]+/,  "") ||  null;

          X.value  =  Eg;
          break;
     }

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

      return   X;
   },

    Jg:  function(za,  Z,  db)
   {
      switch  (this.Bg(Z))
     {
        case   this.ig:
          za.style[Z] =  "rgb("  +  db.join(",") +  ")";
          break;
        case   this.lg:
        case   this.mg:
          za.style[Z] =  db;
          break;
        case   this.gg:
        case   this.kg:
        case   this.fg:
        case   this.eg:
          za.style[Z] =  db  +  "px";
          break;
        case   this.hg:
          za[Z] =  db  +  "px";
          break;
     }
   },

    Kg:  function(za,  Z)
   {
      za.style[Z] =  "";
   },

    Bg:  function(Z)
   {
      return   this.ng[Z] ||  this.eg;
   },

    zg:  function(Z)
   {
      return   Z.replace(/([A-Z])/g,  function(Lg){  return   "-"  +  Lg.toLowerCase(); });
   },
    Mg: {
      "white":"#FFFFFF",  "black":"#000000","blue":"#0000FF",
      "green":"#008000",  "red":"#FF0000",  "yellow":"#FFFF00",
      "aqua":"#00FFFF","azure":"#F0FFFF","beige":"#F5F5DC",
      "black":"#000000","blue":"#0000FF","brown":"#A52A2A",
      "cyan":"#00FFFF","darkblue":"#00008B","darkcyan":"#008B8B",
      "darkgray":"#A9A9A9","darkgreen":"#006400","darkred":"#8B0000",
      "fuchsia":"#FF00FF","gold":"#FFD700","gray":"#808080",
      "green":"#008000","indigo":"#4B0082","lightblue":"#ADD8E6",
      "lightcyan":"#E0FFFF","lightgreen":"#90EE90","lightgrey":"#D3D3D3",
      "lightyellow":"#FFFFE0","lime":"#00FF00","magenta":"#FF00FF",
      "maroon":"#800000","navy":"#000080","orange":"#FFA500",
      "pink":"#FFC0CB","purple":"#800080","red":"#FF0000",
      "silver":"#C0C0C0","steelblue":"#4682B4","turquoise":"#40E0D0",
      "violet":"#EE82EE","white":"#FFFFFF","yellow":"#FFFF00" 
    },

    Gg:  function(c)
   {
      c  =  this.Mg[c] ||  c;

      if  (typeof(c) ==  "object")
        return   c;
      if  (c.indexOf("#") ==  0)
     {
        if  (c.length  ==  7)
          return  [
            parseInt(c.substring(1,  3),  16),
            parseInt(c.substring(3,  5),  16),
            parseInt(c.substring(5,  7),  16)
         ];
        else 
          return  [
            17*parseInt(c.substring(1,  2),  16),
            17*parseInt(c.substring(2,  3),  16),
            17*parseInt(c.substring(3,  4),  16)
         ];
     }
      if  (c.indexOf("rgb(") ==  0)
     {
        var   Ng  =  c.substring(4,  c.length  -  1).split(",");
        return  [
          parseInt(Ng[0]),
          parseInt(Ng[1]),
          parseInt(Ng[2])
       ];
     }

      return  [255,  255,  255];
   }
};

 d.W(d.dg);

 d["StyleUtils"] =  d.dg;
 d.dg["getComputedStyleProperty"] =  d.dg.vg;
 
 
 d.Animator  =  _a  = {
    Og:{},
    animate:  function(Pg,  Qg)
   {
      var   Rg  =  Pg.length;

 
 
 
 
 
 
 
 
 
 
 
      var   Sg  =  10;
      var   Tg  =  1  <<  Sg;

      var   Ug  =  7;
      var   Vg  =  1  <<  Ug;

      var   code  = [
        "  var tPhase = Math.min(1, (t - TSTART)/DURATION);\n",
        "if (tPhase>=0){\n",
        "  var f = ",  _a.Wg[Qg.profile],  ";\n",
        "\n" 
     ];

      var   Xg  = [];
      var   Yg  = [];
      var   Zg  = [];


      for  (var   i=0;  i<Rg;  i++)
     {
        var   _h  =  Pg[i];
        var   za  =  _h.element;
        var   id  =  d.Ga.lb(za);
        var   ah  =  _h.targetState;

        for  (var   bh   in   ah)
       {
          var   ch  =  bh;
          if  (!d.R)
            ch  =  bh.replace(/([A-Z])/g,  function(Lg){  return   "-"  +  Lg.toLowerCase(); });

          var   dh  =  ah[bh];

          
          var   eh  = (_h.currentState&&typeof(_h.currentState[bh])!=d.e)?_h.currentState[bh]:d.dg.vg(za,  bh);

          if  (bh  ==  "zoom")
         {
            
            eh  *=  100;
            dh  *=  10000;
         }

          
          _a[id  +  "el"] =  za;
          switch  (d.dg.Bg(bh))
         {
            case   d.dg.hg:
                _a[id  +  "elscroll"] = (za  !=  document.body  ||  document.compatMode  ==  "BackCompat")?za:document.documentElement;
              break;
            case   d.dg.jg:
              if  (d.R)
             {
                _a[id  +  "opacity"] =  za.filters.item(d.K);
                break;
             }
              
            default:
              _a[id  +  "elStyle"] =  za.style;

              if  (Qg.removeAfterwards)
 
                Zg.push("_a[\"",  id,  "elStyle\"]."  +  bh  +  "='';\n");
         }

          
          if  (d.dg.Bg(bh) ==  "rgb")
            dh  =  d.dg.Gg(dh);

          if  (dh.constructor  ==  Array)
         {
            var   fh  = [];
            for  (var   Mc=0;  Mc<dh.length;  Mc++)
              fh[Mc] =  Math.floor(dh[Mc] -  eh[Mc]);
         }
          else   if  (!isNaN(dh))
         {
            var   fh  =  Math.floor(dh-eh);
         }

          var   gh  = (_h.units  &&  _h.units[bh])?" + '"  +  _h.units[bh] +  "';\n":_a.hh;

          
          switch  (d.dg.Bg(bh))
         {
            case   d.dg.ig:
              if  (d.R)
             {
                if  (bh  ==  "borderColor")
                  Yg.push(
                    '_a["',  id,  'elStyle"].',  bh,  '=["rgb(",',
                    '(',  Math.floor(Vg*(eh[0]+0.5)),  '+cP*',  fh[0],  ')>>',  Ug,  ',",", ',
                    '(',  Math.floor(Vg*(eh[1]+0.5)),  '+cP*',  fh[1],  ')>>',  Ug,  ',",", ',
                    '(',  Math.floor(Vg*(eh[2]+0.5)),  '+cP*',  fh[2],  ')>>',  Ug,  ', ")"].join("");\n' 
                 );
                else 
                  Yg.push(
                    '_a["',  id,  'elStyle"].',  bh,  '=',
                    '((',  Math.floor(Vg*(eh[0]+0.5)),  '+cP*',  fh[0],  ')>>',  Ug,  '<<16) | ',
                    '((',  Math.floor(Vg*(eh[1]+0.5)),  '+cP*',  fh[1],  ')>>',  Ug,  '<<8) | ',
                    '((',  Math.floor(Vg*(eh[2]+0.5)),  '+cP*',  fh[2],  ')>>',  Ug,  ');\n' 
                 );
             }
              else 
                Yg.push(
                  '_a["',  id,  'elStyle"].',  bh,  '=["rgb(",',
                  '(',  Math.floor(Vg*(eh[0]+0.5)),  '+cP*',  fh[0],  ')>>',  Ug,  ',",", ',
                  '(',  Math.floor(Vg*(eh[1]+0.5)),  '+cP*',  fh[1],  ')>>',  Ug,  ',",", ',
                  '(',  Math.floor(Vg*(eh[2]+0.5)),  '+cP*',  fh[2],  ')>>',  Ug,  ', ")"].join("");\n' 
               );
              break;
            case   d.dg.jg:
              Yg.push('try{_a["',  id, (d.R?'opacity"].opacity=(':'elStyle"].opacity=(('),  Vg*(eh+0.5),  '+cP*',  fh,  ')>>',  Ug, (d.R?';':')/100;'),  "}catch(e){};\n");
              break;
            case   d.dg.hg:
              Xg.push('_a["',  id,  'elscroll"].',  bh,  '=(',  Tg*(eh+0.5),  '+normalPhase*',  fh,  ')>>',  Sg,  ';\n');
              break;
            case   d.dg.kg:
              Xg.push('_a["',  id,  'elStyle"].',  bh,  '=((',  Math.floor(Tg*(eh+0.5)),  '+normalPhase*',  fh,  ')>>',  Sg,  ')/10000;\n');
            case   d.dg.lg:
              switch  (bh)
             {
                case   "visibility":
                  za.style.visibility  =  "visible";
                  break;
                case   "display":
                  za.style.display  = (dh=='none'?eh:dh);
                  break;
                case   "overflow":
                  za.style.overflow  =  "hidden";
                  break;
 
 
 
 
 
 
             }
              break;
            case   d.dg.mg:
              Xg.push('_a["',  id,  'elStyle"].',  bh,  '=((',  Math.floor(Tg*(eh+0.5)),  '+normalPhase*',  fh,  ')>>',  Sg,  ');\n');
              break;
            default:
              Xg.push('_a["',  id,  'elStyle"].',  bh,  '=((',  Math.floor(Tg*(eh+0.5)),  '+normalPhase*',  fh,  ')>>',  Sg,  ')', (bh=='zoom'?'/10000':''),  gh,  ";\n");
         }

       }
     }

 

      if  (Xg.length  >  0)
     {
        code.push(
          "var normalPhase=Math.round(",  Tg,  "*f);\n",
          Xg.join("")
       );
     }
      if  (Yg.length  >  0)
     {
        code.push(
          'var cP=Math.round(',  Vg,  '*f);\n',
         Yg.join("")
       );
     }

 

      if  (Qg.removeAfterwards)
        code.push(
          "",
          "if(t==TSTOP)",
          "{",
          Zg.join(""),
          "}\n");

      code.push("}\n\n");

      _a.ih(code,  Qg.delay,  Qg.duration,  Pg,  Qg.onFinish);
   },

    Wg: [
      'tPhase',
      'tPhase*tPhase',
      '(1-Math.pow(1-tPhase, 4))',
      '(1-Math.cos('  +  Math.PI  +  '*tPhase)/2.0)',
      '(tPhase<0.5?Math.exp(3*Math.log(tPhase*2))/2:1-Math.exp(3*Math.log((1-tPhase)*2))/2)',
      '(-Math.cos('  +  4*Math.PI  +  '*tPhase) + 1)/2',
      'tPhase + (1-tPhase)*Math.sin('   +   3*Math.PI   +   '*tPhase)',
      '(1-Math.exp(4*Math.log(1-tPhase)))' 
   ],

    hh: (document.defaultView?" + 'px';\n":";\n"),
    jh:  0,
    kh:  null,
    lh:  1,
    mh:  0,
    nh:  Infinity,
    oh:  500,
    ph:  "",
    ih:  function(qh,  delay,  duration,  Pg,  onFinish)
   {
      _a.jh++;
      _a.lh++;

      for  (var   i=0;  i<Pg.length;  i++)
        _a.Og[Pg[i].element.id] =  _a.lh++;

      if  (onFinish)
     {
        _a["__onFinish"  +  _a.lh] =  onFinish;
        _a["__anims"  +  _a.lh] =  Pg;
     }

      rh  = [
        "/*** ",  _a.lh,  " ***/\n",
        "var t=Math.min(tNow, TSTOP);\n",
        qh.join(""),
        "if(t==TSTOP)\n",
        "{\n",
        "_a.__rC(",  _a.lh,  ");\n",
       (onFinish?("_a.__onFinish"  +  _a.lh  +  "(_a.__anims"  +  _a.lh  +  ");"):""),
        "\n}\n",
        "/*** /",  _a.lh,  " ***/\n"].join("");

      var   sh  = +new   Date() +  delay  -  _a.mh;
      var   uh  =  sh  +  duration;
      rh  =  rh.replace(/TSTART/g,  sh);
      rh  =  rh.replace(/DURATION/g,  duration);
      rh  =  rh.replace(/TSTOP/g,  uh);
      rh  =  rh.replace(/RUNINDEX/g,  _a.lh);

      if  (_a.kh)
        _a.vh(Pg);

      _a.ph  =  _a.ph  +  rh;

 

      _a.wh  =  Function("tNow",  _a.ph);

 

      if  (!_a.kh)
     {
        _a.mh  =  0;
        _a.nh  =  Infinity;

 
 

        _a.kh  =  setInterval(_a.xh,  1);
 _a.yh  =  true;
        _a.xh();
 _a.yh  =  false;
     }
   },
    xh:  function()
   {
      var   zh  = +new   Date() -  _a.mh;

      var   Ah  =  zh  -  _a.nh;
      if  (Ah  >  _a.oh)
     {
        _a.mh  +=  Ah;
        zh  -=  Ah;
     }

      _a.nh  =  zh;

 
 

      _a.wh(zh);
   },
    "__rC":  function(Bh)
   {
      var   Ch  =  "/*** "  +  Bh  +  " ***/";
      var   Dh    =  "/*** /"  +  Bh  +  " ***/";
      _a.ph  =  _a.ph.substring(0,  _a.ph.indexOf(Ch)) +  _a.ph.substring(_a.ph.indexOf(Dh) +  Dh.length);

      _a.wh  =  Function("tNow",  _a.ph);

      _a.Eh(Bh);

      _a.jh--;
      if  (_a.jh  ==  0)
     {
        clearInterval(_a.kh);
        _a.Og  = {};
        _a.kh  =  null;
     }
   },
    Eh:  function(Bh)
   {
      for  (var   id   in   _a.Og)
        if  (_a.Og[id] ==  Bh)
          delete   _a.Og[id];
   },
   vh:  function(Pg)
   {
      var   Fh  = [];
      var   Rg  =  Pg.length;
      for  (var   i=0;  i<Rg;  i++)
     {
        var   _h  =  Pg[i];
        var   id  =  _h.element.id.replace(/(\W)/g,  "\\$1");
        var   ah  =  _h.targetState;

        for  (var   bh   in   ah)
       {
          
          switch  (bh)
         {
            case   'scrollTop':
            case   'scrollLeft':
              Fh.push("|_a\\[\"",  id,  "el\"\\]\\.",  bh,  "[^;]+;");
              break;
            case   "opacity":
              Fh.push("|try{_a\\[\"",  id,  "opacity\"\\][^;]+}catch(e){};");
              break;
            default:
              Fh.push("|_a\\[\"",  id,  "elStyle\"\\]\\.",  bh,  "[^;]+;");
              Fh.push("|_a\\[\"",  id,  "elStyle\"\\]\\.",  bh,  "='';");
         }
       }
     }

      if  (Fh.length  >  0)
     {
 
        _a.ph  =  _a.ph.replace(new   RegExp(Fh.join("").substr(1),  "g"),  "");
 
     }
   },
    Gh:  function(Hh)
   {
 
 
 
 
 
 
 
 
 
 
 
 
   }
};


 d.Modifiers  =  function  ()
{
    this.delay  =  0;
    this.duration  =  300;
    this.profile  =  7;
    this.removeAfterwards  =  false;
    this.onFinish  =  null;
};

 d.Modifiers.prototype  = {
    "LINEAR":0,
    "ACCELERATING":1,
    "DECELERATING":2,
    "NORMAL":3,
    "SLOWFASTSLOW":4,
    "BLINK":5,
    "HEARTBEAT":6,
    "FAST":7 
};

 d["Animator"] =  d.Animator;
 d.Animator["disabled"] =  d.Animator.disabled;
 d.Animator["animate"] =  d.Animator.animate;
 
 
 
 
 
 
 
 
 


 
 
 
 
 
 
 
 
 
 
 
 

 
 
 


 



 d.Ih  = {
    Jh:"display",
    Kh:"block",
    Lh:"morph",
    Mh:"shallow",


    Nh:  true,
    Oh:[
      "display",
      "overflow",
      "backgroundColor",
 
 
 
 
 
      "color",
      "fontSize",
      "height",
      "left",
      "marginTop",
 
 
      "marginLeft",
      "opacity",
 
 
 
 
 
      "top",
 
      "width",
      "zIndex",
      "visibility"
   ],
    Ph:{},
    Qh:  false,
    Rh:  true,
    Sh:  {  BODY:1,  DIV:1,  A:1,  IMG:1,  LI:1,  OL:1,  UL:1,  SPAN:1,  TD:1,  TH:1,  TR:1,  TABLE:1,  H1:1,  H2:1,  H3:1  },
    ba:  function()
   {
      d.wa.nd(d.k,  this.Th,  this);
      d.wa.nd(d.l,  this.Uh,  this);
      d.wa.nd(d.n,  this.Uh,  this);
   },

    Vh:  function()
   {
      this.Nh  =  true;
   },
    Wh:  function()
   {
      this.Nh  =  false;
   },
    Xh:  function()
   {
      this.Rh  =  false;
   },
    Yh:  function(Zh)
   {
      d.w  =  Zh;
   },
    _i:  function(ai)
   {
      var   bi  = {};
      for  (var   i=0;  i<ai.length;  i++)
        bi[ai[i].toUpperCase()] =  1;
      this.Sh  =  bi;
   },
    ci:  function(di)
   {
      this.Oh  =  di;
   },
    Uh:  function(Yc)
   {
      if  (d.Ih.Nh  && !Yc.Dc)
        this.ei(Yc.subject);
   },
    ei:function(vd)
   {
 
      var   fi  = {};

      var   pc  =  d.Ja.Ka(vd,  this.Lh, {"delay":0,  "duration":d.w});
      if  (!pc  || (!pc["not"] && (!pc["require"] ||  d.Ja.contains(vd,  pc["require"]))))
     {
        if  (pc)
          this.gi(fi,  vd,  pc);
        else   if  (!this.Rh)
          this.hi(vd,  fi);

        if  (this.Qh)
       {
          this.ii(fi,  true);

          for  (var   Kf   in   fi)
            this.Ph[Kf] =  fi[Kf];
       }
     }
 
   },

    gi:  function(Hh,  za,  pc)
   {
      var   Kf  =  d.Ga.lb(za);
      if  (!this.Ph[Kf])
     {
        Hh[Kf] = {
          element:za,
          pc:pc,
          eb:pc[this.ji]||this.Oh 
       };

        this.Qh  =  true;
     }

      if  (!this.Rh  ||  pc["deep"])
        this.hi(za,  Hh);
   },

    hi:  function(za,  fi)
   {
      for  (var   zd  =  za.firstChild;  zd;  zd  =  zd.nextSibling)
        if  (zd.nodeType  ==  1)
       {
          var   pc  =  null;
          var   ki  =  false;
          if  (this.Sh[zd.nodeName])
         {
            pc  =  d.Ja.Ka(zd,  this.Lh, {"delay":0,  "duration":d.w});
            if  (pc  && !pc["not"])
           {
              this.gi(fi,  zd,  pc);
              ki  =  true;
           }
         }

          if  (!ki)
         {
            var   mi  =  d.dg.og(zd,  "display");
            if  (mi  !=  d.h  && (!pc  || !pc[this.Mh]))
              this.hi(zd,  fi);
         }
       }
   },

    Th:function()
   {
      
      
      
      if  (d.Q)
        document.body.scrollLeft  +=  0;

      if  (this.Qh)
     {
        
        
        for  (var   Kf   in   this.Ph)
          if  (!this.ni(this.Ph[Kf].element))
         {
            var   za  =  document.getElementById(Kf);
            if  (za)
              this.Ph[Kf].element  =  document.getElementById(Kf);
            else 
              delete   this.Ph[Kf];
         }

 
        this.oi(this.Ph);
 
        this.ii(this.Ph,  false);
 
        this.pi(this.Ph);
 

        var   qi  =  this.ri();
 

        this.Qh  =  false;
        this.Ph  = {};
 

        this.si(qi);
 

        
        
        
        
        
        
        
        if  (d.T)
          document.body.offsetWidth;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
     }
   },
    oi:  function(Hh)
   {
 
 
 
 
 

      for  (var   Kf   in   Hh)
        if  (d.Animator.Og[Kf])
       {
          var   ti  =  Hh[Kf];
          var   za  =  ti.element;

          if  (d.R)
         {
            ti.ui  =  za.style.cssText;
            za.style.cssText  =  "";
         }
          else 
            for  (var   Z   in   ti.vi)
           {
              var   db  =  za.style[Z];
              if  (db)
             {
                ti.wi[Z] =  db;
                za.style[Z] =  "";
             }
           }
       }
   },
    pi:  function(Hh)
   {
      for  (var   Kf   in   Hh)
     {
        if  (d.Animator.Og[Kf])
       {
          var   ti  =  Hh[Kf];
          var   za  =  ti.element;
          if  (d.R)
            za.style.cssText  =  ti.ui;
          else 
            for  (var   Z   in   ti.wi)
              za.style[Z] =  ti.wi[Z];
       }
     }
   },
    ii:  function(Hh,  xi)
   {
      var   yi  = [];
      var   zi  = [];
      var   Ai  =  null;

      for  (var   Kf   in   Hh)
     {
        var   ti  =  Hh[Kf];
        var   za  =  ti.element;

 
 
 
 if  (za.offsetWidth  ==  0  && (!za.parentNode  ||  za.parentNode.offsetWidth  ==  0))
{
    delete   Hh[Kf];
    continue;
}
        if  (xi)
       {
          ti.wi  = {};
          ti.vi  = {};
          ti.Bi  = {};
       }

        
        if  (!xi  &&  Ai  &&  d.Ga.Db(Ai,  za) && (Ai.style.display  ==  d.h))
       {
          delete   Hh[Kf];
          continue;
       }

        var   Ci  = (xi?ti.vi:ti.Bi);

        for  (var   i=0;  i<ti.eb.length;  i++)
       {
          var   Z  =  ti.eb[i];
 

          Ci[Z] =  d.dg.og(za,  Z);

          if  (Z  ==  this.Jh  &&  Ci[Z] ==  d.h)
         {
 
 
 
 
 
            
            if  (!xi  &&  ti.vi.display  ==  d.h)
           {
              delete   Hh[Kf];
              break;
           }

            Ai  =  za;
            yi.push(Ai);
            zi.push(Ai.style.display);
            Ai.style.display  =  this.Kh;
         }
       }
     }

      for  (var   i=0;  i<yi.length;  i++)
        yi[i].style.display  =  zi[i];
   },
    ri:  function()
   {
      var   qi  = {};
      var   Di  = {};
      for  (var   Kf   in   this.Ph)
     {
        var   ti  =  this.Ph[Kf];
        var   za  =  ti.element;
        var   currentState  = {};
        var   units  = {};
        var   targetState  = {};
        var   Ei  =  false;
        for  (var   Z   in   ti.Bi)
       {
          var   Fi  =  ti.vi[Z];
          var   Gi  =  ti.Bi[Z];

          if  (Gi  !=  null)
         {
            
 
 
 
 
            if  (Fi  !=  Gi)
           {
              Ei  =  true;
              var   Hi  =  d.dg.qg(za,  Z,  Fi);
              var   Ii    =  d.dg.qg(za,  Z,  Gi);
              currentState[Z] =  Hi.value;
              targetState[Z] =  Ii.value;
              units[Z] =  Hi.Fg  ||  Ii.Fg;
           }
         }
       }

        if  (Ei)
       {
          if  (d.Q)
         {
            
            
            
            if  (targetState.top  &&  targetState.marginTop  &&  targetState.top  ==  targetState.marginTop)
              delete   targetState.top;
            if  (targetState.left  &&  targetState.marginLeft  &&  targetState.left  ==  targetState.marginLeft)
              delete   targetState.left;
         }

          var   Ji  =  qi[ti.pc["delay"]] =  qi[ti.pc["delay"]] || {};
          var   Pg  =  Ji[ti.pc["duration"]] =  Ji[ti.pc["duration"]] || [];

          Pg[Pg.length] = {
            element:za,
            currentState:currentState,
            targetState:targetState,
            units:units 
         };
       }
     }
      return   qi;
   },
    si:  function(qi)
   {
      for  (var   delay   in   qi)
     {
        delay  *=  1;
        for  (var   duration   in   qi[delay])
       {
          duration  *=  1;
          var   Pg  =  qi[delay][duration];
          for  (var   i=0;  i<Pg.length;  i++)
         {
            var   _h  =  Pg[i];
            var   za  =  _h.element;
            
 
 
            
            for  (var   Z   in   _h.currentState)
           {
 
 
              d.dg.Jg(za,  Z,  _h.currentState[Z]);
           }
         }

 
 
 
 
 
 
 
 
 

          var   Qg  =  new   d.Modifiers();
          Qg.delay  =  delay;
          Qg.duration  =  duration;
 
 
          Qg.removeAfterwards  =  true;

 
 
          d.Animator.animate(Pg,  Qg);
 
       }
     }
   },
    ni:  function(za)
   {
      if  (d.R)
        return   za.parentTextEdit  !=  null;
      else   if  (d.Q)
        return   za.sourceIndex  != -1;
      else 
        return   za.offsetParent  !=  null;
   },
    Ki:  function(Li,  Mi)
   {
      for  (var   i=0;  i<Li.length;  i++)
        if  (Li[i] !=  Mi[i])
          return   false;

      return   true;
   }
};
 d.W(d.Ih);

 d["StyleMorpher"] =  d.Ih;
 d.Ih["enableDeepMorphing"] =  d.Ih.Xh;
 d.Ih["setMorphDuration"] =  d.Ih.Yh;
 d.Ih["setMorphableNodeNames"] =  d.Ih._i;
 d.Ih["setMorphableProperties"] =  d.Ih.ci;
 d.Ih["enable"] =  d.Ih.Vh;
 d.Ih["disable"] =  d.Ih.Wh;

 d.Ih["morph"] =  d.Ih.Th;
 d.Ih["beforeClassNameChange"] =  d.Ih.Uh;
 
 
 
 
 


 d.Ni  = {
    Oi:  null,
    Pi:  null,
    ba:  function()
   {
      d.Oc.Sc(document.documentElement,  d.H,  this.Qi,  this);
      d.Oc.Sc(document.documentElement,  d.I,  this.Ri,  this);
      d.Oc.Sc(document.documentElement,  d.J,    this.Si,  this);
      d.Oc.Sc(document.documentElement,  "DOMMouseScroll",    this.sd,  this);

      d.wa.nd("persist-pos",  this.Ti,  this);
   },
    
    Ti:  function(Yc)
   {
      var   za  =  Yc.subject;
      if  (d.Ja.contains(za,  "movable"))
     {
        var   Ui  = {  x:  parseInt(za.style.left),  y:  parseInt(za.style.top) };
        if  (!isNaN(Ui.x) || !isNaN(Ui.y))
       {
          var   La  =  d.Ja.Ka(za,  "movable");
          if  (La[d.N])
            La[d.N](za,  Ui);
       }
     }
   },

    Qi:  function(Yc)
   {
      this.Si();

      this.Vi  =  d.oa.ya(Yc.subject,  "mover",  "movable");
      if  (this.Vi.object)
     {
       this.Vi.box  =  this.Vi.object.offsetParent  ||  d.V;

        this.Wi  =  d.V.scrollTop;
        this.Xi  =  this.Vi.object.offsetLeft  -  Yc.clientX  -  d.dg.vg(this.Vi.object,  "marginLeft");
        this.Yi  =  this.Vi.object.offsetTop  -  Yc.clientY  -  d.dg.vg(this.Vi.object,  "marginTop");

        this.Zi();

        this._j  =  false;
     }
      else 
        this.Vi  =  null;
   },
    Ri:  function(Yc)
   {
      this.Pi  =  Yc.clientY;

      if  (this.Vi)
        if  (Yc.kd)
       {
          if  (!this._j)
         {
            d.Oc.Pc  =  true;

            if  (d.R)
              this.Vi.Fa.setCapture();

            d.Ja.replace(this.Vi.box,  "notMoving",  "moving");
            d.Ja.replace(this.Vi.object,  "notMoving",  "moving");
            d.Ja.replace(this.Vi.Fa,  "notMoving",  "moving");

            this.Oi  =  d.oa.ta(this.aj,  15,  this);

            this._j  =  true;
         }

          this.bj  = {  x:  this.Xi  +  Yc.clientX,  y:  this.Yi  +  Yc.clientY  +  d.V.scrollTop  -  this.Wi  };
          this.cj();

          if  (this.Vi.La[d.N])
         {
            this.Vi.La[d.N](this.Vi.object,  this.bj);
            this.cj();
         }

          if  (this.Vi.Ia.dir  !=  "vertical")
            d.dg.Jg(this.Vi.object,  "left",  this.bj.x);
          if  (this.Vi.Ia.dir  !=  "horizontal")
            d.dg.Jg(this.Vi.object,  "top",   this.bj.y);
       }
        else 
          this.Si();
   },
    sd:  function(Yc)
   {
      this.Si();

      var   dj  =  d.Ga.Ha(Yc.subject,  "move");
      if  (dj)
     {
        var   pc  =  d.Ja.Ka(dj,  "move");

        if  (pc["onMouseScroll"])
       {
          if  (this.ej)
            clearTimeout(this.ej);

          var   fj  =  document.getElementById(pc["onMouseScroll"]);
          this.Vi  = {
            box:  fj.offsetParent  ||  d.V,
            object:  fj,
            La:  d.Ja.Ka(fj,  "movable")
         };
          
          this.Zi();

          var   gj  =  this.Vi.object.offsetTop;

          var   hj  =  pc["delta"] ||  Math.abs(Yc.detail);

          this.bj  = {  x:0,  y:gj  +  hj  *  Yc.detail  /  Math.abs(Yc.detail) };
          this.cj();

          if  (this.Vi.La[d.N])
         {
            this.Vi.La[d.N](this.Vi.object,  this.bj);
            this.cj();
         }

          d.dg.Jg(this.Vi.object,  "top",   this.bj.y);

          var   ij  =  d.Ni.Vi.La[d.O];
          if  (this.Vi.La[d.O])
         {
            var   X  =  d.Ni.Vi.object;
            var   Ui  =  d.Ni.bj;
            this.ej  =  d.oa.pa(function() {  ij(X,  Ui); },  500);
         }

          this.Si();
          
          Yc.cancel();
       }
     }
   },

    Zi:  function()
   {
      
      
      
      var   jj   = -1;
      var   kj  = -1;
      var   lj  =  this.Vi.box;
      while  (jj  <=  1  ||  kj  <=  1)
     {
        jj  = (document.compatMode  !=  "BackCompat"  ||  lj  !=  d.V)?lj.offsetWidth:lj.clientWidth;
        kj  =  lj.offsetHeight;
        lj  =  lj.offsetParent  ||  d.V;
     }
      

      if  (this.Vi.La["restricted"])
     {
        this.mj  =  jj   -  d.dg.vg(this.Vi.object,  "width") -  d.dg.vg(this.Vi.object,  "marginRight") - (lj  ==  d.V?2:0);
        this.nj  =  kj  -  d.dg.vg(this.Vi.object,  "height") -  d.dg.vg(this.Vi.object,  "marginBottom");
     }
   },

    cj:  function()
   {
      if  (this.Vi.La["restricted"])
     {
        this.bj.x  =  Math.max(0,  Math.min(this.bj.x,  this.mj)),
        this.bj.y  =  Math.max(0,  Math.min(this.bj.y,  this.nj))
     }
   },
    Si:  function()
   {
      if  (this.Vi)
     {
        if  (this._j)
       {
          if  (this.Vi.box)
            d.Ja.replace(this.Vi.box,  "moving",  "notMoving");
          if  (this.Vi.object)
            d.Ja.replace(this.Vi.object,  "moving",  "notMoving");
          if  (this.Vi.Fa)
            d.Ja.replace(this.Vi.Fa,  "moving",  "notMoving");

          if  (this.Vi.La[d.O])
            this.Vi.La[d.O](this.Vi.object,  this.bj);

          d.Oc.Pc  =  false;

          if  (d.R)
            this.Vi.Fa.releaseCapture();

          this.Pi  =  null;
          clearTimeout(this.Oi);
          this.Oi  =  null;
       }

        this.Vi  =  null;
     }

      this.oj  =  d.V.scrollHeight  -  d.V.offsetHeight;
   },
    aj:  function()
   {
      if  (this.bj  &&  this.Vi.Ia.dir  !=  "horizontal")
     {
        var   pj  =  d.V.scrollTop;
      
        if  (this.Pi  <  50)
          d.V.scrollTop  -=  Math.round(10  -  this.Pi/5);

        if  (this.Pi  >  d.V.offsetHeight  -  50)
          d.V.scrollTop  =  Math.min(d.V.scrollTop  +  Math.round(10  - (d.V.offsetHeight  -  this.Pi)/5),  this.oj);

        if  (d.V.scrollTop  !=  pj)
       {
          this.bj.y  +=  d.V.scrollTop  -  pj;
          this.cj();

          if  (this.Vi.La[d.N])
         {
            this.Vi.La[d.N](this.Vi.object,  this.bj);
            this.cj();
         }
          d.dg.Jg(this.Vi.object,  "top",   this.bj.y);
       }
     }
   }
};

 d.W(d.Ni);
 d.qj  = {
    ba:  function()
   {
      d.Oc.Sc(document.documentElement,  d.H,  this.Qi,  this);
      d.Oc.Sc(document.documentElement,  d.I,  this.Ri,  this);
      d.Oc.Sc(document.documentElement,  d.J,    this.Si,  this);

      d.wa.nd("persist-dim",  this.Ti,  this);
   },

    Ti:  function(Yc)
   {
      var   za  =  Yc.subject;
      if  (d.Ja.contains(za,  "resizable"))
     {
        var   rj  = {  width:  parseInt(za.style.width),  height:  parseInt(za.style.height) };
        if  (!isNaN(rj.width) || !isNaN(rj.height))
       {
          var   La  =  d.Ja.Ka(za,  "resizable");
          if  (La[d.N])
            La[d.N](za,  rj);
       }
     }
   },
    
    Qi:  function(Yc)
   {
      
      this.Si();

      this.sj  =  d.oa.ya(Yc.subject,  "resizer",  "resizable");
      if  (this.sj.object)
     {
        
        this.tj  =  d.dg.vg(this.sj.object,  "width");
        this.uj  =  d.dg.vg(this.sj.object,  "minWidth") ||  0;
        this.vj  =  d.dg.vg(this.sj.object,  "maxWidth") ||  Infinity;

        this.wj  =  d.dg.vg(this.sj.object,  "height");
        this.xj  =  d.dg.vg(this.sj.object,  "minHeight") ||  0;
        this.yj  =  d.dg.vg(this.sj.object,  "maxHeight") ||  Infinity;

        this.Xi  =  Yc.clientX;
        this.Yi  =  Yc.clientY;

        this.zj  =  false;
     }
      else 
        this.sj  =  null;
   },
    
    Ri:  function(Yc)
   {
      if  (this.sj)
        if  (Yc.kd)
       {
          if  (!this.zj)
         {
            d.Oc.Pc  =  true;

            if  (d.R)
              this.sj.Fa.setCapture();

            d.Ja.replace(this.sj.object,  "notResizing",  "resizing");
            d.Ja.replace(this.sj.Fa,  "notResizing",  "resizing");
            this.zj  =  true;
         }

          this.Aj  = {
            width:this.tj  +  Yc.clientX  -  this.Xi,
            height:this.wj  +  Yc.clientY  -  this.Yi 
         };
          this.cj();

          if  (this.sj.La[d.N])
         {
            this.sj.La[d.N](this.sj.object,  this.Aj);
            this.cj();
         }

          if  (this.sj.Ia.Bj  !=  "height")
            this.sj.object.style.width   =  this.Aj.width   +  "px";
          if  (this.sj.Ia.Bj  !=  "width")
            this.sj.object.style.height  =  this.Aj.height  +  "px";
       }
        else 
          this.Si();
   },
    cj:  function()
   {
      this.Aj.width   =  Math.max(this.uj,  Math.min(this.vj,  this.Aj.width));
      this.Aj.height  =  Math.max(this.xj,  Math.min(this.yj,  this.Aj.height));
   },

    Si:  function()
   {
      if  (this.sj)
     {
        if  (this.zj)
       {
          d.Ja.replace(this.sj.object,  "resizing",  "notResizing");
          d.Ja.replace(this.sj.Fa,  "resizing",  "notResizing");

          if  (this.sj.La[d.O])
            this.sj.La[d.O](this.sj.object,  this.Aj);

          d.Oc.Pc  =  false;

          if  (d.R)
            this.sj.Fa.releaseCapture();
       }

        this.sj  =  null;
     }
   }
};

 d.qj.ba();
 d.Cj  = {
    pf:  null,
    Dj:  Math.pow(2,  15),
    ba:  function()
   {
      d.Oc.Sc(document.documentElement,  "mousedown",  this.Ej,  this);
      d.Oc.Sc(document.documentElement,  "keyup",  this.Ej,  this);
      d.wa.nd(d.m,  this.Ej,  this);
   },
    
    Ej:  function(Yc)
   {
      var   za  =  Yc.subject;

      if  (za  !=  this.pf)
     {
        this.pf  =  za;

        for  (;za  &&   za.nodeType  ==  1;  za  =  za.parentNode)
          if  (d.Ja.contains(za,  "stackable"))
            za.style.zIndex  =  this.Dj++;
     }
   }
};


 d.Cj.ba();
 d.Fj  = {
    Gj:"dragging",
    Hj:"notDragging",
    Ij:"dropping",
    Jj:"notDropping",
     ba: function () {
      d.Oc.Sc(document.documentElement,  d.H,  this.Qi,  this);
      d.Oc.Sc(document.documentElement,  d.I,  this.Ri,  this);
      d.Oc.Sc(document.documentElement,  d.J,    this.Kj,  this);
   },
    
     Qi: function (Yc) {
      
      this.Si();

      
      var   Lj  =  d.Ga.Ha(Yc.subject,  "dragger");
         if (Lj) {
        
        var   Mj  =  d.Ga.Ha(Yc.subject,  "draggable");

        
             if (Mj) {
          
          if  (!d.Ga.Ha(Yc.subject,  "dragging-disabled"))
            
            this.Nj(Mj,  Lj);

          
          
          Yc.cancel();
       }
     }
   },
    
     Ri: function (Yc) {
      this.Pi  =  Yc.clientY;

      if  (this.Oj)
             if (Yc.kd) {
          this.Pj();

          
          this.Qj.style.left  = (d.V.scrollLeft  +  Yc.clientX) +  "px";
          this.Qj.style.top  = (d.V.scrollTop  +  5  +  this.Pi) +  "px";

          
          
          
          var   Mj  =  d.Ga.Ha(Yc.subject,  "draggable");
                 if (Mj != this.Qj) {
            
            var   Rj  =  d.Ga.Ha(Yc.subject,  "dropBox");
                     if (Rj && Rj != this.Sj) {
              
              var   Tj  =  d.oa.Va(Rj,  "dropType",  "",  true);
              for  (var   i=0;  i<Tj.length;  i++)
                if  (!isNaN(this.Uj[Tj[i]]))
                  break;
              
              if  (i  >=  Tj.length)
                Rj  =  null;
           }

            var   Vj  =  null;

            if  (d.Ga.Ha(Yc.subject,  "noDrop",  "dropBox"))
              Rj  =  null;

                     if (Rj) {
              var   Wj  =  d.R?Yc.clientY:(Yc.clientY  +  d.V.scrollTop);
                         if (d.Q) {
                Wj  =  Yc.offsetY;
                var   za  =  Yc.subject;
                             while (za != Rj) {
                  Wj  +=  za.offsetTop;
                  za  =  za.offsetParent  ||  d.V;
               }
             }

                         for (var i = 0; !Vj && i < Rj.childNodes.length; i++) {
                var   Bb  =  Rj.childNodes[i];
                             if (Bb != this.Xj && Bb != this.Qj && Bb.nodeType == 1) {
                  var   Ab  =  d.Ga.getBoxObjectFor(Bb);
                  if  (Wj  < (Ab.y  +  Ab.height/2))
                    Vj  =  Bb;
               }
             }
           }
            this.Yj(Rj,  Vj);
         }

          
          Yc.cancel();
       }
        else 
          this.Kj();
   },

 Pi:  null,
 Zj:  null,
 _k:  null,
        
     Nj: function (Mj, Lj) {
      this.ak  =  Lj;
      this.Oj  =  Mj;
      this.bk  =  Mj.parentNode;
      this.ck  =  Mj.nextSibling;

      
      this.dk  =  d.oa.Va(this.Oj,  "dragType",  "",  true);
      this.Uj  =  d.oa.ab(this.dk);

      this.ek  =  false;

      
      d.Ja.add(document.body,  "dragging-"  +  this.dk.join(" dragging-"));
   },


     Pj: function () {
      if  (this.ek)
        return;

      this.ek  =  true;

      d.Oc.Pc  =  true;

      if  (d.R)
        this.ak.setCapture();

      
      var   fk  =  d.Ga.sb(this.Oj,  "dragPlaceholder");
      if  (fk)
        this.Qj  =  fk.cloneNode(true);
         else {
        this.Qj  =  this.Oj.cloneNode(true);
        this.Qj.style.width  =  this.Oj.offsetWidth  +  "px";
     }

      d.Ja.add(this.Qj,  "dragPlaceholder");
      d.Ja.replace(this.Qj,  this.Hj,  this.Gj);
      this.Oj.parentNode.insertBefore(this.Qj,  this.Oj);

      this.Qj.style.position  =  "absolute";
      this.Qj.style.zIndex  =  Math.pow(2,  15);
      document.body.appendChild(this.Qj);

      var   gk  =  d.Ga.sb(this.Oj,  "dropPlaceholder");
      if  (gk)
        this.Xj  =  gk.cloneNode(true);
         else {
        this.Xj  =  this.Oj.cloneNode(true);
 
     }
      d.Ja.add(this.Xj,  "dropPlaceholder");
      d.Ja.remove(this.Xj,  this.Hj);

      
      d.Ja.replace(this.Oj,  this.Hj,  this.Gj);
      d.Ja.replace(this.Oj.parentNode,  this.Hj,  this.Gj);

      this.Oi  =  d.oa.ta(this.aj,  15,  this);
   },
     Yj: function (Rj, Vj) {
         if (Rj != this.Sj || Vj != this.hk) {
        
        if  (this.Sj  &&  Rj  !=  this.Sj)
          d.Ja.replace(this.Sj,  this.Ij,  this.Jj);

        this.Sj  =  Rj;
        this.hk  =  Vj;

             //$(this.Xj.nextSibling).css("border", "2px Solid Red");

        if  (!Rj)
          this.Xj.parentNode.removeChild(this.Xj);
             else {
          d.Ja.replace(Rj,  this.Jj,  this.Ij);
          Rj.insertBefore(this.Xj,  Vj  ||  null);
       }
     }
   },

     Kj: function () {
         if (this.Oj && this.Sj) {
        var   Mj  =  this.Oj;
        var   ik  =  this.Xj.parentNode;
        var   jk  =  this.Xj.nextSibling;

        this.Si();

        var   kk  =  d.Ja.contains(this.bk,  "clone-box") &&  ik  !=  this.bk;
             if (ik != this.bk || jk != this.ck) {
          var   Vj  =  kk?Mj.cloneNode(true):Mj;

          ik.insertBefore(Vj,  jk);

          var   lk  =  d.Ja.Ka(ik,  "dropBox");
          if  (lk[d.O])
            if  (lk[d.O](Vj,  this.bk,  this.ck,  ik,  jk) ==  false)
              this.bk.insertBefore(Vj,  this.ck);
       }
     }

      this.Si();
   },

     Si: function () {
         if (this.Oj) {
        d.Ja.remove(document.body,  "dragging-"  +  this.dk.join(" dragging-"));

             if (this.ek) {
          d.Ja.replace(this.Oj.parentNode,  this.Gj,  this.Hj);
          d.Ja.replace(this.Oj,  this.Gj,  this.Hj);
          if  (this.Sj)
            d.Ja.replace(this.Sj,  this.Ij,  this.Jj);

          
          this.Qj.parentNode.removeChild(this.Qj);
          if  (this.Xj.parentNode)
            this.Xj.parentNode.removeChild(this.Xj);
       }

        d.Oc.Pc  =  false;

        if  (d.R)
          this.ak.releaseCapture();

        this.ak  =  null;
        this.Oj  =  null;
        this.Sj  =  null;
        this.Pi  =  null;
        clearTimeout(this.Oi);
        this.Oi  =  null;
     }
      this.oj  =  d.V.scrollHeight  -  d.V.offsetHeight;
   },
    
     aj: function () {
      var   pj  =  d.V.scrollTop;
      
      if  (this.Pi  <  50)
        d.V.scrollTop  -=  Math.round(10  -  this.Pi/5);

      if  (this.Pi  >  d.V.offsetHeight  -  50)
        d.V.scrollTop  =  Math.min(d.V.scrollTop  +  Math.round(10  - (d.V.offsetHeight  -  this.Pi)/5),  this.oj);

      if  (d.V.scrollTop  !=  pj)
        this.Qj.style.top  = (d.V.scrollTop  +  5  +  this.Pi) +  "px";
   }
};

 d.W(d.Fj);


 
 
 
 
 
 
 
 
 d.mk  =
{
    nk:0,
    ok:1,
    pk:2,
    qk:-1,
    rk:-2,
    sk: {},
    ba:  function()
   {
      d.Qd.ae(["classShifter"], ["classShiftee",  "classChain"],  this.Oe,  this);
      d.Bd.Kd("classChain",  this.tk,  this);
   },
    
    uk:  function(za)
   {
      var   Kf  =  d.Ga.lb(za);
      var   ie  =  d.Ja.Ka(za,  "classChain");
      var   data  =  this.vk(Kf,  document.body,  za,  "classChain", {},  ie);

      data.wk  =  this.qk;
      d.Ja.add(data.oe,  "sliding");
      this.xk(data);
   },
    reset:  function(za)
   {
      var   Kf  =  d.Ga.lb(za);
      delete   this.sk[Kf];
   },

    tk:  function(oe,  yk,  Yc)
   {
      var   za  =  Yc.subject;
      while  (za  &&  za.parentNode  !=  oe)
        za  =  za.parentNode;

      var   Kf  =  d.Ga.lb(oe);
      var   ie  =  d.Ja.Ka(oe,  "classChain");
      var   data  =  this.vk(Kf,  oe,  oe,  "classChain", {},  ie);

      for  (var   c=0;  c<data.children.length;  c++)
        if  (data.children[c] ==  za)
       {
          data.zk  =  c;

          if  (data.zk  ==  data.Ak)
            break;

          if  (data.Yf)
         {
            clearTimeout(data.Yf);
            data.Yf  =  null;
         }

          this.Bk(data);
        
          d.pd.ud(data.oe, ["jump"],  data.oe);

          data.Yf  =  d.oa.pa(this.xk,  data.ua,  this, [data]);
    
          break;
       }
   },
    Oe:  function(ne,  nc,  oe,  Se,  Yc,  fe,  ie)
   {
      var   Kf  =  d.Ga.lb(oe);
      var   data  =  this.vk(Kf,  ne,  oe,  Se,  fe,  ie);

      var   Ck  =  false;
      var   Dk  =  false;
      var   Ek  =  false;

      var   Fk  =  data.wk;

      if  (fe["pause"] &&  data.wk  !=  null)
     {
        data.Gk  =  true;
        Dk  =  true;
        d.Ja.ec(data.oe,  "pausing",  true);
     }

      if  (fe["resume"])
        Ck  =  true;

      if  (fe["stop"])
     {
        Dk  =  true;
        data.wk  =  null;
        d.Ja.remove(data.oe,  "sliding");
        if  (data.Gk)
          d.Ja.remove(data.oe,  "pausing");
     }

      if  (fe["slideToStart"])
     {
        data.wk  =  0;
        Ck  =  true;
     }
      if  (fe["slideToEnd"])
     {
        data.wk  =  data.Hk;
 
        Ck  =  true;
     }
      if  (fe["slideToNext"] ||  fe["jumpToNext"])
     {
        this.Ik(data,  1);
        Ek  =  true;
     }
      if  (fe["slideToPrevious"] ||  fe["jumpToPrevious"])
     {
        this.Ik(data, -1);
        Ek  =  true;
     }
      if  (fe["slideForward"])
     {
        data.wk  =  this.qk;
        Ck  =  true;
     }
      if  (fe["slideBackward"])
     {
        data.wk  =  this.rk;
        Ck  =  true;
     }
      if  (fe["slideTo"])
     {
        if  (data.Jk)
          data.wk  =  this.Kk(data,  fe["slideTo"]);
        else 
          data.wk  =  data.Lk[fe["slideTo"]];
        Ck  =  true;
     }

      if  (fe["jumpToStart"])
     {
        data.zk  =  0;
        Ek  =  true;
     }
      if  (fe["jumpToEnd"])
     {
        data.zk  =  data.Hk;
        Ek  =  true;
     }
      if  (fe["jumpTo"])
     {
        if  (data.Jk)
          data.zk  =  this.Kk(data,  fe["jumpTo"]);
        else 
          data.zk  =  data.Lk[fe["jumpTo"]];
        Ek  =  true;
     }

      if  (Ek  &&  data.zk  ==  data.Ak)
        Ek  =  false;

      if  (!data.Gk  &&  Ck  &&  data.wk  ==  Fk)
        Ck  =  false;

      if  (data.Yf  && (Dk  ||  Ck  ||  Ek))
     {
        clearTimeout(data.Yf);
        data.Yf  =  null;
     }

      if  (Ck  &&  data.Ak  ==  data.wk)
        Ck  =  false;

      if  (Ck)
     {
        data.Gk  =  false;
        data.dir  =  1;
        d.Ja.ec(data.oe,  "pausing",  false);
     }

      if  (Ek)
     {
        this.Bk(data);
        
        d.pd.ud(data.oe, ["jump"],  data.oe);
     }

      if  (Ek)
        data.Yf  =  d.oa.pa(this.xk,  data.ua,  this, [data]);
      else   if  (Ck)
     {
        d.Ja.add(data.oe,  "sliding");
        this.xk(data);
     }
   },
    vk:  function(Kf,  ne,  oe,  Se,  fe,  ie)
   {
      var   data  =  this.sk[Kf];

      if  (!data)
     {
        data  =  this.sk[Kf] = {
          Kf:Kf,
          ne:ne,
          oe:oe,
          Se:Se,
          Jk:(Se  ==  "classChain"),
          Mk:(ie["wrap"]?this.ok:(ie["bounce"]?this.pk:this.nk)),
          dir:1,
          Nk:ie["classes"],
          Lk:d.oa.ab(ie["classes"]),
          Ok:ie["classes"].join("\\b|\\b"),
          wk:null,
          ua:(fe["interval"] ||  ie["interval"] ||  d.w),
          Pk:d.oa.Ma(ie["onbeforechange"],  null)
       };
        if  (data.Jk)
       {
          data.Qk  =  ie["mainClass"];
          data.children  =  this.Rk(data.oe,  data.Ok);
          data.Sk  =  data.Lk[data.Qk];
       }
        data.Hk  = (data.Jk?data.children.length-1:data.Nk.length-1),
        data.Ak  =  this.Tk(data);
     }

      return   data;
   },
    Tk:  function(data)
   {
      for  (var   i=0;  i<=data.Hk;  i++)
        if  (
         (data.Jk  &&  d.Ja.contains(data.children[i],  data.Qk))
         ||
         (!data.Jk  &&  d.Ja.contains(data.oe,  data.Nk[i]))
       )
          return   i;
   },
    Kk:  function(data,  qb)
   {
      for  (var   i=0;  i<data.children.length;  i++)
        if  (d.Ja.contains(data.children[i],  qb))
          return   i;
   },
    Rk:  function(za,  Ok)
   {
      var   Ng  = [];
      for  (var   Uk  =  za.firstChild;  Uk;  Uk  =  Uk.nextSibling)
        if  (d.Ja.contains(Uk,  Ok))
          Ng.push(Uk);
      return   Ng;
   },
    Ik:  function(data,  hj)
   {
      data.zk  =  data.Ak  +  data.dir*hj;
      if  (data.zk  <  0)
     {
        if  (data.Mk  ==  this.ok)
          data.zk  =  data.Hk;
        else   if  (data.Mk  ==  this.pk)
       {
          data.zk  =  1;
          data.dir  *= -1;
       }
        else 
          data.zk  =  0;
     }
      else   if  (data.zk  >  data.Hk)
     {
        if  (data.Mk  ==  this.ok)
          data.zk  =  0;
        else   if  (data.Mk  ==  this.pk)
       {
          data.zk  =  data.Hk  -  1;
          data.dir  *= -1;
       }
        else 
          data.zk  =  data.Hk;
     }
   },
    xk:  function(data)
   {
      if  (!data.Gk  &&  data.wk  !=  null)
     {
        if  (data.wk  ==  this.qk)
          this.Ik(data,  1);
        else   if  (data.wk  ==  this.rk)
          this.Ik(data, -1);
        else   if  (data.Ak  !=  data.wk)
       {
          var   Vk  =  data.wk  -  data.Ak;
          this.Ik(data,  Vk  /  Math.abs(Vk));
       }

        this.Bk(data);

        d.pd.ud(data.oe, ["slide"],  data.oe);

        if  (data.Ak  !=  data.wk)
       {
          var   fe  =  d.Ja.Ka(data.ne,  "classShifter");
          var   ie  =  d.Ja.Ka(data.oe,  data.Se);
          var   ua  = (fe?fe["interval"]:null) ||  ie["interval"] ||  data.ua  ||  d.w;

          data.Yf  =  d.oa.pa(this.xk,  ua,  this, [data]);
       }
        else 
       {
          data.wk  =  null;
          d.Ja.remove(data.oe,  "sliding");
       }
     }
   },
    Bk:  function(data)
   {
      if  (data.zk  !=  data.Ak)
     {
        if  (!data.Pk  || (data.Pk(data.oe) !=  false))
       {
          if  (data.Jk)
         {
 

            if  (data.Hk  >=  data.Nk.length)
           {
              var   Wk  =  0;
              var   Xk  =  data.Nk.length  -  1;
           }
            else 
           {
              var   Wk  =  data.Sk  -  Math.floor(data.Hk/2);
              var   Xk  =  Wk  +  data.Hk;
           }

            var   Nk  = [];
            for  (var   i=0;  i<data.Nk.length;  i++)
              Nk[i] =  i;
            var   Yk  = (data.Mk  ==  this.ok?Xk:Wk);
            for  (var   i=-1;  i<Wk;  i++)
              Nk[i] =  Yk;
            Yk  = (data.Mk  ==  this.ok?Wk:Xk);
            for  (var   i=Xk  +  1;  i<=  data.Nk.length;  i++)
              Nk[i] =  Yk;

 

            var   Zk  = [];
            for  (var   i=0;  i<=data.Hk;  i++)
              Zk[i] =  data.Lk[d.Ja.match(data.children[i],  data.Ok)];

            var   _l  =  data.zk  -  data.Ak;
            var   al  =  _l/Math.abs(_l);
            for  (var   bl  =  1;  bl  <=  Math.abs(_l);  bl++)
           {
              Zk[-1] =  Zk[data.Hk];
              Zk[data.Hk+1] =  Zk[0];

              var   cl  = [];

              if  (al  ==  1)
                for  (var   i  =  0;  i  <=  data.Hk;  i++)
                  cl[i] =  Nk[Zk[i] - (Zk[i] !=  Zk[i-data.dir]?al:0)];
              else 
                for  (var   i  =  data.Hk;  i>=0;  i--)
                  cl[i] =  Nk[Zk[i] - (Zk[i] !=  Zk[i+data.dir]?al:0)];

              Zk  =  cl;
 
           }

            for  (var   i=0;  i<=data.Hk;  i++)
              d.Ja.replace(data.children[i],  data.Ok,  data.Nk[Zk[i]]);
         }
          else 
            d.Ja.replace(data.oe,  data.Ok,  data.Nk[data.zk]);

          data.Ak  =  data.zk;
       }
     }
   }
};

 d.W(d.mk);

 d["ClassShifter"] =  d.mk;
 d.mk["play"] =  d.mk.uk;
 d.mk["reset"] =  d.mk.reset;

 d.el  = {
    fl:null,
    gl:  null,
    ba:  function()
   {
 
 
 
 
 
 
 
 

      d.Oc.Sc(document.documentElement,  "mousedown",  this.Qi,  this);
      d.Oc.Sc(document.documentElement,  "mouseup",  this.hl,  this);
      d.Oc.Sc(document.documentElement,  "mousemove",  this.Ri,  this);
      d.Oc.Sc(document.documentElement,  "dragstart",  this.il,  this);
   },
    
    Qi:  function(Yc)
   {
      if  (d.wa.xa(d.r,  Yc.subject))
        for  (var   za  =  Yc.subject;  za;  za  =  za.parentNode)
          if  (d.Ja.contains(za,  "button"))
         {
            if  (!this.fl)
              this.fl  = [];

            this.fl.push(za);
            d.Ja.replace(za,  "up",  "down");
         }
   },

    hl:  function(Yc)
   {
      if  (d.wa.xa(d.r,  Yc.subject))
        if  (this.fl)
       {
          for  (var   i=0;  i<this.fl.length;  i++)
            d.Ja.replace(this.fl[i],  "down",  "up");

          this.fl  =  null;
       }
   },

    il:  function(Yc)
   {
      if  (d.wa.xa(d.r,  Yc.subject))
        if  (this.fl)
          for  (var   i=0;  i<this.fl.length;  i++)
            if  (Yc.subject  ==  this.fl[i])
              Yc.cancel();
   },

    Ri:  function(Yc)
   {
      if  (d.wa.xa(d.r,  Yc.subject) &&  this.fl  &&  Yc.subject  !=  this.gl)
     {
        this.gl  =  Yc.subject;

        for  (var   i=0;  i<this.fl.length;  i++)
          if  (d.Ga.Db(this.fl[i],  Yc.subject))
            d.Ja.replace(this.fl[i],  "up",  "down");
          else 
            d.Ja.replace(this.fl[i],  "down",  "up");
     }
   }
};

 d.el.ba();d.jl  = {
    ba:  function()
   {
      d.Oc.Sc(document.documentElement,  d.D,  this.Jd,  this);
      d.Oc.Sc(document.documentElement,  "keyup",  this.Jd,  this);
   },
    
    Jd:  function(Yc)
   {
      var   za  =  Yc.subject;
      if  (za.name)
     {
        var   value  =  d.Ga.Cb(za);

        if  (value  ||  za.kl)
       {
          var   ll  =  za.kl?document.getElementById(za.kl):d.Ga.Ha(za,  "reflector");

          if  (ll)
         {
            if  (!za.kl)
           {
              za.kl  =  d.Ga.lb(ll);
              d.Oc.Sc(za,  "paste",  this.ml,  this);
           }

            d.Ja.replace(ll,  za.name  +  "-[^\\s]*",  za.name  +  "-"  +  value);
         }
       }
     }
   },
    
    ml:  function(Yc)
   {
      d.oa.pa(this.Jd,  0,  this, [Yc])
   }
};

 d.W(d.jl);
 
 
 d.Ja.add(document.documentElement,  "spiffy "  +  d.oa.platform,  d.L);

 d.Oc.Sc(
    window,
    d.C,
    function()
   {
      if  (document.compatMode  ==  "BackCompat")
        d.V  =  document.body;

      
      if  (d.R)
     {
        var   nl  =  document.getElementsByTagName("object");
        for  (var   i=nl.length-1;  i>=0;  i--)
          nl[i].outerHTML  =  nl[i].outerHTML;
     }

      d.Ja.replace(document.body,  d.B,  d.z);

      d.wa.xa(d.o,  document.body);
   }
);

 if  (d.R)
{
    
    
    
 

 
 

    
    
    
    

    
    if  (!d.S)
   {
      try 
     {
        document.execCommand("BackgroundImageCache",  false,  true);
     }
      catch(Ig){}
   }
}

 d.wa.xa("spifLoaded");

 d["documentScrollElement"] =  d.V;


/*!
 * jQuery JavaScript Library v1.6.2
 * http://jquery.com/
 *
 * Copyright 2011, John Resig
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 * Copyright 2011, The Dojo Foundation
 * Released under the MIT, BSD, and GPL Licenses.
 *
 * Date: Thu Jun 30 14:16:56 2011 -0400
 */
(function(a,b){function cv(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cs(a){if(!cg[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ch||(ch=c.createElement("iframe"),ch.frameBorder=ch.width=ch.height=0),b.appendChild(ch);if(!ci||!ch.createElement)ci=(ch.contentWindow||ch.contentDocument).document,ci.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),ci.close();d=ci.createElement(a),ci.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ch)}cg[a]=e}return cg[a]}function cr(a,b){var c={};f.each(cm.concat.apply([],cm.slice(0,b)),function(){c[this]=a});return c}function cq(){cn=b}function cp(){setTimeout(cq,0);return cn=f.now()}function cf(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ce(){try{return new a.XMLHttpRequest}catch(b){}}function b$(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function bZ(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function bY(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bC.test(a)?d(a,e):bY(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)bY(a+"["+e+"]",b[e],c,d);else d(a,b)}function bX(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bR,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bX(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bX(a,c,d,e,"*",g));return l}function bW(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bN),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bA(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bv:bw;if(d>0){c!=="border"&&f.each(e,function(){c||(d-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?d+=parseFloat(f.css(a,c+this))||0:d-=parseFloat(f.css(a,"border"+this+"Width"))||0});return d+"px"}d=bx(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0,c&&f.each(e,function(){d+=parseFloat(f.css(a,"padding"+this))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+this+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+this))||0)});return d+"px"}function bm(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(be,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bl(a){f.nodeName(a,"input")?bk(a):"getElementsByTagName"in a&&f.grep(a.getElementsByTagName("input"),bk)}function bk(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bj(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function bi(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bh(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c=f.expando,d=f.data(a),e=f.data(b,d);if(d=d[c]){var g=d.events;e=e[c]=f.extend({},d);if(g){delete e.handle,e.events={};for(var h in g)for(var i=0,j=g[h].length;i<j;i++)f.event.add(b,h+(g[h][i].namespace?".":"")+g[h][i].namespace,g[h][i],g[h][i].data)}}}}function bg(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function W(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(R.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function V(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function N(a,b){return(a&&a!=="*"?a+".":"")+b.replace(z,"`").replace(A,"&")}function M(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;i<s.length;i++)g=s[i],g.origType.replace(x,"")===a.type?q.push(g.selector):s.splice(i--,1);e=f(a.target).closest(q,a.currentTarget);for(j=0,k=e.length;j<k;j++){m=e[j];for(i=0;i<s.length;i++){g=s[i];if(m.selector===g.selector&&(!n||n.test(g.namespace))&&!m.elem.disabled){h=m.elem,d=null;if(g.preType==="mouseenter"||g.preType==="mouseleave")a.type=g.preType,d=f(a.relatedTarget).closest(g.selector)[0],d&&f.contains(h,d)&&(d=h);(!d||d!==h)&&p.push({elem:h,handleObj:g,level:m.level})}}}for(j=0,k=p.length;j<k;j++){e=p[j];if(c&&e.level>c)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function K(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function E(){return!0}function D(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(j,"$1-$2").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(g){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=/-([a-z])/ig,x=function(a,b){return b.toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!A){A=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a);return c===b||D.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(b,c,d){a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),d=c.documentElement,(!d||!d.nodeName||d.nodeName==="parsererror")&&e.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:G?function(a){return a==null?"":G.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b){if(H)return H.call(b,a);for(var c=0,d=b.length;c<d;c++)if(b[c]===a)return c;return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f.concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=s.exec(a)||t.exec(a)||u.exec(a)||a.indexOf("compatible")<0&&v.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener("DOMContentLoaded",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",B),e.ready())});return e}(),g="done fail isResolved isRejected promise then always pipe".split(" "),h=[].slice;f.extend({_Deferred:function(){var a=[],b,c,d,e={done:function(){if(!d){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=f.type(i),j==="array"?e.done.apply(e,i):j==="function"&&a.push(i);k&&e.resolveWith(k[0],k[1])}return this},resolveWith:function(e,f){if(!d&&!b&&!c){f=f||[],c=1;try{while(a[0])a.shift().apply(e,f)}finally{b=[e,f],c=0}}return this},resolve:function(){e.resolveWith(this,arguments);return this},isResolved:function(){return!!c||!!b},cancel:function(){d=1,a=[];return this}};return e},Deferred:function(a){var b=f._Deferred(),c=f._Deferred(),d;f.extend(b,{then:function(a,c){b.done(a).fail(c);return this},always:function(){return b.done.apply(b,arguments).fail.apply(this,arguments)},fail:c.done,rejectWith:c.resolveWith,reject:c.resolve,isRejected:c.isResolved,pipe:function(a,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[c,"reject"]},function(a,c){var e=c[0],g=c[1],h;f.isFunction(e)?b[a](function(){h=e.apply(this,arguments),h&&f.isFunction(h.promise)?h.promise().then(d.resolve,d.reject):d[g](h)}):b[a](d[g])})}).promise()},promise:function(a){if(a==null){if(d)return d;d=a={}}var c=g.length;while(c--)a[g[c]]=b[g[c]];return a}}),b.done(c.cancel).fail(b.cancel),delete b.cancel,a&&a.call(b,b);return b},when:function(a){function i(a){return function(c){b[a]=arguments.length>1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c<d;c++)b[c]&&f.isFunction(b[c].promise)?b[c].promise().then(i(c),g.reject):--e;e||g.resolveWith(g,b)}else g!==a&&g.resolveWith(g,d?[a]:[]);return g.promise()}}),f.support=function(){var a=c.createElement("div"),b=c.documentElement,d,e,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;a.setAttribute("className","t"),a.innerHTML="   <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=a.getElementsByTagName("input")[0],k={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,k.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,k.optDisabled=!h.disabled;try{delete a.test}catch(v){k.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function(){k.noCloneEvent=!1}),a.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),k.radioValue=i.value==="t",i.setAttribute("checked","checked"),a.appendChild(i),l=c.createDocumentFragment(),l.appendChild(a.firstChild),k.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",m=c.getElementsByTagName("body")[0],o=c.createElement(m?"div":"body"),p={visibility:"hidden",width:0,height:0,border:0,margin:0},m&&f.extend(p,{position:"absolute",left:-1e3,top:-1e3});for(t in p)o.style[t]=p[t];o.appendChild(a),n=m||b,n.insertBefore(o,n.firstChild),k.appendChecked=i.checked,k.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,k.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",k.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",q=a.getElementsByTagName("td"),u=q[0].offsetHeight===0,q[0].style.display="",q[1].style.display="none",k.reliableHiddenOffsets=u&&q[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",a.appendChild(j),k.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0),o.innerHTML="",n.removeChild(o);if(a.attachEvent)for(t in{submit:1,change:1,focusin:1})s="on"+t,u=s in a,u||(a.setAttribute(s,"return;"),u=typeof a[s]=="function"),k[t+"Bubbles"]=u;o=l=g=h=m=j=a=i=null;return k}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([a-z])([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g=f.expando,h=typeof c=="string",i,j=a.nodeType,k=j?f.cache:a,l=j?a[f.expando]:a[f.expando]&&f.expando;if((!l||e&&l&&!k[l][g])&&h&&d===b)return;l||(j?a[f.expando]=l=++f.uuid:l=f.expando),k[l]||(k[l]={},j||(k[l].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?k[l][g]=f.extend(k[l][g],c):k[l]=f.extend(k[l],c);i=k[l],e&&(i[g]||(i[g]={}),i=i[g]),d!==b&&(i[f.camelCase(c)]=d);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[f.camelCase(c)]||i[c]:i}},removeData:function(b,c,d){if(!!f.acceptData(b)){var e=f.expando,g=b.nodeType,h=g?f.cache:b,i=g?b[f.expando]:f.expando;if(!h[i])return;if(c){var j=d?h[i][e]:h[i];if(j){delete j[c];if(!l(j))return}}if(d){delete h[i][e];if(!l(h[i]))return}var k=h[i][e];f.support.deleteExpando||h!=a?delete h[i]:h[i]=null,k?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=k):g&&(f.support.deleteExpando?delete b[f.expando]:b.removeAttribute?b.removeAttribute(f.expando):b[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h<i;h++)g=e[h].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),k(this[0],g,d[g]))}}return d}if(typeof a=="object")return this.each(function(){f.data(this,a)});var j=a.split(".");j[1]=j[1]?"."+j[1]:"";if(c===b){d=this.triggerHandler("getData"+j[1]+"!",[j[0]]),d===b&&this.length&&(d=f.data(this[0],a),d=k(this[0],a,d));return d===b&&j[1]?this.data(j[0]):d}return this.each(function(){var b=f(this),d=[j[0],c];b.triggerHandler("setData"+j[1]+"!",d),f.data(this,a,c),b.triggerHandler("changeData"+j[1]+"!",d)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,c){a&&(c=(c||"fx")+"mark",f.data(a,c,(f.data(a,c,b,!0)||0)+1,!0))},_unmark:function(a,c,d){a!==!0&&(d=c,c=a,a=!1);if(c){d=d||"fx";var e=d+"mark",g=a?0:(f.data(c,e,b,!0)||1)-1;g?f.data(c,e,g,!0):(f.removeData(c,e,!0),m(c,d,"mark"))}},queue:function(a,c,d){if(a){c=(c||"fx")+"queue";var e=f.data(a,c,b,!0);d&&(!e||f.isArray(d)?e=f.data(a,c,f.makeArray(d),!0):e.push(d));return e||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e;d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),d.call(a,function(){f.dequeue(a,b)})),c.length||(f.removeData(a,b+"queue",!0),m(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(){var c=this;setTimeout(function(){f.dequeue(c,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f._Deferred(),!0))h++,l.done(m);m();return d.promise()}});var n=/[\n\t\r]/g,o=/\s+/,p=/\r/g,q=/^(?:button|input)$/i,r=/^(?:button|input|object|select|textarea)$/i,s=/^a(?:rea)?$/i,t=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,u=/\:|^on/,v,w;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(o);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(o);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(n," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(o);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ";for(var c=0,d=this.length;c<d;c++)if((" "+this[c].className+" ").replace(n," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;d=e.value;return typeof d=="string"?d.replace(p,""):d==null?"":d}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c=a.selectedIndex,d=[],e=a.options,g=a.type==="select-one";if(c<0)return null;for(var h=g?c:0,i=g?c+1:e.length;h<i;h++){var j=e[h];if(j.selected&&(f.support.optDisabled?!j.disabled:j.getAttribute("disabled")===null)&&(!j.parentNode.disabled||!f.nodeName(j.parentNode,"optgroup"))){b=f(j).val();if(g)return b;d.push(b)}}if(g&&!d.length&&e.length)return f(e[c]).val();return d},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);var h,i,j=g!==1||!f.isXMLDoc(a);j&&(c=f.attrFix[c]||c,i=f.attrHooks[c],i||(t.test(c)?i=w:v&&c!=="className"&&(f.nodeName(a,"form")||u.test(c))&&(i=v)));if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j&&(h=i.get(a,c))!==null)return h;h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){var c;a.nodeType===1&&(b=f.attrFix[b]||b,f.support.getSetAttribute?a.removeAttribute(b):(f.attr(a,b,""),a.removeAttributeNode(a.getAttributeNode(b))),t.test(b)&&(c=f.propFix[b]||b)in a&&(a[c]=!1))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},tabIndex:{get:function(a){var c=a.getAttributeNode("tabIndex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}},value:{get:function(a,b){if(v&&f.nodeName(a,"button"))return v.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(v&&f.nodeName(a,"button"))return v.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);i&&(c=f.propFix[c]||c,h=f.propHooks[c]);return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==b?g:a[c]},propHooks:{}}),w={get:function(a,c){return f.prop(a,c)?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},f.support.getSetAttribute||(f.attrFix=f.propFix,v=f.attrHooks.name=f.attrHooks.title=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&d.nodeValue!==""?d.nodeValue:b},set:function(a,b,c){var d=a.getAttributeNode(c);if(d){d.nodeValue=b;return b}}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var x=/\.(.*)$/,y=/^(?:textarea|input|select)$/i,z=/\./g,A=/ /g,B=/[^\w\s.|`]/g,C=function(a){return a.replace(B,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=D;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=D);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),C).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j<p.length;j++){q=p[j];if(l||n.test(q.namespace))f.event.remove(a,r,q.handler,j),p.splice(j--,1)}continue}o=f.event.special[h]||{};for(j=e||0;j<p.length;j++){q=p[j];if(d.guid===q.guid){if(l||n.test(q.namespace))e==null&&p.splice(j--,1),o.remove&&o.remove.call(a,q);if(e!=null)break}}if(p.length===0||e!=null&&p.length===1)(!o.teardown||o.teardown.call(a,m)===!1)&&f.removeEvent(a,h,s.handle),g=null,delete t[h]}if(f.isEmptyObject(t)){var u=s.handle;u&&(u.elem=null),delete s.events,delete s.handle,f.isEmptyObject(s)&&f.removeData(a,b,!0)}}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){var h=c.type||c,i=[],j;h.indexOf("!")>=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.
shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d!=null?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h<i;h++){var j=d[h];if(e||c.namespace_re.test(j.namespace)){c.handler=j.handler,c.data=j.data,c.handleObj=j;var k=j.handler.apply(this,g);k!==b&&(c.result=k,k===!1&&(c.preventDefault(),c.stopPropagation()));if(c.isImmediatePropagationStopped())break}}return c.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[f.expando])return a;var d=a;a=f.Event(d);for(var e=this.props.length,g;e;)g=this.props[--e],a[g]=d[g];a.target||(a.target=a.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),!a.relatedTarget&&a.fromElement&&(a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement);if(a.pageX==null&&a.clientX!=null){var h=a.target.ownerDocument||c,i=h.documentElement,j=h.body;a.pageX=a.clientX+(i&&i.scrollLeft||j&&j.scrollLeft||0)-(i&&i.clientLeft||j&&j.clientLeft||0),a.pageY=a.clientY+(i&&i.scrollTop||j&&j.scrollTop||0)-(i&&i.clientTop||j&&j.clientTop||0)}a.which==null&&(a.charCode!=null||a.keyCode!=null)&&(a.which=a.charCode!=null?a.charCode:a.keyCode),!a.metaKey&&a.ctrlKey&&(a.metaKey=a.ctrlKey),!a.which&&a.button!==b&&(a.which=a.button&1?1:a.button&2?3:a.button&4?2:0);return a},guid:1e8,proxy:f.proxy,special:{ready:{setup:f.bindReady,teardown:f.noop},live:{add:function(a){f.event.add(this,N(a.origType,a.selector),f.extend({},a,{handler:M,guid:a.handler.guid}))},remove:function(a){f.event.remove(this,N(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}}},f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!this.preventDefault)return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?E:D):this.type=a,b&&f.extend(this,b),this.timeStamp=f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=E;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=E;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=E,this.stopPropagation()},isDefaultPrevented:D,isPropagationStopped:D,isImmediatePropagationStopped:D};var F=function(a){var b=a.relatedTarget,c=!1,d=a.type;a.type=a.data,b!==this&&(b&&(c=f.contains(this,b)),c||(f.event.handle.apply(this,arguments),a.type=d))},G=function(a){a.type=a.data,f.event.handle.apply(this,arguments)};f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={setup:function(c){f.event.add(this,b,c&&c.selector?G:F,a)},teardown:function(a){f.event.remove(this,b,a&&a.selector?G:F)}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(a,b){if(!f.nodeName(this,"form"))f.event.add(this,"click.specialSubmit",function(a){var b=a.target,c=b.type;(c==="submit"||c==="image")&&f(b).closest("form").length&&K("submit",this,arguments)}),f.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,c=b.type;(c==="text"||c==="password")&&f(b).closest("form").length&&a.keyCode===13&&K("submit",this,arguments)});else return!1},teardown:function(a){f.event.remove(this,".specialSubmit")}});if(!f.support.changeBubbles){var H,I=function(a){var b=a.type,c=a.value;b==="radio"||b==="checkbox"?c=a.checked:b==="select-multiple"?c=a.selectedIndex>-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},J=function(c){var d=c.target,e,g;if(!!y.test(d.nodeName)&&!d.readOnly){e=f._data(d,"_change_data"),g=I(d),(c.type!=="focusout"||d.type!=="radio")&&f._data(d,"_change_data",g);if(e===b||g===e)return;if(e!=null||g)c.type="change",c.liveFired=b,f.event.trigger(c,arguments[1],d)}};f.event.special.change={filters:{focusout:J,beforedeactivate:J,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&J.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&J.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",I(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in H)f.event.add(this,c+".specialChange",H[c]);return y.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return y.test(this.nodeName)}},H=f.event.special.change.filters,H.focus=H.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i<j;i++)f.event.add(this[i],a,g,d);return this}}),f.fn.extend({unbind:function(a,b){if(typeof a=="object"&&!a.preventDefault)for(var c in a)this.unbind(c,a[c]);else for(var d=0,e=this.length;d<e;d++)f.event.remove(this[d],a,b);return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f.data(this,"lastToggle"+a.guid)||0)%d;f.data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var L={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};f.each(["live","die"],function(a,c){f.fn[c]=function(a,d,e,g){var h,i=0,j,k,l,m=g||this.selector,n=g?this:f(this.context);if(typeof a=="object"&&!a.preventDefault){for(var o in a)n[c](o,d,a[o],m);return this}if(c==="die"&&!a&&g&&g.charAt(0)==="."){n.unbind(g);return this}if(d===!1||f.isFunction(d))e=d||D,d=b;a=(a||"").split(" ");while((h=a[i++])!=null){j=x.exec(h),k="",j&&(k=j[0],h=h.replace(x,""));if(h==="hover"){a.push("mouseenter"+k,"mouseleave"+k);continue}l=h,L[h]?(a.push(L[h]+k),h=h+k):h=(L[h]||h)+k;if(c==="live")for(var p=0,q=n.length;p<q;p++)f.event.add(n[p],"live."+N(h,m),{data:d,selector:m,handler:e,origType:h,origHandler:e,preType:l});else n.unbind("live."+N(h,m),e)}return this}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}if(i.nodeType===1){f||(i.sizcache=c,i.sizset=g);if(typeof b!="string"){if(i===b){j=!0;break}}else if(k.filter(b,[i]).length>0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}i.nodeType===1&&!f&&(i.sizcache=c,i.sizset=g);if(i.nodeName.toLowerCase()===b){j=i;break}i=i[a]}d[g]=j}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},k.matches=function(a,b){return k(a,null,null,b)},k.matchesSelector=function(a,b){return k(b,null,null,[a]).length>0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e<f;e++){var g,h=l.order[e];if(g=l.leftMatch[h].exec(a)){var j=g[1];g.splice(1,1);if(j.substr(j.length-1)!=="\\"){g[1]=(g[1]||"").replace(i,""),d=l.find[h](g,b,c);if(d!=null){a=a.replace(l.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},k.filter=function(a,c,d,e){var f,g,h=a,i=[],j=c,m=c&&c[0]&&k.isXML(c[0]);while(a&&c.length){for(var n in l.filter)if((f=l.leftMatch[n].exec(a))!=null&&f[2]){var o,p,q=l.filter[n],r=f[1];g=!1,f.splice(1,1);if(r.substr(r.length-1)==="\\")continue;j===i&&(i=[]);if(l.preFilter[n]){f=l.preFilter[n](f,j,d,i,e,m);if(!f)g=o=!0;else if(f===!0)continue}if(f)for(var s=0;(p=j[s])!=null;s++)if(p){o=q(p,f,s,j);var t=e^!!o;d&&o!=null?t?g=!0:j[s]=!1:t&&(i.push(p),g=!0)}if(o!==b){d||(j=i),a=a.replace(l.match[n],"");if(!g)return[];break}}if(a===h)if(g==null)k.error(a);else break;h=a}return j},k.error=function(a){throw"Syntax error, unrecognized expression: "+a};var l=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!j.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&k.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&k.filter(b,a,!0)}},"":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("parentNode",b,f,a,e,c)},"~":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("previousSibling",b,f,a,e,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(i,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}k.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case"only":case"first":while(d=d.previousSibling)if(d.nodeType===1)return!1;if(c==="first")return!0;d=a;case"last":while(d=d.nextSibling)if(d.nodeType===1)return!1;return!0;case"nth":var e=b[2],f=b[3];if(e===1&&f===0)return!0;var g=b[0],h=a.parentNode;if(h&&(h.sizcache!==g||!a.nodeIndex)){var i=0;for(d=h.firstChild;d;d=d.nextSibling)d.nodeType===1&&(d.nodeIndex=++i);h.sizcache=g}var j=a.nodeIndex-f;return e===0?j===0:j%e===0&&j/e>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c<f;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var r,s;c.documentElement.compareDocumentPosition?r=function(a,b){if(a===b){g=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(r=function(a,b){if(a===b){g=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],h=a.parentNode,i=b.parentNode,j=h;if(h===i)return s(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return s(e[k],f[k]);return k===c?s(a,f[k],-1):s(e[k],b,1)},s=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),k.getText=function(a){var b="",c;for(var d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=k.getText(c.childNodes));return b},function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g<h;g++)k(a,f[g],d);return k.filter(e,d)};f.find=k,f.expr=k.selectors,f.expr[":"]=f.expr.filters,f.unique=k.uniqueSort,f.text=k.getText,f.isXMLDoc=k.isXML,f.contains=k.contains}();var O=/Until$/,P=/^(?:parents|prevUntil|prevAll)/,Q=/,/,R=/^.[^:#\[\.,]*$/,S=Array.prototype.slice,T=f.expr.match.POS,U={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(W(this,a,!1),"not",a)},filter:function(a){return this.pushStack(W(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d<e;d++)i=a[d],j[i]||(j[i]=T.test(i)?f(i,b||this.context):i);while(g&&g.ownerDocument&&g!==b){for(i in j)h=j[i],(h.jquery?h.index(g)>-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=T.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(l?l.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a=="string")return f.inArray(this[0],a?f(a):this.parent().children());return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(V(c[0])||V(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=S.call(arguments);O.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!U[a]?f.unique(e):e,(this.length>1||Q.test(d))&&P.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var X=/ jQuery\d+="(?:\d+|null)"/g,Y=/^\s+/,Z=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,$=/<([\w:]+)/,_=/<tbody/i,ba=/<|&#?\w+;/,bb=/<(?:script|object|embed|option|style)/i,bc=/checked\s*(?:[^=]|=\s*.checked.)/i,bd=/\/(java|ecma)script/i,be=/^\s*<!(?:\[CDATA\[|\-\-)/,bf={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};bf.optgroup=bf.option,bf.tbody=bf.tfoot=bf.colgroup=bf.caption=bf.thead,bf.th=bf.td,f.support.htmlSerialize||(bf._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(X,""):null;if(typeof a=="string"&&!bb.test(a)&&(f.support.leadingWhitespace||!Y.test(a))&&!bf[($.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Z,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bc.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bg(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bm)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i;b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof a[0]=="string"&&a[0].length<512&&i===c&&a[0].charAt(0)==="<"&&!bb.test(a[0])&&(f.support.checkClone||!bc.test(a[0]))&&(g=!0,h=f.fragments[a[0]],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[a[0]]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j
)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bi(a,d),e=bj(a),g=bj(d);for(h=0;e[h];++h)bi(e[h],g[h])}if(b){bh(a,d);if(c){e=bj(a),g=bj(d);for(h=0;e[h];++h)bh(e[h],g[h])}}e=g=null;return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!ba.test(k))k=b.createTextNode(k);else{k=k.replace(Z,"<$1></$2>");var l=($.exec(k)||["",""])[1].toLowerCase(),m=bf[l]||bf._default,n=m[0],o=b.createElement("div");o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=_.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&Y.test(k)&&o.insertBefore(b.createTextNode(Y.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i<r;i++)bl(k[i]);else bl(k);k.nodeType?h.push(k):h=f.merge(h,k)}if(d){g=function(a){return!a.type||bd.test(a.type)};for(j=0;h[j];j++)if(e&&f.nodeName(h[j],"script")&&(!h[j].type||h[j].type.toLowerCase()==="text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]);else{if(h[j].nodeType===1){var s=f.grep(h[j].getElementsByTagName("script"),g);h.splice.apply(h,[j+1,0].concat(s))}d.appendChild(h[j])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.expando,g=f.event.special,h=f.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&f.noData[j.nodeName.toLowerCase()])continue;c=j[f.expando];if(c){b=d[c]&&d[c][e];if(b&&b.events){for(var k in b.events)g[k]?f.event.remove(j,k):f.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[f.expando]:j.removeAttribute&&j.removeAttribute(f.expando),delete d[c]}}}});var bn=/alpha\([^)]*\)/i,bo=/opacity=([^)]*)/,bp=/([A-Z]|^ms)/g,bq=/^-?\d+(?:px)?$/i,br=/^-?\d/,bs=/^[+\-]=/,bt=/[^+\-\.\de]+/g,bu={position:"absolute",visibility:"hidden",display:"block"},bv=["Left","Right"],bw=["Top","Bottom"],bx,by,bz;f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bx(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d;if(h==="number"&&isNaN(d)||d==null)return;h==="string"&&bs.test(d)&&(d=+d.replace(bt,"")+parseFloat(f.css(a,c)),h="number"),h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bx)return bx(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){if(a.offsetWidth!==0)return bA(a,b,d);f.swap(a,bu,function(){e=bA(a,b,d)});return e}},set:function(a,b){if(!bq.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bo.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle;c.zoom=1;var e=f.isNaN(b)?"":"alpha(opacity="+b*100+")",g=d&&d.filter||c.filter||"";c.filter=bn.test(g)?g.replace(bn,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bx(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(by=function(a,c){var d,e,g;c=c.replace(bp,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bz=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bq.test(d)&&br.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bx=by||bz,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bB=/%20/g,bC=/\[\]$/,bD=/\r?\n/g,bE=/#.*$/,bF=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bG=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bH=/^(?:about|app|app\-storage|.+\-extension|file|widget):$/,bI=/^(?:GET|HEAD)$/,bJ=/^\/\//,bK=/\?/,bL=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bM=/^(?:select|textarea)/i,bN=/\s+/,bO=/([?&])_=[^&]*/,bP=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bQ=f.fn.load,bR={},bS={},bT,bU;try{bT=e.href}catch(bV){bT=c.createElement("a"),bT.href="",bT=bT.href}bU=bP.exec(bT.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bQ)return bQ.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bL,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bM.test(this.nodeName)||bG.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bD,"\r\n")}}):{name:b.name,value:c.replace(bD,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?f.extend(!0,a,f.ajaxSettings,b):(b=a,a=f.extend(!0,f.ajaxSettings,b));for(var c in{context:1,url:1})c in b?a[c]=b[c]:c in f.ajaxSettings&&(a[c]=f.ajaxSettings[c]);return a},ajaxSettings:{url:bT,isLocal:bH.test(bU[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML}},ajaxPrefilter:bW(bR),ajaxTransport:bW(bS),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a?4:0;var o,r,u,w=l?bZ(d,v,l):b,x,y;if(a>=200&&a<300||a===304){if(d.ifModified){if(x=v.getResponseHeader("Last-Modified"))f.lastModified[k]=x;if(y=v.getResponseHeader("Etag"))f.etag[k]=y}if(a===304)c="notmodified",o=!0;else try{r=b$(d,w),c="success",o=!0}catch(z){c="parsererror",u=z}}else{u=c;if(!c||a)c="error",a<0&&(a=0)}v.status=a,v.statusText=c,o?h.resolveWith(e,[r,c,v]):h.rejectWith(e,[v,c,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.resolveWith(e,[v,c]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f._Deferred(),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bF.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.done,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bE,"").replace(bJ,bU[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bN),d.crossDomain==null&&(r=bP.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bU[1]&&r[2]==bU[2]&&(r[3]||(r[1]==="http:"?80:443))==(bU[3]||(bU[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bX(bR,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bI.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bK.test(d.url)?"&":"?")+d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bO,"$1_="+x);d.url=y+(y===d.url?(bK.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", */*; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bX(bS,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){status<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)bY(g,a[g],c,e);return d.join("&").replace(bB,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var b_=f.now(),ca=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+b_++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ca.test(b.url)||e&&ca.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ca,l),b.url===j&&(e&&(k=k.replace(ca,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cb=a.ActiveXObject?function(){for(var a in cd)cd[a](0,1)}:!1,cc=0,cd;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ce()||cf()}:ce,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cb&&delete cd[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cc,cb&&(cd||(cd={},f(a).unload(cb)),cd[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cg={},ch,ci,cj=/^(?:toggle|show|hide)$/,ck=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cl,cm=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cn,co=a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cr("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",cs(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cr("hide",3),a,b,c);for(var d=0,e=this.length;d<e;d++)if(this[d].style){var g=f.css(this[d],"display");g!=="none"&&!f._data(this[d],"olddisplay")&&f._data(this[d],"olddisplay",g)}for(d=0;d<e;d++)this[d].style&&(this[d].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cr("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return this[e.queue===!1?"each":"queue"](function(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(f.support.inlineBlockNeedsLayout?(j=cs(this.nodeName),j==="inline"?this.style.display="inline-block":(this.style.display="inline",this.style.zoom=1)):this.style.display="inline-block"))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)k=new f.fx(this,b,i),h=a[i],cj.test(h)?k[h==="toggle"?d?"show":"hide":h]():(l=ck.exec(h),m=k.cur(),l?(n=parseFloat(l[2]),o=l[3]||(f.cssNumber[i]?"":"px"),o!=="px"&&(f.style(this,i,(n||1)+o),m=(n||1)/k.cur()*m,f.style(this,i,m+o)),l[1]&&(n=(l[1]==="-="?-1:1)*n+m),k.custom(m,n,o)):k.custom(m,h,""));return!0})},stop:function(a,b){a&&this.queue([]),this.each(function(){var a=f.timers,c=a.length;b||f._unmark(!0,this);while(c--)a[c].elem===this&&(b&&a[c](!0),a.splice(c,1))}),b||this.dequeue();return this}}),f.each({slideDown:cr("show",1),slideUp:cr("hide",1),slideToggle:cr("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default,d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue!==!1?f.dequeue(this):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function h(a){return d.step(a)}var d=this,e=f.fx,g;this.startTime=cn||cp(),this.start=a,this.end=b,this.unit=c||this.unit||(f.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,h.elem=this.elem,h()&&f.timers.push(h)&&!cl&&(co?(cl=!0,g=function(){cl&&(co(g),e.tick())},co(g)):cl=setInterval(e.tick,e.interval))},show:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=cn||cp(),c=!0,d=this.elem,e=this.options,g,h;if(a||b>=e.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),e.animatedProperties[this.prop]=!0;for(g in e.animatedProperties)e.animatedProperties[g]!==!0&&(c=!1);if(c){e.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){d.style["overflow"+b]=e.overflow[a]}),e.hide&&f(d).hide();if(e.hide||e.show)for(var i in e.animatedProperties)f.style(d,i,e.orig[i]);e.complete.call(d)}return!1}e.duration==Infinity?this.now=b:(h=b-this.startTime,this.state=h/e.duration,this.pos=f.easing[e.animatedProperties[this.prop]](this.state,h,0,1,e.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){for(var a=f.timers,b=0;b<a.length;++b)a[b]()||a.splice(b--,1);a.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cl),cl=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit:a.elem[a.prop]=a.now}}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var ct=/^t(?:able|d|h)$/i,cu=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cv(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);f.offset.initialize();var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.offset.supportsFixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.offset.doesNotAddBorder&&(!f.offset.doesAddBorderForTableAndCells||!ct.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.offset.supportsFixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={initialize:function(){var a=c.body,b=c.createElement("div"),d,e,g,h,i=parseFloat(f.css(a,"marginTop"))||0,j="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";f.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),d=b.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,this.doesNotAddBorder=e.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,e.style.position="fixed",e.style.top="20px",this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),f.offset.initialize=f.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.offset.initialize(),f.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cu.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cu.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cv(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cv(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a&&a.style?parseFloat(f.css(a,d,"padding")):null},f.fn["outer"+c]=function(a){var b=this[0];return b&&b.style?parseFloat(f.css(b,d,a?"margin":"border")):null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c];return e.document.compatMode==="CSS1Compat"&&g||e.document.body["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var h=f.css(e,d),i=parseFloat(h);return f.isNaN(i)?h:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window);
/* ------------------------------------------------------------------------
	Class: prettyPhoto
	Use: Lightbox clone for jQuery
	Author: Stephane Caron (http://www.no-margin-for-errors.com)
	Version: 3.1.3
------------------------------------------------------------------------- */

(function($){$.prettyPhoto={version:'3.1.3'};$.fn.prettyPhoto=function(pp_settings){pp_settings=jQuery.extend({animation_speed:'fast',slideshow:5000,autoplay_slideshow:false,opacity:0.80,show_title:true,allow_resize:true,default_width:500,default_height:344,counter_separator_label:'/',theme:'pp_default',horizontal_padding:20,hideflash:false,wmode:'opaque',autoplay:true,modal:false,deeplinking:true,overlay_gallery:true,keyboard_shortcuts:true,changepicturecallback:function(){},callback:function(){},ie6_fallback:true,markup:'<div class="pp_pic_holder"> \
      <div class="ppt">&nbsp;</div> \
      <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"> \
           <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> \
           <p class="pp_description"></p> \
           <div class="pp_social">{pp_social}</div> \
           <a class="pp_close" href="#">Close</a> \
          </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>',gallery_markup:'<div class="pp_gallery"> \
        <a href="#" class="pp_arrow_previous">Previous</a> \
        <div> \
         <ul> \
          {gallery} \
         </ul> \
        </div> \
        <a href="#" class="pp_arrow_next">Next</a> \
       </div>',image_markup:'<img id="fullResImage" src="{path}" />',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">{content}</div>',custom_markup:'',social_tools:'<div class="twitter"><a href="http://twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div><div class="facebook"><iframe src="http://www.facebook.com/plugins/like.php?locale=en_US&href={location_href}&amp;layout=button_count&amp;show_faces=true&amp;width=500&amp;action=like&amp;font&amp;colorscheme=light&amp;height=23" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:500px; height:23px;" allowTransparency="true"></iframe></div>'},pp_settings);var matchedObjects=this,percentBased=false,pp_dimensions,pp_open,pp_contentHeight,pp_contentWidth,pp_containerHeight,pp_containerWidth,windowHeight=$(window).height(),windowWidth=$(window).width(),pp_slideshow;doresize=true,scroll_pos=_get_scroll();$(window).unbind('resize.prettyphoto').bind('resize.prettyphoto',function(){_center_overlay();_resize_overlay();});if(pp_settings.keyboard_shortcuts){$(document).unbind('keydown.prettyphoto').bind('keydown.prettyphoto',function(e){if(typeof $pp_pic_holder!='undefined'){if($pp_pic_holder.is(':visible')){switch(e.keyCode){case 37:$.prettyPhoto.changePage('previous');e.preventDefault();break;case 39:$.prettyPhoto.changePage('next');e.preventDefault();break;case 27:if(!settings.modal)
$.prettyPhoto.close();e.preventDefault();break;};};};});};$.prettyPhoto.initialize=function(){settings=pp_settings;if(settings.theme=='pp_default')settings.horizontal_padding=16;if(settings.ie6_fallback&&$.browser.msie&&parseInt($.browser.version)==6)settings.theme="light_square";theRel=$(this).attr('rel');galleryRegExp=/\[(?:.*)\]/;isSet=(galleryRegExp.exec(theRel))?true:false;pp_images=(isSet)?jQuery.map(matchedObjects,function(n,i){if($(n).attr('rel').indexOf(theRel)!=-1)return $(n).attr('href');}):$.makeArray($(this).attr('href'));pp_titles=(isSet)?jQuery.map(matchedObjects,function(n,i){if($(n).attr('rel').indexOf(theRel)!=-1)return($(n).find('img').attr('alt'))?$(n).find('img').attr('alt'):"";}):$.makeArray($(this).find('img').attr('alt'));pp_descriptions=(isSet)?jQuery.map(matchedObjects,function(n,i){if($(n).attr('rel').indexOf(theRel)!=-1)return($(n).attr('title'))?$(n).attr('title'):"";}):$.makeArray($(this).attr('title'));if(pp_images.length>30)settings.overlay_gallery=false;set_position=jQuery.inArray($(this).attr('href'),pp_images);rel_index=(isSet)?set_position:$("a[rel^='"+theRel+"']").index($(this));_build_overlay(this);if(settings.allow_resize)
$(window).bind('scroll.prettyphoto',function(){_center_overlay();});$.prettyPhoto.open();return false;}
$.prettyPhoto.open=function(event){if(typeof settings=="undefined"){settings=pp_settings;if($.browser.msie&&$.browser.version==6)settings.theme="light_square";pp_images=$.makeArray(arguments[0]);pp_titles=(arguments[1])?$.makeArray(arguments[1]):$.makeArray("");pp_descriptions=(arguments[2])?$.makeArray(arguments[2]):$.makeArray("");isSet=(pp_images.length>1)?true:false;set_position=0;_build_overlay(event.target);}
if($.browser.msie&&$.browser.version==6)$('select').css('visibility','hidden');if(settings.hideflash)$('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','hidden');_checkPosition($(pp_images).size());$('.pp_loaderIcon').show();if(settings.deeplinking)
setHashtag();if(settings.social_tools){facebook_like_link=settings.social_tools.replace('{location_href}',encodeURIComponent(location.href));$pp_pic_holder.find('.pp_social').html(facebook_like_link);}
if($ppt.is(':hidden'))$ppt.css('opacity',0).show();$pp_overlay.show().fadeTo(settings.animation_speed,settings.opacity);$pp_pic_holder.find('.currentTextHolder').text((set_position+1)+settings.counter_separator_label+$(pp_images).size());if(pp_descriptions[set_position]!=""){$pp_pic_holder.find('.pp_description').show().html(unescape(pp_descriptions[set_position]));}else{$pp_pic_holder.find('.pp_description').hide();}
movie_width=(parseFloat(getParam('width',pp_images[set_position])))?getParam('width',pp_images[set_position]):settings.default_width.toString();movie_height=(parseFloat(getParam('height',pp_images[set_position])))?getParam('height',pp_images[set_position]):settings.default_height.toString();percentBased=false;if(movie_height.indexOf('%')!=-1){movie_height=parseFloat(($(window).height()*parseFloat(movie_height)/100)-150);percentBased=true;}
if(movie_width.indexOf('%')!=-1){movie_width=parseFloat(($(window).width()*parseFloat(movie_width)/100)-150);percentBased=true;}
$pp_pic_holder.fadeIn(function(){(settings.show_title&&pp_titles[set_position]!=""&&typeof pp_titles[set_position]!="undefined")?$ppt.html(unescape(pp_titles[set_position])):$ppt.html('&nbsp;');imgPreloader="";skipInjection=false;switch(_getFileType(pp_images[set_position])){case'image':imgPreloader=new Image();nextImage=new Image();if(isSet&&set_position<$(pp_images).size()-1)nextImage.src=pp_images[set_position+1];prevImage=new Image();if(isSet&&pp_images[set_position-1])prevImage.src=pp_images[set_position-1];$pp_pic_holder.find('#pp_full_res')[0].innerHTML=settings.image_markup.replace(/{path}/g,pp_images[set_position]);imgPreloader.onload=function(){pp_dimensions=_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=pp_images[set_position];break;case'youtube':pp_dimensions=_fitToViewport(movie_width,movie_height);movie_id=getParam('v',pp_images[set_position]);if(movie_id==""){movie_id=pp_images[set_position].split('youtu.be/');movie_id=movie_id[1];if(movie_id.indexOf('?')>0)
movie_id=movie_id.substr(0,movie_id.indexOf('?'));if(movie_id.indexOf('&')>0)
movie_id=movie_id.substr(0,movie_id.indexOf('&'));}
movie='http://www.youtube.com/embed/'+movie_id;(getParam('rel',pp_images[set_position]))?movie+="?rel="+getParam('rel',pp_images[set_position]):movie+="?rel=1";if(settings.autoplay)movie+="&autoplay=1";toInject=settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);break;case'vimeo':pp_dimensions=_fitToViewport(movie_width,movie_height);movie_id=pp_images[set_position];var regExp=/http:\/\/(www\.)?vimeo.com\/(\d+)/;var match=movie_id.match(regExp);movie='http://player.vimeo.com/video/'+match[2]+'?title=0&amp;byline=0&amp;portrait=0';if(settings.autoplay)movie+="&autoplay=1;";vimeo_width=pp_dimensions['width']+'/embed/?moog_width='+pp_dimensions['width'];toInject=settings.iframe_markup.replace(/{width}/g,vimeo_width).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,movie);break;case'quicktime':pp_dimensions=_fitToViewport(movie_width,movie_height);pp_dimensions['height']+=15;pp_dimensions['contentHeight']+=15;pp_dimensions['containerHeight']+=15;toInject=settings.quicktime_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,pp_images[set_position]).replace(/{autoplay}/g,settings.autoplay);break;case'flash':pp_dimensions=_fitToViewport(movie_width,movie_height);flash_vars=pp_images[set_position];flash_vars=flash_vars.substring(pp_images[set_position].indexOf('flashvars')+10,pp_images[set_position].length);filename=pp_images[set_position];filename=filename.substring(0,filename.indexOf('?'));toInject=settings.flash_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,filename+'?'+flash_vars);break;case'iframe':pp_dimensions=_fitToViewport(movie_width,movie_height);frame_url=pp_images[set_position];frame_url=frame_url.substr(0,frame_url.indexOf('iframe')-1);toInject=settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,frame_url);break;case'ajax':doresize=false;pp_dimensions=_fitToViewport(movie_width,movie_height);doresize=true;skipInjection=true;$.get(pp_images[set_position],function(responseHTML){toInject=settings.inline_markup.replace(/{content}/g,responseHTML);$pp_pic_holder.find('#pp_full_res')[0].innerHTML=toInject;_showContent();});break;case'custom':pp_dimensions=_fitToViewport(movie_width,movie_height);toInject=settings.custom_markup;break;case'inline':myClone=$(pp_images[set_position]).clone().append('<br clear="all" />').css({'width':settings.default_width}).wrapInner('<div id="pp_full_res"><div class="pp_inline"></div></div>').appendTo($('body')).show();doresize=false;pp_dimensions=_fitToViewport($(myClone).width(),$(myClone).height());doresize=true;$(myClone).remove();toInject=settings.inline_markup.replace(/{content}/g,$(pp_images[set_position]).html());break;};if(!imgPreloader&&!skipInjection){$pp_pic_holder.find('#pp_full_res')[0].innerHTML=toInject;_showContent();};});return false;};$.prettyPhoto.changePage=function(direction){currentGalleryPage=0;if(direction=='previous'){set_position--;if(set_position<0)set_position=$(pp_images).size()-1;}else if(direction=='next'){set_position++;if(set_position>$(pp_images).size()-1)set_position=0;}else{set_position=direction;};rel_index=set_position;if(!doresize)doresize=true;$('.pp_contract').removeClass('pp_contract').addClass('pp_expand');_hideContent(function(){$.prettyPhoto.open();});};$.prettyPhoto.changeGalleryPage=function(direction){if(direction=='next'){currentGalleryPage++;if(currentGalleryPage>totalPage)currentGalleryPage=0;}else if(direction=='previous'){currentGalleryPage--;if(currentGalleryPage<0)currentGalleryPage=totalPage;}else{currentGalleryPage=direction;};slide_speed=(direction=='next'||direction=='previous')?settings.animation_speed:0;slide_to=currentGalleryPage*(itemsPerPage*itemWidth);$pp_gallery.find('ul').animate({left:-slide_to},slide_speed);};$.prettyPhoto.startSlideshow=function(){if(typeof pp_slideshow=='undefined'){$pp_pic_holder.find('.pp_play').unbind('click').removeClass('pp_play').addClass('pp_pause').click(function(){$.prettyPhoto.stopSlideshow();return false;});pp_slideshow=setInterval($.prettyPhoto.startSlideshow,settings.slideshow);}else{$.prettyPhoto.changePage('next');};}
$.prettyPhoto.stopSlideshow=function(){$pp_pic_holder.find('.pp_pause').unbind('click').removeClass('pp_pause').addClass('pp_play').click(function(){$.prettyPhoto.startSlideshow();return false;});clearInterval(pp_slideshow);pp_slideshow=undefined;}
$.prettyPhoto.close=function(){if($pp_overlay.is(":animated"))return;$.prettyPhoto.stopSlideshow();$pp_pic_holder.stop().find('object,embed').css('visibility','hidden');$('div.pp_pic_holder,div.ppt,.pp_fade').fadeOut(settings.animation_speed,function(){$(this).remove();});$pp_overlay.fadeOut(settings.animation_speed,function(){if($.browser.msie&&$.browser.version==6)$('select').css('visibility','visible');if(settings.hideflash)$('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','visible');$(this).remove();$(window).unbind('scroll.prettyphoto');clearHashtag();settings.callback();doresize=true;pp_open=false;delete settings;});};function _showContent(){$('.pp_loaderIcon').hide();projectedTop=scroll_pos['scrollTop']+((windowHeight/2)-(pp_dimensions['containerHeight']/2));if(projectedTop<0)projectedTop=0;$ppt.fadeTo(settings.animation_speed,1);$pp_pic_holder.find('.pp_content').animate({height:pp_dimensions['contentHeight'],width:pp_dimensions['contentWidth']},settings.animation_speed);$pp_pic_holder.animate({'top':projectedTop,'left':(windowWidth/2)-(pp_dimensions['containerWidth']/2),width:pp_dimensions['containerWidth']},settings.animation_speed,function(){$pp_pic_holder.find('.pp_hoverContainer,#fullResImage').height(pp_dimensions['height']).width(pp_dimensions['width']);$pp_pic_holder.find('.pp_fade').fadeIn(settings.animation_speed);if(isSet&&_getFileType(pp_images[set_position])=="image"){$pp_pic_holder.find('.pp_hoverContainer').show();}else{$pp_pic_holder.find('.pp_hoverContainer').hide();}
if(pp_dimensions['resized']){$('a.pp_expand,a.pp_contract').show();}else{$('a.pp_expand').hide();}
if(settings.autoplay_slideshow&&!pp_slideshow&&!pp_open)$.prettyPhoto.startSlideshow();settings.changepicturecallback();pp_open=true;});_insert_gallery();};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.animation_speed,function(){$('.pp_loaderIcon').show();callback();});};function _checkPosition(setCount){(setCount>1)?$('.pp_nav').show():$('.pp_nav').hide();};function _fitToViewport(width,height){resized=false;_getDimensions(width,height);imageWidth=width,imageHeight=height;if(((pp_containerWidth>windowWidth)||(pp_containerHeight>windowHeight))&&doresize&&settings.allow_resize&&!percentBased){resized=true,fitting=false;while(!fitting){if((pp_containerWidth>windowWidth)){imageWidth=(windowWidth-200);imageHeight=(height/width)*imageWidth;}else if((pp_containerHeight>windowHeight)){imageHeight=(windowHeight-200);imageWidth=(width/height)*imageHeight;}else{fitting=true;};pp_containerHeight=imageHeight,pp_containerWidth=imageWidth;};_getDimensions(imageWidth,imageHeight);if((pp_containerWidth>windowWidth)||(pp_containerHeight>windowHeight)){_fitToViewport(pp_containerWidth,pp_containerHeight)};};return{width:Math.floor(imageWidth),height:Math.floor(imageHeight),containerHeight:Math.floor(pp_containerHeight),containerWidth:Math.floor(pp_containerWidth)+(settings.horizontal_padding*2),contentHeight:Math.floor(pp_contentHeight),contentWidth:Math.floor(pp_contentWidth),resized:resized};};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().addClass(settings.theme).width(width).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_title=$pp_pic_holder.find('.ppt');$pp_title.width(width);titleHeight=parseFloat($pp_title.css('marginTop'))+parseFloat($pp_title.css('marginBottom'));$pp_title=$pp_title.clone().appendTo($('body')).css({'position':'absolute','top':-10000});titleHeight+=$pp_title.height();$pp_title.remove();pp_contentHeight=height+detailsHeight;pp_contentWidth=width;pp_containerHeight=pp_contentHeight+titleHeight+$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)||itemSrc.match(/youtu\.be/i)){return'youtube';}else if(itemSrc.match(/vimeo\.com/i)){return'vimeo';}else if(itemSrc.match(/\b.mov\b/i)){return'quicktime';}else if(itemSrc.match(/\b.swf\b/i)){return'flash';}else if(itemSrc.match(/\biframe=true\b/i)){return'iframe';}else if(itemSrc.match(/\bajax=true\b/i)){return'ajax';}else if(itemSrc.match(/\bcustom=true\b/i)){return'custom';}else if(itemSrc.substr(0,1)=='#'){return'inline';}else{return'image';};};function _center_overlay(){if(doresize&&typeof $pp_pic_holder!='undefined'){scroll_pos=_get_scroll();contentHeight=$pp_pic_holder.height(),contentwidth=$pp_pic_holder.width();projectedTop=(windowHeight/2)+scroll_pos['scrollTop']-(contentHeight/2);if(projectedTop<0)projectedTop=0;if(contentHeight>windowHeight)
return;$pp_pic_holder.css({'top':projectedTop,'left':(windowWidth/2)+scroll_pos['scrollLeft']-(contentwidth/2)});};};function _get_scroll(){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 _resize_overlay(){windowHeight=$(window).height(),windowWidth=$(window).width();if(typeof $pp_overlay!="undefined")$pp_overlay.height($(document).height()).width(windowWidth);};function _insert_gallery(){if(isSet&&settings.overlay_gallery&&_getFileType(pp_images[set_position])=="image"&&(settings.ie6_fallback&&!($.browser.msie&&parseInt($.browser.version)==6))){itemWidth=52+5;navWidth=(settings.theme=="facebook"||settings.theme=="pp_default")?50:30;itemsPerPage=Math.floor((pp_dimensions['containerWidth']-100-navWidth)/itemWidth);itemsPerPage=(itemsPerPage<pp_images.length)?itemsPerPage:pp_images.length;totalPage=Math.ceil(pp_images.length/itemsPerPage)-1;if(totalPage==0){navWidth=0;$pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').hide();}else{$pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').show();};galleryWidth=itemsPerPage*itemWidth;fullGalleryWidth=pp_images.length*itemWidth;$pp_gallery.css('margin-left',-((galleryWidth/2)+(navWidth/2))).find('div:first').width(galleryWidth+5).find('ul').width(fullGalleryWidth).find('li.selected').removeClass('selected');goToPage=(Math.floor(set_position/itemsPerPage)<totalPage)?Math.floor(set_position/itemsPerPage):totalPage;$.prettyPhoto.changeGalleryPage(goToPage);$pp_gallery_li.filter(':eq('+set_position+')').addClass('selected');}else{$pp_pic_holder.find('.pp_content').unbind('mouseenter mouseleave');}}
function _build_overlay(caller){if(settings.social_tools)
facebook_like_link=settings.social_tools.replace('{location_href}',encodeURIComponent(location.href));settings.markup=settings.markup.replace('{pp_social}',(settings.social_tools)?facebook_like_link:'');$('body').append(settings.markup);$pp_pic_holder=$('.pp_pic_holder'),$ppt=$('.ppt'),$pp_overlay=$('div.pp_overlay');if(isSet&&settings.overlay_gallery){currentGalleryPage=0;toInject="";for(var i=0;i<pp_images.length;i++){if(!pp_images[i].match(/\b(jpg|jpeg|png|gif)\b/gi)){classname='default';img_src='';}else{classname='';img_src=pp_images[i];}
toInject+="<li class='"+classname+"'><a href='#'><img src='"+img_src+"' width='50' alt='' /></a></li>";};toInject=settings.gallery_markup.replace(/{gallery}/g,toInject);$pp_pic_holder.find('#pp_full_res').after(toInject);$pp_gallery=$('.pp_pic_holder .pp_gallery'),$pp_gallery_li=$pp_gallery.find('li');$pp_gallery.find('.pp_arrow_next').click(function(){$.prettyPhoto.changeGalleryPage('next');$.prettyPhoto.stopSlideshow();return false;});$pp_gallery.find('.pp_arrow_previous').click(function(){$.prettyPhoto.changeGalleryPage('previous');$.prettyPhoto.stopSlideshow();return false;});$pp_pic_holder.find('.pp_content').hover(function(){$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeIn();},function(){$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeOut();});itemWidth=52+5;$pp_gallery_li.each(function(i){$(this).find('a').click(function(){$.prettyPhoto.changePage(i);$.prettyPhoto.stopSlideshow();return false;});});};if(settings.slideshow){$pp_pic_holder.find('.pp_nav').prepend('<a href="#" class="pp_play">Play</a>')
$pp_pic_holder.find('.pp_nav .pp_play').click(function(){$.prettyPhoto.startSlideshow();return false;});}
$pp_pic_holder.attr('class','pp_pic_holder '+settings.theme);$pp_overlay.css({'opacity':0,'height':$(document).height(),'width':$(window).width()}).bind('click',function(){if(!settings.modal)$.prettyPhoto.close();});$('a.pp_close').bind('click',function(){$.prettyPhoto.close();return false;});$('a.pp_expand').bind('click',function(e){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();});return false;});$pp_pic_holder.find('.pp_previous, .pp_nav .pp_arrow_previous').bind('click',function(){$.prettyPhoto.changePage('previous');$.prettyPhoto.stopSlideshow();return false;});$pp_pic_holder.find('.pp_next, .pp_nav .pp_arrow_next').bind('click',function(){$.prettyPhoto.changePage('next');$.prettyPhoto.stopSlideshow();return false;});_center_overlay();};if(!pp_alreadyInitialized&&getHashtag()){pp_alreadyInitialized=true;hashIndex=getHashtag();hashRel=hashIndex;hashIndex=hashIndex.substring(hashIndex.indexOf('/')+1,hashIndex.length-1);hashRel=hashRel.substring(0,hashRel.indexOf('/'));setTimeout(function(){$("a[rel^='"+hashRel+"']:eq("+hashIndex+")").trigger('click');},50);}
return this.unbind('click.prettyphoto').bind('click.prettyphoto',$.prettyPhoto.initialize);};function getHashtag(){url=location.href;hashtag=(url.indexOf('#!')!=-1)?decodeURI(url.substring(url.indexOf('#!')+2,url.length)):false;return hashtag;};function setHashtag(){if(typeof theRel=='undefined')return;location.hash='!'+theRel+'/'+rel_index+'/';};function clearHashtag(){url=location.href;hashtag=(url.indexOf('#!prettyPhoto'))?true:false;if(hashtag)location.hash="!prettyPhoto";}
function getParam(name,url){name=name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");var regexS="[\\?&]"+name+"=([^&#]*)";var regex=new RegExp(regexS);var results=regex.exec(url);return(results==null)?"":results[1];}})(jQuery);var pp_alreadyInitialized=false;
﻿function MenuComponent()
  {    
  };
  
  MenuComponent.prototype = 
  {
    __initialized: false,
    xsl : null,
    menuXml : null,
    firstDraw : null,
    
    doMovePage : function(id,direction)
    {
      var pageId = $("#pageId").val();
      var error = "";
    
      if ((id != null || id != "") && (direction != null || direction != ""))
        error = proxies.EditMode.ChangeMenuItemPosition(id, direction, pageId);
        
      if(error != ""){
        alert(error);
        window.location.reload();
      }
      else
      {
        window.location.reload();
      }
    },
    
    deletePage : function(pageId)
    {
      var error = "";
      if (!confirm("Weet u zeker dat u dit bestand wilt verwijderen?"))
        return;
    
      if (pageId != null || pageId != "")
        error = proxies.EditMode.DeletePage(pageId);
        
      if(error != "")
      {
        if (error == "link")
        { 
          window.location.href = "/_actions/Redirect.aspx?type=loggedinuser&id="+CURRENT_USER_ID;
        }
        else
        {
          alert(error);
          window.location.reload();
        }
      }
      else
      {
        this.drawNavigation(this.firstDraw);
      }
    },
    
    initNavigation : function (pageId)
    {
      if (this.xsl==null)
        this.xsl = "navigation.xsl";
        
      var el = document.getElementById("navigationDialog");
      if ($(el).hasClass("hidden"))
        Spif.ClassNameAbstraction.replace(el, "hidden", "shown");  
      
      this.drawNavigation(pageId);
    }, 
    
    drawNavigation : function (pageId)
    {
      try {
        this.menuXml = proxies.EditMode.getNavXmlByPageId(pageId);  
        this.firstDraw = selectSingleNode(this.menuXml, "page/@id").value;

        if (this.menuXml != null)
        {
          var el = document.getElementById("navigatieBox");
          transformXml(this.menuXml, this.xsl, el);
        }
      }
      catch (err) {
        alert(err.message)
      }
    },
    
    doMoveUp : function (pageId)
    {
      try
      {
        proxies.EditMode.movePageUpinNavByPageId(pageId);
        this.initNavigation(pageId);
      }
      catch (err)
      {
        alert(err.message)
      }
    },
    
    doMoveDown : function (pageId)
    {
      try
      {
        proxies.EditMode.movePageDowninNavByPageId(pageId);
        this.initNavigation(pageId);
      }
      catch (err)
      {
        alert(err.message)
      }
    },
    
    doIndent : function (pageId)
    {
      try
      {
        proxies.EditMode.movePageIndentByPageId(pageId);
        this.initNavigation(pageId);
      }
      catch (err)
      {
        alert(err.message)
      }
    },
    
    doOutdent : function (pageId)
    {
      try
      {
        proxies.EditMode.movePageOutdentByPageId(pageId);
        this.initNavigation(pageId);
      }
      catch (err)
      {
        alert(err.message)
      }
    },
    
    closeNavChange : function ()
    {
      var el = document.getElementById("navigationDialog");
      document.getElementById("navigatieBox").innerHTML = "";

      if (Spif.ClassNameAbstraction.contains(el,"shown"))
        Spif.ClassNameAbstraction.add(el, "hidden");        
    }
  }

var menu = new MenuComponent();





function doShownAssetDialog()
{
  // Stub for absence of assetManager
}

function doShownContactDialog()
{
  // Stub for absence of contactManager
}

function doShownPropertiesDialog()
{}

function doShownSettingsDialog()
{}


function doDropComponent(droppedEl, oldParent, oldNextSibling, newParent, newNextSibling) {
    
  var currentView = "small";
  currentView = doGetCompView(newParent);
  
  if (currentView == 'small') {
    if ($(droppedEl).hasClass('denySmall')) {
      alert('Dit component kan hier niet geplaatst worden.');

      //doDropComponent(droppedEl, newParent, newNextSibling, oldParent, oldNextSibling);
      return window.location.reload();  
    }

  }

  // Replace dropped element with the dropPlaceholder
  for (var i=0; i<droppedEl.childNodes.length; i++)
    if (Spif.ClassNameAbstraction.contains(droppedEl.childNodes[i], "dropPlaceholder"))
    {
      newParent.insertBefore(droppedEl.childNodes[i], droppedEl);
      newParent.removeChild(droppedEl);
      break;
    }

  //stops page from reloading when element id dropped on the place it came from.
  if (oldParent == newParent && oldNextSibling == newNextSibling)
    return;
  
  var error = null
  if (!Spif.ClassNameAbstraction.contains(document.getElementById("body"), "editMode"))
    error = "You're not in editmode"
  
  if (error == null)
  {
    /*
    **nieuw component
    */ 
    if ($(oldParent).hasClass("clone-box"))
    {
      // get placeholder nummer
      var placeholder = newParent.id;
      // get id's van object en component
      var thisComponentId = droppedEl.id;
          
      if (newNextSibling == null)
        newNextSibling = -1;
      else 
        newNextSibling = newNextSibling.id;
        
      // haal type op
      var componentClass = droppedEl.className.match(/(\w+)Component/)[1];
      
      // initial content
      var xmlDoc = initXML("<initialcontent></initialcontent>");
      if ($(droppedEl).hasClass("asset-image"))
      {
        var asset = xmlDoc.documentElement.appendChild(xmlDoc.createElement("asset"));
        var assetId = asset.appendChild(xmlDoc.createElement("id"));
        assetId.text = oldParent.id.replace("asset-","");
        var assetName = asset.appendChild(xmlDoc.createElement("name"));
        var el = getElementsByTagNameAttributeValue(oldParent,"span","class","assetName")[0];
        assetName.text = (el.textContent || el.innerText);
      }
      else if ($(droppedEl).hasClass("folder"))
      {
        var asset = xmlDoc.documentElement.appendChild(xmlDoc.createElement("asset"));
        var assetId = asset.appendChild(xmlDoc.createElement("id"));
        
        if (isMozilla)
           assetId.textContent = oldParent.id.replace("folder-","");
        else
          assetId.text = oldParent.id.replace("folder-","");
          
        var assetName = asset.appendChild(xmlDoc.createElement("name"));
        var el = getElementsByTagNameAttributeValue(oldParent,"a","class","asset-label")[0];
        
         if (isMozilla)
           assetName.textContent = (el.textContent || el.innerText);
        else
          assetName.text = (el.textContent || el.innerText);
      }
      else if ($(droppedEl).hasClass("slideshowassetimage"))
      {
        var asset = xmlDoc.documentElement.appendChild(xmlDoc.createElement("asset"));
        var assetId = asset.appendChild(xmlDoc.createElement("id"));
        assetId.text = oldParent.id.replace("asset-","");
        var assetName = asset.appendChild(xmlDoc.createElement("name"));
        var el = document.getElementById("assetSlideShowTitle");
        assetName.text = (el.textContent || el.innerText);
      }
      //debugger;
      // Een Service aanroepen waarin we de wijziging doorgeven
      var pageId = $("#pageId").val();
      var error = proxies.EditMode.CreateComponent(pageId, placeholder, componentClass, newNextSibling, xmlDoc);
      if (error == null)
        window.location.reload();  // reload doen 
      else
      {
        alert(error);
        window.location.reload();
      }
    }
    
    //get placeholder nummer
    var placeholder = newParent.id;
    
    if (newNextSibling == null)
      newNextSibling = -1;
    else 
      newNextSibling = newNextSibling.id;
      
    //get current pageId
    var pageId = $("#pageId").val();
      
    
    /*check if component is from the deleted tab*/      
    if (Spif.ClassNameAbstraction.contains(droppedEl, "deletedComponentId"))
    {
      //now get id
      var delComponentId = droppedEl.className.match(/\bdeletedComponentId-(\d+)/i)[1]
      
      //place component here
      try
      {
        proxies.ComponentManager.placeDeletedComponentInNewPage(delComponentId, pageId);
        
        var error = proxies.EditMode.MoveComponent(delComponentId, placeholder, newNextSibling, currentView);
        if (error == null)
          window.location.reload();  // reload doen 
        else
        {
          alert(error);
          window.location.reload();
        }
      }
      catch (err)
      {
        alert(err.message)
      }
    }
    
    /*check if component is from the deleted tab*/      
    if (Spif.ClassNameAbstraction.contains(droppedEl, "cutComponentId"))
    {
      //now get id
      var cutComponentId = droppedEl.className.match(/\bcutComponentId-(\d+)/i)[1];
      
      //place component here
      try
      {
        proxies.ComponentManager.placeCutComponentInNewPage(cutComponentId, pageId);
        
        var error = proxies.EditMode.MoveComponent(cutComponentId, placeholder, newNextSibling, currentView);
        if (error == null)
          window.location.reload();  // reload doen 
        else
        {
          alert(error);
          window.location.reload();
        }
      }
      catch (err)
      {
        alert(err.message)
      }
    }
    
    
    /*
    **verplaatsen component
    */
    if (Spif.ClassNameAbstraction.contains(oldParent, "columnContent") || Spif.ClassNameAbstraction.contains(oldParent, "contentColumn"))
    {
      //get id's van object en component
      var thisComponentId = droppedEl.id;
        
      // Een Service aanroepen waarin we de wijziging doorgeven 
      var error = proxies.EditMode.MoveComponent(thisComponentId, placeholder, newNextSibling,currentView);
      if (error == null)
        window.location.reload();  // reload doen 
      else
      {
        alert(error);
        window.location.reload();
      }
    }
  }
  else
  {
    alert(error);
    window.location.reload();
  }
  
  // optioneel een "implicit save" aanroepen voor Lime
  
}

/*drop image when using it for style*/
function doDropImageComponentForStyle(droppedEl, oldParent, oldNextSibling, newParent, newNextSibling)
{
  var pageId = $("#pageId").val();
  var error = null
  if (!Spif.ClassNameAbstraction.contains(document.getElementById("body"), "editMode"))
    error = "You're not in editmode"
    
  if (error != null)
  {
    alert(error)
    newParent.innerHTML = "";
  }
  else
  {
    newParent.innerHTML = "";
    var assetId = oldParent.id.replace("asset-","");
    var link = "/_services/AssetServer.ashx/"+assetId+"?assetserver-small";
    
    newParent.innerHTML = "<img src='"+link+"' />";
        
    //save image in db
    proxies.EditMode.savePageStyleChange(pageId, newParent.id, assetId)
  }
}


/*executes when an image is dropped on another image so we can create or extend the slideshow.*/
function doDropSlideshow(droppedEl, oldParent, oldNextSibling, newParent, newNextSibling)
{
  
  var error = null;
  if (!Spif.ClassNameAbstraction.contains(document.getElementById("body"), "editMode"))
    error = "You're not in editmode";
  
  if (error == null)
  {
    // get parameterd
    var assetId = oldParent.id.replace("asset-","").replace("folder-","");
    var componentId = getParentElementByTagNameAttributeValue(newParent, "div", "class", "component").id;
    var pageId = $("#pageId").val();
    
    // submit parameters to server
    var error = proxies.EditMode.AddAssetToMMComponent(componentId, assetId, pageId);

    if (error != null)
      alert(error);
  }
  else
    alert(error);

  window.location.reload();
}

/*executes when an image is dropped on another image so we can create or extend the photobook.*/
function doDropPhotobook(droppedEl, oldParent, oldNextSibling, newParent, newNextSibling) {
  var error = null;
  if (!Spif.ClassNameAbstraction.contains(document.getElementById("body"), "editMode"))
    error = "You're not in editmode";

  if (error == null) {
    // get parameterd
    var assetId = oldParent.id.replace("asset-", "").replace("folder-", "");
    var componentId = getParentElementByTagNameAttributeValue(newParent, "div", "class", "component").id;
    var pageId = $("#pageId").val();
    // submit parameters to server
    var error = proxies.EditMode.AddAssetToPBComponent(componentId, assetId, pageId);

    if (error != null && error.length > 0)
      alert(error);
  }
  else
    alert(error);

  window.location.reload();
}

function doDropTextImage(droppedEl, oldParent, oldNextSibling, newParent, newNextSibling)
{
  var img = null;
  if (droppedEl.firstChild)
   img = droppedEl.firstChild
  else
    img = droppedEl
    
  //set new className
  img.className = "lime-image";
  
  //set src to match component size
  var size = doGetCompView(newParent);
  img.src = img.src.split("?")[0] + "?multimediacomponent-" + size;

  if (isMozilla)
  {
    var tempDiv = document.createElement("p");
    tempDiv.appendChild(img);
    newNextSibling.appendChild(tempDiv);
  }
  else if (Spif.ClassNameAbstraction.contains(newParent,"richtextContent"))
  {
    newParent.childNodes[1].innerHTML += img.outerHTML;
    }
  else
    newParent.childNodes[2].innerHTML += img.outerHTML;

  //ActionSave.execute();
  window.location.reload();
}

function doGetCompView(el)
{
  if (Spif.ClassNameAbstraction.contains(el, "view-small"))
    size = "small";
  else if (Spif.ClassNameAbstraction.contains(el, "view-large"))
    size = "large";
  else if (Spif.ClassNameAbstraction.contains(el, "view-fullwidth"))
    size = "fullwidth";
  else
    doGetCompView(el.parentNode);
    
  return size;
}

/**
 * CMS functies (alleen editmode)
 */
function CMS()
{

};

/*
* Here an extra item is added to an exsisting component
* voorbeeld: Een weblog artikel
*/

CMS.prototype.doCreateNewItem = function (componentId)
{
  var error = null;
  var pageId = CURRENT_PAGE_ID;
  
  if (!Spif.ClassNameAbstraction.contains(document.getElementById("body"), "editMode"))
    error = "You're not in editmode"

  if (error == null) 
    error = proxies.EditMode.AddExtraItemToComponent(pageId, componentId);
  if (error == null)
    window.location.reload();  // reload doen 
  else
  {
    alert(error);
    window.location.reload();
  }
}

CMS.prototype.doRemoveItem = function (objectType, componentId, objectId)
{
  var error = null;
  var pageId = CURRENT_PAGE_ID;
  
  if (!Spif.ClassNameAbstraction.contains(document.getElementById("body"), "editMode"))
  {
    alert("You're not in editmode");
    return;
  }

  if (!confirm("Weet u zeker dat u dit artikel wilt verwijderen?")) return;  

  error = proxies.EditMode.DeleteItem(pageId, componentId, objectId);
    
  if (error == null)
    window.location.reload();  // reload doen 
  else
  {
    alert(error);
    window.location.reload();
  }
}

CMS.prototype.doRemoveComponent = function(componentId, componentType)
{
  var error = null;
  var pageId = CURRENT_PAGE_ID;
  var componentId = componentId;
  
  var prompt;
  switch (componentType)
  {
    case "weblog": prompt= "Weet u zeker dat u uw GEHELE Weblog wilt verwijderen? Al uw artikelen in dit weblog worden dan verwijderd."; break;
    case "map": prompt= "Weet u zeker dat u deze kaart wilt verwijderen? Al uw ingevoerde lokaties op deze kaart worden dan ook verwijderd."; break;
    case "menu": prompt= "Weet u zeker dat u dit menu wilt verwijderen van deze pagina?"; break;
    default:
     prompt = "Weet u zeker dat u deze GEHELE component wilt verwijderen?";
     break;
  }
  
  if (!confirm(prompt)) return;

  if (!Spif.ClassNameAbstraction.contains(document.getElementById("body"), "editMode"))
    error = "You're not in editmode"

  if (error == null)
    error = proxies.EditMode.DeleteComponent(pageId, componentId);
  if (error == null)
  {
    //instead of a reload, remove from DOM
    var elToRemove = document.getElementById(componentId);
    elToRemove.parentNode.removeChild(elToRemove);
  }
  else
    alert(error);
}

CMS.prototype.doCutComponent = function(componentId, componentType)
{
  var error = null;
  var pageId = CURRENT_PAGE_ID;
  var componentId = componentId;
  
  if (!confirm("Weet u zeker dat u deze component wilt knippen")) return;
   
  if (!Spif.ClassNameAbstraction.contains(document.getElementById("body"), "editMode"))
    error = "You're not in editmode"
    
  try
  {
    proxies.ComponentManager.CutComponent(pageId, componentId);
    window.location.reload();
  }
  catch (err)
  {
    alert(err.message);
  }
}

CMS.prototype.reloadWeblogComponent = function(componentId, extraVarname,  extraVarValue)
{
   var variableObject = new Array( {name:extraVarname, value:extraVarValue} );
   this.reloadComponent(componentId, variableObject)
}

/*
  define variableObject as var variableObject = new Array( {name:"currentAssetId", value:currentAssetId} );
*/
CMS.prototype.reloadComponent = function(componentId, variableObject)
{
  //check
  if (componentId == null || componentId < 1) return;
  
  //disable all componenttoolbars that are still on
  componentToolbar.__doDeactivateComponent();
  
  //find component
  var componentEl  = document.getElementById(componentId);
  var height = componentEl.offsetHeight;
  
  //empty component
  componentEl.innerHTML = "";
  
  //place div with same height
  var tempDiv = document.createElement("div");
  tempDiv.className = "tempElLoading standardContent";
  tempDiv.style.height = height+"px";
  tempDiv.innerHTML = "Een ogenblik geduld...";
  componentEl.appendChild(tempDiv);
  
  //anti cache
  var now = new Date();
  
  //get the view
  //alert(componentEl.parentNode.parentNode.className)
  var currentView = componentEl.parentNode.className.match(/\bview-(\w+)/i)[1];
  if (!currentView)
    currentView = "small";
    
  //make string out of variableObject
  var objectString = "";
  if (variableObject)
  {
    for (var i = 0 ; i < variableObject.length; i++)
    {
      var object = variableObject[i];
      objectString += "&"+ object["name"] + "=" + object["value"];
    }
  }
  
  //get content (xmlhttp)
  var contentXML = xmlhttp.request("/_fragments/Fragment.aspx?componentId="+componentId+"&view="+currentView+"&xml=true"+objectString+"&now="+now).responseXML;
  
  /*contentXML = contentXML.getElementById(componentId);
  var b = document.createElement("div");
  b.appendChild(contentXML)
  alert(b.innerHTML);;*/

  
  
  contentXML = contentXML.selectSingleNode("//*[@id='"+componentId+"']")
  
  if (isMozilla && contentXML)
  {
  
    componentEl.innerHTML = serializeXMLDoc(contentXML.firstChild);
  }
  else if (contentXML && contentXML.childNodes)
  {
    var newXML = "";
    for (var q = 0; q < contentXML.childNodes.length; q++)
    {
      newXML += contentXML.childNodes[q].xml;
    }
    componentEl.innerHTML = newXML
  }
  else if(contentXML)
  {
    componentEl.innerHTML = contentXML.xml
  }
  else
  {
    componentEl.innerHTML = "Niet gelukt nieuwe deel op te halen. Gelieve de pagina te herladen.";
  }
}


function displayStatus(name, value)
{
  switch (name) 
  {
    case "lime":
      if (value=="saving")
        status="Uw wijzigingen worden opgeslagen...";
      else
        status="";
      break;
  }
}

function ReloadComponent(id, editMode) {
  $.get("_fragments/Fragment.aspx?componentId=" + id + "&em=" + editMode, function (data) {
    $("#" + id).replaceWith($(data));
  })
}


var cms = new CMS();

function Reaction()
{    
};

Reaction.prototype = 
{ 
  lastRating : null,

  setReactionUrl : function(reactionSort, id, tab)
  {
    if (!id || !reactionSort)
      return;
    
    Iframe = document.getElementById("reactionFrame");
    var IframeUrl = Iframe.src.split("?");
    
    //variable to prevent cache 
    var now = new Date();
    
    if (IframeUrl[0])
    {
      if (tab == 1)
        Iframe.src = IframeUrl[0] + "?sort="+ reactionSort + "&id="+ id + "&start=0&numberofrows=0&antiCache="+now;
      else if (tab == 2)
        Iframe.src = IframeUrl[0] + "?sort="+ reactionSort + "&id="+ id + "&start=0&numberofrows=0&beoordeling=mijn&antiCache="+now;
    }
      
    //open dialog
    var reactionDialog = document.getElementById("reactionDialog");
    Spif.ClassNameAbstraction.replace(reactionDialog, "hidden", "shown");
  },
  
  checkReactionForm : function()
  {
    var name = null;
    var email = null;
    
    if (document.getElementById("reaction_name") != null)
      name = document.getElementById("reaction_name").value;
     
    if (document.getElementById("reaction_email") != null)
      email = document.getElementById("reaction_email").value; 
    
    var error = proxies.Validation.checkReactionForm(name, email);
    if (error == "" || error == null || error == "\n")
    {
      return true
    }
    else
    {
      alert(error);
      return false 
    }
  },
  
  getRating : function (evt) 
  {
    el = document.getElementById("giveRating");
    var percentage = (evt.clientX - findPos(el)[0]) / el.offsetWidth;
    return Math.ceil(percentage * 5);
  },
  
  setRating : function (evt)
  {
    el = document.getElementById("giveRating");
    //get rating
    var rating = this.getRating(evt)
    //set right class
    el.className = "ratingBox rated-"+(rating*2);
    //rumble the alement, otherwise className change won't have effect on layout
    el.parentNode.appendChild(el);
    document.getElementById("rating").value = rating*2;
  },
  
  getLastRating : function()
  {
    if (!this.mouseIn)
    {
      el = document.getElementById("giveRating");
      var className = el.className;
      this.lastRating = className.split("-")[1];
//document.title = this.lastRating;
      this.mouseIn = true;
    }
  },
  
  getPotentialRating : function(evt)
  {
    this.getLastRating();
    this.setRating(evt);
  },
  
  setOldRating : function ()
  {
    //el = document.getElementById("giveRating");
    //el.className = "ratingBox rated-"+this.lastRating;
  }
}
  
var reaction = new Reaction();  
    


﻿
function doShownPropertiesDialog() {
  dialog.drawProperties();
}

function Dialog() { };

Dialog.prototype =
  {
    colorNumberEl: null,

    userInEditmode: function () {
      return Spif.ClassNameAbstraction.contains(document.getElementById("body"), "editMode");
    },

    changePageLayout: function () {
      var el = getElementsByTagNameAttributeValue(document.getElementById("pickLayouts"), "div", "class", "selected")[0];

      //check of er wel op een layout is geklikt
      if (el == null)
        return;

      //check of user rechten heeft
      if (!this.userInEditmode())
        return;

      //check of id gevuld is
      if (el.id == null)
        el.id = "layout-basic";

      //ok; haal layoutnaam op
      var layoutnaam = el.id.substr(7, el.id.length);
      var pageId = $("#pageId").val();

      //haal op toepassigsgebied op
      var apply = "";
      var applyToAll = document.getElementById("applyToAll").checked;
      if (applyToAll)
        apply = "all";
      else
        apply = "this"

      var error = proxies.EditMode.ChangeLayoutOfPage(pageId, layoutnaam, apply);

      if (error == "")
        window.location.reload();
      else {
        alert(error);
        window.location.reload();
      }
    },

    changePageStyle: function () {
      var el = getElementsByTagNameAttributeValue(document.getElementById("styleBox"), "img", "class", "selected")[0];
      var advancedSettingsEl = document.getElementById("advancedStyleSettingsTab");
      var pageId = $("#pageId").val();
      var stylenaam = "basic";

      //check of user rechten heeft
      if (!this.userInEditmode())
        return;

      //check of er wel op een layout is geklikt
      if (el == null && Spif.ClassNameAbstraction.contains(advancedSettingsEl, "collapsed-tab"))
        return;
      else
        stylenaam = "personalized";

      //haal op toepassigsgebied op
      var apply = "";
      var applyToAll = document.getElementById("styleApplyToAll").checked;
      if (applyToAll)
        apply = "all";
      else
        apply = "this"

      //haal stylenaam op
      if (el && el.id != null)
        stylenaam = el.id.substr(6, el.id.length);

      //opslaan nieuwe stijl
      var error = proxies.EditMode.ChangePageStyle(pageId, stylenaam, apply);
      if (error == "")
        dialog.reloadPage();
      else {
        alert(error);
        dialog.reloadPage();
      }
    },

    reloadPage: function () {
      window.location.reload();
    },

    openColorPicker: function (colorNumberId) {
      this.colorNumberEl = document.getElementById(colorNumberId);
    },

    returnPickedColor: function (el) {
      var value;
      if (el.style.backgroundColor == null || el.style.backgroundColor == "")
        value = "Transparent";
      else
        value = el.style.backgroundColor;

      this.handlePickerColor(value)
    },

    handlePickerColor: function (color) {
      if ($("#colorpickerDialog").hasClass("shown"))
        Spif.ClassNameAbstraction.replace(document.getElementById("colorpickerDialog"), "shown", "hidden")

      this.colorNumberEl.value = color;
      this.colorNumberEl.parentNode.firstChild.style.backgroundColor = color;

      this.saveStyleChange(this.colorNumberEl.id, color)
    },

    styleselectbox: function (el) {
      this.saveStyleChange(el.id, el.value)
    },

    stylecheckbox: function (el) {
      var checked = "no-repeat";
      if (el.checked)
        checked = "repeat";

      this.saveStyleChange(el.id, checked)
    },

    saveStyleChange: function (name, value) {
      //save change with service
      var pageId = $("#pageId").val();
      var error = proxies.EditMode.savePageStyleChange(pageId, name, value)
      if (error != "")
        alert(error);
      else
        setTimeout(this.resetCss, 500);

      this.deletebuttonActivator();
    },

    resetCss: function () {
      var pageId = $("#pageId").val();

      var currentCss = document.getElementById("personalizedCss");
      if (currentCss != null)
        currentCss.parentNode.removeChild(currentCss);

      var link = document.createElement("link");
      link.id = "personalizedCss";
      link.setAttribute("type", "text/css");
      link.setAttribute("rel", "stylesheet");
      link.setAttribute("href", "/_css/skins/personalized2.aspx?pageId=" + pageId + "&" + new Date());
      document.getElementsByTagName("head")[0].appendChild(link);
    },

    setPickedColors: function () {
      //pickedColor
      var els = getElementsByTagNameAttributeValue(document.getElementById("styleDialog"), "span", "class", "pickedColor")
      for (i = 0; i < els.length; i++) {
        var el = els[i];
        el.style.backgroundColor = el.nextSibling.value;
      }

      this.deletebuttonActivator();
    },

    deletebuttonActivator: function () {
      var els = getElementsByTagNameAttributeValue(document.getElementById("styleDialog"), "div", "class", "clearRule")
      for (i = 0; i < els.length; i++) {
        el = els[i];
        var valueId = el.className.split(" ")[1].replace("deletefor-", "");
        var valueEl = document.getElementById(valueId);

        if (Spif.ClassNameAbstraction.contains(valueEl, "colorNumber")) {
          if (valueEl.value == "")
            Spif.ClassNameAbstraction.add(el, "hidden")
          else
            Spif.ClassNameAbstraction.remove(el, "hidden")
        }
        if (Spif.ClassNameAbstraction.contains(valueEl, "placeholder")) {
          if (valueEl.innerHTML == "")
            Spif.ClassNameAbstraction.add(el, "hidden")
          else
            Spif.ClassNameAbstraction.remove(el, "hidden")
        }
      }
    },

    deleteStyleSetting: function (evt) {
      el = evt.srcElement || evt.target;

      if (Spif.ClassNameAbstraction.contains(el, "clearRule")) {
        var pageId = $("#pageId").val();
        var nameToDelete = el.className.split(" ")[1].replace("deletefor-", "");
        proxies.EditMode.removePageStyle(pageId, nameToDelete)
        this.emptyStyleSetting(document.getElementById(nameToDelete));
      }

      this.deletebuttonActivator();
    },

    emptyStyleSetting: function (el) {
      if (el) {
        if (Spif.ClassNameAbstraction.contains(el, "colorNumber")) {
          el.value = "";
          el.parentNode.firstChild.style.background = "none";
        }
        if (Spif.ClassNameAbstraction.contains(el, "placeholder")) {
          el.innerHTML = "";
        }

      }
      setTimeout(this.resetCss, 500);
    },

    openAssetManager: function () {
      var assetEl = document.getElementById("assetmanagerDialog");
      var styleEl = document.getElementById("styleDialog");

      //position dialogs
      styleEl.style.top = "98px";
      styleEl.style.left = "10px";
      assetEl.style.top = "98px";
      assetEl.style.left = "420px";
    },


    /*send a message functions*/
    setMessageSettings: function (userId) {
      //if not a loggedin user, show extra inputfields
      bodyEl = document.getElementById("body") | document.getElementById("body")
      if (!Spif.ClassNameAbstraction.contains(bodyEl, "loggedIn"))
        Spif.ClassNameAbstraction.remove(document.getElementById("sendMessageBox").firstChild, "hideSendersInfo");

      this.sendMessageToId = userId;
      this.openMessageDialog();
    },

    setGuestbookMessage: function (reactionId) {
      bodyEl = window.parent.document.getElementById("body");
      if (!Spif.ClassNameAbstraction.contains(bodyEl, "loggedIn"))
        Spif.ClassNameAbstraction.remove(window.parent.document.getElementById("sendMessageBox").firstChild, "hideSendersInfo");

      window.parent.dialog.sendMessageToReactionId = reactionId;
      window.parent.dialog.sendMessageType = "guestbook";
      var el = window.parent.document.getElementById("sendAMessageDialog");
      if (Spif.ClassNameAbstraction.contains(el, "hidden"))
        Spif.ClassNameAbstraction.replace(el, "hidden", "shown");
    },

    openMessageDialog: function () {
      var el = document.getElementById("sendAMessageDialog");
      if (Spif.ClassNameAbstraction.contains(el, "hidden"))
        Spif.ClassNameAbstraction.replace(el, "hidden", "shown");
    },

    closeMessageDialog: function () {
      var el = document.getElementById("sendAMessageDialog");
      document.getElementById("messageText").innerHTML = "";

      if (Spif.ClassNameAbstraction.contains(el, "shown"))
        Spif.ClassNameAbstraction.add(el, "hidden");
    },

    sendMessage: function () {
      try {
        var message = document.getElementById("messageText").value;
        var subject = "Je hebt een bericht ontvangen";
        bodyEl = document.getElementById("body") | document.getElementById("admin")
        if (!Spif.ClassNameAbstraction.contains(bodyEl, "loggedIn")) {
          var email = document.getElementById("sendersEmail").value;
          if (email.indexOf("@") == -1 || email.indexOf(".") == -1) {
            alert("Emailadres is incorrect");
            return;
          }
          else if (this.sendMessageType == "guestbook") {
            proxies.ContactManager.sendEmailToContactHandler(subject, message, this.sendMessageType, this.sendMessageToReactionId);
          }
          else
            proxies.ContactManager.sendEmailToUserWithEmailadres(this.sendMessageToId, subject, message, email);
        }
        else
          proxies.ContactManager.sendEmailToUser(this.sendMessageToId, subject, message);

        this.closeMessageDialog()
      }
      catch (err) {
        alert(err.message)
      }
    },

    /*PROPERTY FUNCTIONS*/
    drawProperties: function () {
      this.groups = proxies.EditMode.getAllGroupInformation(CURRENT_PAGE_ID);
      if (this.groups != null) {
        try {
          var el = document.getElementById("propertiesContentDialog");
          transformXml(this.groups, "propertyDialog.xsl", el);
        }
        catch (err) {
          alert(err.message)
        }
      }
    },

    /*this.contacts = proxies.ContactManager.getAllContacts();
    if (this.contacts != null)
    {
    var el = document.getElementById("contactFolderBox");
    transformXml(this.contacts, this.xsl, el);
    }*/

    savePageSettings: function () {
      try {
        var accesLevel = 0;
        var groupId = 0;
        var showWidwbar;
        if (document.getElementById("accesPublic").checked)
          accesLevel = 2;
        else if (document.getElementById("accesFriends") && document.getElementById("accesFriends").checked) {
          accesLevel = 1;
          groupId = document.getElementById("selectedSecurityGroup").value
          if (groupId == -1)
            throw ("U heeft geen groep gekozen");
        }

        showWidwbar = document.getElementById("showWidwbar").checked;

        //call save function
        proxies.EditMode.savePageSettings(accesLevel, groupId, showWidwbar, CURRENT_PAGE_ID);

        //close dialog
        Spif.ClassNameAbstraction.replace(document.getElementById("propertiesDialog"), "shown", "hidden")
      }
      catch (err) {
        if (err.message != null)
          alert(err.message);
        else
          alert(err);
      }
    },


    /*REACTION FUNCTIONS*/
    openReactiondialog: function (url) {
      var el = document.getElementById("reactionDialog");
      Spif.ClassNameAbstraction.replace(el, "hidden", "shown");

      var frame = document.getElementById("reactionFrame");
      frame.src = url;
      //alert("open")
    },

    /*EVENT FUNCTIONS*/
    doEditEvent: function (el, eventid, componentId) {
      //open dialog
      this.drawEvents(componentId);
      if (eventid)
        this.drawEvent(eventid);
      this.showEventDialog(true);
      cms.reloadComponent(componentId);
    },

    drawEvents: function (componentId) {
      eventSettings = proxies.EditMode.getEvents(componentId);
      if (eventSettings != null) {
        try {
          var el = document.getElementById("allEvents");
          transformXml(eventSettings, "eventDialog.xsl", el);
        }
        catch (err) {
          alert(err.message)
        }
      }
    },

    drawEvent: function (eventid) {
      eventSettings = proxies.EditMode.getEventSettings(eventid);
      if (eventSettings != null) {
        try {
          var date = new Date();
          var params = new Array({ name: "year", value: date.getFullYear() });

          var el = document.getElementById("specEvent");
          transformXml(eventSettings, "eventDialog.xsl", el, params);

          //set data
          //this.setEventData(eventSettings);
        }
        catch (err) {
          alert(err.message)
        }
      }
    },

    setEventData: function (eventSettings) {
      var startDate = eventSettings.selectSingleNode("/specSetting/@start").value;
      document.getElementById("startDay").value = startDate.substr(8, 2);
      document.getElementById("startMonth").value = startDate.substr(5, 2);
      document.getElementById("startYear").value = startDate.substr(0, 4);
      document.getElementById("startHour").value = startDate.substr(11, 2);
      document.getElementById("startMinute").value = startDate.substr(14, 2);

      var endDate = eventSettings.selectSingleNode("/specSetting/@end").value;
      if (endDate) {
        document.getElementById("endDay").value = endDate.substr(8, 2);
        document.getElementById("endMonth").value = endDate.substr(5, 2);
        document.getElementById("endYear").value = endDate.substr(0, 4);
        document.getElementById("endHour").value = endDate.substr(11, 2);
        document.getElementById("endMinute").value = endDate.substr(14, 2);
      }
    },

    createNewEvent: function (componentId) {
      try {
        var eventId = proxies.EditMode.createNewEvent(componentId);
        this.doEditEvent("", eventId, componentId);
      }
      catch (err) {
        alert(err.message)
      }
    },

    showEventDialog: function (open) {
      el = document.getElementById("eventDialog");
      if (open)
        Spif.ClassNameAbstraction.replace(el, "hidden", "shown");
      else
        Spif.ClassNameAbstraction.replace(el, "shown", "hidden");
    },

    doDeleteEvent: function (componentid, eventid) {
      if (!confirm("Weet u zeker dat u deze gebeurtenis wilt verwijderen?")) return false;
      proxies.EditMode.DeleteEvent(componentid, eventid);
      this.doEditEvent("", eventid, componentid);
    },

    showEndDate: function (checkEl) {
      var parentEl = document.getElementById("endDateTimeBox");
      if (checkEl.checked)
        Spif.ClassNameAbstraction.replace(parentEl, "noEndDate", "aEndDate"); //show
      else
        Spif.ClassNameAbstraction.replace(parentEl, "aEndDate", "noEndDate"); //hide  
    },

    showWidwInfo: function () {
      Spif.ClassNameAbstraction.replace(document.getElementById("widwInfoDialog"), "hidden", "shown");
    },

    toggleActivityMailDialog: function (open) {
      var el = document.getElementById("emailDialog");
      if (open)
        Spif.ClassNameAbstraction.replace(el, "hidden", "shown");
      else
        Spif.ClassNameAbstraction.replace(el, "shown", "hidden");
    },

    toggleActivityEditDialog: function (open) {
      var el = document.getElementById('activityEditDialog');
      if (open)
        Spif.ClassNameAbstraction.replace(el, "hidden", "shown");
      else
        Spif.ClassNameAbstraction.replace(el, "shown", "hidden");

      var rolesBox = document.getElementById('activityEditRoles');
      var startDate = document.getElementById('startDate').innerHTML;
      var endDate = document.getElementById('endDate').innerHTML;
      var lastDate = document.getElementById('lastSignupDate').innerHTML;
      var activityRoles = document.getElementById('activityRoles');

      // dirty hack: copy data about the event to the new dialog    
      if (open) {
        rolesBox.innerHTML = activityRoles.innerHTML;

        document.getElementById('startDateDay').value = startDate.substring(0, 2);
        document.getElementById('startDateMonth').value = startDate.substring(3, 5);
        document.getElementById('startDateYear').value = "20" + startDate.substring(6, 8);

        var startTimeHour = startDate.substring(9, 11);
        var startTimeMinute = startDate.substring(12, 14);
        if (startTimeHour != "00" && startTimeMinute != "00") {
          document.getElementById('startTimeHour').value = startTimeHour;
          document.getElementById('startTimeMinute').value = startTimeMinute;
        }

        document.getElementById('endDateDay').value = endDate.substring(0, 2);
        document.getElementById('endDateMonth').value = endDate.substring(3, 5);
        document.getElementById('endDateYear').value = "20" + endDate.substring(6, 8);

        var endTimeHour = endDate.substring(9, 11);
        var endTimeMinute = endDate.substring(12, 14);
        if (endTimeHour != "00" && endTimeMinute != "00") {
          document.getElementById('endTimeHour').value = endTimeHour;
          document.getElementById('endTimeMinute').value = endTimeMinute;
        }

        if (lastDate == "01-01-01 00:00" || lastDate == endDate) {
          document.getElementById('lastSignupDateContainer').style.display = 'none';
        }
        else {
          document.getElementById('signupDateDay').value = lastDate.substring(0, 2);
          document.getElementById('signupDateMonth').value = lastDate.substring(3, 5);
          document.getElementById('signupDateYear').value = "20" + lastDate.substring(6, 8);
        }

        var comps1 = document.getElementById('activityAddRoleComp1');
        var comps2 = document.getElementById('activityAddRoleComp2');
        var comps3 = document.getElementById('activityAddRoleComp3');
        var hcomps = document.getElementById('hiddenCompetenciesSelect').options;
        for (var i = 1; i < hcomps.length; i++) {
          // add comps to the popup
          comps1.options.add(new Option(hcomps[i].innerHTML, hcomps[i].value));
          comps2.options.add(new Option(hcomps[i].innerHTML, hcomps[i].value));
          comps3.options.add(new Option(hcomps[i].innerHTML, hcomps[i].value));
        }

        var privacy = document.getElementById('activityPrivacy').innerHTML;
        var showGroups = document.getElementById('showActivityAddRoleUser');
        if (privacy == 'group') {
          // add contacts to the popup
          showGroups.style.display = 'block';
          var hgroups = document.getElementById('hiddenGroupsSelect');
          var friends = document.getElementById('activityAddRoleUser');

          friends.innerHTML = "";
          friends.innerHTML = hgroups.innerHTML.replace("<FRIENDS>", "").replace("</FRIENDS>", "");
        }

      }

    },

    openYouTubeDialog: function ($component) {
      var el = document.getElementById("youtubeDialog");
      if (Spif.ClassNameAbstraction.contains(el, "hidden"))
        Spif.ClassNameAbstraction.replace(el, "hidden", "shown");

      this.youtubeCaller = $component;
    },

    openDescriptionDialog: function () {
      var el = document.getElementById("descriptionDialog");
      if (Spif.ClassNameAbstraction.contains(el, "hidden"))
        Spif.ClassNameAbstraction.replace(el, "hidden", "shown");
    }
  }

var dialog = new Dialog();

/*pick your own color*/
$(document).ready(function () {
  $(".pickHashColor input:button").live("click", function () {
    var regColorcode = /^(#)?([0-9a-fA-F]{3})([0-9a-fA-F]{3})?$/;
    var el = $(".pickHashColor .colorSelf");

    if (regColorcode.test(el.val())) {
      dialog.handlePickerColor(el.val());
      el.val("#");
    };
  });

  $(".pickHashColor .colorSelf").live("keyup", function () {
    var regColorcode = /^(#)?([0-9a-fA-F]{3})([0-9a-fA-F]{3})?$/;
    var value = $(this).val();
    if (value.indexOf("#") == -1) {
      value = "#" + value;
      $(this).val(value);
    }

    if (regColorcode.test(value)) {
      //goed
      $(".pickHashColor .feedback").css("background", "url('/_img/icons/accept.png')");
      $(".pickHashColor input:button").attr("disabled", "");
    }
    else {
      //fout
      $(".pickHashColor .feedback").css("background", "url('/_img/icons/delete.png')");
      $(".pickHashColor input:button").attr("disabled", "disabled");
    }
  });

  $('#addVideo').live('click', function () {
    try {
      var $component = dialog.youtubeCaller;
      var componentId = $component.attr('id').split('-')[0];

      var videoLink = proxies.EditMode.AddYouTubeToPB(componentId, $('#videoLink').val());
      $('#videoLink').val("");

      if (!videoLink || videoLink.indexOf("Error:") != -1) {
        alert(videoLink);
        return;
      }

      if ($component.find('.pbpL').length) var sizeClass = 'pbpL';
      else if ($component.find('.pbpM').length) var sizeClass = 'pbpM';
      else if ($component.find('.pbpS').length) var sizeClass = 'pbpS';

      //console.log(videoLink);
      var newPhoto = $('<div id="pb_' + componentId + '_' + videoLink + '" class="photobookPhoto floatLeft ' + sizeClass + '">');
      newPhoto.append($('<img class="pbThumb"src="http://img.youtube.com/vi/' + videoLink + '/0.jpg"/>'));
      var deleteButton = $('<a href="#" class="deleteButton execute-doDeleteFromPhotobook_' + videoLink + '">' + '<img alt="Verwijder Afbeelding Uit Fotoboek" title="verwijder uit fotoboek" src="/_img/icons/delete.png"/></a>');
      var descriptionButton = $('<a href="#' + componentId + '_' + videoLink + '" class="editPhotoBookText"><img alt="Verwijder Afbeelding Uit Fotoboek" title="beschrijving aanpassen" src="/_img/icons/pencil.png"/></a>');

      newPhoto.append(deleteButton, descriptionButton);

      $component.find('.addYouTube').before(newPhoto);

    } catch (err) { alert(err.message); }

  });

  $('#addPBDescription').live('click', function (evt) {
    evt.preventDefault();
    var form = $("#submitPBDescription").serialize();
    proxies.EditMode.EditPBDescription(form);
    window.location.reload();
  });



});
/*




*/

var ContextMenu = {
  __cm: null,
  __content:
  {

  },
  __init: function () {
    Spif.DOMEvents.attach(window, "load", ContextMenu.__doLoadWindow, ContextMenu);
    Spif.DOMEvents.attach(window, "scroll", ContextMenu.__hide, ContextMenu);
    Spif.DOMEvents.attach(document.documentElement, "mousewheel", ContextMenu.__hide, ContextMenu);
    Spif.DOMEvents.attach(window, "resize", ContextMenu.__hide, ContextMenu);
  },
  __doLoadWindow: function (evt) {
    Spif.DOMEvents.attach(document, "mousedown", ContextMenu.__doMouseDownDocument, ContextMenu);
    Spif.DOMEvents.attach(document, "click", ContextMenu.__doClickDocument, ContextMenu);

    this.__cm = document.createElement("div");
    this.__cmTab = document.createElement("div");
    this.__cmTabContent = document.createElement("div");
    this.__cmMenu = document.createElement("div");

    this.__cm.id = "contextmenu";
    this.__cm.className = "hidden";
    this.__cmTab.className = "contextmenuTab";
    this.__cmTabContent.className = "contextmenuTabcontent nowrap";
    this.__cmMenu.className = "contextmenuMenu";

    document.body.appendChild(this.__cm);
    this.__cm.appendChild(this.__cmTab);
    this.__cmTab.appendChild(this.__cmTabContent);
    this.__cm.appendChild(this.__cmMenu);
  },
  __doMouseDownDocument: function (evt) {
    var activatorEl = Spif.HtmlDomUtils.getAncestorWithClassName(evt.subject, "contextmenuActivator");
    var itemEl = Spif.HtmlDomUtils.getAncestorWithClassName(evt.subject, "contextmenuItem");

    if (!activatorEl && !itemEl)
      this.__hide();
  },
  __doClickDocument: function (evt) {
    var activatorEl = Spif.HtmlDomUtils.getAncestorWithClassName(evt.subject, "contextmenuActivator");
    var itemEl = Spif.HtmlDomUtils.getAncestorWithClassName(evt.subject, "contextmenuItem");

    if (!activatorEl && !itemEl) {
      this.__hide();
      return;
    }

    if (itemEl)
      this.__doClickContextmenuItem(itemEl);
    else {
      this.__show(activatorEl);
      evt.cancel();
    }
  },
  __doClickContextmenuItem: function (itemEl) {
    if (Spif.ClassNameAbstraction.contains(itemEl, "disabled"))
      return;

    this.__hide();
  },
  __show: function (activatorEl) {
    this.__hide();

    var labelWidth = 0;

    var labelEl = activatorEl.previousSibling;
    if (!Spif.ClassNameAbstraction.contains(labelEl, "contextmenuLabel"))
      labelEl = null;
    if (labelEl) {
      labelWidth = Spif.StyleUtils.getComputedStyleProperty(labelEl, "width");
      if (isNaN(labelWidth))
        labelWidth = labelEl.offsetWidth;
      labelWidth += 8;
      this.__cmTabContent.innerHTML = labelEl.innerHTML;
      this.__cmTabContent.style.color = "#0060C2";
      this.__cmTabContent.style.fontSize = Spif.StyleUtils.getRawComputedStyleProperty(labelEl, "fontSize");
      this.__cmTabContent.style.fontWeight = Spif.StyleUtils.getRawComputedStyleProperty(labelEl, "fontWeight");
    }
    else {
      this.__cmTabContent.innerHTML = "";
      labelEl = activatorEl;
    }


    this.__cmTabContent.style.width = labelWidth + "px";

    var box = getBoxObjectFor(labelEl);

    var menuWidth = Math.min(400, Math.max(200, labelWidth + 70));
    var leftAlign = (box.x + box.width + menuWidth < document.body.offsetWidth);

    this.__cm.style.top = box.y + "px";

    if (leftAlign) {
      this.__cm.style.left = box.x + "px";
      this.__cmTabContent.parentNode.style.left = "";
    }
    else {
      this.__cm.style.left = box.x + document.documentElement.scrollLeft - menuWidth + labelWidth + 20 + "px";
      this.__cmTabContent.parentNode.style.left = menuWidth - labelWidth - (Spif.isIE ? 26 : 28) + "px";
    }

    var a = activatorEl.className.match(/contextmenuType-(.+)\b/)[1].split("-");
    this.__cmType = a[0];
    this.__cmId = a[1];
    this.__extra = a[2];

    Spif.ClassNameAbstraction.replace(this.__cm, "hidden", "contextmenuType-" + this.__cmType);

    // MOET EIGENLIJK MET MINWIDTH EN NOG WAT...
    this.__cmMenu.style.width = menuWidth + "px";
    this.__cmMenu.innerHTML = this.__generateMenuHTML(this.__cmType);
  },
  __hide: function () {
    //alert(this.__cmType)
    if (!this.__cmType)
      return;

    Spif.ClassNameAbstraction.replace(this.__cm, "contextmenuType-" + this.__cmType, "hidden");
  },
  __generateMenuHTML: function (cmType) {
    var data = this.__getMenuFor(cmType, this.__cmId);

    var html = ['<div class="items">'];
    for (var i = 0; i < data.length; i++) {
      var item = data[i];

      if (item.target != "_blank")
        item.target = "_self";

      if (item.label)
        html.push(
          '<a href="',
          item.href.replace(/\$id/g, this.__cmId).replace(/\$type/g, this.__cmType),
          '" class="contextmenuItem ',
          (item.enabled ? 'enabled' : 'disabled'),
          ' nowrap"',
          'target="' + item.target + '">',
          item.label,
          '</a>'
        );
      else
        html.push('<div class="separator"></div>');
    }

    return html.join("");
  },

  __getMenuFor: function (cmType, param1) {
    //alert(cmType)
    switch (cmType) {
      case "image":
        return
        [
            {
              label: "Voeg toe aan mijn media, voor later gebruik",
              href: "#",
              enabled: true
            },
            {},
            {
              label: "Lokatie",
              href: "/_actions/Redirect.aspx?type=user&id=" + param1,
              enabled: false
            },
            {
              label: "Persoon",
              href: "/_actions/Redirect.aspx?type=user&id=" + param1,
              enabled: false
            },
            {
              label: "Evenement",
              href: "/bewoners/" + param1,
              enabled: false
            },
            {},
            {
              label: "Wis",
              href: "/delete/" + param1,
              enabled: true
            },
            {},
            {
              label: "Eigenschappen",
              href: "/properties/" + param1,
              enabled: true
            }
          ];
      case "user":
        return [
        {
          label: "Bekijk profiel",
          href: "/_actions/Redirect.aspx?type=user&id=" + param1,
          enabled: true
        },
        {},
        {
          label: "Stuur een bericht",
          href: "javascript:dialog.setMessageSettings(" + param1 + ")",
          enabled: true
        }
      ];
      case "portal":
        return [
        {
          label: "Aanmelden",
          href: "/_wizards/UserRegistration",
          enabled: true
        },
        {},
        {
          label: "Bugmelding doorgeven",
          href: "http://support.q42.net/default.asp?pg=pgPublicEdit&ixProject=21&sTitle=Webindewijk%20bugmelding&sEvent=-%20wat%20gebeurt%20er:%0D-%20wat%20deed%20ik:%0D-%20wat%20had%20er%20moeten%20gebeuren:%0D-%20afzender:%0D-%20wijk%20:%0D-%20emailadres%20(niet%20verplicht):",
          target: "_blank",
          enabled: true
        }
      ];
      case "portalAdmin":
        return [
        {
          label: "Aanmelden",
          href: "/_wizards/UserRegistration",
          enabled: true
        },
        {
          label: "Naar admin scherm",
          href: "/_admin",
          enabled: true
        },
        {},
        {
          label: "Bugmelding doorgeven",
          href: "http://support.q42.net/default.asp?pg=pgPublicEdit&ixProject=21&sTitle=Webindewijk%20bugmelding&sEvent=-%20wat%20gebeurt%20er:%0D-%20wat%20deed%20ik:%0D-%20wat%20had%20er%20moeten%20gebeuren:%0D-%20afzender:%0D-%20wijk%20:%0D-%20emailadres%20(niet%20verplicht):",
          target: "_blank",
          enabled: true
        }
      ];
      case "weblogentry":
        var objId = param1.split('_')[0];
        var compId = param1.split('_')[1];
        return [
        {
          label: "Verwijder dit Artikel",
          href: "javascript:cms.doRemoveItem('weblogentry'," + compId + "," + objId + ")",
          enabled: true
        }
      ];
      case "loggedinuser":
        return [
        {
          label: "Uitloggen",
          href: "javascript:userauthenticate.logout()",
          enabled: true
        },
        {
          label: "Ga naar mijn profiel",
          href: "/_actions/Redirect.aspx?type=user&id=" + param1,
          enabled: true
        }
      ];
      case "assetactions":
        var assetPos = document.getElementById("asset-" + param1).className.match(/\bposition-(\d+)\b/)[1];
        return [
        {
          label: "Bekijken",
          href: "javascript:assetmanager.doSelectAsset(" + assetPos + ", " + param1 + ")",
          enabled: true
        },
        {
          label: "Downloaden",
          href: "javascript:assetmanager.downloadAsset(" + param1 + ")",
          enabled: true
        },
        {
          label: "Hernoemen",
          href: "javascript:assetmanager.doRename(" + param1 + ")",
          enabled: true
        },
        {
          label: "Verwijderen",
          href: "javascript:assetmanager.doDelete(" + param1 + ")",
          enabled: true
        }
      ];
      case "topfolderactions":
        return [
        {
          label: "Maak subfolder",
          href: "javascript:assetmanager.doCreateFolder(" + param1 + ")",
          enabled: true
        },
        {
          label: "Verwijder alle bestanden",
          href: "javascript:assetmanager.doDeleteFolder(" + param1 + ")",
          enabled: true
        }
      ];
      case "folderactions":
        return [
        {
          label: "Maak subfolder",
          href: "javascript:assetmanager.doCreateFolder(" + param1 + ")",
          enabled: true
        },
        {
          label: "Hernoemen",
          href: "javascript:assetmanager.doRenameFolder(" + param1 + ")",
          enabled: true
        },
        {
          label: "Verwijderen",
          href: "javascript:assetmanager.doDeleteFolder(" + param1 + ")",
          enabled: true
        }
      ];
      case "singleContactActions":
        return [
        {
          label: "Verwijder contact",
          href: "javascript:contactmanager.deleteSingleContact('" + param1 + "', '" + this.__extra + "')",
          enabled: true
        }
      ];
      case "contactHeaderActions":
        return [
        {
          label: "Hernoem groep",
          href: "javascript:contactmanager.activateRenameGroup('" + param1 + "')",
          enabled: true
        },
        {
          label: "Verwijder groep",
          href: "javascript:contactmanager.deleteGroup('" + param1 + "')",
          enabled: true
        }
      ];
        /* generiek component context menu */
      case "component":
        var curComp = componentToolbar.__currentActiveComponent;
        var compId = curComp.id;
        var componentType = "unknown";
        try { componentType = curComp.className.match(/(\w+)-component /)[1]; } catch (e) { }
        var menu = [];
        switch (componentType) {
          case "weblog": menu = [
          {
            label: "Voeg nieuw Artikel toe",
            href: "javascript:cms.doCreateNewItem(" + compId + ")",
            enabled: true
          },
          {},
          {
            label: "Knip deze Component",
            href: "javascript:cms.doCutComponent(" + compId + ",'" + componentType + "')",
            enabled: true
          }];
            break;
          case "richtext": menu = [
          {
            label: "Knip deze Component",
            href: "javascript:cms.doCutComponent(" + compId + ",'" + componentType + "')",
            enabled: true
          }
        ];
            break;
          case "gastenboek": menu = [
          {
            label: "Knip deze Component",
            href: "javascript:cms.doCutComponent(" + compId + ",'" + componentType + "')",
            enabled: true
          }
        ];
            break;
          case "event": menu = [
          {
            label: "Knip deze Component",
            href: "javascript:cms.doCutComponent(" + compId + ",'" + componentType + "')",
            enabled: true
          }
        ];
            break;
          case "multimedia": menu = [
          {
            label: "Knip deze Component",
            href: "javascript:cms.doCutComponent(" + compId + ",'" + componentType + "')",
            enabled: true
          }
        ];
            break;
          case "menu": menu = [{
            label: "Voeg nieuwe Pagina toe",
            href: "/_wizards/CreatePageWizard/Default.aspx?pageId=" + CURRENT_PAGE_ID,
            enabled: true
          },
        {
          label: "Pas navigatie aan",
          href: "javascript:menu.initNavigation('" + CURRENT_PAGE_ID + "')",
          enabled: true
        },
        {}
        ];
        }

        // dit geldt voor elk component:
        menu.push(
        {
          label: "Verwijder deze Component",
          href: "javascript:cms.doRemoveComponent(" + compId + ",'" + componentType + "')",
          enabled: true
        });
        return menu;
    }
  }
};

ContextMenu.__init();

function ComponentToolbar()
{    
  Spif.DOMEvents.attach(document.documentElement, "click", this.doClickBody, this);

  //create Toolbar
  this.__toolbar = this.CreateComponentToolbar();
};
  
ComponentToolbar.prototype = 
{
  // op dit moment nog geen component active.
  __currentActiveComponent: null,

  doClickBody: function(evt)
  {
    if (!this.isInEditmode())
      return;

    if (this.isInsideUI(evt.subject))
      return;

    var el = this.getComponentElement(evt.subject);

    if (this.__currentActiveComponent && this.__currentActiveComponent != el)
      this.__doDeactivateComponent();

    if (!el)
      return;

    this.__doActivateComponent(el);
  },
  
  __doActivateComponent: function (el)
  {
    // place toolbar
    el.appendChild(this.__toolbar);

    // make active component look active
    Spif.ClassNameAbstraction.add(el, "activatedComponent");

    this.__currentActiveComponent = el;
  },
  
  __doDeactivateComponent: function ()
  {
    // remove 
    if (!this.__toolbar.parentNode)
      return
      
    this.__toolbar.parentNode.removeChild(this.__toolbar);

    // stop active component from looking active 
    if (this.__currentActiveComponent)
      Spif.ClassNameAbstraction.remove(this.__currentActiveComponent, "activatedComponent");

    this.__currentActiveComponent = null;
  },
  
  // functions gets the component element if someone clicked within the component
  getComponentElement: function(el) {
    for (;el; el = el.parentNode)
      if (Spif.ClassNameAbstraction.contains(el, "componentBox") && Spif.ClassNameAbstraction.contains(el.parentNode, "placeholder"))
        return el;
    return null;
  },

  isInEditmode: function()
  {
    return Spif.ClassNameAbstraction.contains(document.getElementById("body"), "editMode");
  },

  isInsideUI: function(el)
  {
    for (;el; el = el.parentNode)
      if (Spif.ClassNameAbstraction.contains(el, "ui"))
        return true;
    return false;
  },
  
  // functions returns the HTML for the component toolbar    
  CreateComponentToolbar: function()
  {
    var componentToolbar = document.createElement("div");
    componentToolbar.id = "componentToolbar";
    componentToolbar.className = "componentToolbarBar ui dragger";
    
    var settingsButton = document.createElement("div");
    settingsButton.className = "dragging-disabled componentSettings";
    settingsButton.innerHTML = "<img src='/_img/component-selector-propertie.gif'/>";
    settingsButton.onclick = function(){settings.getComponentSettings(this);};
    componentToolbar.appendChild(settingsButton);

    // title
    /*var titleEl = document.createElement('span');
    titleEl.className = "contextmenuTitle";
    titleEl.innerHTML = "";
    componentToolbar.appendChild(titleEl);*/
    
    // context menu
    var ctxmenu = document.createElement('a');
    ctxmenu.setAttribute('href','#');
    ctxmenu.className = "dragging-disabled contextmenuActivator contextmenuType-component-";
    
    componentToolbar.appendChild(ctxmenu);

    return componentToolbar;
  }
};
  
var componentToolbar = new ComponentToolbar();
﻿
function ComponentDialog()
  {    
  };
  
  ComponentDialog.prototype = 
  {
    __initialized: false,
    deletedComponents : null,
    cutComponents : null,
  
    //tabkinds are copied and deleted
    initComponentTab : function (tabkind) {
    if (!this.__initialized)
    {
      this.__initialized = true;
      if (this.xsl==null)
        this.xsl = "components.xsl";
    }

    if (tabkind == "copied")
      this.drawCopiedTab();
    else if (tabkind == "deleted")
      this.drawDeletedTab();
    
    },
    
    drawCopiedTab : function () {
      this.cutComponents = proxies.ComponentManager.getAllCutComponents();
      if (this.cutComponents != null)
      {
        try
        {
          var params = new Array( {name:"componentSort", value:"cut"});
          var el = document.getElementById("cutComponentsBox");
          transformXml(this.cutComponents, this.xsl, el, params);
        }
        catch (err)
        {
          alert(err.message);
        }
      }
    },
    
    drawDeletedTab : function () {
      this.deletedComponents = proxies.ComponentManager.getAllDeletedComponents();
      if (this.deletedComponents != null)
      {
        try
        {
          var params = new Array( {name:"componentSort", value:"deleted"});
          var el = document.getElementById("deletedComponentsBox");
          transformXml(this.deletedComponents, this.xsl, el, params);
        }
        catch (err)
        {
          alert(err.message);
        }
      }
    }
  }

var componentdialog = new ComponentDialog();  


function MapHandler(mapId, view) {

  if (typeof (GUnload) == 'undefined' || !maps)
    return;
  this.mapId = mapId;
  this.view = view;
  maps.list[mapId + ""] = this;
}

MapHandler.prototype = {
  /* click vanuit een google map */
  onClick: function(marker, position) {

    if (!EDITMODE) return;

    if (!marker && position) {

      // we willen een nieuwe marker aanmaken.
      var newLoc = proxies.Maps.CreateLocation(this.mapId, position.lat(), position.lng());
      if (newLoc && newLoc.documentElement) {
        marker = maps.doShowLocation(newLoc.documentElement, true);
      }
      //return;
    }
      }
};

function Maps() {
  this.list = {};
  this.mapsById = {};
  this.allMarkers = {};

  Spif.DOMEvents.attach(window, "load", doOnloadMaps);
}

function doOnloadMaps() {
  maps.doOnload();
}

// async return method
proxies.Maps.GetLocations.func = function(soapResult) {
  if (soapResult && soapResult.documentElement) {
    maps.doShowLocations(soapResult.documentElement);
  }
  maps.doOnload(); // process possible next locations for other maps
}


Maps.prototype = {
  doOnload: function() {
    for (var mapid in this.list) {
      // start webservice call voor elke kaart
      // async!
      var maph = this.list[mapid + ""];
      if (!maph.loaded) {
        this.initializeMap('map-' + maph.mapId, maph.mapId, maph);
        maph.loaded = true;
        proxies.Maps.GetLocations(maph.mapId, 0, 0, 0, 0);
        break;
      }
    }
  },

  initializeMap: function(htmlElId, componentId, mapHandler) {
    if (GBrowserIsCompatible()) {
      var map = new GMap2(document.getElementById(htmlElId));

      if (mapHandler.view != 'small') {
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
      }

      map.setCenter(new GLatLng(DEFAULTMAPLOCATION.lng, DEFAULTMAPLOCATION.lat), 13);

      var maph = this.list[componentId + ""];
      GEvent.bind(map, "click", maph, maph.onClick);

      map.widwId = componentId;

      // store js object also
      this.mapsById[componentId] = map;
      return map;
    }
    return null;
  },

  /* wordt aangeroepen vanuit de proxies api */
  doShowLocations: function(xmlEl) {
    var nodes = xmlEl.childNodes;
        for (var i = 0; i < nodes.length; i++) {
      this.doShowLocation(nodes[i], i == nodes.length - 1); // laatste altijd openen
        }
  },

  doShowLocation: function(xmlEl, showPanel) {
    var mapId = xmlEl.getAttribute("component_id");
    var map = this.mapsById[mapId];
    var lng = xmlEl.getAttribute("lng").replace(",", ".") * 1
    var lat = xmlEl.getAttribute("lat").replace(",", ".") * 1
    var title = xmlEl.getAttribute("title");
    if (title == null) title = "";

    if (map == null)
      return;

    // create editable lime content if needed
    var html = title + "";
    if (EDITMODE) {
      var locid = xmlEl.getAttribute("id");
            html = '<div class="bubbleWrapper"><h3 name="' + locid + '" class="miniLocationEdit">' + title + '</h3><a class="location-delete-button" href="#" onclick="maps.doDeleteLocation(' + mapId + ',' + locid + '); return false;"></a></div>';

    }
    else {
      html = '<div style="width:200px;">' + title + '</div>';
    }

    // Our info window content
    var infoTabs = [
      new GInfoWindowTab("Lokatie", html)
    ];

    // Place a marker in the center of the map and open the info window
    // automatically
    var marker = new GMarker(new GLatLng(lat, lng));

    GEvent.addListener(marker, "click", function() {
      marker.openInfoWindowTabsHtml(infoTabs);
    });

        GEvent.addListener(marker, "infowindowopen", function () {
            maps.loadLocationEditor();
        });

        GEvent.addListener(marker, "infowindowbeforeclose", function () {
            $(".miniEditor").blur();
            $(".miniEditor").unbind('keydown');
        });


    map.addOverlay(marker);
    if (showPanel) {
      marker.openInfoWindowTabsHtml(infoTabs);
    }
    this.allMarkers[mapId + '-' + locid] = marker;
    return marker;
  },

    loadLocationEditor: function () {
        $(".miniLocationEdit").unbind("click");
        $(".miniLocationEdit").bind("click", function (evt) {
            $(evt.target).miniEditor({ editorType: 'location' });
        });
    },

  doDeleteLocation: function(mapid, locid) {
    if (EDITMODE) {
      if (!confirm("Weet u zeker dat u deze lokatie wilt verwijderen?")) return;

      proxies.Maps.DeleteLocation(locid);
      var map = this.mapsById[mapid];

      // kan slimmer; maar removeOverlay werkte even niet goed, dit werkt ook, is alleen suboptimaal. (kars)
      map.clearOverlays();
      proxies.Maps.GetLocations(mapid, 0, 0, 0, 0);
    }
  }



};

var maps = new Maps();




/**
 * Web in de Wijk
 *
 * (C) 2006, Q42 Internet BV - http://q42.nl
 */
 
// check which browser is running
var userAgent    = navigator.userAgent.toLowerCase();
var appVersion   = navigator.appVersion.toLowerCase();
var appName      = navigator.appName.toLowerCase();

// operating system and browser information
var isWin        = (appVersion.indexOf('windows') != -1);
var isOpera      = (userAgent.indexOf('opera') != -1);
var isIE         = (appName.indexOf('internet explorer') != -1) && !isOpera;
var isSafari     = (userAgent.indexOf('applewebkit') != -1);
var isMozilla    = (appName.indexOf('netscape') != -1) && !isSafari;

// build versionString
if (isSafari)
  var versionString = appVersion.substr(appVersion.lastIndexOf("safari/") + 7, 3);
else if (isIE || isOpera)
  var versionString = appVersion.substring(appVersion.indexOf('msie') + 5);
else if (isMozilla)
  var versionString = userAgent.substring(userAgent.indexOf('rv:')+3, userAgent.indexOf('rv:') + 6);
else
  var versionString = appVersion;

// cast version to numeric
var version = parseFloat(versionString);
var ie50 = isWin && isIE && (version <= 5.01);

function getBoxObjectFor(el)
{
  if (el.getBoundingClientRect)
  {
    var bcr = el.getBoundingClientRect();
    return {
      x: bcr.left + document.documentElement.scrollLeft,
      y: bcr.top + document.documentElement.scrollTop,
      width: bcr.right - bcr.left,
      height: bcr.bottom - bcr.top
    };
  }
  else if (el.ownerDocument.getBoxObjectFor)
  {
    var box = el.ownerDocument.getBoxObjectFor(el);
    var bcr = {
      x:box.x,
      y:box.y,
      width:box.width,
      height:box.height
    };
    for (var pel = el.parentNode; pel != document.documentElement; pel = pel.parentNode)
    {
      bcr.x -= pel.scrollLeft;
      bcr.y -= pel.scrollTop;
    }
    return bcr;
  }
  else
    aler("getBoxObjectFor is not implemented for this browser");
}

function getElementsByTagNameAttributeValue(ancestorEl, tagName, attrName, attrValue)
 {
  if (typeof(attrValue) == "undefined")
    attrValue = null;

  var els = [];
  var a = ancestorEl.getElementsByTagName(tagName);
  for (var i=0; i<a.length; i++)
  {
    var el = a[i];
    switch (attrName)
    {
      case "className":
      case "class":
        //if (el.className.indexOf(attrValue) != -1)
        if (Spif.ClassNameAbstraction.contains(el,attrValue))
          els.push(el);
        break;
      default:
        var val = el.getAttribute(attrName);
        if ((val != null) && ((attrValue == null) || (val == attrValue)))
          els.push(el);
    }
  }
  return els;
};

function getParentElementByTagNameAttributeValue(el, tagName, attrName, attrValue)
 {
  if (typeof(attrValue) == 'undefined')
    attrValue = null;

  tagName = tagName.toLowerCase();

  while (el && el.getAttribute && el.parentNode)
  {
    if (el.tagName && (el.tagName.toLowerCase() == tagName))
    {
      switch (attrName)
      {
        case "className":
        case "class":
          if (Spif.ClassNameAbstraction.contains(el,attrValue))
            return el;
        default:
          var val = el.getAttribute(attrName);
          if ((val != null) && ((attrValue == null) || (val == attrValue)))
            return el;
      }
    }
    el = el.parentNode;
  }

  return null;
};

function getParametersFromElement(el)
{
  // Will extract a hashTable of name/value pairs from a className:
  // class="... params-name1_value1-name2_value2... ..."

  var params = {};
  var matches = el.className.match(/params-(.+[^\s$])/);
  if (matches)
  {
    var s = matches[1];
    var a = s.split("-");
    for (var i=0; i<a.length; i++)
    {
      var nv = a[i].split("_");
      params[nv[0]] = nv[1];
    }
  }
  
  return params;
}

Function.prototype.closure = function(obj)
{
  // Init object storage.
  if (!window.__objs)
  {
    window.__objs = [];
    window.__funs = [];
  }

  // For symmetry and clarity.
  var fun = this;

  // Make sure the object has an id and is stored in the object store.
  var objId = obj.__objId;
  if (!objId)
    __objs[objId = obj.__objId = __objs.length] = obj;

  // Make sure the function has an id and is stored in the function store.
  var funId = fun.__funId;
  if (!funId)
    __funs[funId = fun.__funId = __funs.length] = fun;

  // Init closure storage.
  if (!obj.__closures)
    obj.__closures = [];

  // See if we previously created a closure for this object/function pair.
  var closure = obj.__closures[funId];
  if (closure)
    return closure;

  // Clear references to keep them out of the closure scope.
  obj = null;
  fun = null;

  // Create the closure, store in cache and return result.
  return __objs[objId].__closures[funId] = function ()
  {
    return __funs[funId].apply(__objs[objId], arguments);
  };
};

function getXMLDOM(url)
{
  var xmlDoc;

  if (window.ActiveXObject)
    xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
  else
    xmlDoc = document.implementation.createDocument("text/xml", "", null);

  xmlDoc.async=false;
  xmlDoc.load(url);

  return xmlDoc;
};

function getXSLTStylesheet(xslFileName)
{
  //ophalen van alle verschillende soorten websites.
  if (window.ActiveXObject)
  {
    var xslDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument");
    xslDoc.async = false;
    xslDoc.resolveExternals = true;
    xslDoc.load(xslFileName);

    var xslt = new ActiveXObject("Msxml2.XSLTemplate");
    xslt.stylesheet = xslDoc;

    return xslt.createProcessor();
  }
  else
  {
    var xslDoc = getXMLDOM(xslFileName);
    var xsltProc = new XSLTProcessor();
    xsltProc.importStylesheet(xslDoc);

    return xsltProc;
  }
};

function initXML(xmlString)
{
  if (window.ActiveXObject)
  {
    var doc=new ActiveXObject("Microsoft.XMLDOM");
    doc.async="false";
    doc.loadXML(xmlString);
    return doc;
  }
  else
  {
    var parser=new DOMParser();
    var doc=parser.parseFromString(xmlString,"text/xml");
    return doc;
  }
};

function loadXMLFile (file)
{
  var xmlDoc;
  //ophalen van alle verschillende soorten websites.
  if (document.implementation && document.implementation.createDocument)
    xmlDoc = document.implementation.createDocument("", "", null);
  else if (window.ActiveXObject)
  {
    xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    xmlDoc.async="false";
  }
  xmlDoc.load(file);
  
  return xmlDoc;
}

function XmlHttp(){}
XmlHttp.prototype =
{
  request: function(url, send)
  {
    if (window.XMLHttpRequest)
      req = new XMLHttpRequest();
    else if (window.ActiveXObject)
      req = new ActiveXObject("Microsoft.XMLHTTP");
    if (req == null)
      return;        
    req.open("GET", url, false);
    req.send(send);
    return req;
  }
}
var xmlhttp = new XmlHttp();

function removeDoubles(array)
{
  var newArray = new Array();
  var aantal = 0;
  for (i=0; i<array.length; i++)
  {
    var vergelijk = array[i];

    for (y=0; y<newArray.length; y++)
    {
      var vergelijkmet = newArray[y];
      if (vergelijk == vergelijkmet)
        aantal++
    }

    if (aantal == 0)
      newArray.push(vergelijk)
    aantal = 0;
  }
  return newArray;
}


function setFocus(el)
{
  if (el)
    setTimeout(function() {el.select(); },20)
}

function findPos(obj)
 {
  var curleft = curtop = 0;
  if (obj.offsetParent)
   {
    curleft = obj.offsetLeft
    curtop = obj.offsetTop
    while (obj = obj.offsetParent)
     {
      curleft += obj.offsetLeft
      curtop += obj.offsetTop
    }
  }
  return [curleft,curtop];
}


function transformXml(xmlDoc, xslProc, destEl, parameters) {
    var preXslPath = "/_xslt/";
    var transformerUrl = "/_services/" + "ServerSideTransform";

    //default value for proxy
    var $parametersArray = [""];

    $(parameters).each(function (key, objValue) {
        $parametersArray.push(objValue.name + ":" + objValue.value);
    });

    destEl.innerHTML = "";
    var result = proxies.EditMode.ServerSideTransform(xmlDoc, preXslPath, xslProc, $parametersArray , EDITMODE);
    $(destEl).html(result);
}


// FUNCION DEPRECATED Do Not Use This Function
// only IE probably!
// transforms xmlDom using xslTemplate and parameters
// define params as var params = new Array( {name:"currentAssetId", value:currentAssetId} );
function DEPRECATEDtransformXmlDEPRECATED(xmlDoc, xslProc, destEl, parameters) {
  var preXslPath = "/_xslt/";
  if (isMozilla)
  {
    //create processor
    var processor = new XSLTProcessor();
    
    //get and import xsl
    var xslDom = xmlhttp.request(preXslPath + xslProc).responseXML;
    processor.importStylesheet(xslDom);
    
    //add parameters if there are any
    if (parameters)
      for (var i = 0; i < parameters.length; i++)
        processor.setParameter("", parameters[i]["name"], parameters[i]["value"]);
        
    
    //transform and show result
    var result = processor.transformToDocument(xmlDoc);
    if(result.documentElement)
    {
      destEl.innerHTML = "";

      //while (result.documentElement.firstChild)
      destEl.appendChild(result.documentElement);
      return;
    } 
  } 
  else if (isIE)
  {
    xslProc = getXSLTStylesheet(preXslPath+xslProc);
    var endResult = null;
    if (xslProc.transformToDocument)
    {
      if (parameters)
        for (var i = 0; i < parameters.length; i++)
          xslProc.setParameter("", parameters[i].name, parameters[i].value);

      var result = xslProc.transformToDocument(xmlDoc);

      if (parameters)
        for (var i = 0; i < parameters.length; i++)
          xslProc.removeParameter("", parameters[i].name);

      endResult = result;
    }
    else
    {
      xslProc.input = xmlDoc;
      if (parameters)
        for (var i = 0; i < parameters.length; i++)
          xslProc.addParameter(parameters[i].name, parameters[i].value);

      xslProc.transform();
      endResult = xslProc.output;
    }
    
    //draw endresult
    destEl.innerHTML = "";
    destEl.innerHTML = serializeXMLDoc(endResult);
  }
}

function serializeXMLDoc(xmlDoc)
{
  if (window.XMLSerializer)
    var html = new XMLSerializer().serializeToString(xmlDoc);
  else
    var html = "" + xmlDoc;

  html = html.replace(/(<iframe[^>]+)\/>/gi, "$1></iframe>");

  return html;
}
  
function selectSingleNode(node, xpath)
{
  if (typeof(node.selectSingleNode) != "undefined")
    return node.selectSingleNode(xpath);
  else
  {
    var xpe = new XPathEvaluator();
    return xpe.evaluate(xpath, node, xpe.createNSResolver(node), XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
  }
}

// check for XPath implementation 
if( document.implementation.hasFeature("XPath", "3.0") ) 
{ 
  // prototying the XMLDocument 
  XMLDocument.prototype.selectSingleNode = function(cXPathString, xNode) 
  { 
    if( !xNode ) { xNode = this; }
    var xItems = this.selectNodes(cXPathString, xNode);
    
    if( xItems.length > 0 )  
      return xItems[0];
    else 
      return null;
  } 
  
  // prototying the Element 
  Element.prototype.selectSingleNode = function(cXPathString) 
  {
    if(this.ownerDocument.selectSingleNode) 
      return this.ownerDocument.selectSingleNode(cXPathString, this); 
    else
      throw "For XML Elements Only";
  } 
} 

if( document.implementation.hasFeature("XPath", "3.0") ) 
{ 
  // prototying the XMLDocument 
  XMLDocument.prototype.selectNodes = function(cXPathString, xNode) 
  { 
    if( !xNode ) { xNode = this; }
    var oNSResolver = this.createNSResolver(this.documentElement) 
    var aItems = this.evaluate(cXPathString, xNode, oNSResolver,
                 XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null) 
    var aResult = [];
    for( var i = 0; i < aItems.snapshotLength; i++) 
    { 
      aResult[i] = aItems.snapshotItem(i);
    } 
    return aResult;
  } 

  // prototying the Element 
  Element.prototype.selectNodes = function(cXPathString) 
  { 
    if(this.ownerDocument.selectNodes) 
    { 
      return this.ownerDocument.selectNodes(cXPathString, this);
    } 
    else{throw "For XML Elements Only";} 
  }
}

$(function () {
  // in viewMode alle plaatjes met prettyPhoto links init
  if (!$(document.body).hasClass("editMode")) {
    $("a[rel^='prettyPhoto']").prettyPhoto({ social_tools: "", overlay_gallery: false });
  }
  // in editMode prettyPhoto op youtube Help dialog
  else {
    $(".youtubeHelp").prettyPhoto({ social_tools: "", overlay_gallery: false });
  }
});
 /**
 * Web in de Wijk
 *
 * (C) 2006, Q42 Internet BV - http://q42.nl
 */
function userAuthentication() {}
userAuthentication.prototype =
{
  login: function () {
    //ophalen van username/emailadres en password
    var username = document.getElementById("loginUsername").value;
    var password = document.getElementById("loginPassword").value;
    var remember = document.getElementById("rememberMe").checked;

    //controleer password dmv service
    var result = proxies.userAuthentication.Login(username, password, remember);
    if (result != "") {
      alert(result);
      document.getElementById('loginUsername').select();
      Spif.ClassNameAbstraction.replace(document.getElementById('forgotPassword'), "collapsed", "expanded");
    }
    else {
      var res = proxies.userAuthentication.isEmailAdressValidated();
      if (res != "" && (typeof res !== "undefined"))
        window.location.href = "/_wizards/UserRegistration/ValidateEmail.aspx?code=" + res;
      else {
        //reload page
        window.location.reload();
      }
    }
  },

  changePassword: function () {
    //ophalen password
    var username = document.getElementById('forgotPassUsername').value;

    //check of username bestaat
    if (!proxies.userAuthentication.userNameExists(username)) {
      alert("Deze gebruikersnaam bestaat niet.\nProbeer het nog eens.")
      return;
    }

    //send email
    proxies.userAuthentication.sendPasswordForgottenMail(username);
    alert("Er is een email verzonden naar uw emailadres");
  },

  logout: function () {
    //legen van de sessie
    proxies.userAuthentication.Logout();
    window.location.reload()
  },

  startEditing: function () {
    //zet in een sessie dat er gewijzigd mag worden
    proxies.userAuthentication.setEditingSession();
    //reload page (alleen pathname, want hash van prettyPhoto triggert het openen van de lightbox
    window.location = window.location.pathname;
  },

  stopEditing: function () {
    //zet de sessie om te wijzigen uit
    proxies.userAuthentication.removeEditingSession();
    //reload page (alleen pathname, want hash van prettyPhoto triggert het openen van de lightbox
    window.location = window.location.pathname;
  },

  inlogTriggerAction: function (keycode, evt) {
    var keyCode = evt.keyCode ? evt.keyCode : evt.which ? evt.which : evt.charCode;
    if (keyCode == 13)
      this.login();
  }

}

var userauthenticate = new userAuthentication();

﻿/**
* Web in de Wijk
*
* (C) 2010, Q42 Internet BV - http://q42.nl
*/

function openContactDialog() {
  Spif.ClassNameAbstraction.replace(document.getElementById("contactDialog"), "hidden", "shown");
}

function deleteProfilePhoto() {
  try {
    proxies.EditMode.deleteProfilePhoto();
    document.getElementById("headPhoto").innerHTML = " ";
  }
  catch (err) {
    alert(err.message);
  }
}

function doDropProfileHeadImage(droppedEl, oldParent, oldNextSibling, newParent, newNextSibling) {
  if (!EDITMODE) {
    alert("You're not in editmode");
    newParent.innerHTML = "";
    return;
  }

  newParent.innerHTML = "";
  var assetId = oldParent.id.replace("asset-", "");
  if (!assetId || assetId < 0)
    return;

  var link = "/_services/AssetServer.ashx/" + assetId + "?multimediacomponent-profile";
  newParent.innerHTML = "<img src='" + link + "' /><div class=\"removePhoto\" onclick=\"deleteProfilePhoto()\">&#160;</div>";

  //save image in db
  try {
    proxies.EditMode.saveProfileHeadImage(assetId)
  }
  catch (err) {
    alert(err.message);
  }
}


function deleteWebsite(id) {
  var a = confirm("Weet u zeker dat u de website (inclusief subpagina's) wilt weggooien?")
  if (a) {
    try {
      proxies.EditMode.deleteWebsite(id);

      //hide row
      var el = document.getElementById("myWebsite-" + id);
      el.parentNode.removeChild(el);
    }
    catch (err) {
      alert(err.message);
    }
  }
}

/*save profile info limelessly*/
$("#profileInfo .submitButton").live('click', function (evt) {
  var firstName = $("#profileInfo .firstname").val();
  var lastName = $("#profileInfo .lastname").val();
  var gender = $("#profileInfo .gender").val();
  var day = $("#profileInfo .day").val();
  var month = $("#profileInfo .month").val();
  var year = $("#profileInfo .year").val();
  var information = $("#profileInfo .information").val();
  var hyvesprofilelink = $("#profileInfo .hyvesprofilelink").val();
  var facebookprofilelink = $("#profileInfo .facebookprofilelink").val();
  var linkedinprofilelink = $("#profileInfo .linkedinprofilelink").val();
  var twitterprofilelink = $("#profileInfo .twitterprofilelink").val();
    
  var error = proxies.EditMode.updateProfileInformation(firstName, lastName, gender, day, month, year, information, hyvesprofilelink, facebookprofilelink, linkedinprofilelink, twitterprofilelink);
  if (error != "")
    errorHandler(error);
  else
    feedbackHandler("De gegevens zijn succesvol gewijzigd");
});

function feedbackHandler(feedback) {
  $("#profileInfo .error").css("display", "none");
  $("#profileInfo .feedback").text(feedback);
  $("#profileInfo .feedbackBox").fadeIn(300).delay(6000).fadeOut(300, function () {
    $("#profileInfo .feedback").text("");
    $("#profileInfo .error").css("display", "block");
  });
}

function errorHandler(feedback) {
  $("#profileInfo .feedback").css("display", "none");
  $("#profileInfo .error").text(feedback);
  $("#profileInfo .feedbackBox").fadeIn(300).delay(6000).fadeOut(300, function () {
    $("#profileInfo .error").text("");
    $("#profileInfo .feedback").css("display", "block");
  });
}

$("#profileInfo .information").live('keydown', function (evt) {
  var deleteKeysPressed = (evt.keyCode == 8 || evt.keyCode == 27 || evt.keyCode == 46);

  var value = $(evt.target)[0].value;
  if (value.length > 140 && !deleteKeysPressed)
    return false;
});

$("#profileInfo .information").bind('blur', function (evt) {
  var value = $(evt.target)[0].value;
 
  if (value.length > 140)
    $(evt.target)[0].valueOf(value.substr(0, 140));
});


﻿var classREs = "prev3Img\\b|\\bprev2Img\\b|\\bprev1Img\\b|\\bcurImg\\b|\\bnext1Img\\b|\\bnext2Img\\b|\\bnext3Img";
function doSlide(actorEl, acteeEl) {
  doLoadImages(actorEl.parentNode, acteeEl);

  var captionEl = document.getElementById("caption" + acteeEl.id.substring(9));
  var showCaption = false;
  if (document.getElementById("showDescr") && document.getElementById("showDescr").value == "on")
    showCaption = true;

  var curImg = getCurImage(acteeEl);

  if (curImg && showCaption)
    captionEl.innerHTML = curImg.title;
}

function doLoadImages(actorEl, acteeEl) {
  for (var cEl = acteeEl.firstChild; cEl; cEl = cEl.nextSibling) {
    if (cEl.nodeType == 1) {
      if (
        Spif.ClassNameAbstraction.contains(cEl, classREs)
        &&
        cEl.getAttribute("nosrc")
      ) {
        cEl.setAttribute("src", cEl.getAttribute("nosrc"));
        cEl.removeAttribute("nosrc", null);
      }
    }
  }
}

function autoSlideShowStarter(componentId) {
  var playButton = document.getElementById("slideshow" + componentId);
  Spif.ClassShifter.play(playButton);
}

var classRE2s = "prev2Img\\b|\\bprev1Img\\b|\\bcurImg\\b|\\bnext1Img\\b|\\bnext2Img";
function doBeforeChangeSlideshow(el) {
  for (var i = 0; i < el.childNodes.length; i++) {
    var cEl = el.childNodes[i];
    if (cEl.nodeType == 1 && Spif.ClassNameAbstraction.contains(cEl, classRE2s) && (cEl.naturalWidth == 0 || (cEl.readyState && cEl.readyState != "complete")))
      return false;
  }
}

function doSwapPrevInSlideshow(el, parentEl, componentId) {
  var curImg = getCurImage(el);

  var prevImg = curImg.previousSibling.previousSibling;
  if (!prevImg || prevImg.nodeName != "IMG")
    return;

  // Send to server
  var curAssetId = curImg.src.match(/\/([0-9]+)\?/)[1];
  var prevAssetId = prevImg.src.match(/\/([0-9]+)\?/)[1];

  try {
    proxies.AssetServer.doSwapPrevInSlideshow(curAssetId, prevAssetId, componentId)
    var src = curImg.src;
    curImg.src = prevImg.src;
    prevImg.src = src;
  }
  catch (err) { alert(err.message) }
}

function doSwapNextInSlideshow(el, parentEl, componentId) {
  var curImg = getCurImage(el);
  var nextImg = curImg.nextSibling.nextSibling;

  if (!nextImg || nextImg.tagName != "IMG")
    return;

  // Send to server
  var curAssetId = curImg.src.match(/\/([0-9]+)\?/)[1];
  var nextAssetId = nextImg.src.match(/\/([0-9]+)\?/)[1];

  try {
    proxies.AssetServer.doSwapPrevInSlideshow(curAssetId, nextAssetId, componentId)
    var src = curImg.src;
    curImg.src = nextImg.src;
    nextImg.src = src;
  }
  catch (err) { alert(err.message) }
}

function doDeleteFromSlideshow(el, parentEl, componentId) {
  var curImg = getCurImage(el);
  // Send to server
  var assetId = curImg.src.match(/\/([0-9]+)\?/)[1];
  try {
    proxies.AssetServer.deleteImageFromSlideshow(assetId, componentId)
    var deleteEl = curImg;
    var newClassName = deleteEl.className;
    var nextSlide = deleteEl.nextSibling
    deleteEl.parentNode.removeChild(deleteEl);
    Spif.ClassShifter.reset(parentEl);

    for (nextSlide; nextSlide; nextSlide = nextSlide.nextSibling) {
      if (Spif.ClassNameAbstraction.contains(nextSlide, "slide")) {
        var oldClassName = nextSlide.className;
        Spif.ClassNameAbstraction.replace(nextSlide, oldClassName, newClassName)
        newClassName = oldClassName;
      }
    }
  }
  catch (err) { alert(err.message) }
}

function getCurImage(el) {
  while (!Spif.ClassNameAbstraction.contains(el, "classChain"))
    el = el.parentNode;

  for (var cel = el.firstChild; cel; cel = cel.nextSibling)
    if (Spif.ClassNameAbstraction.contains(cel, "curImg"))
      return cel;
}

function doLoadSlideshowImage(img) {
  var cn = img.className;
  img.className = "";
  var cssText = null;
  if (img.style.cssText) {
    cssText = img.style.cssText;
    img.style.cssText = "";
  }
  img.setAttribute("style", "");
  if (img.offsetWidth < img.offsetHeight)
    cn = cn.replace("landscape", "portret");
  if (cssText)
    img.style.cssText = cssText;
  img.className = cn;
}
﻿//semipersistent objects
var $hoverlay, currentPreviewImg;


//descriptions
$(".editPhotoBookText").live("click", function (evt) {
  evt.preventDefault();
  var href = $(this).attr("href").replace("#", "").split("_");

  var html = $(this).closest(".photobookPhoto").find(".photoTitle").html();
  $("#editPBPhotoDescription").html(html);
  $("#submitPBDescription .componentId").val(href[0]);
  $("#submitPBDescription .ref").val(href[1]);
  $("#submitPBDescription .pageId").val($("#pageId").val());

  dialog.openDescriptionDialog();
});



$(document).ready(function () {

  //description editor settings
  $("#editPBPhotoDescription").tinymce({
    script_url: '/tinymce/tiny_mce.js',
    body_id: 'editPBPhotoDescription',
    // General options
    theme: "advanced",
    language: "nl",
    advimagescale_noresize_all: true,
    // Theme options                    
    theme_advanced_toolbar_location: "top",
    theme_advanced_toolbar_align: "left",
    theme_advanced_statusbar_location: "",
    theme_advanced_default_background_color: "#FF00FF",
    theme_advanced_resizing: true,
    theme_advanced_buttons1: "link,unlink", //", HTML tonen kan standaard niet in lightbox dus linkje heeft geen zin :'(
    theme_advanced_buttons2: null,
    theme_advanced_buttons3: null,
    theme_advanced_buttons4: null
  });

  function photoBook(element, rowsOfImages) {
    var $element = $(element),
        elementId = $element.attr('id').split('-')[0],
        isDragging = false,
        $parent = $element.closest(".photobook");


    //detect being on a small column and take appropriate action
    if ($('body').hasClass('editMode')) {
      if ($element.parents().hasClass('view-small')) {
        var oldParent = $element.parents().filter('.contentColumn')[0],
            oldNextSibling = $element.siblings()[$.inArray($element, $element.parent().children()) + 1],
            newParent = $('.view-large')[0];
        doDropComponent(element, oldParent, oldNextSibling ? oldNextSibling : null, newParent, null);
      }

      //on numrows change save and reload;
      $parent.find('select.rowsOfImages').bind('change', function () {
        var $selected = $(this).find("option:selected");
        elementId = $parent.attr("id");
        var result = proxies.EditMode.SavePhotobookSettings(elementId, $selected.val());
        if (result != "")
          alert(result);
        else {
          window.location.reload();
        }
      });

      // bind drag handler
      $element.bind('mousedown', photoDragHandler);

      $element.find('.addYouTube').bind('click', function (event) {
        dialog.openYouTubeDialog($element);
      });

    }
    // not editMode
    else {
      $element.children().bind('mousemove', preview);
    }

    function photoDragHandler(e) {
      if ($(e.target).parent().hasClass('deleteButton') || $(e.target).parent().hasClass('editPhotoBookText')) {
        return;
      }
      e.target.blur();
      if (isDragging) return;
      isDragging = true;
      e.preventDefault();

      var $drag = e.target instanceof Image ? $(e.target).parent() : $(e.target);
      if ($drag.parent().hasClass('addYouTube')) {
        isDragging = false;
        dialog.openYouTubeDialog($element);
        return;
      }
      var originalIndex = $.inArray($drag[0], $element.children());
      $element.find('.deleteButton').addClass('hide');
      $element.find('.editPhotoBookText').addClass('hide');
      $element.find('.addYouTube').hide();

      var parentId = $drag.parent().attr('id');
      var lastTarget, lastIndex = originalIndex, targetIndex;

      $(document).bind('mousemove', function (e) {
        e.preventDefault();
        var overElement = document.elementFromPoint(e.clientX, e.clientY);
        if (overElement instanceof Image) overElement = $(overElement).parent()[0];
        if (overElement != lastTarget && overElement != $drag[0]) { //a new item under cursor, not self.
          if ($(overElement).parent().attr('id') == parentId) { //make sure it's from this photobook
            lastTarget = overElement;
            targetIndex = $.inArray(lastTarget, $element.children());
            $drag.remove();
            if (targetIndex > lastIndex) {
              $(overElement).after($drag);
            } else if (targetIndex < lastIndex) {
              $(overElement).before($drag);
            }
            lastIndex = $.inArray($drag[0], $element.children());
            lastTarget = null;
          }

        }
      });
      $(document).bind('mouseup', function (e) {
        $(document).unbind('mousemove');
        $(document).unbind('mouseup');
        e.preventDefault();
        if (originalIndex != targetIndex) {
          var postString = "";
          var updateList = processSequence($element, Math.min(originalIndex, targetIndex), Math.max(originalIndex, targetIndex), function (item, index) {
            postString += $(item).attr('id');
            postString += ':' + index + ',';
            return { id: $(item).attr('id'), index: index };
          });
          postString = postString.substr(0, postString.length - 1);
          updatePhotobookItems($element, postString);
        }
        $element.bind('mousedown', photoDragHandler);
        isDragging = false;
        $element.find('.deleteButton').removeClass('hide');
        $element.find('.editPhotoBookText').removeClass('hide');
        $element.find('.addYouTube').fadeIn(500);
        return false;
      });
      return false;
    }
  }

  function stripPxToNumber(string) {
    if (string == 'light') return 1;
    if (string == 'medium') return 3;
    if (string == 'thick') return 5;
    return parseInt(string);
  };

  function preview(event) {
    return;
    var $el = $(this);
    var $image = $(event.target);
    if ($(event.target).hasClass("pbThumb")) {
      if (!currentPreviewImg || event.target.src != currentPreviewImg.image.src) {
        if ($hoverlay) {  //removes previous preview
          $hoverlay.remove();
          $hoverlay = null;
        }

        if (currentPreviewImg) {  //sets the old previewed image back to it's default state
          $(currentPreviewImg.image).css('width', currentPreviewImg.width);
          $(currentPreviewImg.image).css('height', currentPreviewImg.height);
          $(currentPreviewImg.image).css('left', 0);
          $(currentPreviewImg.image).css('top', 0);
          $(currentPreviewImg.image).css('z-index', 1);
        }
        currentPreviewImg = {}; //and updates the default variables with the new previewed image
        currentPreviewImg.image = $image[0];
        currentPreviewImg.width = $image.width();
        currentPreviewImg.height = $image.height();

        $image.css('width', currentPreviewImg.width * 1.2 + 'px');  //enlarges the new previewed image
        $image.css('height', currentPreviewImg.height * 1.2 + 'px');
        $image.css('left', currentPreviewImg.width * -0.1);
        $image.css('top', currentPreviewImg.height * -0.2);
        $image.css('z-index', 2);

        //Now determine the size of the comment div
        var borderWidths = parseInt($image.css('border-left-width')) + parseInt($image.css('border-right-width'));
        var $title = $($image.parent().siblings()[0]).clone(); //get the image title, div2
        $container = $image.parent().parent().parent();
        $hoverlay = $('<div class="hoverlay"/>');             //create the new title float
        $hoverlay.append($title);
        $image.parent().parent().append($hoverlay);
        $title.css('display', 'block');
        $title.css('min-width', (currentPreviewImg.width * 1.2 + borderWidths) - 2 + 'px');
        var halfTitleWidth = -(parseInt($title.width())) / 2;
        $hoverlay.css('top', parseInt($image.position().top) + (currentPreviewImg.height * 1.2) + 'px');
        $hoverlay.css('left', parseInt($image.position().left) + (currentPreviewImg.width * 1.2) / 2 + halfTitleWidth + (borderWidths / 2) + 'px');

        $(document).bind('mousemove', function (event) {      //disables hoverlay when not hovering over an image anymore
          if (!(event.target instanceof Image) || event.target.src != $image[0].src) {
            if (currentPreviewImg) {
              $(currentPreviewImg.image).css('width', currentPreviewImg.width);
              $(currentPreviewImg.image).css('height', currentPreviewImg.height);
              $(currentPreviewImg.image).css('left', 0);
              $(currentPreviewImg.image).css('top', 0);
              $(currentPreviewImg.image).css('z-index', 0);
            }
            currentPreviewImg = null;
            $hoverlay.remove();
            $hoverlay = null;
            $(document).unbind('mousemove');
          }
        });
      }
    }
  }

  //run photobook with page
  var thePhotobooks = $('.pb-content');
  thePhotobooks.each(function (item) {
    var componentId = $(thePhotobooks[item]).parent().parent().parent().attr('id');
    photoBook(thePhotobooks[item], Number($('#roi_' + componentId).attr('value')));
  });
});

function processSequence($container, min, max, callback) {
  var i = min;
  var children = $container.children();
  var result = [];
  while (i <= max) {
    result.push(callback(children[i], i));
    i++;
  }
  return result;
}

function updatePhotobookItems($component, updateList) {
  if (!updateList.length) return;
  var componentId = $component.attr('id').split('-')[0];
  // Send to server
  try {
    proxies.AssetServer.updatePhotobookOrder(updateList, componentId)
  }
  catch (err) { alert(err.message) }
}

function doDeleteFromPhotobook(element) {  
  var $parent = $(element).parent().parent();
  var componentId = $parent.attr('id').split('-')[0],
      id = $(element).parent().attr('id');
  var length = $parent.children().length - 2;
  var index = $.inArray($(element).parent()[0], $parent.children());
  $(element).parent().remove();
  var postString = "";
  var updateList = processSequence($parent, index, length, function (item, index) {
    if ($(item).attr('id') == undefined) return;
    postString += $(item).attr('id');
    postString += ':' + index + ',';
    return { id: $(item).attr('id'), index: index };
  });
  postString = postString.substr(0, postString.length - 1);

  // Send to server
  try {
    proxies.AssetServer.deleteImageFromPhotobook(id, componentId, postString);
  }
  catch (err) {alert(err.message); }
}
﻿function doShownSettingsDialog()
{
  settings.init();
}


function Settings()
  {    
  };

  Settings.prototype =
  {
    init: function () {
      var xsl = "settingsDialog.xsl";
      var html = null;
      var settingsXML = null

      try { settingsXML = proxies.EditMode.getAllSettingsByComponentId(this.componentId); }
      catch (err) { alert(err.message) }
      if (settingsXML != null) {
        var el = document.getElementById("settingsDialogMainContent");
        transformXml(settingsXML, xsl, el);
      }
      else {
        html = "Er is geen component gevonden waarvan de settings weergegeven kunnen worden. Sluit het venster en probeer het nog eens"
        document.getElementById("settingsDialogMainContent").innerHTML = html;
      }

    },

    getComponentSettings: function (el) {
      //get componentId
      this.componentId = el.parentNode.parentNode.id;
      var componentIdForFrame = document.getElementById("componentIdForIframe");
      componentIdForFrame.value = this.componentId;

      //set src for iframe
      document.getElementById("saveSettingsForm").src = "/_actions/settings.aspx";

      //open dialog
      settingsDialoog = document.getElementById("settingsDialog");
      Spif.ClassNameAbstraction.replace(settingsDialoog, "hidden", "shown");
    }

  }

var settings = new Settings();


$(document).ready(function () {

  /*SAVE EDITMODE*/
  $(".saveYouTubeSettings").bind("click", function (evt) {
    var el = $(this)

    var componentId = el.parents(".youtubewidget").attr("id");
    var url = $(".settings-" + componentId + " .videoLink").val();

    var result = proxies.EditMode.SaveYouTubeSettings(componentId, url);

    if (result != "")
      alert(result);
    else {
      $(".settings-" + componentId + " .statusInfo").fadeIn(300).delay(3000).fadeOut(300);
    }
  });
});

/*	Unobtrusive Flash Objects (UFO) v3.20 <http://www.bobbyvandersluis.com/ufo/>
	Copyright 2005, 2006 Bobby van der Sluis
	This software is licensed under the CC-GNU LGPL <http://creativecommons.org/licenses/LGPL/2.1/>
*/

var UFO = {
	req: ["movie", "width", "height", "majorversion", "build"],
	opt: ["play", "loop", "menu", "quality", "scale", "salign", "wmode", "bgcolor", "base", "flashvars", "devicefont", "allowscriptaccess", "seamlesstabbing"],
	optAtt: ["id", "name", "align"],
	optExc: ["swliveconnect"],
	ximovie: "ufo.swf",
	xiwidth: "215",
	xiheight: "138",
	ua: navigator.userAgent.toLowerCase(),
	pluginType: "",
	fv: [0,0],
	foList: [],
		
	create: function(FO, id) {
		if (!UFO.uaHas("w3cdom") || UFO.uaHas("ieMac")) return;
		UFO.getFlashVersion();
		UFO.foList[id] = UFO.updateFO(FO);
		UFO.createCSS("#" + id, "visibility:hidden;");
		UFO.domLoad(id);
	},

	updateFO: function(FO) {
		if (typeof FO.xi != "undefined" && FO.xi == "true") {
			if (typeof FO.ximovie == "undefined") FO.ximovie = UFO.ximovie;
			if (typeof FO.xiwidth == "undefined") FO.xiwidth = UFO.xiwidth;
			if (typeof FO.xiheight == "undefined") FO.xiheight = UFO.xiheight;
		}
		FO.mainCalled = false;
		return FO;
	},

	domLoad: function(id) {
		var _t = setInterval(function() {
			if ((document.getElementsByTagName("body")[0] != null || document.body != null) && document.getElementById(id) != null) {
				UFO.main(id);
				clearInterval(_t);
			}
		}, 4500);
		if (typeof document.addEventListener != "undefined") {
			document.addEventListener("DOMContentLoaded", function() { UFO.main(id); clearInterval(_t); } , null); // Gecko, Opera 9+
		}
	},

	main: function(id) {
		var _fo = UFO.foList[id];
		if (_fo.mainCalled) return;
		UFO.foList[id].mainCalled = true;
		document.getElementById(id).style.visibility = "hidden";
		if (UFO.hasRequired(id)) {
			if (UFO.hasFlashVersion(parseInt(_fo.majorversion, 10), parseInt(_fo.build, 10))) {
				if (typeof _fo.setcontainercss != "undefined" && _fo.setcontainercss == "true") UFO.setContainerCSS(id);
				UFO.writeSWF(id);
			}
			else if (_fo.xi == "true" && UFO.hasFlashVersion(6, 65)) {
				UFO.createDialog(id);
			}
		}
		document.getElementById(id).style.visibility = "visible";
	},
	
	createCSS: function(selector, declaration) {
		var _h = document.getElementsByTagName("head")[0]; 
		var _s = UFO.createElement("style");
		if (!UFO.uaHas("ieWin")) _s.appendChild(document.createTextNode(selector + " {" + declaration + "}")); // bugs in IE/Win
		_s.setAttribute("type", "text/css");
		_s.setAttribute("media", "screen"); 
		_h.appendChild(_s);
		if (UFO.uaHas("ieWin") && document.styleSheets && document.styleSheets.length > 0) {
			var _ls = document.styleSheets[document.styleSheets.length - 1];
			if (typeof _ls.addRule == "object") _ls.addRule(selector, declaration);
		}
	},
	
	setContainerCSS: function(id) {
		var _fo = UFO.foList[id];
		var _w = /%/.test(_fo.width) ? "" : "px";
		var _h = /%/.test(_fo.height) ? "" : "px";
		UFO.createCSS("#" + id, "width:" + _fo.width + _w +"; height:" + _fo.height + _h +";");
		if (_fo.width == "100%") {
			UFO.createCSS("body", "margin-left:0; margin-right:0; padding-left:0; padding-right:0;");
		}
		if (_fo.height == "100%") {
			UFO.createCSS("html", "height:100%; overflow:hidden;");
			UFO.createCSS("body", "margin-top:0; margin-bottom:0; padding-top:0; padding-bottom:0; height:100%;");
		}
	},

	createElement: function(el) {
		return (UFO.uaHas("xml") && typeof document.createElementNS != "undefined") ?  document.createElementNS("http://www.w3.org/1999/xhtml", el) : document.createElement(el);
	},

	createObjParam: function(el, aName, aValue) {
		var _p = UFO.createElement("param");
		_p.setAttribute("name", aName);	
		_p.setAttribute("value", aValue);
		el.appendChild(_p);
	},

	uaHas: function(ft) {
		var _u = UFO.ua;
		switch(ft) {
			case "w3cdom":
				return (typeof document.getElementById != "undefined" && typeof document.getElementsByTagName != "undefined" && (typeof document.createElement != "undefined" || typeof document.createElementNS != "undefined"));
			case "xml":
				var _m = document.getElementsByTagName("meta");
				var _l = _m.length;
				for (var i = 0; i < _l; i++) {
					if (/content-type/i.test(_m[i].getAttribute("http-equiv")) && /xml/i.test(_m[i].getAttribute("content"))) return true;
				}
				return false;
			case "ieMac":
				return /msie/.test(_u) && !/opera/.test(_u) && /mac/.test(_u);
			case "ieWin":
				return /msie/.test(_u) && !/opera/.test(_u) && /win/.test(_u);
			case "gecko":
				return /gecko/.test(_u) && !/applewebkit/.test(_u);
			case "opera":
				return /opera/.test(_u);
			case "safari":
				return /applewebkit/.test(_u);
			default:
				return false;
		}
	},
	
	getFlashVersion: function() {
		if (UFO.fv[0] != 0) return;  
		if (navigator.plugins && typeof navigator.plugins["Shockwave Flash"] == "object") {
			UFO.pluginType = "npapi";
			var _d = navigator.plugins["Shockwave Flash"].description;
			if (typeof _d != "undefined") {
				_d = _d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
				var _m = parseInt(_d.replace(/^(.*)\..*$/, "$1"), 10);
				var _r = /r/.test(_d) ? parseInt(_d.replace(/^.*r(.*)$/, "$1"), 10) : 0;
				UFO.fv = [_m, _r];
			}
		}
		else if (window.ActiveXObject) {
			UFO.pluginType = "ax";
			try { // avoid fp 6 crashes
				var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
			}
			catch(e) {
				try { 
					var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
					UFO.fv = [6, 0];
					_a.AllowScriptAccess = "always"; // throws if fp < 6.47 
				}
				catch(e) {
					if (UFO.fv[0] == 6) return;
				}
				try {
					var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
				}
				catch(e) {}
			}
			if (typeof _a == "object") {
				var _d = _a.GetVariable("$version"); // bugs in fp 6.21/6.23
				if (typeof _d != "undefined") {
					_d = _d.replace(/^\S+\s+(.*)$/, "$1").split(",");
					UFO.fv = [parseInt(_d[0], 10), parseInt(_d[2], 10)];
				}
			}
		}
	},

	hasRequired: function(id) {
		var _l = UFO.req.length;
		for (var i = 0; i < _l; i++) {
			if (typeof UFO.foList[id][UFO.req[i]] == "undefined") return false;
		}
		return true;
	},
	
	hasFlashVersion: function(major, release) {
		return (UFO.fv[0] > major || (UFO.fv[0] == major && UFO.fv[1] >= release)) ? true : false;
	},

	writeSWF: function(id) {
		var _fo = UFO.foList[id];
		var _e = document.getElementById(id);
		if (UFO.pluginType == "npapi") {
			if (UFO.uaHas("gecko") || UFO.uaHas("xml")) {
				while(_e.hasChildNodes()) {
					_e.removeChild(_e.firstChild);
				}
				var _obj = UFO.createElement("object");
				_obj.setAttribute("type", "application/x-shockwave-flash");
				_obj.setAttribute("data", _fo.movie);
				_obj.setAttribute("width", _fo.width);
				_obj.setAttribute("height", _fo.height);
				var _l = UFO.optAtt.length;
				for (var i = 0; i < _l; i++) {
					if (typeof _fo[UFO.optAtt[i]] != "undefined") _obj.setAttribute(UFO.optAtt[i], _fo[UFO.optAtt[i]]);
				}
				var _o = UFO.opt.concat(UFO.optExc);
				var _l = _o.length;
				for (var i = 0; i < _l; i++) {
					if (typeof _fo[_o[i]] != "undefined") UFO.createObjParam(_obj, _o[i], _fo[_o[i]]);
				}
				_e.appendChild(_obj);
			}
			else {
				var _emb = "";
				var _o = UFO.opt.concat(UFO.optAtt).concat(UFO.optExc);
				var _l = _o.length;
				for (var i = 0; i < _l; i++) {
					if (typeof _fo[_o[i]] != "undefined") _emb += ' ' + _o[i] + '="' + _fo[_o[i]] + '"';
				}
				_e.innerHTML = '<embed type="application/x-shockwave-flash" src="' + _fo.movie + '" width="' + _fo.width + '" height="' + _fo.height + '" pluginspage="http://www.macromedia.com/go/getflashplayer"' + _emb + '></embed>';
			}
		}
		else if (UFO.pluginType == "ax") {
			var _objAtt = "";
			var _l = UFO.optAtt.length;
			for (var i = 0; i < _l; i++) {
				if (typeof _fo[UFO.optAtt[i]] != "undefined") _objAtt += ' ' + UFO.optAtt[i] + '="' + _fo[UFO.optAtt[i]] + '"';
			}
			var _objPar = "";
			var _l = UFO.opt.length;
			for (var i = 0; i < _l; i++) {
				if (typeof _fo[UFO.opt[i]] != "undefined") _objPar += '<param name="' + UFO.opt[i] + '" value="' + _fo[UFO.opt[i]] + '" />';
			}
			var _p = window.location.protocol == "https:" ? "https:" : "http:";
			_e.innerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + _objAtt + ' width="' + _fo.width + '" height="' + _fo.height + '" codebase="' + _p + '//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + _fo.majorversion + ',0,' + _fo.build + ',0"> <param name="wmode" value="transparent" /><param name="movie" value="' + _fo.movie + '" />' + _objPar + '</object>';
		}
	},
		
	createDialog: function(id) {
		var _fo = UFO.foList[id];
		UFO.createCSS("html", "height:100%; overflow:hidden;");
		UFO.createCSS("body", "height:100%; overflow:hidden;");
		UFO.createCSS("#xi-con", "position:absolute; left:0; top:0; z-index:1000; width:100%; height:100%; background-color:#fff; filter:alpha(opacity:75); opacity:0.75;");
		UFO.createCSS("#xi-dia", "position:absolute; left:50%; top:50%; margin-left: -" + Math.round(parseInt(_fo.xiwidth, 10) / 2) + "px; margin-top: -" + Math.round(parseInt(_fo.xiheight, 10) / 2) + "px; width:" + _fo.xiwidth + "px; height:" + _fo.xiheight + "px;");
		var _b = document.getElementsByTagName("body")[0];
		var _c = UFO.createElement("div");
		_c.setAttribute("id", "xi-con");
		var _d = UFO.createElement("div");
		_d.setAttribute("id", "xi-dia");
		_c.appendChild(_d);
		_b.appendChild(_c);
		var _mmu = window.location;
		if (UFO.uaHas("xml") && UFO.uaHas("safari")) {
			var _mmd = document.getElementsByTagName("title")[0].firstChild.nodeValue = document.getElementsByTagName("title")[0].firstChild.nodeValue.slice(0, 47) + " - Flash Player Installation";
		}
		else {
			var _mmd = document.title = document.title.slice(0, 47) + " - Flash Player Installation";
		}
		var _mmp = UFO.pluginType == "ax" ? "ActiveX" : "PlugIn";
		var _uc = typeof _fo.xiurlcancel != "undefined" ? "&xiUrlCancel=" + _fo.xiurlcancel : "";
		var _uf = typeof _fo.xiurlfailed != "undefined" ? "&xiUrlFailed=" + _fo.xiurlfailed : "";
		UFO.foList["xi-dia"] = { movie:_fo.ximovie, width:_fo.xiwidth, height:_fo.xiheight, majorversion:"6", build:"65", flashvars:"MMredirectURL=" + _mmu + "&MMplayerType=" + _mmp + "&MMdoctitle=" + _mmd + _uc + _uf };
		UFO.writeSWF("xi-dia");
	},

	expressInstallCallback: function() {
		var _b = document.getElementsByTagName("body")[0];
		var _c = document.getElementById("xi-con");
		_b.removeChild(_c);
		UFO.createCSS("body", "height:auto; overflow:auto;");
		UFO.createCSS("html", "height:auto; overflow:auto;");
	},

	cleanupIELeaks: function() {
		var _o = document.getElementsByTagName("object");
		var _l = _o.length
		for (var i = 0; i < _l; i++) {
			_o[i].style.display = "none";
			for (var x in _o[i]) {
				if (typeof _o[i][x] == "function") {
					_o[i][x] = null;
				}
			}
		}
	}

};

if (typeof window.attachEvent != "undefined" && UFO.uaHas("ieWin")) {
	window.attachEvent("onunload", UFO.cleanupIELeaks.closure(window));
}

﻿// JScript File

function generatePlayer (id, file, size, extension, autostart)
{
  var width;
  var height;
  
  if (size=="small")
    { 
      width = "170px";
      height = "145px";
    }
  
  if (size=="large")
  {
    width = "504px";
    height = "375px";
  }

  if (size == "fullwidth")
  {
    width = "924px";
    height = "740px";
  }
  
  if (size=="audio")
  {
    width = "100%";
    height = "20px";
  }
  
  if (size=="slideshow")
  {
    width = "260px";
    height = "190px";
  }
  
  var FO = { movie:"/flvplayer.swf",width:width,height:height,majorversion:"7",build:"0",bgcolor:"#FFFFFF",flashvars:"file=/_services/AssetServer.ashx/" 
             + file + "?player-workaround=." + extension + "&amp;overstretch=fit&amp;showdigits=false&amp;showicons=false&amp;"
             + "autostart=" + autostart + "&amp;showfsbutton=true&amp;repeat=false" };
  UFO.create(	FO, "flvPlayer" + id);
}

﻿
var Events = {

  // CREATING AN EVENT

  deleteRole: function(el)
  {
    var rolesBox = document.getElementById('rolesBox');
    rolesBox.removeChild(el);
    return;
  },
    
  addRole: function()
  {
    var rolesBox = document.getElementById('rolesBox');
    var divs = rolesBox.getElementsByTagName('div');
    var newRole = null;
    
    for (var i = divs.length - 1; i >= 0; i--) {
      if (divs[i].className == "role") {
        newRole = divs[i].cloneNode(true);
        break;
      }
    }
    
    var oldId = parseInt(newRole.id.replace("role",""));
    var title = newRole.getElementsByTagName('div')[0];
    var roleName = newRole.getElementsByTagName('input')[0];
    var selects = newRole.getElementsByTagName('select');
    
    newRole.id = newRole.id.replace(oldId, oldId+1);
    title.innerHTML = title.innerHTML.replace(oldId, oldId+1);
    newRole.getElementsByTagName('input')[0].value = '';
    roleName.name = roleName.name.replace(oldId, oldId+1);
    
    for (var i = 0; i < selects.length; i++)
    {
      var s = selects[i];
      s.name = s.name.replace("role"+oldId, "role"+parseInt(oldId+1));
      s.selectedIndex = 0;
    }
    
    rolesBox.appendChild(newRole);
    return;
  },
  
  selectPrivacy: function(el)
  {
    var type = el.value;
    var rb = document.getElementById('rolesBox');
    var smb = document.getElementById('sendMailBox');
    switch (type)
    {
      case "open":
        if (!Spif.ClassNameAbstraction.contains(rb, "hidePeople"))
          Spif.ClassNameAbstraction.add(rb, "hidePeople");
        if (!Spif.ClassNameAbstraction.contains(smb, "hide"))
          Spif.ClassNameAbstraction.add(smb, "hide");
        smb.getElementsByTagName('input')[0].checked = false;
        break;  
      case "group":
        Spif.ClassNameAbstraction.remove(rb, "hidePeople");
        Spif.ClassNameAbstraction.remove(smb, "hide");
        break;
    }
  },
    
  toggleSignupDate: function()
  {
    var signupDates = document.getElementById('signupDates');
    if (Spif.ClassNameAbstraction.contains(signupDates, "hideSignupDate"))
      Spif.ClassNameAbstraction.remove(signupDates, "hideSignupDate");
    else
      Spif.ClassNameAbstraction.add(signupDates, "hideSignupDate");
  },
  
  cleanRoleName: function(el)
  {
    el.value = el.value.replace(/[;\|,]/g,"");
  },
  
  
  
  // FOR THE ACTUAL EVENT PAGE
  registerUser: function(activityId)
  {
    var signupDefault = document.getElementById('signupDefault');
    var specificRole = document.getElementById('specificRole');
    var signupSpecific = document.getElementById('signupSpecific');
    var role = "";
    
    if (signupDefault != null && signupDefault.checked)
      role = signupDefault.value;
    else if (signupSpecific != null && signupSpecific.checked)
      role = specificRole.value;
      
    if (role == "")
    {
      alert("Je moet een rol selecteren om je in te schrijven.");
      return;
    }
    
    proxies.ActivityManager.RegisterUser(activityId, role);
    Events.refreshPage();
  },
  
  unregisterUser: function(activityId)
  {
    proxies.ActivityManager.UnregisterUser(activityId);
    Events.refreshPage();
  },
  
  toggleShowSignups: function(bool, activityId)
  {
    proxies.ActivityManager.toggleShowSignups(bool, activityId);
  },
  
  saveChanges: function(activityId)
  {
    var newRoleId = document.getElementById('newRole').value;
    if (newRoleId == "")
    {
      alert("U moet een rol selecteren.");
      return false;
    }
    
    proxies.ActivityManager.updateRole(newRoleId, activityId);
    Events.refreshPage();
  },
  
  toggleComp: function(compId, activityId, el)
  {
    var username = el.parentNode.parentNode.getElementsByTagName('td')[0].innerHTML;
    compId = compId.replace(compId.substring(0, compId.indexOf("_") + 1), "").replace("comp","");
    proxies.ActivityManager.toggleComp(compId, username, activityId, el.checked);    
  },
  
  setSignupSpecific : function ()
  {
    document.getElementById("signupSpecific").checked = true;
  },
  
  refreshPage: function()
  {
    window.location.href = window.location.href;
    window.location.reload();
  },
  
  sendActivityMail: function()
  {
    var activityId = document.getElementById('activityId').innerHTML;
    var subject = document.getElementById('activityEmailTitle').value;
    var body = document.getElementById('activityEmailBody').value;
    
    proxies.ActivityManager.EmailParticipants(activityId, subject, body);
    
    alert("De ingeschreven bewoners zijn op de hoogte gebracht.");
    dialog.toggleActivityMailDialog(false);
  },
  
  saveActivity: function()
  {
    var activityId = document.getElementById('activityId').innerHTML;
  
    var startDateDay = document.getElementById('startDateDay').value;
    var startDateMonth = document.getElementById('startDateMonth').value;
    var startDateYear = document.getElementById('startDateYear').value;
    var startTimeHour = document.getElementById('startTimeHour').value;
    var startTimeMinute = document.getElementById('startTimeMinute').value;
    var endDateDay = document.getElementById('endDateDay').value;
    var endDateMonth = document.getElementById('endDateMonth').value;
    var endDateYear = document.getElementById('endDateYear').value;
    var endTimeHour = document.getElementById('endTimeHour').value;
    var endTimeMinute = document.getElementById('endTimeMinute').value;
    var signupDateDay = document.getElementById('signupDateDay').value;
    var signupDateMonth = document.getElementById('signupDateMonth').value;
    var signupDateYear = document.getElementById('signupDateYear').value;
  
    var roleUpdates = [];
    var roles = document.getElementById('activityEditRoles');
    var inputs = roles.getElementsByTagName('input');
    for (var i = 0; i < inputs.length; i++)
    {
      var input = inputs[i];
      if (input.value == "")
      {
        alert("U kunt geen rollen van een lege naam voorzien.\nVul a.u.b. een naam in voor alle rollen.");
        return false;
      }
      roleUpdates.push("id=" + input.name.replace("role_","") + ";value=" + input.value);
    }
    
    proxies.ActivityManager.saveActivity(
      activityId,
      startDateDay, startDateMonth, startDateYear, startTimeHour, startTimeMinute,
      endDateDay, endDateMonth, endDateYear, endTimeHour, endTimeMinute,
      signupDateDay, signupDateMonth, signupDateYear,
      roleUpdates.join("|")
    );
    
    alert("De wijzigingen zijn opgeslagen.");
    Events.refreshPage();
    
  },
  
  // for adding a new role to an existing event from within the edit activity popup
  addNewRole: function()
  {
    var activityId = document.getElementById('activityId').innerHTML;
    var newName = document.getElementById('activityAddRoleName').value;
    var comp1 = document.getElementById('activityAddRoleComp1').value;
    var comp2 = document.getElementById('activityAddRoleComp2').value;
    var comp3 = document.getElementById('activityAddRoleComp3').value;
    var privacy = document.getElementById('activityPrivacy').innerHTML;
    var group = document.getElementById('activityAddRoleUserSelect');
    
    if (newName == '')
    {
      alert('U moet een naam voor de rol selecteren.');
      return;
    }
    
    if (privacy == 'group' && group.value == '')
    {
      alert('U moet een persoon of groep uitnodigen.');
      return;
    }
    
    proxies.ActivityManager.addNewRole(activityId, newName, comp1, comp2, comp3, group);
    
    alert("De rol '" + newName + "' is toegevoegd.");
    window.location.href = window.location.href;
  }
  
  
};
﻿$(document).ready(function () {
    if (EDITMODE) {
        $(".miniComponentEdit").bind("click", function (evt) {
            $(evt.target).miniEditor({ editorType: 'component' });
        });

        $(".miniComponentTitleEdit").bind("click", function (evt) {
            $(evt.target).miniEditor({ editorType: 'componentTitle' });
        });

        $(".miniPageTitleEdit").bind("click", function (evt) {
            $(evt.target).miniEditor({ editorType: 'pageTitle' });
        });

        $(".miniSubPageTitleEdit").bind("click", function (evt) {
            $(evt.target).miniEditor({ editorType: 'pageTitle', cssclass: 'subPageTitle' });
        });

        $(".miniActivityTitleEdit").bind("click", function (evt) {
            $(evt.target).miniEditor({ editorType: 'eventTitle' });
        });

        $(".miniActivityDetailsEdit").bind("click", function (evt) {
            $(evt.target).miniEditor({ editorType: 'eventDetails' });
        });
    }
});

(function ($) {
    $.fn.miniEditor = function (options) {
        var defaults = {
            editorType: "component",
            cssclass: "",
            autosave: false // save automatically
        };
        var options = $.extend(defaults, options);
        var miniEditor;
        var miniView;

        return this.each(function () {
            initialize(this);
        });

        function initialize(element) {
            $miniView = $(element);

            if (EDITMODE) {
                if (options.editorType == "location" || options.editorType == "eventDetails") {
                    $miniEditor = $("<textarea type='text' class='miniEditor' name='miniEditor' rows='3'></textarea>");
                }
                else {
                    $miniEditor = $("<input type='text' class='miniEditor' name='miniEditor'></input>");
                }
                $miniEditor.val("");
                $miniView.hide();
                $miniEditor.attr("name", $miniView.attr("name"));
                $miniEditor.addClass(options.cssclass);
                $miniEditor.insertAfter($miniView);

                $miniEditor.show();
                $miniEditor.focus().val($miniView.html());
            }


            $(".miniEditor").unbind('blur');
            $(".miniEditor").unbind('keydown');

            $(".miniEditor").bind("blur keydown", function (evt) {
                if (evt.type == "blur" || (evt.type == "keydown" && evt.keyCode == '13')) 
                {
                    var result;
                    switch (options.editorType) {
                        case "location":
                            result = saveLocation($(evt.target).attr("name"), $(evt.target).val());
                            break;
                        case "component":
                            result = save($(evt.target).attr("name"), $(evt.target).val());
                            break;
                        case "componentTitle":
                            result = saveComponentTitle($(evt.target).attr("name"), $(evt.target).val());
                            break;
                        case "pageTitle":
                            result = savePageTitle($(evt.target).attr("name"), $(evt.target).val());
                            break;
                        case "eventTitle":
                            result = saveEventTitle($(evt.target).attr("name"), $(evt.target).val());
                            break;
                        case "eventDetails":
                            result = saveEventDetails($(evt.target).attr("name"), $(evt.target).val());
                            break;
                    }

                    if (result == "success") {
                        $(evt.target).prev().html($(evt.target).val());
                        $(evt.target).hide();
                        $(evt.target).prev().show();
                        $(evt.target).remove();
                    }
                    else {
                        //i know thats not good way to show error. We must to do that.
                        alert("De veranderingen zijn niet goed opgeslagen.\nProbeer het nog een keer.\nDetail: " + result);
                    }
                }
            });
        }

        function save(componentId, content) {
            return proxies.EditMode.SaveComponent(componentId, content, "title");
        }

        function saveEventTitle(componentId, title) {
            return proxies.EditMode.SaveEvent(componentId, title, "title");
        }

        function saveEventDetails(componentId, details) {
            return proxies.EditMode.SaveEvent(componentId, details, "details");
        }

        function saveLocation(locationId, title) {
            return proxies.Maps.SaveLocationTitle(locationId, title);
        }

        function saveComponentTitle(componentId, title) {
            return proxies.EditMode.SaveComponentTitle(componentId, title);
        }

        function savePageTitle(pageId, title) {
            return proxies.EditMode.ChangeTitleOfPage(pageId, title);
        }
    };
})(jQuery);
﻿jQuery(function ($) {

  $('.twitterwidget').each(function (i, o) {
    var component = $(o);

    /* CALLBACK */
    window["twitterCallback" + i] = function (json) {
      var box = component.find('.twitterResultBox');
      var json = (json.results != null) ? json.results : json;
      if (json) {
        box.empty();

        if (!json.length) {
          box.html("<p>Er zijn geen recente tweets over dit onderwerp.</p>");
        } else {
          for (var i = 0; i < json.length; ++i) {
            var html = convertToTweet(json[i]);

            box.append(html);
          }
        }
      }
    };

    /* CALL */
    var itemsPerPage = component.find(".twitterResultBox .itemsPerPage").val();
    var searchKey = component.find(".twitterResultBox .searchKey").val();
    var callback = "twitterCallback" + i;

    if (!$("body").hasClass("editMode"))
      initTweets(itemsPerPage, searchKey, callback);
  });
});


function initTweets(count, userOrTag, callback) {

  var firstChar = userOrTag.substr(0, 1);
  if (count < 3 || count > 5)
    count = 3;

  if (firstChar == "#") {
    var q = "%23" + userOrTag.replace("#", "");
    var url = "http://search.twitter.com/search.json?q=" + q + "&rpp=" + count + "&result_type=recent&callback=" + callback;
  }
  else if (firstChar == "@") {
    var q = userOrTag.replace("@", "");
    var url = "http://api.twitter.com/1/statuses/user_timeline.json?screen_name=" + q + "&count=" + (count * 1) + "&callback=" + callback;
  } else {
    return;
  }

  $.getScript(url);
}


$(document).ready(function () {

  /*SAVE EDITMODE*/
  $(".tweetSettings .saveTweetSettings").bind("click", function (evt) {
    var el = $(this)

    var componentId = el.parents(".twitterwidget").attr("id");
    var num = $(".settings-" + componentId + " .tweetNum").val();
    var userOrTag = $(".settings-" + componentId + " .userOrTag").val();
    var result = proxies.EditMode.SaveTwitterSettings(componentId, num, userOrTag);

    if (result != "")
      alert(result);
    else {
      $(".settings-" + componentId + " .statusInfo").fadeIn(300).delay(3000).fadeOut(300);
    }
  });

});

/* HELPERS */
function convertToTweet(jsonItem) {
  var when = Date.parse(jsonItem.created_at);
  if (when) {
    var now = Date.now ? Date.now() : new Date;
    var diff = Math.floor((now - when) / 1000);
    if (diff < 60) when = Math.floor(diff) + " seconden geleden";
    else if (Math.floor(diff / 60) < 60) when = "ongeveer " + Math.floor(diff / 60) + " minuten geleden";
    else if (Math.floor(diff / 60 / 60) < 24) when = "ongeveer " + Math.floor(diff / 60 / 60) + " uur geleden";
    else if (Math.floor(diff / 60 / 60 / 24) == 1) when = "ongeveer 1 dag geleden";
    else when = "ongeveer " + Math.floor(diff / 60 / 60 / 24) + " dagen geleden";
  } else {
    "Een tijdje geleden";
  }

  if (isNaN(when)) {
    when = "";
  }

  var photo = (jsonItem.user != null) ? jsonItem.user.profile_image_url : jsonItem.profile_image_url;
  var user = (jsonItem.user != null) ? jsonItem.user.screen_name : jsonItem.from_user;
  var text = jsonItem.text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
  text = Linkify(text);

  var html = ' <div class="tweet">' +
                '<img src="' + photo + '" alt="avatar" />' +
                '<p class="text">@' + user + " " + text + '</p>' +
                '<p class="when"> ' + when + ' </p>' +
              '</div>';

  return html;
}

function Linkify(text) {
  text = text.replace(/(https?:\/\/\S+)/gi, function (s) {
    return '<a href="' + s + '">' + s + '</a>';
  });

  text = text.replace(/(^|)@(\w+)/gi, function (s) {
    return '<a href="http://twitter.com/' + s + '">' + s + '</a>';
  });

  text = text.replace(/(^|)#(\w+)/gi, function (s) {
    return '<a href="http://search.twitter.com/search?q=' + s.replace(/#/, '%23') + '">' + s + '</a>';
  });
  return text;
}

